@devticon-os/graphql-codegen-axios 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/input.js +12 -1
package/package.json
CHANGED
package/src/input.js
CHANGED
|
@@ -7,7 +7,8 @@ const findUsageInputs = (document, schema) => {
|
|
|
7
7
|
continue;
|
|
8
8
|
}
|
|
9
9
|
for (const variableDefinition of definition.variableDefinitions) {
|
|
10
|
-
const
|
|
10
|
+
const type = unpackVariableType(variableDefinition.type);
|
|
11
|
+
const name = type.name.value;
|
|
11
12
|
const input = findInputInSchema(name, schema);
|
|
12
13
|
if (input) {
|
|
13
14
|
inputs.push(input);
|
|
@@ -60,4 +61,14 @@ const unpackInputType = type => {
|
|
|
60
61
|
return type;
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
const unpackVariableType = type => {
|
|
65
|
+
if (type.kind === 'ListType') {
|
|
66
|
+
return unpackVariableType(type.type);
|
|
67
|
+
}
|
|
68
|
+
if (type.kind === 'NonNullType') {
|
|
69
|
+
return unpackVariableType(type.type);
|
|
70
|
+
}
|
|
71
|
+
return type;
|
|
72
|
+
};
|
|
73
|
+
|
|
63
74
|
module.exports = { findUsageInputs, findInputInSchema };
|