Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Support string fields and args #106

Open
@sntran

Description

@sntran

At the moment, the fields key in %GraphQL.Type.ObjectType{} and args key only take a map with atom keys. For example:

%GraphQL.Schema{
  query: %GraphQL.Type.ObjectType{
    name: "RootQueryType", 
    fields: %{
      greeting: %{
        type: %GraphQL.Type.String{},
        args: %{
          name: %{type: %GraphQL.Type.String{}, description: "The name of who you'd like to greet."}
        },
        resolve: fn(_,_,_) -> "Hello" end
      }
    }
  }
}

However, there are cases where those fields are generated from user's input. By using atoms, we can run out of atoms in the Erlang shell, since atoms are not garbage collected.

It would be ideal to also support this:

%GraphQL.Schema{
  query: %GraphQL.Type.ObjectType{
    name: "RootQueryType", 
    fields: %{
      "greeting" => %{
        type: %GraphQL.Type.String{},
        args: %{
          "name" => %{type: %GraphQL.Type.String{}, description: "The name of who you'd like to greet."}
        },
        resolve: fn(_,_,_) -> "Hello" end
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions