Skip to content

Commit fc97761

Browse files
Alan-ChaErikWittern
authored andcommitted
Option fillEmptyResponses affects all
Changes requested in #140 Signed-off-by: Alan Cha <[email protected]>
1 parent 7b9f4a6 commit fc97761

File tree

11 files changed

+24
-28
lines changed

11 files changed

+24
-28
lines changed

packages/openapi-to-graphql-cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Options:
2626
-p, --port <port> select the port where the server will start
2727
-u, --url <url> select the base url which paths will be built on
2828
-s, --strict throw an error if OpenAPI-to-GraphQL cannot run without compensating for errors or missing data in the OAS
29-
-f, --fillEmptyResponses create placeholder schemas for operations with HTTP status code 204 (no response) rather than ignore them
30-
-a, --addLimitArgument add limit argument on fields returning lists of objects/lists to control the data size
29+
-f, --fillEmptyResponses create placeholder schemas for operations with no response body rather than ignore them
30+
-a, --addLimitArgument add a limit argument on fields returning lists of objects/lists to control the data size
3131
-o, --operationIdFieldNames create field names based on the operationId
3232
--cors enable Cross-origin resource sharing (CORS)
3333
--no-viewer do not create GraphQL viewer objects for passing authentication credentials

packages/openapi-to-graphql-cli/lib/openapi-to-graphql.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql-cli/lib/openapi-to-graphql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql-cli/src/openapi-to-graphql.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ program
3030
)
3131
.option(
3232
'-f, --fillEmptyResponses',
33-
'create placeholder schemas for operations with HTTP status code 204 (no response) rather than ignore them'
33+
'create placeholder schemas for operations with no response body rather than ignore them'
3434
)
3535
.option(
3636
'-a, --addLimitArgument',
37-
'add limit argument on fields returning lists of objects/lists to control the data size'
37+
'add a limit argument on fields returning lists of objects/lists to control the data size'
3838
)
3939
.option(
4040
'-o, --operationIdFieldNames',

packages/openapi-to-graphql/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The options object can contain the following properties:
152152

153153
- `tokenJSONpath` (type: `string`, default: `undefined`): Used to pass the [JSONPath](http://goessner.net/articles/JsonPath/) of the OAuth token in the GraphQL context. To see more details, click [here](./README.md#authorization).
154154

155-
- `fillEmptyResponses` (type: `boolean`, default: `false`): OpenAPI-to-GraphQL, by default, will only wrap operations that have a [response schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responsesObject) and operations that do not have a response schema will be ignored. The reason is that all GraphQL objects must have a data structure and in these cases, where the OAS does not define a response schema, the data structure cannot be safely assumed. As a result, it is recommended that the OAS should be modified to include a response schema. However, under certain circumstances, some operations should _not in fact_ have a response schema. One circumstance is HTTP status code 204, in which no content should be returned. The option `fillEmptyResponses` will allow OpenAPI-to-GraphQL to wrap these operations, _specifically ones with the 204 HTTP status code_, by assigning these operations a nullable data structure. Although this data structure is meaningless, the operation will appear in the schema.
155+
- `fillEmptyResponses` (type: `boolean`, default: `false`): OpenAPI-to-GraphQL, by default, will only wrap operations that have a [response schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responsesObject). Therefore, operations that _do not have_ response schemas will be ignored. The reason is that all GraphQL objects must have a data structure and in these cases where the OAS does not define response schemas, the data structures cannot be safely assumed. As a result, it is recommended that the OAS should be modified to include a response schema. However, under certain circumstances, some operations should _not in fact_ have a response schema. One circumstance is HTTP status code 204, in which no content should be returned. The option `fillEmptyResponses` will allow OpenAPI-to-GraphQL to wrap these operations by assigning these operations a nullable data structure. Although this data structure is meaningless, the operation will appear in the schema.
156156

157157
- `baseUrl` (type: `string`): Used to manual specify the base URL which all paths will be built on. Normally, OpenAPI-to-GraphQL will select a base URL from the [server object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#serverObject) defined in the OAS. However, if the server object contains multiple URLs, OpenAPI-to-GraphQL will randomly select one. The purpose of this option is to provide greater control over the base URL in these situations, especially when the OAS cannot be modified. This option may also prove to be useful in testing and development.
158158

packages/openapi-to-graphql/lib/oas_3_tools.js

Lines changed: 5 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql/lib/oas_3_tools.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql/lib/preprocessor.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)