Skip to content

Adds extra validation tests for Parameters #53

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
Mar 6, 2020
Merged

Conversation

lezhnev74
Copy link
Contributor

@lezhnev74 lezhnev74 commented Jan 9, 2020

Why this PR is here.
I am working on validation for incoming HTTP requests, containing serialized parameters: thephpleague/openapi-psr7-validator#2

It looks like this package should be responsible for validating serialization styles defined in the specifications. It should prevent wrong styles chosen. So the abovementioned package can safely rely on the specification to use a correct style for deserialization.

New tests in ParameterTest.php:

  • testItValidatesSchemaAndContentCombination checks that both "content" and "schema" cannot be present
  • testItValidatesSupportedSerializationStyles checks that only certain serialization styles supported for each Parameter type.
  • testItValidatesContentCanHaveOnlySingleKey enforces this rule:
    image

- "testItValidatesSchemaAndContentCombination" checks that both "content" and "schema" cannot be present
- "testItValidatesSupportedSerializationStyles" checks that only certain serialization styles supported for each Parameter type.
@lezhnev74
Copy link
Contributor Author

I am not sure why the CI failed...

'header' => ['simple'],
'cookie' => ['form'],
];
if (! in_array($this->style, $supportedSerializationStyles[$this->in])) {
Copy link
Owner

Choose a reason for hiding this comment

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

$supportedSerializationStyles[$this->in] may not be set. An isset() check should be made before this.

lezhnev74 and others added 2 commits March 6, 2020 21:55
Co-Authored-By: Carsten Brandt <[email protected]>
Co-Authored-By: Carsten Brandt <[email protected]>
@cebe cebe added the enhancement New feature or request label Mar 6, 2020
@cebe cebe added this to the 1.4 milestone Mar 6, 2020
@cebe cebe merged commit a958873 into cebe:master Mar 6, 2020
@cebe
Copy link
Owner

cebe commented Mar 6, 2020

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