Socket
Socket
Sign inDemoInstall

graphql-to-postman

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-to-postman - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6-beta.0

16

lib/assets/gql-generator.js

@@ -104,6 +104,9 @@ // Forked from https://github.com/timqian/gql-generator.

* @param {object} gqlSchema
* @param {Number} stack
*/
function resolveVariableType (type, gqlSchema) {
function resolveVariableType (type, gqlSchema, stack = 0) {
var fieldObj = {},
stackLimit = 10,
fields;
stack++;
const argType = gqlSchema.getType(getTypeFromTypeObject(type));

@@ -113,6 +116,11 @@ if (graphql.isInputObjectType(argType)) {

Object.keys(fields).forEach((field) => {
if (type.toString().includes('[') && type.toString().includes(']')) {
fieldObj[field] = [resolveVariableType(fields[field].type, gqlSchema)];
if (fields[field].type === type) {
fieldObj[field] = '<Same as ' + type + '>';
}
fieldObj[field] = resolveVariableType(fields[field].type, gqlSchema);
else if (stack <= stackLimit) {
if (type.toString().includes('[') && type.toString().includes(']')) {
fieldObj[field] = [resolveVariableType(fields[field].type, gqlSchema, stack)];
}
fieldObj[field] = resolveVariableType(fields[field].type, gqlSchema, stack);
}
});

@@ -119,0 +127,0 @@ return fieldObj;

@@ -52,2 +52,19 @@ var schemaToQuery = require('./assets/gql-generator').schemaToQuery,

introspectionObject = util.asJson(data);
// introspection query result has the following structure:
// https://graphql.org/learn/introspection/
// The user can directly provide this
// {
// data: {
// // Or may provide this.
// __schema: {
// }
// }
// }
// Either way, the function `graphql.buildClientSchema`
// only takes in the value of `data` from above.
if (introspectionObject.data) {
introspectionObject = introspectionObject.data;
}
gqlSchemaObj = graphql.buildClientSchema(introspectionObject);

@@ -54,0 +71,0 @@ }

{
"name": "graphql-to-postman",
"version": "0.0.5",
"version": "0.0.6-beta.0",
"description": "Generates a Postman Collection from a GraphQL schema.",

@@ -5,0 +5,0 @@ "main": "index.js",

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