openapi-python-client
openapi-python-client copied to clipboard
field required (type=value_error.missing)
Hi, I'm sure this is related to my project, not to the openapi-python-client, but needed some help. When running the app, I get the following errors:
Error(s) encountered while generating, client was not created
Failed to parse OpenAPI document
50 validation errors for OpenAPI
paths -> /auth/login -> post -> requestBody -> content -> application/x-www-form-urlencoded -> schema -> $ref
field required (type=value_error.missing)
paths -> /auth/login -> post -> requestBody -> content -> application/x-www-form-urlencoded -> schema -> properties -> user -> $ref
field required (type=value_error.missing)
paths -> /auth/login -> post -> requestBody -> content -> application/x-www-form-urlencoded -> schema -> properties -> user -> required
value is not a valid list (type=type_error.list)
paths -> /auth/login -> post -> requestBody -> content -> application/x-www-form-urlencoded -> schema -> properties -> password -> $ref
field required (type=value_error.missing)
paths -> /auth/login -> post -> requestBody -> content -> application/x-www-form-urlencoded -> schema -> properties -> password -> required
....
And here's some of api.yaml file that I'm using:
paths:
/auth/login:
post:
tags:
- Auth
summary: Authenticate with API
description: Authenticate with API getting bearer token
requestBody:
description: Request values
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
user:
description: API user name
type: string
required: true
password:
description: API password
type: string
required: true
required:
- user
- password
Any thoughts on what's wrong?
bump, encountering the same issue.
Did you ever find a fix?
Unfortunately not
This just happened to me with the sentry openapi schema, which is openapi version v3.0.3. I tried to load the schema directly with openapi-pydantic (see here) which worked fine. It seems like openapi-python-client bundles its own version of openapi-pydantic which does not work with v3.0.3. I did a quick and dirty try to replace the included version (in openapi_python_client/schema/) with the latest upstream openapi-pydantic which needed some little adjustments but worked fine overall. @dbanty are there any special reasons for the vendored version?
It needed a bunch of customizations to work the way I needed. It could be that the latest version works much better, but it'd take a lot of validation to be sure