File tree Expand file tree Collapse file tree
modules/openapi-generator/src
main/resources/typescript-fetch
test/resources/3_0/typescript-fetch Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{ {#hasImports} }
2- { {#imports } }
2+ { {#oneOfModels } }
33import type { {{{.} }} } from './{ {.} }{ {importFileExtension} }';
44import {
55 instanceOf{{{.} }},
66 { {{.} }}FromJSON,
77 { {{.} }}FromJSONTyped,
88 { {{.} }}ToJSON,
99} from './{ {.} }{ {importFileExtension} }';
10- { {/imports } }
10+ { {/oneOfModels } }
1111
1212{ {/hasImports} }
1313{ {> modelOneOfInterfaces} }
Original file line number Diff line number Diff line change @@ -25,6 +25,16 @@ paths:
2525 application/json :
2626 schema :
2727 $ref : ' #/components/schemas/TestArrayResponse'
28+ /test-discriminator :
29+ get :
30+ operationId : testDiscriminator
31+ responses :
32+ 200 :
33+ description : OK
34+ content :
35+ application/json :
36+ schema :
37+ $ref : ' #/components/schemas/TestDiscriminatorResponse'
2838components :
2939 schemas :
3040 TestArrayResponse :
@@ -38,6 +48,15 @@ components:
3848 - type : array
3949 items :
4050 type : string
51+ TestDiscriminatorResponse :
52+ discriminator :
53+ propertyName : discriminatorField
54+ mapping :
55+ optionOne : " #/components/schemas/OptionOne"
56+ optionTwo : " #/components/schemas/OptionTwo"
57+ oneOf :
58+ - $ref : " #/components/schemas/OptionOne"
59+ - $ref : " #/components/schemas/OptionTwo"
4160 TestResponse :
4261 oneOf :
4362 - $ref : " #/components/schemas/TestA"
@@ -56,4 +75,22 @@ components:
5675 bar :
5776 type : string
5877 required :
59- - bar
78+ - bar
79+ OptionOne :
80+ type : object
81+ properties :
82+ discriminatorField :
83+ enum :
84+ - " optionOne"
85+ type : string
86+ required :
87+ - discriminatorField
88+ OptionTwo :
89+ type : object
90+ properties :
91+ discriminatorField :
92+ enum :
93+ - " optionTwo"
94+ type : string
95+ required :
96+ - discriminatorField
You can’t perform that action at this time.
0 commit comments