Skip to content

Commit 2991377

Browse files
Alan-ChaErikWittern
authored andcommitted
Add equivalentToMessages
Signed-off-by: Alan Cha <[email protected]>
1 parent 3d02955 commit 2991377

24 files changed

+343
-95
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ Options:
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
2929
-f, --fillEmptyResponses create placeholder schemas for operations with HTTP status code 204 (no response) rather than ignore them
30-
-a, --addLimitArgument add a limit argument on fields returning lists of objects/lists that will constrain the list size
30+
-a, --addLimitArgument add 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
3434
--no-extensions do not add extentions, containing information about failed REST calls, to the GraphQL errors objects
35+
--no-equivalentToMessages do not append information about the underlying REST operations to the description of fields
3536
--save <file path> save schema to path and do not start server
3637
-h, --help output usage information
3738
```

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

Lines changed: 3 additions & 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/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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ program
4949
'--no-extensions',
5050
'do not add extentions, containing information about failed REST calls, to the GraphQL errors objects'
5151
)
52+
.option(
53+
'--no-equivalentToMessages',
54+
'do not append information about the underlying REST operations to the description of fields'
55+
)
5256
.option('--save <file path>', 'save schema to path and do not start server')
5357
.parse(process.argv)
5458

@@ -162,7 +166,8 @@ function startGraphQLServer(oas, port) {
162166
baseUrl: program.url,
163167
operationIdFieldNames: program.operationIdFieldNames,
164168
provideErrorExtensions: program.extensions,
165-
addLimitArgument: program.addLimitArgument
169+
addLimitArgument: program.addLimitArgument,
170+
equivalentToMessages: program.equivalentToMessages
166171
})
167172
.then(({ schema, report }) => {
168173
console.log(JSON.stringify(report, null, 2))

packages/openapi-to-graphql/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ The options object can contain the following properties:
166166

167167
- `addLimitArgument` (type: `boolean`, default: `false`): Add a `limit` argument to fields returning lists of objects/lists that will limit the number of returned elements, selecting the first `n` elements of the list.
168168

169+
- `equivalentToMessages` (type: `boolean`, default: `true`): Append a small message to the description of a field that clarifies the operation the field will trigger. The message will take the form of `Equivalent to {title of OAS} {method in ALL_CAPS} {path}` (the [title](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#infoObject) will only appear if multiple OASs are provided). Messages will appear for query/mutation fields as well as for fields created by links. _Note: These messages may unintentionally leak information about the underlying REST API._
170+
169171
Consider this example of passing options:
170172

171173
```javascript

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

Lines changed: 7 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)