-
-
Notifications
You must be signed in to change notification settings - Fork 928
fix(openapi): do not use jsonld schema for all media types #4247
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
Conversation
And the JSON node "paths./dummies.get.responses.200.content.application/json" should be equal to: | ||
""" | ||
{ | ||
"schema": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/Dummy" | ||
} | ||
} | ||
} | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step was failing (the schema was the same as jsonld above)
src/JsonSchema/SchemaFactory.php
Outdated
$schema = $schema ?? new Schema(); | ||
$schema = null !== $schema ? clone $schema : new Schema(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$schema ? clone $schema : new Schema()
would work as well right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this comment. Thanks for proposing a suggestion, I've just accepted it
$schema = new Schema('openapi'); | ||
$schema->setDefinitions($schemas); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was added by #4213, not needed anymore
$this->jsonSchemaFactory->buildSchema($resourceClass, $format, $type, $operationType, $operationName, $schema, $serializerContext, $forceCollection); | ||
|
||
return $schema; | ||
return $this->jsonSchemaFactory->buildSchema($resourceClass, $format, $type, $operationType, $operationName, $schema, $serializerContext, $forceCollection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a consequence of the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soyuka: Refs #4215 (comment). I have added a note to the changelog entry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Antoine Bluchet <soyuka@users.noreply.github.com>
Co-authored-by: Antoine Bluchet <soyuka@users.noreply.github.com>
Thank you @guilliamxavier. |
Follows #4213