graphql-to-postman
Advanced tools
Comparing version 0.1.0 to 0.1.1
# Changelog for graphql-to-postman | ||
## [Unreleased] | ||
## [v0.1.1] - 2024-04-05 | ||
### Fixed | ||
- Fixed an issue where GQL definition of having Union self refs past depth limit was failing with RangeError. | ||
#### v0.1.0 (June 06, 2023) | ||
* Added support for CLI usage to convert GraphQL definition to collection with custom depth. | ||
* Added maximum limit to depth allowed via usage of module APIs. | ||
- Added support for CLI usage to convert GraphQL definition to collection with custom depth. | ||
- Added maximum limit to depth allowed via usage of module APIs. | ||
### v0.0.12 (March 30, 2023) | ||
* Fixed issue where conversion failed with type error while resolving non-defined variables. | ||
* Added support for release script. | ||
- Fixed issue where conversion failed with type error while resolving non-defined variables. | ||
- Added support for release script. | ||
### v0.0.12 (January 9, 2023) | ||
* Fix for - [#10070](hhttps://github.com/postmanlabs/postman-app-support/issues/10070) Added support for nested lists. | ||
- Fix for - [#10070](hhttps://github.com/postmanlabs/postman-app-support/issues/10070) Added support for nested lists. | ||
### v0.0.11 (Sept 27, 2021) | ||
* Fix for - [#24](https://github.com/postmanlabs/graphql-to-postman/issues/24) Fixed an issue where nesting was faulty. | ||
- Fix for - [#24](https://github.com/postmanlabs/graphql-to-postman/issues/24) Fixed an issue where nesting was faulty. | ||
### v0.0.10 (Sept 27, 2021) | ||
* Fix for - [#9884](https://github.com/postmanlabs/postman-app-support/issues/9884) Fixed an issue with union types self referencing | ||
- Fix for - [#9884](https://github.com/postmanlabs/postman-app-support/issues/9884) Fixed an issue with union types self referencing | ||
### v0.0.9 (April 9, 2021) | ||
* Added the support for changing stack depth if required. | ||
- Added the support for changing stack depth if required. | ||
### v0.0.8 (March 15, 2021) | ||
* Fixed issue where error shown was meaningless for incorrect GraphQL SDL. | ||
- Fixed issue where error shown was meaningless for incorrect GraphQL SDL. | ||
### 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. | ||
- 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) | ||
* Fix for circular reference input object types. | ||
* Fix for introspection query response type support. | ||
- Fix for circular reference input object types. | ||
- Fix for introspection query response type support. | ||
### v0.0.5 (May 15, 2020) | ||
* Fix for - [#8429](https://github.com/postmanlabs/postman-app-support/issues/8429) [#10](https://github.com/postmanlabs/graphql-to-postman/issues/10) - Schemas with Input type will now be converted successfully. | ||
- Fix for - [#8429](https://github.com/postmanlabs/postman-app-support/issues/8429) [#10](https://github.com/postmanlabs/graphql-to-postman/issues/10) - Schemas with Input type will now be converted successfully. | ||
#### v0.0.4 (April 29, 2020) | ||
* Sanitization of options. | ||
* Added a function for getting meta data. | ||
- Sanitization of options. | ||
- Added a function for getting meta data. | ||
#### v0.0.3 (March 26, 2020) | ||
* Fix for empty collection generation for certain queries. | ||
- Fix for empty collection generation for certain queries. | ||
#### v0.0.2 (December 20, 2019) | ||
* Support for GraphQL variables. | ||
- Support for GraphQL variables. | ||
#### v0.0.1 (December 10, 2019) | ||
* Base release | ||
- Base release | ||
[Unreleased]: https://github.com/postmanlabs/graphql-to-postman/compare/v0.1.1...HEAD | ||
[v0.1.1]: https://github.com/postmanlabs/graphql-to-postman/compare/011f91a2fff94f02aeefcfc004a96777a62829bb...v0.1.1 |
@@ -21,2 +21,6 @@ // Forked from https://github.com/timqian/gql-generator. | ||
getArgsToVarsStr = (dict) => { | ||
if (typeof dict !== 'object') { | ||
return ''; | ||
} | ||
return Object.entries(dict) | ||
@@ -106,2 +110,6 @@ .map(([varName, arg]) => { return `${arg.name}: $${varName}`; }) | ||
getVarsToTypesStr = (dict) => { | ||
if (typeof dict !== 'object') { | ||
return ''; | ||
} | ||
return Object.entries(dict) | ||
@@ -156,3 +164,3 @@ .map(([varName, arg]) => { | ||
fields = argType.getFields(); | ||
Object.keys(fields).forEach((field) => { | ||
typeof fields === 'object' && Object.keys(fields).forEach((field) => { | ||
if (fields[field].type === type) { | ||
@@ -247,3 +255,3 @@ fieldObj[field] = '<Same as ' + type + '>'; | ||
let childKeys = Object.keys(curType.getFields()); | ||
let childKeys = Object.keys(curType.getFields() || {}); | ||
childQuery = childKeys | ||
@@ -280,2 +288,12 @@ .filter((fieldName) => { | ||
if (curType.astNode && curType.astNode.kind === 'UnionTypeDefinition') { | ||
/* Make sure UnionTypeDefinition are also not circularly referenced */ | ||
if ((crossReferenceKeyList.hasOwnProperty(crossReferenceKey) && crossReferenceKeyList[crossReferenceKey]) || | ||
curDepth > depthLimit | ||
) { | ||
crossReferenceKeyList[crossReferenceKey] = false; | ||
return ''; | ||
} | ||
crossReferenceKeyList[crossReferenceKey] = true; | ||
const types = curType.getTypes(); | ||
@@ -290,3 +308,3 @@ if (types && types.length) { | ||
valueType = gqlSchema.getType(valueTypeName), | ||
unionChildQuery = Object.keys(valueType.getFields()) | ||
unionChildQuery = Object.keys(valueType.getFields() || {}) | ||
.map((cur) => { | ||
@@ -339,3 +357,3 @@ // Don't genrate query fields that have self referencing | ||
Object.keys(obj).forEach((type) => { | ||
typeof obj === 'object' && Object.keys(obj).forEach((type) => { | ||
@@ -368,6 +386,9 @@ let field, | ||
var variables = {}; | ||
Object.entries(queryResult.argumentsDict).map(([varName, arg]) => { | ||
variables[varName] = resolveVariableType(arg.type, gqlSchema, 0, stackLimit); | ||
}); | ||
if (typeof queryResult.argumentsDict === 'object') { | ||
Object.entries(queryResult.argumentsDict).map(([varName, arg]) => { | ||
variables[varName] = resolveVariableType(arg.type, gqlSchema, 0, stackLimit); | ||
}); | ||
} | ||
let query = queryResult.queryStr; | ||
@@ -374,0 +395,0 @@ // here the `description` is used to construct the actual queries |
{ | ||
"name": "graphql-to-postman", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Generates a Postman Collection from a GraphQL schema.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
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
74336
18
947