Skip to content
This repository was archived by the owner on Nov 14, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/swift/codeGeneration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,12 +814,6 @@ export class SwiftAPIGenerator extends SwiftGenerator<CompilerContext> {

const properties = fields.map(this.helpers.propertyFromInputField, this.helpers);

properties.forEach(property => {
if (property.isOptional) {
property.typeName = `Optional<${property.typeName}>`;
}
});

this.structDeclaration({ structName, description, adoptedProtocols }, () => {
this.printOnNewline(`public var graphQLMap: GraphQLMap`);

Expand Down
10 changes: 5 additions & 5 deletions test/swift/__snapshots__/codeGeneration.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ exports[`Swift code generation #typeDeclarationForGraphQLType() should generate
public struct ReviewInput: GraphQLMapConvertible {
public var graphQLMap: GraphQLMap

public init(stars: Int, commentary: Optional<String?> = nil, favoriteColor: Optional<ColorInput?> = nil) {
public init(stars: Int, commentary: String? = nil, favoriteColor: ColorInput? = nil) {
graphQLMap = [\\"stars\\": stars, \\"commentary\\": commentary, \\"favorite_color\\": favoriteColor]
}

Expand All @@ -1481,19 +1481,19 @@ public struct ReviewInput: GraphQLMapConvertible {
}

/// Comment about the movie, optional
public var commentary: Optional<String?> {
public var commentary: String? {
get {
return graphQLMap[\\"commentary\\"] as! Optional<String?>
return graphQLMap[\\"commentary\\"] as! String?
}
set {
graphQLMap.updateValue(newValue, forKey: \\"commentary\\")
}
}

/// Favorite color, optional
public var favoriteColor: Optional<ColorInput?> {
public var favoriteColor: ColorInput? {
get {
return graphQLMap[\\"favoriteColor\\"] as! Optional<ColorInput?>
return graphQLMap[\\"favoriteColor\\"] as! ColorInput?
}
set {
graphQLMap.updateValue(newValue, forKey: \\"favoriteColor\\")
Expand Down