-
Notifications
You must be signed in to change notification settings - Fork 62
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
Discriminator object refers to missing property #243
Comments
According to https://spec.openapis.org/oas/v3.1.0#fixed-fields-20,
|
The conversion mechanism should add the Also related #240. Here the spec contradicts itself by providing the following example where Pet does not have any/all/one of but has a discriminator node. I do think we should ignore this directive from the spec as if you follow it, the only way to implement inheritance + discriminator + mapping would be to have the discriminator field defined on each derived type AND have the mapping entry containing the derived type it's defined on, which would be both redundant, and make for a complex guessing game when looking at the base type. What do you think @darrelmiller ? components:
schemas:
Pet:
type: object
required:
- petType
properties:
petType:
type: string
discriminator:
propertyName: petType
mapping:
dog: Dog
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Cat`
properties:
name:
type: string
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Dog`
properties:
bark:
type: string
Lizard:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Lizard`
properties:
lovesRocks:
type: boolean |
+1 |
So to recap for implementers to have clarity on the changes required by this issue:
(and the OpenAPI lib will be fixed to properly validate the inheritance structure instead of looking only at the current schema) |
Additionally, after some more thinking, could we also take that opportunity to set a default value for the odata.type property to the actual odata type? i.e. |
Latest update of the conversion library includes adding some discriminator mappings to the openApi document. Possibly related to changes fixing #233
Taking a look at the previous description of the
apiAuthenticationConfigurationBase
And the new description
The discriminator mapping mentions the propertyName
@odata.type
but the property collection (this instance has no properties) does not contain the property@odata.type
.This leads to validation errors as described in microsoft/kiota#1668.
The conversion library should probably make sure the property exists before adding the mapping.
The text was updated successfully, but these errors were encountered: