Skip to content

apollo-compiler@1.0.0-beta.7

Choose a tag to compare

@goto-bus-stop goto-bus-stop released this 17 Nov 17:20
· 245 commits to main since this release
208d2d7

Features

  • Helper features for Name and Type - SimonSapin, pull/739:
    • The name! macro also accepts an identifier:
      name!(Query) and name!("Query") create equivalent Name values.
    • InvalidNameError now contain a public NodeStr for the input string that is invalid,
      and implements Display, Debug, and Error traits.
    • Add TryFrom conversion to Name from NodeStr, &NodeStr, &str, String, and &String.
    • Add a ty! macro to build a static ast::Type using GraphQL-like syntax.
  • Add parsing an ast::Type from a string - lrlna and goto-bus-stop, pull/718 fixing issue/715

    Parses GraphQL type syntax:

    use apollo_compiler::ast::Type;
    let ty = Type::parse("[ListItem!]!")?;

Fixes

  • Fix list and null type validation bugs - goto-bus-stop, pull/746 fixing issue/738
    Previous versions of apollo-compiler accepted null inside a list even if the list item type
    was marked as required. Lists were also accepted as inputs to non-list fields. This is now
    fixed.

    input Args {
      string: String
      ints: [Int!]
    }
    type Query { example(args: Args): Int }
    query {
      example(args: {
        # Used to be accepted, now raises an error
        string: ["1"]
        # Used to be accepted, now raises an error
        ints: [1, 2, null, 4]
      })
    }