Skip to content

Commit 4b3e63b

Browse files
committed
Make createGraphQLSchema consistent
Related to #288 Signed-off-by: Alan Cha <[email protected]>
1 parent 1e4fdc0 commit 4b3e63b

23 files changed

+62
-62
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Use OpenAPI-to-GraphQL as a library in your application to generate GraphQL sche
3535
```bash
3636
npm i -s openapi-to-graphql
3737
```
38-
2. Require OpenAPI-to-GraphQL and use the `createGraphQlSchema` function:
38+
2. Require OpenAPI-to-GraphQL and use the `createGraphQLSchema` function:
3939
```javascript
40-
const { createGraphQlSchema } = require("openapi-to-graphql");
40+
const { createGraphQLSchema } = require("openapi-to-graphql");
4141
// load or construct OAS (const oas = ...)
42-
const { schema, report } = await createGraphQlSchema(oas);
42+
const { schema, report } = await createGraphQLSchema(oas);
4343
```
4444

4545
For further details, refer to the [`openapi-to-graphql` documentation](./packages/openapi-to-graphql).

docs/tutorials/watson.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const bodyParser = require('body-parser')
2121
async function startServer () {
2222
// use OpenAPI-to-GraphQL to create a GraphQL schema:
2323
const oas = require('path/to/language-translator-v2.json')
24-
const {schema} = await OTG.createGraphQlSchema(oas)
24+
const {schema} = await OTG.createGraphQLSchema(oas)
2525

2626
// setup Express.js app and serve the schema:
2727
const app = express()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ openapi-to-graphql oas.json -H someHeader:someValue -H anotherHeader:anotherValu
8585

8686
To learn more about the other options, please refer [here](https://github.com/IBM/openapi-to-graphql/tree/master/packages/openapi-to-graphql#options).
8787

88-
Please 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.
88+
Please 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.
8989

9090
## License
9191

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/src/openapi-to-graphql.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as yaml from 'js-yaml'
1010
import { printSchema } from 'graphql'
1111
import { Command } from 'commander'
1212

13-
import { createGraphQlSchema } from 'openapi-to-graphql'
13+
import { createGraphQLSchema } from 'openapi-to-graphql'
1414
import { Oas2 } from 'openapi-to-graphql/lib/types/oas2'
1515
import { Oas3 } from 'openapi-to-graphql/lib/types/oas3'
1616
import { Options } from 'openapi-to-graphql/lib/types/options'
@@ -246,7 +246,7 @@ function startGraphQLServer(
246246
port: number
247247
): void {
248248
// Create GraphQL interface
249-
createGraphQlSchema(oas, options)
249+
createGraphQLSchema(oas, options)
250250
.then(({ schema, report }) => {
251251
console.log(JSON.stringify(report, null, 2))
252252

@@ -281,7 +281,7 @@ function startGraphQLServer(
281281

282282
/**
283283
* saves a grahpQL schema generated by OpenAPI-to-GraphQL to a file
284-
* @param {createGraphQlSchema} schema
284+
* @param {createGraphQLSchema} schema
285285
*/
286286
function writeSchema(schema): void {
287287
fs.writeFile(program.save, printSchema(schema), err => {

packages/openapi-to-graphql/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ Note that [`GraphQL.js`](https://github.com/graphql/graphql-js) is a [peer depen
2525
The basic way to use OpenAPI-to-GraphQL is to pass an OpenAPI Specification (OAS; version 2.0 or 3.0.x) to the `generateGraphQLSchema` function. The function returns a promise that resolves on an object containing the generated GraphQL schema as well as a report about possible issues when generating the schema:
2626

2727
```javascript
28-
const { createGraphQlSchema } = require('openapi-to-graphql')
28+
const { createGraphQLSchema } = require('openapi-to-graphql')
2929
// load or construct OAS (const oas = ...)
30-
const { schema, report } = await createGraphQlSchema(oas)
30+
const { schema, report } = await createGraphQLSchema(oas)
3131
```
3232

3333
---
3434

3535
OpenAPI-to-GraphQL can also create GraphQL interfaces from _multiple_ APIs. To do so, simply provide multiple OpenAPI Specifications.
3636

3737
```javascript
38-
const { schema, report } = await createGraphQlSchema([oas, oas2, oas3]])
38+
const { schema, report } = await createGraphQLSchema([oas, oas2, oas3]])
3939
```
4040

4141
### Example of Serving the Generated GraphQL Schema
@@ -45,7 +45,7 @@ The schema generated by OpenAPI-to-GraphQL can, for example, be served using [Ex
4545
```javascript
4646
const express = require('express')
4747
const graphqlHTTP = require('express-graphql')
48-
const { createGraphQlSchema } = require('openapi-to-graphql')
48+
const { createGraphQLSchema } = require('openapi-to-graphql')
4949

5050
async function main(oas) {
5151
// generate schema:
@@ -134,7 +134,7 @@ Notice that the slashes in the path `/favoriteBooks/{name}` must be escaped with
134134

135135
### Options
136136

137-
The `createGraphQlSchema` function takes an optional `options` object as a second argument:
137+
The `createGraphQLSchema` function takes an optional `options` object as a second argument:
138138

139139
```javascript
140140
createGraphQLSchema(oas[, options])

packages/openapi-to-graphql/lib/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ declare type Result = {
3535
/**
3636
* Creates a GraphQL interface from the given OpenAPI Specification (2 or 3).
3737
*/
38-
export declare function createGraphQlSchema(spec: Oas3 | Oas2 | (Oas3 | Oas2)[], options?: Options): Promise<Result>;
38+
export declare function createGraphQLSchema(spec: Oas3 | Oas2 | (Oas3 | Oas2)[], options?: Options): Promise<Result>;
3939
export { sanitize, CaseStyle } from './oas_3_tools';
4040
export { GraphQLOperationType } from './types/graphql';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const translationLog = debug('translation')
6161
/**
6262
* Creates a GraphQL interface from the given OpenAPI Specification (2 or 3).
6363
*/
64-
export async function createGraphQlSchema(
64+
export async function createGraphQLSchema(
6565
spec: Oas3 | Oas2 | (Oas3 | Oas2)[],
6666
options?: Options
6767
): Promise<Result> {

packages/openapi-to-graphql/test/authentication.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let createdSchema
2424
*/
2525
beforeAll(() => {
2626
return Promise.all([
27-
openAPIToGraphQL.createGraphQlSchema(oas).then(({ schema }) => {
27+
openAPIToGraphQL.createGraphQLSchema(oas).then(({ schema }) => {
2828
createdSchema = schema
2929
}),
3030
startServer(PORT)
@@ -125,7 +125,7 @@ test('Get project using API key 1', () => {
125125
})
126126

127127
test('Get project using API key passed as option - viewer is disabled', async () => {
128-
const { schema } = await openAPIToGraphQL.createGraphQlSchema(oas, {
128+
const { schema } = await openAPIToGraphQL.createGraphQLSchema(oas, {
129129
viewer: false,
130130
headers: {
131131
access_token: 'abcdef'
@@ -148,7 +148,7 @@ test('Get project using API key passed as option - viewer is disabled', async ()
148148
})
149149

150150
test('Get project using API key passed in the requestOptions - viewer is disabled', async () => {
151-
const { schema } = await openAPIToGraphQL.createGraphQlSchema(oas, {
151+
const { schema } = await openAPIToGraphQL.createGraphQLSchema(oas, {
152152
viewer: false,
153153
requestOptions: {
154154
headers: {
@@ -272,7 +272,7 @@ test('Get project using API key 3', async () => {
272272
})
273273

274274
test('Get project using API key 3 passed as option - viewer is disabled', async () => {
275-
const { schema } = await openAPIToGraphQL.createGraphQlSchema(oas, {
275+
const { schema } = await openAPIToGraphQL.createGraphQLSchema(oas, {
276276
viewer: false,
277277
headers: {
278278
cookie: 'access_token=abcdef'
@@ -295,7 +295,7 @@ test('Get project using API key 3 passed as option - viewer is disabled', async
295295
})
296296

297297
test('Get project using API key 3 passed in the requestOptions - viewer is disabled', async () => {
298-
const { schema } = await openAPIToGraphQL.createGraphQlSchema(oas, {
298+
const { schema } = await openAPIToGraphQL.createGraphQLSchema(oas, {
299299
viewer: false,
300300
requestOptions: {
301301
headers: {
@@ -458,7 +458,7 @@ test('Extract token from context', () => {
458458
}`
459459

460460
return openAPIToGraphQL
461-
.createGraphQlSchema(oas, {
461+
.createGraphQLSchema(oas, {
462462
tokenJSONpath: '$.user.token',
463463
viewer: true
464464
})

packages/openapi-to-graphql/test/cloudfunction.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const oas = require('./fixtures/cloudfunction.json')
1515
let createdSchema
1616

1717
beforeAll(async () => {
18-
const { schema } = await openAPIToGraphQL.createGraphQlSchema(oas)
18+
const { schema } = await openAPIToGraphQL.createGraphQLSchema(oas)
1919
createdSchema = schema
2020
})
2121

packages/openapi-to-graphql/test/docusign.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test('Generate schema without problems', () => {
1717
strict: false
1818
}
1919
return openAPIToGraphQL
20-
.createGraphQlSchema(oas, options)
20+
.createGraphQLSchema(oas, options)
2121
.then(({ schema }) => {
2222
expect(schema).toBeTruthy()
2323
})

packages/openapi-to-graphql/test/evaluation/eval_apis_guru.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function checkOas(OASList) {
5050
let name = oas.info.title
5151
console.log(`Process "${name}" (${oas['x-file-path']})...`)
5252
try {
53-
let { report } = await openapiToGraphql.createGraphQlSchema(oas, {
53+
let { report } = await openapiToGraphql.createGraphQLSchema(oas, {
5454
strict: false
5555
})
5656
results.successes.push({ name, report })

0 commit comments

Comments
 (0)