Skip to content
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

added stricter scalar type checks #320

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
1,495 changes: 576 additions & 919 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/openapi-to-graphql/lib/schema_builder.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { PreprocessingData } from './types/preprocessing_data';
import { Operation, DataDefinition } from './types/operation';
import { ParameterObject } from './types/oas3';
import { SchemaObject, ParameterObject } from './types/oas3';
import { Args, GraphQLType } from './types/graphql';
declare type GetArgsParams = {
requestPayloadDef?: DataDefinition;
Expand All @@ -13,6 +13,7 @@ declare type GetArgsParams = {
};
declare type CreateOrReuseComplexTypeParams = {
def: DataDefinition;
schema?: SchemaObject;
operation?: Operation;
iteration?: number;
isInputObjectType?: boolean;
Expand All @@ -21,7 +22,7 @@ declare type CreateOrReuseComplexTypeParams = {
/**
* Creates and returns a GraphQL type for the given JSON schema.
*/
export declare function getGraphQLType({ def, operation, data, iteration, isInputObjectType }: CreateOrReuseComplexTypeParams): GraphQLType;
export declare function getGraphQLType({ def, schema, operation, data, iteration, isInputObjectType }: CreateOrReuseComplexTypeParams): GraphQLType;
/**
* Creates the arguments for resolving a field
*/
Expand Down
130 changes: 123 additions & 7 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.

5 changes: 5 additions & 0 deletions packages/openapi-to-graphql/lib/types/oas3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ declare type ExternalDocumentationObject = {
export declare type SchemaObject = {
$ref?: string;
title?: string;
minimum?: number;
maximum?: number;
maxLength?: number;
minLength?: number;
pattern?: string;
type?: 'string' | 'number' | 'object' | 'array' | 'boolean' | 'integer';
format?: string;
nullable?: boolean;
Expand Down
24 changes: 24 additions & 0 deletions packages/openapi-to-graphql/lib/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@ export declare const mitigations: {
LIMIT_ARGUMENT_NAME_COLLISION: string;
OAUTH_SECURITY_SCHEME: string;
};
/**
* verify that a variable contains a safe int (2^31)
*/
export declare function isSafeInteger(n: unknown): n is number;
/**
* verify that a variable contains a safe long (2^53)
*/
export declare function isSafeLong(n: unknown): n is number;
/**
* verify that a vriable contains a valid UUID string
*/
export declare function isUUID(s: any): boolean;
/**
* verify
*/
export declare function isURL(s: any): boolean;
/**
* verify that a vriable contains a safe date/date-time string
*/
export declare function isSafeDate(n: string): boolean;
/**
* get the correct type of a variable
*/
export declare function strictTypeOf(value: any, type: any): boolean;
/**
* Utilities that are specific to OpenAPI-to-GraphQL
*/
Expand Down
106 changes: 106 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