-
Notifications
You must be signed in to change notification settings - Fork 92
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
allOf is not properly merged #31
Comments
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. |
I believe the resolved reference should include both the
When I tried to use https://github.com/lezhnev74/openapi-psr7-validator it gave me errors with any schema that used |
The purpose of |
ping @lezhnev74 |
Hey! Ok, this looks like a problem with resolving references. Let me try to write a failing test first. |
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. $schema = $validator->getSchema();
$allOf = $schema->paths['/ref']->post->responses['200']->content['application/json']->schema->allOf;
var_dump($allOf[0]->properties['age']->type); // "integer"
var_dump($allOf[1]->properties['name']->type); // "string" |
@cebe as I understand, one can resolve references manually like this: use cebe\openapi\Reader;
use cebe\openapi\ReferenceContext;
use function realpath;
$filePath = "./schema.yaml";
$schema = Reader::readFromYamlFile($filePath);
$schema->resolveReferences(new ReferenceContext($schema, realpath($filePath))); |
Lines 93 to 100 in 13b9175
|
Hi, version 1.3.0 fixes a lot of issues with references, please try if this is solved by the changes. |
Closing this issue for now, please comment if the issue persists. I'll reopen it then. |
@cebe We're still seeing this issue.
You can see the attached issue here: hotmeteor/spectator#38 |
@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? |
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 |
still not really sure what this is about. Could someone come up with a failing test case for this? |
Given a schema that uses
allOf
to combine two differentobject
schemas, the properties of the two schemas are not combined:Not 100% sure that schema validates, but it should be a good start.
The text was updated successfully, but these errors were encountered: