@@ -18,15 +18,25 @@ program
18
18
. version ( require ( '../package.json' ) . version )
19
19
. usage ( '<OAS JSON file path(s) and/or remote url(s)> [options]' )
20
20
. arguments ( '<path(s) and/or url(s)>' )
21
+ . option (
22
+ '-s, --strict' ,
23
+ 'throw an error if OpenAPI-to-GraphQL cannot run without compensating for errors or missing data in the OAS'
24
+ )
25
+ . option ( '--save <file path>' , 'save schema to path and do not start server' )
26
+
27
+ // Resolver options
21
28
. option (
22
29
'-p, --port <port>' ,
23
30
'select the port where the server will start' ,
24
31
parseInt
25
32
)
26
33
. option ( '-u, --url <url>' , 'select the base url which paths will be built on' )
34
+ . option ( '--cors' , 'enable Cross-origin resource sharing (CORS)' )
35
+
36
+ // Schema options
27
37
. option (
28
- '-s , --strict ' ,
29
- 'throw an error if OpenAPI-to-GraphQL cannot run without compensating for errors or missing data in the OAS '
38
+ '-o , --operationIdFieldNames ' ,
39
+ 'create field names based on the operationId '
30
40
)
31
41
. option (
32
42
'-f, --fillEmptyResponses' ,
@@ -36,15 +46,14 @@ program
36
46
'-a, --addLimitArgument' ,
37
47
'add a limit argument on fields returning lists of objects/lists to control the data size'
38
48
)
39
- . option (
40
- '-o, --operationIdFieldNames' ,
41
- 'create field names based on the operationId'
42
- )
43
- . option ( '--cors' , 'enable Cross-origin resource sharing (CORS)' )
49
+
50
+ // Authentication options
44
51
. option (
45
52
'--no-viewer' ,
46
53
'do not create GraphQL viewer objects for passing authentication credentials'
47
54
)
55
+
56
+ // Logging options
48
57
. option (
49
58
'--no-extensions' ,
50
59
'do not add extentions, containing information about failed REST calls, to the GraphQL errors objects'
@@ -53,7 +62,6 @@ program
53
62
'--no-equivalentToMessages' ,
54
63
'do not append information about the underlying REST operations to the description of fields'
55
64
)
56
- . option ( '--save <file path>' , 'save schema to path and do not start server' )
57
65
. parse ( process . argv )
58
66
59
67
// Select the port on which to host the GraphQL server
@@ -161,12 +169,20 @@ function startGraphQLServer(oas, port) {
161
169
// Create GraphQL interface
162
170
createGraphQlSchema ( oas , {
163
171
strict : program . strict ,
164
- viewer : program . viewer ,
165
- fillEmptyResponses : program . fillEmptyResponses ,
172
+
173
+ // Resolver options
166
174
baseUrl : program . url ,
175
+
176
+ // Schema options
167
177
operationIdFieldNames : program . operationIdFieldNames ,
168
- provideErrorExtensions : program . extensions ,
178
+ fillEmptyResponses : program . fillEmptyResponses ,
169
179
addLimitArgument : program . addLimitArgument ,
180
+
181
+ // Authentication options
182
+ viewer : program . viewer ,
183
+
184
+ // Logging options
185
+ provideErrorExtensions : program . extensions ,
170
186
equivalentToMessages : program . equivalentToMessages
171
187
} )
172
188
. then ( ( { schema, report } ) => {
0 commit comments