File tree Expand file tree Collapse file tree 7 files changed +181
-8
lines changed Expand file tree Collapse file tree 7 files changed +181
-8
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,11 @@ export function nodeType(obj: any): SchemaObjectType {
151
151
return "enum" ;
152
152
}
153
153
154
+ // Treat any node with allOf/ anyOf/ oneOf as object
155
+ if ( obj . hasOwnProperty ( "allOf" ) || obj . hasOwnProperty ( "anyOf" ) || obj . hasOwnProperty ( "oneOf" ) ) {
156
+ return "object" ;
157
+ }
158
+
154
159
// boolean
155
160
if ( obj . type === "boolean" ) {
156
161
return "boolean" ;
@@ -179,14 +184,7 @@ export function nodeType(obj: any): SchemaObjectType {
179
184
}
180
185
181
186
// object
182
- if (
183
- obj . type === "object" ||
184
- obj . hasOwnProperty ( "allOf" ) ||
185
- obj . hasOwnProperty ( "anyOf" ) ||
186
- obj . hasOwnProperty ( "oneOf" ) ||
187
- obj . hasOwnProperty ( "properties" ) ||
188
- obj . hasOwnProperty ( "additionalProperties" )
189
- ) {
187
+ if ( obj . type === "object" || obj . hasOwnProperty ( "properties" ) || obj . hasOwnProperty ( "additionalProperties" ) ) {
190
188
return "object" ;
191
189
}
192
190
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ '/test' : {
8
+ get : {
9
+ responses : {
10
+ /** A list of types. */
11
+ 200 : unknown
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ export interface components {
18
+ schemas : {
19
+ /** @description Object with one property that is a string enum */
20
+ Example : {
21
+ status ?: components [ 'schemas' ] [ 'ExampleStatus' ] & { [ key : string ] : unknown }
22
+ } & { [ key : string ] : unknown }
23
+ /** @enum {string} */
24
+ ExampleStatus : 'ACTIVE' | 'INACTIVE'
25
+ }
26
+ }
27
+
28
+ export interface operations { }
29
+
30
+ export interface external { }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export type paths = {
7
+ '/test' : {
8
+ get : {
9
+ responses : {
10
+ /** A list of types. */
11
+ 200 : unknown
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ export type components = {
18
+ schemas : {
19
+ /** @description Object with one property that is a string enum */
20
+ Example : {
21
+ status ?: components [ 'schemas' ] [ 'ExampleStatus' ]
22
+ }
23
+ /** @enum {string} */
24
+ ExampleStatus : 'ACTIVE' | 'INACTIVE'
25
+ }
26
+ }
27
+
28
+ export type operations = { }
29
+
30
+ export type external = { }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ readonly '/test' : {
8
+ readonly get : {
9
+ readonly responses : {
10
+ /** A list of types. */
11
+ readonly 200 : unknown
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ export interface components {
18
+ readonly schemas : {
19
+ /** @description Object with one property that is a string enum */
20
+ readonly Example : {
21
+ readonly status ?: components [ 'schemas' ] [ 'ExampleStatus' ]
22
+ }
23
+ /** @enum {string} */
24
+ readonly ExampleStatus : 'ACTIVE' | 'INACTIVE'
25
+ }
26
+ }
27
+
28
+ export interface operations { }
29
+
30
+ export interface external { }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ '/test' : {
8
+ get : {
9
+ responses : {
10
+ /** A list of types. */
11
+ 200 : unknown
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ export interface components {
18
+ schemas : {
19
+ /** @description Object with one property that is a string enum */
20
+ Example : {
21
+ status ?: components [ 'schemas' ] [ 'ExampleStatus' ]
22
+ }
23
+ /** @enum {string} */
24
+ ExampleStatus : 'ACTIVE' | 'INACTIVE'
25
+ }
26
+ }
27
+
28
+ export interface operations { }
29
+
30
+ export interface external { }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ '/test' : {
8
+ get : {
9
+ responses : {
10
+ /** A list of types. */
11
+ 200 : unknown
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ export interface components {
18
+ schemas : {
19
+ /** @description Object with one property that is a string enum */
20
+ Example : {
21
+ status ?: components [ 'schemas' ] [ 'ExampleStatus' ]
22
+ }
23
+ /** @enum {string} */
24
+ ExampleStatus : 'ACTIVE' | 'INACTIVE'
25
+ }
26
+ }
27
+
28
+ export interface operations { }
29
+
30
+ export interface external { }
Original file line number Diff line number Diff line change
1
+ openapi : 3.0
2
+ paths :
3
+ /test :
4
+ get :
5
+ tags :
6
+ - test
7
+ summary : " Just a test path"
8
+ responses :
9
+ 200 :
10
+ description : A list of types.
11
+ components :
12
+ schemas :
13
+ Example :
14
+ description : Object with one property that is a string enum
15
+ type : object
16
+ properties :
17
+ status :
18
+ type : string
19
+ allOf :
20
+ - $ref : ' #/components/schemas/ExampleStatus'
21
+ ExampleStatus :
22
+ type : string
23
+ enum :
24
+ - ACTIVE
25
+ - INACTIVE
You can’t perform that action at this time.
0 commit comments