Skip to content
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

Fix HeadersValidator for parameters with content #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pboos
Copy link

@pboos pboos commented Feb 23, 2024

Headers can also have content instead of schema the same as other parameters (see OpenAPI Specification here).
This is handled correctly in other parameters but seems to have gotten missing in the HeadersValidator. For example see the ArrayValidator [link], which uses the same code line as I updated the HeaderValidator to.

Without this change it causes an exception:

TypeError: League\OpenAPIValidation\Schema\SchemaValidator::validate(): Argument #2 ($schema) must be of type cebe\openapi\spec\Schema, null given, called in ***/vendor/league/openapi-psr7-validator/src/PSR7/Validators/HeadersValidator.php on line 44

@pboos pboos marked this pull request as ready for review February 23, 2024 08:32
@pboos
Copy link
Author

pboos commented Mar 19, 2024

@scaytrase would be great if this could be merged as we are encountering this problem at @ GetYourGuide.

@oliviersorine
Copy link

I encounter the same issue on my project and found the same fix, it would be great if this PR is validated !

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

Successfully merging this pull request may close these issues.

2 participants