You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for the report, could you elaborate on how you read the schema and what you expect in the output. I added a test for your Schema (b9eddbd) and as far as I see everything is loaded correctly.
The purpose of php-openapi is to read and write OpenAPI description files as they are, so you get the raw allOf element with its sub-schemas only. For schema validation you need to use other tools (at least now this is not implemented). The validation of the request schema against the API description has to be made by lezhnev74/openapi-psr7-validator which should validate the request based on allOf semantics.
Activity
added test for reading schema with "allOf"
cebe commentedon Jul 30, 2019
Hi, thanks for the report, could you elaborate on how you read the schema and what you expect in the output. I added a test for your Schema (b9eddbd) and as far as I see everything is loaded correctly.
shadowhand commentedon Aug 1, 2019
I believe the resolved reference should include both the
idandnameproperties; something like:When I tried to use https://github.com/lezhnev74/openapi-psr7-validator it gave me errors with any schema that used
allOf, stating that it couldn't find the (combined) properties.cebe commentedon Aug 7, 2019
The purpose of
php-openapiis to read and write OpenAPI description files as they are, so you get the raw allOf element with its sub-schemas only. For schema validation you need to use other tools (at least now this is not implemented). The validation of the request schema against the API description has to be made bylezhnev74/openapi-psr7-validatorwhich should validate the request based on allOf semantics.cebe commentedon Aug 7, 2019
ping @lezhnev74
lezhnev74 commentedon Aug 8, 2019
Hey! Ok, this looks like a problem with resolving references. Let me try to write a failing test first.
lezhnev74 commentedon Aug 8, 2019
I've added this test which validates a response body against a schema with a reference:
The validator builds a schema in the memory and resolves all the references automatically.
You can access resolved schema like this:
lezhnev74 commentedon Aug 8, 2019
@cebe as I understand, one can resolve references manually like this:
cebe commentedon Aug 9, 2019
resolveReferences()is called automatically by default, so the reference should not be a problem:$resolveReferencesparameter defaults to true:php-openapi/src/Reader.php
Lines 93 to 100 in 13b9175
cebe commentedon Oct 28, 2019
Hi, version 1.3.0 fixes a lot of issues with references, please try if this is solved by the changes.
cebe commentedon Feb 28, 2020
Closing this issue for now, please comment if the issue persists. I'll reopen it then.
hotmeteor commentedon Apr 21, 2021
@cebe We're still seeing this issue.
allOfcomponents are not resolving correctly.You can see the attached issue here: hotmeteor/spectator#38
cebe commentedon Apr 23, 2021
@hotmeteor I see hotmeteor/spectator#38 (comment) is closed now, is there still something to fix in cebe/php-openapi or was this only a problem in your tool?
hotmeteor commentedon Apr 23, 2021
No, there's still an issue. I created a workaround in my tool, but I'd prefer to see things merging as expected. This is the example schema that we're testing with: https://github.com/hotmeteor/spectator/blob/master/tests/Fixtures/Components.v1.json
hotmeteor commentedon Jul 24, 2021
@cebe I forgot I had reported this issue, so I had created another ticket here: #120
It can be closed, but it does contain some useful information for testing.
cebe commentedon Oct 13, 2021
still not really sure what this is about. Could someone come up with a failing test case for this?
SOHELAHMED7 commentedon Jan 25, 2025
This issue is fixed in #208
Until merged, this PR can be 'composer required' as documented at https://github.com/php-openapi/yii2-openapi/blob/master/CONTRIBUTING.md#use-pr-of-your-own-fork-of-this-library-in-your-project-to-check-new-changes
Usage: