Skip to content

Commit 6d22104

Browse files
committed
Further cleanup
Signed-off-by: Alan Cha <[email protected]>
1 parent 59d853f commit 6d22104

File tree

12 files changed

+9
-121
lines changed

12 files changed

+9
-121
lines changed

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

Lines changed: 0 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/index.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/oas_3_tools.d.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import { Oas2 } from './types/oas2';
55
import { Operation } from './types/operation';
6-
import { Oas3, ServerObject, ParameterObject, SchemaObject, OperationObject, ResponseObject, PathItemObject, RequestBodyObject, ReferenceObject, LinkObject, CallbackObject, SecuritySchemeObject } from './types/oas3';
6+
import { Oas3, ServerObject, ParameterObject, SchemaObject, OperationObject, ResponseObject, PathItemObject, RequestBodyObject, ReferenceObject, LinkObject, SecuritySchemeObject } from './types/oas3';
77
import { PreprocessingData, ProcessedSecurityScheme } from './types/preprocessing_data';
88
import { InternalOptions } from './types/options';
99
export declare type SchemaNames = {
@@ -140,12 +140,6 @@ export declare function getLinks(path: string, method: string, operation: Operat
140140
* Returns the list of parameters in the given operation.
141141
*/
142142
export declare function getParameters(path: string, method: string, operation: OperationObject, pathItem: PathItemObject, oas: Oas3): ParameterObject[];
143-
/**
144-
* Returns a hash containing the callbacks in the given operation.
145-
*/
146-
export declare function getCallbacks(operation: OperationObject, oas: Oas3): {
147-
[key: string]: CallbackObject;
148-
};
149143
/**
150144
* Returns an array of server objects for the operation at the given path and
151145
* method. Considers in the following order: global server definitions,

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

Lines changed: 0 additions & 35 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: 0 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/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/types/operation.d.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Type definitions for the objects created during preprocessing for every
33
* operation in the OAS.
44
*/
5-
import { Oas3, LinkObject, CallbackObject, ParameterObject, ServerObject, SchemaObject } from './oas3';
5+
import { Oas3, LinkObject, ParameterObject, ServerObject, SchemaObject } from './oas3';
66
import { GraphQLOperationType } from './graphql';
77
import { GraphQLScalarType, GraphQLObjectType, GraphQLInputObjectType, GraphQLList, GraphQLEnumType, GraphQLUnionType } from 'graphql';
88
import * as GraphQLJSON from 'graphql-type-json';
@@ -90,12 +90,6 @@ export declare type Operation = {
9090
* List of parameters of the operation
9191
*/
9292
parameters: ParameterObject[];
93-
/**
94-
* List of callbacks of the operation
95-
*/
96-
callbacks?: {
97-
[key: string]: CallbackObject;
98-
};
9993
/**
10094
* List of keys of security schemes required by this operation
10195
*
@@ -108,7 +102,7 @@ export declare type Operation = {
108102
*/
109103
servers: ServerObject[];
110104
/**
111-
* Whether this operation should be placed in an authentication viewer\
105+
* Whether this operation should be placed in an authentication viewer
112106
* (cannot be true if "viewer" option passed to OpenAPI-to-GraphQL is false).
113107
*/
114108
inViewer: boolean;

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,7 @@ export async function createGraphQLSchema(
106106
typeof options.createSubscriptionsFromCallbacks === 'boolean'
107107
? options.createSubscriptionsFromCallbacks
108108
: false
109-
110-
options.createSubscriptionsFromCallbacks =
111-
typeof options.createSubscriptionsFromCallbacks === 'boolean'
112-
? options.createSubscriptionsFromCallbacks
113-
: false
114-
109+
115110
// Authentication options
116111
options.viewer = typeof options.viewer === 'boolean' ? options.viewer : true
117112
options.sendOAuthTokenInQuery =
@@ -381,7 +376,7 @@ async function translateOpenAPIToGraphQL(
381376
data.saneMap
382377
)
383378
}
384-
379+
385380
if (operation.inViewer) {
386381
for (let securityRequirement of operation.securityRequirements) {
387382
if (typeof authMutationFields[securityRequirement] !== 'object') {

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,48 +1037,6 @@ export function getParameters(
10371037
return parameters
10381038
}
10391039

1040-
/**
1041-
* Returns a hash containing the callbacks in the given operation.
1042-
*/
1043-
export function getCallbacks(
1044-
operation: OperationObject,
1045-
oas: Oas3
1046-
): { [key: string]: CallbackObject } {
1047-
const callbacks = {}
1048-
if (typeof operation.callbacks === 'object') {
1049-
let callbacksObject: CallbacksObject = operation.callbacks
1050-
for (let callbackName in callbacksObject) {
1051-
if (typeof callbacksObject[callbackName] === 'object') {
1052-
let callbackObject: CallbackObject | ReferenceObject =
1053-
callbacksObject[callbackName]
1054-
// Make sure we have CallbackObject:
1055-
if (typeof (callbackObject as ReferenceObject).$ref === 'string') {
1056-
callbackObject = resolveRef(
1057-
(callbackObject as ReferenceObject).$ref,
1058-
oas
1059-
) as CallbackObject
1060-
} else {
1061-
callbackObject = (callbackObject as any) as CallbackObject
1062-
}
1063-
// Make sure CallbackObject contains PathItemObject:
1064-
for (let expression in callbackObject) {
1065-
let pathItem: PathItemObject = callbackObject[expression]
1066-
if (typeof (pathItem as ReferenceObject).$ref === 'string') {
1067-
pathItem = resolveRef(callbackObject[callbackName]['$ref'], oas)
1068-
} else {
1069-
pathItem = (pathItem as any) as PathItemObject
1070-
}
1071-
1072-
const callback: CallbackObject = { [expression]: pathItem }
1073-
callbacks[callbackName] = { ...callbacks[callbackName], ...callback }
1074-
}
1075-
}
1076-
}
1077-
}
1078-
1079-
return callbacks
1080-
}
1081-
10821040
/**
10831041
* Returns an array of server objects for the operation at the given path and
10841042
* method. Considers in the following order: global server definitions,

0 commit comments

Comments
 (0)