apollo-codegen
Advanced tools
Comparing version 0.12.5 to 0.12.6
@@ -358,2 +358,3 @@ 'use strict'; | ||
var responseName = field.responseName; | ||
var namedType = (0, _graphql.getNamedType)(type); | ||
@@ -374,3 +375,3 @@ | ||
var snapshotTypeName = (0, _types.typeNameFromGraphQLType)(generator.context, type, 'Snapshot', isOptional); | ||
var getter = `return (snapshot["${propertyName}"]! as! ${snapshotTypeName})`; | ||
var getter = `return (snapshot["${responseName}"]! as! ${snapshotTypeName})`; | ||
getter += mapExpressionForType(generator.context, type, `${structName}(snapshot: $0)`); | ||
@@ -382,3 +383,3 @@ generator.printOnNewline(getter); | ||
var newValueExpression = "newValue" + mapExpressionForType(generator.context, type, `$0.snapshot`); | ||
generator.printOnNewline(`snapshot.updateValue(${newValueExpression}, forKey: "${propertyName}")`); | ||
generator.printOnNewline(`snapshot.updateValue(${newValueExpression}, forKey: "${responseName}")`); | ||
}); | ||
@@ -389,5 +390,5 @@ } else { | ||
if (isOptional) { | ||
generator.printOnNewline(`return (snapshot["${propertyName}"]! as! Snapshot?).flatMap { ${structName}(snapshot: $0) }`); | ||
generator.printOnNewline(`return (snapshot["${responseName}"]! as! Snapshot?).flatMap { ${structName}(snapshot: $0) }`); | ||
} else { | ||
generator.printOnNewline(`return ${structName}(snapshot: snapshot["${propertyName}"]! as! Snapshot)`); | ||
generator.printOnNewline(`return ${structName}(snapshot: snapshot["${responseName}"]! as! Snapshot)`); | ||
} | ||
@@ -403,3 +404,3 @@ }); | ||
} | ||
generator.printOnNewline(`snapshot.updateValue(${newValueExpression}, forKey: "${propertyName}")`); | ||
generator.printOnNewline(`snapshot.updateValue(${newValueExpression}, forKey: "${responseName}")`); | ||
}); | ||
@@ -410,7 +411,7 @@ } | ||
generator.withinBlock(function () { | ||
generator.printOnNewline(`return snapshot["${propertyName}"]! as! ${typeName}`); | ||
generator.printOnNewline(`return snapshot["${responseName}"]! as! ${typeName}`); | ||
}); | ||
generator.printOnNewline("set"); | ||
generator.withinBlock(function () { | ||
generator.printOnNewline(`snapshot.updateValue(newValue, forKey: "${propertyName}")`); | ||
generator.printOnNewline(`snapshot.updateValue(newValue, forKey: "${responseName}")`); | ||
}); | ||
@@ -417,0 +418,0 @@ } |
{ | ||
"name": "apollo-codegen", | ||
"version": "0.12.5", | ||
"version": "0.12.6", | ||
"description": "Generate API code or type annotations based on a GraphQL schema and query documents", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
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
634781
9794