Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-codegen

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-codegen - npm Package Compare versions

Comparing version 0.12.5 to 0.12.6

15

lib/swift/codeGeneration.js

@@ -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

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