@khanacademy/graphql-flow
Advanced tools
Comparing version 3.1.1 to 3.1.2
# @khanacademy/graphql-flow | ||
## 3.1.2 | ||
### Patch Changes | ||
- 09f72b5: Fix handling of input objects with required attributes that have a default value | ||
## 3.1.1 | ||
@@ -4,0 +10,0 @@ |
@@ -30,3 +30,3 @@ "use strict"; | ||
return (0, _utils.maybeAddDescriptionComment)(inputObject.description, (0, _utils.objectTypeFromProperties)(inputObject.inputFields.map(vbl => (0, _utils.maybeAddDescriptionComment)(vbl.description, maybeOptionalObjectTypeProperty(vbl.name, inputRefToFlow(ctx, vbl.type)))))); | ||
return (0, _utils.maybeAddDescriptionComment)(inputObject.description, (0, _utils.objectTypeFromProperties)(inputObject.inputFields.map(vbl => (0, _utils.maybeAddDescriptionComment)(vbl.description, maybeOptionalObjectTypeProperty(vbl.name, inputRefToFlow(ctx, vbl.type, vbl.defaultValue != null)))))); | ||
}; | ||
@@ -48,5 +48,7 @@ | ||
const inputRefToFlow = (ctx, inputRef) => { | ||
const inputRefToFlow = (ctx, inputRef, hasDefaultValue = false) => { | ||
if (inputRef.kind === "NON_NULL") { | ||
return _inputRefToFlow(ctx, inputRef.ofType); | ||
const result = _inputRefToFlow(ctx, inputRef.ofType); | ||
return hasDefaultValue ? (0, _utils.nullableType)(result) : result; | ||
} | ||
@@ -53,0 +55,0 @@ |
{ | ||
"name": "@khanacademy/graphql-flow", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"bin": { | ||
"graphql-flow": "./dist/cli/run.js" | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
"dist" | ||
] | ||
}, | ||
"scripts": { | ||
@@ -8,0 +13,0 @@ "test": "jest", |
@@ -624,2 +624,3 @@ /** | ||
candies: number; | ||
friendly?: boolean | null | undefined; | ||
}; | ||
@@ -626,0 +627,0 @@ }, |
@@ -34,3 +34,3 @@ import generate from "@babel/generator"; | ||
vbl.name, | ||
inputRefToFlow(ctx, vbl.type), | ||
inputRefToFlow(ctx, vbl.type, vbl.defaultValue != null), | ||
), | ||
@@ -62,5 +62,7 @@ ), | ||
inputRef: IntrospectionInputTypeRef, | ||
hasDefaultValue = false, | ||
): babelTypes.TSType => { | ||
if (inputRef.kind === "NON_NULL") { | ||
return _inputRefToFlow(ctx, inputRef.ofType); | ||
const result = _inputRefToFlow(ctx, inputRef.ofType); | ||
return hasDefaultValue ? nullableType(result) : result; | ||
} | ||
@@ -67,0 +69,0 @@ const result = _inputRefToFlow(ctx, inputRef); |
Sorry, the diff of this file is not supported yet
216420
5284