graphql_schema3 3.2.1
graphql_schema3: ^3.2.1 copied to clipboard
An implementation of the GraphQL type system in Dart. Builds object, union, enum, input and scalar types, and validates and coerces values against them.
Change Log #
3.2.1 #
Changed #
LICENSEcarries a copyright notice for the work done on this line, next to the upstream one it has always kept, as the BSD-3-Clause terms require.AUTHORS.mdalready recorded who did what; the licence file now says the same thing.- The README says where to look for both, rather than describing the licence file as untouched.
No code changed.
3.2.0 #
First release published to pub.dev. The package was consumed straight from its git repository until now.
Fixed #
-
Validation refuses rather than raises. Every validator narrowed the parameter the base class declares
covariant- an object type took aMap, a list type aList, a bounded scalar its ownT- so a value of the wrong shape did not fail validation, it raised aTypeErrorfrom the call boundary. That is the one thing validation exists to prevent. All nine overrides takeObject?now and answer a failedValidationResult.The two shape checks that would have caught this were present but commented out, because with a
Map-typed parameter they were unreachable. They are restored along with the widened parameter. -
The bounded scalars measured the raw input rather than the validated value, and their supertype accepts
null, soGraphQLNumMinType.validate(key, null)crashed on the comparison. A null now passes the bound untouched: whether it is legal at all is the non-nullable wrapper's business, not the bound's.
Added #
example/main.dart: builds a small schema by hand, then validates values against it, including theInt/Floatcoercion rule.- Package metadata for pub.dev: a description that says what the package does rather than what to use instead, an issue tracker, and topics.
- 9 tests covering the above. 50 in all.
3.1.0 #
Fixed #
- Validating an unknown enum literal raised
Bad state: No elementinstead of returning a failedValidationResult. For a string-valued enum, built withenumTypeFromStrings, every literal took that path, so any client sending an unrecognised value crashed the resolver. Bothvalidateandconvertare affected. - A field whose input has the wrong type raised a cast error while validating
an object, rather than reporting the mismatch.
GraphQLType.convertnow answersnullfor a value of the wrong shape. Floatrejected an integer literal. The specification coerces an integer toFloat, and only in that direction, so4is now a validFloatwhile4.2remains an invalidInt.GraphQLFieldInput.operator ==comparedother.defaultValuewith itself, so two inputs differing only by their default value compared as equal.GraphQLEnumType,GraphQLObjectType,GraphQLInputObjectTypeandGraphQLUnionTypehashed the identity of their field list while comparing its contents, so two equal instances could carry different hash codes. That breaks theObjectcontract and, with it, anySetorMapkeyed on a type.GraphQLObjectType.hashCodeandGraphQLInputObjectType.hashCodefoldednamein twice and neverdescription.
Removed #
- The
quiverdependency. Itshash2/hash3/hash4were the only thing used andObject.hashcovers them.
Added #
- A test suite. There was none.
3.0.0 #
- Initial release