File tree 10 files changed +581
-16
lines changed
test-data/param-generator/golden-files
10 files changed +581
-16
lines changed Original file line number Diff line number Diff line change 1
1
# Open API Lambda Connector Changelog
2
2
3
+ ## Unreleased
4
+
5
+ - Fix param parsing of ` anyOf ` , ` allOf ` and ` oneOf ` ([ #83 ] ( https://github.com/hasura/ndc-open-api-lambda/pull/83 ) )
6
+
7
+
3
8
## [[ 1.5.0] ( https://github.com/hasura/ndc-open-api-lambda/releases/tag/v1.5.0 )] 2025-03-07
4
9
5
10
- Update NDC NodeJS Lambda to ` v1.11.0 ` [ #80 ] ( https://github.com/hasura/ndc-open-api-lambda/pull/80 )
Original file line number Diff line number Diff line change @@ -164,6 +164,24 @@ const tests: {
164
164
goldenFile : "./golden-files/trello" ,
165
165
baseUrl : "" ,
166
166
} ,
167
+ {
168
+ name : "one-of-param-test" ,
169
+ openApiUri : "./open-api-docs/one-of-param-test.json" ,
170
+ goldenFile : "./golden-files/one-of-param-test" ,
171
+ baseUrl : "" ,
172
+ } ,
173
+ {
174
+ name : "any-of-param-test" ,
175
+ openApiUri : "./open-api-docs/one-of-param-test.json" ,
176
+ goldenFile : "./golden-files/one-of-param-test" ,
177
+ baseUrl : "" ,
178
+ } ,
179
+ {
180
+ name : "all-of-param-test" ,
181
+ openApiUri : "./open-api-docs/one-of-param-test.json" ,
182
+ goldenFile : "./golden-files/one-of-param-test" ,
183
+ baseUrl : "" ,
184
+ } ,
167
185
] ;
168
186
169
187
describe ( "functions-ts-generator" , async ( ) => {
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -143,7 +143,12 @@ export function schemaIsTypeScalar(schema: any): schema is SchemaTypeScalar {
143
143
return (
144
144
schema . type &&
145
145
Object . values ( ScalarTypeEnum ) . includes ( schema . type ) &&
146
- schema . properties === undefined
146
+ ! schemaIsTypeObject ( schema ) &&
147
+ ! schemaIsTypeRef ( schema ) &&
148
+ ! schemaIsTypeArray ( schema ) &&
149
+ ! schemaIsTypeAnyOf ( schema ) &&
150
+ ! schemaIsTypeOneOf ( schema ) &&
151
+ ! schemaIsTypeAllOf ( schema )
147
152
) ;
148
153
}
149
154
Original file line number Diff line number Diff line change
1
+ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
2
+ import { Api } from "./api";
3
+
4
+ const api = new Api({
5
+ baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
6
+ });
7
+
8
+ /**
9
+ * Get total
10
+ * @request GET :/total
11
+ * @allowrelaxedtypes
12
+ * @readonly
13
+ */
14
+ export async function getTotalTotalList(
15
+ query: {
16
+ content?: {
17
+ /** Depending of resurce, use different content params */
18
+ inner_content?: { fields?: { include?: string[] } } & {
19
+ expand?: { all?: hasuraSdk.JSONValue; false?: hasuraSdk.JSONValue };
20
+ } & {
21
+ structure?: {
22
+ /** Possible have empty object, or different parent or child combinations */
23
+ tree?: hasuraSdk.JSONValue;
24
+ };
25
+ };
26
+ };
27
+ },
28
+ headers?: hasuraSdk.JSONValue,
29
+ ): Promise<{
30
+ total?: number;
31
+ }> {
32
+ const result = await api.total.totalList({
33
+ query: query,
34
+ params: {
35
+ headers: (headers?.value as Record<string, string>) ?? undefined,
36
+ },
37
+ });
38
+ if (result.data) {
39
+ return result.data;
40
+ } else {
41
+ throw result.error;
42
+ }
43
+ }
Original file line number Diff line number Diff line change
1
+ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
2
+ import { Api } from "./api";
3
+
4
+ const api = new Api({
5
+ baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
6
+ });
7
+
8
+ /**
9
+ * Get total
10
+ * @request GET :/total
11
+ * @allowrelaxedtypes
12
+ * @readonly
13
+ */
14
+ export async function getTotalTotalList(
15
+ query: {
16
+ content?: {
17
+ /** Depending of resurce, use different content params */
18
+ inner_content?:
19
+ | { fields?: { include?: string[] } }
20
+ | {
21
+ expand?: { all?: hasuraSdk.JSONValue; false?: hasuraSdk.JSONValue };
22
+ }
23
+ | {
24
+ structure?: {
25
+ /** Possible have empty object, or different parent or child combinations */
26
+ tree?: hasuraSdk.JSONValue;
27
+ };
28
+ };
29
+ };
30
+ },
31
+ headers?: hasuraSdk.JSONValue,
32
+ ): Promise<{
33
+ total?: number;
34
+ }> {
35
+ const result = await api.total.totalList({
36
+ query: query,
37
+ params: {
38
+ headers: (headers?.value as Record<string, string>) ?? undefined,
39
+ },
40
+ });
41
+ if (result.data) {
42
+ return result.data;
43
+ } else {
44
+ throw result.error;
45
+ }
46
+ }
Original file line number Diff line number Diff line change
1
+ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
2
+ import { Api } from "./api";
3
+
4
+ const api = new Api({
5
+ baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
6
+ });
7
+
8
+ /**
9
+ * Get total
10
+ * @request GET :/total
11
+ * @allowrelaxedtypes
12
+ * @readonly
13
+ */
14
+ export async function getTotalTotalList(
15
+ query: {
16
+ content?: {
17
+ /** Depending of resurce, use different content params */
18
+ inner_content?:
19
+ | { fields?: { include?: string[] } }
20
+ | {
21
+ expand?: { all?: hasuraSdk.JSONValue; false?: hasuraSdk.JSONValue };
22
+ }
23
+ | {
24
+ structure?: {
25
+ /** Possible have empty object, or different parent or child combinations */
26
+ tree?: hasuraSdk.JSONValue;
27
+ };
28
+ };
29
+ };
30
+ },
31
+ headers?: hasuraSdk.JSONValue,
32
+ ): Promise<{
33
+ total?: number;
34
+ }> {
35
+ const result = await api.total.totalList({
36
+ query: query,
37
+ params: {
38
+ headers: (headers?.value as Record<string, string>) ?? undefined,
39
+ },
40
+ });
41
+ if (result.data) {
42
+ return result.data;
43
+ } else {
44
+ throw result.error;
45
+ }
46
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" : " 3.0.3" ,
3
+ "info" : {},
4
+ "servers" : [],
5
+ "security" : [],
6
+ "paths" : {
7
+ "/total" : {
8
+ "get" : {
9
+ "summary" : " Get total" ,
10
+ "description" : " Get total" ,
11
+ "parameters" : [
12
+ {
13
+ "$ref" : " #/components/parameters/content"
14
+ }
15
+ ],
16
+ "responses" : {
17
+ "200" : {
18
+ "description" : " Get Total" ,
19
+ "content" : {
20
+ "application/json" : {
21
+ "schema" : {
22
+ "type" : " object" ,
23
+ "properties" : {
24
+ "total" : {
25
+ "type" : " integer"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ },
32
+ "400" : {
33
+ "$ref" : " #/components/responses/BadRequestError"
34
+ },
35
+ "401" : {
36
+ "$ref" : " #/components/responses/AuthorizationError"
37
+ },
38
+ "403" : {
39
+ "$ref" : " #/components/responses/ForbiddenError"
40
+ },
41
+ "500" : {
42
+ "$ref" : " #/components/responses/ServerError"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ },
48
+ "components" : {
49
+ "parameters" : {
50
+ "content" : {
51
+ "name" : " content" ,
52
+ "in" : " query" ,
53
+ "required" : false ,
54
+ "example" : " " ,
55
+ "schema" : {
56
+ "type" : " object" ,
57
+ "properties" : {
58
+ "inner_content" : {
59
+ "type" : " object" ,
60
+ "description" : " Depending of resurce, use different content params" ,
61
+ "allOf" : [
62
+ {
63
+ "type" : " object" ,
64
+ "properties" : {
65
+ "fields" : {
66
+ "type" : " object" ,
67
+ "properties" : {
68
+ "include" : {
69
+ "type" : " array" ,
70
+ "items" : {
71
+ "type" : " string"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ },
78
+ {
79
+ "type" : " object" ,
80
+ "properties" : {
81
+ "expand" : {
82
+ "type" : " object" ,
83
+ "properties" : {
84
+ "all" : {
85
+ "type" : " object"
86
+ },
87
+ "false" : {
88
+ "type" : " object"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ },
94
+ {
95
+ "type" : " object" ,
96
+ "properties" : {
97
+ "structure" : {
98
+ "type" : " object" ,
99
+ "properties" : {
100
+ "tree" : {
101
+ "type" : " object" ,
102
+ "description" : " Possible have empty object, or different parent or child combinations"
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ }
112
+ }
113
+ },
114
+ "schemas" : {},
115
+ "securitySchemes" : {},
116
+ "responses" : {
117
+ "BadRequestError" : {
118
+ "description" : " BadRequestError\n "
119
+ },
120
+ "AuthorizationError" : {
121
+ "description" : " AuthorizationError\n "
122
+ },
123
+ "ForbiddenError" : {
124
+ "description" : " ForbiddenError\n "
125
+ },
126
+ "NotFoundError" : {
127
+ "description" : " NotFoundError \n "
128
+ },
129
+ "ServerError" : {
130
+ "description" : " ServerError\n "
131
+ }
132
+ }
133
+ }
134
+ }
You can’t perform that action at this time.
0 commit comments