swagger-api / swagger-api/swagger-parser
Discriminator property is not validated
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
Accordingly with the OpenAPI spec when you define a discriminator the name should be in the schema and must be required:
discriminator | string | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the
requiredproperty list. When used, the value MUST be the name of this schema or any schema that inherits it.
Should this trigger a parse error?
Acceptance criteria
- Parser should fail (at least warn) if the above criteria is not fulfilled
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
The issue does not name a source file or test. Start by locating the parser's discriminator validation entry point and review the OpenAPI requirements quoted here; done means an invalid discriminator causes at least a warning or parse failure, with coverage for a missing schema property and a missing required entry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100