apollo-codegen
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -533,3 +533,3 @@ 'use strict'; | ||
return '"' + propertyName + '": ' + propertyName; | ||
}), ', '), ']')); | ||
}), ', ') || ':', ']')); | ||
}); | ||
@@ -536,0 +536,0 @@ }); |
{ | ||
"name": "apollo-codegen", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"description": "Generate client code based on a GraphQL schema and query documents", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -12,3 +12,4 @@ import { expect } from 'chai'; | ||
GraphQLList, | ||
GraphQLNonNull | ||
GraphQLNonNull, | ||
GraphQLInputObjectType | ||
} from 'graphql'; | ||
@@ -847,3 +848,30 @@ | ||
}); | ||
it('should generate a valid struct declaration for a GraphQLInputObjectType with only optional fields', function() { | ||
const generator = new CodeGenerator(); | ||
const inputType = new GraphQLInputObjectType({ | ||
name: 'OnlyOptionalFieldsInput', | ||
fields: { | ||
optionalString: { type: GraphQLString }, | ||
} | ||
}); | ||
typeDeclarationForGraphQLType(generator, inputType); | ||
expect(generator.output).to.equal(stripIndent` | ||
public struct OnlyOptionalFieldsInput: GraphQLMapConvertible { | ||
public var graphQLMap: GraphQLMap | ||
public init() { | ||
graphQLMap = [:] | ||
} | ||
public init(optionalString: String?) { | ||
graphQLMap = ["optionalString": optionalString] | ||
} | ||
} | ||
`); | ||
}); | ||
}); | ||
}); |
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
377388
7517