Skip to content

Commit b83064f

Browse files
Alan-ChaErikWittern
authored andcommitted
Capitalize viewer type names
Signed-off-by: Alan Cha <[email protected]>
1 parent 1c4429c commit b83064f

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

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

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

packages/openapi-to-graphql/lib/auth_builder.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.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/schema_builder.js

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

packages/openapi-to-graphql/lib/schema_builder.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/src/auth_builder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function createAndLoadViewer(
7474
* Check if the name has already been used (i.e. in the list)
7575
* if so, create a new name and add it to the list
7676
*/
77-
let securityType = data.security[protocolName].def.type
77+
const securityType = data.security[protocolName].def.type
7878
let viewerType: string
7979

8080
/**
@@ -136,7 +136,7 @@ export function createAndLoadViewer(
136136
}
137137

138138
// Create name for the AnyAuth viewer
139-
let anyAuthObjectName = !isMutation
139+
const anyAuthObjectName = !isMutation
140140
? 'viewerAnyAuth'
141141
: 'mutationViewerAnyAuth'
142142

@@ -215,7 +215,7 @@ const getViewerOT = (
215215

216216
return {
217217
type: new GraphQLObjectType({
218-
name: name,
218+
name: Oas3Tools.capitalize(name), // Should already be sanitized and in camelCase
219219
description: typeDescription,
220220
fields: () => queryFields
221221
}),
@@ -271,7 +271,7 @@ const getViewerAnyAuthOT = (
271271

272272
return {
273273
type: new GraphQLObjectType({
274-
name: name,
274+
name: Oas3Tools.capitalize(name), // Should already be GraphQL safe
275275
description: 'Warning: Not every request will work with this viewer type',
276276
fields: () => queryFields
277277
}),

packages/openapi-to-graphql/test/example_gql_server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ const openAPIToGraphQL = require('../lib/index')
1414
// const oas = require('./fixtures/example_oas.json')
1515
// const oas2 = require('./fixtures/example_oas2.json')
1616
// const oas3 = require('./fixtures/example_oas3.json')
17-
const oas4 = require('./fixtures/example_oas4.json')
17+
// const oas4 = require('./fixtures/example_oas4.json')
1818

1919
// const oas = require('./fixtures/github.json')
2020
// const oas = require('./fixtures/instagram.json')
2121
// const oas = require('./fixtures/ibm_language_translator.json')
2222
// const oas = require('./fixtures/government_social_work.json')
2323
// const oas = require('./fixtures/weather_underground.json')
24-
// const oas = require('./fixtures/stripe.json')
24+
const oas = require('./fixtures/stripe.json')
2525

2626
// const yamljs = require('yamljs')
2727
// const fs = require('fs')
2828
// // requires Box API from API Guru
2929
// const oas = yamljs.parse(fs.readFileSync('../tmp/APIs/box.com/content/2.0/swagger.yaml', 'utf8'))
3030

3131
openAPIToGraphQL
32-
.createGraphQLSchema(oas4)
32+
.createGraphQLSchema(oas)
3333
.then(({ schema, report }) => {
3434
console.log(JSON.stringify(report, null, 2))
3535

0 commit comments

Comments
 (0)