-
Notifications
You must be signed in to change notification settings - Fork 749
Closed
apollographql/apollo-ios-dev
#658Labels
bugGenerally incorrect behaviorGenerally incorrect behaviorcodegenIssues related to or arising from code generationIssues related to or arising from code generation
Milestone
Description
Summary
We have encountered an issue with the code generation process that results in non-compilable code. When we have a field with multiple deprecation warnings, we have the same amount of #warning directives separated with a ,\n which does not compile with the following error - Extra tokens following #warning directive.
Version
1.21.0
Steps to reproduce the behavior
To achieve this we had a query with multiple arguments, where 2 or more are deprecated.
Example:
This GraphQL schema definition
someQuery(
argumentA: String @deprecated(reason: "Some reason")
argumentB: String @deprecated(reason: "Some other reason")
): Object!with the following GraphQL contract
query QueryA{
someQuery(
argumentA: "",
argumentB: ""
)
}results in the following Swift code generation
public class QueryA: GraphQLQuery {
(...)
#warning("Argument 'argumentA' of field 'someQuery' is deprecated. Reason: 'Some reason'"), // Compilation error here
#warning("Argument 'argumentB' of field 'someQuery' is deprecated. Reason: 'Some other reason'")
public static var __selections: [ApolloAPI.Selection] { [
.field("someQuery", Object.self, arguments: [
"argumentA": "",
"argumentB": ""
]),
] }
}Logs
Anything else?
No response
carlos-santos-anchorcarlos-santos-anchor
Metadata
Metadata
Assignees
Labels
bugGenerally incorrect behaviorGenerally incorrect behaviorcodegenIssues related to or arising from code generationIssues related to or arising from code generation