Incorrect uppercasing used for default values of variables used in query #3290
Labels
bug
Generally incorrect behavior
needs investigation
planned-next
Slated to be included in the next release
Milestone
Summary
When defining a query using a variable with a default value, if the default value is an input type with a field whose name starts with an uppercase letter, the query's generated code uses the wrong case for that letter when initializing the input type.
For example if an
input
is defined with a fieldPREFIX__id
, then the generated struct for the input type reformats it topREFIX__id
but the query tries to initialize it usingPREFIX__id
.See reproduction steps for a concrete example.
Ideally, the CLI would detect that an ALL-CAPS name is being used and preserve the first-letter capital, but I realize that would likely be a breaking change (and maybe unreliable), so I'd settle for the generated query using the first-letter-lower-cased name :)
Thanks!
Version
CLI 1.7.1
Steps to reproduce the behavior
Create files:
schema/schema.graphqls
:queries/query.graphql
:apollo-codegen-config.json
Then run
apollo-ios-cli generate
, which generates:generated/Schema/InputObjects/Param.graphql.swift
(non-relevant bits snipped out)generated/Operations/Queries/ExampleQuery.graphql.swift
(snipped again)This causes a Swift compilation error since
Param
's initializer takes a parameter namedpREFIX__id
butExampleQuery
is trying to give it a parameterPREFIX__id
.Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: