Skip to content

Allow passing prepared objects instead of array definition #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 28, 2019

Conversation

SilverFire
Copy link
Contributor

@SilverFire SilverFire commented May 28, 2019

Before this pull request I was able to write only

new Server([ 
    'url' => "{protocol}://$host/",
    'variables' => [
        'protocol' => [
            'enum' => ['http', 'https'],
            'default' => 'https', 
        ],
    ],
])

It's could be enough, but when it comes to more complex code, I would like to write something like that to be more verbose on what is going on inside my object:

new Server([ 
    'url' => "{protocol}://$host/",
    'variables' => [
        'protocol' => new ServerVariable([
            'enum' => ['http', 'https'],
            'default' => 'https',
        ]),
    ],
])

This pull request enhances library so it respects the passed object.

@cebe cebe added the enhancement New feature or request label May 28, 2019
Copy link
Owner

@cebe cebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition! See my comments above, we should make overall behavior consistent if incorrect type of object is passed.

Also I'd like to have 3 unit tests:

  • one that checks the behavior for a subclass of SpecBaseObject
  • one for Paths
  • one for Responses

@cebe cebe added this to the 1.1 milestone May 28, 2019
@cebe cebe modified the milestones: 1.1, 1.2 Jun 21, 2019
@SilverFire
Copy link
Contributor Author

Hi, Carsten! I've added a test that covers SpecBaseObject, Paths and PathItem behavior at once.

cebe added 2 commits June 28, 2019 14:52
* origin/master:
  API Spec -> API Description
  Added support for $ref in PathItem Objects
@cebe cebe self-assigned this Jun 28, 2019
@cebe cebe merged commit 0943eba into cebe:master Jun 28, 2019
@cebe
Copy link
Owner

cebe commented Jun 28, 2019

Merged, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants