swagger-api / swagger-api/swagger-codegen
[python client] can't access fields that reference definition
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
My response contains an enum field (netAccessType in the example below). In the spec, the field is defined via "ref" for reuse purpose. This field is mapped to an empty list in the python object generated by the client instead of a string.
It appears this issue is not enum specific -- other types referenced are also empty.
Here's an example of spec:
...
accessType:
type: string
description: access type
enum:
- public
- private
...
NetworkConfig:
properties:
netAccessType:
$ref : '#/definitions/accessType'
...
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 Python client generation with the issue's NetworkConfig and accessType specification, then trace how referenced properties are handled. Done means referenced fields, including the enum example, are represented with their expected values instead of empty lists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100