Types

Specification

Following types are supported:

  • ScalarDefinition
  • ObjectDefinition
  • InterfaceDefinition
  • UnionDefinition
  • EnumDefinition
  • InputObjectDefinition

These all exists in Tanka.GraphQL.Language.Nodes.TypeSystem namespace and implement TypeDefinition base class.

Examples of creating type instances

Following shows how to create ScalarDefinition from bytes or string. Other types are created in similar way. You can also create actual instance of the type class but that can get quite verbose for more complicated types.

    [Fact]
    public void FromBytes()
    {
        /* Given */
        /* When */
        ScalarDefinition original = "scalar Name"u8;

        /* Then */
        Assert.Equal("Name", original.Name);
    }



    [Fact]
    public void FromString()
    {
        /* Given */
        /* When */
        ScalarDefinition original = "scalar Name";

        /* Then */
        Assert.Equal("Name", original.Name);
    }