diff --git a/.github/ISSUE_TEMPLATE/2-AMA-SDK-ISSUE-FORM.yaml b/.github/ISSUE_TEMPLATE/2-AMA-SDK-ISSUE-FORM.yaml index d00439c332..865f6aec5c 100644 --- a/.github/ISSUE_TEMPLATE/2-AMA-SDK-ISSUE-FORM.yaml +++ b/.github/ISSUE_TEMPLATE/2-AMA-SDK-ISSUE-FORM.yaml @@ -17,7 +17,7 @@ body: core, create, schematics, - showcase-sdk + showcase-sdk, swagger-builder ] validations: diff --git a/docs/api-sdk/COMPOSITION_INHERITANCE.md b/docs/api-sdk/COMPOSITION_INHERITANCE.md index 0d758ddc60..50d6ad624a 100644 --- a/docs/api-sdk/COMPOSITION_INHERITANCE.md +++ b/docs/api-sdk/COMPOSITION_INHERITANCE.md @@ -62,7 +62,7 @@ export interface ExtendedErrorModel { The addition of a discriminator allows a hierarchy between the models and the possibility to identify which child class a model can be casted into. -For example, let's consider a Pet object and its two class child Cat and Dog: +For example, let's consider a Pet object and its two child classes Cat and Dog: ```yaml components: diff --git a/docs/api-sdk/ISSUES_AND_WORKAROUNDS.md b/docs/api-sdk/ISSUES_AND_WORKAROUNDS.md new file mode 100644 index 0000000000..5fa7ee4bec --- /dev/null +++ b/docs/api-sdk/ISSUES_AND_WORKAROUNDS.md @@ -0,0 +1,41 @@ +# Issues and workarounds + +## `properties` for `allOf` instruction + +Currently, using `properties` along with the `allOf` instruction is not supported by the SDK generator. For instance, it can incorrectly handle `enum` generation. + +```yaml +Dog: + allOf: + - $ref: '#/components/schemas/Pet' + properties: + bark: + type: boolean + breed: + type: string + enum: [Dingo, Husky, Retriever, Shepherd] +``` + +It will not generate the `breed` enum. + +As a workaround, you can pass the properties as an object to the `allOf` array as follows: + +```yaml +Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + bark: + type: boolean + breed: + type: string + enum: [Dingo, Husky, Retriever, Shepherd] +``` + +This will generate: +```typescript +export type BreedEnum = 'Dingo' | 'Husky' | 'Retriever' | 'Shepherd'; +``` + +The issue is tracked via https://github.com/AmadeusITGroup/otter/issues/3017.