openapi-generators / openapi-generators/openapi-python-client
`Input should be a valid string` for integer keys in openapi.yaml
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 293
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
Describe the bug
When generating classes from openapi.yaml with integers as keys (e.g. 200), I get the error:
paths./api/events.get.responses.200.[key]
Input should be a valid string [type=string_type, input_value=200, input_type=int]
For further information visit https://errors.pydantic.dev/2.12/v/string_type
Is there a chance to ignore those errors and fall back to string for integer keys?
OpenAPI Spec File
Link to an OpenAPI document
Desktop (please complete the following information):
- OS: macOS 26.0.1
- Python Version: 13.3
- openapi-python-client version: 0.26.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the linked openapi.yaml and openapi-python-client 0.26.2, focusing on the response key at paths./api/events.get.responses.200. The work is done when integer keys are accepted during class generation and treated as strings instead of producing the Pydantic validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100