async-graphql/tests/schemas/test_entity_tag.schema.graphql
Dominik Spicher b020ce5aee tests/federation: compare export_sdl against expected schema
This commit adds logic to two unit tests where the schema
export is compared against expected output cached in two
schema files.

This is intended to help prevent bugs like the ones fixed in
faf407b or the immediately succeeding commit, as unexpected
changes to schema export will become apparent in the commit
diff, easing reviews.

When legitimately changing the export output behaviour,
the test suite just needs to be run twice, as the unit-tests
automatically overwrite the files with the new version.

This unit-test approach is inspired by

https://matklad.github.io/2022/03/26/self-modifying-code.html
2022-08-29 22:23:28 +02:00

68 lines
1.6 KiB
GraphQL

type MyCustomObjTagged @tag(name: "tagged") @tag(name: "object") @tag(name: "with") @tag(name: "multiple") @tag(name: "tags") {
a: Int!
customObjectTagged: Int! @tag(name: "tagged_custom_object_field")
}
enum MyEnumTagged @tag(name: "tagged_num"){
OPTION_A
OPTION_B
OPTION_C
}
enum MyEnumVariantTagged{
OPTION_A_TAGGED @tag(name: "tagged_enum_option")
OPTION_B
OPTION_C
}
input MyInputObjFieldTagged{
inputFieldTaggedA: Int! @tag(name: "tagged_input_object_field")
}
input MyInputObjTagged @tag(name: "input_object_tag"){
a: Int!
}
type MyInterfaceObjA implements MyInterfaceTagged {
taggedInterfaceValue: String!
}
type MyInterfaceObjB implements MyInterfaceTagged @tag(name: "interface_object") {
taggedInterfaceValue: String!
}
interface MyInterfaceTagged @tag(name: "tagged_interface") {
taggedInterfaceValue: String! @tag(name: "tagged_interface_field")
}
scalar MyNumberTagged @tag(name: "tagged_scalar")
type MyObjFieldTagged @key(fields: "id") {
objFieldTaggedA: Int! @tag(name: "tagged_field")
}
type MyObjTagged @key(fields: "id") @tag(name: "tagged_simple_object") {
a: Int!
}
union MyUnionTagged @tag(name: "tagged_union") = MyInterfaceObjA | MyInterfaceObjB
extend type Query {
enumVariantTagged(id: Int!): MyEnumVariantTagged!
enumTagged(id: Int!): MyEnumTagged!
taggedField(id: Int!): Int! @tag(name: "tagged_\"field\"")
taggedArgument(id: Int! @tag(name: "tagged_argument")): Int!
taggedInterface: MyInterfaceTagged!
taggedUnion: MyUnionTagged!
taggedScalar: MyNumberTagged!
taggedInputField(value: MyInputObjFieldTagged!): Int!
taggedInput(value: MyInputObjTagged!): Int!
taggedCustomObject: MyCustomObjTagged!
}