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

Escape single-lined description in SDL #968

Conversation

barthez
Copy link
Contributor

@barthez barthez commented Sep 11, 2020

Hello!

I got a pretty strange error while generating types for typescript out of schema SDL. I have switched from rendering with https://github.com/maartenvanvliet/absinthe_sdl to Absinthe.Schema.to_sdl. It turned out I had a macro enum definition like this:

enum :logic do
  value :and, description: "Apply \"and\" logic to query"
  value :or, description: "Apply \"or\" logic to query"
end

The type generator complained about duplicated values in enum. When I took a closer look at generated SDL it looked like:

enum Logic {
  "Apply "and" logic to query"
  AND

  "Apply "or" logic to query"
  OR
}

Which, after stripping descriptions, is:

enum Logic {
  and
  AND
  or
  OR
}

I got into GraphQL specs for strings: http://spec.graphql.org/June2018/#sec-String-Value

It seems some characters need to be escaped in a single line description string.

@barthez
Copy link
Contributor Author

barthez commented Oct 20, 2020

Hey @benwilson512, could you please give it a look?

@benwilson512 benwilson512 merged commit d585bbb into absinthe-graphql:master Oct 21, 2020
@benwilson512
Copy link
Contributor

Great catch, thanks!

@barthez barthez deleted the escape-single-line-description-in-sdl branch October 21, 2020 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants