zth/rescript-relay

Build error with the reserved keyword `private`

mununki opened this issue · 4 comments

I encountered the build error with the reserved keyword private, while I'm testing with GitHub graphQL API. Schema and generated files:

"""
Autogenerated input type of CreateTeamDiscussion
"""
input CreateTeamDiscussionInput {
    """
    The ID of the team to which the discussion belongs.
    """
    teamId: ID!

    """
    The title of the discussion.
    """
    title: String!

    """
    The content of the discussion.
    """
    body: String!

    """
    If true, restricts the visibility of this discussion to team members and organization admins. If false or not specified, allows any organization member to view this discussion.
    """
    private: Boolean

    """
    A unique identifier for the client performing the mutation.
    """
    clientMutationId: String
}
// __generated__
@live
and input_CreateTeamDiscussionInput = {
  teamId: string,
  title: string,
  body: string,
  private: option<bool>,
  clientMutationId: option<string>,
}
Syntax error!
  /Users/jake/_devel/repos/greenlabs/green-rescript-homework-ts/src/__generated__/RelaySchemaAssets_graphql.res:3592:3-9

  3590 │   title: string,
  3591 │   body: string,
  3592 │   private: option<bool>,
  3593 │   clientMutationId: option<string>,
  3594 │ }

  `private` is a reserved keyword. Keywords need to be escaped: \"private"

I think we have to avoid generating a private field. Can you check?

zth commented

@mattdamon108 good catch! private is indeed not in the list of reserved words, but it should be. An easy fix, will fix it soon.

Thanks!

zth commented

Fixed in 1de3a4b, will be in 1.0.2 that's on its way out.

@zth I don't know the Rust, but it is great! Thanks!