Skip to content

apollo-compiler@1.0.0-beta.2

Choose a tag to compare

@lrlna lrlna released this 10 Oct 15:52
· 299 commits to main since this release
f3760db

1.0.0-beta.2 - 2023-10-10

BREAKING

Assorted Schema API changes by SimonSapin in pull/678:

  • Type of the schema_definition field changed
    from Option<SchemaDefinition> to SchemaDefinition.
    Default root operations based on object type names
    are now stored explicitly in SchemaDefinition.
    Serialization relies on a heuristic to decide on implicit schema definition.
  • Removed schema_definition_directives method: no longer having an Option allows
    field schema.schema_definition.directives to be accessed directly
  • Removed query_root_operation, mutation_root_operation, and subscription_root_operation
    methods. Instead schema.schema_definition.query etc can be accessed directly.

Features

  • Add executable::FieldSet for a selection set with optional outer brackets - lrlna, pull/685 fixing issue/681
    This is intended to parse string value of a FieldSet custom scalar
    used in some Apollo Federation directives in the context of a specific schema and type.
    Its validate method calls a subset of validation rules relevant to selection sets.
    which is not part of a document.

    let input = r#"
      type Query {
        id: ID
        organization: Org
      }
      type Org {
        id: ID
      }
    "#;
    let schema = Schema::parse(input, "schema.graphql");
    schema.validate().unwrap();
    let input = "id organization { id }";
    let field_set = FieldSet::parse(&schema, "Query", input, "field_set.graphql");
    field_set.validate(&schema).unwrap();
  • Add opt-in configuration for “orphan” extensions to be “adopted” - SimonSapin, pull/678

    Type extensions and schema extensions without a corresponding definition
    are normally ignored except for recording a validation error.
    In this new mode, an implicit empty definition to extend is generated instead.
    This behavious is not the default, as it's non-standard.
    Configure a schema builder to opt in:

    let input = "extend type Query { x: Int }";
    let schema = apollo_compiler::Schema::builder()
        .adopt_orphan_extensions()
        .parse(input, "schema.graphql")
        .build();
    schema.validate()?;

Fixes

  • Allow built-in directives to be redefined - SimonSapin, pull/684 fixing issue/656
  • Allow schema extensions to extend a schema definition implied by object types named after default root operations - SimonSapin, pull/678 fixing [issues/682]