Skip to content

Commit f5927ab

Browse files
committed
Add test to check HTTP method
Signed-off-by: Alan Cha <[email protected]>
1 parent 6bd7258 commit f5927ab

20 files changed

+10434
-1812
lines changed

packages/openapi-to-graphql-cli/package-lock.json

Lines changed: 10179 additions & 1716 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.d.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,20 @@ export declare type ResponseSchemaAndNames = {
2828
responseSchemaNames?: SchemaNames;
2929
statusCode?: string;
3030
};
31-
export declare const OAS_OPERATIONS: string[];
31+
export declare enum HTTP_METHODS {
32+
'get' = "get",
33+
'put' = "put",
34+
'post' = "post",
35+
'patch' = "patch",
36+
'delete' = "delete",
37+
'options' = "options",
38+
'head' = "head"
39+
}
3240
export declare const SUCCESS_STATUS_RX: RegExp;
41+
/**
42+
* Given an HTTP method, convert it to the HTTP_METHODS enum
43+
*/
44+
export declare function methodToHttpMethod(method: string): HTTP_METHODS;
3345
/**
3446
* Resolves on a validated OAS 3 for the given spec (OAS 2 or OAS 3), or rejects
3547
* if errors occur.
@@ -172,7 +184,7 @@ export declare function trim(str: string, length: number): string;
172184
* Determines if the given "method" is indeed an operation. Alternatively, the
173185
* method could point to other types of information (e.g., parameters, servers).
174186
*/
175-
export declare function isOperation(method: string): boolean;
187+
export declare function isHttpMethod(method: string): boolean;
176188
/**
177189
* Formats a string that describes an operation in the form:
178190
* {name of OAS} {HTTP method in ALL_CAPS} {operation path}

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

Lines changed: 44 additions & 19 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: 31 additions & 14 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/resolver_builder.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/lib/resolver_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/schema_builder.js

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.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.

0 commit comments

Comments
 (0)