Skip to content

Commit 2c41dc9

Browse files
Ian BuddenAlan-Cha
Ian Budden
authored andcommitted
Add simpleNames option
Signed-off-by: Alan Cha <[email protected]>
1 parent 894c055 commit 2c41dc9

28 files changed

+735
-207
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Options:
3434
-f, --fillEmptyResponses create placeholder schemas for operations with no response body rather than ignore them
3535
-a, --addLimitArgument add a limit argument on fields returning lists of objects/lists to control the data size
3636
-g, --genericPayloadArgName Sets argument name for the payload of a mutation to 'requestBody'
37+
-N, --simpleNames Only remove illegal characters from names in the OAS and ignore casing and formatting
3738
3839
-H, --header <key:value> add headers to every request; repeatable flag; set using key:value notation (default: [])
3940
-Q, --queryString <key:value> add query parameters to every request; repeatable flag; set using key:value notation (default: [])

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

+4
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

+1-1
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

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ program
5252
)
5353
.option(
5454
'-g, --genericPayloadArgName',
55-
'Sets argument name for the payload of a mutation to \'requestBody\''
55+
"Sets argument name for the payload of a mutation to 'requestBody'"
56+
)
57+
.option(
58+
'-N, --simpleNames',
59+
'Only remove illegal characters from names in the OAS and ignore casing and formatting'
5660
)
5761

5862
// Resolver options
@@ -107,6 +111,7 @@ const options: Options = {
107111
fillEmptyResponses: program.fillEmptyResponses,
108112
addLimitArgument: program.addLimitArgument,
109113
genericPayloadArgName: program.genericPayloadArgName,
114+
simpleNames: program.simpleNames,
110115

111116
// Resolver options
112117
headers,

packages/openapi-to-graphql/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ Schema options:
160160

161161
- `genericPayloadArgName` (type: `boolean`, default: `false`): Set the default argument name for the payload of a mutation to `requestBody`. Otherwise, the name will default to the camelCased pathname.
162162

163+
- `simpleNames` (type: `boolean`, default: `false`): By default, field names are sanitized to conform with GraphQL conventions, i.e. types should be in PascalCase, fields should be in camelCase, and enum values should be in ALL_CAPS. This option will prevent OTG from enforcing camelCase field names and PascalCase type names, only removing illegal characters and staying as true to the provided names in the OAS as possible.
164+
163165
***
164166

165167
Resolver options:

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

+5-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)