graphql-to-postman
Advanced tools
Comparing version 0.0.6 to 0.0.7
# Changelog for graphql-to-postman | ||
### v0.0.7 (Oct 23, 2020) | ||
* fix for - [#8863](https://github.com/postmanlabs/postman-app-support/issues/8863) Fixed an issue where custom name for type threw an error. | ||
### v0.0.6 (Jul 23, 2020) | ||
@@ -3,0 +6,0 @@ * Fix for circular reference input object types. |
@@ -161,2 +161,3 @@ // Forked from https://github.com/timqian/gql-generator. | ||
curDepth = 1) { | ||
const field = gqlSchema.getType(curParentType).getFields()[curName], | ||
@@ -255,7 +256,25 @@ curTypeName = field.type.inspect().replace(/[[\]!]/g, ''), | ||
Object.keys(obj).forEach((type) => { | ||
const field = gqlSchema.getType(description).getFields()[type]; | ||
let field, | ||
newDescription; | ||
// The name of the mutationType can be anything other than 'Mutation' | ||
// Handle for each type separately and use the new description to traverse through | ||
// the fields. | ||
if (description === 'Mutation') { | ||
field = gqlSchema._mutationType._fields[type]; | ||
newDescription = gqlSchema._mutationType.name; | ||
} | ||
else if (description === 'Query') { | ||
field = gqlSchema._queryType._fields[type]; | ||
newDescription = gqlSchema._queryType.name; | ||
} | ||
else if (description === 'Subscription') { | ||
field = gqlSchema._subscriptionType._fields[type]; | ||
newDescription = gqlSchema._subscriptionType.name; | ||
} | ||
/* Only process non-deprecated queries/mutations: */ | ||
if (includeDeprecatedFields || !field.isDeprecated) { | ||
const queryResult = generateQuery(type, description), | ||
const queryResult = generateQuery(type, newDescription), | ||
varsToTypesStr = getVarsToTypesStr(queryResult.argumentsDict); | ||
@@ -270,2 +289,4 @@ | ||
let query = queryResult.queryStr; | ||
// here the `description` is used to construct the actual queries | ||
// Here has to be one of query, mutation, or subscription. | ||
query = `${description.toLowerCase()} ${type}${varsToTypesStr ? ` (${varsToTypesStr}) ` : ' '}{\n${query}\n}`; | ||
@@ -272,0 +293,0 @@ currentObject[type] = { |
{ | ||
"name": "graphql-to-postman", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Generates a Postman Collection from a GraphQL schema.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
48917
666