get-graphql-from-jsonschema
Version:
get-graphql-from-jsonschema gets a GraphQL schema from a JSON schema.
16 lines (12 loc) • 464 B
text/typescript
import { scalarTypes } from './scalarTypes';
import { TranslatableScalarTypeJsonSchema } from './Types/TranslatableScalarTypeJsonSchema';
import { TranslatableTypeJsonSchema } from './Types/TranslateableTypeJsonSchema';
const hasScalarType = function (
schema: TranslatableTypeJsonSchema
): schema is TranslatableScalarTypeJsonSchema {
if (Array.isArray(schema.type)) {
return true;
}
return schema.type in scalarTypes;
};
export { hasScalarType };