Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/one of support #49

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

z6n9n
Copy link
Contributor

@z6n9n z6n9n commented Apr 27, 2023

What kind of change does this PR introduce? (check at least one)

  • [ X ] Bugfix
  • [ X] Feature
  • [ X ] Test
  • Docs
  • Refactor
  • Build-related changes
  • Other, please describe:

Description: OAS 3 provides support for oneOf with 'discriminator' and the 'example' keywords. Newer AJV versions support this too. This change adds the support for it to the project.

https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/

Unfortunately AJV does not yet support the 'mapping'-property of 'discriminator' as OAS3 does, so I had to remove the mapping from the AJV schema object. Validation support for discriminator is still possible without this mapping property.
See: ajv-validator/ajv#2003

Example OAS Code:

oneOf: //supportet by AJV
  - $ref: '#/components/schemas/Object1'
  - $ref: '#/components/schemas/Object2'
discriminator: //supportet by AJV
  propertyName: objectType //supportet by AJV
  mapping: //NOT yet supportet by AJV
    obj1: '#/components/schemas/Object1'
    obj2: '#/components/schemas/Object2'

@z6n9n
Copy link
Contributor Author

z6n9n commented Apr 27, 2023

after dependency update, test are not anymore supported on node 10 & 12. Node 18 added instead

@sonarcloud
Copy link

sonarcloud bot commented Apr 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant