graphql-2-json-schema
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="0.1.1"></a> | ||
## [0.1.1](https://github.com/wittydeveloper/graphql-to-json-schema/compare/v0.1.0...v0.1.1) (2019-02-15) | ||
<a name="0.1.0"></a> | ||
@@ -7,0 +12,0 @@ # [0.1.0](https://github.com/wittydeveloper/graphql-to-json-schema/compare/v0.1.0-1...v0.1.0) (2018-12-29) |
@@ -5,3 +5,3 @@ import { IntrospectionField, IntrospectionInputValue, IntrospectionType } from 'graphql'; | ||
export declare type JSONSchema6Acc = { | ||
[k: string]: boolean | JSONSchema6; | ||
[k: string]: JSONSchema6; | ||
}; | ||
@@ -8,0 +8,0 @@ export declare const getRequiredFields: (fields: ReadonlyArray<IntrospectionField | IntrospectionInputValue>) => string[]; |
@@ -31,2 +31,3 @@ "use strict"; | ||
} | ||
acc[curr.name].description = curr.description || undefined; | ||
return acc; | ||
@@ -47,2 +48,3 @@ }; | ||
} | ||
acc[curr.name].description = curr.description || undefined; | ||
return acc; | ||
@@ -76,3 +78,4 @@ }; | ||
], | ||
title: item.description || item.name | ||
title: item.description || item.name, | ||
description: item.description || undefined | ||
}; | ||
@@ -82,3 +85,4 @@ }) | ||
} | ||
acc[curr.name].description = curr.description || undefined; | ||
return acc; | ||
}; }; |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.getTodoSchemaIntrospection = function () { | ||
var schema = graphql_1.buildSchema("\n type Todo {\n id: String!\n name: String!\n completed: Boolean\n color: Color\n }\n\n input TodoInputType {\n name: String!\n completed: Boolean\n color: Color\n }\n \n enum Color {\n \"Red color\"\n RED\n \"Green color\"\n GREEN\n }\n\n type Query {\n todo(id: String!): Todo!\n todos: [Todo!]!\n }\n\n type Mutation {\n update_todo(id: String!, todo: TodoInputType!): Todo\n create_todo(todo: TodoInputType!): Todo\n }\n"); | ||
var schema = graphql_1.buildSchema("\n \"A ToDo Object\"\n type Todo {\n \"A unique identifier\"\n id: String! \n name: String!\n completed: Boolean\n color: Color\n }\n\n \"\"\"\n A type that describes ToDoInputType. Its description might not\n fit within the bounds of 80 width and so you want MULTILINE\n \"\"\"\n input TodoInputType {\n name: String!\n completed: Boolean\n color: Color\n } \n \n enum Color { \n \"Red color\" \n RED\n \"Green color\"\n GREEN\n }\n\n type Query {\n todo(\n \"todo identifier\"\n id: String!\n ): Todo!\n todos: [Todo!]!\n }\n\n type Mutation {\n update_todo(id: String!, todo: TodoInputType!): Todo\n create_todo(todo: TodoInputType!): Todo\n }\n"); | ||
var result = graphql_1.graphqlSync(schema, graphql_1.introspectionQuery); | ||
@@ -25,3 +25,3 @@ return { | ||
properties: { | ||
id: { type: 'string' } | ||
id: { type: 'string', description: "todo identifier" } | ||
}, | ||
@@ -96,4 +96,5 @@ required: ['id'] | ||
type: 'object', | ||
description: "A ToDo Object", | ||
properties: { | ||
id: { type: 'string' }, | ||
id: { type: 'string', description: "A unique identifier" }, | ||
name: { type: 'string' }, | ||
@@ -110,7 +111,9 @@ completed: { type: 'boolean' }, | ||
"enum": ['RED'], | ||
title: 'Red color' | ||
title: 'Red color', | ||
description: 'Red color' | ||
}, | ||
{ | ||
"enum": ['GREEN'], | ||
title: 'Green color' | ||
title: 'Green color', | ||
description: 'Green color' | ||
} | ||
@@ -121,2 +124,3 @@ ] | ||
type: 'object', | ||
description: 'A type that describes ToDoInputType. Its description might not\nfit within the bounds of 80 width and so you want MULTILINE', | ||
properties: { | ||
@@ -123,0 +127,0 @@ name: { type: 'string' }, |
@@ -18,3 +18,3 @@ import { types } from 'functional-json-schema'; | ||
export type JSONSchema6Acc = { | ||
[k: string]: boolean | JSONSchema6; | ||
[k: string]: JSONSchema6; | ||
}; | ||
@@ -64,2 +64,3 @@ | ||
} | ||
acc[curr.name].description = curr.description || undefined; | ||
return acc; | ||
@@ -85,2 +86,3 @@ }; | ||
} | ||
acc[curr.name].description = curr.description || undefined; | ||
return acc; | ||
@@ -123,2 +125,3 @@ }; | ||
title: item.description || item.name, | ||
description: item.description || undefined | ||
}; | ||
@@ -128,3 +131,5 @@ }), | ||
} | ||
acc[curr.name].description = curr.description || undefined; | ||
return acc; | ||
}; |
{ | ||
"name": "graphql-2-json-schema", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:wittydeveloper/graphql-to-json-schema.git", |
@@ -16,4 +16,6 @@ import { | ||
const schema = buildSchema(` | ||
"A ToDo Object" | ||
type Todo { | ||
id: String! | ||
"A unique identifier" | ||
id: String! | ||
name: String! | ||
@@ -24,2 +26,6 @@ completed: Boolean | ||
""" | ||
A type that describes ToDoInputType. Its description might not | ||
fit within the bounds of 80 width and so you want MULTILINE | ||
""" | ||
input TodoInputType { | ||
@@ -29,6 +35,6 @@ name: String! | ||
color: Color | ||
} | ||
} | ||
enum Color { | ||
"Red color" | ||
enum Color { | ||
"Red color" | ||
RED | ||
@@ -40,3 +46,6 @@ "Green color" | ||
type Query { | ||
todo(id: String!): Todo! | ||
todo( | ||
"todo identifier" | ||
id: String! | ||
): Todo! | ||
todos: [Todo!]! | ||
@@ -70,3 +79,3 @@ } | ||
properties: { | ||
id: { type: 'string' } | ||
id: { type: 'string', description: "todo identifier" } | ||
}, | ||
@@ -141,4 +150,5 @@ required: ['id'] | ||
type: 'object', | ||
description: "A ToDo Object", | ||
properties: { | ||
id: { type: 'string' }, | ||
id: { type: 'string', description: "A unique identifier" }, | ||
name: { type: 'string' }, | ||
@@ -156,2 +166,3 @@ completed: { type: 'boolean' }, | ||
title: 'Red color', | ||
description: 'Red color' | ||
}, | ||
@@ -161,2 +172,3 @@ { | ||
title: 'Green color', | ||
description: 'Green color' | ||
} | ||
@@ -167,2 +179,3 @@ ] | ||
type: 'object', | ||
description: 'A type that describes ToDoInputType. Its description might not\nfit within the bounds of 80 width and so you want MULTILINE', | ||
properties: { | ||
@@ -169,0 +182,0 @@ name: { type: 'string' }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43801
813