Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-graphql-from-jsonschema

Package Overview
Dependencies
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-graphql-from-jsonschema - npm Package Compare versions

Comparing version 8.0.16 to 8.0.17

2

build/lib/errors.js

@@ -5,4 +5,4 @@ "use strict";

const defekt_1 = require("defekt");
class SchemaInvalid extends defekt_1.defekt({ code: 'SchemaInvalid' }) {
class SchemaInvalid extends (0, defekt_1.defekt)({ code: 'SchemaInvalid' }) {
}
exports.SchemaInvalid = SchemaInvalid;

@@ -6,4 +6,4 @@ "use strict";

const getGraphqlSchemaFromJsonSchema = function ({ rootName, schema, direction = 'output' }) {
return parseSchema_1.parseSchema({ path: [rootName], schema, direction });
return (0, parseSchema_1.parseSchema)({ path: [rootName], schema, direction });
};
exports.getGraphqlSchemaFromJsonSchema = getGraphqlSchemaFromJsonSchema;

@@ -6,3 +6,3 @@ "use strict";

const handleArrayType = function ({ path, schema, direction }) {
const { typeName: graphqlTypeName, typeDefinitions: graphqlTypeDefinitions } = parseSchema_1.parseSchema({ path, schema: schema.items, direction });
const { typeName: graphqlTypeName, typeDefinitions: graphqlTypeDefinitions } = (0, parseSchema_1.parseSchema)({ path, schema: schema.items, direction });
return {

@@ -9,0 +9,0 @@ typeName: `[${graphqlTypeName}]`,

@@ -8,3 +8,3 @@ "use strict";

var _a;
const graphqlTypeName = toPascalCase_1.toPascalCase(path);
const graphqlTypeName = (0, toPascalCase_1.toPascalCase)(path);
const graphqlTypeDefinitions = [];

@@ -14,3 +14,3 @@ const lines = [];

const isRequired = (_a = (schema.required && schema.required.includes(propertyName))) !== null && _a !== void 0 ? _a : false;
const { typeName: propertyGraphqlTypeName, typeDefinitions: propertyGraphqlTypeDefinitions } = parseSchema_1.parseSchema({
const { typeName: propertyGraphqlTypeName, typeDefinitions: propertyGraphqlTypeDefinitions } = (0, parseSchema_1.parseSchema)({
path: [...path, propertyName],

@@ -17,0 +17,0 @@ schema: propertySchema,

@@ -32,13 +32,13 @@ "use strict";

if ('type' in schema) {
result = parseType_1.parseType({ path, schema, direction });
result = (0, parseType_1.parseType)({ path, schema, direction });
}
else if ('oneOf' in schema || 'anyOf' in schema) {
result = parseUnion_1.parseUnion({ path, schema, direction });
result = (0, parseUnion_1.parseUnion)({ path, schema, direction });
}
else {
throw new errors.SchemaInvalid(`Structure at '${toBreadcrumb_1.toBreadcrumb(path)}' not recognized.`);
throw new errors.SchemaInvalid(`Structure at '${(0, toBreadcrumb_1.toBreadcrumb)(path)}' not recognized.`);
}
if (result.typeName.includes('|')) {
const typeName = toPascalCase_1.toPascalCase(path);
result.typeDefinitions.push(common_tags_1.stripIndent `
const typeName = (0, toPascalCase_1.toPascalCase)(path);
result.typeDefinitions.push((0, common_tags_1.stripIndent) `
union ${typeName} = ${result.typeName}

@@ -45,0 +45,0 @@ `);

@@ -13,13 +13,13 @@ "use strict";

const subPath = [...path, `T${0}`];
if (hasArrayType_1.hasArrayType(schema)) {
return handleArrayType_1.handleArrayType({ path: subPath, schema, direction });
if ((0, hasArrayType_1.hasArrayType)(schema)) {
return (0, handleArrayType_1.handleArrayType)({ path: subPath, schema, direction });
}
if (hasObjectType_1.hasObjectType(schema)) {
return handleObjectType_1.handleObjectType({ path: subPath, schema, direction });
if ((0, hasObjectType_1.hasObjectType)(schema)) {
return (0, handleObjectType_1.handleObjectType)({ path: subPath, schema, direction });
}
if (!Array.isArray(schema.type)) {
return handleScalarType_1.handleScalarType({ type: schema.type });
return (0, handleScalarType_1.handleScalarType)({ type: schema.type });
}
schema.type.forEach((type) => {
const result = handleScalarType_1.handleScalarType({ type });
const result = (0, handleScalarType_1.handleScalarType)({ type });
graphqlTypeNames.push(result.typeName);

@@ -26,0 +26,0 @@ graphqlTypeDefinitions.push(...result.typeDefinitions);

@@ -15,3 +15,3 @@ "use strict";

subSchemas.forEach((subSchema, index) => {
const result = parseSchema_1.parseSchema({ schema: subSchema, direction, path: [...path, `I${index}`] });
const result = (0, parseSchema_1.parseSchema)({ schema: subSchema, direction, path: [...path, `I${index}`] });
graphqlTypeNames.push(result.typeName);

@@ -18,0 +18,0 @@ graphqlTypeDefinitions.push(...result.typeDefinitions);

@@ -0,1 +1,8 @@

## [8.0.17](https://github.com/thenativeweb/get-graphql-from-jsonschema/compare/8.0.16...8.0.17) (2022-03-09)
### Bug Fixes
* Fix compatibility to latest TypeScript version. ([#362](https://github.com/thenativeweb/get-graphql-from-jsonschema/issues/362)) ([5671182](https://github.com/thenativeweb/get-graphql-from-jsonschema/commit/567118241bc0bc89e104b1c3dafbf2a01a9a72ce))
## [8.0.16](https://github.com/thenativeweb/get-graphql-from-jsonschema/compare/8.0.15...8.0.16) (2021-08-24)

@@ -2,0 +9,0 @@

{
"name": "get-graphql-from-jsonschema",
"version": "8.0.16",
"version": "8.0.17",
"description": "get-graphql-from-jsonschema gets a GraphQL schema from a JSON schema.",

@@ -25,9 +25,9 @@ "contributors": [

"@types/json-schema": "7.0.9",
"common-tags": "1.8.0",
"defekt": "7.3.3"
"common-tags": "1.8.2",
"defekt": "8.2.0"
},
"devDependencies": {
"assertthat": "6.3.13",
"roboter": "12.1.2",
"semantic-release-configuration": "2.0.5"
"assertthat": "6.4.0",
"roboter": "12.7.0",
"semantic-release-configuration": "2.0.7"
},

@@ -34,0 +34,0 @@ "scripts": {},

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc