apollo-compiler@1.0.0-beta.2
1.0.0-beta.2 - 2023-10-10
BREAKING
Assorted Schema API changes by SimonSapin in pull/678:
- Type of the
schema_definitionfield changed
fromOption<SchemaDefinition>toSchemaDefinition.
Default root operations based on object type names
are now stored explicitly inSchemaDefinition.
Serialization relies on a heuristic to decide on implicit schema definition. - Removed
schema_definition_directivesmethod: no longer having anOptionallows
fieldschema.schema_definition.directivesto be accessed directly - Removed
query_root_operation,mutation_root_operation, andsubscription_root_operation
methods. Insteadschema.schema_definition.queryetc can be accessed directly.
Features
-
Add
executable::FieldSetfor a selection set with optional outer brackets - lrlna, pull/685 fixing issue/681
This is intended to parse string value of aFieldSetcustom scalar
used in some Apollo Federation directives in the context of a specific schema and type.
Itsvalidatemethod 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]