swagger-api / swagger-api/swagger-parser
Add Unmangled Discriminator Property Name to Discriminator Class
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
The Discriminator class contains some information to inform how deserialization should occur, given the property name and the mapping to subclasses I would expect to be able to dispatch appropriately.
Unfortunately the propertyName property is mangled before it is passed to the template generation, so for example in the python client generator, a property of petSpecies is only available as pet_species. If you then want to use this property to fetch data from the API response, you need to guess what the original form of the property name was.
It would be very helpful if the Discriminator class also stored the original, unmangled, property name. This would make the class actually useful for the purpose of dispatching to subclasses whilst deserializing responses.
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 with the Discriminator class and trace where its propertyName is transformed before template generation, particularly along the Python client generator path described in the issue. Determine how the original property name can be retained alongside the mangled value. Done means the Discriminator exposes the unmangled name for deserialization dispatch without losing the existing mapped value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100