Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotes in operation identifiers are not escaped #2671

Closed
StarLard opened this issue Nov 16, 2022 · 4 comments · Fixed by #2701
Closed

Quotes in operation identifiers are not escaped #2671

StarLard opened this issue Nov 16, 2022 · 4 comments · Fixed by #2701
Assignees
Labels
bug Generally incorrect behavior codegen Issues related to or arising from code generation

Comments

@StarLard
Copy link

Bug report

Code generated when using the operationIdentifiersPath output option which contains String values with escaped quotes in in the associated operation id JSON map file does not correctly escape the quotes in the generated code; which consequently, causes the generated code to fail compilation.

Versions

Please fill in the versions you're currently using:

  • apollo-ios SDK version: 1.0.3
  • Xcode version: 14.0.1
  • Swift version: 5.7
  • Package manager: SPM

Steps to reproduce

  1. Generate code for an operation which contains a string literal value, like "query Sections($id: String!, platform: \"ios\")"
  2. Add generated code to project
  3. Attempt to build project
  4. Observe compiler error; generated code will contain String with non-escaped quotes like "query Sections($id: String!, platform: "ios")"
@calvincestari
Copy link
Member

Thanks for reporting this @StarLard, I'll need to take a deeper look and get back to you.

@StarLard
Copy link
Author

Appreciate it! I believe this is our team's last blocker on updating to 1.0.

@calvincestari
Copy link
Member

Looking into this it appears it's only an issue when using QueryStringLiteralFormat.singleLine as the options.queryStringLiteralFormat value. QueryStringLiteralFormat.multiline works as expected because inner quotes are not a problem with multiline string literals in Swift.

Seems like an easy fix though, should have it sorted soon.

@calvincestari calvincestari added bug Generally incorrect behavior codegen Issues related to or arising from code generation and removed needs investigation labels Dec 2, 2022
@calvincestari calvincestari removed their assignment Dec 2, 2022
@calvincestari calvincestari added this to the Release 1.0.6 milestone Dec 2, 2022
@calvincestari calvincestari self-assigned this Dec 6, 2022
@calvincestari
Copy link
Member

@StarLard, this is now fixed and available in main; it will go out in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Generally incorrect behavior codegen Issues related to or arising from code generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants