Skip to content

[Enhancement] Add discriminator support #156

@sserrata

Description

@sserrata

Carried over from #154

Is your feature request related to a problem?

Currently there is no support for handling discriminators. Moreover, discriminator $ref pointers don't adhere to JSON Schema specification and are thus not resolved by our parser/resolver. This means we will need to resolve discriminator $ref pointers on-demand.

Describe the solution you'd like

  • Implement support for discriminators.
  • Render schema mappings at the same level as the property we're applying the discriminator to (may necessitate a new UI component or setting the marginLeft to "-2.4rem")
  • Leverage the OpenAPIParser class byRef() method to resolve $ref pointers. (Will require instantiating and passing a parser instance for each spec we read in)

Describe alternatives you've considered

Explored using oneOf in place of discriminator but it renders the schema as a child of the property which does not satisfy the requirements.

Additional context

ReDocly has a group write up on this and their ReDoc demo demonstrates the correct implementation: https://redocly.com/docs/resources/discriminator/

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed and we are accepting pull requests from anyone willing to take this on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions