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

Feature/Handle Reserved Names #207

Closed
nalchevanidze opened this issue Aug 14, 2019 · 3 comments
Closed

Feature/Handle Reserved Names #207

nalchevanidze opened this issue Aug 14, 2019 · 3 comments

Comments

@nalchevanidze
Copy link
Member

nalchevanidze commented Aug 14, 2019

reserved name type is converted to type'.

there are convertToJSONName and convertToHaskellName functions responsible for it.

TODO:

  • extend it to support all reserved Names: data, default, ....
  • update API Documentation
@horus
Copy link
Contributor

horus commented Aug 14, 2019

Hello @nalchevanidze,

Since a new issue has been opened, we move on here.

I had read the related parts, the purpose of those functions were unclear to me at that time, due to the lack of a big picture. All I knew was: it parses & converts. The lesson learned here is we might need more comments in the original source code, and mention one can use ' to avoid conflicts in the corresponding document.

I've tested your suggestions, it worked except for the generated documents. The output left the prime symbol just there.

An example:

# toGraphQLDocument rootResolver
input TestArgs {
  type': String!
}

...I am afraid this isn't the intended behavior. The latest GraphQL spec:

InputFieldsDefinition
    { InputValueDefinitionlist }
InputValueDefinition
    Description Name : Type DefaultValue Directives
Name ::
    /[_A-Za-z][_0-9A-Za-z]*/

... which allows the use of "type" as field name, so we might want get that fixed, too:

# fixed
input TestArgs {
  type: String!
}

I don't know whether you're already working on the solution, but if you're busy, I'm willing to extend the convertTo* functions first, then try to get rid of the prime symbol in the output document.

@nalchevanidze
Copy link
Member Author

my intention is that Haskell type' will be alias for type, but GraphQL schema will it read it just as type.

i will be glad if you extend the convertTo*

thank you :)

horus added a commit to horus/morpheus-graphql that referenced this issue Aug 14, 2019
Extend convertTo* to handle all Haskell 2010 reservedid
horus added a commit to horus/morpheus-graphql that referenced this issue Aug 15, 2019
nalchevanidze pushed a commit that referenced this issue Aug 15, 2019
* Feature/Handle Reserved Names #207

Extend convertTo* to handle all Haskell 2010 reservedid

* Update documents for #207

* Reimplement convertTo* with isReserved
@nalchevanidze
Copy link
Member Author

done, thanks @horus

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

No branches or pull requests

2 participants