graphql_schema2 8.0.0
graphql_schema2: ^8.0.0 copied to clipboard
An implementation of GraphQL's type system in Dart. Basis of graphql_server2.
Change Log #
8.0.0 #
Breaking changes in 8.0.0 #
- Breaking:
validatereturns a failedValidationResultfor wrongly typed input instead of throwing aTypeError. This applies to lists, objects, input objects, unions, non-null types and the min/max/range string and number types. - Breaking: Number types reject
null, like the other scalar types. Objects, input objects and lists still acceptnullfor nullable fields and items. - Breaking: An enum's
validateaccepts only value names. Dart values are converted withconvert, whichGraphQLObjectType.validateapplies to resolver output. - Breaking:
GraphQLType.convertreturnsnullfor a value it cannot convert, instead of throwing. - Breaking:
GraphQLUnionType.coerceToInputObjectthrows anUnsupportedError, as a union cannot be an input type. - Breaking:
toInputObjectandcoerceToInputObjecton an object type leave out a nullable field whose type cannot be an input, such as a union, an interface or an object with no input fields. They throw anUnsupportedErrorfor such a field that is non-null, for an interface, and for an object left with no input fields. - Breaking:
coerceToInputObjecton an object type builds its${name}Inputtype once and returns the same instance after that, so fields added to the object type later are not included.toInputObjectwith that name returns it too, and throws anArgumentErrorfor another description, which the shared input type cannot have. - Breaking: A
GraphQLFieldResolver's first parameter is the parent value the field is resolved on, typeddynamic, instead of the field's ownSerializedtype, which it never received. A resolver can read a model object with(todo, _) => todo.textor(todo, _) => (todo as Todo).text. One that declares a type for that parameter, such as(Todo todo, _) => ..., no longer compiles. - Breaking: Type hash codes no longer include fields, so equal types have equal hash codes and self-referencing types can be hashed.
New in 8.0.0 #
ValidationResult.okandValidationResult.failure, so a custom type, such as a scalar, can return the result of itsvalidate.field()accepts arguments of any type, not only the field's own type.
Fixes in 8.0.0 #
- Validation: A
nullvalue for a nullable field is accepted, and anullvalue for a non-null field is reported once. - Validation: A
nulllist item is accepted when the list's Dart type can hold it, as inlistOf<dynamic, dynamic>(...), and otherwise rejected with an error. - Validation: The values returned by nested validators are kept, so nested input objects have
Stringkeys. - Serialization:
nullfield values serialize and deserialize asnull. - Numbers:
Floataccepts and convertsIntinput. - Unions: Resolving a union or interface member handles enum, list-of-enum and
Datefields holding Dart values. - Equality:
GraphQLFieldInputequality comparesdefaultValue. - Enums: A Dart
Enumvalue named after one of an enum type's values is serialized and converted to that name, so a model serialized to a map, which keeps its enum values, can be output. - Input objects:
toInputObjectandcoerceToInputObjecthandle object types that refer to themselves or to each other, instead of overflowing the stack. A failed conversion leaves no partly built input types behind. - Lists: Resolver output for a list of enum or
Datevalues is converted item by item, so anullitem is reported on its own instead of failing every other item too. - Lists:
serializeanddeserializekeep anullitem the list can hold, and throw anArgumentErrorfor one it cannot, such as anullitem for a non-null item type, instead of passing it to the item type. - Equality: Comparing object or input object types that refer to themselves, or to each other, no longer overflows the stack, including two such types built apart, which are equal when all else about them is. Their interfaces are compared too, where they were left out, and types that many fields refer to are compared once, not once per path to them.
7.0.0 #
- Require Dart >= 3.13
6.5.0 #
- Require Dart >= 3.9
6.4.1 #
- Fix analyzer warnings
6.4.0 #
- Require Dart >= 3.8
- Updated
lintsto 6.0.0 - Updated dependencies to the latest release
6.3.0 #
- Require Dart >= 3.6
- Updated
lintsto 5.0.0
6.2.0 #
- Require Dart >= 3.3
- Updated
lintsto 4.0.0
6.1.0 #
- Updated
lintsto 3.0.0 - Fixed linter warnings
- Updated repository link
6.0.0 #
- Require dart >= 3.0.x
5.0.0 #
- Require dart >= 2.17.x
4.0.0 #
- Require dart >= 2.16.x
3.0.0 #
- Implemented directives
- Added polymorphic type names (basically type alias for polymorphism)
- Updated to SDK 2.15.x
2.1.1 #
- Fixed bug in enums
2.1.0 #
- Upgraded from
pendantictolintslinter
2.0.0 #
- Migrated to support Dart SDK 2.12.x NNBD
- Rename
graphql_schematographql_schema2
1.0.4 #
- Add
convertmethod to types, to avoid some annoying generics bugs.
1.0.3 #
enumTypeFromStringsnow returnsGraphQLEnumType<String>.
1.0.2 #
- Added
GraphQLClass(). - Added
typeName.
1.0.1 #
- Dart 2 updates.