-
Notifications
You must be signed in to change notification settings - Fork 43
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
docs(api-sdk): enums specific properties use-case #3013
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit a453146.
☁️ Nx Cloud last updated this comment at |
e613d8e
to
e0b7c14
Compare
@@ -147,6 +147,43 @@ export function revivePet<T extends Pet = Pet>(data: any): undefined | T | Cat | | |||
> The discriminator needs to be of enum type as the string format would be too generic to map the accepted | |||
> value to the supported models. | |||
|
|||
### Enum specific properties | |||
|
|||
If the a specific property is of type enum, make sure to explicitly declare the type object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect to always have the type object for allOf elements that are not ref
We discovered the issue concerning enum but maybe there are others
https://swagger.io/docs/specification/v3_0/data-models/oneof-anyof-allof-not/#allof
looking at there documentation they always specify the type object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you check on https://editor.swagger.io/
it seems that
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
is not even valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed the indent in the docs.
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
is valid.
@@ -147,6 +147,43 @@ export function revivePet<T extends Pet = Pet>(data: any): undefined | T | Cat | | |||
> The discriminator needs to be of enum type as the string format would be too generic to map the accepted | |||
> value to the supported models. | |||
|
|||
### Enum specific properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not reduce the case to enums.
I wonder if it would not make more sense to have a file dedicated to cases that we do not support but have a workaround.
Here it is mainly the properties to a allOf
instruction.
e0b7c14
to
d3d8fb9
Compare
5d62964
to
b9000cb
Compare
b9000cb
to
a453146
Compare
export type BreedEnum = 'Dingo' | 'Husky' | 'Retriever' | 'Shepherd'; | ||
``` | ||
|
||
The issue is tracked via https://github.com/AmadeusITGroup/otter/issues/3017. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is tracked via https://github.com/AmadeusITGroup/otter/issues/3017. | |
> [!INFO] | |
> The issue is tracked via https://github.com/AmadeusITGroup/otter/issues/3017. |
Proposed change
Related issues
allOf
#2832