Skip to content

Commit

Permalink
Fixed issue that caused the tag directive to be ignored. (#6746)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Dec 16, 2023
1 parent bc2fa50 commit a12f33e
Show file tree
Hide file tree
Showing 797 changed files with 5,536 additions and 2,287 deletions.
31 changes: 31 additions & 0 deletions .build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Linq;
using System;
using System.IO;
using Serilog;

[UnsetVisualStudioEnvironmentVariables]
partial class Build : NukeBuild
Expand Down Expand Up @@ -100,6 +101,36 @@ partial class Build : NukeBuild
RootDirectory / "matrix.json",
JsonConvert.SerializeObject(matrix));
});

Target Accept => _ => _
.Executes(() =>
{
foreach (var mismatchDir in Directory.GetDirectories(
RootDirectory, "__MISMATCH__", SearchOption.AllDirectories))
{
Log.Information("Analyzing {0} ...", mismatchDir);

var snapshotDir = Directory.GetParent(mismatchDir)!.FullName;
foreach (var mismatch in Directory.GetFiles(
mismatchDir, "*.*", SearchOption.TopDirectoryOnly))
{
var snapshot = Path.Combine(snapshotDir, Path.GetFileName(mismatch));
if (File.Exists(snapshot))
{
File.Delete(snapshot);
File.Move(mismatch, snapshot);
}
}

foreach (var mismatch in Directory.GetFiles(
mismatchDir, "*.*", SearchOption.AllDirectories))
{
File.Delete(mismatch);
}

Directory.Delete(mismatchDir, true);
}
});
}


Expand Down
6 changes: 6 additions & 0 deletions accept.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/accept.sh "$@"
:; exit $?

./build.cmd accept
44 changes: 1 addition & 43 deletions accept.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
#!/bin/zsh

# Use a variable to keep track of whether any directories were found
found_mismatch=false

# Use a variable to check if the header has been printed
header_printed=false

# Find all __MISMATCH__ folders
find . -type d -name "__MISMATCH__" | while read mismatch_dir; do
# Mark that we found a mismatch directory
found_mismatch=true

# Get the parent __snapshots__ directory
snapshot_dir="$(dirname "$mismatch_dir")"

# If there are files in the directory, copy them
if [ "$(ls -A "$mismatch_dir")" ]; then
for file in "$mismatch_dir"/*; do
if [ -f "$file" ]; then
cp "$file" "$snapshot_dir/"

# Print the header only once
if [ "$header_printed" = false ]; then
echo "Found Updated Snapshots:"
header_printed=true
fi

# Extract relevant path details and print
relative_path="${snapshot_dir#./src/HotChocolate/}" # strip the common prefix
echo "- $relative_path/$(basename "$file")"
fi
done
fi

# Remove the __MISMATCH__ directory
rm -r "$mismatch_dir"
done

# Check if any directories were found
if [ "$found_mismatch" = false ]; then
echo "All snapshots are up to date!"
else
echo "\nDone!"
fi
./build.sh accept
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ extend type User @key(fields: "email") {
email: ID! @external
totalProductsCreated: Int @external
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ extend type User @key(fields: "email") {
email: ID! @external
totalProductsCreated: Int @external
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ type Query {

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ directive @external on FIELD_DEFINITION
"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ type Query {

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,9 @@ type _Service {
"Union of all types that key directive applied. This information is needed by the Apollo federation gateway."
union _Entity = TestTypePropertyDirective

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,9 @@ type _Service {
"Union of all types that key directive applied. This information is needed by the Apollo federation gateway."
union _Entity = TestTypePropertyDirectives

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ type TestType @key(fields: "id") {
"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"Scalar representing a set of fields."
scalar _FieldSet
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,9 @@ type _Service {
"Union of all types that key directive applied. This information is needed by the Apollo federation gateway."
union _Entity = TestTypeClassDirective

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ type TestType @key(fields: "id") {
"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"Scalar representing a set of fields."
scalar _FieldSet
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,12 @@ type _Service {
"Union of all types that key directive applied. This information is needed by the Apollo federation gateway."
union _Entity = Review

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"Scalar representing a set of fields."
scalar _FieldSet
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"Scalar representing a set of fields."
scalar _FieldSet
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,12 @@ type _Service {
"Union of all types that key directive applied. This information is needed by the Apollo federation gateway."
union _Entity = Review

"Directive to indicate that a field is owned by another service, for example via Apollo federation."
directive @external on FIELD_DEFINITION

"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface."
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE

"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway."
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION

"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"Scalar representing a set of fields."
scalar _FieldSet
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"Scalar representing a set of fields."
scalar _FieldSet
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ protected ISchema CreateSchema(Action<ISchemaBuilder> configure)
{
c.Name("Query");
c.Field("foo").Type<StringType>().Resolve("bar");
});
})
.ModifyOptions(o => o.RemoveUnusedTypeSystemDirectives = false);

configure(builder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ type Query {
deprecated1: EnumWithDeprecatedValue @deprecated(reason: "deprecated")
deprecated2: EnumWithDeprecatedValue @deprecated(reason: "deprecated")
}

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ type Query {
}

directive @custom on FIELD_DEFINITION | ENUM_VALUE

directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ type User @key(fields: "id") {
idCodeShort: String! @requires(fields: "idCode")
address: Address! @provides(fields: "zipcode")
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ type TestType @key(fields: "id") {
id: Int!
name: String!
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ interface iTestType @key(fields: "id") {
id: Int!
external: String! @external
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@ interface iTestType @key(fields: "id") {
id: Int!
external: String! @external
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
type QueryRootOfProduct {
entity(id: Int!): Product!
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
type Address @key(fields: "matchCode") {
matchCode: String
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
type Address @key(fields: "matchCode") {
matchCode: String!
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
type Query {
address(id: Int!): Address!
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
type Query {
address: Address!
}

directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
Loading

0 comments on commit a12f33e

Please sign in to comment.