Skip to content

Content type method #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11,895 changes: 10,179 additions & 1,716 deletions packages/openapi-to-graphql-cli/package-lock.json

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions packages/openapi-to-graphql/lib/oas_3_tools.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,20 @@ export declare type ResponseSchemaAndNames = {
responseSchemaNames?: SchemaNames;
statusCode?: string;
};
export declare const OAS_OPERATIONS: string[];
export declare enum HTTP_METHODS {
'get' = "get",
'put' = "put",
'post' = "post",
'patch' = "patch",
'delete' = "delete",
'options' = "options",
'head' = "head"
}
export declare const SUCCESS_STATUS_RX: RegExp;
/**
* Given an HTTP method, convert it to the HTTP_METHODS enum
*/
export declare function methodToHttpMethod(method: string): HTTP_METHODS;
/**
* Resolves on a validated OAS 3 for the given spec (OAS 2 or OAS 3), or rejects
* if errors occur.
Expand Down Expand Up @@ -98,7 +110,7 @@ export declare function getRequestBodyObject(operation: OperationObject, oas: Oa
* a dictionary of names from different sources (if available), and whether the
* request schema is required for the operation.
*/
export declare function getRequestSchemaAndNames(path: string, method: string, operation: OperationObject, oas: Oas3): RequestSchemaAndNames;
export declare function getRequestSchemaAndNames(path: string, method: HTTP_METHODS, operation: OperationObject, oas: Oas3): RequestSchemaAndNames;
/**
* Returns JSON-compatible schema produced by the given operation
*/
Expand All @@ -111,21 +123,21 @@ export declare function getResponseObject(operation: OperationObject, statusCode
* a successful status code, and a dictionary of names from different sources
* (if available).
*/
export declare function getResponseSchemaAndNames<TSource, TContext, TArgs>(path: string, method: string, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>, options: InternalOptions<TSource, TContext, TArgs>): ResponseSchemaAndNames;
export declare function getResponseSchemaAndNames<TSource, TContext, TArgs>(path: string, method: HTTP_METHODS, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>, options: InternalOptions<TSource, TContext, TArgs>): ResponseSchemaAndNames;
/**
* Returns a success status code for the given operation
*/
export declare function getResponseStatusCode<TSource, TContext, TArgs>(path: string, method: string, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>): string | void;
/**
* Returns a hash containing the links in the given operation.
*/
export declare function getLinks<TSource, TContext, TArgs>(path: string, method: string, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>): {
export declare function getLinks<TSource, TContext, TArgs>(path: string, method: HTTP_METHODS, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>): {
[key: string]: LinkObject;
};
/**
* Returns the list of parameters in the given operation.
*/
export declare function getParameters(path: string, method: string, operation: OperationObject, pathItem: PathItemObject, oas: Oas3): ParameterObject[];
export declare function getParameters(path: string, method: HTTP_METHODS, operation: OperationObject, pathItem: PathItemObject, oas: Oas3): ParameterObject[];
/**
* Returns an array of server objects for the operation at the given path and
* method. Considers in the following order: global server definitions,
Expand Down Expand Up @@ -172,7 +184,7 @@ export declare function trim(str: string, length: number): string;
* Determines if the given "method" is indeed an operation. Alternatively, the
* method could point to other types of information (e.g., parameters, servers).
*/
export declare function isOperation(method: string): boolean;
export declare function isHttpMethod(method: string): boolean;
/**
* Formats a string that describes an operation in the form:
* {name of OAS} {HTTP method in ALL_CAPS} {operation path}
Expand All @@ -191,4 +203,4 @@ export declare function uncapitalize(str: string): string;
/**
* For operations that do not have an operationId, generate one
*/
export declare function generateOperationId(method: string, path: string): string;
export declare function generateOperationId(method: HTTP_METHODS, path: string): string;
63 changes: 44 additions & 19 deletions packages/openapi-to-graphql/lib/oas_3_tools.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/oas_3_tools.js.map

Large diffs are not rendered by default.

57 changes: 43 additions & 14 deletions packages/openapi-to-graphql/lib/preprocessor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/preprocessor.js.map

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions packages/openapi-to-graphql/lib/resolver_builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/resolver_builder.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions packages/openapi-to-graphql/lib/schema_builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/schema_builder.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/openapi-to-graphql/lib/types/operation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { Oas3, LinkObject, ParameterObject, ServerObject, SchemaObject } from './oas3';
import { GraphQLOperationType } from './graphql';
import { GraphQLScalarType, GraphQLObjectType, GraphQLInputObjectType, GraphQLList, GraphQLEnumType, GraphQLUnionType } from 'graphql';
import { HTTP_METHODS } from '../oas_3_tools';
import * as GraphQLJSON from 'graphql-type-json';
export declare type DataDefinition = {
preferredName: string;
Expand Down Expand Up @@ -65,7 +66,7 @@ export declare type Operation = {
/**
* HTTP method for this operation
*/
method: string;
method: HTTP_METHODS;
/**
* Content-type of the request payload
*/
Expand Down
1 change: 1 addition & 0 deletions packages/openapi-to-graphql/lib/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export declare enum MitigationTypes {
COMBINE_SCHEMAS = "COMBINE_SCHEMAS",
DUPLICATE_FIELD_NAME = "DUPLICATE_FIELD_NAME",
DUPLICATE_LINK_KEY = "DUPLICATE_LINK_KEY",
INVALID_HTTP_METHOD = "INVALID_HTTP_METHOD",
INPUT_UNION = "INPUT_UNION",
MISSING_RESPONSE_SCHEMA = "MISSING_RESPONSE_SCHEMA",
MISSING_SCHEMA = "MISSING_SCHEMA",
Expand Down
2 changes: 2 additions & 0 deletions packages/openapi-to-graphql/lib/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading