-
Notifications
You must be signed in to change notification settings - Fork 8
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
OpenAPI v3 Specification errors #18
Comments
There may have been a breaking change in Pydantic that has caused this issue. I'll see if I can investigate at some point! Thanks! |
I have this issue as well and can't figure out what exactly needs to change. The problem happens when you use nested Pydantic models. The nested model gets defined inside the parent model and Swagger isn't happy with that: class NestedModel(BaseModel):
name: str
class ParentModel(BaseModel):
message: str
data: NestedModel Generates this when used as the response model in "components": {
"schemas": {
"ParentModel": {
"$defs": { <----- Swagger doesn't seem to accept
"NestedModel": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
},
"required": [
"name",
],
"title": "NestedModel",
"type": "object"
}
},
"properties": {
"message": {
"title": "Message",
"type": "string"
},
"data": {
"$ref": "#/components/schemas/NestedModel", <----- Invalid
"default": null
}
},
"required": [
"message"
],
"title": "ParentModel",
"type": "object"
},
} Did you come up with any workarounds by any chance @luis199230 ? |
Here's a fix: #22 |
I installed the following libraries
chalice==1.28.0
apispec==6.3.0
chalice_spec==0.6.0
pydantic==2.0.3
My initialization code is this:
my CodeSchema:
my CodesResponse:
When I validate in https://validator.swagger.io/validator/debug my url
I find this error:
I was researching and I realized in OpenAPI v3 not support that reference and I would like to know if possible to solve from your side or apisec side?
The text was updated successfully, but these errors were encountered: