@@ -22,25 +22,26 @@ npm i -g openapi-to-graphql-cli
2222Usage: openapi-to-graphql <OAS JSON file path(s) and/or remote url(s)> [options]
2323
2424Options:
25- -V, --version output the version number
26- -s, --strict throw an error if OpenAPI-to-GraphQL cannot run without compensating for errors or missing data in the OAS
27- --save <file path> save schema to path and do not start server
25+ -V, --version output the version number
26+ -s, --strict throw an error if OpenAPI-to-GraphQL cannot run without compensating for errors or missing data in the OAS
27+ --save <file path> save schema to path and do not start server
2828
29- -p, --port <port> select the port where the server will start
30- -u, --url <url> select the base url which paths will be built on
31- --cors enable Cross-origin resource sharing (CORS)
29+ -p, --port <port> select the port where the server will start
30+ -u, --url <url> select the base url which paths will be built on
31+ --cors enable Cross-origin resource sharing (CORS)
3232
33- -o, --operationIdFieldNames create field names based on the operationId
34- -f, --fillEmptyResponses create placeholder schemas for operations with no response body rather than ignore them
35- -a, --addLimitArgument add a limit argument on fields returning lists of objects/lists to control the data size
33+ -o, --operationIdFieldNames create field names based on the operationId
34+ -f, --fillEmptyResponses create placeholder schemas for operations with no response body rather than ignore them
35+ -a, --addLimitArgument add a limit argument on fields returning lists of objects/lists to control the data size
3636
37- -H, --header <key:value> add headers to every request; repeatable flag; set using key:value notation (default: [])
37+ -H, --header <key:value> add headers to every request; repeatable flag; set using key:value notation (default: [])
38+ -Q, --queryString <key:value> add query parameters to every request; repeatable flag; set using key:value notation (default: [])
3839
39- --no-viewer do not create GraphQL viewer objects for passing authentication credentials
40+ --no-viewer do not create GraphQL viewer objects for passing authentication credentials
4041
41- --no-extensions do not add extentions, containing information about failed REST calls, to the GraphQL errors objects
42- --no-equivalentToMessages do not append information about the underlying REST operations to the description of fields
43- -h, --help output usage information
42+ --no-extensions do not add extentions, containing information about failed REST calls, to the GraphQL errors objects
43+ --no-equivalentToMessages do not append information about the underlying REST operations to the description of fields
44+ -h, --help output usage information
4445```
4546
4647The basic usage of the CLI takes the specified OAS, creates a GraphQL interface for it, and starts a server to host the GraphQL interface.
@@ -73,6 +74,14 @@ openapi-to-graphql oas.json --save schema.graphql
7374
7475---
7576
77+ You can use multiple ` header ` and ` queryString ` to add headers and query strings to the resolvers. Use the syntax: ` {key}:{value} ` .
78+
79+ ``` sh
80+ openapi-to-graphql oas.json -H someHeader:someValue -H anotherHeader:anotherValue -Q " exampleQueryString:This one contains spaces!"
81+ ```
82+
83+ ---
84+
7685To learn more about the other options, please refer [ here] ( https://github.com/IBM/openapi-to-graphql/tree/master/packages/openapi-to-graphql#options ) .
7786
7887Please note that the CLI tool is mainly used for quick testing and does not offer all the features that [ ` createGraphQlSchema(oas, options) ` ] ( https://github.com/IBM/openapi-to-graphql/tree/master/packages/openapi-to-graphql#usage ) does.
0 commit comments