File tree Expand file tree Collapse file tree 4 files changed +92
-0
lines changed
packages/openapi-ts-tests
3.0.x/discriminator-all-of
3.1.x/discriminator-all-of Expand file tree Collapse file tree 4 files changed +92
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,26 @@ export type QuxMapped = FooMapped & {
44
44
qux ?: boolean ;
45
45
} ;
46
46
47
+ export type FooUnion = ( {
48
+ id : 'bar' ;
49
+ } & BarUnion ) | ( {
50
+ id : 'baz' ;
51
+ } & BazUnion ) ;
52
+
53
+ export type BarUnion = {
54
+ id ?: string ;
55
+ bar ?: string ;
56
+ } ;
57
+
58
+ export type BazUnion = {
59
+ id ?: string ;
60
+ baz ?: string ;
61
+ } ;
62
+
63
+ export type QuxExtend = FooUnion & {
64
+ id ?: 'QuxExtend' ;
65
+ } ;
66
+
47
67
export type ClientOptions = {
48
68
baseUrl : `${string } ://${string } ` | ( string & { } ) ;
49
69
} ;
Original file line number Diff line number Diff line change @@ -44,6 +44,26 @@ export type QuxMapped = FooMapped & {
44
44
qux ?: boolean ;
45
45
} ;
46
46
47
+ export type FooUnion = ( {
48
+ id : 'bar' ;
49
+ } & BarUnion ) | ( {
50
+ id : 'baz' ;
51
+ } & BazUnion ) ;
52
+
53
+ export type BarUnion = {
54
+ id ?: string ;
55
+ bar ?: string ;
56
+ } ;
57
+
58
+ export type BazUnion = {
59
+ id ?: string ;
60
+ baz ?: string ;
61
+ } ;
62
+
63
+ export type QuxExtend = FooUnion & {
64
+ id ?: 'QuxExtend' ;
65
+ } ;
66
+
47
67
export type ClientOptions = {
48
68
baseUrl : `${string } ://${string } ` | ( string & { } ) ;
49
69
} ;
Original file line number Diff line number Diff line change @@ -67,3 +67,29 @@ components:
67
67
properties :
68
68
qux :
69
69
type : boolean
70
+ FooUnion :
71
+ oneOf :
72
+ - $ref : ' #/components/schemas/BarUnion'
73
+ - $ref : ' #/components/schemas/BazUnion'
74
+ discriminator :
75
+ propertyName : id
76
+ mapping :
77
+ bar : ' #/components/schemas/BarUnion'
78
+ baz : ' #/components/schemas/BazUnion'
79
+ BarUnion :
80
+ type : object
81
+ properties :
82
+ id :
83
+ type : string
84
+ bar :
85
+ type : string
86
+ BazUnion :
87
+ type : object
88
+ properties :
89
+ id :
90
+ type : string
91
+ baz :
92
+ type : string
93
+ QuxExtend : # this is a schema that extends the FooUnion schema
94
+ allOf :
95
+ - $ref : ' #/components/schemas/FooUnion'
Original file line number Diff line number Diff line change @@ -67,3 +67,29 @@ components:
67
67
properties :
68
68
qux :
69
69
type : boolean
70
+ FooUnion :
71
+ oneOf :
72
+ - $ref : ' #/components/schemas/BarUnion'
73
+ - $ref : ' #/components/schemas/BazUnion'
74
+ discriminator :
75
+ propertyName : id
76
+ mapping :
77
+ bar : ' #/components/schemas/BarUnion'
78
+ baz : ' #/components/schemas/BazUnion'
79
+ BarUnion :
80
+ type : object
81
+ properties :
82
+ id :
83
+ type : string
84
+ bar :
85
+ type : string
86
+ BazUnion :
87
+ type : object
88
+ properties :
89
+ id :
90
+ type : string
91
+ baz :
92
+ type : string
93
+ QuxExtend : # this is a schema that extends the FooUnion schema
94
+ allOf :
95
+ - $ref : ' #/components/schemas/FooUnion'
You can’t perform that action at this time.
0 commit comments