swagger-api / swagger-api/swagger-parser

Add Unmangled Discriminator Property Name to Discriminator Class

Open
#1,876 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.