-
-
Notifications
You must be signed in to change notification settings - Fork 507
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
Add more test for OpenAPI Specification v3.1 #2353
Conversation
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.
IMO, schema type is missing here.
}, | ||
"components": { | ||
"schemas": { | ||
"ExamplesResponse": { |
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.
"ExamplesResponse": { | |
"ExamplesResponse": { | |
"type": "object", |
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.
@JohnNiang It seems that the current unit test also not include "type": "object"
springdoc-openapi/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app7.json
Lines 37 to 60 in d4f99ac
"ExamplesResponse": { | |
"properties": { | |
"name": { | |
"type": "string", | |
"description": "name", | |
"examples": [ | |
"name" | |
] | |
}, | |
"subject": { | |
"type": "string", | |
"description": "subject", | |
"example":"Hello", | |
"examples": [ | |
"Hello", | |
"World" | |
] | |
} | |
}, | |
"required": [ | |
"name", | |
"subject" | |
] | |
} |
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.
See here: https://spec.openapis.org/oas/v3.1.0#data-types
Data types in the OAS are based on the types supported by the JSON Schema Specification Draft 2020-12.
In JSON Schema Specification Draft 2020-12, "type" field is optional, so this is valid JSON schema.
And the api-gen is done by swagger-core. We can advise swagger-core to provide "type": "object"
.
@uc4w6c Can you review it? |
@xiaoxiangmoe I thought it might be better to combine it with the test code below. |
Thank you for your contribution to the project. |
No description provided.