diff --git a/.editorconfig b/.editorconfig index fb8adc980ac..820a244b54e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -121,3 +121,12 @@ resharper_trailing_comma_in_multiline_lists = true resharper_wrap_before_binary_pattern_op = false resharper_wrap_chained_binary_expressions = chop_if_long resharper_wrap_chained_binary_patterns = chop_if_long + +# Require braces on all control statements +resharper_csharp_braces_for_ifelse = required +resharper_csharp_braces_for_for = required +resharper_csharp_braces_for_foreach = required +resharper_csharp_braces_for_while = required +resharper_csharp_braces_for_using = required +resharper_csharp_braces_for_lock = required +resharper_csharp_braces_for_fixed = required \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ea91981d37c..2d418fa88b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -## [12.0.1] +## [12.0.1] - 2021-10-01 ### Hot Chocolate @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Return argument value as field definition runtimeType if requested as object type by @benmccallum (#4291) -## [12.0.0] +## [12.0.0] - 2021-09-27 ### Hot Chocolate @@ -106,7 +106,7 @@ Return argument value as field definition runtimeType if requested as object typ - Optimized component code splitting for better load times - Fixed shortcut label texts for Windows and Linux -## [11.1.0] +## [11.1.0] - 2021-03-30 ### Added @@ -181,7 +181,7 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed nullable matrix types in schema first. (#2998) - Fixed fragment projections issue with the operation compiler. (#2920) -## [11.0.9] +## [11.0.9] - 2021-01-27 ### Added @@ -197,7 +197,7 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed selection optimizer were not resolved correctly. (#2889) - Fixed projection of edge type (#2888) -## [11.0.8] +## [11.0.8] - 2021-01-14 ### Added @@ -218,7 +218,7 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed string literals in places of enum values have to raise a query errors. (#2846) - Fixed issues with Apollo active persisted queries flow. (#2864) -## [11.0.7] +## [11.0.7] - 2021-01-06 ### Added @@ -230,38 +230,38 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed argument renaming during schema stitching. (#2784) - Fixed cursor backward pagination with two list elements (#2777) -## [11.0.6] +## [11.0.6] - 2020-12-23 ### Fixed - Fixed error filters not being activated (#2774) -## [11.0.5] +## [11.0.5] - 2020-12-18 ### Fixed - Fixes query rewriting when fields are merged during stitching. (#2765) -## [11.0.4] +## [11.0.4] - 2020-12-16 ### Fixed - Fixed executable detection (#2762) -## [11.0.3] +## [11.0.3] - 2020-12-15 ### Fixed - Added back the syntax serializers for backward compatibility (#2758) -## [11.0.2] +## [11.0.2] - 2020-12-08 ### Fixed - Fixed PagingAmountRewriter for stitching in migration guide (#2737) - Fixed execution of batch requests (#2726) -## [11.0.1] +## [11.0.1] - 2020-12-02 ### Added @@ -277,7 +277,7 @@ Return argument value as field definition runtimeType if requested as object typ - Removed legacy syntax printer and ensured that only the new one is used. (#2711) -## [11.0.0] +## [11.0.0] - 2020-11-23 ### Added @@ -338,37 +338,37 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed inference of enum values from GraphQL SDL - Fixed issue with non-null arguments that have defaults (#2441) -## [10.5.5] +## [10.5.5] - 2020-11-23 ### Fixed - Fixed operation serialization [#2646](https://github.com/ChilliCream/graphql-platform/pull/2646) -## [10.5.4] +## [10.5.4] - 2020-11-18 ### Fixed - Fixed QueryRequestBuild handling of extensions. [#2608](https://github.com/ChilliCream/graphql-platform/pull/2608) -## [10.5.3] +## [10.5.3] - 2020-09-27 ### Fixed - Fixed ConnectionMiddleware and IEnumerable + IConnection [#2378](https://github.com/ChilliCream/graphql-platform/pull/2378) -## [10.5.2] +## [10.5.2] - 2020-07-28 ### Fixed - Fixed ID serialization on input types [#2174](https://github.com/ChilliCream/graphql-platform/pull/2174) -## [10.5.1] +## [10.5.1] - 2020-07-28 ### Fixed - Fixed field discovery [#2167](https://github.com/ChilliCream/graphql-platform/pull/2167) -## [10.5.0] +## [10.5.0] - 2020-07-27 ### Added @@ -402,7 +402,7 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed schema type discovery issues. - Fixed field discovery for object type extensions. -## [10.4.0] +## [10.4.0] - 2020-03-18 ### Added @@ -429,45 +429,45 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed issue where the type dependencies of type extension where not correctly merged with the target type. - Fixed `UUID` type serialization. -## [10.3.6] +## [10.3.6] - 2020-02-28 ### Fixed - Fixed handling of variables when delegating data fetching through the stitching context. [#1390](https://github.com/ChilliCream/graphql-platform/pull/1390) -## [10.3.5] +## [10.3.5] - 2020-01-13 ### Fixed - Fixed issue that caused errors when collecting fields on a directive context -## [10.3.4] +## [10.3.4] - 2020-01-09 ### Fixed - Fixed default hash provider dependency injection configuration [#1363](https://github.com/ChilliCream/graphql-platform/pull/1363) -## [10.3.3] +## [10.3.3] - 2020-01-09 ### Fixed - Fixed argument non-null validation. - Fixed variable coercion. -## [10.3.2] +## [10.3.2] - 2020-01-06 ### Fixed - Fixed issue where input fields were no longer automatically converted. - Fixed issue where the float was rounded when provided as variable. -## [10.3.1] +## [10.3.1] - 2019-12-31 ### Fixed - Fixed issue that private setters where not used during input deserialization. -## [10.3.0] +## [10.3.0] - 2019-12-26 ### Added @@ -499,7 +499,7 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed parser error handling in middleware. [#1028](https://github.com/ChilliCream/graphql-platform/pull/1028) - Fixed directive delegation (@skip/@include) in stitching. [#937](https://github.com/ChilliCream/graphql-platform/pull/937) -## [10.2.0] +## [10.2.0] - 2019-10-31 ### Added @@ -528,7 +528,7 @@ Return argument value as field definition runtimeType if requested as object typ - The complecity middleware when multiplier where activated did only take the firs level into account. [#1137](https://github.com/ChilliCream/graphql-platform/pull/1137) - Errors when attempting to filter on nullable types. [#1121](https://github.com/ChilliCream/graphql-platform/pull/1121) -## [10.1.0] +## [10.1.0] - 2019-09-13 ### Added @@ -547,7 +547,7 @@ Return argument value as field definition runtimeType if requested as object typ - Fixed scoped service handling. [#1066](https://github.com/ChilliCream/graphql-platform/pull/1066) - Fixed Duplicate service registration. [#1066](https://github.com/ChilliCream/graphql-platform/pull/1066) -## [10.0.0] +## [10.0.0] - 2019-08-14 ### Added @@ -883,7 +883,42 @@ Return argument value as field definition runtimeType if requested as object typ - Diagnostic source which can be used to track field execution times and other events. - Implementing a directive middleware has now become much easier with this release. We have built the authorize-directive with these new APIs. -[unreleased]: https://github.com/ChilliCream/graphql-platform/compare/0.8.2...HEAD +[unreleased]: https://github.com/ChilliCream/graphql-platform/compare/12.0.1...HEAD +[12.0.1]: https://github.com/ChilliCream/graphql-platform/compare/12.0.0...12.0.1 +[12.0.0]: https://github.com/ChilliCream/graphql-platform/compare/11.1.0...12.0.0 +[11.1.0]: https://github.com/ChilliCream/graphql-platform/compare/11.0.9...11.1.0 +[11.0.9]: https://github.com/ChilliCream/graphql-platform/compare/11.0.8...11.0.9 +[11.0.8]: https://github.com/ChilliCream/graphql-platform/compare/11.0.7...11.0.8 +[11.0.7]: https://github.com/ChilliCream/graphql-platform/compare/11.0.6...11.0.7 +[11.0.6]: https://github.com/ChilliCream/graphql-platform/compare/11.0.5...11.0.6 +[11.0.5]: https://github.com/ChilliCream/graphql-platform/compare/11.0.4...11.0.5 +[11.0.4]: https://github.com/ChilliCream/graphql-platform/compare/11.0.3...11.0.4 +[11.0.3]: https://github.com/ChilliCream/graphql-platform/compare/11.0.2...11.0.3 +[11.0.2]: https://github.com/ChilliCream/graphql-platform/compare/11.0.1...11.0.2 +[11.0.1]: https://github.com/ChilliCream/graphql-platform/compare/11.0.0...11.0.1 +[11.0.0]: https://github.com/ChilliCream/graphql-platform/compare/10.5.5...11.0.0 +[10.5.5]: https://github.com/ChilliCream/graphql-platform/compare/10.5.4...10.5.5 +[10.5.4]: https://github.com/ChilliCream/graphql-platform/compare/10.5.3...10.5.4 +[10.5.3]: https://github.com/ChilliCream/graphql-platform/compare/10.5.2...10.5.3 +[10.5.2]: https://github.com/ChilliCream/graphql-platform/compare/10.5.1...10.5.2 +[10.5.1]: https://github.com/ChilliCream/graphql-platform/compare/10.5.0...10.5.1 +[10.5.0]: https://github.com/ChilliCream/graphql-platform/compare/10.4.0...10.5.0 +[10.4.0]: https://github.com/ChilliCream/graphql-platform/compare/10.3.6...10.4.0 +[10.3.6]: https://github.com/ChilliCream/graphql-platform/compare/10.3.5...10.3.6 +[10.3.5]: https://github.com/ChilliCream/graphql-platform/compare/10.3.4...10.3.5 +[10.3.4]: https://github.com/ChilliCream/graphql-platform/compare/10.3.3...10.3.4 +[10.3.3]: https://github.com/ChilliCream/graphql-platform/compare/10.3.2...10.3.3 +[10.3.2]: https://github.com/ChilliCream/graphql-platform/compare/10.3.1...10.3.2 +[10.3.1]: https://github.com/ChilliCream/graphql-platform/compare/10.3.0...10.3.1 +[10.3.0]: https://github.com/ChilliCream/graphql-platform/compare/10.2.0...10.3.0 +[10.2.0]: https://github.com/ChilliCream/graphql-platform/compare/10.1.0...10.2.0 +[10.1.0]: https://github.com/ChilliCream/graphql-platform/compare/10.0.0...10.1.0 +[10.0.0]: https://github.com/ChilliCream/graphql-platform/compare/9.0.4...10.0.0 +[9.0.4]: https://github.com/ChilliCream/graphql-platform/compare/9.0.3...9.0.4 +[9.0.3]: https://github.com/ChilliCream/graphql-platform/compare/9.0.2...9.0.3 +[9.0.2]: https://github.com/ChilliCream/graphql-platform/compare/9.0.1...9.0.2 +[9.0.1]: https://github.com/ChilliCream/graphql-platform/compare/9.0.0...9.0.1 +[9.0.0]: https://github.com/ChilliCream/graphql-platform/compare/0.8.2...9.0.0 [0.8.2]: https://github.com/ChilliCream/graphql-platform/compare/0.8.1...0.8.2 [0.8.1]: https://github.com/ChilliCream/graphql-platform/compare/0.8.0...0.8.1 [0.8.0]: https://github.com/ChilliCream/graphql-platform/compare/0.7.0...0.8.0 diff --git a/src/HotChocolate/ApolloFederation/Directory.Build.props b/src/HotChocolate/ApolloFederation/Directory.Build.props index c3a1a4be296..457246e96e5 100644 --- a/src/HotChocolate/ApolloFederation/Directory.Build.props +++ b/src/HotChocolate/ApolloFederation/Directory.Build.props @@ -3,6 +3,6 @@ enable - $(Library2TargetFrameworks) + $(Library3TargetFrameworks) diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownArgumentNames.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownArgumentNames.cs deleted file mode 100644 index 2ba2d494e34..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownArgumentNames.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace HotChocolate.ApolloFederation.Constants; - -internal static class WellKnownArgumentNames -{ - public const string Fields = "fields"; - public const string Representations = "representations"; -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownContextData.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownContextData.cs deleted file mode 100644 index 5180cf6e0be..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownContextData.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace HotChocolate.ApolloFederation.Constants; - -internal static class WellKnownContextData -{ - public const string KeyMarker = "HotChocolate.ApolloFederation.Key"; - public const string ExtendMarker = "HotChocolate.ApolloFederation.Extend"; - public const string ExternalSetter = "HotChocolate.ApolloFederation.ExternalSetter"; - public const string EntityResolver = "HotChocolate.ApolloFederation.EntityResolver"; - public const string DataField = "data"; - public const string TypeField = "__type"; -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownTypeNames.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownTypeNames.cs deleted file mode 100644 index 89c1ae9fba1..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownTypeNames.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace HotChocolate.ApolloFederation.Constants; - -internal static class WellKnownTypeNames -{ - public const string External = "external"; - public const string Requires = "requires"; - public const string Provides = "provides"; - public const string Key = "key"; - public const string FieldSet = "_FieldSet"; - public const string Any = "_Any"; - public const string Entity = "_Entity"; - public const string Service = "_Service"; -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/IEntityResolverDescriptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/IEntityResolverDescriptor.cs deleted file mode 100644 index e25defb1199..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/IEntityResolverDescriptor.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System.Linq.Expressions; -using System.Reflection; -using HotChocolate.Resolvers; - -namespace HotChocolate.ApolloFederation.Descriptors; - -/// -/// The entity descriptor allows to specify a reference resolver. -/// -public interface IEntityResolverDescriptor -{ - /// - /// Resolve an entity from its representation. - /// - /// - /// The resolver. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReference( - FieldResolverDelegate fieldResolver); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The reference resolver selector. - /// - /// - /// The type on which the reference resolver is located. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith( - Expression> method); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The type on which the reference resolver is located. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith(); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The reference resolver. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The type on which the reference resolver is located. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith(Type type); -} - -/// -/// The entity descriptor allows to specify a reference resolver. -/// -public interface IEntityResolverDescriptor -{ - /// - /// Resolve an entity from its representation. - /// - /// - /// The resolver. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReference( - FieldResolverDelegate fieldResolver); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The reference resolver selector. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith( - Expression> method); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The reference resolver selector. - /// - /// - /// The type on which the reference resolver is located. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith( - Expression> method); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The type on which the reference resolver is located. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith(); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The reference resolver. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method); - - /// - /// Resolve an entity from its representation. - /// - /// - /// The type on which the reference resolver is located. - /// - /// - /// Returns the descriptor for configuration chaining. - /// - IObjectTypeDescriptor ResolveReferenceWith(Type type); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/EntityType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/EntityType.cs deleted file mode 100644 index 6f070a1e6f9..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/EntityType.cs +++ /dev/null @@ -1,16 +0,0 @@ -using HotChocolate.ApolloFederation.Properties; -using static HotChocolate.ApolloFederation.Constants.WellKnownTypeNames; - -namespace HotChocolate.ApolloFederation; - -/// -/// A union called _Entity which is a union of all types that use the @key directive, -/// including both types native to the schema and extended types. -/// -public sealed class EntityType : UnionType -{ - protected override void Configure(IUnionTypeDescriptor descriptor) - => descriptor - .Name(Entity) - .Description(FederationResources.EntityType_Description); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExtendServiceTypeAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExtendServiceTypeAttribute.cs deleted file mode 100644 index 47ff6842b02..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExtendServiceTypeAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -using HotChocolate.Types.Descriptors; - -namespace HotChocolate.ApolloFederation; - -/// -/// This attribute is used to mark types as an extended type -/// of a type that is defined by another service when -/// using apollo federation. -/// -[AttributeUsage( - AttributeTargets.Class | - AttributeTargets.Struct | - AttributeTargets.Interface)] -public sealed class ExtendServiceTypeAttribute : ObjectTypeDescriptorAttribute -{ - protected override void OnConfigure( - IDescriptorContext context, - IObjectTypeDescriptor descriptor, - Type type) - => descriptor.ExtendServiceType(); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationDescriptorExtensions.cs deleted file mode 100644 index 721b9eb53c5..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationDescriptorExtensions.cs +++ /dev/null @@ -1,227 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Descriptors; -using HotChocolate.Language; -using static HotChocolate.ApolloFederation.Properties.FederationResources; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; - -namespace HotChocolate.Types; - -/// -/// Provides extensions for type system descriptors. -/// -public static partial class ApolloFederationDescriptorExtensions -{ - /// - /// Adds the @external directive which is used to mark a field as owned by another service. - /// This allows service A to use fields from service B while also knowing at runtime - /// the types of that field. - /// - /// - /// # extended from the Users service - /// extend type User @key(fields: "email") { - /// email: String @external - /// reviews: [Review] - /// } - /// - /// - /// - /// The object field descriptor on which this directive shall be annotated. - /// - /// - /// Returns the object field descriptor. - /// - /// - /// The is null. - /// - public static IObjectFieldDescriptor External( - this IObjectFieldDescriptor descriptor) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - return descriptor.Directive(WellKnownTypeNames.External); - } - - /// - /// Adds the @key directive which is used to indicate a combination of fields that - /// can be used to uniquely identify and fetch an object or interface. - /// - /// type Product @key(fields: "upc") { - /// upc: UPC! - /// name: String - /// } - /// - /// - /// - /// The object type descriptor on which this directive shall be annotated. - /// - /// - /// The field set that describes the key. - /// Grammatically, a field set is a selection set minus the braces. - /// - /// - /// - /// is null. - /// - /// - /// is null or . - /// - public static IEntityResolverDescriptor Key( - this IObjectTypeDescriptor descriptor, - string fieldSet) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - if (string.IsNullOrEmpty(fieldSet)) - { - throw new ArgumentException( - FieldDescriptorExtensions_Key_FieldSet_CannotBeNullOrEmpty, - nameof(fieldSet)); - } - - descriptor.Directive( - WellKnownTypeNames.Key, - new ArgumentNode( - WellKnownArgumentNames.Fields, - new StringValueNode(fieldSet))); - - return new EntityResolverDescriptor(descriptor); - } - - /// - /// Adds the @requires directive which is used to annotate the required - /// input fieldset from a base type for a resolver. It is used to develop - /// a query plan where the required fields may not be needed by the client, but the - /// service may need additional information from other services. - /// - /// - /// # extended from the Users service - /// extend type User @key(fields: "id") { - /// id: ID! @external - /// email: String @external - /// reviews: [Review] @requires(fields: "email") - /// } - /// - /// - /// - /// The object field descriptor on which this directive shall be annotated. - /// - /// - /// The describes which fields may - /// not be needed by the client, but are required by - /// this service as additional information from other services. - /// Grammatically, a field set is a selection set minus the braces. - /// - /// - /// Returns the object field descriptor. - /// - /// - /// is null. - /// - /// - /// is null or . - /// - public static IObjectFieldDescriptor Requires( - this IObjectFieldDescriptor descriptor, - string fieldSet) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - if (string.IsNullOrEmpty(fieldSet)) - { - throw new ArgumentException( - FieldDescriptorExtensions_Requires_FieldSet_CannotBeNullOrEmpty, - nameof(fieldSet)); - } - - return descriptor.Directive( - WellKnownTypeNames.Requires, - new ArgumentNode( - WellKnownArgumentNames.Fields, - new StringValueNode(fieldSet))); - } - - /// - /// Adds the @provides directive which is used to annotate the expected returned - /// fieldset from a field on a base type that is guaranteed to be selectable by - /// the gateway. - /// - /// - /// # extended from the Users service - /// type Review @key(fields: "id") { - /// product: Product @provides(fields: "name") - /// } - /// - /// extend type Product @key(fields: "upc") { - /// upc: String @external - /// name: String @external - /// } - /// - /// - /// - /// The object field descriptor on which this directive shall be annotated. - /// - /// - /// The fields that are guaranteed to be selectable by the gateway. - /// Grammatically, a field set is a selection set minus the braces. - /// - /// - /// Returns the object field descriptor. - /// - /// - /// is null. - /// - /// - /// is null or . - /// - public static IObjectFieldDescriptor Provides( - this IObjectFieldDescriptor descriptor, - string fieldSet) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - if (string.IsNullOrEmpty(fieldSet)) - { - throw new ArgumentException( - FieldDescriptorExtensions_Provides_FieldSet_CannotBeNullOrEmpty, - nameof(fieldSet)); - } - - return descriptor.Directive( - WellKnownTypeNames.Provides, - new ArgumentNode( - WellKnownArgumentNames.Fields, - new StringValueNode(fieldSet))); - } - - /// - /// Mark the type as an extension - /// of a type that is defined by another service when - /// using apollo federation. - /// - public static IObjectTypeDescriptor ExtendServiceType( - this IObjectTypeDescriptor descriptor) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - descriptor - .Extend() - .OnBeforeCreate(d => d.ContextData[ExtendMarker] = true); - - return descriptor; - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationDescriptorExtensions~1.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationDescriptorExtensions~1.cs deleted file mode 100644 index 99eb7ed4e56..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationDescriptorExtensions~1.cs +++ /dev/null @@ -1,82 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Descriptors; -using HotChocolate.Language; -using static HotChocolate.ApolloFederation.Properties.FederationResources; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; - -namespace HotChocolate.Types; - -/// -/// Provides extensions for type system descriptors. -/// -public static partial class ApolloFederationDescriptorExtensions -{ - /// - /// Adds the @key directive which is used to indicate a combination of fields that - /// can be used to uniquely identify and fetch an object or interface. - /// - /// type Product @key(fields: "upc") { - /// upc: UPC! - /// name: String - /// } - /// - /// - /// - /// The object type descriptor on which this directive shall be annotated. - /// - /// - /// The field set that describes the key. - /// Grammatically, a field set is a selection set minus the braces. - /// - /// - /// - /// is null. - /// - /// - /// is null or . - /// - public static IEntityResolverDescriptor Key( - this IObjectTypeDescriptor descriptor, - string fieldSet) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - if (string.IsNullOrEmpty(fieldSet)) - { - throw new ArgumentException( - FieldDescriptorExtensions_Key_FieldSet_CannotBeNullOrEmpty, - nameof(fieldSet)); - } - - descriptor.Directive( - WellKnownTypeNames.Key, - new ArgumentNode( - WellKnownArgumentNames.Fields, - new StringValueNode(fieldSet))); - - return new EntityResolverDescriptor(descriptor); - } - - /// - /// Mark the type as an extension - /// of a type that is defined by another service when - /// using apollo federation. - /// - public static IObjectTypeDescriptor ExtendServiceType( - this IObjectTypeDescriptor descriptor) - { - if (descriptor is null) - { - throw new ArgumentNullException(nameof(descriptor)); - } - - descriptor - .Extend() - .OnBeforeCreate(d => d.ContextData[ExtendMarker] = true); - - return descriptor; - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs index 5d6ddf5f0b5..511735be58d 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs @@ -1,6 +1,7 @@ -using System; +using HotChocolate.ApolloFederation; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; +using FederationVersion = HotChocolate.ApolloFederation.FederationVersion; namespace Microsoft.Extensions.DependencyInjection; @@ -15,6 +16,9 @@ public static class ApolloFederationRequestExecutorBuilderExtensions /// /// The . /// + /// + /// The apollo federation version to use. + /// /// /// Returns the . /// @@ -22,13 +26,12 @@ public static class ApolloFederationRequestExecutorBuilderExtensions /// The is null. /// public static IRequestExecutorBuilder AddApolloFederation( - this IRequestExecutorBuilder builder) + this IRequestExecutorBuilder builder, + FederationVersion version = FederationVersion.Latest) { - if (builder is null) - { - throw new ArgumentNullException(nameof(builder)); - } - - return builder.ConfigureSchema(s => s.AddApolloFederation()); + ArgumentNullException.ThrowIfNull(builder); + builder.SetContextData(FederationContextData.FederationVersion, version); + builder.TryAddTypeInterceptor(); + return builder; } } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs deleted file mode 100644 index a112a1b5d93..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs +++ /dev/null @@ -1,42 +0,0 @@ -using HotChocolate.ApolloFederation; -using AnyType = HotChocolate.ApolloFederation.AnyType; - -namespace HotChocolate; - -/// -/// Provides extensions to . -/// -public static class ApolloFederationSchemaBuilderExtensions -{ - /// - /// Adds support for Apollo Federation to the schema. - /// - /// - /// The . - /// - /// - /// Returns the . - /// - /// - /// The is null. - /// - internal static ISchemaBuilder AddApolloFederation( - this ISchemaBuilder builder) - { - if (builder is null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddType(); - builder.AddType(); - builder.AddType(); - builder.AddType(); - builder.AddType(); - builder.AddType(); - builder.AddType(); - builder.AddType(); - builder.TryAddTypeInterceptor(); - return builder; - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/DirectiveTypeDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/DirectiveTypeDescriptorExtensions.cs deleted file mode 100644 index 94b0acfa0f7..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/DirectiveTypeDescriptorExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using static HotChocolate.ApolloFederation.Constants.WellKnownArgumentNames; - -namespace HotChocolate.ApolloFederation; - -internal static class DirectiveTypeDescriptorExtensions -{ - public static IDirectiveTypeDescriptor FieldsArgument( - this IDirectiveTypeDescriptor descriptor) - { - descriptor - .Argument(Fields) - .Type>(); - - return descriptor; - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs new file mode 100644 index 00000000000..537a1a53209 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; +using HotChocolate.Types.Descriptors; +using HotChocolate.Types.Descriptors.Definitions; + +namespace HotChocolate.ApolloFederation; + +internal static class FederationVersionExtensions +{ + private static readonly Dictionary _uriToVersion = new() + { + [new Uri(FederationVersionUrls.Federation20)] = FederationVersion.Federation20, + [new Uri(FederationVersionUrls.Federation21)] = FederationVersion.Federation21, + [new Uri(FederationVersionUrls.Federation22)] = FederationVersion.Federation22, + [new Uri(FederationVersionUrls.Federation23)] = FederationVersion.Federation23, + [new Uri(FederationVersionUrls.Federation24)] = FederationVersion.Federation24, + [new Uri(FederationVersionUrls.Federation25)] = FederationVersion.Federation25, + }; + + private static readonly Dictionary _versionToUri = new() + { + [FederationVersion.Federation20] = new(FederationVersionUrls.Federation20), + [FederationVersion.Federation21] = new(FederationVersionUrls.Federation21), + [FederationVersion.Federation22] = new(FederationVersionUrls.Federation22), + [FederationVersion.Federation23] = new(FederationVersionUrls.Federation23), + [FederationVersion.Federation24] = new(FederationVersionUrls.Federation24), + [FederationVersion.Federation25] = new(FederationVersionUrls.Federation25), + }; + + public static FederationVersion GetFederationVersion( + this IDescriptor descriptor) + where T : DefinitionBase + { + var contextData = descriptor.Extend().Context.ContextData; + if (contextData.TryGetValue(FederationContextData.FederationVersion, out var value) && + value is FederationVersion version and > FederationVersion.Unknown) + { + return version; + } + + // TODO : resources + throw new InvalidOperationException("The configuration state is invalid."); + } + + public static FederationVersion GetFederationVersion( + this IDescriptorContext context) + { + if (context.ContextData.TryGetValue(FederationContextData.FederationVersion, out var value) && + value is FederationVersion version and > FederationVersion.Unknown) + { + return version; + } + + // TODO : resources + throw new InvalidOperationException("The configuration state is invalid."); + } + + public static Uri ToUrl(this FederationVersion version) + { + if(_versionToUri.TryGetValue(version, out var url)) + { + return url; + } + + // TODO : resources + throw new ArgumentException("The federation version is not supported.", nameof(version)); + } + + public static FederationVersion ToVersion(this Uri url) + { + if(_uriToVersion.TryGetValue(url, out var version)) + { + return version; + } + + // TODO : resources + throw new ArgumentException("The federation url is not supported.", nameof(url)); + } + + public static bool TryToVersion(this Uri url, out FederationVersion version) + => _uriToVersion.TryGetValue(url, out version); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExternalAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExternalAttribute.cs deleted file mode 100644 index b05bb154494..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExternalAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Reflection; -using HotChocolate.Types.Descriptors; - -namespace HotChocolate.ApolloFederation; - -/// -/// The @external directive is used to mark a field as owned by another service. -/// This allows service A to use fields from service B while also knowing at runtime -/// the types of that field. -/// -/// -/// # extended from the Users service -/// extend type User @key(fields: "email") { -/// email: String @external -/// reviews: [Review] -/// } -/// -/// -public sealed class ExternalAttribute : ObjectFieldDescriptorAttribute -{ - protected override void OnConfigure( - IDescriptorContext context, - IObjectFieldDescriptor descriptor, - MemberInfo member) - => descriptor.External(); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExternalDirectiveType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExternalDirectiveType.cs deleted file mode 100644 index 52b9e4bcd47..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ExternalDirectiveType.cs +++ /dev/null @@ -1,26 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Properties; - -namespace HotChocolate.ApolloFederation; - -/// -/// The @external directive is used to mark a field as owned by another service. -/// This allows service A to use fields from service B while also knowing at runtime -/// the types of that field. -/// -/// -/// # extended from the Users service -/// extend type User @key(fields: "email") { -/// email: String @external -/// reviews: [Review] -/// } -/// -/// -public sealed class ExternalDirectiveType : DirectiveType -{ - protected override void Configure(IDirectiveTypeDescriptor descriptor) - => descriptor - .Name(WellKnownTypeNames.External) - .Description(FederationResources.ExternalDirective_Description) - .Location(DirectiveLocation.FieldDefinition); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationContextData.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationContextData.cs new file mode 100644 index 00000000000..25f57164a49 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationContextData.cs @@ -0,0 +1,13 @@ +namespace HotChocolate.ApolloFederation; + +internal static class FederationContextData +{ + public const string KeyMarker = "HotChocolate.ApolloFederation.Key"; + public const string ContactMarker = "HotChocolate.ApolloFederation.Contact"; + public const string ExternalSetter = "HotChocolate.ApolloFederation.ExternalSetter"; + public const string EntityResolver = "HotChocolate.ApolloFederation.EntityResolver"; + public const string FederationVersion = "HotChocolate.ApolloFederation.Version"; + public const string ExportedDirectives = "HotChocolate.ApolloFederation.ExportedDirectives"; + public const string DataField = "data"; + public const string TypeField = "__type"; +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.DirectiveType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.DirectiveType.cs deleted file mode 100644 index 2f0966d8200..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.DirectiveType.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.Language; -using HotChocolate.Types.Introspection; -using HotChocolate.Utilities.Introspection; - -namespace HotChocolate.ApolloFederation; - -public static partial class FederationSchemaPrinter -{ - private static DirectiveDefinitionNode SerializeDirectiveTypeDefinition( - DirectiveType directiveType, - Context context) - { - var arguments = directiveType.Arguments - .Select(a => SerializeInputField(a, context)) - .ToList(); - - var locations = directiveType.Locations - .AsEnumerable() - .Select(l => new NameNode(l.MapDirectiveLocation().ToString())) - .ToList(); - - return new DirectiveDefinitionNode - ( - null, - new NameNode(directiveType.Name), - SerializeDescription(directiveType.Description), - directiveType.IsRepeatable, - arguments, - locations - ); - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.InputType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.InputType.cs deleted file mode 100644 index 5758dc1ff9f..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.InputType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Linq; -using HotChocolate.Language; - -namespace HotChocolate.ApolloFederation; - -public static partial class FederationSchemaPrinter -{ - private static InputObjectTypeDefinitionNode SerializeInputObjectType( - InputObjectType inputObjectType, - Context context) - { - var directives = SerializeDirectives(inputObjectType.Directives, context); - - var fields = inputObjectType.Fields - .Select(t => SerializeInputField(t, context)) - .ToList(); - - return new InputObjectTypeDefinitionNode( - null, - new NameNode(inputObjectType.Name), - SerializeDescription(inputObjectType.Description), - directives, - fields); - } - - private static InputValueDefinitionNode SerializeInputField( - IInputField inputValue, - Context context) - { - var directives = SerializeDirectives(inputValue.Directives, context); - - return new InputValueDefinitionNode( - null, - new NameNode(inputValue.Name), - SerializeDescription(inputValue.Description), - SerializeType(inputValue.Type, context), - inputValue.DefaultValue, - directives); - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.LeafType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.LeafType.cs deleted file mode 100644 index 1abddf1993f..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.LeafType.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using HotChocolate.Language; -using static HotChocolate.Types.SpecifiedByDirectiveType.Names; - -namespace HotChocolate.ApolloFederation; - -public static partial class FederationSchemaPrinter -{ - private static EnumTypeDefinitionNode SerializeEnumType( - EnumType enumType, - Context context) - { - var directives = SerializeDirectives(enumType.Directives, context); - - var values = enumType.Values - .Select(t => SerializeEnumValue(t, context)) - .ToList(); - - return new EnumTypeDefinitionNode( - null, - new NameNode(enumType.Name), - SerializeDescription(enumType.Description), - directives, - values); - } - - private static EnumValueDefinitionNode SerializeEnumValue( - IEnumValue enumValue, - Context context) - { - var directives = SerializeDirectives(enumValue.Directives, context); - - if (enumValue.IsDeprecated) - { - var deprecateDirective = DeprecatedDirective.CreateNode(enumValue.DeprecationReason); - - if(directives.Count == 0) - { - directives = new List { deprecateDirective }; - } - else - { - var temp = directives.ToList(); - temp.Add(deprecateDirective); - directives = temp; - } - } - - return new EnumValueDefinitionNode( - null, - new NameNode(enumValue.Name), - SerializeDescription(enumValue.Description), - directives); - } - - private static ScalarTypeDefinitionNode SerializeScalarType( - ScalarType scalarType, - Context context) - { - var directives = SerializeDirectives(scalarType.Directives, context); - - if (scalarType.SpecifiedBy is not null) - { - var copy = directives as List ?? directives.ToList(); - directives = copy; - copy.Add( - new DirectiveNode( - SpecifiedBy, - new ArgumentNode( - Url, - new StringValueNode(scalarType.SpecifiedBy.ToString())))); - } - - return new( - null, - new NameNode(scalarType.Name), - SerializeDescription(scalarType.Description), - directives); - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.OutputTypes.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.OutputTypes.cs deleted file mode 100644 index f54e6d4d805..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.OutputTypes.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System.Linq; -using HotChocolate.Language; - -namespace HotChocolate.ApolloFederation; - -public static partial class FederationSchemaPrinter -{ - private static IDefinitionNode? SerializeObjectType( - ObjectType objectType, - Context context) - { - var fields = objectType.Fields - .Where(IncludeField) - .Select(t => SerializeObjectField(t, context)) - .ToList(); - - if (fields.Count == 0) - { - return null; - } - - var directives = SerializeDirectives(objectType.Directives, context); - - var interfaces = objectType.Implements - .Select(t => SerializeNamedType(t, context)) - .ToList(); - - if (objectType.ContextData.ContainsKey(Constants.WellKnownContextData.ExtendMarker)) - { - return new ObjectTypeExtensionNode( - null, - new NameNode(objectType.Name), - directives, - interfaces, - fields); - } - - return new ObjectTypeDefinitionNode( - null, - new NameNode(objectType.Name), - SerializeDescription(objectType.Description), - directives, - interfaces, - fields); - } - - private static InterfaceTypeDefinitionNode SerializeInterfaceType( - InterfaceType interfaceType, - Context context) - { - var directives = SerializeDirectives(interfaceType.Directives, context); - - var fields = interfaceType.Fields - .Select(t => SerializeObjectField(t, context)) - .ToList(); - - return new InterfaceTypeDefinitionNode( - null, - new NameNode(interfaceType.Name), - SerializeDescription(interfaceType.Description), - directives, - Array.Empty(), - fields); - } - - private static UnionTypeDefinitionNode SerializeUnionType( - UnionType unionType, - Context context) - { - var directives = SerializeDirectives(unionType.Directives, context); - - var types = unionType.Types.Values - .Select(t => SerializeNamedType(t, context)) - .ToList(); - - return new UnionTypeDefinitionNode( - null, - new NameNode(unionType.Name), - SerializeDescription(unionType.Description), - directives, - types); - } - - private static FieldDefinitionNode SerializeObjectField( - IOutputField field, - Context context) - { - var arguments = field.Arguments - .Select(t => SerializeInputField(t, context)) - .ToList(); - - var directives = SerializeDirectives(field.Directives, context); - - if (field.IsDeprecated) - { - var deprecateDirective = DeprecatedDirective.CreateNode(field.DeprecationReason); - - if(directives.Count == 0) - { - directives = new[] { deprecateDirective }; - } - else - { - var temp = directives.ToList(); - temp.Add(deprecateDirective); - directives = temp; - } - } - - return new FieldDefinitionNode( - null, - new NameNode(field.Name), - SerializeDescription(field.Description), - arguments, - SerializeType(field.Type, context), - directives); - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.cs deleted file mode 100644 index 1555925e3dd..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationSchemaPrinter.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.Language; -using HotChocolate.Types.Introspection; -using HotChocolate.Utilities; -using HotChocolate.Utilities.Introspection; - -namespace HotChocolate.ApolloFederation; - -/// -/// The apollo federation schema printer. -/// -public static partial class FederationSchemaPrinter -{ - private static readonly HashSet _builtInDirectives = - [ - WellKnownTypeNames.External, - WellKnownTypeNames.Requires, - WellKnownTypeNames.Provides, - WellKnownTypeNames.Key, - WellKnownDirectives.Defer, - WellKnownDirectives.Stream, - WellKnownDirectives.Skip, - WellKnownDirectives.Include, - WellKnownDirectives.Deprecated, - SpecifiedByDirectiveType.Names.SpecifiedBy, - ]; - - /// - /// Creates a representation of the given - /// . - /// - /// - /// The schema object. - /// - /// - /// Returns the representation of the given - /// . - /// - public static string Print(ISchema schema) - { - if (schema is null) - { - throw new ArgumentNullException(nameof(schema)); - } - - return SerializeSchema(schema).ToString(); - } - - private static DocumentNode SerializeSchema(ISchema schema) - { - var context = new Context(); - var definitionNodes = new List(); - - foreach (var directive in schema.DirectiveTypes) - { - if (directive.IsPublic) - { - context.DirectiveNames.Add(directive.Name); - } - } - - foreach (var namedType in GetRelevantTypes(schema)) - { - if (TrySerializeType(namedType, context, out var definitionNode)) - { - definitionNodes.Add(definitionNode); - } - } - - foreach (var directive in schema.DirectiveTypes) - { - if (!_builtInDirectives.Contains(directive.Name) && directive.IsPublic) - { - definitionNodes.Add(SerializeDirectiveTypeDefinition(directive, context)); - } - } - - return new DocumentNode(null, definitionNodes); - } - - private static IEnumerable GetRelevantTypes(ISchema schema) - => schema.Types - .Where(IncludeType) - .OrderBy(t => t.Name, StringComparer.Ordinal); - - private static bool TrySerializeType( - INamedType namedType, - Context context, - [NotNullWhen(true)] out IDefinitionNode? definitionNode) - { - definitionNode = namedType switch - { - ObjectType type => SerializeObjectType(type, context), - InterfaceType type => SerializeInterfaceType(type, context), - InputObjectType type => SerializeInputObjectType(type, context), - UnionType type => SerializeUnionType(type, context), - EnumType type => SerializeEnumType(type, context), - ScalarType type => SerializeScalarType(type, context), - _ => throw new NotSupportedException(), - }; - return definitionNode is not null; - } - - private static ITypeNode SerializeType( - IType type, - Context context) - { - return type switch - { - NonNullType nt => new NonNullTypeNode( - (INullableTypeNode)SerializeType(nt.Type, context)), - ListType lt => new ListTypeNode(SerializeType(lt.ElementType, context)), - INamedType namedType => SerializeNamedType(namedType, context), - _ => throw new NotSupportedException(), - }; - } - - private static NamedTypeNode SerializeNamedType( - INamedType namedType, - Context context) - { - context.TypeNames.Add(namedType.Name); - return new NamedTypeNode(null, new NameNode(namedType.Name)); - } - - private static IReadOnlyList SerializeDirectives( - IReadOnlyCollection directives, - Context context) - { - if (directives.Count == 0) - { - return Array.Empty(); - } - - List? directiveNodes = null; - - foreach (var directive in directives) - { - if (context.DirectiveNames.Contains(directive.Type.Name)) - { - (directiveNodes ??= new()).Add(directive.AsSyntaxNode(true)); - } - } - - if (directiveNodes is not null) - { - return directiveNodes; - } - - return Array.Empty(); - } - - private static StringValueNode? SerializeDescription(string? description) - => description is { Length: > 0 } - ? new StringValueNode(description) - : null; - - private static bool IncludeType(INamedType type) - => !IsBuiltInType(type) && - !IsApolloFederationType(type); - - private static bool IncludeField(IOutputField field) - => !field.IsIntrospectionField && - !IsApolloFederationType(field.Type.NamedType()); - - private static bool IsApolloFederationType(INamedType type) - => type is EntityType or ServiceType || - type.Name.EqualsOrdinal(WellKnownTypeNames.Any) || - type.Name.EqualsOrdinal(WellKnownTypeNames.FieldSet); - - private static bool IsBuiltInType(INamedType type) => - IntrospectionTypes.IsIntrospectionType(type.Name) || - BuiltInTypes.IsBuiltInType(type.Name); - - private sealed class Context - { - // ReSharper disable once CollectionNeverQueried.Local - public HashSet TypeNames { get; } = new(); - public HashSet DirectiveNames { get; } = new(_builtInDirectives); - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs index 1a26cfe0302..fbaa5d91094 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs @@ -4,24 +4,22 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Descriptors; -using HotChocolate.ApolloFederation.Helpers; +using HotChocolate.ApolloFederation.Resolvers; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Configuration; using HotChocolate.Language; using HotChocolate.Resolvers; using HotChocolate.Types.Descriptors; using HotChocolate.Types.Descriptors.Definitions; +using HotChocolate.Types.Helpers; using static HotChocolate.ApolloFederation.ThrowHelper; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; +using static HotChocolate.ApolloFederation.FederationContextData; using static HotChocolate.Types.TagHelper; namespace HotChocolate.ApolloFederation; internal sealed class FederationTypeInterceptor : TypeInterceptor { - private static readonly object _empty = new(); - private static readonly MethodInfo _matches = typeof(ReferenceResolverHelper) .GetMethod( @@ -41,9 +39,15 @@ internal sealed class FederationTypeInterceptor : TypeInterceptor BindingFlags.Static | BindingFlags.Public)!; private readonly List _entityTypes = new(); + private readonly Dictionary> _imports = new(); private IDescriptorContext _context = default!; private ITypeInspector _typeInspector = default!; + private TypeRegistry _typeRegistry = default!; private ObjectType _queryType = default!; + private ExtendedTypeDirectiveReference _keyDirectiveReference = default!; + private SchemaTypeDefinition _schemaTypeDefinition = default!; + private RegisteredType _schemaType = default!; + private bool _registeredTypes; internal override void InitializeContext( IDescriptorContext context, @@ -52,8 +56,10 @@ internal override void InitializeContext( TypeLookup typeLookup, TypeReferenceResolver typeReferenceResolver) { - _context = context; _typeInspector = context.TypeInspector; + _context = context; + _typeRegistry = typeRegistry; + _keyDirectiveReference = new ExtendedTypeDirectiveReference(_typeInspector.GetType(typeof(KeyDirective))); ModifyOptions(context, o => o.Mode = TagMode.ApolloFederation); } @@ -79,11 +85,190 @@ public override void OnAfterInitialize( } } - public override void OnTypesInitialized() + public override IEnumerable RegisterMoreTypes( + IReadOnlyCollection discoveryContexts) { - if (_entityTypes.Count == 0) + if (_registeredTypes) { - throw EntityType_NoEntities(); + yield break; + } + + _registeredTypes = true; + yield return _typeInspector.GetTypeRef(typeof(_Service)); + yield return _typeInspector.GetTypeRef(typeof(_EntityType)); + yield return _typeInspector.GetTypeRef(typeof(_AnyType)); + yield return _typeInspector.GetTypeRef(typeof(FieldSetType)); + + if (_context.GetFederationVersion() > FederationVersion.Federation10) + { + yield return _typeInspector.GetTypeRef(typeof(LinkDirective)); + } + } + + public override void OnBeforeCompleteName( + ITypeCompletionContext completionContext, + DefinitionBase definition) + { + if (definition is SchemaTypeDefinition schemaDef) + { + _schemaType = (RegisteredType)completionContext; + _schemaTypeDefinition = schemaDef; + } + } + + public override void OnAfterCompleteName( + ITypeCompletionContext completionContext, + DefinitionBase definition) + { + if (definition is not ITypeDefinition and not DirectiveTypeDefinition) + { + return; + } + + var hasRuntimeType = (IHasRuntimeType)definition; + var type = hasRuntimeType.RuntimeType; + + if (type != typeof(object) && + type.IsDefined(typeof(PackageAttribute))) + { + RegisterImport(type); + return; + } + + type = completionContext.Type.GetType(); + + if (type.IsDefined(typeof(PackageAttribute))) + { + RegisterImport(type); + } + return; + + void RegisterImport(MemberInfo element) + { + var package = element.GetCustomAttribute(); + + if (package is null) + { + return; + } + + if (!_imports.TryGetValue(package.Url, out var types)) + { + types = new HashSet(); + _imports[package.Url] = types; + } + + if (completionContext.Type is DirectiveType) + { + types.Add($"@{completionContext.Type.Name}"); + } + else + { + types.Add(completionContext.Type.Name); + } + } + } + + public override void OnTypesCompletedName() + { + RegisterExportedDirectives(); + RegisterImports(); + } + + private void RegisterImports() + { + if (_imports.Count == 0) + { + return; + } + + var version = _context.GetFederationVersion(); + var federationTypes = new HashSet(); + + foreach (var import in _imports) + { + if (!import.Key.TryToVersion(out var importVersion)) + { + continue; + } + + if (importVersion > version) + { + // todo: throw helper + throw new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + "The following federation types were used and are not supported by " + + "the current federation version: {0}", + string.Join(", ", import.Value)) + .Build()); + } + + federationTypes.UnionWith(import.Value); + } + + if (version == FederationVersion.Federation10) + { + return; + } + + var dependency = new TypeDependency( + _typeInspector.GetTypeRef(typeof(LinkDirective)), + TypeDependencyFulfilled.Completed); + _schemaType.Dependencies.Add(dependency); + + _schemaTypeDefinition + .GetLegacyDefinition() + .AddDirective( + new LinkDirective(version.ToUrl(), federationTypes), + _typeInspector); + + foreach (var import in _imports) + { + if (import.Key.TryToVersion(out _)) + { + continue; + } + + _schemaTypeDefinition + .GetLegacyDefinition() + .AddDirective( + new LinkDirective(import.Key, import.Value), + _typeInspector); + } + } + + private void RegisterExportedDirectives() + { + if (!_context.ContextData.TryGetValue(ExportedDirectives, out var value) || + value is not List exportedDirectives) + { + return; + } + + var composeDirectives = new List(); + foreach (var exportedDirective in exportedDirectives) + { + var typeReference = _typeInspector.GetTypeRef(exportedDirective); + if (_typeRegistry.TryGetType(typeReference, out var exportedDirectiveType)) + { + composeDirectives.Add(new ComposeDirective(exportedDirectiveType.Type.Name)); + } + } + + if (composeDirectives.Count > 0) + { + var dependency = new TypeDependency( + _typeInspector.GetTypeRef(typeof(ComposeDirective)), + TypeDependencyFulfilled.Completed); + _schemaType.Dependencies.Add(dependency); + + foreach (var directive in composeDirectives) + { + _schemaTypeDefinition + .GetLegacyDefinition() + .AddDirective(directive, _typeInspector); + } } } @@ -94,7 +279,15 @@ internal override void OnAfterResolveRootType( { if (operationType is OperationType.Query) { - _queryType = (ObjectType) completionContext.Type; + _queryType = (ObjectType)completionContext.Type; + } + } + + public override void OnTypesInitialized() + { + if (_entityTypes.Count == 0) + { + throw EntityType_NoEntities(); } } @@ -123,49 +316,64 @@ public override void OnAfterCompleteType( } } + internal override void OnAfterCreateSchemaInternal(IDescriptorContext context, ISchema schema) { } + private void CompleteExternalFieldSetters(ObjectType type, ObjectTypeDefinition typeDef) => ExternalSetterExpressionHelper.TryAddExternalSetter(type, typeDef); private void CompleteReferenceResolver(ObjectTypeDefinition typeDef) { - if (typeDef.GetContextData().TryGetValue(EntityResolver, out var value) && - value is IReadOnlyList resolvers) + IReadOnlyList resolvers; { - if (resolvers.Count == 1) + var contextData = typeDef.GetContextData(); + + if (!contextData.TryGetValue(EntityResolver, out var resolversObject)) { - typeDef.ContextData[EntityResolver] = resolvers[0].Resolver; + return; } - else + + if (resolversObject is not IReadOnlyList r) { - var expressions = new Stack<(Expression Condition, Expression Execute)>(); - var context = Expression.Parameter(typeof(IResolverContext)); + return; + } - foreach (var resolverDef in resolvers) - { - Expression required = Expression.Constant(resolverDef.Required); - Expression resolver = Expression.Constant(resolverDef.Resolver); - Expression condition = Expression.Call(_matches, context, required); - Expression execute = Expression.Call(_execute, context, resolver); - expressions.Push((condition, execute)); - } + resolvers = r; + } - Expression current = Expression.Call(_invalid, context); - var variable = Expression.Variable(typeof(ValueTask)); + if (resolvers.Count == 1) + { + typeDef.ContextData[EntityResolver] = resolvers[0].Resolver; + } + else + { + var expressions = new Stack<(Expression Condition, Expression Execute)>(); + var context = Expression.Parameter(typeof(IResolverContext)); - while (expressions.Count > 0) - { - var expression = expressions.Pop(); - current = Expression.IfThenElse( - expression.Condition, - Expression.Assign(variable, expression.Execute), - current); - } + foreach (var resolverDef in resolvers) + { + Expression required = Expression.Constant(resolverDef.Required); + Expression resolver = Expression.Constant(resolverDef.Resolver); + Expression condition = Expression.Call(_matches, context, required); + Expression execute = Expression.Call(_execute, context, resolver); + expressions.Push((condition, execute)); + } - current = Expression.Block(new[] { variable }, current, variable); + Expression current = Expression.Call(_invalid, context); + var variable = Expression.Variable(typeof(ValueTask)); - typeDef.ContextData[EntityResolver] = - Expression.Lambda(current, context).Compile(); + while (expressions.Count > 0) + { + var expression = expressions.Pop(); + current = Expression.IfThenElse( + expression.Condition, + Expression.Assign(variable, expression.Execute), + current); } + + current = Expression.Block(new[] { variable }, current, variable); + + typeDef.ContextData[EntityResolver] = + Expression.Lambda(current, context).Compile(); } } @@ -173,67 +381,59 @@ private void AddServiceTypeToQueryType( ITypeCompletionContext completionContext, DefinitionBase? definition) { - if (ReferenceEquals(completionContext.Type, _queryType) && - definition is ObjectTypeDefinition objectTypeDefinition) + if (!ReferenceEquals(completionContext.Type, _queryType)) { - var serviceFieldDescriptor = ObjectFieldDescriptor.New( - _context, - WellKnownFieldNames.Service); - serviceFieldDescriptor - .Type>() - .Resolve(_empty); - objectTypeDefinition.Fields.Add(serviceFieldDescriptor.CreateDefinition()); - - var entitiesFieldDescriptor = ObjectFieldDescriptor.New( - _context, - WellKnownFieldNames.Entities); - entitiesFieldDescriptor - .Type>>() - .Argument( - WellKnownArgumentNames.Representations, - descriptor => descriptor.Type>>>()) - .Resolve( - c => EntitiesResolver.ResolveAsync( - c.Schema, - c.ArgumentValue>( - WellKnownArgumentNames.Representations), - c - )); - objectTypeDefinition.Fields.Add(entitiesFieldDescriptor.CreateDefinition()); + return; } + + var objectTypeDefinition = (ObjectTypeDefinition)definition!; + objectTypeDefinition.Fields.Add(ServerFields.CreateServiceField(_context)); + objectTypeDefinition.Fields.Add(ServerFields.CreateEntitiesField(_context)); } private void ApplyMethodLevelReferenceResolvers( ObjectType objectType, ObjectTypeDefinition objectTypeDefinition) { - if (objectType.RuntimeType != typeof(object)) + if (objectType.RuntimeType == typeof(object)) { - var descriptor = ObjectTypeDescriptor.From(_context, objectTypeDefinition); + return; + } + + var descriptor = ObjectTypeDescriptor.From(_context, objectTypeDefinition); - foreach (var possibleReferenceResolver in - objectType.RuntimeType.GetMethods(BindingFlags.Static | BindingFlags.Public)) + // Static methods won't end up in the schema as fields. + // The default initialization system only considers instance methods, + // so we have to handle the attributes for those manually. + var potentiallyUnregisteredReferenceResolvers = objectType.RuntimeType + .GetMethods(BindingFlags.Static | BindingFlags.Public); + + foreach (var possibleReferenceResolver in potentiallyUnregisteredReferenceResolvers) + { + if (!possibleReferenceResolver.IsDefined(typeof(ReferenceResolverAttribute))) { - if (possibleReferenceResolver.IsDefined(typeof(ReferenceResolverAttribute))) + continue; + } + + foreach (var attribute in possibleReferenceResolver.GetCustomAttributes(true)) + { + if (attribute is ReferenceResolverAttribute casted) { - _typeInspector.ApplyAttributes( - _context, - descriptor, - possibleReferenceResolver); + casted.TryConfigure(_context, descriptor, possibleReferenceResolver); } } - - descriptor.CreateDefinition(); } + + // This seems to re-detect the entity resolver and save it into the context data. + descriptor.CreateDefinition(); } private void AddToUnionIfHasTypeLevelKeyDirective( ObjectType objectType, ObjectTypeDefinition objectTypeDefinition) { - if (objectTypeDefinition.Directives.Any( - d => d.Value is DirectiveNode { Name.Value: WellKnownTypeNames.Key }) || - objectTypeDefinition.Fields.Any(f => f.ContextData.ContainsKey(WellKnownTypeNames.Key))) + if (objectTypeDefinition.Directives.Any(d => d.Value is KeyDirective) || + objectTypeDefinition.Fields.Any(f => f.ContextData.ContainsKey(KeyMarker))) { _entityTypes.Add(objectType); } @@ -246,50 +446,56 @@ private void AggregatePropertyLevelKeyDirectives( { // if we find key markers on our fields, we need to construct the key directive // from the annotated fields. - if (objectTypeDefinition.Fields.Any(f => f.ContextData.ContainsKey(KeyMarker))) { - IReadOnlyList fields = objectTypeDefinition.Fields; - var fieldSet = new StringBuilder(); + var foundMarkers = objectTypeDefinition.Fields.Any(f => f.ContextData.ContainsKey(KeyMarker)); - foreach (var fieldDefinition in fields) + if (!foundMarkers) { - if (fieldDefinition.ContextData.ContainsKey(KeyMarker)) - { - if (fieldSet.Length > 0) - { - fieldSet.Append(' '); - } - - fieldSet.Append(fieldDefinition.Name); - } + return; } + } - // add the key directive with the dynamically generated field set. - AddKeyDirective(objectTypeDefinition, fieldSet.ToString()); + IReadOnlyList fields = objectTypeDefinition.Fields; + var fieldSet = new StringBuilder(); - // register dependency to the key directive so that it is completed before - // we complete this type. - foreach (var directiveDefinition in objectTypeDefinition.Directives) + foreach (var fieldDefinition in fields) + { + if (fieldDefinition.ContextData.ContainsKey(KeyMarker)) { - discoveryContext.Dependencies.Add( - new TypeDependency( - directiveDefinition.Type, - TypeDependencyFulfilled.Completed)); + if (fieldSet.Length > 0) + { + fieldSet.Append(' '); + } - discoveryContext.Dependencies.Add(new(directiveDefinition.Type)); + fieldSet.Append(fieldDefinition.Name); } + } - // since this type has now a key directive we also need to add this type to - // the _Entity union type. - _entityTypes.Add(objectType); + // add the key directive with the dynamically generated field set. + AddKeyDirective(objectTypeDefinition, fieldSet.ToString()); + + // register dependency to the key directive so that it is completed before + // we complete this type. + foreach (var directiveDefinition in objectTypeDefinition.Directives) + { + discoveryContext.Dependencies.Add( + new TypeDependency( + directiveDefinition.Type, + TypeDependencyFulfilled.Completed)); + + discoveryContext.Dependencies.Add(new(directiveDefinition.Type)); } + + // since this type has now a key directive we also need to add this type to + // the _Entity union type. + _entityTypes.Add(objectType); } private void AddMemberTypesToTheEntityUnionType( ITypeCompletionContext completionContext, DefinitionBase? definition) { - if (completionContext.Type is EntityType && + if (completionContext.Type is _EntityType && definition is UnionTypeDefinition unionTypeDefinition) { foreach (var objectType in _entityTypes) @@ -299,17 +505,13 @@ private void AddMemberTypesToTheEntityUnionType( } } - private static void AddKeyDirective( + private void AddKeyDirective( ObjectTypeDefinition objectTypeDefinition, string fieldSet) { - var directiveNode = new DirectiveNode( - WellKnownTypeNames.Key, - new ArgumentNode( - WellKnownArgumentNames.Fields, - fieldSet)); - objectTypeDefinition.Directives.Add( - new DirectiveDefinition(directiveNode)); + new DirectiveDefinition( + new KeyDirective(fieldSet), + _keyDirectiveReference)); } } \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeNames.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeNames.cs new file mode 100644 index 00000000000..6b9a29c7efb --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeNames.cs @@ -0,0 +1,24 @@ +namespace HotChocolate.ApolloFederation; + +internal static class FederationTypeNames +{ + public const string AuthenticatedDirective_Name = "authenticated"; + public const string ContactDirective_Name = "contact"; + public const string ComposeDirective_Name = "composeDirective"; + public const string ExtendsDirective_Name = "extends"; + public const string ExternalDirective_Name = "external"; + public const string InaccessibleDirective_Name = "inaccessible"; + public const string InterfaceObject_Name = "interfaceObject"; + public const string KeyDirective_Name = "key"; + public const string LinkDirective_Name = "link"; + public const string OverrideDirective_Name = "override"; + public const string ProvidesDirective_Name = "provides"; + public const string RequiresDirective_Name = "requires"; + public const string RequiresScopesDirective_Name = "requiresScopes"; + public const string ShareableDirective_Name = "shareable"; + public const string FieldSetType_Name = "FieldSet"; + public const string ScopeType_Name = "Scope"; + public const string AnyType_Name = "_Any"; + public const string EntityType_Name = "_Entity"; + public const string ServiceType_Name = "_Service"; +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationVersion.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationVersion.cs new file mode 100644 index 00000000000..f3626a7c84c --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationVersion.cs @@ -0,0 +1,18 @@ +namespace HotChocolate.ApolloFederation; + +/// +/// Enum defining all supported Apollo Federation v2 versions. +/// +public enum FederationVersion +{ + Unknown = 0, + Federation10 = 1_0, + Federation20 = 2_0, + Federation21 = 2_1, + Federation22 = 2_2, + Federation23 = 2_3, + Federation24 = 2_4, + Federation25 = 2_5, + // Federation26 = 2_6, + Latest = Federation25, +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationVersionUrls.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationVersionUrls.cs new file mode 100644 index 00000000000..054b96ce3cb --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationVersionUrls.cs @@ -0,0 +1,11 @@ +namespace HotChocolate.ApolloFederation; + +internal static class FederationVersionUrls +{ + public const string Federation20 = "https://specs.apollo.dev/federation/v2.0"; + public const string Federation21 = "https://specs.apollo.dev/federation/v2.1"; + public const string Federation22 = "https://specs.apollo.dev/federation/v2.2"; + public const string Federation23 = "https://specs.apollo.dev/federation/v2.3"; + public const string Federation24 = "https://specs.apollo.dev/federation/v2.4"; + public const string Federation25 = "https://specs.apollo.dev/federation/v2.5"; +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs deleted file mode 100644 index fdeebcf9e19..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; -using HotChocolate.Internal; -using HotChocolate.Language; -using HotChocolate.Resolvers; -using HotChocolate.Resolvers.Expressions; -using HotChocolate.Resolvers.Expressions.Parameters; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; -using static HotChocolate.Resolvers.Expressions.Parameters.ParameterExpressionBuilderHelpers; - -namespace HotChocolate.ApolloFederation.Helpers; - -internal sealed class ReferenceResolverArgumentExpressionBuilder - : ScopedStateParameterExpressionBuilder -{ - private readonly MethodInfo _getValue = - typeof(ArgumentParser).GetMethod( - nameof(ArgumentParser.GetValue), - BindingFlags.Static | BindingFlags.Public)!; - - public override ArgumentKind Kind => ArgumentKind.LocalState; - - protected override PropertyInfo ContextDataProperty { get; } = - ContextType.GetProperty(nameof(IResolverContext.LocalContextData))!; - - protected override MethodInfo SetStateMethod { get; } = - typeof(ExpressionHelper).GetMethod(nameof(ExpressionHelper.SetLocalState))!; - - protected override MethodInfo SetStateGenericMethod { get; } = - typeof(ExpressionHelper).GetMethod(nameof(ExpressionHelper.SetLocalStateGeneric))!; - - public override bool IsDefaultHandler => true; - - public IReadOnlyList Required { get; private set; } = Array.Empty(); - - public override bool CanHandle(ParameterInfo parameter) => true; - - protected override string GetKey(ParameterInfo parameter) => DataField; - - public override Expression Build(ParameterExpressionBuilderContext context) - { - var param = context.Parameter; - var path = Expression.Constant(GetPath(param), typeof(string[])); - var dataKey = Expression.Constant(DataField, typeof(string)); - var typeKey = Expression.Constant(TypeField, typeof(string)); - var value = BuildGetter(param, dataKey, context.ResolverContext, typeof(IValueNode)); - var objectType = BuildGetter(param, typeKey, context.ResolverContext, typeof(ObjectType)); - var getValueMethod = _getValue.MakeGenericMethod(param.ParameterType); - Expression getValue = Expression.Call(getValueMethod, value, objectType, path); - return getValue; - } - - private string[] GetPath(ParameterInfo parameter) - { - var path = parameter.GetCustomAttribute() is { } attr - ? attr.Path.Split('.') - : new[] { parameter.Name! }; - - if (Required.Count == 0) - { - Required = new[] { path }; - } - else if (Required.Count == 1) - { - var required = new List(Required) { path }; - Required = required; - } - else if (Required is List list) - { - list.Add(path); - } - - return path; - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/HotChocolate.ApolloFederation.csproj b/src/HotChocolate/ApolloFederation/src/ApolloFederation/HotChocolate.ApolloFederation.csproj index 4c46ea457bb..cb595c7a0a1 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/HotChocolate.ApolloFederation.csproj +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/HotChocolate.ApolloFederation.csproj @@ -23,6 +23,87 @@ + + ProvidesDirective.cs + + + ProvidesDirective.cs + + + RequiresDirective.cs + + + RequiresDirective.cs + + + KeyDirective.cs + + + KeyDirective.cs + + + ExternalDirective.cs + + + ExternalDirective.cs + + + ExtendServiceTypeDirective.cs + + + ExtendServiceTypeDirective.cs + + + ContactDirective.cs + + + OverrideDirective.cs + + + OverrideDirective.cs + + + ShareableDirective.cs + + + ShareableDirective.cs + + + InterfaceObjectDirective.cs + + + InterfaceObjectDirective.cs + + + KeyDirective.cs + + + LinkDirective.cs + + + LinkDirective.cs + + + InaccessibleDirective.cs + + + InaccessibleDirective.cs + + + ComposeDirective.cs + + + FieldSetType.cs + + + AuthenticatedDirective.cs + + + AuthenticatedDirective.cs + + + RequiresScopesDirective.cs + True True @@ -32,6 +113,9 @@ ResXFileCodeGenerator FederationResources.Designer.cs + + RequiresScopesDirective.cs + diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/KeyAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/KeyAttribute.cs deleted file mode 100644 index 5832b476c4b..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/KeyAttribute.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Reflection; -using HotChocolate.Types.Descriptors; -using static HotChocolate.ApolloFederation.ThrowHelper; - -namespace HotChocolate.ApolloFederation; - -/// -/// The @key directive is used to indicate a combination of fields that -/// can be used to uniquely identify and fetch an object or interface. -/// -/// type Product @key(fields: "upc") { -/// upc: UPC! -/// name: String -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Class | - AttributeTargets.Struct | - AttributeTargets.Interface | - AttributeTargets.Property | - AttributeTargets.Method, - AllowMultiple = true)] -public sealed class KeyAttribute : DescriptorAttribute -{ - /// - /// Initializes a new instance of . - /// - /// - /// The field set that describes the key. - /// Grammatically, a field set is a selection set minus the braces. - /// - public KeyAttribute(string? fieldSet = default) - { - FieldSet = fieldSet; - } - - /// - /// Gets the field set that describes the key. - /// Grammatically, a field set is a selection set minus the braces. - /// - public string? FieldSet { get; } - - protected internal override void TryConfigure( - IDescriptorContext context, - IDescriptor descriptor, - ICustomAttributeProvider element) - { - switch (descriptor) - { - case IObjectTypeDescriptor objectTypeDescriptor when element is Type runtimeType: - { - if (string.IsNullOrEmpty(FieldSet)) - { - throw Key_FieldSet_CannotBeEmpty(runtimeType); - } - - objectTypeDescriptor.Key(FieldSet!); - break; - } - - case IObjectFieldDescriptor objectFieldDescriptor when element is MemberInfo: - objectFieldDescriptor - .Extend() - .OnBeforeCreate(d => d.ContextData[Constants.WellKnownContextData.KeyMarker] = true); - break; - } - } -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/KeyDirectiveType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/KeyDirectiveType.cs deleted file mode 100644 index 9b8de0c9317..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/KeyDirectiveType.cs +++ /dev/null @@ -1,25 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Properties; - -namespace HotChocolate.ApolloFederation; - -/// -/// The @key directive is used to indicate a combination of fields that -/// can be used to uniquely identify and fetch an object or interface. -/// -/// type Product @key(fields: "upc") { -/// upc: UPC! -/// name: String -/// } -/// -/// -public sealed class KeyDirectiveType : DirectiveType -{ - protected override void Configure(IDirectiveTypeDescriptor descriptor) - => descriptor - .Name(WellKnownTypeNames.Key) - .Description(FederationResources.KeyDirective_Description) - .Location(DirectiveLocation.Object | DirectiveLocation.Interface) - .Repeatable() - .FieldsArgument(); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.Designer.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.Designer.cs index a1f8b0ee7a2..64465d4a006 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.Designer.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.Designer.cs @@ -14,7 +14,7 @@ namespace HotChocolate.ApolloFederation.Properties { [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class FederationResources { + internal partial class FederationResources { private static System.Resources.ResourceManager resourceMan; @@ -45,39 +45,33 @@ internal static System.Globalization.CultureInfo Culture { } } - internal static string ExternalDirective_Description { - get { - return ResourceManager.GetString("ExternalDirective_Description", resourceCulture); - } - } - internal static string FieldsetType_Description { get { return ResourceManager.GetString("FieldsetType_Description", resourceCulture); } } - internal static string KeyDirective_Description { + internal static string ScopeType_Description { get { - return ResourceManager.GetString("KeyDirective_Description", resourceCulture); + return ResourceManager.GetString("ScopeType_Description", resourceCulture); } } - internal static string ProvidesDirective_Description { + internal static string TagDirective_Description { get { - return ResourceManager.GetString("ProvidesDirective_Description", resourceCulture); + return ResourceManager.GetString("TagDirective_Description", resourceCulture); } } - internal static string RequiresDirective_Description { + internal static string EntityType_Description { get { - return ResourceManager.GetString("RequiresDirective_Description", resourceCulture); + return ResourceManager.GetString("EntityType_Description", resourceCulture); } } - internal static string EntityType_Description { + internal static string PolicyDirective_Description { get { - return ResourceManager.GetString("EntityType_Description", resourceCulture); + return ResourceManager.GetString("PolicyDirective_Description", resourceCulture); } } @@ -111,6 +105,30 @@ internal static string ThrowHelper_Requires_FieldSet_CannotBeEmpty { } } + internal static string ThrowHelper_ComposeDirective_Name_CannotBeEmpty { + get { + return ResourceManager.GetString("ThrowHelper_ComposeDirective_Name_CannotBeEmpty", resourceCulture); + } + } + + internal static string ThrowHelper_Link_Url_CannotBeEmpty { + get { + return ResourceManager.GetString("ThrowHelper_Link_Url_CannotBeEmpty", resourceCulture); + } + } + + internal static string ThrowHelper_Contact_Name_CannotBeEmpty { + get { + return ResourceManager.GetString("ThrowHelper_Contact_Name_CannotBeEmpty", resourceCulture); + } + } + + internal static string ThrowHelper_FederationVersion_Unknown { + get { + return ResourceManager.GetString("ThrowHelper_FederationVersion_Unknown", resourceCulture); + } + } + internal static string FieldDescriptorExtensions_Key_FieldSet_CannotBeNullOrEmpty { get { return ResourceManager.GetString("FieldDescriptorExtensions_Key_FieldSet_CannotBeNullOrEmpty", resourceCulture); @@ -129,15 +147,15 @@ internal static string FieldDescriptorExtensions_Provides_FieldSet_CannotBeNullO } } - internal static string ThrowHelper_EntityType_NoEntities { + internal static string FieldDescriptorExtensions_Override_From_CannotBeNullOrEmpty { get { - return ResourceManager.GetString("ThrowHelper_EntityType_NoEntities", resourceCulture); + return ResourceManager.GetString("FieldDescriptorExtensions_Override_From_CannotBeNullOrEmpty", resourceCulture); } } - internal static string ServiceType_Description { + internal static string ThrowHelper_EntityType_NoEntities { get { - return ResourceManager.GetString("ServiceType_Description", resourceCulture); + return ResourceManager.GetString("ThrowHelper_EntityType_NoEntities", resourceCulture); } } @@ -159,6 +177,12 @@ internal static string ThrowHelper_Any_HasInvalidFormat { } } + internal static string ExpressionHelper_GetScopedStateWithDefault_NoDefaultValue { + get { + return ResourceManager.GetString("ExpressionHelper_GetScopedStateWithDefault_NoDefaultValue", resourceCulture); + } + } + internal static string Any_Description { get { return ResourceManager.GetString("Any_Description", resourceCulture); @@ -170,5 +194,11 @@ internal static string ResolveReference_MustBeMethod { return ResourceManager.GetString("ResolveReference_MustBeMethod", resourceCulture); } } + + internal static string PolicyCollectionType_ParseValue_ExpectedStringArray { + get { + return ResourceManager.GetString("PolicyCollectionType_ParseValue_ExpectedStringArray", resourceCulture); + } + } } } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.cs new file mode 100644 index 00000000000..f37f2257f5c --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.cs @@ -0,0 +1,55 @@ +namespace HotChocolate.ApolloFederation.Properties; + +internal partial class FederationResources +{ + public const string ProvidesDirective_Description = + "Used to annotate the expected returned fieldset from a field on a base type " + + "that is guaranteed to be selectable by the federation gateway."; + + public const string KeyDirective_Description = + "Used to indicate a combination of fields that can be used to uniquely identify " + + "and fetch an object or interface."; + + public const string ExternalDirective_Description = + "Directive to indicate that a field is owned by another service, " + + "for example via Apollo federation."; + + public const string ExtendsDirective_Description = + "Directive to indicate that marks target object as extending part of the federated schema."; + + public const string ContactDirective_Description = + "Provides contact information of the owner responsible for this subgraph schema."; + + public const string RequiresDirective_Description = + "Used to annotate the required input fieldset from a base type for a resolver."; + + public const string OverrideDirective_Description = + "Overrides fields resolution logic from other subgraph. " + + "Used for migrating fields from one subgraph to another."; + + public const string ShareableDirective_Description = + "Indicates that given object and/or field can be resolved by multiple subgraphs."; + + public const string InterfaceObjectDirective_Description = + "Provides meta information to the router that this entity type is an interface in the supergraph."; + + public const string InaccessibleDirective_Description = + "Marks location within schema as inaccessible from the GraphQL Gateway."; + + public const string ComposeDirective_Description = + "Marks underlying custom directive to be included in the Supergraph schema."; + + public const string ServiceType_Description = + "This type provides a field named sdl: String! which exposes the SDL of the " + + "service's schema. This SDL (schema definition language) is a printed version " + + "of the service's schema including the annotations of federation directives. " + + "This SDL does not include the additions of the federation spec."; + + public const string AuthenticatedDirective_Description = + "Indicates to composition that the target element is accessible " + + "only to the authenticated supergraph users."; + + public const string RequiresScopesDirective_Description = + "Indicates to composition that the target element is accessible only " + + "to the authenticated supergraph users with the appropriate JWT scopes."; +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.resx b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.resx index 5edeea66e82..73302292ad2 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.resx +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Properties/FederationResources.resx @@ -117,24 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Directive to indicate that a field is owned by another service, for example via Apollo federation. - Scalar representing a set of fields. - - Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or 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. + + Scalar representing a JWT scope - - Used to annotate the required input fieldset from a base type for a resolver. + + Allows users to annotate fields and types with additional metadata information. Union of all types that key directive applied. This information is needed by the Apollo federation gateway. + + Indicates to composition that the target element is restricted based on authorization policies that are evaluated in a Rhai script or coprocessor. + The fieldset has an invalid format. @@ -142,7 +139,7 @@ {0} cannot parse the given value of type `{1}` - The key attribute is used on `{0}` without specifying the the field set. + The key attribute is used on `{0}` without specifying the field set. FieldSet is null or empty on type @@ -150,6 +147,18 @@ FieldSet is null or empty on type + + The compose directive attribute is used on `{0}` without specifying the name. + + + The link attribute is used on `{0}` without specifying the url. + + + The contact attribute is used on `{0}` without specifying the name. + + + Specified federation version `{0}` is not supported. + Value cannot be null or empty. @@ -159,11 +168,11 @@ Value cannot be null or empty. - - The schema has no types with a KeyDirective and therefor no entities. Apollo federation requires at least on entity. + + Value cannot be null or empty. - - This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec. + + The schema has no types with a KeyDirective and therefore no entities. Apollo federation requires at least one entity. The apollo gateway tries to resolve an entity for which no EntityResolver method was found. @@ -174,10 +183,16 @@ The given any representation has an invalid format. + + The specified key `{0}` does not exist on `context.ScopedContextData`. + 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. The expression must refer to a method representing the reference resolver. + + Expected a string[][] + diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ProvidesDirectiveType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ProvidesDirectiveType.cs deleted file mode 100644 index caebfc1bc5e..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ProvidesDirectiveType.cs +++ /dev/null @@ -1,29 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Properties; - -namespace HotChocolate.ApolloFederation; - -/// -/// The @provides directive is used to annotate the expected returned fieldset -/// from a field on a base type that is guaranteed to be selectable by the gateway. -/// -/// -/// type Review @key(fields: "id") { -/// product: Product @provides(fields: "name") -/// } -/// -/// extend type Product @key(fields: "upc") { -/// upc: String @external -/// name: String @external -/// } -/// -/// -public sealed class ProvidesDirectiveType : DirectiveType -{ - protected override void Configure(IDirectiveTypeDescriptor descriptor) - => descriptor - .Name(WellKnownTypeNames.Provides) - .Description(FederationResources.ProvidesDirective_Description) - .Location(DirectiveLocation.FieldDefinition) - .FieldsArgument(); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Representation.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Representation.cs index ab9c5728146..fe8ae7cef56 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Representation.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Representation.cs @@ -20,8 +20,9 @@ public sealed class Representation /// public Representation(string typeName, ObjectValueNode data) { + ArgumentNullException.ThrowIfNull(data); TypeName = typeName.EnsureGraphQLName(); - Data = data ?? throw new ArgumentNullException(nameof(data)); + Data = data; } /// diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/RequiresDirectiveType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/RequiresDirectiveType.cs deleted file mode 100644 index 28ca84decd0..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/RequiresDirectiveType.cs +++ /dev/null @@ -1,29 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Properties; - -namespace HotChocolate.ApolloFederation; - -/// -/// The @requires directive is used to annotate the required input fieldset -/// from a base type for a resolver. It is used to develop a query plan -/// where the required fields may not be needed by the client, but the -/// service may need additional information from other services. -/// -/// -/// # extended from the Users service -/// extend type User @key(fields: "id") { -/// id: ID! @external -/// email: String @external -/// reviews: [Review] @requires(fields: "email") -/// } -/// -/// -public sealed class RequiresDirectiveType : DirectiveType -{ - protected override void Configure(IDirectiveTypeDescriptor descriptor) - => descriptor - .Name(WellKnownTypeNames.Requires) - .Description(FederationResources.RequiresDirective_Description) - .Location(DirectiveLocation.FieldDefinition) - .FieldsArgument(); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ArgumentParser.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs similarity index 93% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ArgumentParser.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs index 1331d199419..f4a3da4f568 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ArgumentParser.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs @@ -3,7 +3,7 @@ using HotChocolate.Language; using HotChocolate.Utilities; -namespace HotChocolate.ApolloFederation.Helpers; +namespace HotChocolate.ApolloFederation.Resolvers; /// /// A helper for getting field values from a representation object. @@ -21,7 +21,7 @@ public static bool TryGetValue( IType type, string[] path, out T? value) - => TryGetValue(valueNode, type, path, 0, out value); + => TryGetValue(valueNode, type, path, 0, out value); [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static bool TryGetValue( @@ -35,6 +35,7 @@ private static bool TryGetValue( switch (valueNode.Kind) { case SyntaxKind.ObjectValue: + { var current = path[i]; if (type is not IComplexOutputType complexType || @@ -56,15 +57,17 @@ private static bool TryGetValue( } } break; - + } case SyntaxKind.NullValue: - value = default(T); + { + value = default; return true; - + } case SyntaxKind.StringValue: case SyntaxKind.IntValue: case SyntaxKind.FloatValue: case SyntaxKind.BooleanValue: + { if (type.NamedType() is not ScalarType scalarType) { break; @@ -72,8 +75,10 @@ private static bool TryGetValue( value = (T)scalarType.ParseLiteral(valueNode)!; return true; + } case SyntaxKind.EnumValue: + { if (type.NamedType() is not EnumType enumType) { break; @@ -81,6 +86,7 @@ private static bool TryGetValue( value = (T)enumType.ParseLiteral(valueNode)!; return true; + } } value = default; @@ -117,6 +123,7 @@ private static bool Matches(IValueNode valueNode, string[] path, int i) switch (valueNode.Kind) { case SyntaxKind.ObjectValue: + { var current = path[i]; foreach (var fieldValue in ((ObjectValueNode)valueNode).Fields) @@ -131,6 +138,7 @@ private static bool Matches(IValueNode valueNode, string[] path, int i) } } break; + } case SyntaxKind.NullValue: case SyntaxKind.StringValue: diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/EntitiesResolver.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/EntitiesResolver.cs similarity index 95% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/EntitiesResolver.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/EntitiesResolver.cs index 26f241b8a3a..b700eafbc15 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/EntitiesResolver.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/EntitiesResolver.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Threading.Tasks; using HotChocolate.Resolvers; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; +using static HotChocolate.ApolloFederation.FederationContextData; -namespace HotChocolate.ApolloFederation.Helpers; +namespace HotChocolate.ApolloFederation.Resolvers; /// /// This class contains the _entities resolver method. diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ExternalSetterExpressionHelper.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs similarity index 86% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ExternalSetterExpressionHelper.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs index ad38d811cb1..04de4e3c05f 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ExternalSetterExpressionHelper.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs @@ -1,17 +1,16 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; -using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Language; using HotChocolate.Types.Descriptors.Definitions; using static System.Linq.Expressions.Expression; using static System.Reflection.BindingFlags; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; -namespace HotChocolate.ApolloFederation.Helpers; +namespace HotChocolate.ApolloFederation.Resolvers; /// -/// This class contains helpers to genereate external field setters. +/// This class contains helpers to generate external field setters. /// internal static class ExternalSetterExpressionHelper { @@ -32,7 +31,7 @@ public static void TryAddExternalSetter(ObjectType type, ObjectTypeDefinition ty foreach (var field in type.Fields) { - if (field.Directives.ContainsDirective(WellKnownTypeNames.External) && + if (field.Directives.ContainsDirective() && field.Member is PropertyInfo { SetMethod: { } } property) { var expression = CreateTrySetValue(type.RuntimeType, property, field.Name); @@ -42,7 +41,7 @@ public static void TryAddExternalSetter(ObjectType type, ObjectTypeDefinition ty if (block is not null) { - typeDef.ContextData[ExternalSetter] = + typeDef.ContextData[FederationContextData.ExternalSetter] = Lambda>( Block(block), _type, _data, _entity) .Compile(); @@ -65,7 +64,7 @@ private static Expression CreateSetValue( PropertyInfo property) => (Expression)_createSetValueExpression .MakeGenericMethod(property.PropertyType) - .Invoke(null, new object[] { runtimeType, property })!; + .Invoke(null, [runtimeType, property])!; private static Expression CreateSetValueExpression( diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/MapAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/MapAttribute.cs similarity index 81% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/MapAttribute.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/MapAttribute.cs index 513555db5da..aebfdec154b 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/MapAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/MapAttribute.cs @@ -1,4 +1,4 @@ -namespace HotChocolate.ApolloFederation; +namespace HotChocolate.ApolloFederation.Resolvers; /// /// Maps an argument to a representation value. @@ -14,7 +14,8 @@ public class MapAttribute : Attribute /// public MapAttribute(string path) { - Path = path ?? throw new ArgumentNullException(nameof(path)); + ArgumentNullException.ThrowIfNull(path); + Path = path; } /// diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverArgumentExpressionBuilder.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverArgumentExpressionBuilder.cs new file mode 100644 index 00000000000..4ae12c7919a --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverArgumentExpressionBuilder.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using HotChocolate.Internal; +using HotChocolate.Language; +using HotChocolate.Resolvers.Expressions.Parameters; + +namespace HotChocolate.ApolloFederation.Resolvers; + +internal sealed class ReferenceResolverArgumentExpressionBuilder : + LocalStateParameterExpressionBuilder +{ + private readonly MethodInfo _getValue = + typeof(ArgumentParser).GetMethod( + nameof(ArgumentParser.GetValue), + BindingFlags.Static | BindingFlags.Public)!; + + public override Expression Build(ParameterExpressionBuilderContext context) + { + var param = context.Parameter; + var path = Expression.Constant( + RequirePathAndGetSeparatedPath(param), + typeof(string[])); + var dataKey = Expression.Constant( + FederationContextData.DataField, + typeof(string)); + var typeKey = Expression.Constant( + FederationContextData.TypeField, + typeof(string)); + var value = BuildGetter( + param, + dataKey, + context.ResolverContext, + typeof(IValueNode)); + var objectType = BuildGetter( + param, + typeKey, + context.ResolverContext, + typeof(ObjectType)); + var getValueMethod = _getValue.MakeGenericMethod(param.ParameterType); + var getValue = Expression.Call( + getValueMethod, + value, + objectType, + path); + return getValue; + } + + // NOTE: It will use the default handler without these two. + public override bool IsDefaultHandler => true; + + public override bool CanHandle(ParameterInfo parameter) => true; + + private string[] RequirePathAndGetSeparatedPath(ParameterInfo parameter) + { + var path = parameter.GetCustomAttribute() is { } attr + ? attr.Path.Split('.') + : [parameter.Name!]; + + _requiredPaths.Add(path); + + return path; + } + + private readonly List _requiredPaths = []; + + public IReadOnlyList Required => _requiredPaths; + + protected override bool ResolveDefaultIfNotExistsParameterValue( + Type targetType, + ParameterInfo parameter) + => false; + +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ReferenceResolverAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverAttribute.cs similarity index 90% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/ReferenceResolverAttribute.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverAttribute.cs index f7444142df3..4d3e56d1f82 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ReferenceResolverAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverAttribute.cs @@ -1,16 +1,18 @@ using System.Reflection; -using HotChocolate.ApolloFederation.Descriptors; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types.Descriptors; using static HotChocolate.ApolloFederation.ThrowHelper; -namespace HotChocolate.ApolloFederation; +namespace HotChocolate.ApolloFederation.Resolvers; /// /// The reference resolver enables your gateway's query planner to resolve a particular /// entity by whatever unique identifier your other subgraphs use to reference it. /// [AttributeUsage( - AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method, + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Method, AllowMultiple = true)] public class ReferenceResolverAttribute : DescriptorAttribute { @@ -81,7 +83,7 @@ private void OnConfigure(IObjectTypeDescriptor descriptor, Type type) } } - private void OnConfigure(IObjectTypeDescriptor descriptor, MethodInfo method) + private static void OnConfigure(IObjectTypeDescriptor descriptor, MethodInfo method) { var entityResolverDescriptor = new EntityResolverDescriptor(descriptor); entityResolverDescriptor.ResolveReferenceWith(method); diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ReferenceResolverHelper.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverHelper.cs similarity index 92% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ReferenceResolverHelper.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverHelper.cs index 6e257fb14d7..69d97be3ac6 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Helpers/ReferenceResolverHelper.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ReferenceResolverHelper.cs @@ -2,9 +2,9 @@ using System.Threading.Tasks; using HotChocolate.Language; using HotChocolate.Resolvers; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; +using static HotChocolate.ApolloFederation.FederationContextData; -namespace HotChocolate.ApolloFederation.Helpers; +namespace HotChocolate.ApolloFederation.Resolvers; /// /// This class provides helpers for the reference resolver expression generators. diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ServiceType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ServiceType.cs deleted file mode 100644 index 64a1e86fb66..00000000000 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ServiceType.cs +++ /dev/null @@ -1,23 +0,0 @@ -using HotChocolate.ApolloFederation.Constants; -using HotChocolate.ApolloFederation.Properties; - -namespace HotChocolate.ApolloFederation; - -/// -/// A new object type called _Service must be created. -/// This type must have an sdl: String! field which exposes the SDL of the service's schema. -/// -/// This SDL (schema definition language) is a printed version of the service's -/// schema including the annotations of federation directives. This SDL does not -/// include the additions of the federation spec. -/// -public class ServiceType : ObjectType -{ - protected override void Configure(IObjectTypeDescriptor descriptor) - => descriptor - .Name(WellKnownTypeNames.Service) - .Description(FederationResources.ServiceType_Description) - .Field(WellKnownFieldNames.Sdl) - .Type>() - .Resolve(resolver => FederationSchemaPrinter.Print(resolver.Schema)); -} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ThrowHelper.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ThrowHelper.cs index 2804e2a6f2a..da07894b425 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ThrowHelper.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/ThrowHelper.cs @@ -1,4 +1,5 @@ using System.Reflection; +using HotChocolate.ApolloFederation.Types; using static HotChocolate.ApolloFederation.Properties.FederationResources; namespace HotChocolate.ApolloFederation; @@ -27,7 +28,7 @@ public static SerializationException FieldSet_InvalidFormat( /// node value has an invalid format. /// public static SerializationException Any_InvalidFormat( - AnyType anyType) => + _AnyType anyType) => new SerializationException( ErrorBuilder.New() .SetMessage(ThrowHelper_Any_HasInvalidFormat) @@ -41,14 +42,16 @@ public static SerializationException Any_InvalidFormat( /// of the given type. /// public static SchemaException ExternalAttribute_InvalidTarget( - Type type, MemberInfo? member) => - new SchemaException(SchemaErrorBuilder.New() - .SetMessage( - "The specified external attribute was applied to " + - "the member `{0}` of `{1}`, which is not a property.", - member?.Name, - type.FullName ?? type.Name) - .Build()); + Type type, + MemberInfo? member) => + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + "The specified external attribute was applied to " + + "the member `{0}` of `{1}`, which is not a property.", + member?.Name, + type.FullName ?? type.Name) + .Build()); /// /// No ReferenceResolver was found for a type that is decorated with a ReferenceResolverAttribute. @@ -56,12 +59,13 @@ public static SchemaException ExternalAttribute_InvalidTarget( public static SchemaException ReferenceResolverAttribute_EntityResolverNotFound( Type type, string referenceResolver) => - new SchemaException(SchemaErrorBuilder.New() - .SetMessage( - "The specified ReferenceResolver `{0}` does not exist on `{1}`.", - type.FullName ?? type.Name, - referenceResolver) - .Build()); + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + "The specified ReferenceResolver `{0}` does not exist on `{1}`.", + type.FullName ?? type.Name, + referenceResolver) + .Build()); /// /// The runtime type is not supported by the scalars ParseValue method. @@ -103,8 +107,7 @@ public static SchemaException EntityResolver_NoResolverFound() => .Build()); /// - /// The key attribute is used on the type level without specifying the the - /// fieldset. + /// The key attribute is used on the type level without specifying the fieldset. /// public static SchemaException Key_FieldSet_CannotBeEmpty( Type type) => @@ -116,6 +119,23 @@ public static SchemaException Key_FieldSet_CannotBeEmpty( // .SetCode(ErrorCodes.ApolloFederation.KeyFieldSetNullOrEmpty) .Build()); + /// + /// The key attribute is used on the type level without specifying the fieldset. + /// + public static SchemaException Key_FieldSet_MustBeEmpty( + MemberInfo member) + { + var type = member.ReflectedType ?? member.DeclaringType!; + + return new SchemaException( + SchemaErrorBuilder.New() + .SetMessage("The specified key attribute must not specify a fieldset when annotated to a field.") + .SetExtension("type", type.FullName ?? type.Name) + .SetExtension("member", member.Name) + // .SetCode(ErrorCodes.ApolloFederation.KeyFieldSetNullOrEmpty) + .Build()); + } + /// /// The provides attribute is used and the fieldset is set to null or /// . @@ -141,4 +161,58 @@ public static SchemaException Requires_FieldSet_CannotBeEmpty( // .SetCode(ErrorCodes.ApolloFederation.RequiresFieldSetNullOrEmpty) .SetExtension(nameof(member), member) .Build()); -} + + /// + /// The compose directive attribute is used on the type level without specifying the name. + /// + public static SchemaException ComposeDirective_Name_CannotBeEmpty( + Type type) => + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + ThrowHelper_ComposeDirective_Name_CannotBeEmpty, + type.FullName ?? type.Name) + .Build()); + + /// + /// The link attribute is used on the schema without specifying the url. + /// + public static SchemaException Link_Url_CannotBeEmpty( + Type type) => + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + ThrowHelper_Link_Url_CannotBeEmpty, + type.FullName ?? type.Name) + .Build()); + + /// + /// The contact attribute is used on the schema without specifying the name. + /// + public static SchemaException Contact_Name_CannotBeEmpty( + Type type) => + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + ThrowHelper_Contact_Name_CannotBeEmpty, + type.FullName ?? type.Name) + .Build()); + + /// + /// Specified federation version is not supported. + /// + public static SchemaException FederationVersion_Unknown( + FederationVersion version) => + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage( + ThrowHelper_FederationVersion_Unknown, + version) + .Build()); + + public static SchemaException Contact_Not_Repeatable() => + new SchemaException( + SchemaErrorBuilder.New() + .SetMessage("The @contact directive is not repeatable and can.") + .Build()); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/EntityResolverDefinition.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs similarity index 90% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/EntityResolverDefinition.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs index 77982e63982..5d0f5a33238 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/EntityResolverDefinition.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Descriptors.Definitions; -namespace HotChocolate.ApolloFederation.Descriptors; +namespace HotChocolate.ApolloFederation.Types; /// /// The entity definition allows to specify a reference resolver. diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/EntityResolverDescriptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs similarity index 83% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/EntityResolverDescriptor.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs index 98adae9855e..00d2c9ca79e 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/EntityResolverDescriptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs @@ -1,16 +1,16 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; -using HotChocolate.ApolloFederation.Helpers; using HotChocolate.ApolloFederation.Properties; +using HotChocolate.ApolloFederation.Resolvers; using HotChocolate.Internal; using HotChocolate.Resolvers; using HotChocolate.Types.Descriptors; using HotChocolate.Types.Descriptors.Definitions; using HotChocolate.Utilities; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; +using static HotChocolate.ApolloFederation.FederationContextData; -namespace HotChocolate.ApolloFederation.Descriptors; +namespace HotChocolate.ApolloFederation.Types; /// /// The entity descriptor allows to specify a reference resolver. @@ -63,31 +63,11 @@ private void OnCompleteDefinition(ObjectTypeDefinition definition) } } - protected internal override EntityResolverDefinition Definition { get; protected set; } = new(); - /// public IObjectTypeDescriptor ResolveReference( FieldResolverDelegate fieldResolver) => ResolveReference(fieldResolver, Array.Empty()); - private IObjectTypeDescriptor ResolveReference( - FieldResolverDelegate fieldResolver, - IReadOnlyList required) - { - if (fieldResolver is null) - { - throw new ArgumentNullException(nameof(fieldResolver)); - } - - if (required is null) - { - throw new ArgumentNullException(nameof(required)); - } - - Definition.ResolverDefinition = new(fieldResolver, required); - return _typeDescriptor; - } - /// public IObjectTypeDescriptor ResolveReferenceWith( Expression> method) @@ -97,10 +77,7 @@ public IObjectTypeDescriptor ResolveReferenceWith( public IObjectTypeDescriptor ResolveReferenceWith( Expression> method) { - if (method is null) - { - throw new ArgumentNullException(nameof(method)); - } + ArgumentNullException.ThrowIfNull(method); var member = method.TryExtractMember(true); @@ -114,20 +91,10 @@ public IObjectTypeDescriptor ResolveReferenceWith( nameof(member)); } - /// - public IObjectTypeDescriptor ResolveReferenceWith() - => ResolveReferenceWith( - Context.TypeInspector.GetNodeResolverMethod( - Definition.EntityType ?? typeof(TResolver), - typeof(TResolver))!); - /// public IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method) { - if (method is null) - { - throw new ArgumentNullException(nameof(method)); - } + ArgumentNullException.ThrowIfNull(method); var argumentBuilder = new ReferenceResolverArgumentExpressionBuilder(); @@ -141,10 +108,28 @@ public IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method) return ResolveReference(resolver.Resolver!, argumentBuilder.Required); } + /// + public IObjectTypeDescriptor ResolveReferenceWith() + => ResolveReferenceWith(typeof(TResolver)); + /// public IObjectTypeDescriptor ResolveReferenceWith(Type type) => ResolveReferenceWith( Context.TypeInspector.GetNodeResolverMethod( Definition.EntityType ?? type, type)!); + + private IObjectTypeDescriptor ResolveReference( + FieldResolverDelegate fieldResolver, + IReadOnlyList required) + { + ArgumentNullException.ThrowIfNull(fieldResolver); + + ArgumentNullException.ThrowIfNull(required); + + Definition.ResolverDefinition = new(fieldResolver, required); + return _typeDescriptor; + } + + protected internal override EntityResolverDefinition Definition { get; protected set; } = new(); } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/IEntityResolverDescriptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/IEntityResolverDescriptor.cs new file mode 100644 index 00000000000..fe91fb190f6 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/IEntityResolverDescriptor.cs @@ -0,0 +1,50 @@ +using System.Linq.Expressions; +using System.Reflection; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// The entity descriptor allows to specify a reference resolver. +/// +public interface IEntityResolverDescriptor +{ + /// + /// Resolve an entity from its representation. + /// + /// + /// The reference resolver. + /// + /// + /// Returns the descriptor for configuration chaining. + /// + IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method); +} + +/// +/// The entity descriptor allows to specify a reference resolver. +/// +public interface IEntityResolverDescriptor +{ + /// + /// Resolve an entity from its representation. + /// + /// + /// The reference resolver selector. + /// + /// + /// Returns the descriptor for configuration chaining. + /// + IObjectTypeDescriptor ResolveReferenceWith( + Expression> method); + + /// + /// Resolve an entity from its representation. + /// + /// + /// The reference resolver. + /// + /// + /// Returns the descriptor for configuration chaining. + /// + IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/ReferenceResolverDefinition.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/ReferenceResolverDefinition.cs similarity index 89% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/ReferenceResolverDefinition.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/ReferenceResolverDefinition.cs index 00950a880df..fbd21a77c51 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Descriptors/ReferenceResolverDefinition.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/ReferenceResolverDefinition.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using HotChocolate.Resolvers; -namespace HotChocolate.ApolloFederation.Descriptors; +namespace HotChocolate.ApolloFederation.Types; /// /// A reference resolver definition. @@ -24,7 +24,8 @@ public ReferenceResolverDefinition( FieldResolverDelegate resolver, IReadOnlyList? required = default) { - Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); + ArgumentNullException.ThrowIfNull(resolver); + Resolver = resolver; Required = required ?? Array.Empty(); } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedAttribute.cs new file mode 100644 index 00000000000..9df105553d9 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedAttribute.cs @@ -0,0 +1,72 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @authenticated on +/// ENUM +/// | FIELD_DEFINITION +/// | INTERFACE +/// | OBJECT +/// | SCALAR +/// +/// +/// The @authenticated directive is used to indicate that the target element is accessible only to the +/// authenticated supergraph users. For more granular access control, see the +/// RequiresScopeDirectiveType directive usage. +/// Refer to the +/// Apollo Router article for additional details. +/// +/// +/// type Foo @key(fields: "id") { +/// id: ID +/// description: String @authenticated +/// } +/// +/// +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Enum | + AttributeTargets.Interface | + AttributeTargets.Method | + AttributeTargets.Property | + AttributeTargets.Struct)] +public sealed class AuthenticatedAttribute : DescriptorAttribute +{ + protected internal override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + switch (descriptor) + { + case IEnumTypeDescriptor enumTypeDescriptor: + { + enumTypeDescriptor.Authenticated(); + break; + } + case IObjectTypeDescriptor objectFieldDescriptor: + { + objectFieldDescriptor.Authenticated(); + break; + } + case IObjectFieldDescriptor objectFieldDescriptor: + { + objectFieldDescriptor.Authenticated(); + break; + } + case IInterfaceTypeDescriptor interfaceTypeDescriptor: + { + interfaceTypeDescriptor.Authenticated(); + break; + } + case IInterfaceFieldDescriptor interfaceFieldDescriptor: + { + interfaceFieldDescriptor.Authenticated(); + break; + } + } + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDescriptionExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDescriptionExtensions.cs new file mode 100644 index 00000000000..cdf22caef1b --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDescriptionExtensions.cs @@ -0,0 +1,59 @@ +namespace HotChocolate.ApolloFederation.Types; + +/// +/// Provides extensions for applying @authenticated directive on type system descriptors. +/// +public static class AuthenticatedDescriptionExtensions +{ + /// + /// Applies @authenticated directive to indicate that the target element is accessible only to the authenticated supergraph users. + /// + /// type Foo @key(fields: "id") { + /// id: ID + /// description: String @authenticated + /// } + /// + /// + /// + /// The type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the type descriptor. + /// + /// + /// The is null. + /// + public static IEnumTypeDescriptor Authenticated(this IEnumTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(AuthenticatedDirective.Default); + } + + /// + public static IInterfaceFieldDescriptor Authenticated(this IInterfaceFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(AuthenticatedDirective.Default); + } + + /// + public static IInterfaceTypeDescriptor Authenticated(this IInterfaceTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(AuthenticatedDirective.Default); + } + + /// + public static IObjectFieldDescriptor Authenticated(this IObjectFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(AuthenticatedDirective.Default); + } + + /// + public static IObjectTypeDescriptor Authenticated(this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(AuthenticatedDirective.Default); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDirective.cs new file mode 100644 index 00000000000..d5ee8b5ee29 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/AuthenticatedDirective.cs @@ -0,0 +1,40 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @authenticated on +/// ENUM +/// | FIELD_DEFINITION +/// | INTERFACE +/// | OBJECT +/// | SCALAR +/// +/// +/// The @authenticated directive is used to indicate that the target element is accessible only to the authenticated supergraph users. +/// For more granular access control, see the RequiresScopeDirectiveType directive usage. +/// Refer to the Apollo Router article +/// for additional details. +/// +/// type Foo @key(fields: "id") { +/// id: ID +/// description: String @authenticated +/// } +/// +/// +[Package(Federation24)] +[DirectiveType( + AuthenticatedDirective_Name, + DirectiveLocation.Enum | + DirectiveLocation.FieldDefinition | + DirectiveLocation.Interface | + DirectiveLocation.Object | + DirectiveLocation.Scalar)] +[GraphQLDescription(AuthenticatedDirective_Description)] +public sealed class AuthenticatedDirective +{ + public static AuthenticatedDirective Default { get; } = new(); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ComposeDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ComposeDirective.cs new file mode 100644 index 00000000000..e76aa35145a --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ComposeDirective.cs @@ -0,0 +1,33 @@ +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @composeDirective(name: String!) repeatable on SCHEMA +/// +/// +/// By default, Supergraph schema excludes all custom directives. The @composeDirective is used to specify +/// custom directives that should be exposed in the Supergraph schema. +/// +/// +/// extend schema @composeDirective(name: "@custom") +/// @link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@composeDirective"]) +/// @link(url: "https://myspecs.dev/custom/v1.0", import: ["@custom"]) +/// +/// directive @custom on FIELD_DEFINITION +/// +/// type Query { +/// helloWorld: String! @custom +/// } +/// +/// +[Package(Federation25)] +[DirectiveType(ComposeDirective_Name, DirectiveLocation.Schema, IsRepeatable = true)] +[GraphQLDescription(ComposeDirective_Description)] +public sealed class ComposeDirective(string name) +{ + public string Name { get; } = name; +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ComposeDirectiveDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ComposeDirectiveDescriptorExtensions.cs new file mode 100644 index 00000000000..a0767f1ec57 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ComposeDirectiveDescriptorExtensions.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using HotChocolate.Execution.Configuration; +using Microsoft.Extensions.DependencyInjection; +using static HotChocolate.ApolloFederation.FederationContextData; + +namespace HotChocolate.ApolloFederation.Types; + +public static class ComposeDirectiveDescriptorExtensions +{ + /// + /// Applies @composeDirective which is used to specify custom directives that should be exposed in the + /// Supergraph schema. If not specified, by default, Supergraph schema excludes all custom directives. + /// + /// extend schema @composeDirective(name: "@custom") + /// @link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@composeDirective"]) + /// @link(url: "https://myspecs.dev/custom/v1.0", import: ["@custom"]) + /// + /// directive @custom on FIELD_DEFINITION + /// + /// type Query { + /// helloWorld: String! @custom + /// } + /// + /// + /// + /// The GraphQL request executor builder. + /// + /// + /// Name of the directive that should be preserved in the supergraph composition. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + /// + /// is null. + /// + public static IRequestExecutorBuilder ExportDirective( + this IRequestExecutorBuilder builder, + string directiveName) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentException.ThrowIfNullOrEmpty(directiveName); + + builder.ConfigureSchema( + sb => + { + sb.AddSchemaConfiguration( + d => d.Directive(new ComposeDirective(directiveName))); + }); + + return builder; + } + + public static IRequestExecutorBuilder ExportDirective( + this IRequestExecutorBuilder builder) + { + ArgumentNullException.ThrowIfNull(builder); + + builder.AddType(); + builder.AddType(); + + builder.ConfigureSchema( + sb => + { + if(!sb.ContextData.TryGetValue(ExportedDirectives, out var directiveTypes)) + { + directiveTypes = new List(); + sb.ContextData[ExportedDirectives] = directiveTypes; + } + + ((List)directiveTypes!).Add(typeof(T)); + }); + + return builder; + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ContactDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ContactDescriptorExtensions.cs new file mode 100644 index 00000000000..555b5894e25 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ContactDescriptorExtensions.cs @@ -0,0 +1,183 @@ +using System.Collections.Generic; +using HotChocolate.Execution.Configuration; +using Microsoft.Extensions.DependencyInjection; +using static HotChocolate.ApolloFederation.FederationContextData; + +namespace HotChocolate.ApolloFederation.Types; + +public static class ContactDescriptorExtensions +{ + /// + /// Applies @contact directive which can be used to prpvode team contact information to your subgraph schema. + /// This information is automatically parsed and displayed by Apollo Studio. See + /// + /// Subgraph Contact Information + /// for additional details. + /// + /// + /// schema + /// @contact( + /// description: "send urgent issues to [#oncall](https://yourteam.slack.com/archives/oncall)." + /// name: "My Team Name" + /// url: "https://myteam.slack.com/archives/teams-chat-room-url") { + /// query: Query + /// } + /// + /// + /// + /// The GraphQL request executor builder. + /// + /// + /// Contact title of the subgraph owner + /// + /// + /// URL where the subgraph's owner can be reached + /// + /// + /// Other relevant contact notes; supports markdown links + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + /// + /// is null. + /// + public static IRequestExecutorBuilder AddContact( + this IRequestExecutorBuilder builder, + string name, + string? url = null, + string? description = null) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentException.ThrowIfNullOrEmpty(name); + + builder.ConfigureSchema( + sb => + { + if (!sb.ContextData.TryAdd(ContactMarker, 1)) + { + throw ThrowHelper.Contact_Not_Repeatable(); + } + + sb.AddSchemaConfiguration(d => d.Directive(new ContactDirective(name, url, description))); + }); + + return builder; + } + + /// + /// Applies @contact directive which can be used to prpvode team contact information to your subgraph schema. + /// This information is automatically parsed and displayed by Apollo Studio. See + /// + /// Subgraph Contact Information + /// for additional details. + /// + /// + /// schema + /// @contact( + /// description: "send urgent issues to [#oncall](https://yourteam.slack.com/archives/oncall)." + /// name: "My Team Name" + /// url: "https://myteam.slack.com/archives/teams-chat-room-url") { + /// query: Query + /// } + /// + /// + /// + /// The GraphQL request executor builder. + /// + /// + /// The contact. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + /// + /// is null. + /// + public static IRequestExecutorBuilder AddContact( + this IRequestExecutorBuilder builder, + ContactDirective contact) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(contact); + + builder.ConfigureSchema( + sb => + { + if (!sb.ContextData.TryAdd(ContactMarker, 1)) + { + throw ThrowHelper.Contact_Not_Repeatable(); + } + + sb.AddSchemaConfiguration(d => d.Directive(contact)); + }); + + return builder; + } + + /// + /// Applies @contact directive which can be used to prpvode team contact information to your subgraph schema. + /// This information is automatically parsed and displayed by Apollo Studio. See + /// + /// Subgraph Contact Information + /// for additional details. + /// + /// + /// schema + /// @contact( + /// description: "send urgent issues to [#oncall](https://yourteam.slack.com/archives/oncall)." + /// name: "My Team Name" + /// url: "https://myteam.slack.com/archives/teams-chat-room-url") { + /// query: Query + /// } + /// + /// + /// + /// The GraphQL request executor builder. + /// + /// + /// A delegate to resolve the contact details from the DI or from the configuration. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + /// + /// is null. + /// + public static IRequestExecutorBuilder AddContact( + this IRequestExecutorBuilder builder, + Func contactResolver) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(contactResolver); + + builder.ConfigureSchema( + (sp, sb) => + { + var contact = contactResolver(sp.GetApplicationServices()); + + if (contact is null) + { + return; + } + + if (!sb.ContextData.TryAdd(ContactMarker, 1)) + { + throw ThrowHelper.Contact_Not_Repeatable(); + } + + sb.AddSchemaConfiguration(d => d.Directive(contact)); + }); + + return builder; + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ContactDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ContactDirective.cs new file mode 100644 index 00000000000..d7e63791fd8 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ContactDirective.cs @@ -0,0 +1,74 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @contact( +/// "Contact title of the subgraph owner" +/// name: String! +/// "URL where the subgraph's owner can be reached" +/// url: String +/// "Other relevant notes can be included here; supports markdown links" +/// description: String +/// ) on SCHEMA +/// +/// +/// Contact schema directive can be used to provide team contact information to your subgraph +/// schema. This information is automatically parsed and displayed by Apollo Studio. +/// See +/// Subgraph Contact Information for additional details. +/// +/// +/// +/// +/// schema +/// @contact( +/// description: "send urgent issues to [#oncall](https://yourteam.slack.com/archives/oncall)." +/// name : "My Team Name", url : "https://myteam.slack.com/archives/teams-chat-room-url") { +/// query: Query +/// } +/// +/// +/// +[DirectiveType(ContactDirective_Name, DirectiveLocation.Schema)] +[GraphQLDescription(ContactDirective_Description)] +public sealed class ContactDirective +{ + /// + /// Initializes new instance of + /// + /// + /// Contact title of the subgraph owner + /// + /// + /// URL where the subgraph's owner can be reached + /// + /// + /// Other relevant notes can be included here; supports markdown links + /// + public ContactDirective(string name, string? url, string? description) + { + ArgumentException.ThrowIfNullOrEmpty(name); + + Name = name; + Url = url; + Description = description; + } + + /// + /// Gets the contact title of the subgraph owner. + /// + public string Name { get; } + + /// + /// Gets the url where the subgraph's owner can be reached. + /// + public string? Url { get; } + + /// + /// Gets other relevant notes about subgraph contact information. Can include markdown links. + /// + public string? Description { get; } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeAttribute.cs new file mode 100644 index 00000000000..adf370e27c5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeAttribute.cs @@ -0,0 +1,31 @@ +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @extends on OBJECT | INTERFACE +/// +/// +/// The @extends directive is used to represent type extensions in the schema. Federated extended types should have +/// corresponding @key directive defined that specifies primary key required to fetch the underlying object. +/// +/// # extended from the Users service +/// type Foo @extends @key(fields: "id") { +/// id: ID +/// description: String +/// } +/// +/// +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface)] +public sealed class ExtendServiceTypeAttribute : ObjectTypeDescriptorAttribute +{ + protected override void OnConfigure( + IDescriptorContext context, + IObjectTypeDescriptor descriptor, + Type type) + => descriptor.ExtendServiceType(); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeDescriptorExtensions.cs new file mode 100644 index 00000000000..5c367a91ab5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeDescriptorExtensions.cs @@ -0,0 +1,76 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class ExtendServiceTypeDescriptorExtensions +{ + /// + /// Applies @extends directive which is used to represent type extensions in the schema. Federated extended types should have + /// corresponding @key directive defined that specifies primary key required to fetch the underlying object. + /// + /// NOTE: Federation v2 no longer requires `@extends` directive due to the smart entity type merging. All usage of @extends + /// directive should be removed from your Federation v2 schemas. + /// + /// # extended from the Users service + /// type Foo @extends @key(fields: "id") { + /// id: ID + /// description: String + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + public static IObjectTypeDescriptor ExtendServiceType( + this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + if (descriptor.Extend().Context.GetFederationVersion() == FederationVersion.Federation10) + { + descriptor.Directive(ExtendServiceTypeDirective.Default); + } + + return descriptor; + } + + /// + /// Applies @extends directive which is used to represent type extensions in the schema. Federated extended types should have + /// corresponding @key directive defined that specifies primary key required to fetch the underlying object. + /// + /// NOTE: Federation v2 no longer requires `@extends` directive due to the smart entity type merging. All usage of @extends + /// directive should be removed from your Federation v2 schemas. + /// + /// # extended from the Users service + /// type Foo @extends @key(fields: "id") { + /// id: ID + /// description: String + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + public static IObjectTypeDescriptor ExtendServiceType( + this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + if (descriptor.Extend().Context.GetFederationVersion() == FederationVersion.Federation10) + { + descriptor.Directive(ExtendServiceTypeDirective.Default); + } + + return descriptor; + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeDirective.cs new file mode 100644 index 00000000000..cfdf38cdee8 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExtendServiceTypeDirective.cs @@ -0,0 +1,31 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @extends on OBJECT | INTERFACE +/// +/// +/// The @extends directive is used to represent type extensions in the schema. Federated extended types should have +/// corresponding @key directive defined that specifies primary key required to fetch the underlying object. +/// +/// # extended from the Users service +/// type Foo @extends @key(fields: "id") { +/// id: ID +/// description: String +/// } +/// +/// +[Package(Federation20)] +[DirectiveType( + ExtendsDirective_Name, + DirectiveLocation.Object | + DirectiveLocation.Interface)] +[GraphQLDescription(ExtendsDirective_Description)] +public sealed class ExtendServiceTypeDirective +{ + public static ExtendServiceTypeDirective Default { get; } = new(); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalAttribute.cs new file mode 100644 index 00000000000..f4fa6037d27 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalAttribute.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// # federation v1 definition +/// directive @external on FIELD_DEFINITION +/// +/// # federation v2 definition +/// directive @external on OBJECT | FIELD_DEFINITION +/// +/// +/// The @external directive is used to mark a field as owned by another service. +/// This allows service A to use fields from service B while also knowing at runtime +/// the types of that field. All the external fields should either be referenced from the @key, +/// @requires or @provides directives field sets. +/// +/// Due to the smart merging of entity types, Federation v2 no longer requires @external directive +/// on @key fields and can be safely omitted from the schema. @external directive is only required +/// on fields referenced by the @requires and @provides directive. +/// +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// remoteField: String @external +/// localField: String @requires(fields: "remoteField") +/// } +/// +/// +public sealed class ExternalAttribute : ObjectFieldDescriptorAttribute +{ + protected override void OnConfigure( + IDescriptorContext context, + IObjectFieldDescriptor descriptor, + MemberInfo member) + => descriptor.External(); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalDescriptorExtensions.cs new file mode 100644 index 00000000000..26cbf1749f5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalDescriptorExtensions.cs @@ -0,0 +1,39 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class ExternalDescriptorExtensions +{ + /// + /// Applies the @external directive which is used to mark a field as owned by another service. + /// This allows service A to use fields from service B while also knowing at runtime + /// the types of that field. All the external fields should either be referenced from the @key, + /// @requires or @provides directives field sets. + /// + /// Due to the smart merging of entity types, Federation v2 no longer requires @external directive + /// on @key fields and can be safely omitted from the schema. @external directive is only required + /// on fields referenced by the @requires and @provides directive. + /// + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// remoteField: String @external + /// localField: String @requires(fields: "remoteField") + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// The is null. + /// + public static IObjectFieldDescriptor External( + this IObjectFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.Directive(ExternalDirective.Default); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalDirective.cs new file mode 100644 index 00000000000..3118084014e --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ExternalDirective.cs @@ -0,0 +1,35 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @external on FIELD_DEFINITION +/// +/// +/// The @external directive is used to mark a field as owned by another service. +/// This allows service A to use fields from service B while also knowing at runtime +/// the types of that field. All the external fields should either be referenced from the @key, +/// @requires or @provides directives field sets. +/// +/// Due to the smart merging of entity types, Federation v2 no longer requires @external directive +/// on @key fields and can be safely omitted from the schema. @external directive is only required +/// on fields referenced by the @requires and @provides directive. +/// +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// remoteField: String @external +/// localField: String @requires(fields: "remoteField") +/// } +/// +/// +[Package(Federation20)] +[DirectiveType(ExternalDirective_Name, DirectiveLocation.FieldDefinition)] +[GraphQLDescription(ExternalDirective_Description)] +public sealed class ExternalDirective +{ + public static ExternalDirective Default { get; } = new(); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleAttribute.cs new file mode 100644 index 00000000000..9d05e1d7b70 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleAttribute.cs @@ -0,0 +1,84 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @inaccessible on FIELD_DEFINITION +/// | OBJECT +/// | INTERFACE +/// | UNION +/// | ENUM +/// | ENUM_VALUE +/// | SCALAR +/// | INPUT_OBJECT +/// | INPUT_FIELD_DEFINITION +/// | ARGUMENT_DEFINITION +/// +/// +/// The @inaccessible directive is used to mark location within schema as inaccessible +/// from the GraphQL Router. Applying @inaccessible directive on a type is equivalent of applying +/// it on all type fields. +/// +/// While @inaccessible fields are not exposed by the router to the clients, they are still available +/// for query plans and can be referenced from @key and @requires directives. This allows you to not +/// expose sensitive fields to your clients but still make them available for computations. +/// Inaccessible can also be used to incrementally add schema elements (e.g. fields) to multiple +/// subgraphs without breaking composition. +/// +/// +/// type Foo @inaccessible { +/// hiddenId: ID! +/// hiddenField: String +/// } +/// +/// +[AttributeUsage( + AttributeTargets.Class + | AttributeTargets.Enum + | AttributeTargets.Field + | AttributeTargets.Interface + | AttributeTargets.Method + | AttributeTargets.Parameter + | AttributeTargets.Property + | AttributeTargets.Struct)] +public sealed class InaccessibleAttribute : DescriptorAttribute +{ + protected internal override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + switch (descriptor) + { + case IEnumTypeDescriptor enumTypeDescriptor: + enumTypeDescriptor.Inaccessible(); + break; + case IObjectTypeDescriptor objectFieldDescriptor: + objectFieldDescriptor.Inaccessible(); + break; + case IObjectFieldDescriptor objectFieldDescriptor: + objectFieldDescriptor.Inaccessible(); + break; + case IInterfaceTypeDescriptor interfaceTypeDescriptor: + interfaceTypeDescriptor.Inaccessible(); + break; + case IInterfaceFieldDescriptor interfaceFieldDescriptor: + interfaceFieldDescriptor.Inaccessible(); + break; + case IInputObjectTypeDescriptor inputObjectTypeDescriptor: + inputObjectTypeDescriptor.Inaccessible(); + break; + case IInputFieldDescriptor inputFieldDescriptor: + inputFieldDescriptor.Inaccessible(); + break; + case IUnionTypeDescriptor unionTypeDescriptor: + unionTypeDescriptor.Inaccessible(); + break; + case IEnumValueDescriptor enumValueDescriptor: + enumValueDescriptor.Inaccessible(); + break; + } + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleDescriptorExtensions.cs new file mode 100644 index 00000000000..d4ff26078f4 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleDescriptorExtensions.cs @@ -0,0 +1,98 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class InaccessibleDescriptorExtensions +{ + /// + /// Applies the @inaccessible directive which is used to mark location within schema as inaccessible + /// from the GraphQL Router. While @inaccessible fields are not exposed by the router to the clients, + /// they are still available for query plans and can be referenced from @key and @requires directives. + /// This allows you to not expose sensitive fields to your clients but still make them available for + /// computations. Inaccessible can also be used to incrementally add schema elements (e.g. fields) to + /// multiple subgraphs without breaking composition. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// hidden: String @inaccessible + /// } + /// + /// + /// + /// The type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the type descriptor. + /// + /// + /// The is null. + /// + public static IEnumTypeDescriptor Inaccessible( + this IEnumTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IEnumValueDescriptor Inaccessible( + this IEnumValueDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IInterfaceFieldDescriptor Inaccessible( + this IInterfaceFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IInterfaceTypeDescriptor Inaccessible( + this IInterfaceTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IInputObjectTypeDescriptor Inaccessible( + this IInputObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IInputFieldDescriptor Inaccessible( + this IInputFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IObjectFieldDescriptor Inaccessible( + this IObjectFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IObjectTypeDescriptor Inaccessible( + this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } + + /// + public static IUnionTypeDescriptor Inaccessible( + this IUnionTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + return descriptor.Directive(InaccessibleDirective.Default); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleDirective.cs new file mode 100644 index 00000000000..02070ade87c --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InaccessibleDirective.cs @@ -0,0 +1,54 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @inaccessible on FIELD_DEFINITION +/// | OBJECT +/// | INTERFACE +/// | UNION +/// | ENUM +/// | ENUM_VALUE +/// | SCALAR +/// | INPUT_OBJECT +/// | INPUT_FIELD_DEFINITION +/// | ARGUMENT_DEFINITION +/// +/// +/// The @inaccessible directive is used to mark location within schema as inaccessible +/// from the GraphQL Router. Applying @inaccessible directive on a type is equivalent of applying +/// it on all type fields. +/// +/// While @inaccessible fields are not exposed by the router to the clients, they are still available +/// for query plans and can be referenced from @key and @requires directives. This allows you to not +/// expose sensitive fields to your clients but still make them available for computations. +/// Inaccessible can also be used to incrementally add schema elements (e.g. fields) to multiple +/// subgraphs without breaking composition. +/// +/// type Foo @inaccessible { +/// hiddenId: ID! +/// hiddenField: String +/// } +/// +/// +[Package(Federation20)] +[DirectiveType( + InaccessibleDirective_Name, + DirectiveLocation.FieldDefinition | + DirectiveLocation.Object | + DirectiveLocation.Interface | + DirectiveLocation.Union | + DirectiveLocation.Enum | + DirectiveLocation.EnumValue | + DirectiveLocation.Scalar | + DirectiveLocation.InputObject | + DirectiveLocation.InputFieldDefinition | + DirectiveLocation.ArgumentDefinition)] +[GraphQLDescription(InaccessibleDirective_Description)] +public sealed class InaccessibleDirective +{ + public static InaccessibleDirective Default { get; } = new(); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectAttribute.cs new file mode 100644 index 00000000000..832f76c49d5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectAttribute.cs @@ -0,0 +1,29 @@ +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @interfaceObject on OBJECT +/// +/// +/// The @interfaceObject directive provides meta information to the router that this entity +/// type defined within this subgraph is an interface in the supergraph. +/// This allows you to extend functionality of an interface across the supergraph +/// without having to implement (or even be aware of) all its implementing types. +/// +/// +/// type Foo @interfaceObject @key(fields: "ids") { +/// id: ID! +/// newCommonField: String +/// } +/// +/// +public sealed class InterfaceObjectAttribute : ObjectTypeDescriptorAttribute +{ + protected override void OnConfigure( + IDescriptorContext context, + IObjectTypeDescriptor descriptor, + Type type) + => descriptor.InterfaceObject(); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectDescriptorExtensions.cs new file mode 100644 index 00000000000..188598ec6cb --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectDescriptorExtensions.cs @@ -0,0 +1,58 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class InterfaceObjectDescriptorExtensions +{ + /// + /// Applies the @interfaceObject directive which provides meta information to the router that this entity + /// type defined within this subgraph is an interface in the supergraph. This allows you to extend functionality + /// of an interface across the supergraph without having to implement (or even be aware of) all its implementing types. + /// + /// type Foo @interfaceObject @key(fields: "ids") { + /// id: ID! + /// newCommonField: String + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// The is null. + /// + public static IObjectTypeDescriptor InterfaceObject(this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.Directive(InterfaceObjectDirective.Default); + } + + /// + /// Applies the @interfaceObject directive which provides meta information to the router that this entity + /// type defined within this subgraph is an interface in the supergraph. This allows you to extend functionality + /// of an interface across the supergraph without having to implement (or even be aware of) all its implementing types. + /// + /// type Foo @interfaceObject @key(fields: "ids") { + /// id: ID! + /// newCommonField: String + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// The is null. + /// + public static IObjectTypeDescriptor InterfaceObject(this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.Directive(InterfaceObjectDirective.Default); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectDirective.cs new file mode 100644 index 00000000000..0d76dfc1daa --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/InterfaceObjectDirective.cs @@ -0,0 +1,28 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @interfaceObject on OBJECT +/// +/// +/// The @interfaceObject directive provides meta information to the router that this entity +/// type defined within this subgraph is an interface in the supergraph. This allows you to extend functionality +/// of an interface across the supergraph without having to implement (or even be aware of) all its implementing types. +/// +/// type Foo @interfaceObject @key(fields: "ids") { +/// id: ID! +/// newCommonField: String +/// } +/// +/// +[Package(Federation22)] +[DirectiveType(InterfaceObject_Name, DirectiveLocation.Object)] +[GraphQLDescription(InterfaceObjectDirective_Description)] +public sealed class InterfaceObjectDirective +{ + public static InterfaceObjectDirective Default { get; } = new(); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs new file mode 100644 index 00000000000..5b64eeacc86 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs @@ -0,0 +1,138 @@ +using System.Collections.Generic; +using System.Reflection; +using HotChocolate.Types.Descriptors; +using static System.Reflection.MemberTypes; +using static HotChocolate.ApolloFederation.FederationContextData; +using static HotChocolate.ApolloFederation.ThrowHelper; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// # federation v1 definition +/// directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE +/// +/// # federation v2 definition +/// directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE +/// +/// +/// The @key directive is used to indicate a combination of fields that can be used to uniquely +/// identify and fetch an object or interface. The specified field set can represent single field (e.g. "id"), +/// multiple fields (e.g. "id name") or nested selection sets (e.g. "id user { name }"). Multiple keys can +/// be specified on a target type. +/// +/// Keys can also be marked as non-resolvable which indicates to router that given entity should never be +/// resolved within given subgraph. This allows your subgraph to still reference target entity without +/// contributing any fields to it. +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// field: String +/// bars: [Bar!]! +/// } +/// +/// type Bar @key(fields: "id", resolvable: false) { +/// id: ID! +/// } +/// +/// +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Property, + AllowMultiple = true)] +public sealed class KeyAttribute : DescriptorAttribute +{ + /// + /// Initializes a new instance of . + /// + public KeyAttribute() + { + Resolvable = true; + } + + /// + /// Initializes a new instance of . + /// + /// + /// The field set that describes the key. + /// Grammatically, a field set is a selection set minus the braces. + /// + /// + /// Indicates whether the key is resolvable. + /// + public KeyAttribute(string fieldSet, bool resolvable = true) + { + FieldSet = fieldSet; + Resolvable = resolvable; + } + + /// + /// Gets the field set that describes the key. + /// Grammatically, a field set is a selection set minus the braces. + /// + public string? FieldSet { get; } + + /// + /// Gets a value that indicates whether the key is resolvable. + /// + public bool Resolvable { get; } + + protected internal override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + switch (element) + { + case Type type: + ConfigureType(type, descriptor); + break; + + case PropertyInfo member: + ConfigureField(member, descriptor); + break; + + case MethodInfo member: + ConfigureField(member, descriptor); + break; + } + } + + private void ConfigureType(Type type, IDescriptor descriptor) + { + if (string.IsNullOrEmpty(FieldSet)) + { + throw Key_FieldSet_CannotBeEmpty(type); + } + + switch (descriptor) + { + case IObjectTypeDescriptor typeDesc: + typeDesc.Key(FieldSet, Resolvable); + break; + + case IInterfaceTypeDescriptor interfaceDesc: + interfaceDesc.Key(FieldSet, Resolvable); + break; + } + } + + private void ConfigureField(MemberInfo member, IDescriptor descriptor) + { + if (!string.IsNullOrEmpty(FieldSet)) + { + throw Key_FieldSet_MustBeEmpty(member); + } + + switch (descriptor) + { + case IObjectFieldDescriptor fieldDesc: + fieldDesc.Extend().Definition.ContextData.TryAdd(KeyMarker, true); + break; + + case IInterfaceFieldDescriptor fieldDesc: + fieldDesc.Extend().Definition.ContextData.TryAdd(KeyMarker, true); + break; + } + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyDescriptorExtensions.cs new file mode 100644 index 00000000000..a6d1c6e68b4 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyDescriptorExtensions.cs @@ -0,0 +1,145 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class KeyDescriptorExtensions +{ + /// + /// Applies the @key directive which is used to indicate a combination of fields that can be used to uniquely + /// identify and fetch an object or interface. The specified field set can represent single field (e.g. "id"), + /// multiple fields (e.g. "id name") or nested selection sets (e.g. "id user { name }"). Multiple keys can + /// be specified on a target type. + /// + /// Keys can be marked as non-resolvable which indicates to router that given entity should never be + /// resolved within given subgraph. This allows your subgraph to still reference target entity without + /// contributing any fields to it. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// field: String + /// bars: [Bar!]! + /// } + /// + /// type Bar @key(fields: "id", resolvable: false) { + /// id: ID! + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// The field set that describes the key. + /// Grammatically, a field set is a selection set minus the braces. + /// + /// + /// Boolean flag to indicate whether this entity is resolvable locally. + /// + /// + /// + /// is null. + /// + /// + /// is null or . + /// + public static IEntityResolverDescriptor Key( + this IObjectTypeDescriptor descriptor, + string fieldSet, + bool resolvable = true) + { + ArgumentNullException.ThrowIfNull(descriptor); + ArgumentException.ThrowIfNullOrEmpty(fieldSet); + + descriptor.Directive(new KeyDirective(fieldSet, resolvable)); + return new EntityResolverDescriptor(descriptor); + } + + /// + /// Adds the @key directive which is used to indicate a combination of fields that can be used to uniquely + /// identify and fetch an object or interface. The specified field set can represent single field (e.g. "id"), + /// multiple fields (e.g. "id name") or nested selection sets (e.g. "id user { name }"). Multiple keys can + /// be specified on a target type. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// field: String + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// The field set that describes the key. + /// Grammatically, a field set is a selection set minus the braces. + /// + /// + /// Boolean flag to indicate whether this entity is resolvable locally. + /// + /// + /// + /// is null. + /// + /// + /// is null or . + /// + public static IEntityResolverDescriptor Key( + this IObjectTypeDescriptor descriptor, + string fieldSet, + bool resolvable = true) + { + ArgumentNullException.ThrowIfNull(descriptor); + ArgumentException.ThrowIfNullOrEmpty(fieldSet); + + descriptor.Directive(new KeyDirective(fieldSet, resolvable)); + + return new EntityResolverDescriptor(descriptor); + } + + /// + /// Applies the @key directive which is used to indicate a combination of fields that can be used to uniquely + /// identify and fetch an object or interface. The specified field set can represent single field (e.g. "id"), + /// multiple fields (e.g. "id name") or nested selection sets (e.g. "id user { name }"). Multiple keys can + /// be specified on a target type. + /// + /// Keys can be marked as non-resolvable which indicates to router that given entity should never be + /// resolved within given subgraph. This allows your subgraph to still reference target entity without + /// contributing any fields to it. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// field: String + /// bars: [Bar!]! + /// } + /// + /// type Bar @key(fields: "id", resolvable: true) { + /// id: ID! + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// The field set that describes the key. + /// Grammatically, a field set is a selection set minus the braces. + /// + /// + /// Boolean flag to indicate whether this entity is resolvable locally. + /// + /// + /// + /// is null. + /// + /// + /// is null or . + /// + public static IInterfaceTypeDescriptor Key( + this IInterfaceTypeDescriptor descriptor, + string fieldSet, + bool resolvable = true) + { + ArgumentNullException.ThrowIfNull(descriptor); + ArgumentException.ThrowIfNullOrEmpty(fieldSet); + + return descriptor.Directive(new KeyDirective(fieldSet, resolvable)); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyDirective.cs new file mode 100644 index 00000000000..076a7fbce9a --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyDirective.cs @@ -0,0 +1,55 @@ +using HotChocolate.Language; +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; +using DirectiveLocation = HotChocolate.Types.DirectiveLocation; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE +/// +/// +/// The @key directive is used to indicate a combination of fields that can be used to uniquely +/// identify and fetch an object or interface. The specified field set can represent single field (e.g. "id"), +/// multiple fields (e.g. "id name") or nested selection sets (e.g. "id user { name }"). Multiple keys can +/// be specified on a target type. +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// field: String +/// } +/// +/// +[Package(Federation20)] +[DirectiveType( + KeyDirective_Name, + DirectiveLocation.Object | + DirectiveLocation.Interface, + IsRepeatable = true)] +[GraphQLDescription(KeyDirective_Description)] +[KeyLegacySupport] +public sealed class KeyDirective +{ + public KeyDirective(string fields, bool resolvable = true) + { + ArgumentException.ThrowIfNullOrEmpty(fields); + Fields = FieldSetType.ParseSelectionSet(fields); + Resolvable = resolvable; + } + + public KeyDirective(SelectionSetNode fields, bool resolvable = true) + { + ArgumentNullException.ThrowIfNull(fields); + Fields = fields; + Resolvable = resolvable; + } + + [FieldSet] + public SelectionSetNode Fields { get; } + + [GraphQLType] + [DefaultValue(true)] + public bool Resolvable { get; } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyLegacySupportAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyLegacySupportAttribute.cs new file mode 100644 index 00000000000..8aa10f9d292 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyLegacySupportAttribute.cs @@ -0,0 +1,19 @@ +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +internal sealed class KeyLegacySupportAttribute : DirectiveTypeDescriptorAttribute +{ + protected override void OnConfigure( + IDescriptorContext context, + IDirectiveTypeDescriptor descriptor, + Type type) + { + if (descriptor.GetFederationVersion() == FederationVersion.Federation10) + { + var desc = (IDirectiveTypeDescriptor)descriptor; + desc.BindArgumentsExplicitly(); + desc.Argument(t => t.Fields); + } + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/LinkDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/LinkDescriptorExtensions.cs new file mode 100644 index 00000000000..abf47d2fc09 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/LinkDescriptorExtensions.cs @@ -0,0 +1,124 @@ +using System.Collections.Generic; +using System.Linq; +using HotChocolate.Execution.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace HotChocolate.ApolloFederation.Types; + +public static class LinkDescriptorExtensions +{ + /// + /// Applies @link directive definitions to link the document to external schemas. + /// External schemas are identified by their url, which optionally ends with a name and version with + /// the following format: `{NAME}/v{MAJOR}.{MINOR}` + /// + /// By default, external types should be namespaced (prefixed with namespace__, e.g. key directive + /// should be namespaced as federation__key) unless they are explicitly imported. We automatically + /// import ALL federation directives to avoid the need for namespacing. + /// + /// NOTE: We currently DO NOT support full @link directive capability as it requires support for + /// namespacing and renaming imports. This functionality may be added in the future releases. + /// See @link specification for details. + /// + /// + /// extend schema @link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@composeDirective"]) + /// + /// type Query { + /// foo: Foo! + /// } + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// name: String + /// } + /// + /// + /// + /// The GraphQL request executor builder. + /// + /// + /// Url of specification to be imported + /// + /// + /// Optional list of imported elements. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + /// + /// is null. + /// + public static IRequestExecutorBuilder AddLink( + this IRequestExecutorBuilder builder, + string url, + IReadOnlyList? imports) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentException.ThrowIfNullOrEmpty(url); + return AddLink(builder, new Uri(url), imports); + } + + /// + /// Applies @link directive definitions to link the document to external schemas. + /// External schemas are identified by their url, which optionally ends with a name and version with + /// the following format: `{NAME}/v{MAJOR}.{MINOR}` + /// + /// By default, external types should be namespaced (prefixed with namespace__, e.g. key directive + /// should be namespaced as federation__key) unless they are explicitly imported. We automatically + /// import ALL federation directives to avoid the need for namespacing. + /// + /// NOTE: We currently DO NOT support full @link directive capability as it requires support for + /// namespacing and renaming imports. This functionality may be added in the future releases. + /// See @link specification for details. + /// + /// + /// extend schema @link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@composeDirective"]) + /// + /// type Query { + /// foo: Foo! + /// } + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// name: String + /// } + /// + /// + /// + /// The GraphQL request executor builder. + /// + /// + /// Url of specification to be imported + /// + /// + /// Optional list of imported elements. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + /// + /// is null. + /// + public static IRequestExecutorBuilder AddLink( + this IRequestExecutorBuilder builder, + Uri url, + IReadOnlyList? imports) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(url); + + builder.ConfigureSchema( + sb => + { + sb.AddSchemaConfiguration(d => d.Directive(new LinkDirective(url, imports?.ToHashSet()))); + }); + + return builder; + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/LinkDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/LinkDirective.cs new file mode 100644 index 00000000000..88df3bd476a --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/LinkDirective.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using static HotChocolate.ApolloFederation.FederationTypeNames; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// Object representation of @link directive. +/// +[DirectiveType(LinkDirective_Name, DirectiveLocation.Schema, IsRepeatable = true)] +public sealed class LinkDirective +{ + /// + /// Initializes new instance of + /// + /// + /// Url of specification to be imported + /// + /// + /// Optional list of imported elements. + /// + public LinkDirective(Uri url, IReadOnlySet? import) + { + Url = url; + Import = import; + } + + /// + /// Gets imported specification url. + /// + [GraphQLType>] + public Uri Url { get; } + + /// + /// Gets optional list of imported element names. + /// + public IReadOnlySet? Import { get; } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideAttribute.cs new file mode 100644 index 00000000000..020f4243acc --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideAttribute.cs @@ -0,0 +1,49 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @override(from: String!) on FIELD_DEFINITION +/// +/// +/// The @override directive is used to indicate that the current subgraph is taking +/// responsibility for resolving the marked field away from the subgraph specified in the from +/// argument. Name of the subgraph to be overridden has to match the name of the subgraph that +/// was used to publish their schema. +/// +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// description: String @override(from: "BarSubgraph") +/// } +/// +/// +public sealed class OverrideAttribute : ObjectFieldDescriptorAttribute +{ + + /// + /// Initializes new instance of + /// + /// + /// Name of the subgraph to be overridden + /// + public OverrideAttribute(string from) + { + From = from; + } + + /// + /// Get name of the subgraph to be overridden. + /// + public string From { get; } + + protected override void OnConfigure( + IDescriptorContext context, + IObjectFieldDescriptor descriptor, + MemberInfo member) + { + descriptor.Override(From); + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideDescriptorExtensions.cs new file mode 100644 index 00000000000..f50c150e48a --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideDescriptorExtensions.cs @@ -0,0 +1,41 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class OverrideDescriptorExtensions +{ + /// + /// Applies the @override directive which is used to indicate that the current subgraph is taking + /// responsibility for resolving the marked field away from the subgraph specified in the from + /// argument. Name of the subgraph to be overridden has to match the name of the subgraph that + /// was used to publish their schema. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// description: String @override(from: "BarSubgraph") + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// Name of the subgraph to be overridden. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// is null. + /// + /// + /// is null or . + /// + public static IObjectFieldDescriptor Override( + this IObjectFieldDescriptor descriptor, + string from) + { + ArgumentNullException.ThrowIfNull(descriptor); + ArgumentException.ThrowIfNullOrEmpty(from); + + return descriptor.Directive(new OverrideDirective(from)); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideDirective.cs new file mode 100644 index 00000000000..5c5a1943cb4 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/OverrideDirective.cs @@ -0,0 +1,29 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @override(from: String!) on FIELD_DEFINITION +/// +/// +/// The @override directive is used to indicate that the current subgraph is taking +/// responsibility for resolving the marked field away from the subgraph specified in the from +/// argument. Name of the subgraph to be overridden has to match the name of the subgraph that +/// was used to publish their schema. +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// description: String @override(from: "BarSubgraph") +/// } +/// +/// +[Package(Federation20)] +[DirectiveType(OverrideDirective_Name, DirectiveLocation.FieldDefinition)] +[GraphQLDescription(OverrideDirective_Description)] +public sealed class OverrideDirective(string from) +{ + public string From { get; } = from; +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PackageAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PackageAttribute.cs new file mode 100644 index 00000000000..2e0b4c499b8 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PackageAttribute.cs @@ -0,0 +1,20 @@ +namespace HotChocolate.ApolloFederation.Types; + +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct)] +public sealed class PackageAttribute : Attribute +{ + internal PackageAttribute(string url, bool isFederationType = false) + { + Url = new(url); + IsFederationType = isFederationType; + } + + public PackageAttribute(string url) + { + Url = new(url); + } + + public Uri Url { get; } + + internal bool IsFederationType { get; } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ProvidesAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesAttribute.cs similarity index 53% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/ProvidesAttribute.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesAttribute.cs index e1cba395a76..606457193e1 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/ProvidesAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesAttribute.cs @@ -2,20 +2,32 @@ using HotChocolate.Types.Descriptors; using static HotChocolate.ApolloFederation.ThrowHelper; -namespace HotChocolate.ApolloFederation; +namespace HotChocolate.ApolloFederation.Types; /// -/// The @provides directive is used to annotate the expected returned fieldset -/// from a field on a base type that is guaranteed to be selectable by the gateway. +/// +/// directive @provides(fields: _FieldSet!) on FIELD_DEFINITION +/// /// +/// The @provides directive is a router optimization hint specifying field set that +/// can be resolved locally at the given subgraph through this particular query path. This +/// allows you to expose only a subset of fields from the underlying entity type to be selectable +/// from the federated schema without the need to call other subgraphs. Provided fields specified +/// in the directive field set should correspond to a valid field on the underlying GraphQL +/// interface/object type. @provides directive can only be used on fields returning entities. /// -/// type Review @key(fields: "id") { -/// product: Product @provides(fields: "name") +/// type Foo @key(fields: "id") { +/// id: ID! +/// # implies name field can be resolved locally +/// bar: Bar @provides(fields: "name") +/// # name fields are external +/// # so will be fetched from other subgraphs +/// bars: [Bar] /// } /// -/// extend type Product @key(fields: "upc") { -/// upc: String @external -/// name: String @external +/// type Bar @key(fields: "id") { +/// id: ID! +/// name: String @external /// } /// /// diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesDescriptorExtensions.cs new file mode 100644 index 00000000000..a832d12e48b --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesDescriptorExtensions.cs @@ -0,0 +1,52 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class ProvidesDescriptorExtensions +{ + /// + /// Applies the @provides directive which is a router optimization hint specifying field set that + /// can be resolved locally at the given subgraph through this particular query path. This + /// allows you to expose only a subset of fields from the underlying entity type to be selectable + /// from the federated schema without the need to call other subgraphs. Provided fields specified + /// in the directive field set should correspond to a valid field on the underlying GraphQL + /// interface/object type. @provides directive can only be used on fields returning entities. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// # implies name field can be resolved locally + /// bar: Bar @provides(fields: "name") + /// # name fields are external + /// # so will be fetched from other subgraphs + /// bars: [Bar] + /// } + /// + /// type Bar @key(fields: "id") { + /// id: ID! + /// name: String @external + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// The fields that are guaranteed to be selectable by the gateway. + /// Grammatically, a field set is a selection set minus the braces. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// is null. + /// + /// + /// is null or . + /// + public static IObjectFieldDescriptor Provides( + this IObjectFieldDescriptor descriptor, + string fieldSet) + { + ArgumentNullException.ThrowIfNull(descriptor); + ArgumentException.ThrowIfNullOrEmpty(fieldSet); + return descriptor.Directive(new ProvidesDirective(fieldSet)); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesDirective.cs new file mode 100644 index 00000000000..99a6af13178 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ProvidesDirective.cs @@ -0,0 +1,55 @@ +using HotChocolate.Language; +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; +using DirectiveLocation = HotChocolate.Types.DirectiveLocation; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @provides(fields: _FieldSet!) on FIELD_DEFINITION +/// +/// +/// The @provides directive is a router optimization hint specifying field set that +/// can be resolved locally at the given subgraph through this particular query path. This +/// allows you to expose only a subset of fields from the underlying entity type to be selectable +/// from the federated schema without the need to call other subgraphs. Provided fields specified +/// in the directive field set should correspond to a valid field on the underlying GraphQL +/// interface/object type. @provides directive can only be used on fields returning entities. +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// # implies name field can be resolved locally +/// bar: Bar @provides(fields: "name") +/// # name fields are external +/// # so will be fetched from other subgraphs +/// bars: [Bar] +/// } +/// +/// type Bar @key(fields: "id") { +/// id: ID! +/// name: String @external +/// } +/// +/// +[Package(Federation20)] +[DirectiveType(ProvidesDirective_Name, DirectiveLocation.FieldDefinition)] +[GraphQLDescription(ProvidesDirective_Description)] +public sealed class ProvidesDirective +{ + public ProvidesDirective(string fields) + { + ArgumentException.ThrowIfNullOrEmpty(fields); + Fields = FieldSetType.ParseSelectionSet(fields); + } + + public ProvidesDirective(SelectionSetNode fields) + { + ArgumentNullException.ThrowIfNull(fields); + Fields = fields; + } + + [FieldSet] + public SelectionSetNode Fields { get; } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/RequiresAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresAttribute.cs similarity index 59% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/RequiresAttribute.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresAttribute.cs index 16549b3a1bb..d8022448c82 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/RequiresAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresAttribute.cs @@ -2,20 +2,29 @@ using HotChocolate.Types.Descriptors; using static HotChocolate.ApolloFederation.ThrowHelper; -namespace HotChocolate.ApolloFederation; +namespace HotChocolate.ApolloFederation.Types; /// -/// The @requires directive is used to annotate the required input fieldset -/// from a base type for a resolver. It is used to develop a query plan -/// where the required fields may not be needed by the client, but the -/// service may need additional information from other services. +/// +/// # federation v1 definition +/// directive @requires(fields: _FieldSet!) on FIELD_DEFINITION /// +/// # federation v2 definition +/// directive @requires(fields: FieldSet!) on FIELD_DEFINITON +/// +/// +/// The @requires directive is used to specify external (provided by other subgraphs) +/// entity fields that are needed to resolve target field. It is used to develop a query plan where +/// the required fields may not be needed by the client, but the service may need additional +/// information from other subgraphs. Required fields specified in the directive field set should +/// correspond to a valid field on the underlying GraphQL interface/object and should be instrumented +/// with @external directive. /// -/// # extended from the Users service -/// extend type User @key(fields: "id") { -/// id: ID! @external -/// email: String @external -/// reviews: [Review] @requires(fields: "email") +/// type Foo @key(fields: "id") { +/// id: ID! +/// # this field will be resolved from other subgraph +/// remote: String @external +/// local: String @requires(fields: "remote") /// } /// /// diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresDescriptorExtensions.cs new file mode 100644 index 00000000000..acc54ef695d --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresDescriptorExtensions.cs @@ -0,0 +1,48 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class RequiresDescriptorExtensions +{ + /// + /// Applies the @requires directive which is used to specify external (provided by other subgraphs) + /// entity fields that are needed to resolve target field. It is used to develop a query plan where + /// the required fields may not be needed by the client, but the service may need additional + /// information from other subgraphs. Required fields specified in the directive field set should + /// correspond to a valid field on the underlying GraphQL interface/object and should be instrumented + /// with @external directive. + /// + /// type Foo @key(fields: "id") { + /// id: ID! + /// # this field will be resolved from other subgraph + /// remote: String @external + /// local: String @requires(fields: "remote") + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// The describes which fields may + /// not be needed by the client, but are required by + /// this service as additional information from other services. + /// Grammatically, a field set is a selection set minus the braces. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// is null. + /// + /// + /// is null or . + /// + public static IObjectFieldDescriptor Requires( + this IObjectFieldDescriptor descriptor, + string fieldSet) + { + ArgumentNullException.ThrowIfNull(descriptor); + ArgumentException.ThrowIfNullOrEmpty(fieldSet); + + return descriptor.Directive(new RequiresDirective(fieldSet)); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresDirective.cs new file mode 100644 index 00000000000..c6b66e1bfc2 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresDirective.cs @@ -0,0 +1,48 @@ +using HotChocolate.Language; +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; +using DirectiveLocation = HotChocolate.Types.DirectiveLocation; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @requires(fields: _FieldSet!) on FIELD_DEFINITON +/// +/// +/// The @requires directive is used to specify external (provided by other subgraphs) +/// entity fields that are needed to resolve target field. It is used to develop a query plan where +/// the required fields may not be needed by the client, but the service may need additional +/// information from other subgraphs. Required fields specified in the directive field set should +/// correspond to a valid field on the underlying GraphQL interface/object and should be instrumented +/// with @external directive. +/// +/// type Foo @key(fields: "id") { +/// id: ID! +/// # this field will be resolved from other subgraph +/// remote: String @external +/// local: String @requires(fields: "remote") +/// } +/// +/// +[Package(Federation20)] +[DirectiveType(RequiresDirective_Name, DirectiveLocation.FieldDefinition)] +[GraphQLDescription(RequiresDirective_Description)] +public sealed class RequiresDirective +{ + public RequiresDirective(string fields) + { + ArgumentException.ThrowIfNullOrEmpty(fields); + Fields = FieldSetType.ParseSelectionSet(fields); + } + + public RequiresDirective(SelectionSetNode fields) + { + ArgumentNullException.ThrowIfNull(fields); + Fields = fields; + } + + [FieldSet] + public SelectionSetNode Fields { get; } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesAttribute.cs new file mode 100644 index 00000000000..0b89917a912 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesAttribute.cs @@ -0,0 +1,80 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @requiresScopes(scopes: [[Scope!]!]!) on +/// ENUM +/// | FIELD_DEFINITION +/// | INTERFACE +/// | OBJECT +/// | SCALAR +/// +/// +/// Directive that is used to indicate that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes. +/// Refer to the Apollo Router article for additional details. +/// +/// type Foo @key(fields: "id") { +/// id: ID +/// description: String @requiresScopes(scopes: [["scope1"]]) +/// } +/// +/// +[AttributeUsage( + AttributeTargets.Class + | AttributeTargets.Enum + | AttributeTargets.Interface + | AttributeTargets.Method + | AttributeTargets.Property + | AttributeTargets.Struct, + AllowMultiple = true +)] +public sealed class RequiresScopesAttribute : DescriptorAttribute +{ + /// + /// Initializes new instance of + /// + /// + /// Array of required JWT scopes. + /// + public RequiresScopesAttribute(string[] scopes) + { + Scopes = scopes; + } + + /// + /// Retrieves array of required JWT scopes. + /// + public string[] Scopes { get; } + + protected internal override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + switch (descriptor) + { + case IEnumTypeDescriptor desc: + desc.RequiresScopes(Scopes); + break; + + case IObjectTypeDescriptor desc: + desc.RequiresScopes(Scopes); + break; + + case IObjectFieldDescriptor desc: + desc.RequiresScopes(Scopes); + break; + + case IInterfaceTypeDescriptor desc: + desc.RequiresScopes(Scopes); + break; + + case IInterfaceFieldDescriptor desc: + desc.RequiresScopes(Scopes); + break; + } + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs new file mode 100644 index 00000000000..74c41624f28 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs @@ -0,0 +1,230 @@ +using System.Collections.Generic; +using System.Linq; +using HotChocolate.Types.Descriptors; +using HotChocolate.Types.Descriptors.Definitions; +using HotChocolate.Types.Helpers; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// Provides extensions for applying @requiresScopes directive on type system descriptors. +/// +public static class RequiresScopesDescriptorExtensions +{ + /// + /// Applies @requiresScopes directive to indicate that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes. + /// + /// type Foo @key(fields: "id") { + /// id: ID + /// description: String @requiresScopes(scopes: [["scope1"]]) + /// } + /// + /// + /// + /// The type descriptor on which this directive shall be annotated. + /// + /// Required JWT scopes + /// + /// Returns the type descriptor. + /// + /// + /// The is null. + /// + public static IEnumTypeDescriptor RequiresScopes( + this IEnumTypeDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes, def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + /// Applies @requiresScopes directive to indicate that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes. + /// + /// type Foo @key(fields: "id") { + /// id: ID + /// description: String @requiresScopes(scopes: [["scope1"]]) + /// } + /// + /// + /// + /// The type descriptor on which this directive shall be annotated. + /// + /// Required JWT scopes + /// + /// Returns the type descriptor. + /// + /// + /// The is null. + /// + public static IEnumTypeDescriptor RequiresScopes( + this IEnumTypeDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes.Select(s => new Scope(s)).ToArray(), def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IInterfaceFieldDescriptor RequiresScopes( + this IInterfaceFieldDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes, def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IInterfaceFieldDescriptor RequiresScopes( + this IInterfaceFieldDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes.Select(s => new Scope(s)).ToArray(), def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IInterfaceTypeDescriptor RequiresScopes( + this IInterfaceTypeDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes, def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IInterfaceTypeDescriptor RequiresScopes( + this IInterfaceTypeDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes.Select(s => new Scope(s)).ToArray(), def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IObjectFieldDescriptor RequiresScopes( + this IObjectFieldDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes, def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IObjectFieldDescriptor RequiresScopes( + this IObjectFieldDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes.Select(s => new Scope(s)).ToArray(), def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IObjectTypeDescriptor RequiresScopes( + this IObjectTypeDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes, def, ctx.TypeInspector); + }); + + return descriptor; + } + + /// + public static IObjectTypeDescriptor RequiresScopes( + this IObjectTypeDescriptor descriptor, + IReadOnlyList scopes) + { + ArgumentNullException.ThrowIfNull(descriptor); + + descriptor.Extend().OnBeforeCreate( + (ctx, def) => + { + AddScopes(scopes.Select(s => new Scope(s)).ToArray(), def, ctx.TypeInspector); + }); + + return descriptor; + } + + private static void AddScopes( + IReadOnlyList scopes, + IHasDirectiveDefinition definition, + ITypeInspector typeInspector) + { + var directive = definition + .Directives + .Select(t => t.Value) + .OfType() + .FirstOrDefault(); + + if (directive is null) + { + directive = new RequiresScopesDirective([]); + definition.AddDirective(directive, typeInspector); + } + + var newScopes = scopes.ToHashSet(); + directive.Scopes.Add(newScopes); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDirective.cs new file mode 100644 index 00000000000..d4ccb6614f5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDirective.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using HotChocolate.ApolloFederation.Properties; +using static HotChocolate.ApolloFederation.FederationTypeNames; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @@requiresScopes(scopes: [[Scope!]!]!) on +/// ENUM +/// | FIELD_DEFINITION +/// | INTERFACE +/// | OBJECT +/// | SCALAR +/// +/// +/// Directive that is used to indicate that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes. +/// Refer to the Apollo Router article for additional details. +/// +/// type Foo @key(fields: "id") { +/// id: ID +/// description: String @requiresScopes(scopes: [["scope1"]]) +/// } +/// +/// +/// +/// List of a list of required JWT scopes. +/// +[Package(FederationVersionUrls.Federation24)] +[DirectiveType( + RequiresScopesDirective_Name, + DirectiveLocation.Enum | + DirectiveLocation.FieldDefinition | + DirectiveLocation.Interface | + DirectiveLocation.Object | + DirectiveLocation.Scalar)] +[GraphQLDescription(FederationResources.RequiresScopesDirective_Description)] +public sealed class RequiresScopesDirective(List> scopes) +{ + /// + /// Retrieves list of a list of required JWT scopes. + /// + public List> Scopes { get; } = scopes; +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableAttribute.cs new file mode 100644 index 00000000000..939a9d60f2a --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableAttribute.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @shareable repeatable on FIELD_DEFINITION | OBJECT +/// +/// +/// The @shareable directive indicates that given object and/or field can be resolved by multiple subgraphs. +/// If an object is marked as @shareable then all its fields are automatically shareable without the need +/// for explicitly marking them with @shareable directive. All fields referenced from @key directive are +/// automatically shareable as well. +/// +/// +/// type Foo @key(fields: "id") { +/// id: ID! # shareable because id is a key field +/// name: String # non-shareable +/// description: String @shareable # shareable +/// } +/// +/// type Bar @shareable { +/// description: String # shareable because User is marked shareable +/// name: String # shareable because User is marked shareable +/// } +/// +/// +[AttributeUsage( + AttributeTargets.Class + | AttributeTargets.Struct + | AttributeTargets.Method + | AttributeTargets.Property)] +public sealed class ShareableAttribute : DescriptorAttribute +{ + protected internal override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + switch (descriptor) + { + case IObjectTypeDescriptor objectTypeDescriptor: + { + objectTypeDescriptor.Shareable(); + break; + } + case IObjectFieldDescriptor objectFieldDescriptor: + { + objectFieldDescriptor.Shareable(); + break; + } + } + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableDescriptorExtensions.cs new file mode 100644 index 00000000000..13cfb93a305 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableDescriptorExtensions.cs @@ -0,0 +1,107 @@ +namespace HotChocolate.ApolloFederation.Types; + +public static class ShareableDescriptorExtensions +{ + /// + /// Applies @shareable directive which indicates that given object and/or field can be resolved by multiple + /// subgraphs. + /// If an object is marked as @shareable then all its fields are automatically shareable without the need + /// for explicitly marking them with @shareable directive. All fields referenced from @key directive are + /// automatically shareable as well. + /// + /// type Foo @key(fields: "id") { + /// id: ID! # shareable because id is a key field + /// name: String # non-shareable + /// description: String @shareable # shareable + /// } + /// + /// type Bar @shareable { + /// description: String # shareable because User is marked shareable + /// name: String # shareable because User is marked shareable + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + public static IObjectTypeDescriptor Shareable(this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.Directive(ShareableDirective.Default); + } + + /// + /// Applies @shareable directive which indicates that given object and/or field can be resolved by multiple subgraphs. + /// If an object is marked as @shareable then all its fields are automatically shareable without the need + /// for explicitly marking them with @shareable directive. All fields referenced from @key directive are + /// automatically shareable as well. + /// + /// type Foo @key(fields: "id") { + /// id: ID! # shareable because id is a key field + /// name: String # non-shareable + /// description: String @shareable # shareable + /// } + /// + /// type Bar @shareable { + /// description: String # shareable because User is marked shareable + /// name: String # shareable because User is marked shareable + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + public static IObjectTypeDescriptor Shareable(this IObjectTypeDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.Directive(ShareableDirective.Default); + } + + /// + /// Applies @shareable directive which indicates that given object and/or field can be resolved by multiple subgraphs. + /// If an object is marked as @shareable then all its fields are automatically shareable without the need + /// for explicitly marking them with @shareable directive. All fields referenced from @key directive are + /// automatically shareable as well. + /// + /// type Foo @key(fields: "id") { + /// id: ID! # shareable because id is a key field + /// name: String # non-shareable + /// description: String @shareable # shareable + /// } + /// + /// type Bar @shareable { + /// description: String # shareable because User is marked shareable + /// name: String # shareable because User is marked shareable + /// } + /// + /// + /// + /// The object field descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object field descriptor. + /// + /// + /// is null. + /// + public static IObjectFieldDescriptor Shareable(this IObjectFieldDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.Directive(ShareableDirective.Default); + } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableDirective.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableDirective.cs new file mode 100644 index 00000000000..099b6b6295c --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/ShareableDirective.cs @@ -0,0 +1,39 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.FederationVersionUrls; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// +/// directive @shareable repeatable on FIELD_DEFINITION | OBJECT +/// +/// +/// The @shareable directive indicates that given object and/or field can be resolved by multiple subgraphs. +/// If an object is marked as @shareable then all its fields are automatically shareable without the need +/// for explicitly marking them with @shareable directive. All fields referenced from @key directive are +/// automatically shareable as well. +/// +/// type Foo @key(fields: "id") { +/// id: ID! # shareable because id is a key field +/// name: String # non-shareable +/// description: String @shareable # shareable +/// } +/// +/// type Bar @shareable { +/// description: String # shareable because User is marked shareable +/// name: String # shareable because User is marked shareable +/// } +/// +/// +[Package(Federation20)] +[DirectiveType( + ShareableDirective_Name, + DirectiveLocation.FieldDefinition | + DirectiveLocation.Object, + IsRepeatable = true)] +[GraphQLDescription(ShareableDirective_Description)] +public sealed class ShareableDirective +{ + public static ShareableDirective Default { get; } = new(); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/FieldSetAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/FieldSetAttribute.cs new file mode 100644 index 00000000000..9dc61909067 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/FieldSetAttribute.cs @@ -0,0 +1,13 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.ApolloFederation.Types; + +internal sealed class FieldSetAttribute : DirectiveArgumentDescriptorAttribute +{ + protected override void OnConfigure( + IDescriptorContext context, + IDirectiveArgumentDescriptor descriptor, + PropertyInfo property) + => descriptor.Type>(); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FieldSetType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/FieldSetType.cs similarity index 91% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/FieldSetType.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/FieldSetType.cs index b437c896633..13dc6a7153c 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FieldSetType.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/FieldSetType.cs @@ -1,9 +1,8 @@ -using HotChocolate.ApolloFederation.Constants; using HotChocolate.ApolloFederation.Properties; using HotChocolate.Language; using static HotChocolate.ApolloFederation.ThrowHelper; -namespace HotChocolate.ApolloFederation; +namespace HotChocolate.ApolloFederation.Types; /// /// A scalar called _FieldSet is a custom scalar type that is used to @@ -14,12 +13,13 @@ namespace HotChocolate.ApolloFederation; /// This means it can represent a single field "upc", multiple fields "id countryCode", /// and even nested selection sets "id organization { id }". /// +[Package(FederationVersionUrls.Federation20)] public sealed class FieldSetType : ScalarType { /// /// Initializes a new instance of . /// - public FieldSetType() : this(WellKnownTypeNames.FieldSet) + public FieldSetType() : this(FederationTypeNames.FieldSetType_Name) { } @@ -53,7 +53,7 @@ protected override SelectionSetNode ParseLiteral(StringValueNode valueSyntax) /// protected override StringValueNode ParseValue(SelectionSetNode runtimeValue) - => new StringValueNode(SerializeSelectionSet(runtimeValue)); + => new(SerializeSelectionSet(runtimeValue)); /// public override IValueNode ParseResult(object? resultValue) @@ -128,12 +128,12 @@ public override bool TryDeserialize(object? resultValue, out object? runtimeValu return false; } - private static SelectionSetNode ParseSelectionSet(string s) + internal static SelectionSetNode ParseSelectionSet(string s) => Utf8GraphQLParser.Syntax.ParseSelectionSet($"{{{s}}}"); private static string SerializeSelectionSet(SelectionSetNode selectionSet) { var s = selectionSet.ToString(false); - return s.Substring(1, s.Length - 2).Trim(); + return s.AsSpan()[1 .. ^1].Trim().ToString(); } } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Scope.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Scope.cs new file mode 100644 index 00000000000..fa07cdde81c --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Scope.cs @@ -0,0 +1,23 @@ +namespace HotChocolate.ApolloFederation.Types; + +/// +/// Scalar Scope representation. +/// +public readonly record struct Scope +{ + /// + /// Initializes a new instance of . + /// + /// + /// Scope value + /// + public Scope(string value) + { + Value = value; + } + + /// + /// Retrieve scope value + /// + public string Value { get; } +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ScopeType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ScopeType.cs new file mode 100644 index 00000000000..637c9ab0f98 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ScopeType.cs @@ -0,0 +1,41 @@ +using HotChocolate.ApolloFederation.Properties; +using HotChocolate.Language; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// The Scope scalar representing a JWT scope. Serializes as a string. +/// +public sealed class ScopeType : ScalarType +{ + /// + /// Initializes a new instance of . + /// + public ScopeType() : this(FederationTypeNames.ScopeType_Name) + { + } + + /// + /// Initializes a new instance of . + /// + /// + /// Scalar name + /// + /// + /// Defines if this scalar shall bind implicitly to . + /// + public ScopeType(string name, BindingBehavior bind = BindingBehavior.Explicit) + : base(name, bind) + { + Description = FederationResources.ScopeType_Description; + } + + protected override Scope ParseLiteral(StringValueNode valueSyntax) + => new(valueSyntax.Value); + + public override IValueNode ParseResult(object? resultValue) + => ParseValue(resultValue); + + protected override StringValueNode ParseValue(Scope runtimeValue) + => new(runtimeValue.Value); +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs new file mode 100644 index 00000000000..acb2f95b86c --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs @@ -0,0 +1,45 @@ +#nullable enable + +using System.Collections.Generic; +using HotChocolate.ApolloFederation.Resolvers; +using HotChocolate.Resolvers; +using HotChocolate.Types.Descriptors; +using HotChocolate.Types.Descriptors.Definitions; + +namespace HotChocolate.ApolloFederation.Types; + +public static class ServerFields +{ + private static readonly _Service _service = new(); + + internal static ObjectFieldDefinition CreateServiceField(IDescriptorContext context) + { + var descriptor = ObjectFieldDescriptor.New(context, WellKnownFieldNames.Service); + descriptor.Type>>().Resolve(_service); + descriptor.Definition.PureResolver = Resolve; + + static _Service Resolve(IPureResolverContext ctx) + => _service; + + return descriptor.CreateDefinition(); + } + + internal static ObjectFieldDefinition CreateEntitiesField(IDescriptorContext context) + { + var descriptor = ObjectFieldDescriptor.New(context, WellKnownFieldNames.Entities); + + descriptor + .Type>>() + .Argument( + WellKnownArgumentNames.Representations, + d => d.Type>>>()) + .Resolve( + c => EntitiesResolver.ResolveAsync( + c.Schema, + c.ArgumentValue>( + WellKnownArgumentNames.Representations), + c)); + + return descriptor.CreateDefinition(); + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/AnyType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_AnyType.cs similarity index 86% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/AnyType.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_AnyType.cs index 127236a62bf..c971db3dd35 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/AnyType.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_AnyType.cs @@ -1,30 +1,31 @@ using System.Linq; -using HotChocolate.ApolloFederation.Constants; using HotChocolate.ApolloFederation.Properties; using HotChocolate.Language; using HotChocolate.Utilities; +using static HotChocolate.ApolloFederation.FederationTypeNames; using static HotChocolate.ApolloFederation.ThrowHelper; -namespace HotChocolate.ApolloFederation; +namespace HotChocolate.ApolloFederation.Types; /// /// The _Any scalar is used to pass representations of entities /// from external services into the root _entities field for execution. /// -public sealed class AnyType : ScalarType +// ReSharper disable once InconsistentNaming +public sealed class _AnyType : ScalarType { public const string TypeNameField = "__typename"; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public AnyType() - : this(WellKnownTypeNames.Any) + public _AnyType() + : this(AnyType_Name) { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// /// The name the scalar shall have. @@ -32,7 +33,7 @@ public AnyType() /// /// Defines if this scalar shall bind implicitly to . /// - public AnyType(string name, BindingBehavior bind = BindingBehavior.Explicit) + public _AnyType(string name, BindingBehavior bind = BindingBehavior.Explicit) : base(name, bind) { Description = FederationResources.Any_Description; diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_EntityType.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_EntityType.cs new file mode 100644 index 00000000000..cb5b16967ec --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_EntityType.cs @@ -0,0 +1,19 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// A union called _Entity which is a union of all types that use the @key directive, +/// including both types native to the schema and extended types. +/// +// ReSharper disable once InconsistentNaming +public sealed class _EntityType : UnionType +{ + protected override void Configure(IUnionTypeDescriptor descriptor) + { + descriptor + .Name(EntityType_Name) + .Description(EntityType_Description); + } +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_Service.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_Service.cs new file mode 100644 index 00000000000..9a4d2e6e9a0 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/_Service.cs @@ -0,0 +1,22 @@ +using static HotChocolate.ApolloFederation.FederationTypeNames; +using static HotChocolate.ApolloFederation.Properties.FederationResources; + +namespace HotChocolate.ApolloFederation.Types; + +/// +/// A new object type called _Service must be created. +/// This type must have an sdl: String! field which exposes the SDL of the service's schema. +/// +/// This SDL (schema definition language) is a printed version of the service's +/// schema including the annotations of federation directives. This SDL does not +/// include the additions of the federation spec. +/// +[ObjectType(ServiceType_Name)] +[GraphQLDescription(ServiceType_Description)] +// ReSharper disable once InconsistentNaming +public sealed class _Service +{ + [GraphQLName(WellKnownFieldNames.Sdl)] + public string GetSdl(ISchema schema) + => SchemaPrinter.Print(schema); +} diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/WellKnownArgumentNames.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/WellKnownArgumentNames.cs new file mode 100644 index 00000000000..a5b16c05e67 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/WellKnownArgumentNames.cs @@ -0,0 +1,13 @@ +namespace HotChocolate.ApolloFederation; + +internal static class WellKnownArgumentNames +{ + public const string Fields = "fields"; + public const string From = "from"; + public const string Name = "name"; + public const string Resolvable = "resolvable"; + public const string Representations = "representations"; + public const string Scopes = "scopes"; + public const string Url = "url"; + public const string Policies = "policies"; +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownFieldNames.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/WellKnownFieldNames.cs similarity index 77% rename from src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownFieldNames.cs rename to src/HotChocolate/ApolloFederation/src/ApolloFederation/WellKnownFieldNames.cs index cad442c664c..39ec1ebdfd1 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Constants/WellKnownFieldNames.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/WellKnownFieldNames.cs @@ -1,4 +1,4 @@ -namespace HotChocolate.ApolloFederation.Constants; +namespace HotChocolate.ApolloFederation; internal static class WellKnownFieldNames { diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/packages.lock.json b/src/HotChocolate/ApolloFederation/src/ApolloFederation/packages.lock.json index 99dd6af021e..29eb4b6d081 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/packages.lock.json +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/packages.lock.json @@ -1,273 +1,6 @@ { "version": 1, "dependencies": { - "net6.0": { - "Microsoft.SourceLink.GitHub": { - "type": "Direct", - "requested": "[1.1.1, )", - "resolved": "1.1.1", - "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", - "dependencies": { - "Microsoft.Build.Tasks.Git": "1.1.1", - "Microsoft.SourceLink.Common": "1.1.1" - } - }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" - }, - "Microsoft.Build.Tasks.Git": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==" - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" - }, - "Microsoft.Extensions.ObjectPool": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "7hR9FU0JJHOCLmn/Ary31pLLAhlzoMptBKs5CJmNUzD87dXjl+/NqVkyCTl6cT2JAfTK0G39HpvCOv1fhsX3BQ==" - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "Microsoft.SourceLink.Common": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==" - }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.ComponentModel.Annotations": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" - }, - "System.Diagnostics.DiagnosticSource": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" - }, - "System.Text.Encodings.Web": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "6.0.7", - "contentHash": "/Tf/9XjprpHolbcDOrxsKVYy/mUG/FS7aGd9YUgBVEiHeQH4kAE0T1sMbde7q6B5xcrNUsJ5iW7D1RvHudQNqA==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0" - } - }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==" - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "csAJe24tWCOTO/rXoJAuBGuOq7ZdHY60XtC6b/hNMHT9tuX+2J9HK7nciLEtNvnrRLMxBACLXO3R4y5+kCduMA==" - }, - "greendonut": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.ObjectPool": "[6.0.0, )", - "System.Diagnostics.DiagnosticSource": "[6.0.0, )", - "System.Threading.Tasks.Extensions": "[4.5.0, )" - } - }, - "HotChocolate": { - "type": "Project", - "dependencies": { - "HotChocolate.Authorization": "[0.0.0, )", - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Fetching": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Types.CursorPagination": "[0.0.0, )", - "HotChocolate.Types.Mutations": "[0.0.0, )", - "HotChocolate.Types.OffsetPagination": "[0.0.0, )", - "HotChocolate.Validation": "[0.0.0, )" - } - }, - "hotchocolate.abstractions": { - "type": "Project", - "dependencies": { - "HotChocolate.Language": "[0.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[6.0.0, )", - "System.Collections.Immutable": "[6.0.0, )" - } - }, - "hotchocolate.authorization": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )" - } - }, - "hotchocolate.execution": { - "type": "Project", - "dependencies": { - "HotChocolate.Abstractions": "[0.0.0, )", - "HotChocolate.Execution.Abstractions": "[0.0.0, )", - "HotChocolate.Fetching": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", - "HotChocolate.Validation": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection": "[6.0.0, )", - "System.Threading.Channels": "[6.0.0, )" - } - }, - "hotchocolate.execution.abstractions": { - "type": "Project", - "dependencies": { - "HotChocolate.Abstractions": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )" - } - }, - "hotchocolate.fetching": { - "type": "Project", - "dependencies": { - "GreenDonut": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.language": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )", - "HotChocolate.Language.Utf8": "[0.0.0, )", - "HotChocolate.Language.Visitors": "[0.0.0, )", - "HotChocolate.Language.Web": "[0.0.0, )" - } - }, - "hotchocolate.language.syntaxtree": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.ObjectPool": "[6.0.0, )" - } - }, - "hotchocolate.language.utf8": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )" - } - }, - "hotchocolate.language.visitors": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )" - } - }, - "hotchocolate.language.web": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.Utf8": "[0.0.0, )" - } - }, - "hotchocolate.types": { - "type": "Project", - "dependencies": { - "HotChocolate.Abstractions": "[0.0.0, )", - "HotChocolate.Types.Shared": "[0.0.0, )", - "HotChocolate.Utilities": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.ObjectPool": "[6.0.0, )", - "System.ComponentModel.Annotations": "[5.0.0, )", - "System.Text.Json": "[6.0.7, )" - } - }, - "hotchocolate.types.cursorpagination": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.types.mutations": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.types.offsetpagination": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.types.shared": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )" - } - }, - "hotchocolate.utilities": { - "type": "Project" - }, - "hotchocolate.utilities.dependencyinjection": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "[6.0.0, )" - } - }, - "hotchocolate.validation": { - "type": "Project", - "dependencies": { - "HotChocolate.Types": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Options": "[6.0.0, )" - } - } - }, "net7.0": { "Microsoft.SourceLink.GitHub": { "type": "Direct", diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/AnyTypeTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/AnyTypeTests.txt similarity index 87% rename from src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/AnyTypeTests.cs rename to src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/AnyTypeTests.txt index 3f0248c569c..5d2b0601ec2 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/AnyTypeTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/AnyTypeTests.txt @@ -1,7 +1,7 @@ using HotChocolate.ApolloFederation.Constants; using HotChocolate.Language; using HotChocolate.Types; -using Xunit; +using AnyType = HotChocolate.ApolloFederation.Types.AnyType; namespace HotChocolate.ApolloFederation; @@ -33,43 +33,41 @@ public void Deserialize() var representationObject = type.Deserialize(serialized); // assert - Assert.IsType(representationObject); - if (representationObject is Representation representation) - { - Assert.Equal("test", representation.TypeName); - Assert.Collection(representation.Data.Fields, - node => - { - Assert.Equal( - AnyType.TypeNameField, - node.Name.Value); - - Assert.Equal( - "test", - node.Value.Value); - }, - node => - { - Assert.Equal( - "faa", - node.Name.Value); - - Assert.Equal( - "foo", - node.Value.Value); - }, - node => - { - Assert.Equal( - "foo", - node.Name.Value); - - Assert.Equal( - "bar", - node.Value.Value); - } - ); - } + var representation = Assert.IsType(representationObject); + + Assert.Equal("test", representation.TypeName); + Assert.Collection(representation.Data.Fields, + node => + { + Assert.Equal( + AnyType.TypeNameField, + node.Name.Value); + + Assert.Equal( + "test", + node.Value.Value); + }, + node => + { + Assert.Equal( + "faa", + node.Name.Value); + + Assert.Equal( + "foo", + node.Value.Value); + }, + node => + { + Assert.Equal( + "foo", + node.Name.Value); + + Assert.Equal( + "bar", + node.Value.Value); + } + ); } [Fact] diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs index 210f81a7841..a4e785174f3 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs @@ -4,7 +4,6 @@ using HotChocolate.Execution.Processing; using HotChocolate.Language; using Snapshooter.Xunit; -using Xunit; namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased; diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs index 4bba84cad81..e1b33e9acc5 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs @@ -4,9 +4,9 @@ namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased.Type public class Data { - public List Products { get; } = new() - { + public List Products { get; } = + [ new("apollo-federation", "federation", "@apollo/federation", "OSS"), - new("apollo-studio", "studio", string.Empty, "platform"), - }; + new("apollo-studio", "studio", string.Empty, "platform") + ]; } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs index 8c7dbfbcbc8..66e1f754a8e 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs @@ -1,4 +1,6 @@ using System.Linq; +using HotChocolate.ApolloFederation.Resolvers; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types.Relay; namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased.Types; @@ -6,29 +8,21 @@ namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased.Type [Key("id")] [Key("sku package")] [Key("sku variation { id }")] -public class Product +public class Product(string id, string sku, string package, string variation) { - public Product(string id, string sku, string package, string variation) - { - Id = id; - Sku = sku; - Package = package; - Variation = new(variation); - } - [ID] - public string Id { get; } + public string Id { get; } = id; - public string? Sku { get; } + public string? Sku { get; } = sku; - public string? Package { get; } + public string? Package { get; } = package; - public ProductVariation? Variation { get; } + public ProductVariation? Variation { get; } = new(variation); public ProductDimension? Dimensions { get; } = new("1", 1); [Provides("totalProductsCreated")] - public User? CreatedBy { get; } = new("support@apollographql.com", 1337); + public User? CreatedBy { get; } = new("contact@chillicream.com", 1337); [ReferenceResolver] public static Product? GetProductById( diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs index a1018fb718a..8b37a3fed80 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs @@ -1,14 +1,8 @@ namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased.Types; -public class ProductDimension +public class ProductDimension(string size, double weight) { - public ProductDimension(string size, double weight) - { - Size = size; - Weight = weight; - } + public string? Size { get; } = size; - public string? Size { get; } - - public double? Weight { get; } + public double? Weight { get; } = weight; } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs index f18c954753b..c8a84a73b8f 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs @@ -1,4 +1,5 @@ using System.Linq; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types.Relay; namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased.Types; diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/User.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/User.cs index c1f282684f4..f2e2ebbfabe 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/User.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/Types/User.cs @@ -1,3 +1,4 @@ +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types.Relay; namespace HotChocolate.ApolloFederation.CertificationSchema.AnnotationBased.Types; diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Provides.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Provides.snap index c3dffea86c6..9e20d556c67 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Provides.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Provides.snap @@ -2,7 +2,7 @@ "data": { "product": { "createdBy": { - "email": "support@apollographql.com", + "email": "contact@chillicream.com", "totalProductsCreated": 1337 } } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap index 14c42f4b2c0..17df87c164e 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@key", "@provides", "FieldSet", "@external" ]) { query: Query } @@ -43,13 +43,16 @@ union _Entity = Product | User 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 +directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +"Object representation of @link directive." +directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA "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 @provides(fields: FieldSet!) on FIELD_DEFINITION + +"Scalar representing a set of fields." +scalar FieldSet "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 - -"Scalar representing a set of fields." -scalar _FieldSet diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap index 0a6311806fc..17df87c164e 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap @@ -1,4 +1,8 @@ -type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@key", "@provides", "FieldSet", "@external" ]) { + query: Query +} + +type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { id: ID! sku: String package: String @@ -16,11 +20,39 @@ type ProductVariation { id: ID! } -extend type Query { +type Query { product(id: ID!): Product + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! } -extend type User @key(fields: "email") { +type User @key(fields: "email") { email: ID! @external totalProductsCreated: Int @external } + +"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." +type _Service { + sdl: String! +} + +"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." +union _Entity = Product | User + +"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! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +"Object representation of @link directive." +directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA + +"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 + +"Scalar representing a set of fields." +scalar FieldSet + +"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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs index 5d17999f79f..261e70ff7c9 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs @@ -4,7 +4,6 @@ using HotChocolate.Execution.Processing; using HotChocolate.Language; using Snapshooter.Xunit; -using Xunit; namespace HotChocolate.ApolloFederation.CertificationSchema.CodeFirst; @@ -25,19 +24,19 @@ public async Task Subgraph_SDL() // act var result = await executor.ExecuteAsync( - @"{ + """ + { _service { sdl } - }"); + } + """); // assert - Assert.IsType( - Assert.IsType( - Assert.IsType(result).Data) - .GetValueOrDefault("_service")) - .GetValueOrDefault("sdl") - .MatchSnapshot(); + var queryResult = Assert.IsType(result); + var data = Assert.IsType(queryResult.Data); + var service = Assert.IsType(data.GetValueOrDefault("_service")); + service.GetValueOrDefault("sdl").MatchSnapshot(); } [Fact] @@ -48,13 +47,15 @@ public async Task Product_By_Id() // act var result = await executor.ExecuteAsync( - @"query ($representations: [_Any!]!) { + """ + query ($representations: [_Any!]!) { _entities(representations: $representations) { ... on Product { sku } } - }", + } + """, new Dictionary { ["representations"] = new List @@ -77,13 +78,15 @@ public async Task Product_By_Package() // act var result = await executor.ExecuteAsync( - @"query ($representations: [_Any!]!) { + """ + query ($representations: [_Any!]!) { _entities(representations: $representations) { ... on Product { sku } } - }", + } + """, new Dictionary { ["representations"] = new List @@ -107,13 +110,15 @@ public async Task Product_By_Variation() // act var result = await executor.ExecuteAsync( - @"query ($representations: [_Any!]!) { + """ + query ($representations: [_Any!]!) { _entities(representations: $representations) { ... on Product { sku } } - }", + } + """, new Dictionary { ["representations"] = new List @@ -139,11 +144,13 @@ public async Task Provides() // act var result = await executor.ExecuteAsync( - @"query ($id: ID!) { + """ + query ($id: ID!) { product(id: $id) { createdBy { email totalProductsCreated } } - }", + } + """, new Dictionary { ["id"] = "apollo-federation", @@ -161,11 +168,13 @@ public async Task Requires() // act var result = await executor.ExecuteAsync( - @"query ($id: ID!) { + """ + query ($id: ID!) { product(id: $id) { dimensions { size weight } } - }", + } + """, new Dictionary { ["id"] = "apollo-federation", diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs index ae4a992d896..a24d080ac51 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs @@ -1,4 +1,6 @@ using System.Linq; +using HotChocolate.ApolloFederation.Resolvers; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; namespace HotChocolate.ApolloFederation.CertificationSchema.CodeFirst.Types; @@ -23,9 +25,9 @@ protected override void Configure(IObjectTypeDescriptor descriptor) .Key("sku variation { id }") .ResolveReferenceWith(t => GetProductByVariation(default!, default!, default!)); - descriptor - .Field(t => t.CreatedBy) - .Provides("totalProductsCreated") + ProvidesDescriptorExtensions.Provides( + descriptor + .Field(t => t.CreatedBy), "totalProductsCreated") .Type>(); } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs index 54a6b05f908..f601da8a6b5 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs @@ -1,4 +1,5 @@ using System.Linq; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; namespace HotChocolate.ApolloFederation.CertificationSchema.CodeFirst.Types; diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/User.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/User.cs index 1ad79c9f611..e15fb009f53 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/User.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/User.cs @@ -1,5 +1,3 @@ -using HotChocolate.Types.Relay; - namespace HotChocolate.ApolloFederation.CertificationSchema.CodeFirst.Types; public class User diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs index 7b78308f699..844ea58c245 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs @@ -1,3 +1,4 @@ +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; namespace HotChocolate.ApolloFederation.CertificationSchema.CodeFirst.Types; diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap index d645304fedc..f8412cdddab 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@key", "@provides", "@external", "FieldSet" ]) { query: Query } @@ -43,13 +43,16 @@ union _Entity = Product | User 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 +directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +"Object representation of @link directive." +directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA "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 @provides(fields: FieldSet!) on FIELD_DEFINITION + +"Scalar representing a set of fields." +scalar FieldSet "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 - -"Scalar representing a set of fields." -scalar _FieldSet diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap index bf23f5f8774..f8412cdddab 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap @@ -1,4 +1,8 @@ -type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@key", "@provides", "@external", "FieldSet" ]) { + query: Query +} + +type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { id: ID! createdBy: User! @provides(fields: "totalProductsCreated") sku: String @@ -16,11 +20,39 @@ type ProductVariation { id: ID! } -extend type Query { +type Query { product(id: ID!): Product + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! } -extend type User @key(fields: "email") { +type User @key(fields: "email") { email: ID! @external totalProductsCreated: Int @external } + +"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." +type _Service { + sdl: String! +} + +"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." +union _Entity = Product | User + +"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! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +"Object representation of @link directive." +directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA + +"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 + +"Scalar representing a set of fields." +scalar FieldSet + +"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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ComposeDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ComposeDirectiveTests.cs new file mode 100644 index 00000000000..d3c9bb6d070 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ComposeDirectiveTests.cs @@ -0,0 +1,50 @@ +using System.Threading.Tasks; +using CookieCrumble; +using HotChocolate.ApolloFederation.Types; +using HotChocolate.Execution; +using HotChocolate.Language; +using HotChocolate.Types; +using Microsoft.Extensions.DependencyInjection; +using DirectiveLocation = HotChocolate.Types.DirectiveLocation; + +namespace HotChocolate.ApolloFederation; + +public class ComposeDirectiveTests +{ + [Fact] + public async Task TestServiceTypeEmptyQueryTypePureCodeFirst() + { + // arrange + var schema = await new ServiceCollection() + .AddGraphQL() + .AddApolloFederation() + .AddQueryType() + .AddType
() + .ExportDirective() + .BuildSchemaAsync(); + + var entityType = schema.GetType(FederationTypeNames.ServiceType_Name); + var sdlResolver = entityType.Fields[WellKnownFieldNames.Sdl].Resolver!; + + // act + var value = await sdlResolver(TestHelper.CreateResolverContext(schema)); + + Utf8GraphQLParser + .Parse((string)value!) + .MatchSnapshot(); + } + + [Key("field")] + public class Address + { + [CustomDirective] + public string Field => "abc"; + } + + [Package("https://specs.custom.dev/custom/v1.0")] + [DirectiveType(DirectiveLocation.FieldDefinition)] + public sealed class Custom; + + public sealed class CustomDirectiveAttribute() + : DirectiveAttribute(new Custom()); +} diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ExternalDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ExternalDirectiveTests.txt similarity index 93% rename from src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ExternalDirectiveTests.cs rename to src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ExternalDirectiveTests.txt index 86348b7123a..32811c90923 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ExternalDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ExternalDirectiveTests.txt @@ -1,5 +1,6 @@ using System.Linq; using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; @@ -63,13 +64,12 @@ public void AnnotateExternalToTypeFieldSchemaFirst() var schema = SchemaBuilder.New() .AddDocumentFromString( - @" - type Query { - field(a: Int): String - @external - } - " - ) + """ + type Query { + field(a: Int): String + @external + } + """) .AddDirectiveType() .Use(_ => _ => default) .Create(); diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.txt similarity index 96% rename from src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs rename to src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.txt index 88f685d70b9..910022afd8a 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/KeyDirectiveTests.txt @@ -1,5 +1,6 @@ using System.Linq; using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; @@ -26,8 +27,8 @@ public void AddKeyDirective_EnsureAvailableInSchema() Assert.NotNull(directive); Assert.IsType(directive); Assert.Equal(WellKnownTypeNames.Key, directive!.Name); - Assert.Single(directive.Arguments); - AssertDirectiveHasFieldsArgument(directive); + Assert.Equal(2, directive.Arguments.Count); + AssertDirectiveHasFieldsArgument(directive.Arguments.Take(1)); Assert.True(directive.Locations.HasFlag(DirectiveLocation.Object)); Assert.True(directive.Locations.HasFlag(DirectiveLocation.Interface)); } @@ -194,6 +195,7 @@ public void AnnotateKeyToClassAttributesPureCodeFirst() public class Query { + // ReSharper disable once InconsistentNaming public T someField(int id) => default!; } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/PolicyDirectiveTests.txt b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/PolicyDirectiveTests.txt new file mode 100644 index 00000000000..c476ec7df01 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/PolicyDirectiveTests.txt @@ -0,0 +1,170 @@ +using System.Linq; +using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; +using HotChocolate.Types; +using Snapshooter.Xunit; + +namespace HotChocolate.ApolloFederation.Directives; + +public class PolicyDirectiveTests : FederationTypesTestBase +{ + [Fact] + public void PolicyDirectives_GetParsedCorrectly_SchemaFirst() + { + // arrange + Snapshot.FullName(); + + var schema = SchemaBuilder.New() + .AddDocumentFromString( + """ + type Review @policy(policies: "p3") { + id: Int! + } + + type Query { + someField(a: Int): Review @policy(policies: [["p1", "p1_1"], ["p2"]]) + } + """) + .AddDirectiveType() + .Use(_ => _ => default) + .Create(); + + CheckReviewType(schema); + CheckQueryType(schema); + + schema.ToString().MatchSnapshot(); + } + + [Fact] + public void PolicyDirectives_GetAddedCorrectly_Annotations() + { + // arrange + Snapshot.FullName(); + + var schema = SchemaBuilder.New() + .AddApolloFederation() + .AddQueryType() + .Create(); + + CheckReviewType(schema); + CheckQueryType(schema); + + schema.ToString().MatchSnapshot(); + } + + [Fact] + public void PolicyDirectives_GetAddedCorrectly_CodeFirst() + { + // arrange + Snapshot.FullName(); + + var reviewType = new ObjectType(d => + { + d.Name(nameof(Review)); + d.Key("id"); + { + var id = d.Field("id"); + id.Type>(); + id.Resolve(_ => default); + } + }); + var queryType = new ObjectType(d => + { + d.Name(nameof(Query)); + d.Field("someField") + .Type(new NonNullType(reviewType)) + .Policy([["p1", "p1_1"], ["p2"]]) + .Resolve(_ => default); + }); + + var schema = SchemaBuilder.New() + .AddApolloFederation() + .AddType(reviewType) + .AddQueryType(queryType) + .Create(); + + CheckReviewType(schema); + CheckQueryType(schema); + + schema.ToString().MatchSnapshot(); + } + + private static string[][] GetSinglePoliciesArgument(IDirectiveCollection directives) + { + foreach (var directive in directives) + { + if (directive.Type.Name != WellKnownTypeNames.PolicyDirective) + { + continue; + } + + var argument = directive.AsSyntaxNode().Arguments.Single(); + return PolicyParsingHelper.ParseNode(argument.Value); + } + + Assert.True(false, "No policy directive found."); + return null!; + } + + private static void CheckQueryType(ISchema schema) + { + var testType = schema.GetType(nameof(Query)); + var directives = testType + .Fields + .Single(f => f.Name == "someField") + .Directives; + var policyCollection = GetSinglePoliciesArgument(directives); + Assert.Collection(policyCollection, + t1 => + { + Assert.Equal("p1", t1[0]); + Assert.Equal("p1_1", t1[1]); + }, + t2 => + { + Assert.Equal("p2", t2[0]); + }); + } + + private static void CheckReviewType(ISchema schema) + { + var testType = schema.GetType(nameof(Review)); + var directives = testType.Directives; + var policyCollection = GetSinglePoliciesArgument(directives); + Assert.Collection(policyCollection, + t1 => + { + Assert.Equal("p3", t1[0]); + }); + } + + [Fact] + public void PolicyDirective_GetsAddedCorrectly_Annotations() + { + // arrange + Snapshot.FullName(); + + var schema = SchemaBuilder.New() + .AddApolloFederation() + .AddQueryType() + .Create(); + + // act + CheckQueryType(schema); + + schema.ToString().MatchSnapshot(); + } + + public class Query + { + [Policy("p1,p1_1", "p2")] + public Review SomeField(int id) => default!; + } + + [Key("id")] + [Policy("p3")] + public class Review + { + public int Id { get; set; } + } +} diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.txt similarity index 96% rename from src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs rename to src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.txt index 5e38f963f45..68706ad24b5 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/ProvidesDirectiveTests.txt @@ -1,5 +1,6 @@ using System.Linq; using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; @@ -24,7 +25,7 @@ public void AddProvidesDirective_EnsureAvailableInSchema() Assert.IsType(directive); Assert.Equal(WellKnownTypeNames.Provides, directive!.Name); Assert.Single(directive.Arguments); - AssertDirectiveHasFieldsArgument(directive); + AssertDirectiveHasFieldsArgument(directive.Arguments); Assert.Equal(DirectiveLocation.FieldDefinition, directive.Locations); } @@ -89,7 +90,7 @@ public void AnnotateProvidesToFieldCodeFirst() { o.Name("Review").Key("id"); o.Field("id").Type(); - o.Field("product").Provides("name").Type("Product"); + ProvidesDescriptorExtensions.Provides(o.Field("product"), "name").Type("Product"); })) .AddQueryType( new ObjectType(o => diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.txt similarity index 98% rename from src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs rename to src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.txt index 33614a89332..41753873fc8 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/RequiresDirectiveTests.txt @@ -1,5 +1,6 @@ using System.Linq; using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; @@ -24,7 +25,7 @@ public void AddRequiresDirective_EnsureAvailableInSchema() Assert.IsType(directive); Assert.Equal(WellKnownTypeNames.Requires, directive!.Name); Assert.Single(directive.Arguments); - AssertDirectiveHasFieldsArgument(directive); + AssertDirectiveHasFieldsArgument(directive.Arguments); Assert.Equal(DirectiveLocation.FieldDefinition, directive.Locations); } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ComposeDirectiveTests.TestServiceTypeEmptyQueryTypePureCodeFirst.graphql b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ComposeDirectiveTests.TestServiceTypeEmptyQueryTypePureCodeFirst.graphql new file mode 100644 index 00000000000..aaac69bb9ad --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ComposeDirectiveTests.TestServiceTypeEmptyQueryTypePureCodeFirst.graphql @@ -0,0 +1,37 @@ +schema @composeDirective(name: "custom") @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@composeDirective", "@key", "FieldSet" ]) @link(url: "https:\/\/specs.custom.dev\/custom\/v1.0", import: [ "@custom" ]) { + query: Query +} + +type Address @key(fields: "field") { + field: String! @custom +} + +type Query { + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! +} + +"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." +type _Service { + sdl: String! +} + +"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." +union _Entity = Address + +"Marks underlying custom directive to be included in the Supergraph schema." +directive @composeDirective(name: String!) repeatable on SCHEMA + +directive @custom 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! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +"Object representation of @link directive." +directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA + +"Scalar representing a set of fields." +scalar FieldSet + +"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 \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap index b0cc7d832bd..9d7f99068a8 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { query: Query } @@ -21,11 +21,31 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = User +"Indicates to composition that the target element is accessible only to the authenticated supergraph users." +directive @authenticated on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Marks underlying custom directive to be included in the Supergraph schema." +directive @composeDirective(name: String!) on SCHEMA + +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION +"Marks location within schema as inaccessible from the GraphQL Gateway" +directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Provides meta information to the router that this entity type is an interface in the supergraph." +directive @interfaceObject on OBJECT + "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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap index b46237c9d8c..5651bda1fd7 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { query: QueryOfTestTypePropertyDirective } @@ -21,7 +21,12 @@ type _Service { union _Entity = TestTypePropertyDirective "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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap index 7a186e234c3..0a3328af805 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { query: QueryOfTestTypePropertyDirectives } @@ -22,7 +22,12 @@ type _Service { union _Entity = TestTypePropertyDirectives "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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeCodeFirst.snap index 27bbff10a27..9263b11e475 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeCodeFirst.snap @@ -12,7 +12,7 @@ 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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE "Scalar representing a set of fields." scalar _FieldSet diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap index a4e0c8f88fb..a9cb5e239eb 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { query: QueryOfTestTypeClassDirective } @@ -21,7 +21,12 @@ type _Service { union _Entity = TestTypeClassDirective "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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeSchemaFirst.snap index f21731e2c65..ffc85e34d4d 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypeSchemaFirst.snap @@ -16,7 +16,7 @@ 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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE "Scalar representing a set of fields." scalar _FieldSet diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirective_GetsAddedCorrectly_Annotations.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirective_GetsAddedCorrectly_Annotations.snap new file mode 100644 index 00000000000..a6badde20c5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirective_GetsAddedCorrectly_Annotations.snap @@ -0,0 +1,76 @@ +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.6", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy", "@policy" ]) { + query: Query +} + +type Query { + someField(id: Int!): Review! @policy(policies: [ [ "p1", "p1_1" ], [ "p2" ] ]) + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! +} + +type Review @key(fields: "id") @policy(policies: [ [ "p3" ] ]) { + id: Int! +} + +"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." +type _Service { + sdl: String! +} + +"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." +union _Entity = Review + +"Indicates to composition that the target element is accessible only to the authenticated supergraph users." +directive @authenticated on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Marks underlying custom directive to be included in the Supergraph schema." +directive @composeDirective(name: String!) on SCHEMA + +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + +"Directive to indicate that a field is owned by another service, for example via Apollo federation." +directive @external on FIELD_DEFINITION + +"Marks location within schema as inaccessible from the GraphQL Gateway" +directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Provides meta information to the router that this entity type is an interface in the supergraph." +directive @interfaceObject on OBJECT + +"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface." +directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on FIELD_DEFINITION + +"Indicates to composition that the target element is restricted based on authorization policies that are evaluated in a Rhai script or coprocessor." +directive @policy(policies: policyCollection!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"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 + +"Indicates to composition that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes." +directive @requiresScopes(scopes: [[Scope!]!]!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Indicates that given object and\/or field can be resolved by multiple subgraphs." +directive @shareable repeatable on OBJECT | FIELD_DEFINITION + +"Allows users to annotate fields and types with additional metadata information." +directive @tag(name: String!) on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Scalar representing a set of fields." +scalar FieldSet + +"Scalar representing a JWT scope" +scalar Scope + +"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 + +scalar policyCollection diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetAddedCorrectly_Annotations.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetAddedCorrectly_Annotations.snap new file mode 100644 index 00000000000..a6badde20c5 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetAddedCorrectly_Annotations.snap @@ -0,0 +1,76 @@ +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.6", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy", "@policy" ]) { + query: Query +} + +type Query { + someField(id: Int!): Review! @policy(policies: [ [ "p1", "p1_1" ], [ "p2" ] ]) + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! +} + +type Review @key(fields: "id") @policy(policies: [ [ "p3" ] ]) { + id: Int! +} + +"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." +type _Service { + sdl: String! +} + +"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." +union _Entity = Review + +"Indicates to composition that the target element is accessible only to the authenticated supergraph users." +directive @authenticated on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Marks underlying custom directive to be included in the Supergraph schema." +directive @composeDirective(name: String!) on SCHEMA + +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + +"Directive to indicate that a field is owned by another service, for example via Apollo federation." +directive @external on FIELD_DEFINITION + +"Marks location within schema as inaccessible from the GraphQL Gateway" +directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Provides meta information to the router that this entity type is an interface in the supergraph." +directive @interfaceObject on OBJECT + +"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface." +directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on FIELD_DEFINITION + +"Indicates to composition that the target element is restricted based on authorization policies that are evaluated in a Rhai script or coprocessor." +directive @policy(policies: policyCollection!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"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 + +"Indicates to composition that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes." +directive @requiresScopes(scopes: [[Scope!]!]!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Indicates that given object and\/or field can be resolved by multiple subgraphs." +directive @shareable repeatable on OBJECT | FIELD_DEFINITION + +"Allows users to annotate fields and types with additional metadata information." +directive @tag(name: String!) on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Scalar representing a set of fields." +scalar FieldSet + +"Scalar representing a JWT scope" +scalar Scope + +"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 + +scalar policyCollection diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetAddedCorrectly_CodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetAddedCorrectly_CodeFirst.snap new file mode 100644 index 00000000000..fcf6b479077 --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetAddedCorrectly_CodeFirst.snap @@ -0,0 +1,76 @@ +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.6", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy", "@policy" ]) { + query: Query +} + +type Query { + someField: Review! @policy(policies: [ [ "p1", "p1_1" ], [ "p2" ] ]) + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! +} + +type Review @key(fields: "id") @key(fields: "id") @policy(policies: [ [ "p3" ] ]) { + id: Int! +} + +"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." +type _Service { + sdl: String! +} + +"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." +union _Entity = Review + +"Indicates to composition that the target element is accessible only to the authenticated supergraph users." +directive @authenticated on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Marks underlying custom directive to be included in the Supergraph schema." +directive @composeDirective(name: String!) on SCHEMA + +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + +"Directive to indicate that a field is owned by another service, for example via Apollo federation." +directive @external on FIELD_DEFINITION + +"Marks location within schema as inaccessible from the GraphQL Gateway" +directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Provides meta information to the router that this entity type is an interface in the supergraph." +directive @interfaceObject on OBJECT + +"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface." +directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on FIELD_DEFINITION + +"Indicates to composition that the target element is restricted based on authorization policies that are evaluated in a Rhai script or coprocessor." +directive @policy(policies: policyCollection!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"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 + +"Indicates to composition that the target element is accessible only to the authenticated supergraph users with the appropriate JWT scopes." +directive @requiresScopes(scopes: [[Scope!]!]!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +"Indicates that given object and\/or field can be resolved by multiple subgraphs." +directive @shareable repeatable on OBJECT | FIELD_DEFINITION + +"Allows users to annotate fields and types with additional metadata information." +directive @tag(name: String!) on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +"Scalar representing a set of fields." +scalar FieldSet + +"Scalar representing a JWT scope" +scalar Scope + +"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 + +scalar policyCollection diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetParsedCorrectly_SchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetParsedCorrectly_SchemaFirst.snap new file mode 100644 index 00000000000..6e06413779f --- /dev/null +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/PolicyDirectiveTests.PolicyDirectives_GetParsedCorrectly_SchemaFirst.snap @@ -0,0 +1,18 @@ +schema { + query: Query +} + +type Query { + someField(a: Int): Review @policy(policies: [ [ "p1", "p1_1" ], [ "p2" ] ]) +} + +type Review @policy(policies: "p3") { + id: Int! +} + +"Indicates to composition that the target element is restricted based on authorization policies that are evaluated in a Rhai script or coprocessor." +directive @policy(policies: policyCollection!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM + +directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION + +scalar policyCollection diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap index 773a0d8fb62..5e5100945b1 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { query: Query } @@ -26,7 +26,12 @@ type _Service { union _Entity = Review "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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on FIELD_DEFINITION "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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap index 4d70d0f5530..be6c26570ec 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap @@ -16,7 +16,7 @@ type Review @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 @key(fields: _FieldSet! resolvable: Boolean = true) 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap index 3bf8791f661..c2f1b02f591 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap @@ -16,7 +16,7 @@ type Review @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 @key(fields: _FieldSet! resolvable: Boolean = true) 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap index e3d45c77604..9a76dd08493 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap @@ -1,4 +1,4 @@ -schema { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { query: Query } @@ -26,7 +26,12 @@ type _Service { union _Entity = Review "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 @key(fields: _FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + +directive @link(url: String! import: [String!]) repeatable on SCHEMA + +"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." +directive @override(from: String!) on FIELD_DEFINITION "Used to annotate the required input fieldset from a base type for a resolver." directive @requires(fields: _FieldSet!) on FIELD_DEFINITION diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap index f7b25e9fc4d..30265246dab 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldCodeFirst.snap @@ -16,7 +16,7 @@ type Review @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 @key(fields: _FieldSet! resolvable: Boolean = true) 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap index 3801171d118..7220e19a1ac 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToFieldSchemaFirst.snap @@ -16,7 +16,7 @@ type Review @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 @key(fields: _FieldSet! resolvable: Boolean = true) 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 diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverTests.txt similarity index 90% rename from src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverTests.cs rename to src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverTests.txt index 586de6eb967..f59fa4e6080 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverTests.txt @@ -3,9 +3,9 @@ using System.Threading; using System.Threading.Tasks; using GreenDonut; -using HotChocolate.ApolloFederation.Helpers; +using HotChocolate.ApolloFederation.Resolvers; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Language; -using Xunit; using static HotChocolate.ApolloFederation.TestHelper; namespace HotChocolate.ApolloFederation; @@ -13,7 +13,7 @@ namespace HotChocolate.ApolloFederation; public class EntitiesResolverTests { [Fact] - public async void TestResolveViaForeignServiceType() + public async Task TestResolveViaForeignServiceType() { // arrange var schema = SchemaBuilder.New() @@ -24,17 +24,17 @@ public async void TestResolveViaForeignServiceType() var context = CreateResolverContext(schema); // act - var representations = new List - { - new("ForeignType", - new ObjectValueNode( - new ObjectFieldNode("id", "1"), - new ObjectFieldNode("someExternalField", "someExternalField"))), - }; - - // assert + var representations = RepresentationsOf( + nameof(ForeignType), + new + { + id = "1", + someExternalField = "someExternalField", + }); var result = await EntitiesResolver.ResolveAsync(schema, representations, context); + + // assert var obj = Assert.IsType(result[0]); Assert.Equal("1", obj.Id); Assert.Equal("someExternalField", obj.SomeExternalField); @@ -113,12 +113,11 @@ public async void TestResolveViaEntityResolver_WithDataLoader() mock.Setup(c => c.Service()).Returns(dataLoader); }); - var representations = new List - { - new("FederatedType", new ObjectValueNode(new ObjectFieldNode("Id", "1"))), - new("FederatedType", new ObjectValueNode(new ObjectFieldNode("Id", "2"))), - new("FederatedType", new ObjectValueNode(new ObjectFieldNode("Id", "3"))), - }; + var representations = RepresentationsOf( + nameof(FederatedType), + new { Id = "1" }, + new { Id = "2" }, + new { Id = "3" }); // act var resultTask = EntitiesResolver.ResolveAsync(schema, representations, context); @@ -219,7 +218,10 @@ public async Task TestDetailFieldResolver_Optional() new ObjectValueNode(new[] { new ObjectFieldNode("detail", - new ObjectValueNode(new[] { new ObjectFieldNode("id", "testId") })), + new ObjectValueNode(new[] + { + new ObjectFieldNode("id", "testId"), + })), })), }; @@ -359,7 +361,15 @@ public class FederatedTypeWithRequiredDetail public FederatedTypeDetail Detail { get; set; } = default!; [ReferenceResolver] - public static FederatedTypeWithRequiredDetail ReferenceResolver([Map("detail.id")] string detailId) => new() { Id = detailId, Detail = new FederatedTypeDetail { Id = detailId } }; + public static FederatedTypeWithRequiredDetail ReferenceResolver([Map("detail.id")] string detailId) + => new() + { + Id = detailId, + Detail = new FederatedTypeDetail + { + Id = detailId, + }, + }; } public class FederatedTypeWithOptionalDetail @@ -369,8 +379,15 @@ public class FederatedTypeWithOptionalDetail public FederatedTypeDetail? Detail { get; set; } = default!; [ReferenceResolver] - public static FederatedTypeWithOptionalDetail ReferenceResolver([Map("detail.id")] string detailId) => new() { Id = detailId, Detail = new FederatedTypeDetail { Id = detailId } }; - + public static FederatedTypeWithOptionalDetail ReferenceResolver([Map("detail.id")] string detailId) + => new() + { + Id = detailId, + Detail = new FederatedTypeDetail + { + Id = detailId, + }, + }; } public class FederatedTypeDetail diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntityTypeTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntityTypeTests.cs index 9e198cd1b67..728001e4d04 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntityTypeTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntityTypeTests.cs @@ -1,4 +1,7 @@ -using Xunit; +using System.Threading.Tasks; +using HotChocolate.ApolloFederation.Types; +using HotChocolate.Execution; +using Microsoft.Extensions.DependencyInjection; using static HotChocolate.ApolloFederation.Properties.FederationResources; namespace HotChocolate.ApolloFederation; @@ -6,143 +9,51 @@ namespace HotChocolate.ApolloFederation; public class EntityTypeTests { [Fact] - public void TestEntityTypeSchemaFirstSingleKey() + public async Task TestEntityTypeCodeFirstNoEntities_ShouldThrow() { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString( - @" - type Query { - user(a: Int!): User - } - - type Review @key(fields: ""id"") { - id: Int! - author: User - } - - type User @key(fields: ""id"") { - id: Int! - idCode: String! - reviews: [Review!]! - } - " - ) - .Use(_ => _ => default) - .Create(); - - // act - var entityType = schema.GetType("_Entity"); - - // assert - Assert.Collection(entityType.Types.Values, - t => Assert.Equal("Review", t.Name), - t => Assert.Equal("User", t.Name)); - } - - [Fact] - public void TestEntityTypeSchemaFirstMultiKey() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString( - @" - type Query { - user(a: Int!): User - } - - type User @key(fields: ""id idCode"") { - id: Int! - idCode: String! - } - " - ) - .Use(_ => _ => default) - .Create(); - - // act - var entityType = schema.GetType("_Entity"); - - // assert - Assert.Collection(entityType.Types.Values, t => Assert.Equal("User", t.Name)); - } - - [Fact] - public void TestEntityTypeSchemaFirstNestedKey() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString( - @" - type Query { - user(a: Int!): User - } - - type User @key(fields: ""id address { matchCode }"") { - id: Int! - address: Address - } - - type Address { - matchCode: String! - } - ") - .Use(_ => _ => default) - .Create(); - - // act - var entityType = schema.GetType("_Entity"); - - // assert - Assert.Collection(entityType.Types.Values, t => Assert.Equal("User", t.Name)); - } - - [Fact] - public void TestEntityTypeCodeFirstNoEntities_ShouldThrow() - { - void CreateSchema() + async Task CreateSchema() { // arrange - SchemaBuilder.New() + await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType>() - .Create(); + .BuildSchemaAsync(); } - var exception = Assert.Throws(CreateSchema); + var exception = await Assert.ThrowsAsync(CreateSchema); Assert.Contains(ThrowHelper_EntityType_NoEntities, exception.Message); } [Fact] - public void TestEntityTypeCodeFirstClassKeyAttributeSingleKey() + public async Task TestEntityTypeCodeFirstClassKeyAttributeSingleKey() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType>() - .Create(); + .BuildSchemaAsync(); // act - var entityType = schema.GetType("_Entity"); + var entityType = schema.GetType<_EntityType>("_Entity"); // assert Assert.Collection(entityType.Types.Values, t => Assert.Equal("Review", t.Name)); } [Fact] - public void TestEntityTypeCodeFirstClassKeyAttributeMultiKey() + public async Task TestEntityTypeCodeFirstClassKeyAttributeMultiKey() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType>() - .Create(); + .BuildSchemaAsync(); // act - var entityType = schema.GetType("_Entity"); + var entityType = schema.GetType<_EntityType>("_Entity"); // assert Assert.Collection( @@ -152,16 +63,17 @@ public void TestEntityTypeCodeFirstClassKeyAttributeMultiKey() } [Fact] - public void TestEntityTypeCodeFirstPropertyKeyAttributes() + public async Task TestEntityTypeCodeFirstPropertyKeyAttributes() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType>() - .Create(); + .BuildSchemaAsync(); // act - var entityType = schema.GetType("_Entity"); + var entityType = schema.GetType<_EntityType>("_Entity"); // assert Assert.Collection( @@ -170,58 +82,59 @@ public void TestEntityTypeCodeFirstPropertyKeyAttributes() } [Fact] - public void TestEntityTypeCodeFirstClassKeyAttributeNestedKey() + public async Task TestEntityTypeCodeFirstClassKeyAttributeNestedKey() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType>() - .Create(); + .BuildSchemaAsync(); // act - var entityType = schema.GetType("_Entity"); + var entityType = schema.GetType<_EntityType>("_Entity"); // assert Assert.Collection(entityType.Types.Values, t => Assert.Equal("UserWithNestedKeyClassAttribute", t.Name)); } -} - -public class Query -{ - public T GetEntity(int id) => default!; -} + + public sealed class Query + { + public T GetEntity(int id) => default!; + } -[Key("id idCode")] -public class UserWithClassAttribute -{ - public int Id { get; set; } - public string IdCode { get; set; } = default!; - public Review[] Reviews { get; set; } = default!; -} + [Key("id idCode")] + public sealed class UserWithClassAttribute + { + public int Id { get; set; } + public string IdCode { get; set; } = default!; + public Review[] Reviews { get; set; } = default!; + } -public class UserWithPropertyAttributes -{ - [Key] - public int Id { get; set; } - [Key] - public string IdCode { get; set; } = default!; -} + public sealed class UserWithPropertyAttributes + { + [Key] + public int Id { get; set; } + [Key] + public string IdCode { get; set; } = default!; + } -[Key("id address { matchCode }")] -public class UserWithNestedKeyClassAttribute -{ - public int Id { get; set; } - public Address Address { get; set; } = default!; -} + [Key("id address { matchCode }")] + public sealed class UserWithNestedKeyClassAttribute + { + public int Id { get; set; } + public Address Address { get; set; } = default!; + } -public class Address -{ - public string MatchCode { get; set; } = default!; -} + public sealed class Address + { + public string MatchCode { get; set; } = default!; + } -[Key("id")] -public class Review -{ - public int Id { get; set; } + [Key("id")] + public sealed class Review + { + public int Id { get; set; } + } } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationSchemaPrinterTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationSchemaPrinterTests.cs deleted file mode 100644 index 6db0f1a47e2..00000000000 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationSchemaPrinterTests.cs +++ /dev/null @@ -1,323 +0,0 @@ -using System; -using System.Reflection; -using HotChocolate.Types; -using HotChocolate.Types.Descriptors; -using Snapshooter.Xunit; -using Xunit; - -namespace HotChocolate.ApolloFederation; - -public class FederationSchemaPrinterTests -{ - [Fact] - public void TestFederationPrinter_ShouldThrow() - { - // arrange - ISchema? schema = null; - void Action() => FederationSchemaPrinter.Print(schema!); - - // act - // assert - Assert.Throws(Action); - } - - [Fact] - public void TestFederationPrinterApolloDirectivesSchemaFirst() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString( - @"type TestType @key(fields: ""id"") { - id: Int! - name: String! - } - - type Query { - someField(a: Int): TestType - }") - .Use(_ => _ => default) - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - [Fact] - public void TestFederationPrinterSchemaFirst() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString(@" - type TestType @key(fields: ""id"") { - id: Int! - name: String! - enum: SomeEnum - } - - type TestTypeTwo { - id: Int! - } - - interface iTestType @key(fields: ""id"") { - id: Int! - external: String! @external - } - - union TestTypes = TestType | TestTypeTwo - - enum SomeEnum { - FOO - BAR - } - - input SomeInput { - name: String! - description: String - someEnum: SomeEnum - } - - type Mutation { - doSomething(input: SomeInput): Boolean - } - - type Query implements iQuery { - someField(a: Int): TestType - } - - interface iQuery { - someField(a: Int): TestType - } - ") - .Use(_ => _ => default) - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - [Fact] - public void TestFederationPrinterSchemaFirst_With_DateTime() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString(@" - type TestType @key(fields: ""id"") { - id: Int! - name: String! - enum: SomeEnum - } - - type TestTypeTwo { - id: Int! - } - - interface iTestType @key(fields: ""id"") { - id: Int! - external: String! @external - } - - union TestTypes = TestType | TestTypeTwo - - enum SomeEnum { - FOO - BAR - } - - input SomeInput { - name: String! - description: String - someEnum: SomeEnum - time: DateTime - } - - type Mutation { - doSomething(input: SomeInput): Boolean - } - - type Query implements iQuery { - someField(a: Int): TestType - } - - interface iQuery { - someField(a: Int): TestType - } - - scalar DateTime - ") - .Use(_ => _ => default) - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - [Fact] - public void TestFederationPrinterApolloDirectivesPureCodeFirst() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddQueryType>() - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - [Fact] - public void TestFederationPrinterTypeExtensionPureCodeFirst() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddQueryType>() - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - [Fact] - public void CustomDirective_IsPublic() - { - // arrange - var schema = SchemaBuilder.New() - .AddQueryType() - .AddDirectiveType(new CustomDirectiveType(true)) - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - [Fact] - public void CustomDirective_IsInternal() - { - // arrange - var schema = SchemaBuilder.New() - .AddQueryType() - .AddDirectiveType(new CustomDirectiveType(false)) - .Create(); - - // act - // assert - FederationSchemaPrinter.Print(schema).MatchSnapshot(); - } - - public class QueryRoot - { - public T GetEntity(int id) => default!; - } - - public class User - { - [Key] - public int Id { get; set; } - [External] - public string IdCode { get; set; } = default!; - [Requires("idCode")] - public string IdCodeShort { get; set; } = default!; - [Provides("zipcode")] - public Address Address { get; set; } = default!; - } - - public class Address - { - [External] - public string Zipcode { get; set; } = default!; - } - - [ExtendServiceType] - public class Product - { - [Key] - public string Upc { get; set; } = default!; - } - - public class QueryWithDirective : ObjectType - { - protected override void Configure(IObjectTypeDescriptor descriptor) - { - descriptor - .Name("Query") - .Field("foo") - .Resolve("bar") - .Directive("custom"); - - descriptor - .Field("deprecated1") - .Resolve("abc") - .Deprecated("deprecated") - .Type>(); - - descriptor - .Field("deprecated2") - .Resolve("abc") - .Deprecated("deprecated") - .Directive("custom") - .Type>(); - } - } - - public class CustomDirectiveType : DirectiveType - { - private readonly bool _isPublic; - - public CustomDirectiveType(bool isPublic) - { - _isPublic = isPublic; - } - - protected override void Configure(IDirectiveTypeDescriptor descriptor) - { - descriptor - .Name("custom") - .Location(DirectiveLocation.FieldDefinition) - .Location(DirectiveLocation.EnumValue); - - if (_isPublic) - { - descriptor.Public(); - } - else - { - descriptor.Internal(); - } - } - } - - public enum EnumWithDeprecatedValue - { - [Obsolete] - Deprecated1, - - [CustomDirective] - [Obsolete] - Deprecated2, - - Active, - } - - public class CustomDirectiveAttribute : DescriptorAttribute - { - protected override void TryConfigure( - IDescriptorContext context, - IDescriptor descriptor, - ICustomAttributeProvider element) - { - if (descriptor is EnumValueDescriptor enumValue) - { - enumValue.Directive("custom"); - } - } - } -} diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs index 83091f8501f..b8ad67b2c82 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs @@ -1,10 +1,11 @@ using System; +using System.Collections.Generic; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Types; -using Xunit; namespace HotChocolate.ApolloFederation; -public class FederationTypesTestBase +public abstract class FederationTypesTestBase { protected ISchema CreateSchema(Action configure) { @@ -23,10 +24,10 @@ protected ISchema CreateSchema(Action configure) return builder.Create(); } - protected void AssertDirectiveHasFieldsArgument(DirectiveType directive) + protected void AssertDirectiveHasFieldsArgument(IEnumerable directiveArguments) { Assert.Collection( - directive.Arguments, + directiveArguments, t => { Assert.Equal("fields", t.Name); diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FieldSetTypeTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FieldSetTypeTests.cs index e980004e98e..9e4130a489a 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FieldSetTypeTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FieldSetTypeTests.cs @@ -1,7 +1,7 @@ -using HotChocolate.ApolloFederation.Constants; +using HotChocolate.ApolloFederation.Types; using HotChocolate.Language; using HotChocolate.Types; -using Xunit; +using static HotChocolate.ApolloFederation.FederationTypeNames; using static HotChocolate.Language.Utf8GraphQLParser; namespace HotChocolate.ApolloFederation; @@ -16,7 +16,7 @@ public void Ensure_Type_Name_Is_Correct() var type = new FieldSetType(); // assert - Assert.Equal(WellKnownTypeNames.FieldSet, type.Name); + Assert.Equal(FieldSetType_Name, type.Name); } [Fact] @@ -111,13 +111,14 @@ public void Serialize() { // arrange var type = new FieldSetType(); - var selectionSet = Syntax.ParseSelectionSet("{ a b c d e(d: $b) }"); + const string selection = "a b c d e(d: $b)"; + var selectionSet = Syntax.ParseSelectionSet(Braces(selection)); // act var serialized = type.Serialize(selectionSet); // assert - Assert.Equal("a b c d e(d: $b)", serialized); + Assert.Equal(selection, serialized); } [Fact] @@ -138,14 +139,15 @@ public void TrySerialize() { // arrange var type = new FieldSetType(); - var selectionSet = Syntax.ParseSelectionSet("{ a b c d e(d: $b) }"); + const string selection = "a b c d e(d: $b)"; + var selectionSet = Syntax.ParseSelectionSet(Braces(selection)); // act var success = type.TrySerialize(selectionSet, out var serialized); // assert Assert.True(success); - Assert.Equal("a b c d e(d: $b)", serialized); + Assert.Equal(selection, serialized); } [Fact] @@ -162,19 +164,22 @@ public void TrySerialize_Invalid_Format() Assert.Null(serialized); } + private static string Braces(string s) => $"{{ {s} }}"; + [Fact] public void ParseValue() { // arrange var type = new FieldSetType(); - var selectionSet = Syntax.ParseSelectionSet("{ a b c d e(d: $b) }"); + const string selection = "a b c d e(d: $b)"; + var selectionSet = Syntax.ParseSelectionSet(Braces(selection)); // act var valueSyntax = type.ParseValue(selectionSet); // assert Assert.Equal( - "a b c d e(d: $b)", + selection, Assert.IsType(valueSyntax).Value); } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/HotChocolate.ApolloFederation.Tests.csproj b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/HotChocolate.ApolloFederation.Tests.csproj index 3ea8e790156..3f5951db112 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/HotChocolate.ApolloFederation.Tests.csproj +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/HotChocolate.ApolloFederation.Tests.csproj @@ -6,8 +6,13 @@ + + + + + diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ReferenceResolverAttributeTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ReferenceResolverAttributeTests.cs index 154f6932f4c..bc099cc2552 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ReferenceResolverAttributeTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ReferenceResolverAttributeTests.cs @@ -1,10 +1,13 @@ using System; using System.Threading.Tasks; +using HotChocolate.ApolloFederation.Resolvers; +using HotChocolate.ApolloFederation.Types; +using HotChocolate.Execution; using HotChocolate.Language; using HotChocolate.Resolvers; using HotChocolate.Types; -using Xunit; -using static HotChocolate.ApolloFederation.Constants.WellKnownContextData; +using Microsoft.Extensions.DependencyInjection; +using static HotChocolate.ApolloFederation.FederationContextData; using static HotChocolate.ApolloFederation.TestHelper; namespace HotChocolate.ApolloFederation; @@ -15,10 +18,11 @@ public class ReferenceResolverAttributeTests public async void InClassRefResolver_PureCodeFirst() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); // act var type = schema.GetType(nameof(InClassRefResolver)); @@ -34,10 +38,11 @@ public async void InClassRefResolver_PureCodeFirst() public async void ExternalRefResolver_PureCodeFirst() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); // act var type = schema.GetType(nameof(ExternalRefResolver)); @@ -54,11 +59,12 @@ public async void ExternalRefResolver_PureCodeFirst() public async void SingleKey_CompiledResolver() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); - + .BuildSchemaAsync(); + // act var type = schema.GetType(nameof(ExternalSingleKeyResolver)); @@ -72,10 +78,11 @@ public async void SingleKey_CompiledResolver() public async void ExternalFields_Set() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); // act var type = schema.GetType(nameof(ExternalFields)); @@ -93,10 +100,11 @@ public async void ExternalFields_Set() public async void ExternalFields_Not_Set() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); // act var type = schema.GetType(nameof(ExternalFields)); @@ -112,10 +120,11 @@ public async void ExternalFields_Not_Set() public async void MultiKey_CompiledResolver() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); var type = schema.GetType(nameof(ExternalMultiKeyResolver)); @@ -132,11 +141,12 @@ public async void MultiKey_CompiledResolver() public async void ExternalRefResolver_RenamedMethod_PureCodeFirst() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); - + .BuildSchemaAsync(); + // act var type = schema.GetType(nameof(ExternalRefResolverRenamedMethod)); @@ -151,34 +161,36 @@ public async void ExternalRefResolver_RenamedMethod_PureCodeFirst() public void InClassRefResolver_RenamedMethod_InvalidName_PureCodeFirst() { // arrange - void SchemaCreation() + async Task SchemaCreation() { - SchemaBuilder.New() + await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); } // act // assert - Assert.Throws((Action)SchemaCreation); + Assert.ThrowsAsync(SchemaCreation); } [Fact] public void ExternalRefResolver_RenamedMethod_InvalidName_PureCodeFirst() { // arrange - void SchemaCreation() + async Task SchemaCreation() { - SchemaBuilder.New() + await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() .AddQueryType() - .Create(); + .BuildSchemaAsync(); } // act // assert - Assert.Throws((Action)SchemaCreation); + Assert.ThrowsAsync(SchemaCreation); } private ValueTask ResolveRef(ISchema schema, ObjectType type) @@ -210,18 +222,18 @@ void SchemaCreation() return entity; } - public class Query_InClass_Invalid + public sealed class Query_InClass_Invalid { public InvalidInClassRefResolver InvalidInClassRefResolver { get; set; } = default!; } - public class Query_ExternalClass_Invalid + public sealed class Query_ExternalClass_Invalid { public ExternalRefResolver_Invalid ExternalRefResolver_Invalid { get; set; } = default!; } [ReferenceResolver(EntityResolver = "non-existing-method")] - public class InvalidInClassRefResolver + public sealed class InvalidInClassRefResolver { [Key] public string? Id { get; set; } @@ -230,19 +242,19 @@ public class InvalidInClassRefResolver [ReferenceResolver( EntityResolverType = typeof(InvalidExternalRefResolver), EntityResolver = "non-existing-method")] - public class ExternalRefResolver_Invalid + public sealed class ExternalRefResolver_Invalid { [Key] public string? Id { get; set; } } - public class InvalidExternalRefResolver + public sealed class InvalidExternalRefResolver { [Key] public string? Id { get; set; } } - public class Query + public sealed class Query { public InClassRefResolver InClassRefResolver { get; set; } = default!; public ExternalRefResolver ExternalRefResolver { get; set; } = default!; @@ -250,23 +262,23 @@ public class Query default!; } - public class QueryWithSingleKeyResolver + public sealed class QueryWithSingleKeyResolver { public ExternalSingleKeyResolver ExternalRefResolver { get; set; } = default!; } - public class QueryWithMultiKeyResolver + public sealed class QueryWithMultiKeyResolver { public ExternalMultiKeyResolver ExternalRefResolver { get; set; } = default!; } - public class QueryWithExternalField + public sealed class QueryWithExternalField { public ExternalFields ExternalRefResolver { get; set; } = default!; } [ReferenceResolver(EntityResolver = nameof(GetAsync))] - public class InClassRefResolver + public sealed class InClassRefResolver { [Key] public string? Id { get; set; } @@ -274,7 +286,7 @@ public class InClassRefResolver public Task GetAsync([LocalState] ObjectValueNode data) { return Task.FromResult( - new InClassRefResolver() + new InClassRefResolver { Id = nameof(InClassRefResolver), }); @@ -282,14 +294,14 @@ public Task GetAsync([LocalState] ObjectValueNode data) } [ReferenceResolver(EntityResolverType = typeof(ExternalReferenceResolver))] - public class ExternalRefResolver + public sealed class ExternalRefResolver { [Key] public string Id { get; set; } = default!; } [ReferenceResolver(EntityResolver = nameof(GetAsync))] - public class ExternalSingleKeyResolver + public sealed class ExternalSingleKeyResolver { [Key] public string Id { get; set; } = default!; @@ -299,7 +311,7 @@ public static Task GetAsync(string id) } [ReferenceResolver(EntityResolver = nameof(GetAsync))] - public class ExternalFields + public sealed class ExternalFields { [Key] public string Id { get; set; } = default!; @@ -313,8 +325,7 @@ public static Task GetAsync(string id) [Key("id")] [Key("sku")] - - public class ExternalMultiKeyResolver + public sealed class ExternalMultiKeyResolver { public string Id { get; set; } = default!; @@ -332,7 +343,7 @@ public static Task GetBySkuAsync(string sku) [ReferenceResolver( EntityResolverType = typeof(ExternalReferenceResolverRenamedMethod), EntityResolver = nameof(ExternalReferenceResolverRenamedMethod.SomeRenamedMethod))] - public class ExternalRefResolverRenamedMethod + public sealed class ExternalRefResolverRenamedMethod { [Key] public string Id { get; set; } = default!; @@ -344,7 +355,7 @@ public static Task SomeRenamedMethod( [LocalState] ObjectValueNode data) { return Task.FromResult( - new ExternalRefResolver() + new ExternalRefResolver { Id = nameof(ExternalRefResolverRenamedMethod), }); @@ -357,7 +368,7 @@ public static Task GetExternalReferenceResolverAsync( [LocalState] ObjectValueNode data) { return Task.FromResult( - new ExternalRefResolver() + new ExternalRefResolver { Id = nameof(ExternalRefResolver), }); diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ServiceTypeTests.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ServiceTypeTests.cs index 52e4fd93ed4..ea1c9474234 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ServiceTypeTests.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ServiceTypeTests.cs @@ -1,7 +1,11 @@ using System.Threading.Tasks; -using HotChocolate.ApolloFederation.Constants; -using Snapshooter.Xunit; -using Xunit; +using CookieCrumble; +using HotChocolate.ApolloFederation.Types; +using HotChocolate.Execution; +using HotChocolate.Language; +using HotChocolate.Types; +using Microsoft.Extensions.DependencyInjection; +using static HotChocolate.ApolloFederation.FederationTypeNames; using static HotChocolate.ApolloFederation.TestHelper; namespace HotChocolate.ApolloFederation; @@ -9,98 +13,117 @@ namespace HotChocolate.ApolloFederation; public class ServiceTypeTests { [Fact] - public async Task TestServiceTypeEmptyQueryTypeSchemaFirst() + public async Task TestServiceTypeEmptyQueryTypePureCodeFirst() { // arrange - var schema = SchemaBuilder.New() + var schema = await new ServiceCollection() + .AddGraphQL() .AddApolloFederation() - .AddDocumentFromString( - @"type Query { - - } + .AddQueryType() + .AddType
() + .BuildSchemaAsync(); - type Address @key(fields: ""matchCode"") { - matchCode: String! - }") - .Use(_ => _ => default) - .Create(); + var entityType = schema.GetType(ServiceType_Name); + var sdlResolver = entityType.Fields[WellKnownFieldNames.Sdl].Resolver!; // act - var entityType = schema.GetType(WellKnownTypeNames.Service); + var value = await sdlResolver(CreateResolverContext(schema)); // assert - var value = await entityType.Fields[WellKnownFieldNames.Sdl].Resolver!( - CreateResolverContext(schema)); - value.MatchSnapshot(); - } + Utf8GraphQLParser + .Parse((string)value!) + .MatchInlineSnapshot( + """ + schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@key", "FieldSet" ]) { + query: Query + } - [Fact] - public async Task TestServiceTypeTypeSchemaFirst() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddDocumentFromString(@" - type Query { - address: Address! - } - - type Address @key(fields: ""matchCode"") { - matchCode: String! - } - ") - .Use(_ => _ => default) - .Create(); + type Address @key(fields: "matchCode") { + matchCode: String + } - // act - var entityType = schema.GetType(WellKnownTypeNames.Service); + type Query { + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! + } - // assert - var value = await entityType.Fields[WellKnownFieldNames.Sdl].Resolver!( - CreateResolverContext(schema)); - value.MatchSnapshot(); - } + "This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." + type _Service { + sdl: String! + } + "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." + union _Entity = Address - [Fact] - public async Task TestServiceTypeEmptyQueryTypePureCodeFirst() - { - // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() - .AddType
() - .AddQueryType() - .Create(); + "Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface." + directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE - // act - var entityType = schema.GetType(WellKnownTypeNames.Service); + "Object representation of @link directive." + directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA - // assert - var value = await entityType.Fields[WellKnownFieldNames.Sdl].Resolver!( - CreateResolverContext(schema)); - value.MatchSnapshot(); + "Scalar representing a set of fields." + scalar FieldSet + + "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 + """); } [Fact] public async Task TestServiceTypeTypePureCodeFirst() { // arrange - var schema = SchemaBuilder.New() - .AddApolloFederation() + var schema = await new ServiceCollection() + .AddGraphQL() + .AddApolloFederation(FederationVersion.Federation22) .AddQueryType() - .Create(); + .BuildSchemaAsync(); + + var entityType = schema.GetType(ServiceType_Name); + var sdlResolver = entityType.Fields[WellKnownFieldNames.Sdl].Resolver!; // act - var entityType = schema.GetType(WellKnownTypeNames.Service); + var value = await sdlResolver(CreateResolverContext(schema)); // assert - var value = await entityType.Fields[WellKnownFieldNames.Sdl].Resolver!( - CreateResolverContext(schema)); - value.MatchSnapshot(); - } - - public class EmptyQuery - { + Utf8GraphQLParser + .Parse((string)value!) + .MatchInlineSnapshot( + """ + schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.2", import: [ "@key", "FieldSet" ]) { + query: Query + } + + type Address @key(fields: "matchCode") { + matchCode: String + } + + type Query { + address(id: Int!): Address! + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! + } + + "This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." + type _Service { + sdl: String! + } + + "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." + union _Entity = Address + + "Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface." + directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE + + "Object representation of @link directive." + directive @link("Gets imported specification url." url: String! "Gets optional list of imported element names." import: [String!]) repeatable on SCHEMA + + "Scalar representing a set of fields." + scalar FieldSet + + "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 + """); } public class Query @@ -110,7 +133,6 @@ public class Query public class Address { - [Key] - public string? MatchCode { get; set; } + [Key] public string? MatchCode { get; set; } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/TestHelper.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/TestHelper.cs index 03fc64c7415..33216fb9152 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/TestHelper.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/TestHelper.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Linq; using System.Threading; +using HotChocolate.ApolloFederation.Types; +using HotChocolate.Language; using HotChocolate.Resolvers; using HotChocolate.Types; using Moq; @@ -22,8 +25,10 @@ public static IResolverContext CreateResolverContext( mock.SetupGet(c => c.ContextData).Returns(contextData); mock.SetupProperty(c => c.ScopedContextData); mock.SetupProperty(c => c.LocalContextData); + mock.Setup(c => c.Parent<_Service>()).Returns(new _Service()); mock.Setup(c => c.Clone()).Returns(mock.Object); mock.SetupGet(c => c.Schema).Returns(schema); + if (type is not null) { @@ -40,4 +45,36 @@ public static IResolverContext CreateResolverContext( context.LocalContextData = ImmutableDictionary.Empty; return context; } + + public static Representation RepresentationOf(string typeName, T anonymousObject) + where T : class + { + var fields = anonymousObject + .GetType() + .GetProperties() + .Select(p => + { + var value = p.GetValue(anonymousObject); + var result = value switch + { + null => new ObjectFieldNode(p.Name, NullValueNode.Default), + string s => new ObjectFieldNode(p.Name, s), + int i => new ObjectFieldNode(p.Name, i), + bool b => new ObjectFieldNode(p.Name, b), + _ => throw new NotSupportedException($"Type {p.PropertyType} is not supported"), + }; + return result; + }) + .ToArray(); + + return new Representation(typeName, new ObjectValueNode(fields)); + } + + public static List RepresentationsOf(string typeName, params T[] anonymousObjects) + where T : class + { + return anonymousObjects + .Select(o => RepresentationOf(typeName, o)) + .ToList(); + } } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap index 350d1e4a5d8..4b46684bbc3 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap @@ -6,6 +6,9 @@ type QueryRootOfUser { entity(id: Int!): User! } +"Scalar representing a JWT scope" +scalar Scope + type User @key(fields: "id") { id: Int! idCode: String! @external diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap index a92c3f12ecb..1e964661a52 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap @@ -2,6 +2,9 @@ someField(a: Int): TestType } +"Scalar representing a JWT scope" +scalar Scope + type TestType @key(fields: "id") { id: Int! name: String! diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap index c0d2af44c96..4bb904d6ba5 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap @@ -6,6 +6,9 @@ type Query implements iQuery { someField(a: Int): TestType } +"Scalar representing a JWT scope" +scalar Scope + enum SomeEnum { FOO BAR diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap index d126d3ddbf8..67177163187 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap @@ -9,6 +9,9 @@ type Query implements iQuery { someField(a: Int): TestType } +"Scalar representing a JWT scope" +scalar Scope + enum SomeEnum { FOO BAR diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap index f8925ecfc38..fe028de1bc0 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap @@ -1,3 +1,7 @@ -type Address @key(fields: "matchCode") { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { + query: EmptyQuery +} + +type Address @key(fields: "matchCode") { matchCode: String } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap index 8956e3205cd..55c81e9acf6 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap @@ -1,3 +1,7 @@ -type Address @key(fields: "matchCode") { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { + query: Query +} + +type Address @key(fields: "matchCode") { matchCode: String! } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap index e94d3259304..9c5f463b7fd 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap @@ -1,7 +1,13 @@ -type Address @key(fields: "matchCode") { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { + query: Query +} + +type Address @key(fields: "matchCode") { matchCode: String } type Query { address(id: Int!): Address! + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap index bf08d07226d..e49ac451ac1 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap @@ -1,7 +1,13 @@ -type Address @key(fields: "matchCode") { +schema @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@extends", "@external", "@key", "@inaccessible", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet", "@composeDirective", "@interfaceObject", "@authenticated", "@requiresPolicy" ]) { + query: Query +} + +type Address @key(fields: "matchCode") { matchCode: String! } type Query { address: Address! + _service: _Service! + _entities(representations: [_Any!]!): [_Entity]! } diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/packages.lock.json b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/packages.lock.json index 4127f2e97be..eac2f505f53 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/packages.lock.json +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/packages.lock.json @@ -1,7 +1,7 @@ { "version": 1, "dependencies": { - "net6.0": { + "net7.0": { "ChilliCream.Testing.Utilities": { "type": "Direct", "requested": "[0.2.0, )", @@ -59,6 +59,12 @@ "xunit.core": "2.4.1" } }, + "System.ComponentModel.Annotations": { + "type": "Direct", + "requested": "[5.0.0, )", + "resolved": "5.0.0", + "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" + }, "xunit": { "type": "Direct", "requested": "[2.4.1, )", @@ -76,6 +82,14 @@ "resolved": "2.4.3", "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" }, + "BananaCakePop.Middleware": { + "type": "Transitive", + "resolved": "13.0.0", + "contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==", + "dependencies": { + "Yarp.ReverseProxy": "2.0.1" + } + }, "Castle.Core": { "type": "Transitive", "resolved": "5.0.0", @@ -84,10 +98,19 @@ "System.Diagnostics.EventLog": "6.0.0" } }, - "Microsoft.Bcl.AsyncInterfaces": { + "DiffPlex": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==" + "resolved": "1.7.1", + "contentHash": "a0fSO2p8ykrcfzgG0sjpZAMZPthXXz4l6UIVuM9uyIYIh5yga4sq3aydSGt6n+MkdSBKvMurjjaKnxIqZtfG1g==" + }, + "Microsoft.AspNetCore.WebUtilities": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "9ErxAAKaDzxXASB/b5uLEkLgUWv1QbeVxyJYEHQwMaxXOeFFVkQxiq8RyfVcifLU7NR0QY0p3acqx4ZpYfhHDg==", + "dependencies": { + "Microsoft.Net.Http.Headers": "2.2.0", + "System.Text.Encodings.Web": "4.5.0" + } }, "Microsoft.Build.Tasks.Git": { "type": "Transitive", @@ -101,1340 +124,43 @@ }, "Microsoft.Extensions.DependencyInjection": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", + "resolved": "7.0.0", + "contentHash": "elNeOmkeX3eDVG6pYVeV82p29hr+UKDaBhrZyWvWLw/EVZSYEkZlQdkp0V39k/Xehs2Qa0mvoCvkVj3eQxNQ1Q==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0" } }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" - }, - "Microsoft.Extensions.ObjectPool": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "7hR9FU0JJHOCLmn/Ary31pLLAhlzoMptBKs5CJmNUzD87dXjl+/NqVkyCTl6cT2JAfTK0G39HpvCOv1fhsX3BQ==" - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "Microsoft.NETCore.Platforms": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" - }, - "Microsoft.NETCore.Targets": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" - }, - "Microsoft.SourceLink.Common": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==" - }, - "Microsoft.TestPlatform.ObjectModel": { - "type": "Transitive", - "resolved": "17.1.0", - "contentHash": "OMo/FYnKGy3lZEK0gfitskRM3ga/YBt6MyCyFPq0xNLeybGOQ6HnYNAAvzyePo5WPuMiw3LX+HiuRWNjnas1fA==", - "dependencies": { - "NuGet.Frameworks": "5.11.0", - "System.Reflection.Metadata": "1.6.0" - } - }, - "Microsoft.TestPlatform.TestHost": { - "type": "Transitive", - "resolved": "17.1.0", - "contentHash": "JS0JDLniDhIzkSPLHz7N/x1CG8ywJOtwInFDYA3KQvbz+ojGoT5MT2YDVReL1b86zmNRV8339vsTSm/zh0RcMg==", - "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.1.0", - "Newtonsoft.Json": "9.0.1" - } - }, - "Microsoft.Win32.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "NETStandard.Library": { - "type": "Transitive", - "resolved": "1.6.1", - "contentHash": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json": { - "type": "Transitive", - "resolved": "12.0.1", - "contentHash": "pBR3wCgYWZGiaZDYP+HHYnalVnPJlpP1q55qvVb+adrDHmFMDc1NAKio61xTwftK3Pw5h7TZJPJEEVMd6ty8rg==" - }, - "NuGet.Frameworks": { - "type": "Transitive", - "resolved": "5.11.0", - "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==" - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==" - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==" - }, - "runtime.native.System": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.IO.Compression": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Net.Http": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Security.Cryptography.Apple": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==" - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==" - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==" - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==" - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" - }, - "Snapshooter": { - "type": "Transitive", - "resolved": "0.5.4", - "contentHash": "znayjnxtFjFcRFdS4W8KyeODS/FOVkIzlAD8hRfrrf3fd3hJ9k+XMNRYCARtzrN3ueIpF4USQbAhWrO73Z9z6w==", - "dependencies": { - "Newtonsoft.Json": "12.0.1" - } - }, - "System.AppContext": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Buffers": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Collections": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Collections.Concurrent": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.ComponentModel.Annotations": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" - }, - "System.Console": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Diagnostics.Debug": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.DiagnosticSource": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw==" - }, - "System.Diagnostics.Tools": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.Tracing": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Calendars": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - } - }, - "System.IO": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.Compression": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - } - }, - "System.IO.Compression.ZipFile": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.IO.FileSystem": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.FileSystem.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Linq": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Linq.Expressions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Net.Http": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Net.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Net.Sockets": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.ObjectModel": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Reflection": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.ILGeneration": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.Lightweight": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Metadata": { - "type": "Transitive", - "resolved": "1.6.0", - "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" - }, - "System.Reflection.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.TypeExtensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Resources.ResourceManager": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" - }, - "System.Runtime.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.Handles": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.InteropServices": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Runtime.InteropServices.RuntimeInformation": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, - "System.Runtime.Numerics": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Security.Cryptography.Algorithms": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Cng": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Security.Cryptography.Csp": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Security.Cryptography.Encoding": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Security.Cryptography.X509Certificates": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Text.Encoding": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Text.Encoding.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Text.Encodings.Web": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "6.0.7", - "contentHash": "/Tf/9XjprpHolbcDOrxsKVYy/mUG/FS7aGd9YUgBVEiHeQH4kAE0T1sMbde7q6B5xcrNUsJ5iW7D1RvHudQNqA==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0" - } - }, - "System.Text.RegularExpressions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Threading": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==" - }, - "System.Threading.Tasks": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" - }, - "System.Threading.Timer": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Xml.ReaderWriter": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - } - }, - "System.Xml.XDocument": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - } - }, - "xunit.abstractions": { - "type": "Transitive", - "resolved": "2.0.3", - "contentHash": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg==" - }, - "xunit.analyzers": { - "type": "Transitive", - "resolved": "0.10.0", - "contentHash": "4/IDFCJfIeg6bix9apmUtIMwvOsiwqdEexeO/R2D4GReIGPLIRODTpId/l4LRSrAJk9lEO3Zx1H0Zx6uohJDNg==" - }, - "xunit.assert": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "O/Oe0BS5RmSsM+LQOb041TzuPo5MdH2Rov+qXGS37X+KFG1Hxz7kopYklM5+1Y+tRGeXrOx5+Xne1RuqLFQoyQ==", - "dependencies": { - "NETStandard.Library": "1.6.1" - } - }, - "xunit.core": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "Zsj5OMU6JasNGERXZy8s72+pcheG6Q15atS5XpZXqAtULuyQiQ6XNnUsp1gyfC6WgqScqMvySiEHmHcOG6Eg0Q==", - "dependencies": { - "xunit.extensibility.core": "[2.4.1]", - "xunit.extensibility.execution": "[2.4.1]" - } - }, - "xunit.extensibility.core": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "yKZKm/8QNZnBnGZFD9SewkllHBiK0DThybQD/G4PiAmQjKtEZyHi6ET70QPU9KtSMJGRYS6Syk7EyR2EVDU4Kg==", - "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.abstractions": "2.0.3" - } - }, - "xunit.extensibility.execution": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "7e/1jqBpcb7frLkB6XDrHCGXAbKN4Rtdb88epYxCSRQuZDRW8UtTfdTEVpdTl8s4T56e07hOBVd4G0OdCxIY2A==", - "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.4.1]" - } - }, - "greendonut": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.ObjectPool": "[6.0.0, )", - "System.Diagnostics.DiagnosticSource": "[6.0.0, )", - "System.Threading.Tasks.Extensions": "[4.5.0, )" - } - }, - "greendonut.tests": { - "type": "Project", - "dependencies": { - "ChilliCream.Testing.Utilities": "[0.2.0, )", - "GreenDonut": "[0.0.0, )", - "Microsoft.NET.Test.Sdk": "[17.1.0, )", - "Moq": "[4.18.1, )", - "Snapshooter.Xunit": "[0.5.4, )", - "System.Diagnostics.DiagnosticSource": "[6.0.0, )", - "xunit": "[2.4.1, )" - } - }, - "HotChocolate": { - "type": "Project", - "dependencies": { - "HotChocolate.Authorization": "[0.0.0, )", - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Fetching": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Types.CursorPagination": "[0.0.0, )", - "HotChocolate.Types.Mutations": "[0.0.0, )", - "HotChocolate.Types.OffsetPagination": "[0.0.0, )", - "HotChocolate.Validation": "[0.0.0, )" - } - }, - "hotchocolate.abstractions": { - "type": "Project", - "dependencies": { - "HotChocolate.Language": "[0.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[6.0.0, )", - "System.Collections.Immutable": "[6.0.0, )" - } - }, - "hotchocolate.apollofederation": { - "type": "Project", - "dependencies": { - "HotChocolate": "[0.0.0, )" - } - }, - "hotchocolate.authorization": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )" - } - }, - "hotchocolate.execution": { - "type": "Project", - "dependencies": { - "HotChocolate.Abstractions": "[0.0.0, )", - "HotChocolate.Execution.Abstractions": "[0.0.0, )", - "HotChocolate.Fetching": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", - "HotChocolate.Validation": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection": "[6.0.0, )", - "System.Threading.Channels": "[6.0.0, )" - } - }, - "hotchocolate.execution.abstractions": { - "type": "Project", - "dependencies": { - "HotChocolate.Abstractions": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )" - } - }, - "hotchocolate.fetching": { - "type": "Project", - "dependencies": { - "GreenDonut": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.language": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )", - "HotChocolate.Language.Utf8": "[0.0.0, )", - "HotChocolate.Language.Visitors": "[0.0.0, )", - "HotChocolate.Language.Web": "[0.0.0, )" - } - }, - "hotchocolate.language.syntaxtree": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.ObjectPool": "[6.0.0, )" - } - }, - "hotchocolate.language.utf8": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )" - } - }, - "hotchocolate.language.visitors": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )" - } - }, - "hotchocolate.language.web": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.Utf8": "[0.0.0, )" - } - }, - "hotchocolate.types": { - "type": "Project", - "dependencies": { - "HotChocolate.Abstractions": "[0.0.0, )", - "HotChocolate.Types.Shared": "[0.0.0, )", - "HotChocolate.Utilities": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.ObjectPool": "[6.0.0, )", - "System.ComponentModel.Annotations": "[5.0.0, )", - "System.Text.Json": "[6.0.7, )" - } - }, - "hotchocolate.types.cursorpagination": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.types.mutations": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.types.offsetpagination": { - "type": "Project", - "dependencies": { - "HotChocolate.Execution": "[0.0.0, )", - "HotChocolate.Types": "[0.0.0, )" - } - }, - "hotchocolate.types.shared": { - "type": "Project", - "dependencies": { - "HotChocolate.Language.SyntaxTree": "[0.0.0, )" - } - }, - "hotchocolate.utilities": { - "type": "Project" - }, - "hotchocolate.utilities.dependencyinjection": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "[6.0.0, )" - } - }, - "hotchocolate.validation": { - "type": "Project", - "dependencies": { - "HotChocolate.Types": "[0.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Options": "[6.0.0, )" - } - } - }, - "net7.0": { - "ChilliCream.Testing.Utilities": { - "type": "Direct", - "requested": "[0.2.0, )", - "resolved": "0.2.0", - "contentHash": "gqRu5DNIt6FphQX4EZYlkOI3QmyzatQhuqf3zNXYBmmvmVQ0KaJStDvrANosxlrlVtVX+L5q/s4z9gZMCeuwkA==", - "dependencies": { - "Newtonsoft.Json": "11.0.2", - "xunit": "2.3.1" - } - }, - "coverlet.msbuild": { - "type": "Direct", - "requested": "[3.1.2, )", - "resolved": "3.1.2", - "contentHash": "QhM0fnDtmIMImY7oxyQ/kh1VYtRxPyRVeLwRUGuUvI6Xp83pSYG9gerK8WgJj4TzUl7ISziADUGtIWKhtlbkbQ==" - }, - "Microsoft.NET.Test.Sdk": { - "type": "Direct", - "requested": "[17.1.0, )", - "resolved": "17.1.0", - "contentHash": "MVKvOsHIfrZrvg+8aqOF5dknO/qWrR1sWZjMPQ1N42MKMlL/zQL30FQFZxPeWfmVKWUWAOmAHYsqB5OerTKziw==", - "dependencies": { - "Microsoft.CodeCoverage": "17.1.0", - "Microsoft.TestPlatform.TestHost": "17.1.0" - } - }, - "Microsoft.SourceLink.GitHub": { - "type": "Direct", - "requested": "[1.1.1, )", - "resolved": "1.1.1", - "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", - "dependencies": { - "Microsoft.Build.Tasks.Git": "1.1.1", - "Microsoft.SourceLink.Common": "1.1.1" - } - }, - "Moq": { - "type": "Direct", - "requested": "[4.18.1, )", - "resolved": "4.18.1", - "contentHash": "MmZIKNyvn8VrivSaqA8tqy5DmwUievC9zsuNTrcb00oY4IeGq6fXT5BQK329lZ05/tyi5vp30AWe9fl0d2PZQg==", - "dependencies": { - "Castle.Core": "5.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Snapshooter.Xunit": { - "type": "Direct", - "requested": "[0.5.4, )", - "resolved": "0.5.4", - "contentHash": "gE9VlseOySUSwwAKCXastwxJ7qYpVHwIEi+QbzRVmdOvV6Ry/vE1WqyuolRHwhjx2QZY8+YuO4L/cKJGrt2H6w==", - "dependencies": { - "Snapshooter": "0.5.4", - "xunit.assert": "2.4.1", - "xunit.core": "2.4.1" - } - }, - "xunit": { - "type": "Direct", - "requested": "[2.4.1, )", - "resolved": "2.4.1", - "contentHash": "XNR3Yz9QTtec16O0aKcO6+baVNpXmOnPUxDkCY97J+8krUYxPvXT1szYYEUdKk4sB8GOI2YbAjRIOm8ZnXRfzQ==", - "dependencies": { - "xunit.analyzers": "0.10.0", - "xunit.assert": "[2.4.1]", - "xunit.core": "[2.4.1]" - } - }, - "xunit.runner.visualstudio": { - "type": "Direct", - "requested": "[2.4.3, )", - "resolved": "2.4.3", - "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" - }, - "Castle.Core": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "edc8jjyXqzzy8jFdhs36FZdwmlDDTgqPb2Zy1Q5F/f2uAc88bu/VS/0Tpvgupmpl9zJOvOo5ZizVANb0ltN1NQ==", - "dependencies": { - "System.Diagnostics.EventLog": "6.0.0" - } - }, - "Microsoft.Build.Tasks.Git": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==" + "resolved": "7.0.0", + "contentHash": "h3j/QfmFN4S0w4C2A6X7arXij/M/OVw3uQHSOFxnND4DyAzO1F9eMX7Eti7lU/OkSthEE0WzRsfT/Dmx86jzCw==" }, - "Microsoft.CodeCoverage": { + "Microsoft.Extensions.Http": { "type": "Transitive", - "resolved": "17.1.0", - "contentHash": "0N/ZJ71ncCxQWhgtkEYKOgu2oMHa8h1tsOUbhmIKXF8UwtSUCe4vHAsJ3DVcNWRwNfQzSTy263ZE+QF6MdIhhQ==" + "resolved": "7.0.0", + "contentHash": "9Pq9f/CvOSz0t9yQa6g1uWpxa2sm13daLFm8EZwy9MaQUjKXWdNUXQwIxwhmba5N83UIqURiPHSNqGK1vfWF2w==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0", + "Microsoft.Extensions.Logging": "7.0.0", + "Microsoft.Extensions.Logging.Abstractions": "7.0.0", + "Microsoft.Extensions.Options": "7.0.0" + } }, - "Microsoft.Extensions.DependencyInjection": { + "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "7.0.0", - "contentHash": "elNeOmkeX3eDVG6pYVeV82p29hr+UKDaBhrZyWvWLw/EVZSYEkZlQdkp0V39k/Xehs2Qa0mvoCvkVj3eQxNQ1Q==", + "contentHash": "Nw2muoNrOG5U5qa2ZekXwudUn2BJcD41e65zwmDHb1fQegTX66UokLWZkJRpqSSHXDOWZ5V0iqhbxOEky91atA==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0" + "Microsoft.Extensions.DependencyInjection": "7.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0", + "Microsoft.Extensions.Logging.Abstractions": "7.0.0", + "Microsoft.Extensions.Options": "7.0.0" } }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { + "Microsoft.Extensions.Logging.Abstractions": { "type": "Transitive", "resolved": "7.0.0", - "contentHash": "h3j/QfmFN4S0w4C2A6X7arXij/M/OVw3uQHSOFxnND4DyAzO1F9eMX7Eti7lU/OkSthEE0WzRsfT/Dmx86jzCw==" + "contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==" }, "Microsoft.Extensions.ObjectPool": { "type": "Transitive", @@ -1455,6 +181,15 @@ "resolved": "7.0.0", "contentHash": "um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==" }, + "Microsoft.Net.Http.Headers": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "iZNkjYqlo8sIOI0bQfpsSoMTmB/kyvmV2h225ihyZT33aTp48ZpF6qYnXxzSXmHt8DpBAwBTX+1s1UFLbYfZKg==", + "dependencies": { + "Microsoft.Extensions.Primitives": "2.2.0", + "System.Buffers": "4.5.0" + } + }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", @@ -1551,8 +286,8 @@ }, "Newtonsoft.Json": { "type": "Transitive", - "resolved": "12.0.1", - "contentHash": "pBR3wCgYWZGiaZDYP+HHYnalVnPJlpP1q55qvVb+adrDHmFMDc1NAKio61xTwftK3Pw5h7TZJPJEEVMd6ty8rg==" + "resolved": "13.0.2", + "contentHash": "R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg==" }, "NuGet.Frameworks": { "type": "Transitive", @@ -1684,15 +419,8 @@ }, "System.Buffers": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } + "resolved": "4.5.0", + "contentHash": "pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A==" }, "System.Collections": { "type": "Transitive", @@ -1726,11 +454,6 @@ "resolved": "7.0.0", "contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==" }, - "System.ComponentModel.Annotations": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" - }, "System.Console": { "type": "Transitive", "resolved": "4.3.0", @@ -1890,6 +613,21 @@ "System.Runtime": "4.3.0" } }, + "System.IO.Hashing": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "sDnWM0N3AMCa86LrKTWeF3BZLD2sgWyYUc7HL6z4+xyDZNQRwzmxbo4qP2rX2MqC+Sy1/gOSRDah5ltxY5jPxw==" + }, + "System.IO.Packaging": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "+j5ezLP7785/pd4taKQhXAWsymsIW2nTnE/U3/jpGZzcJx5lip6qkj6UrxSE7ZYZfL0GaLuymwGLqwJV/c7O7Q==" + }, + "System.IO.Pipelines": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "jRn6JYnNPW6xgQazROBLSfpdoczRw694vO5kKvMcNnpXuolEixUyw6IBuBs2Y2mlSX/LdLvyyWmfXhaI3ND1Yg==" + }, "System.Linq": { "type": "Transitive", "resolved": "4.3.0", @@ -1995,6 +733,11 @@ "System.Threading": "4.3.0" } }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==" + }, "System.Reflection": { "type": "Transitive", "resolved": "4.3.0", @@ -2465,6 +1208,27 @@ "xunit.extensibility.core": "[2.4.1]" } }, + "Yarp.ReverseProxy": { + "type": "Transitive", + "resolved": "2.0.1", + "contentHash": "op7vBwONPFeR1PYxeLw+RLqSodODDX8RWd0OinLGMVIq6yi1q9mv1j56ImuyZgiAToksiC0Dc7jbRUZ9I+jvFA==", + "dependencies": { + "System.IO.Hashing": "7.0.0" + } + }, + "cookiecrumble": { + "type": "Project", + "dependencies": { + "DiffPlex": "[1.7.1, )", + "HotChocolate": "[0.0.0, )", + "HotChocolate.AspNetCore": "[0.0.0, )", + "HotChocolate.Fusion": "[0.0.0, )", + "HotChocolate.Transport.Abstractions": "[0.0.0, )", + "Microsoft.AspNetCore.WebUtilities": "[2.2.0, )", + "Newtonsoft.Json": "[13.0.2, )", + "Xunit": "[2.4.1, )" + } + }, "greendonut": { "type": "Project", "dependencies": { @@ -2511,6 +1275,17 @@ "HotChocolate": "[0.0.0, )" } }, + "hotchocolate.aspnetcore": { + "type": "Project", + "dependencies": { + "BananaCakePop.Middleware": "[13.0.0, )", + "HotChocolate": "[0.0.0, )", + "HotChocolate.Subscriptions.InMemory": "[0.0.0, )", + "HotChocolate.Transport.Sockets": "[0.0.0, )", + "HotChocolate.Types.Scalars.Upload": "[0.0.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )" + } + }, "hotchocolate.authorization": { "type": "Project", "dependencies": { @@ -2544,6 +1319,27 @@ "HotChocolate.Types": "[0.0.0, )" } }, + "hotchocolate.fusion": { + "type": "Project", + "dependencies": { + "HotChocolate": "[0.0.0, )", + "HotChocolate.AspNetCore": "[0.0.0, )", + "HotChocolate.Fusion.Abstractions": "[0.0.0, )", + "HotChocolate.Transport.Http": "[0.0.0, )", + "HotChocolate.Transport.Sockets.Client": "[0.0.0, )", + "Microsoft.Extensions.DependencyInjection.Abstractions": "[7.0.0, )", + "Microsoft.Extensions.Http": "[7.0.0, )", + "System.Reactive": "[5.0.0, )" + } + }, + "hotchocolate.fusion.abstractions": { + "type": "Project", + "dependencies": { + "HotChocolate.Language": "[0.0.0, )", + "HotChocolate.Utilities": "[0.0.0, )", + "System.IO.Packaging": "[7.0.0, )" + } + }, "hotchocolate.language": { "type": "Project", "dependencies": { @@ -2577,6 +1373,54 @@ "HotChocolate.Language.Utf8": "[0.0.0, )" } }, + "hotchocolate.subscriptions": { + "type": "Project", + "dependencies": { + "HotChocolate.Abstractions": "[0.0.0, )", + "HotChocolate.Execution.Abstractions": "[0.0.0, )" + } + }, + "hotchocolate.subscriptions.inmemory": { + "type": "Project", + "dependencies": { + "HotChocolate.Execution.Abstractions": "[0.0.0, )", + "HotChocolate.Subscriptions": "[0.0.0, )", + "Microsoft.Extensions.DependencyInjection.Abstractions": "[7.0.0, )" + } + }, + "hotchocolate.transport.abstractions": { + "type": "Project", + "dependencies": { + "HotChocolate.Language.SyntaxTree": "[0.0.0, )", + "System.Collections.Immutable": "[7.0.0, )", + "System.Text.Json": "[7.0.0, )" + } + }, + "hotchocolate.transport.http": { + "type": "Project", + "dependencies": { + "HotChocolate.Transport.Abstractions": "[0.0.0, )", + "HotChocolate.Utilities": "[0.0.0, )", + "System.IO.Pipelines": "[7.0.0, )" + } + }, + "hotchocolate.transport.sockets": { + "type": "Project", + "dependencies": { + "System.IO.Pipelines": "[7.0.0, )" + } + }, + "hotchocolate.transport.sockets.client": { + "type": "Project", + "dependencies": { + "HotChocolate.Language.SyntaxTree": "[0.0.0, )", + "HotChocolate.Transport.Abstractions": "[0.0.0, )", + "HotChocolate.Transport.Sockets": "[0.0.0, )", + "HotChocolate.Utilities": "[0.0.0, )", + "System.Collections.Immutable": "[7.0.0, )", + "System.Text.Json": "[7.0.0, )" + } + }, "hotchocolate.types": { "type": "Project", "dependencies": { @@ -2610,6 +1454,12 @@ "HotChocolate.Types": "[0.0.0, )" } }, + "hotchocolate.types.scalars.upload": { + "type": "Project", + "dependencies": { + "HotChocolate.Types": "[0.0.0, )" + } + }, "hotchocolate.types.shared": { "type": "Project", "dependencies": { @@ -2692,6 +1542,12 @@ "xunit.core": "2.4.1" } }, + "System.ComponentModel.Annotations": { + "type": "Direct", + "requested": "[5.0.0, )", + "resolved": "5.0.0", + "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" + }, "xunit": { "type": "Direct", "requested": "[2.4.1, )", @@ -2709,6 +1565,14 @@ "resolved": "2.4.3", "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" }, + "BananaCakePop.Middleware": { + "type": "Transitive", + "resolved": "13.0.0", + "contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==", + "dependencies": { + "Yarp.ReverseProxy": "2.0.1" + } + }, "Castle.Core": { "type": "Transitive", "resolved": "5.0.0", @@ -2717,6 +1581,20 @@ "System.Diagnostics.EventLog": "6.0.0" } }, + "DiffPlex": { + "type": "Transitive", + "resolved": "1.7.1", + "contentHash": "a0fSO2p8ykrcfzgG0sjpZAMZPthXXz4l6UIVuM9uyIYIh5yga4sq3aydSGt6n+MkdSBKvMurjjaKnxIqZtfG1g==" + }, + "Microsoft.AspNetCore.WebUtilities": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "z1SXKg5Bk02VmrrOab1TO2yxkZIfL4RyrS+yCpwxcLTqJwImYhEttz3LYbl1gQebkAAvx2Fm4NVXmopxXeLZgw==", + "dependencies": { + "Microsoft.Net.Http.Headers": "8.0.0", + "System.IO.Pipelines": "8.0.0" + } + }, "Microsoft.Build.Tasks.Git": { "type": "Transitive", "resolved": "1.1.1", @@ -2727,6 +1605,31 @@ "resolved": "17.1.0", "contentHash": "0N/ZJ71ncCxQWhgtkEYKOgu2oMHa8h1tsOUbhmIKXF8UwtSUCe4vHAsJ3DVcNWRwNfQzSTy263ZE+QF6MdIhhQ==" }, + "Microsoft.Extensions.Configuration": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "0J/9YNXTMWSZP2p2+nvl8p71zpSwokZXZuJW+VjdErkegAnFdO1XlqtA62SJtgVYHdKu3uPxJHcMR/r35HwFBA==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", + "Microsoft.Extensions.Primitives": "8.0.0" + } + }, + "Microsoft.Extensions.Configuration.Abstractions": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==", + "dependencies": { + "Microsoft.Extensions.Primitives": "8.0.0" + } + }, + "Microsoft.Extensions.Configuration.Binder": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "mBMoXLsr5s1y2zOHWmKsE9veDcx8h1x/c3rz4baEdQKTeDcmQAPNbB54Pi/lhFO3K431eEq6PFbMgLaa6PHFfA==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" + } + }, "Microsoft.Extensions.DependencyInjection": { "type": "Transitive", "resolved": "8.0.0", @@ -2740,6 +1643,57 @@ "resolved": "8.0.0", "contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==" }, + "Microsoft.Extensions.Diagnostics": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "3PZp/YSkIXrF7QK7PfC1bkyRYwqOHpWFad8Qx+4wkuumAeXo1NHaxpS9LboNA9OvNSAu+QOVlXbMyoY+pHSqcw==", + "dependencies": { + "Microsoft.Extensions.Configuration": "8.0.0", + "Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0" + } + }, + "Microsoft.Extensions.Diagnostics.Abstractions": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "JHYCQG7HmugNYUhOl368g+NMxYE/N/AiclCYRNlgCY9eVyiBkOHMwK4x60RYMxv9EL3+rmj1mqHvdCiPpC+D4Q==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", + "Microsoft.Extensions.Options": "8.0.0", + "System.Diagnostics.DiagnosticSource": "8.0.0" + } + }, + "Microsoft.Extensions.Http": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "cWz4caHwvx0emoYe7NkHPxII/KkTI8R/LC9qdqJqnKv2poTJ4e2qqPGQqvRoQ5kaSA4FU5IV3qFAuLuOhoqULQ==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", + "Microsoft.Extensions.Diagnostics": "8.0.0", + "Microsoft.Extensions.Logging": "8.0.0", + "Microsoft.Extensions.Logging.Abstractions": "8.0.0", + "Microsoft.Extensions.Options": "8.0.0" + } + }, + "Microsoft.Extensions.Logging": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection": "8.0.0", + "Microsoft.Extensions.Logging.Abstractions": "8.0.0", + "Microsoft.Extensions.Options": "8.0.0" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" + } + }, "Microsoft.Extensions.ObjectPool": { "type": "Transitive", "resolved": "8.0.0", @@ -2754,11 +1708,31 @@ "Microsoft.Extensions.Primitives": "8.0.0" } }, + "Microsoft.Extensions.Options.ConfigurationExtensions": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "0f4DMRqEd50zQh+UyJc+/HiBsZ3vhAQALgdkcQEalSH1L2isdC7Yj54M3cyo5e+BeO5fcBQ7Dxly8XiBBcvRgw==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", + "Microsoft.Extensions.Configuration.Binder": "8.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", + "Microsoft.Extensions.Options": "8.0.0", + "Microsoft.Extensions.Primitives": "8.0.0" + } + }, "Microsoft.Extensions.Primitives": { "type": "Transitive", "resolved": "8.0.0", "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" }, + "Microsoft.Net.Http.Headers": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "YlHqL8oWBX3H1LmdKUOxEMW8cVD8nUACEnE2Fu3Ze4k7mYf8yJ1o/uLqoequQV0GDupXyCBEzYhn7Zxdz7pqYQ==", + "dependencies": { + "Microsoft.Extensions.Primitives": "8.0.0" + } + }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", @@ -2855,8 +1829,8 @@ }, "Newtonsoft.Json": { "type": "Transitive", - "resolved": "12.0.1", - "contentHash": "pBR3wCgYWZGiaZDYP+HHYnalVnPJlpP1q55qvVb+adrDHmFMDc1NAKio61xTwftK3Pw5h7TZJPJEEVMd6ty8rg==" + "resolved": "13.0.2", + "contentHash": "R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg==" }, "NuGet.Frameworks": { "type": "Transitive", @@ -3030,11 +2004,6 @@ "resolved": "8.0.0", "contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg==" }, - "System.ComponentModel.Annotations": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" - }, "System.Console": { "type": "Transitive", "resolved": "4.3.0", @@ -3194,6 +2163,21 @@ "System.Runtime": "4.3.0" } }, + "System.IO.Hashing": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "sDnWM0N3AMCa86LrKTWeF3BZLD2sgWyYUc7HL6z4+xyDZNQRwzmxbo4qP2rX2MqC+Sy1/gOSRDah5ltxY5jPxw==" + }, + "System.IO.Packaging": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "8g1V4YRpdGAxFcK8v9OjuMdIOJSpF30Zb1JGicwVZhly3I994WFyBdV6mQEo8d3T+URQe55/M0U0eIH0Hts1bg==" + }, + "System.IO.Pipelines": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "FHNOatmUq0sqJOkTx+UF/9YK1f180cnW5FVqnQMvYUN0elp6wFzbtPSiqbo1/ru8ICp43JM1i7kKkk6GsNGHlA==" + }, "System.Linq": { "type": "Transitive", "resolved": "4.3.0", @@ -3299,6 +2283,11 @@ "System.Threading": "4.3.0" } }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==" + }, "System.Reflection": { "type": "Transitive", "resolved": "4.3.0", @@ -3769,6 +2758,27 @@ "xunit.extensibility.core": "[2.4.1]" } }, + "Yarp.ReverseProxy": { + "type": "Transitive", + "resolved": "2.0.1", + "contentHash": "op7vBwONPFeR1PYxeLw+RLqSodODDX8RWd0OinLGMVIq6yi1q9mv1j56ImuyZgiAToksiC0Dc7jbRUZ9I+jvFA==", + "dependencies": { + "System.IO.Hashing": "7.0.0" + } + }, + "cookiecrumble": { + "type": "Project", + "dependencies": { + "DiffPlex": "[1.7.1, )", + "HotChocolate": "[0.0.0, )", + "HotChocolate.AspNetCore": "[0.0.0, )", + "HotChocolate.Fusion": "[0.0.0, )", + "HotChocolate.Transport.Abstractions": "[0.0.0, )", + "Microsoft.AspNetCore.WebUtilities": "[8.0.0, )", + "Newtonsoft.Json": "[13.0.2, )", + "Xunit": "[2.4.1, )" + } + }, "greendonut": { "type": "Project", "dependencies": { @@ -3815,6 +2825,17 @@ "HotChocolate": "[0.0.0, )" } }, + "hotchocolate.aspnetcore": { + "type": "Project", + "dependencies": { + "BananaCakePop.Middleware": "[13.0.0, )", + "HotChocolate": "[0.0.0, )", + "HotChocolate.Subscriptions.InMemory": "[0.0.0, )", + "HotChocolate.Transport.Sockets": "[0.0.0, )", + "HotChocolate.Types.Scalars.Upload": "[0.0.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )" + } + }, "hotchocolate.authorization": { "type": "Project", "dependencies": { @@ -3848,6 +2869,27 @@ "HotChocolate.Types": "[0.0.0, )" } }, + "hotchocolate.fusion": { + "type": "Project", + "dependencies": { + "HotChocolate": "[0.0.0, )", + "HotChocolate.AspNetCore": "[0.0.0, )", + "HotChocolate.Fusion.Abstractions": "[0.0.0, )", + "HotChocolate.Transport.Http": "[0.0.0, )", + "HotChocolate.Transport.Sockets.Client": "[0.0.0, )", + "Microsoft.Extensions.DependencyInjection": "[8.0.0, )", + "Microsoft.Extensions.Http": "[8.0.0, )", + "System.Reactive": "[5.0.0, )" + } + }, + "hotchocolate.fusion.abstractions": { + "type": "Project", + "dependencies": { + "HotChocolate.Language": "[0.0.0, )", + "HotChocolate.Utilities": "[0.0.0, )", + "System.IO.Packaging": "[8.0.0, )" + } + }, "hotchocolate.language": { "type": "Project", "dependencies": { @@ -3881,6 +2923,54 @@ "HotChocolate.Language.Utf8": "[0.0.0, )" } }, + "hotchocolate.subscriptions": { + "type": "Project", + "dependencies": { + "HotChocolate.Abstractions": "[0.0.0, )", + "HotChocolate.Execution.Abstractions": "[0.0.0, )" + } + }, + "hotchocolate.subscriptions.inmemory": { + "type": "Project", + "dependencies": { + "HotChocolate.Execution.Abstractions": "[0.0.0, )", + "HotChocolate.Subscriptions": "[0.0.0, )", + "Microsoft.Extensions.DependencyInjection.Abstractions": "[8.0.0, )" + } + }, + "hotchocolate.transport.abstractions": { + "type": "Project", + "dependencies": { + "HotChocolate.Language.SyntaxTree": "[0.0.0, )", + "System.Collections.Immutable": "[8.0.0, )", + "System.Text.Json": "[8.0.0, )" + } + }, + "hotchocolate.transport.http": { + "type": "Project", + "dependencies": { + "HotChocolate.Transport.Abstractions": "[0.0.0, )", + "HotChocolate.Utilities": "[0.0.0, )", + "System.IO.Pipelines": "[8.0.0, )" + } + }, + "hotchocolate.transport.sockets": { + "type": "Project", + "dependencies": { + "System.IO.Pipelines": "[8.0.0, )" + } + }, + "hotchocolate.transport.sockets.client": { + "type": "Project", + "dependencies": { + "HotChocolate.Language.SyntaxTree": "[0.0.0, )", + "HotChocolate.Transport.Abstractions": "[0.0.0, )", + "HotChocolate.Transport.Sockets": "[0.0.0, )", + "HotChocolate.Utilities": "[0.0.0, )", + "System.Collections.Immutable": "[8.0.0, )", + "System.Text.Json": "[8.0.0, )" + } + }, "hotchocolate.types": { "type": "Project", "dependencies": { @@ -3914,6 +3004,12 @@ "HotChocolate.Types": "[0.0.0, )" } }, + "hotchocolate.types.scalars.upload": { + "type": "Project", + "dependencies": { + "HotChocolate.Types": "[0.0.0, )" + } + }, "hotchocolate.types.shared": { "type": "Project", "dependencies": { diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization.Opa/Extensions/HotChocolateAuthorizeRequestExecutorBuilder.cs b/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization.Opa/Extensions/HotChocolateAuthorizeRequestExecutorBuilder.cs index 1e3b5f79d30..3193d3e350b 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization.Opa/Extensions/HotChocolateAuthorizeRequestExecutorBuilder.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore.Authorization.Opa/Extensions/HotChocolateAuthorizeRequestExecutorBuilder.cs @@ -43,7 +43,7 @@ public static IRequestExecutorBuilder AddOpaAuthorization( var jsonOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, }; jsonOptions.Converters.Add( new JsonStringEnumConverter( diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaTypeKind.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaTypeKind.cs index 18917b581a5..ab27453714f 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaTypeKind.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaTypeKind.cs @@ -43,5 +43,5 @@ public enum AcceptMediaTypeKind /// /// text/event-stream /// - EventStream + EventStream, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/AllowedGetOperations.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/AllowedGetOperations.cs index 193f94fdc26..7ddd6ce97ed 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/AllowedGetOperations.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/AllowedGetOperations.cs @@ -7,5 +7,5 @@ public enum AllowedGetOperations Mutation = 2, Subscription = 4, QueryAndMutation = Query | Mutation, - All = Query | Mutation | Subscription + All = Query | Mutation | Subscription, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/ContentType.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/ContentType.cs index f2c42773a3b..67ad8d35b46 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/ContentType.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/ContentType.cs @@ -15,13 +15,13 @@ internal static class ContentType private static readonly char[] _jsonArray = { - 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '/', 'j', 's', 'o', 'n' + 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '/', 'j', 's', 'o', 'n', }; private static readonly char[] _multiPartFormArray = { 'm', 'u', 'l', 't', 'i', 'p', 'a', 'r', 't', '/', 'f', 'o', 'r', 'm', '-', 'd', 'a', - 't', 'a' + 't', 'a', }; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs index fbc1de92891..5a4dee90c48 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs @@ -13,5 +13,5 @@ public enum DefaultHttpMethod /// /// Use a GraphQL HTTP Post request. /// - Post + Post, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/ErrorHelper.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/ErrorHelper.cs index e292148c4df..21ba4942ec8 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/ErrorHelper.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/ErrorHelper.cs @@ -38,7 +38,7 @@ public static IQueryResult InvalidTypeName(string typeName) code: ErrorCodes.Server.InvalidTypeName, extensions: new Dictionary { - { nameof(typeName), typeName } + { nameof(typeName), typeName }, })); public static IQueryResult TypeNotFound(string typeName) @@ -48,7 +48,7 @@ public static IQueryResult TypeNotFound(string typeName) code: ErrorCodes.Server.TypeDoesNotExist, extensions: new Dictionary { - { nameof(typeName), typeName } + { nameof(typeName), typeName }, })); public static IQueryResult InvalidAcceptMediaType(string headerValue) @@ -58,7 +58,7 @@ public static IQueryResult InvalidAcceptMediaType(string headerValue) code: ErrorCodes.Server.InvalidAcceptHeaderValue, extensions: new Dictionary { - { nameof(headerValue), headerValue } + { nameof(headerValue), headerValue }, })); public static IQueryResult MultiPartRequestPreflightRequired() diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs index fb8f70fd377..6b0fe0217f9 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs @@ -479,7 +479,7 @@ public static GraphQLHttpEndpointConventionBuilder WithOptions( { AllowedGetOperations = httpOptions.AllowedGetOperations, EnableGetRequests = httpOptions.EnableGetRequests, - EnableMultipartRequests = httpOptions.EnableMultipartRequests + EnableMultipartRequests = httpOptions.EnableMultipartRequests, }); /// diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.Http.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.Http.cs index 0366e4b9d56..6af796e1524 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.Http.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.Http.cs @@ -108,8 +108,8 @@ public static IServiceCollection AddHttpResponseFormatter( { Json = new JsonResultFormatterOptions { - Indented = indented - } + Indented = indented, + }, })); return services; } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.cs index 0322cd84564..185f0606b3b 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.cs @@ -46,7 +46,7 @@ public static IServiceCollection AddGraphQLServerCore( DefaultHttpResponseFormatter.Create( new HttpResponseFormatterOptions { - HttpTransportVersion = HttpTransportVersion.Latest + HttpTransportVersion = HttpTransportVersion.Latest, })); services.TryAddSingleton( sp => new DefaultHttpRequestParser( @@ -61,7 +61,7 @@ public static IServiceCollection AddGraphQLServerCore( { 0 => new NoopServerDiagnosticEventListener(), 1 => listeners[0], - _ => new AggregateServerDiagnosticEventListener(listeners) + _ => new AggregateServerDiagnosticEventListener(listeners), }; }); diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HttpResponseExtensions.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HttpResponseExtensions.cs index 263ee9b9905..e7b8ad90eb3 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HttpResponseExtensions.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HttpResponseExtensions.cs @@ -13,7 +13,7 @@ internal static class HttpResponseExtensions private static readonly JsonSerializerOptions _serializerOptions = new() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, }; internal static Task WriteAsJsonAsync( diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs index d2b0b9d2b20..b3e54e35597 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs @@ -22,7 +22,7 @@ internal static class HeaderUtilities ContentType.Types.Application, ContentType.SubTypes.GraphQLResponse, null, - StringSegment.Empty) + StringSegment.Empty), }; /// diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/HttpGetSchemaMiddleware.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/HttpGetSchemaMiddleware.cs index 2692966cc20..f410a8d4481 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/HttpGetSchemaMiddleware.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/HttpGetSchemaMiddleware.cs @@ -17,7 +17,7 @@ public sealed class HttpGetSchemaMiddleware : MiddlewareBase ContentType.Types.Application, ContentType.SubTypes.GraphQLResponse, null, - default) + default), }; private readonly MiddlewareRoutingType _routing; private readonly IServerDiagnosticEvents _diagnosticEvents; diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/HttpTransportVersion.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/HttpTransportVersion.cs index ee38bf3aebe..433292d1916 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/HttpTransportVersion.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/HttpTransportVersion.cs @@ -18,5 +18,5 @@ public enum HttpTransportVersion /// /// Represents the GraphQL over HTTP spec version with the commit on 2023-01-27. /// - Draft20230127 = 2 + Draft20230127 = 2, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Instrumentation/HttpRequestKind.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Instrumentation/HttpRequestKind.cs index b3b6094f45f..24b3d4d5484 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Instrumentation/HttpRequestKind.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Instrumentation/HttpRequestKind.cs @@ -29,5 +29,5 @@ public enum HttpRequestKind /// /// HTTP POST GraphQL-SSE /// - HttpSse + HttpSse, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/MiddlewareRoutingType.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/MiddlewareRoutingType.cs index 24bdcadf041..36fd723847c 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/MiddlewareRoutingType.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/MiddlewareRoutingType.cs @@ -14,5 +14,5 @@ public enum MiddlewareRoutingType /// /// Explicitly hosted e.g. MapGraphQLSchema() /// - Explicit + Explicit, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/RequestContentType.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/RequestContentType.cs index c853670233d..f0744d1f190 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/RequestContentType.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/RequestContentType.cs @@ -18,5 +18,5 @@ public enum RequestContentType /// /// multipart/mixed /// - Form + Form, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/ResponseContentType.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/ResponseContentType.cs index 6dff9b22d44..bc35d43635d 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/ResponseContentType.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/ResponseContentType.cs @@ -28,5 +28,5 @@ public enum ResponseContentType /// /// text/event-stream /// - EventStream + EventStream, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs index b098dc0f786..dd3b6150003 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs @@ -50,8 +50,8 @@ public DefaultHttpResponseFormatter( Json = new JsonResultFormatterOptions { Indented = indented, - Encoder = encoder - } + Encoder = encoder, + }, }) { } @@ -409,7 +409,7 @@ protected virtual void OnWriteResponseHeaders( { SingleResult => ResultKind.Single, SubscriptionResult => ResultKind.Subscription, - _ => ResultKind.Stream + _ => ResultKind.Stream, }; ref var start = ref MemoryMarshal.GetArrayDataReference(acceptMediaTypes); @@ -568,7 +568,7 @@ private enum ResultKind { Single, Stream, - Subscription + Subscription, } private sealed class SealedDefaultHttpResponseFormatter : DefaultHttpResponseFormatter diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/ConnectionCloseReason.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/ConnectionCloseReason.cs index a6f91ebeb4a..51e250fdca1 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/ConnectionCloseReason.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/ConnectionCloseReason.cs @@ -10,5 +10,5 @@ public enum ConnectionCloseReason PolicyViolation, MessageTooBig, MandatoryExtension, - InternalServerError + InternalServerError, } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/ApolloSubscriptionProtocolHandler.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/ApolloSubscriptionProtocolHandler.cs index 66b0b2b5990..5ee913ec0db 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/ApolloSubscriptionProtocolHandler.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/ApolloSubscriptionProtocolHandler.cs @@ -166,7 +166,7 @@ await connection.CloseAsync( ex.Message, locations: new[] { - new Location(ex.Line, ex.Column) + new Location(ex.Line, ex.Column), }); await SendErrorMessageAsync( diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8MessageBodies.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8MessageBodies.cs index f57118ae1f3..8be273daa5d 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8MessageBodies.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8MessageBodies.cs @@ -16,7 +16,7 @@ internal static class Utf8MessageBodies (byte)'k', (byte)'a', (byte)'"', - (byte)'}' + (byte)'}', }; public static ReadOnlyMemory KeepAlive => _keepAlive; diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8Messages.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8Messages.cs index 765b456ed8b..53f5dfa137b 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8Messages.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/Apollo/Utf8Messages.cs @@ -20,7 +20,7 @@ internal static class Utf8Messages (byte)'i', (byte)'n', (byte)'i', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan ConnectionAccept => @@ -39,7 +39,7 @@ internal static class Utf8Messages (byte)'_', (byte)'a', (byte)'c', - (byte)'k' + (byte)'k', }; public static ReadOnlySpan ConnectionError => @@ -60,7 +60,7 @@ internal static class Utf8Messages (byte)'r', (byte)'r', (byte)'o', - (byte)'r' + (byte)'r', }; public static ReadOnlySpan ConnectionTerminate => @@ -85,7 +85,7 @@ internal static class Utf8Messages (byte)'n', (byte)'a', (byte)'t', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Start => @@ -95,7 +95,7 @@ internal static class Utf8Messages (byte)'t', (byte)'a', (byte)'r', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan Stop => @@ -123,7 +123,7 @@ internal static class Utf8Messages (byte)'r', (byte)'r', (byte)'o', - (byte)'r' + (byte)'r', }; public static ReadOnlySpan Complete => @@ -136,6 +136,6 @@ internal static class Utf8Messages (byte)'l', (byte)'e', (byte)'t', - (byte)'e' + (byte)'e', }; } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/GraphQLOverWebSocketProtocolHandler.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/GraphQLOverWebSocketProtocolHandler.cs index dc1a1033822..0e0df1c949c 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/GraphQLOverWebSocketProtocolHandler.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/GraphQLOverWebSocketProtocolHandler.cs @@ -161,7 +161,7 @@ idProp.ValueKind is not JsonValueKind.String || ex.Message, locations: new[] { - new Location(ex.Line, ex.Column) + new Location(ex.Line, ex.Column), }); await SendErrorMessageAsync( diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/Utf8Messages.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/Utf8Messages.cs index 9bbf4ca8dfb..bcb88a077f7 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/Utf8Messages.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/Protocols/GraphQLOverWebSocket/Utf8Messages.cs @@ -20,7 +20,7 @@ internal static class Utf8Messages (byte)'i', (byte)'n', (byte)'i', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan ConnectionAccept => @@ -39,7 +39,7 @@ internal static class Utf8Messages (byte)'_', (byte)'a', (byte)'c', - (byte)'k' + (byte)'k', }; public static ReadOnlySpan Subscribe => @@ -53,7 +53,7 @@ internal static class Utf8Messages (byte)'r', (byte)'i', (byte)'b', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Next => @@ -62,7 +62,7 @@ internal static class Utf8Messages (byte)'n', (byte)'e', (byte)'x', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan Error => @@ -72,7 +72,7 @@ internal static class Utf8Messages (byte)'r', (byte)'r', (byte)'o', - (byte)'r' + (byte)'r', }; public static ReadOnlySpan Complete => @@ -85,7 +85,7 @@ internal static class Utf8Messages (byte)'l', (byte)'e', (byte)'t', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Ping => @@ -94,7 +94,7 @@ internal static class Utf8Messages (byte)'p', (byte)'i', (byte)'n', - (byte)'g' + (byte)'g', }; public static ReadOnlySpan Pong => @@ -103,6 +103,6 @@ internal static class Utf8Messages (byte)'p', (byte)'o', (byte)'n', - (byte)'g' + (byte)'g', }; } diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/WebSocketConnection.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/WebSocketConnection.cs index 829a81b4d32..824a284ed6c 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/WebSocketConnection.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Subscriptions/WebSocketConnection.cs @@ -185,7 +185,7 @@ private static WebSocketCloseStatus MapCloseStatus(ConnectionCloseReason closeRe ConnectionCloseReason.NormalClosure => WebSocketCloseStatus.NormalClosure, ConnectionCloseReason.PolicyViolation => WebSocketCloseStatus.PolicyViolation, ConnectionCloseReason.ProtocolError => WebSocketCloseStatus.ProtocolError, - _ => WebSocketCloseStatus.Empty + _ => WebSocketCloseStatus.Empty, }; public void Dispose() diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/DefaultGraphQLHttpClient.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/DefaultGraphQLHttpClient.cs index 45d3942ee20..7a735b3f9a8 100644 --- a/src/HotChocolate/AspNetCore/src/Transport.Http/DefaultGraphQLHttpClient.cs +++ b/src/HotChocolate/AspNetCore/src/Transport.Http/DefaultGraphQLHttpClient.cs @@ -129,9 +129,9 @@ private static HttpRequestMessage CreateRequestMessage( { new MediaTypeWithQualityHeaderValue(ContentType.GraphQL), new MediaTypeWithQualityHeaderValue(ContentType.Json), - new MediaTypeWithQualityHeaderValue(ContentType.EventStream) - } - } + new MediaTypeWithQualityHeaderValue(ContentType.EventStream), + }, + }, }; if (method == GraphQLHttpMethod.Post) diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpClientExtensions.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpClientExtensions.cs index 032353caa56..be60bc6b100 100644 --- a/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpClientExtensions.cs +++ b/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpClientExtensions.cs @@ -217,7 +217,7 @@ public static Task GetAsync( var request = new GraphQLHttpRequest(operation) { - Method = GraphQLHttpMethod.Get + Method = GraphQLHttpMethod.Get, }; return client.SendAsync(request, cancellationToken); @@ -259,7 +259,7 @@ public static Task GetAsync( var request = new GraphQLHttpRequest(operation, new Uri(uri)) { - Method = GraphQLHttpMethod.Get + Method = GraphQLHttpMethod.Get, }; return client.SendAsync(request, cancellationToken); @@ -301,7 +301,7 @@ public static Task GetAsync( var request = new GraphQLHttpRequest(operation, uri) { - Method = GraphQLHttpMethod.Get + Method = GraphQLHttpMethod.Get, }; return client.SendAsync(request, cancellationToken); @@ -552,7 +552,7 @@ public static Task PostAsync( var request = new GraphQLHttpRequest(operation, new Uri(uri)) { - Method = GraphQLHttpMethod.Post + Method = GraphQLHttpMethod.Post, }; return client.SendAsync(request, cancellationToken); @@ -594,7 +594,7 @@ public static Task PostAsync( var request = new GraphQLHttpRequest(operation, uri) { - Method = GraphQLHttpMethod.Post + Method = GraphQLHttpMethod.Post, }; return client.SendAsync(request, cancellationToken); diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpEventStreamProcessor.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpEventStreamProcessor.cs index 0cd1c733c25..162b4abbd0f 100644 --- a/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpEventStreamProcessor.cs +++ b/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpEventStreamProcessor.cs @@ -354,6 +354,6 @@ private static void SkipWhitespaces(ref ReadOnlySpan span) private enum EventType { Next, - Complete + Complete, } } \ No newline at end of file diff --git a/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/Protocols/GraphQLOverWebSocket/Utf8Messages.cs b/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/Protocols/GraphQLOverWebSocket/Utf8Messages.cs index 3d79ffe23f0..43d6fac2c75 100644 --- a/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/Protocols/GraphQLOverWebSocket/Utf8Messages.cs +++ b/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/Protocols/GraphQLOverWebSocket/Utf8Messages.cs @@ -22,7 +22,7 @@ internal static class Utf8Messages (byte)'i', (byte)'n', (byte)'i', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan ConnectionAccept => @@ -41,7 +41,7 @@ internal static class Utf8Messages (byte)'_', (byte)'a', (byte)'c', - (byte)'k' + (byte)'k', }; public static ReadOnlySpan Subscribe => @@ -55,7 +55,7 @@ internal static class Utf8Messages (byte)'r', (byte)'i', (byte)'b', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Next => @@ -64,7 +64,7 @@ internal static class Utf8Messages (byte)'n', (byte)'e', (byte)'x', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan Error => @@ -74,7 +74,7 @@ internal static class Utf8Messages (byte)'r', (byte)'r', (byte)'o', - (byte)'r' + (byte)'r', }; public static ReadOnlySpan Complete => @@ -87,7 +87,7 @@ internal static class Utf8Messages (byte)'l', (byte)'e', (byte)'t', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Ping => @@ -96,7 +96,7 @@ internal static class Utf8Messages (byte)'p', (byte)'i', (byte)'n', - (byte)'g' + (byte)'g', }; public static ReadOnlySpan Pong => @@ -105,6 +105,6 @@ internal static class Utf8Messages (byte)'p', (byte)'o', (byte)'n', - (byte)'g' + (byte)'g', }; } diff --git a/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/SocketClient.cs b/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/SocketClient.cs index b00672dede6..b3912bb39ff 100644 --- a/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/SocketClient.cs +++ b/src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/SocketClient.cs @@ -14,7 +14,7 @@ public sealed class SocketClient : ISocket { private static readonly IProtocolHandler[] _protocolHandlers = { - new GraphQLOverWebSocketProtocolHandler() + new GraphQLOverWebSocketProtocolHandler(), }; private readonly CancellationTokenSource _cts = new(); diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Opa.Tests/AuthorizationAttributeTestData.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Opa.Tests/AuthorizationAttributeTestData.cs index 6e0257657b0..dd540ad45e4 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Opa.Tests/AuthorizationAttributeTestData.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Opa.Tests/AuthorizationAttributeTestData.cs @@ -50,7 +50,7 @@ public IEnumerator GetEnumerator() { yield return new object[] { - CreateSchema() + CreateSchema(), }; } diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/ServerTestBase.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/ServerTestBase.cs index ef7e71fb008..1658532380a 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/ServerTestBase.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/ServerTestBase.cs @@ -100,7 +100,7 @@ protected virtual TestServer CreateStarWarsServer( .WithOptions(new GraphQLServerOptions { EnableBatching = true, - AllowedGetOperations = AllowedGetOperations.Query | AllowedGetOperations.Subscription + AllowedGetOperations = AllowedGetOperations.Query | AllowedGetOperations.Subscription, }); configureConventions?.Invoke(builder); diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/Subscriptions/Apollo/WebSocketExtensions.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/Subscriptions/Apollo/WebSocketExtensions.cs index 2497f85dbbb..c710fc896a9 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/Subscriptions/Apollo/WebSocketExtensions.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/Subscriptions/Apollo/WebSocketExtensions.cs @@ -19,7 +19,7 @@ public static class WebSocketExtensions new() { ContractResolver = new CamelCasePropertyNamesContractResolver(), - NullValueHandling = NullValueHandling.Ignore + NullValueHandling = NullValueHandling.Ignore, }; public static Task SendConnectionInitializeAsync( diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/TestServerExtensions.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/TestServerExtensions.cs index 1db35c26f7a..b2e808621e8 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/TestServerExtensions.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/TestServerExtensions.cs @@ -208,7 +208,7 @@ await SendPostRequestAsync( { StatusCode = response.StatusCode, ContentType = response.Content.Headers.ContentType!.ToString(), - Content = await response.Content.ReadAsStringAsync() + Content = await response.Content.ReadAsStringAsync(), }; } diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs index aea68e43832..92bac53afa8 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs @@ -61,7 +61,7 @@ public async Task SingleResult_Success(string? acceptHeader, HttpTransportVersio using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __typename }" }) + new ClientQueryRequest { Query = "{ __typename }" }), }; AddAcceptHeader(request, acceptHeader); @@ -97,8 +97,8 @@ public async Task SingleResult_MultipartAcceptHeader(string acceptHeader) new ClientQueryRequest { Query = "{ __typename }" }), Headers = { - { "Accept", acceptHeader } - } + { "Accept", acceptHeader }, + }, }; using var response = await client.SendAsync(request); @@ -144,8 +144,8 @@ public async Task Query_No_Body(string? acceptHeader, HttpTransportVersion trans { Content = new ByteArrayContent(Array.Empty()) { - Headers = { ContentType = new("application/json") { CharSet = "utf-8" } } - } + Headers = { ContentType = new("application/json") { CharSet = "utf-8" } }, + }, }; AddAcceptHeader(request, acceptHeader); @@ -186,7 +186,7 @@ public async Task ValidationError(string? acceptHeader, HttpTransportVersion tra using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __typ$ename }" }) + new ClientQueryRequest { Query = "{ __typ$ename }" }), }; AddAcceptHeader(request, acceptHeader); @@ -229,7 +229,7 @@ public async Task ValidationError2(string? acceptHeader, HttpTransportVersion tr using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __type name }" }) + new ClientQueryRequest { Query = "{ __type name }" }), }; AddAcceptHeader(request, acceptHeader); @@ -275,7 +275,7 @@ public async Task UnsupportedAcceptHeaderValue() using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __typename }" }) + new ClientQueryRequest { Query = "{ __typename }" }), }; request.Headers.TryAddWithoutValidation("Accept", "unsupported"); @@ -308,7 +308,7 @@ public async Task UnsupportedApplicationAcceptHeaderValue() using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __typename }" }) + new ClientQueryRequest { Query = "{ __typename }" }), }; request.Headers.TryAddWithoutValidation("Accept", "application/unsupported"); @@ -346,7 +346,7 @@ public async Task DeferredQuery_Multipart(string? acceptHeader) using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ ... @defer { __typename } }" }) + new ClientQueryRequest { Query = "{ ... @defer { __typename } }" }), }; AddAcceptHeader(request, acceptHeader); @@ -391,7 +391,7 @@ public async Task DeferredQuery_EventStream(string acceptHeader) { Content = JsonContent.Create( new ClientQueryRequest { Query = "{ ... @defer { __typename } }" }), - Headers = { { "Accept", acceptHeader } } + Headers = { { "Accept", acceptHeader } }, }; using var response = await client.SendAsync(request, ResponseHeadersRead); @@ -431,7 +431,7 @@ public async Task DefferedQuery_NoStreamableAcceptHeader() { Content = JsonContent.Create( new ClientQueryRequest { Query = "{ ... @defer { __typename } }" }), - Headers = { { "Accept", ContentType.GraphQLResponse } } + Headers = { { "Accept", ContentType.GraphQLResponse } }, }; using var response = await client.SendAsync(request, ResponseHeadersRead); @@ -464,7 +464,7 @@ public async Task EventStream_Sends_KeepAlive() { Content = JsonContent.Create( new ClientQueryRequest { Query = "subscription {delay(count: 2, delay:15000)}" }), - Headers = { { "Accept", "text/event-stream" } } + Headers = { { "Accept", "text/event-stream" } }, }; using var response = await client.SendAsync(request, ResponseHeadersRead); @@ -502,7 +502,7 @@ private HttpClient GetClient(HttpTransportVersion serverTransportVersion) configureServices: s => s.AddHttpResponseFormatter( new HttpResponseFormatterOptions { - HttpTransportVersion = serverTransportVersion + HttpTransportVersion = serverTransportVersion, })); return server.CreateClient(); diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetMiddlewareTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetMiddlewareTests.cs index 4563bafb367..8118109df15 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetMiddlewareTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetMiddlewareTests.cs @@ -88,7 +88,7 @@ await server.GetAsync( hero { name } - }" + }", }); // assert @@ -111,7 +111,7 @@ await server.GetAsync( HERO: hero { name } - }" + }", }); // assert @@ -133,7 +133,7 @@ await server.GetAsync( query ($d: Float) { double_arg(d: $d) }", - Variables = new Dictionary { { "d", 1.539 } } + Variables = new Dictionary { { "d", 1.539 } }, }, "/arguments"); @@ -156,7 +156,7 @@ await server.GetAsync( query ($d: Float) { double_arg(d: $d) }", - Variables = new Dictionary { { "d", double.MaxValue } } + Variables = new Dictionary { { "d", double.MaxValue } }, }, "/arguments"); @@ -164,7 +164,7 @@ await server.GetAsync( new { double.MaxValue, - result + result, }.MatchSnapshot(); } @@ -183,7 +183,7 @@ await server.GetAsync( query ($d: Float) { double_arg(d: $d) }", - Variables = new Dictionary { { "d", double.MinValue } } + Variables = new Dictionary { { "d", double.MinValue } }, }, "/arguments"); @@ -191,7 +191,7 @@ await server.GetAsync( new { double.MinValue, - result + result, }.MatchSnapshot(); } @@ -210,7 +210,7 @@ await server.GetAsync( query ($d: Decimal) { decimal_arg(d: $d) }", - Variables = new Dictionary { { "d", decimal.MaxValue } } + Variables = new Dictionary { { "d", decimal.MaxValue } }, }, "/arguments"); @@ -218,7 +218,7 @@ await server.GetAsync( new { decimal.MaxValue, - result + result, }.MatchSnapshot(); } @@ -237,7 +237,7 @@ await server.GetAsync( query ($d: Decimal) { decimal_arg(d: $d) }", - Variables = new Dictionary { { "d", decimal.MinValue } } + Variables = new Dictionary { { "d", decimal.MinValue } }, }, "/arguments"); @@ -245,7 +245,7 @@ await server.GetAsync( new { decimal.MinValue, - result + result, }.MatchSnapshot(); } @@ -268,8 +268,8 @@ await server.GetAsync( }", Variables = new Dictionary { - { "episode", "NEW_HOPE" } - } + { "episode", "NEW_HOPE" }, + }, }); // assert @@ -295,8 +295,8 @@ query h($id: String!) { }", Variables = new Dictionary { - { "id", "1000" } - } + { "id", "1000" }, + }, }); // assert @@ -311,7 +311,7 @@ public async Task SingleRequest_CreateReviewForEpisode_With_ObjectVariable() configureConventions: e => e.WithOptions( new GraphQLServerOptions { - AllowedGetOperations = AllowedGetOperations.QueryAndMutation + AllowedGetOperations = AllowedGetOperations.QueryAndMutation, })); // act @@ -338,8 +338,8 @@ mutation CreateReviewForEpisode( { "stars", 5 }, { "commentary", "This is a great movie!" }, } - } - } + }, + }, }); // assert @@ -354,7 +354,7 @@ public async Task SingleRequest_CreateReviewForEpisode_Omit_NonNull_Variable() configureConventions: e => e.WithOptions( new GraphQLServerOptions { - AllowedGetOperations = AllowedGetOperations.QueryAndMutation + AllowedGetOperations = AllowedGetOperations.QueryAndMutation, })); // act @@ -380,8 +380,8 @@ mutation CreateReviewForEpisode( { "stars", 5 }, { "commentary", "This is a great movie!" }, } - } - } + }, + }, }); // assert @@ -396,7 +396,7 @@ public async Task SingleRequest_CreateReviewForEpisode_Variables_In_ObjectValue( configureConventions: e => e.WithOptions( new GraphQLServerOptions { - AllowedGetOperations = AllowedGetOperations.QueryAndMutation + AllowedGetOperations = AllowedGetOperations.QueryAndMutation, })); // act @@ -421,8 +421,8 @@ mutation CreateReviewForEpisode( { { "ep", "EMPIRE" }, { "stars", 5 }, - { "commentary", "This is a great movie!" } - } + { "commentary", "This is a great movie!" }, + }, }); // assert @@ -458,8 +458,8 @@ mutation CreateReviewForEpisode( { { "ep", "EMPIRE" }, { "stars", 5 }, - { "commentary", "This is a great movie!" } - } + { "commentary", "This is a great movie!" }, + }, }); // assert @@ -491,7 +491,7 @@ query b { name } }", - OperationName = operationName + OperationName = operationName, }); // assert @@ -515,7 +515,7 @@ await server.GetAsync( name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -538,7 +538,7 @@ await server.GetAsync( ähero { name } - }" + }", }); // assert @@ -575,8 +575,8 @@ mutation CreateReviewForEpisode( { "stars", 5 }, { "commentary", "This is a great movie!" }, } - } - } + }, + }, }); // assert @@ -591,7 +591,7 @@ public async Task SingleRequest_Mutation_Set_To_Be_Allowed_on_Get() configureConventions: e => e.WithOptions( new GraphQLServerOptions { - AllowedGetOperations = AllowedGetOperations.QueryAndMutation + AllowedGetOperations = AllowedGetOperations.QueryAndMutation, })); // act @@ -618,8 +618,8 @@ mutation CreateReviewForEpisode( { "stars", 5 }, { "commentary", "This is a great movie!" }, } - } - } + }, + }, }); // assert @@ -635,7 +635,7 @@ public async Task Get_Middleware_Is_Disabled() new GraphQLServerOptions { EnableGetRequests = false, - Tool = { Enable = false } + Tool = { Enable = false }, })); // act @@ -648,7 +648,7 @@ await server.GetAsync( hero { name } - }" + }", }); // assert @@ -709,7 +709,7 @@ await server.GetStoreActivePersistedQueryAsync( new[] { resultA, - resultB + resultB, }.MatchSnapshot(); } @@ -755,7 +755,7 @@ await server.GetAsync( hero { name } - }" + }", }); // assert diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSchemaMiddlewareTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSchemaMiddlewareTests.cs index 0cfe17314ea..39848e16f62 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSchemaMiddlewareTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSchemaMiddlewareTests.cs @@ -157,7 +157,7 @@ public async Task Download_GraphQL_SDL_Disabled() new GraphQLServerOptions { EnableSchemaRequests = false, - Tool = { Enable = false } + Tool = { Enable = false }, })); var url = TestServerExtensions.CreateUrl("/graphql?sdl"); var request = new HttpRequestMessage(HttpMethod.Get, url); diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpMultipartMiddlewareTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpMultipartMiddlewareTests.cs index e109f7325e7..56f47c7349d 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpMultipartMiddlewareTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpMultipartMiddlewareTests.cs @@ -244,8 +244,8 @@ public async Task Upload_File() Query = query, Variables = new Dictionary { - { "upload", null } - } + { "upload", null }, + }, }); // act @@ -281,8 +281,8 @@ public async Task Upload_Optional_File() Query = query, Variables = new Dictionary { - { "upload", null } - } + { "upload", null }, + }, }); // act @@ -318,8 +318,8 @@ public async Task Upload_Optional_File_In_InputObject() Query = query, Variables = new Dictionary { - { "input", new Dictionary { { "file", null } } } - } + { "input", new Dictionary { { "file", null } } }, + }, }); // act @@ -355,8 +355,8 @@ public async Task Upload_Optional_File_In_Inline_InputObject() Query = query, Variables = new Dictionary { - { "upload", null } - } + { "upload", null }, + }, }); // act @@ -392,8 +392,8 @@ public async Task Upload_File_In_InputObject() Query = query, Variables = new Dictionary { - { "input", new Dictionary { { "file", null } } } - } + { "input", new Dictionary { { "file", null } } }, + }, }); // act @@ -429,8 +429,8 @@ public async Task Upload_File_Inline_InputObject() Query = query, Variables = new Dictionary { - { "upload", null } - } + { "upload", null }, + }, }); // act @@ -472,11 +472,11 @@ public async Task Upload_File_In_List() { new List { - new Dictionary { { "file", null } } - } + new Dictionary { { "file", null } }, + }, } - } - } + }, + }, }); // act @@ -512,8 +512,8 @@ public async Task Upload_Too_Large_File_Test() Query = query, Variables = new Dictionary { - { "upload", null } - } + { "upload", null }, + }, }); var count = 1024 * 1024 * 129; diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs index 8b1b4d78bec..6716dd5d063 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs @@ -160,7 +160,7 @@ await server.PostAsync( hero { name } - }" + }", }); // assert @@ -183,7 +183,7 @@ await server.PostAsync( HERO: hero { name } - }" + }", }); // assert @@ -212,7 +212,7 @@ await server.PostAsync( HERO: hero { name } - }" + }", }); // assert @@ -236,7 +236,7 @@ await server.PostAsync( name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -261,7 +261,7 @@ await server.PostHttpAsync( name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -305,7 +305,7 @@ query h($id: String!) { name } }", - Variables = new Dictionary { { "id", "1000" } } + Variables = new Dictionary { { "id", "1000" } }, }); // assert @@ -336,7 +336,7 @@ ... on Droid @defer(label: ""my_id"") id } } - }" + }", }); // assert @@ -371,7 +371,7 @@ ... on Droid @defer(label: ""my_id"") id } } - }" + }", }); // assert @@ -408,7 +408,7 @@ ... on Droid @defer(label: ""my_id"") id } } - }" + }", }); // assert @@ -435,7 +435,7 @@ public async Task Apollo_Tracing_Invalid_Field() { name } - }" + }", }, enableApolloTracing: true); @@ -467,7 +467,7 @@ ... on Droid @defer(label: ""my_id"") id } } - }" + }", }); // assert @@ -511,7 +511,7 @@ ... on Droid @defer(label: ""my_id"", if: $if) } } }", - Variables = new Dictionary { ["if"] = true } + Variables = new Dictionary { ["if"] = true }, }); // assert @@ -540,7 +540,7 @@ ... on Droid @defer(label: ""my_id"", if: $if) } } }", - Variables = new Dictionary { ["if"] = false } + Variables = new Dictionary { ["if"] = false }, }); // assert @@ -571,7 +571,7 @@ nodes @stream(initialCount: 1 label: ""foo"") { } } } - }" + }", }); // assert @@ -631,8 +631,8 @@ mutation CreateReviewForEpisode( { { "stars", 5 }, { "commentary", "This is a great movie!" }, } - } - } + }, + }, }); // assert @@ -667,8 +667,8 @@ mutation CreateReviewForEpisode( { { "stars", 5 }, { "commentary", "This is a great movie!" }, } - } - } + }, + }, }); // assert @@ -703,8 +703,8 @@ mutation CreateReviewForEpisode( { { "ep", "EMPIRE" }, { "stars", 5 }, - { "commentary", "This is a great movie!" } - } + { "commentary", "This is a great movie!" }, + }, }); // assert @@ -740,8 +740,8 @@ mutation CreateReviewForEpisode( { { "ep", "EMPIRE" }, { "stars", 5 }, - { "commentary", "This is a great movie!" } - } + { "commentary", "This is a great movie!" }, + }, }); // assert @@ -774,7 +774,7 @@ query b { name } }", - OperationName = operationName + OperationName = operationName, }); // assert @@ -798,7 +798,7 @@ await server.PostAsync( name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -821,7 +821,7 @@ await server.PostAsync( ähero { name } - }" + }", }); // assert @@ -843,7 +843,7 @@ await server.PostAsync( query ($d: Float) { double_arg(d: $d) }", - Variables = new Dictionary { { "d", 1.539 } } + Variables = new Dictionary { { "d", 1.539 } }, }, "/arguments"); @@ -866,7 +866,7 @@ await server.PostAsync( query ($d: Float) { double_arg(d: $d) }", - Variables = new Dictionary { { "d", double.MaxValue } } + Variables = new Dictionary { { "d", double.MaxValue } }, }, "/arguments"); @@ -889,7 +889,7 @@ await server.PostAsync( query ($d: Float) { double_arg(d: $d) }", - Variables = new Dictionary { { "d", double.MinValue } } + Variables = new Dictionary { { "d", double.MinValue } }, }, "/arguments"); @@ -912,7 +912,7 @@ await server.PostAsync( query ($d: Decimal) { decimal_arg(d: $d) }", - Variables = new Dictionary { { "d", decimal.MaxValue } } + Variables = new Dictionary { { "d", decimal.MaxValue } }, }, "/arguments"); @@ -935,7 +935,7 @@ await server.PostAsync( query ($d: Decimal) { decimal_arg(d: $d) }", - Variables = new Dictionary { { "d", decimal.MinValue } } + Variables = new Dictionary { { "d", decimal.MinValue } }, }, "/arguments"); @@ -1034,7 +1034,7 @@ query getHero { hero(episode: EMPIRE) { id @export } - }" + }", }, new ClientQueryRequest { @@ -1043,8 +1043,8 @@ query getHuman { human(id: $id) { name } - }" - } + }", + }, }); // assert @@ -1071,7 +1071,7 @@ query getHero { hero(episode: EMPIRE) { id @export } - }" + }", }, new ClientQueryRequest { @@ -1080,8 +1080,8 @@ query getHuman { human(id: $id) { name } - }" - } + }", + }, }), "/graphql"); @@ -1118,7 +1118,7 @@ query getHuman { human(id: $id) { name } - }" + }", }, "getHero, getHuman"); @@ -1146,7 +1146,7 @@ query getHero { hero(episode: EMPIRE) { id @export } - }" + }", }, new ClientQueryRequest { @@ -1155,8 +1155,8 @@ query getHuman { human(id: $id) { name } - }" - } + }", + }, }), path: "/batching"); @@ -1193,7 +1193,7 @@ query getHuman { human(id: $id) { name } - }" + }", }, "getHero, getHuman", path: "/batching"); @@ -1225,7 +1225,7 @@ query getHuman { human(id: $id) { name } - }" + }", }, "getHero", createOperationParameter: s => "batchOperations=" + s); @@ -1256,7 +1256,7 @@ query getHuman { human(id: $id) { name } - }" + }", }, "getHero, getHuman", createOperationParameter: s => "batchOperations=[" + s); @@ -1287,7 +1287,7 @@ query getHuman { human(id: $id) { name } - }" + }", }, "getHero, getHuman", createOperationParameter: s => "batchOperations=" + s); @@ -1314,7 +1314,7 @@ await server.PostAsync( hero { name } - }" + }", }); // assert @@ -1335,7 +1335,7 @@ public async Task Strip_Null_Values_Variant_1() using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __schema { description } }" }) + new ClientQueryRequest { Query = "{ __schema { description } }" }), }; using var response = await client.SendAsync(request); @@ -1363,7 +1363,7 @@ public async Task Strip_Null_Values_Variant_2() configureServices: s => s.AddHttpResponseFormatter( new HttpResponseFormatterOptions { - Json = new JsonResultFormatterOptions { NullIgnoreCondition = Fields } + Json = new JsonResultFormatterOptions { NullIgnoreCondition = Fields }, })); var client = server.CreateClient(); @@ -1371,7 +1371,7 @@ public async Task Strip_Null_Values_Variant_2() using var request = new HttpRequestMessage(HttpMethod.Post, _url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ __schema { description } }" }) + new ClientQueryRequest { Query = "{ __schema { description } }" }), }; using var response = await client.SendAsync(request); @@ -1405,7 +1405,7 @@ public async Task Strip_Null_Elements() .AddHttpResponseFormatter( new HttpResponseFormatterOptions { - Json = new JsonResultFormatterOptions { NullIgnoreCondition = Lists } + Json = new JsonResultFormatterOptions { NullIgnoreCondition = Lists }, })); var client = server.CreateClient(); @@ -1413,7 +1413,7 @@ public async Task Strip_Null_Elements() using var request = new HttpRequestMessage(HttpMethod.Post, url) { Content = JsonContent.Create( - new ClientQueryRequest { Query = "{ nullValues }" }) + new ClientQueryRequest { Query = "{ nullValues }" }), }; using var response = await client.SendAsync(request); diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/PersistedQueryTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/PersistedQueryTests.cs index 5aca3a22584..e853c6058e2 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/PersistedQueryTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/PersistedQueryTests.cs @@ -343,9 +343,9 @@ private ClientQueryRequest CreateApolloStyleRequest(string hashName, string key) ["persistedQuery"] = new Dictionary { ["version"] = 1, - [hashName] = key - } - } + [hashName] = key, + }, + }, }; private sealed class QueryStorage : IReadStoredQueries diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/Apollo/WebSocketProtocolTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/Apollo/WebSocketProtocolTests.cs index 85dd5eb20dd..33e0d0ba36d 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/Apollo/WebSocketProtocolTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/Apollo/WebSocketProtocolTests.cs @@ -68,7 +68,7 @@ public Task No_ConnectionInit_Timeout() new GraphQLServerOptions { Sockets = { ConnectionInitializationTimeout = TimeSpan.FromMilliseconds(50), - KeepAliveInterval = TimeSpan.FromMilliseconds(150) + KeepAliveInterval = TimeSpan.FromMilliseconds(150), }})); var client = CreateWebSocketClient(testServer); @@ -238,7 +238,7 @@ await testServer.SendPostRequestAsync( }) { stars } - }" + }", }); var message = await WaitForMessage(webSocket, "data", ct); @@ -397,7 +397,7 @@ await testServer.SendPostRequestAsync(new ClientQueryRequest }) { stars } - }" + }", }); await WaitForMessage(webSocket, "data", ct); @@ -415,7 +415,7 @@ await testServer.SendPostRequestAsync(new ClientQueryRequest }) { stars } - }" + }", }); // assert diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/GraphQLOverWebSocket/WebSocketProtocolTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/GraphQLOverWebSocket/WebSocketProtocolTests.cs index 05d47661920..7c1aa7b3e17 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/GraphQLOverWebSocket/WebSocketProtocolTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/GraphQLOverWebSocket/WebSocketProtocolTests.cs @@ -81,8 +81,8 @@ public Task Send_Connect_Accept_Ping() { ConnectionInitializationTimeout = TimeSpan.FromMilliseconds(1000), - KeepAliveInterval = TimeSpan.FromMilliseconds(150) - } + KeepAliveInterval = TimeSpan.FromMilliseconds(150), + }, })); var client = CreateWebSocketClient(testServer); using var webSocket = await client.ConnectAsync(SubscriptionUri, ct); @@ -114,8 +114,8 @@ public Task No_ConnectionInit_Timeout() Sockets = { ConnectionInitializationTimeout = TimeSpan.FromMilliseconds(50), - KeepAliveInterval = TimeSpan.FromMilliseconds(150) - } + KeepAliveInterval = TimeSpan.FromMilliseconds(150), + }, })); var client = CreateWebSocketClient(testServer); @@ -282,7 +282,7 @@ await testServer.SendPostRequestAsync( stars } } - """ + """, }); // assert @@ -413,7 +413,7 @@ await testServer.SendPostRequestAsync( }) { stars } - }" + }", }); await WaitForMessage(webSocket, Messages.Next, ct); @@ -432,7 +432,7 @@ await testServer.SendPostRequestAsync( }) { stars } - }" + }", }); // assert @@ -477,7 +477,7 @@ await testServer.SendPostRequestAsync( }) { stars } - }" + }", }); await WaitForMessage(webSocket, Messages.Next, ct); @@ -489,7 +489,7 @@ await testServer.SendPostRequestAsync( Query = @" mutation { complete(episode:NEW_HOPE) - }" + }", }); // assert @@ -545,7 +545,7 @@ await testServer.SendPostRequestAsync( }) { stars } - }" + }", }); for (var i = 0; i < 600; i++) @@ -557,7 +557,7 @@ await testServer.SendPostRequestAsync( await testServer.SendPostRequestAsync( new ClientQueryRequest { - Query = @"mutation { complete(episode:NEW_HOPE) }" + Query = @"mutation { complete(episode:NEW_HOPE) }", }); // assert diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ToolConfigurationFileMiddlewareTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ToolConfigurationFileMiddlewareTests.cs index a7d0c8b696b..4d6ceefc484 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ToolConfigurationFileMiddlewareTests.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ToolConfigurationFileMiddlewareTests.cs @@ -84,7 +84,7 @@ public async Task Fetch_Tool_When_Disabled(string version) // arrange var options = new GraphQLServerOptions { - Tool = { ServeMode = GraphQLToolServeMode.Version(version), Enable = false } + Tool = { ServeMode = GraphQLToolServeMode.Version(version), Enable = false }, }; var server = CreateStarWarsServer(configureConventions: e => e.WithOptions(options)); @@ -114,8 +114,8 @@ public async Task Fetch_Tool_Config_With_Options() GaTrackingId = "GA-FOO", GraphQLEndpoint = "/foo/bar", UseBrowserUrlAsGraphQLEndpoint = true, - DisableTelemetry = true - } + DisableTelemetry = true, + }, }; var server = CreateStarWarsServer("/graphql", configureConventions: builder => builder.WithOptions(options)); @@ -147,7 +147,7 @@ public async Task Fetch_MapBananaCakePop_Tool_FromCdn() // arrange var options = new GraphQLToolOptions { - ServeMode = GraphQLToolServeMode.Version("5.0.8") + ServeMode = GraphQLToolServeMode.Version("5.0.8"), }; var server = CreateServer(endpoint => endpoint.MapBananaCakePop().WithOptions(options)); diff --git a/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/GraphQLHttpClientTests.cs b/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/GraphQLHttpClientTests.cs index d981ea602a5..223fb563eb8 100644 --- a/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/GraphQLHttpClientTests.cs +++ b/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/GraphQLHttpClientTests.cs @@ -125,7 +125,7 @@ public async Task Post_GraphQL_Query_With_Variables_With_RequestUri() var variables = new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }; var requestUri = new Uri(CreateUrl("/graphql")); @@ -162,7 +162,7 @@ public async Task Post_GraphQL_Query_With_Variables_With_RequestUriString() var variables = new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }; var requestUri = CreateUrl("/graphql"); @@ -199,7 +199,7 @@ public async Task Post_GraphQL_Query_With_JsonElement_Variable() var variables = new Dictionary { - ["traits"] = JsonSerializer.SerializeToElement(new { lastJedi = true }) + ["traits"] = JsonSerializer.SerializeToElement(new { lastJedi = true }), }; var requestUri = CreateUrl("/graphql"); @@ -237,7 +237,7 @@ public async Task Post_GraphQL_Query_With_Variables_With_BaseAddress() var variables = new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }; // act @@ -277,7 +277,7 @@ query B($episode: Episode!) { """, variables: new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }, operationName: "B"); @@ -409,7 +409,7 @@ public async Task Get_GraphQL_Query_With_Variables_With_RequestUri() var variables = new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }; var requestUri = new Uri(CreateUrl("/graphql")); @@ -446,7 +446,7 @@ public async Task Get_GraphQL_Query_With_Variables_With_RequestUriString() var variables = new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }; var requestUri = CreateUrl("/graphql"); @@ -484,7 +484,7 @@ public async Task Get_GraphQL_Query_With_Variables_With_BaseAddress() var variables = new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }; // act @@ -524,7 +524,7 @@ query B($episode: Episode!) { """, variables: new Dictionary { - ["episode"] = "JEDI" + ["episode"] = "JEDI", }, operationName: "B"); @@ -576,8 +576,8 @@ mutation CreateReviewForEpisode( ["review"] = new Dictionary { ["stars"] = 5, - ["commentary"] = "This is a great movie!" - } + ["commentary"] = "This is a great movie!", + }, }); var client = new DefaultGraphQLHttpClient(httpClient); @@ -634,8 +634,8 @@ mutation CreateReviewForEpisode( ["review"] = new Dictionary { ["stars"] = 5, - ["commentary"] = "This is a great movie!" - } + ["commentary"] = "This is a great movie!", + }, }); var client = new DefaultGraphQLHttpClient(httpClient); @@ -677,7 +677,7 @@ public async Task Post_GraphQL_FileUpload() """, variables: new Dictionary { - ["upload"] = new FileReference(() => stream, "test.txt") + ["upload"] = new FileReference(() => stream, "test.txt"), }); var requestUri = new Uri(CreateUrl("/upload")); diff --git a/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/OperationRequestTests.cs b/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/OperationRequestTests.cs index ed07f32ab1a..d736d4bd9cd 100644 --- a/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/OperationRequestTests.cs +++ b/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/OperationRequestTests.cs @@ -18,7 +18,7 @@ public async Task Should_WriteNullValues() variables: new Dictionary() { ["abc"] = "def", - ["hij"] = null + ["hij"] = null, }); using var memory = new MemoryStream(); diff --git a/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/GraphQLOverWebSocket/WebSocketClientProtocolTests.cs b/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/GraphQLOverWebSocket/WebSocketClientProtocolTests.cs index 5c799a16cf6..a4506a1b8fb 100644 --- a/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/GraphQLOverWebSocket/WebSocketClientProtocolTests.cs +++ b/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/GraphQLOverWebSocket/WebSocketClientProtocolTests.cs @@ -60,7 +60,7 @@ public Task Subscribe_ReceiveDataOnMutation() }) { stars } - }" + }", }; using var testServer = CreateStarWarsServer(output: _output); diff --git a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs index 1be21962d01..882b9ada25c 100644 --- a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs +++ b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs @@ -87,7 +87,9 @@ public class MockInvocationFeatures : Dictionary, IInvocationFeatu public void Set(T instance) { if (instance == null) + { return; + } TryAdd(typeof(T), instance); } diff --git a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs index 06d072db584..47d104c27fc 100644 --- a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs +++ b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs @@ -30,7 +30,9 @@ public MockHttpRequestData( Url = requestUri ?? throw new ArgumentNullException(nameof(requestUri)); if(claimsIdentities != null) + { Identities = claimsIdentities; + } if (!string.IsNullOrEmpty(requestBody)) { diff --git a/src/HotChocolate/Core/src/Abstractions/GraphQLNonNullTypeAttribute.cs b/src/HotChocolate/Core/src/Abstractions/GraphQLNonNullTypeAttribute.cs index cfff5181a9c..23af757b9b5 100644 --- a/src/HotChocolate/Core/src/Abstractions/GraphQLNonNullTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Abstractions/GraphQLNonNullTypeAttribute.cs @@ -12,12 +12,12 @@ public sealed class GraphQLNonNullTypeAttribute : Attribute { public GraphQLNonNullTypeAttribute() { - Nullable = new[] { false }; + Nullable = [false]; } public GraphQLNonNullTypeAttribute(params bool[] nullable) { - Nullable = nullable.Length == 0 ? new[] { false } : nullable; + Nullable = nullable.Length == 0 ? [false] : nullable; } internal bool[] Nullable { get; } diff --git a/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs b/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs index 6b241e70dca..3a35ea80ce5 100644 --- a/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs +++ b/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs @@ -284,4 +284,9 @@ public static class WellKnownContextData /// The key to access the tag options object. /// public const string TagOptions = "HotChocolate.Types.TagOptions"; + + /// + /// Type key to access the internal schema options. + /// + public const string InternalSchemaOptions = "HotChocolate.Types.InternalSchemaOptions"; } diff --git a/src/HotChocolate/Core/src/Execution/Instrumentation/ApolloTracingResultBuilder.cs b/src/HotChocolate/Core/src/Execution/Instrumentation/ApolloTracingResultBuilder.cs index 081210951d8..be2517cc996 100644 --- a/src/HotChocolate/Core/src/Execution/Instrumentation/ApolloTracingResultBuilder.cs +++ b/src/HotChocolate/Core/src/Execution/Instrumentation/ApolloTracingResultBuilder.cs @@ -8,7 +8,7 @@ namespace HotChocolate.Execution.Instrumentation; internal class ApolloTracingResultBuilder { private const int _apolloTracingVersion = 1; - private const long _ticksToNanosecondsMultiplicator = 100; + private const long _ticksToNanosecondsMultiplier = 100; private readonly ConcurrentQueue _resolverRecords = new ConcurrentQueue(); private TimeSpan _duration; @@ -76,7 +76,7 @@ public ObjectResult Build() details.SetValueUnsafe(0, ApolloTracingResultKeys.Version, _apolloTracingVersion); details.SetValueUnsafe(1, StartTime, _startTime.ToRfc3339DateTimeString()); details.SetValueUnsafe(2, EndTime, _startTime.Add(_duration).ToRfc3339DateTimeString()); - details.SetValueUnsafe(3, Duration, _duration.Ticks * _ticksToNanosecondsMultiplicator); + details.SetValueUnsafe(3, Duration, _duration.Ticks * _ticksToNanosecondsMultiplier); details.SetValueUnsafe(4, Parsing, _parsingResult); details.SetValueUnsafe(5, ApolloTracingResultKeys.Validation, _validationResult); details.SetValueUnsafe(6, ApolloTracingResultKeys.Execution, result); diff --git a/src/HotChocolate/Core/src/Subscriptions.Postgres/ContinuousTask.cs b/src/HotChocolate/Core/src/Subscriptions.Postgres/ContinuousTask.cs index d1568ac7831..6491a47f64c 100644 --- a/src/HotChocolate/Core/src/Subscriptions.Postgres/ContinuousTask.cs +++ b/src/HotChocolate/Core/src/Subscriptions.Postgres/ContinuousTask.cs @@ -7,7 +7,7 @@ internal sealed class ContinuousTask : IAsyncDisposable private readonly CancellationTokenSource _completion = new(); private readonly Func _handler; private readonly Task _task; - private bool disposed; + private bool _disposed; public ContinuousTask(Func handler) { @@ -47,7 +47,7 @@ private async Task RunContinuously() /// public async ValueTask DisposeAsync() { - if(disposed) + if(_disposed) { return; } @@ -62,7 +62,7 @@ public async ValueTask DisposeAsync() } _completion.Dispose(); - disposed = true; + _disposed = true; await ValueTask.CompletedTask; } diff --git a/src/HotChocolate/Core/src/Subscriptions.Postgres/PostgresMessageEnvelope.cs b/src/HotChocolate/Core/src/Subscriptions.Postgres/PostgresMessageEnvelope.cs index 50e3570d8cd..2c5101559f8 100644 --- a/src/HotChocolate/Core/src/Subscriptions.Postgres/PostgresMessageEnvelope.cs +++ b/src/HotChocolate/Core/src/Subscriptions.Postgres/PostgresMessageEnvelope.cs @@ -11,7 +11,7 @@ internal readonly struct PostgresMessageEnvelope { private static readonly Encoding _utf8 = Encoding.UTF8; private static readonly Random _random = Random.Shared; - private const byte separator = (byte)':'; + private const byte _separator = (byte)':'; private const byte _messageIdLength = 24; private PostgresMessageEnvelope(string topic, string formattedPayload) @@ -53,7 +53,7 @@ private static string Format(string topic, string payload, int maxMessagePayload slicedBuffer = slicedBuffer[_messageIdLength..]; // write separator - slicedBuffer[0] = separator; + slicedBuffer[0] = _separator; slicedBuffer = slicedBuffer[1..]; // write topic as base64 @@ -62,7 +62,7 @@ private static string Format(string topic, string payload, int maxMessagePayload slicedBuffer = slicedBuffer[topicLengthBase64..]; // write separator - slicedBuffer[0] = separator; + slicedBuffer[0] = _separator; slicedBuffer = slicedBuffer[1..]; // write payload @@ -112,7 +112,7 @@ public static bool TryParse( buffer = buffer[(_messageIdLength + 1)..]; // find the separator - var indexOfColon = buffer.IndexOf(separator); + var indexOfColon = buffer.IndexOf(_separator); if (indexOfColon == -1) { topic = null; diff --git a/src/HotChocolate/Core/src/Subscriptions.Postgres/ResilientNpgsqlConnection.cs b/src/HotChocolate/Core/src/Subscriptions.Postgres/ResilientNpgsqlConnection.cs index e15e8371adb..adcfed606f2 100644 --- a/src/HotChocolate/Core/src/Subscriptions.Postgres/ResilientNpgsqlConnection.cs +++ b/src/HotChocolate/Core/src/Subscriptions.Postgres/ResilientNpgsqlConnection.cs @@ -7,7 +7,7 @@ namespace HotChocolate.Subscriptions.Postgres; internal sealed class ResilientNpgsqlConnection : IAsyncDisposable { - private const int _waitOnFailureinMs = 500; + private const int _waitOnFailureInMs = 500; private readonly ISubscriptionDiagnosticEvents _diagnosticEvents; private readonly Func> _connectionFactory; @@ -53,12 +53,12 @@ private async Task OnReconnectAsync(CancellationToken cancellationToken) // trigger var message = string - .Format(ResilientConnection_FailedToConnect, _waitOnFailureinMs, ex.Message); + .Format(ResilientConnection_FailedToConnect, _waitOnFailureInMs, ex.Message); _diagnosticEvents.ProviderInfo(message); try { - await Task.Delay(_waitOnFailureinMs, cancellationToken); + await Task.Delay(_waitOnFailureInMs, cancellationToken); } catch { diff --git a/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs b/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs index 1528be7b511..4fac49cb0f9 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs @@ -12,9 +12,9 @@ namespace HotChocolate.Types.NodaTime; /// public class ZonedDateTimeType : StringToStructBaseType { - private static readonly string formatString = "uuuu'-'MM'-'dd'T'HH':'mm':'ss' 'z' 'o"; + private static readonly string _formatString = "uuuu'-'MM'-'dd'T'HH':'mm':'ss' 'z' 'o"; private static readonly ZonedDateTimePattern _default = - ZonedDateTimePattern.CreateWithInvariantCulture(formatString, DateTimeZoneProviders.Tzdb); + ZonedDateTimePattern.CreateWithInvariantCulture(_formatString, DateTimeZoneProviders.Tzdb); private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/QueryableOffsetPagination.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/QueryableOffsetPagination.cs index b15a5358c11..45223f8c6bd 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/QueryableOffsetPagination.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/QueryableOffsetPagination.cs @@ -48,7 +48,7 @@ await Task.Run(() => list.Add(item); } - }) + }, cancellationToken) .ConfigureAwait(false); } diff --git a/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs b/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs index 0f650cec0bd..23b531c1b62 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Text.RegularExpressions; using HotChocolate.Language; using static HotChocolate.Types.RegexType; @@ -246,6 +247,7 @@ private static bool ValidatePostCode(string postCode) return false; } + [SuppressMessage("ReSharper", "InconsistentNaming")] private static class PostalCodePatterns { public const string US = diff --git a/src/HotChocolate/Core/src/Types.Shared/WellKnownTypes.cs b/src/HotChocolate/Core/src/Types.Shared/WellKnownTypes.cs index 1dad6f39c66..c9a033c33ac 100644 --- a/src/HotChocolate/Core/src/Types.Shared/WellKnownTypes.cs +++ b/src/HotChocolate/Core/src/Types.Shared/WellKnownTypes.cs @@ -1,5 +1,8 @@ +using System.Diagnostics.CodeAnalysis; + namespace HotChocolate.Utilities.Introspection; +[SuppressMessage("ReSharper", "InconsistentNaming")] internal static class WellKnownTypes { public const string __Directive = "__Directive"; @@ -15,4 +18,4 @@ internal static class WellKnownTypes public const string Float = "Float"; public const string ID = "ID"; public const string Int = "Int"; -} \ No newline at end of file +} diff --git a/src/HotChocolate/Core/src/Types/Configuration/Validation/DirectiveValidationRule.cs b/src/HotChocolate/Core/src/Types/Configuration/Validation/DirectiveValidationRule.cs index 49ecfff09fb..41811b66e2f 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Validation/DirectiveValidationRule.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Validation/DirectiveValidationRule.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Configuration.Validation; /// internal sealed class DirectiveValidationRule : ISchemaValidationRule { - private const char _underscore = '_'; + private const char _prefixCharacter = '_'; public void Validate( ReadOnlySpan typeSystemObjects, @@ -41,8 +41,8 @@ private static void EnsureDirectiveNameIsValid( { var firstTwoLetters = type.Name.AsSpan().Slice(0, 2); - if (firstTwoLetters[0] == _underscore && - firstTwoLetters[1] == _underscore) + if (firstTwoLetters[0] == _prefixCharacter && + firstTwoLetters[1] == _prefixCharacter) { errors.Add(TwoUnderscoresNotAllowedOnDirectiveName(type)); } diff --git a/src/HotChocolate/Core/src/Types/Configuration/Validation/TypeValidationHelper.cs b/src/HotChocolate/Core/src/Types/Configuration/Validation/TypeValidationHelper.cs index a60cee483b4..e854205cb04 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Validation/TypeValidationHelper.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Validation/TypeValidationHelper.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Configuration.Validation; internal static class TypeValidationHelper { - private const char _underscore = '_'; + private const char _prefixCharacter = '_'; public static void EnsureTypeHasFields( IComplexOutputType type, @@ -287,8 +287,8 @@ private static bool StartsWithTwoUnderscores(string name) { var firstTwoLetters = name.AsSpan().Slice(0, 2); - if (firstTwoLetters[0] == _underscore && - firstTwoLetters[1] == _underscore) + if (firstTwoLetters[0] == _prefixCharacter && + firstTwoLetters[1] == _prefixCharacter) { return true; } diff --git a/src/HotChocolate/Core/src/Types/Extensions/SchemaBuilderExtensions.Types.cs b/src/HotChocolate/Core/src/Types/Extensions/SchemaBuilderExtensions.Types.cs index 2f321335e6d..8f28d9c104f 100644 --- a/src/HotChocolate/Core/src/Types/Extensions/SchemaBuilderExtensions.Types.cs +++ b/src/HotChocolate/Core/src/Types/Extensions/SchemaBuilderExtensions.Types.cs @@ -628,10 +628,23 @@ public static ISchemaBuilder AddDirectiveType( throw new ArgumentNullException(nameof(directiveType)); } - if (directiveType == typeof(DirectiveType) - || (directiveType.IsGenericType - && directiveType.GetGenericTypeDefinition() == - typeof(DirectiveType<>))) + bool IsDirectiveBaseType() + { + if (directiveType == typeof(DirectiveType)) + { + return true; + } + + if (directiveType.IsGenericType) + { + var genericType = directiveType.GetGenericTypeDefinition(); + return genericType == typeof(DirectiveType<>); + } + + return false; + } + + if (IsDirectiveBaseType()) { throw new ArgumentException( TypeResources.SchemaBuilderExtensions_DirectiveTypeIsBaseType, diff --git a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/LocalStateParameterExpressionBuilder.cs b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/LocalStateParameterExpressionBuilder.cs index 93752c90718..80d8f0bed91 100644 --- a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/LocalStateParameterExpressionBuilder.cs +++ b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/LocalStateParameterExpressionBuilder.cs @@ -6,19 +6,26 @@ namespace HotChocolate.Resolvers.Expressions.Parameters; -internal sealed class LocalStateParameterExpressionBuilder +internal class LocalStateParameterExpressionBuilder : ScopedStateParameterExpressionBuilder { public override ArgumentKind Kind => ArgumentKind.LocalState; - protected override PropertyInfo ContextDataProperty { get; } = + private static readonly PropertyInfo _localContextDataProperty = ContextType.GetProperty(nameof(IResolverContext.LocalContextData))!; - protected override MethodInfo SetStateMethod { get; } = - typeof(ExpressionHelper).GetMethod(nameof(ExpressionHelper.SetLocalState))!; + protected override PropertyInfo ContextDataProperty => _localContextDataProperty; - protected override MethodInfo SetStateGenericMethod { get; } = - typeof(ExpressionHelper).GetMethod(nameof(ExpressionHelper.SetLocalStateGeneric))!; + private static readonly MethodInfo _setLocalState = + typeof(ExpressionHelper).GetMethod( + nameof(ExpressionHelper.SetLocalState))!; + private static readonly MethodInfo _setLocalStateGeneric = + typeof(ExpressionHelper).GetMethod( + nameof(ExpressionHelper.SetLocalStateGeneric))!; + + protected override MethodInfo SetStateMethod => _setLocalState; + + protected override MethodInfo SetStateGenericMethod => _setLocalStateGeneric; public override bool CanHandle(ParameterInfo parameter) => parameter.IsDefined(typeof(LocalStateAttribute)); diff --git a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/ScopedStateParameterExpressionBuilder.cs b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/ScopedStateParameterExpressionBuilder.cs index fa2d86ea8e4..bd09df904a9 100644 --- a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/ScopedStateParameterExpressionBuilder.cs +++ b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/ScopedStateParameterExpressionBuilder.cs @@ -18,17 +18,21 @@ internal class ScopedStateParameterExpressionBuilder : IParameterExpressionBuild private static readonly MethodInfo _getScopedStateWithDefault = typeof(ExpressionHelper).GetMethod( nameof(ExpressionHelper.GetScopedStateWithDefault))!; + private static readonly MethodInfo _setScopedState = + typeof(ExpressionHelper).GetMethod( + nameof(ExpressionHelper.SetScopedState))!; + private static readonly MethodInfo _setScopedStateGeneric = + typeof(ExpressionHelper).GetMethod( + nameof(ExpressionHelper.SetScopedStateGeneric))!; - protected virtual PropertyInfo ContextDataProperty { get; } = + private static readonly PropertyInfo _contextDataProperty = ContextType.GetProperty(nameof(IResolverContext.ScopedContextData))!; - protected virtual MethodInfo SetStateMethod { get; } = - typeof(ExpressionHelper) - .GetMethod(nameof(ExpressionHelper.SetScopedState))!; + protected virtual PropertyInfo ContextDataProperty => _contextDataProperty; + + protected virtual MethodInfo SetStateMethod => _setScopedState; - protected virtual MethodInfo SetStateGenericMethod { get; } = - typeof(ExpressionHelper) - .GetMethod(nameof(ExpressionHelper.SetScopedStateGeneric))!; + protected virtual MethodInfo SetStateGenericMethod => _setScopedStateGeneric; public virtual ArgumentKind Kind => ArgumentKind.ScopedState; @@ -103,7 +107,21 @@ protected Expression BuildGetter( contextData, key, Expression.Constant( - new NullableHelper(targetType).GetFlags(parameter).FirstOrDefault() ?? false, + ResolveDefaultIfNotExistsParameterValue(targetType, parameter), typeof(bool))); } + + protected virtual bool ResolveDefaultIfNotExistsParameterValue( + Type targetType, + ParameterInfo parameter) + { + var helper = new NullableHelper(targetType); + var nullabilityFlags = helper.GetFlags(parameter); + if (nullabilityFlags.Length > 0 && + nullabilityFlags[0] is { } f) + { + return f; + } + return false; + } } diff --git a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs index 194e887e08b..0233cd307db 100644 --- a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using HotChocolate.Configuration; using HotChocolate.Types; @@ -29,6 +30,8 @@ protected sealed override SchemaTypeDefinition CreateDefinition(ITypeDiscoveryCo var descriptor = SchemaTypeDescriptor.New(context.DescriptorContext, GetType()); _configure(descriptor); + + context.DescriptorContext.ApplySchemaConfigurations(descriptor); return descriptor.CreateDefinition(); } @@ -106,3 +109,84 @@ internal void CompleteSchema(SchemaTypesDefinition schemaTypesDefinition) _sealed = true; } } + +internal static class SchemaTools +{ + public static void AddSchemaConfiguration( + this ISchemaBuilder builder, + Action configure) + { + if (builder is null) + { + throw new ArgumentNullException(nameof(builder)); + } + + if (configure is null) + { + throw new ArgumentNullException(nameof(configure)); + } + + List> options; + + if (!builder.ContextData.TryGetValue(WellKnownContextData.InternalSchemaOptions, out var value)) + { + options = new List>(); + builder.ContextData.Add(WellKnownContextData.InternalSchemaOptions, options); + value = options; + } + + options = (List>)value!; + options.Add(configure); + } + + public static void AddSchemaConfiguration( + this IDescriptorContext context, + Action configure) + { + if (context is null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (configure is null) + { + throw new ArgumentNullException(nameof(configure)); + } + + List> options; + + if (!context.ContextData.TryGetValue(WellKnownContextData.InternalSchemaOptions, out var value)) + { + options = new List>(); + context.ContextData.Add(WellKnownContextData.InternalSchemaOptions, options); + value = options; + } + + options = (List>)value!; + options.Add(configure); + } + + public static void ApplySchemaConfigurations( + this IDescriptorContext context, + ISchemaTypeDescriptor descriptor) + { + if (context is null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (descriptor is null) + { + throw new ArgumentNullException(nameof(descriptor)); + } + + if (context.ContextData.TryGetValue(WellKnownContextData.InternalSchemaOptions, out var value) && + value is List> options) + { + foreach (var option in options) + { + option(descriptor); + } + } + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveArgumentDescriptorAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveArgumentDescriptorAttribute.cs new file mode 100644 index 00000000000..8660a3b2568 --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveArgumentDescriptorAttribute.cs @@ -0,0 +1,27 @@ +#nullable enable +using System; +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.Types; + +[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] +public abstract class DirectiveArgumentDescriptorAttribute : DescriptorAttribute +{ + protected internal sealed override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + if (descriptor is IDirectiveArgumentDescriptor d + && element is PropertyInfo property) + { + OnConfigure(context, d, property); + } + } + + protected abstract void OnConfigure( + IDescriptorContext context, + IDirectiveArgumentDescriptor descriptor, + PropertyInfo property); +} \ No newline at end of file diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveAttribute.cs new file mode 100644 index 00000000000..6cc59cf65ad --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveAttribute.cs @@ -0,0 +1,97 @@ +using System; +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace HotChocolate.Types; + +/// +/// This abstract base class can be used to create directive attributes and +/// reduces the amount of boilerplate code. +/// +/// +/// The directive type. +/// +public abstract class DirectiveAttribute : DescriptorAttribute where TDirective : class +{ + private readonly TDirective _directive; + + /// + /// Initializes a new instance of . + /// + /// + /// The directive instance that shall be added to the type system member. + /// + protected DirectiveAttribute(TDirective directive) + { + _directive = directive ?? throw new ArgumentNullException(nameof(directive)); + } + + protected internal sealed override void TryConfigure( + IDescriptorContext context, + IDescriptor descriptor, + ICustomAttributeProvider element) + { + switch (descriptor) + { + case ArgumentDescriptor desc: + desc.Directive(_directive); + break; + + case DirectiveArgumentDescriptor desc: + desc.Directive(_directive); + break; + + case EnumTypeDescriptor desc: + desc.Directive(_directive); + break; + + case EnumValueDescriptor desc: + desc.Directive(_directive); + break; + + case InputFieldDescriptor desc: + desc.Directive(_directive); + break; + + case InputObjectTypeDescriptor desc: + desc.Directive(_directive); + break; + + case InterfaceFieldDescriptor desc: + desc.Directive(_directive); + break; + + case InterfaceTypeDescriptor desc: + desc.Directive(_directive); + break; + + case ObjectFieldDescriptor desc: + desc.Directive(_directive); + break; + + case ObjectTypeDescriptor desc: + desc.Directive(_directive); + break; + + case SchemaTypeDescriptor desc: + desc.Directive(_directive); + break; + + case UnionTypeDescriptor desc: + desc.Directive(_directive); + break; + + default: + throw new ArgumentOutOfRangeException(nameof(descriptor)); + } + + OnConfigure(context, _directive, element); + } + + protected virtual void OnConfigure( + IDescriptorContext context, + TDirective descriptor, + ICustomAttributeProvider element) + { + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeDescriptorAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeDescriptorAttribute.cs index d0dc6117ae2..2bc0cb3a687 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeDescriptorAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeDescriptorAttribute.cs @@ -24,4 +24,4 @@ protected abstract void OnConfigure( IDescriptorContext context, IDirectiveTypeDescriptor descriptor, Type type); -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/src/Types/Types/Contracts/IDirectiveCollection.cs b/src/HotChocolate/Core/src/Types/Types/Contracts/IDirectiveCollection.cs index df8ff895052..c2628ac2d2c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Contracts/IDirectiveCollection.cs +++ b/src/HotChocolate/Core/src/Types/Types/Contracts/IDirectiveCollection.cs @@ -29,6 +29,14 @@ public interface IDirectiveCollection : IReadOnlyCollection /// Returns the first directive that matches the given name or null. /// Directive? FirstOrDefault(string directiveName); + + /// + /// Gets the first directive that matches the given or null. + /// + /// + /// Returns the first directive that matches the given or null. + /// + Directive? FirstOrDefault(); /// /// Checks if a directive with the specified exists. @@ -41,4 +49,13 @@ public interface IDirectiveCollection : IReadOnlyCollection /// exists; otherwise, false will be returned. /// bool ContainsDirective(string directiveName); + + /// + /// Checks if a directive with the specified exists. + /// + /// + /// Returns true if a directive with the specified + /// exists; otherwise, false will be returned. + /// + bool ContainsDirective(); } diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs index 98d6ae292b7..b6e89334db5 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs @@ -81,11 +81,38 @@ private static IEnumerable FindDirectives(Directive[] directives, str return null; } + + /// + public Directive? FirstOrDefault() + { + var span = _directives.AsSpan(); + ref var start = ref MemoryMarshal.GetReference(span); + ref var end = ref Unsafe.Add(ref start, span.Length); + + while (Unsafe.IsAddressLessThan(ref start, ref end)) + { + if (start.AsValue() is TRuntimeType) + { + return start; + } + + // move pointer +#pragma warning disable CS8619 + start = ref Unsafe.Add(ref start, 1); +#pragma warning restore CS8619 + } + + return null; + } /// public bool ContainsDirective(string directiveName) => FirstOrDefault(directiveName) is not null; + /// + public bool ContainsDirective() + => FirstOrDefault() is not null; + internal static DirectiveCollection CreateAndComplete( ITypeCompletionContext context, object source, diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs index 06af38cbd3f..2ed128955fe 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs @@ -106,7 +106,9 @@ protected override void OnCompleteType( foreach (var enumValueDefinition in definition.Values) { if (enumValueDefinition.Ignore) + { continue; + } if (TryCreateEnumValue(context, enumValueDefinition, out var enumValue)) { diff --git a/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs index 0a50f690226..4cc073bcb97 100644 --- a/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs @@ -476,7 +476,8 @@ public static INamedType NamedType(this IType type) return (INamedType) current; } - for (var i = 0; i < 6; i++) + const int maxDepth = 6; + for (var i = 0; i < maxDepth; i++) { current = current.InnerType(); diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs index a8ffe2e5889..56fcc9aa206 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs @@ -15,7 +15,7 @@ namespace HotChocolate.Types.Interceptors; public class FlagsEnumInterceptor : TypeInterceptor { - private const string FlagNameAddition = "Flags"; + private const string _flagNameAddition = "Flags"; private readonly Dictionary _outputTypeCache = new(); private readonly Dictionary _inputTypeCache = new(); @@ -113,7 +113,7 @@ private string CreateObjectType(Type type) return outputType; } - var typeName = _namingConventions.GetTypeName(type) + FlagNameAddition; + var typeName = _namingConventions.GetTypeName(type) + _flagNameAddition; var desc = _namingConventions.GetTypeDescription(type, TypeKind.Enum); var objectTypeDefinition = new ObjectTypeDefinition(typeName, desc) { @@ -144,7 +144,7 @@ private RegisteredInputType CreateInputObjectType(Type type) return result; } - var typeName = $"{_namingConventions.GetTypeName(type)}{FlagNameAddition}Input"; + var typeName = $"{_namingConventions.GetTypeName(type)}{_flagNameAddition}Input"; var desc = _namingConventions.GetTypeDescription(type, TypeKind.Enum); var objectTypeDefinition = new InputObjectTypeDefinition(typeName, desc) { diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/Iso8601Duration.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/Iso8601Duration.cs index 2261beda687..21a74123bb5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/Iso8601Duration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/Iso8601Duration.cs @@ -301,10 +301,14 @@ internal static bool TryParse(string s, out TimeSpan? result) } // Normalize to nanosecond intervals for (; numDigits > 9; numDigits--) + { value /= 10; + } for (; numDigits < 9; numDigits++) + { value *= 10; + } nanoseconds |= (uint)value; diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs index d52eef6df8e..6d5a77abf10 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -388,6 +389,7 @@ public class FooQueries await FooObject.Get(context, "hello", ct); } + [SuppressMessage("ReSharper", "InconsistentNaming")] [GraphQLName("Foo")] [Node] public class FooObject diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/MutationTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/MutationTests.cs index 017cb496ae0..6d0224598b6 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/MutationTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/MutationTests.cs @@ -37,7 +37,7 @@ public async Task Ensure_Mutations_Are_Executed_Serially() public async Task Ensure_Mutations_Child_Fields_Are_Scoped_To_Its_Parent() { using var cts = new CancellationTokenSource(5_000); - + var result = await new ServiceCollection() .AddGraphQLServer() @@ -115,6 +115,7 @@ public class Mutation2 { private bool _a; private bool _b; + // ReSharper disable once InconsistentNaming internal readonly object _sync = new(); public bool IsExecutingA => _a; diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/packages.lock.json b/src/HotChocolate/Core/test/Types.Analyzers.Tests/packages.lock.json index eec800d57db..617d7a3e939 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/packages.lock.json +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/packages.lock.json @@ -1252,7 +1252,7 @@ "HotChocolate.Subscriptions.InMemory": "[0.0.0, )", "HotChocolate.Transport.Sockets": "[0.0.0, )", "HotChocolate.Types.Scalars.Upload": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )" + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )" } }, "hotchocolate.authorization": { @@ -1268,7 +1268,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[6.0.0, )", "System.Threading.Channels": "[6.0.0, )" diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValueT_ValueIsNull_SchemaException.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValueT_ValueIsNull_SchemaException.snap deleted file mode 100644 index cc927a8de8b..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValueT_ValueIsNull_SchemaException.snap +++ /dev/null @@ -1 +0,0 @@ -Value cannot be null. (Parameter 'value') diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValueT_ValueIsNull_SchemaException_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValueT_ValueIsNull_SchemaException_NETCOREAPP2_1.snap deleted file mode 100644 index 4ba84cc4ff9..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValueT_ValueIsNull_SchemaException_NETCOREAPP2_1.snap +++ /dev/null @@ -1,2 +0,0 @@ -Value cannot be null. -Parameter name: value diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValue_ValueIsNull_SchemaException_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValue_ValueIsNull_SchemaException_NETCOREAPP2_1.snap deleted file mode 100644 index 4ba84cc4ff9..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.EnumValue_ValueIsNull_SchemaException_NETCOREAPP2_1.snap +++ /dev/null @@ -1,2 +0,0 @@ -Value cannot be null. -Parameter name: value diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.Serialize_EnumValue_WithDirectivesT.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.Serialize_EnumValue_WithDirectivesT.snap deleted file mode 100644 index b28d86c99c8..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/EnumTypeTests.Serialize_EnumValue_WithDirectivesT.snap +++ /dev/null @@ -1,5 +0,0 @@ -enum Foo { - BAZ @bar -} - -directive @bar on EnumValue diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeNonNullTests.Nullable_Dictionary_Is_Correctly_Detected_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeNonNullTests.Nullable_Dictionary_Is_Correctly_Detected_NETCOREAPP2_1.snap deleted file mode 100644 index 17aec18f7ae..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeNonNullTests.Nullable_Dictionary_Is_Correctly_Detected_NETCOREAPP2_1.snap +++ /dev/null @@ -1,31 +0,0 @@ -schema { - query: Query -} - -type Query { - foo(input: FooInput!): String! -} - -input FooInput { - contextData: [KeyValuePairOfStringAndStringInput!] -} - -input KeyValuePairOfStringAndStringInput { - key: String - value: String -} - -"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`." -directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema,such as deprecated fields on a type or deprecated enum values." -directive @deprecated("Deprecations include a reason for why it is deprecated, which is formatted using Markdown syntax (as specified by CommonMark)." reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE - -"Directs the executor to include this field or fragment only when the `if` argument is true." -directive @include("Included when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"Directs the executor to skip this field or fragment when the `if` argument is true." -directive @skip("Skipped when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`." -directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean) on FIELD diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.DoNotAllow_DynamicInputTypes_OnFields.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.DoNotAllow_DynamicInputTypes_OnFields.snap deleted file mode 100644 index 03cc42491a9..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.DoNotAllow_DynamicInputTypes_OnFields.snap +++ /dev/null @@ -1 +0,0 @@ -The argument type has to be an input-type. (Parameter 'inputType') diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.DoNotAllow_DynamicInputTypes_OnFields_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.DoNotAllow_DynamicInputTypes_OnFields_NETCOREAPP2_1.snap deleted file mode 100644 index 5cdaf72eb5a..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.DoNotAllow_DynamicInputTypes_OnFields_NETCOREAPP2_1.snap +++ /dev/null @@ -1,2 +0,0 @@ -The argument type has to be an input-type. -Parameter name: inputType diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseLiteral.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseLiteral.snap deleted file mode 100644 index 489ee130153..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseLiteral.snap +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Foo": { - "FooList": [] - }, - "Bar": "123" -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseValue_ValueIsNull.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseValue_ValueIsNull.snap deleted file mode 100644 index 1c1f54a26c1..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseValue_ValueIsNull.snap +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseValue_ValueIsSimpleInput.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseValue_ValueIsSimpleInput.snap deleted file mode 100644 index 0fd8c1251e0..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.ParseValue_ValueIsSimpleInput.snap +++ /dev/null @@ -1 +0,0 @@ -{ name: "foo" } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.Serialize_ValueIsDictionary.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.Serialize_ValueIsDictionary.snap deleted file mode 100644 index f6877412719..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.Serialize_ValueIsDictionary.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "foo" -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.Serialize_ValueIsSimpleInput.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.Serialize_ValueIsSimpleInput.snap deleted file mode 100644 index f6877412719..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputObjectTypeTests.Serialize_ValueIsSimpleInput.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "foo" -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet.snap deleted file mode 100644 index 9f837557614..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet.snap +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Field1": "abc", - "Field2": 123 -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_ConstructorInit.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_ConstructorInit.snap deleted file mode 100644 index 9f837557614..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_ConstructorInit.snap +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Field1": "abc", - "Field2": 123 -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_MissingRequired.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_MissingRequired.snap deleted file mode 100644 index f8dda14c9e9..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_MissingRequired.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "errors": [ - { - "message": "The required input field \u0060field1\u0060 is missing.", - "path": [ - "field1" - ], - "extensions": { - "field": "Test2Input.field1" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_OneInvalidField.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_OneInvalidField.snap deleted file mode 100644 index 487b6494975..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_OneInvalidField.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "errors": [ - { - "message": "The field \u0060field3\u0060 does not exist on the type \u0060TestInput\u0060.", - "path": [ - "root" - ], - "extensions": { - "type": "TestInput" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_TwoInvalidFields.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_TwoInvalidFields.snap deleted file mode 100644 index c30efdcf5b0..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Deserialize_InputObject_AllIsSet_TwoInvalidFields.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "errors": [ - { - "message": "The fields \u0060\u0060field3\u0060, \u0060field4\u0060\u0060 do not exist on the type \u0060TestInput\u0060.", - "path": [ - "root" - ], - "extensions": { - "type": "TestInput" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet.snap deleted file mode 100644 index 9f837557614..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet.snap +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Field1": "abc", - "Field2": 123 -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_ConstructorInit.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_ConstructorInit.snap deleted file mode 100644 index 9f837557614..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_ConstructorInit.snap +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Field1": "abc", - "Field2": 123 -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_MissingRequired.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_MissingRequired.snap deleted file mode 100644 index f8dda14c9e9..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_MissingRequired.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "errors": [ - { - "message": "The required input field \u0060field1\u0060 is missing.", - "path": [ - "field1" - ], - "extensions": { - "field": "Test2Input.field1" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_OneInvalidField.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_OneInvalidField.snap deleted file mode 100644 index 487b6494975..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_OneInvalidField.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "errors": [ - { - "message": "The field \u0060field3\u0060 does not exist on the type \u0060TestInput\u0060.", - "path": [ - "root" - ], - "extensions": { - "type": "TestInput" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_TwoInvalidFields.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_TwoInvalidFields.snap deleted file mode 100644 index c30efdcf5b0..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/InputSerializerTests.Parse_InputObject_AllIsSet_TwoInvalidFields.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "errors": [ - { - "message": "The fields \u0060\u0060field3\u0060, \u0060field4\u0060\u0060 do not exist on the type \u0060TestInput\u0060.", - "path": [ - "root" - ], - "extensions": { - "type": "TestInput" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Argument_Type_IsInfered_From_Parameter.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Argument_Type_IsInfered_From_Parameter.snap deleted file mode 100644 index c1ddf524828..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Argument_Type_IsInfered_From_Parameter.snap +++ /dev/null @@ -1,13 +0,0 @@ -schema { - query: QueryWithIntArg -} - -type QueryWithIntArg { - bar(foo: Int!): String -} - -"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1." -scalar Int - -"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text." -scalar String diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Infer_List_From_Queryable_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Infer_List_From_Queryable_NETCOREAPP2_1.snap deleted file mode 100644 index fdf214159f7..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Infer_List_From_Queryable_NETCOREAPP2_1.snap +++ /dev/null @@ -1,26 +0,0 @@ -schema { - query: MyListQuery -} - -type Bar { - baz: String! -} - -type MyListQuery { - list: [Bar] -} - -"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`." -directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema,such as deprecated fields on a type or deprecated enum values." -directive @deprecated("Deprecations include a reason for why it is deprecated, which is formatted using Markdown syntax (as specified by CommonMark)." reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE - -"Directs the executor to include this field or fragment only when the `if` argument is true." -directive @include("Included when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"Directs the executor to skip this field or fragment when the `if` argument is true." -directive @skip("Skipped when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`." -directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean) on FIELD diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Infer_Non_Null_Filed_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Infer_Non_Null_Filed_NETCOREAPP2_1.snap deleted file mode 100644 index 68959749cbe..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Infer_Non_Null_Filed_NETCOREAPP2_1.snap +++ /dev/null @@ -1,22 +0,0 @@ -schema { - query: Bar -} - -type Bar { - baz: String! -} - -"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`." -directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema,such as deprecated fields on a type or deprecated enum values." -directive @deprecated("Deprecations include a reason for why it is deprecated, which is formatted using Markdown syntax (as specified by CommonMark)." reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE - -"Directs the executor to include this field or fragment only when the `if` argument is true." -directive @include("Included when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"Directs the executor to skip this field or fragment when the `if` argument is true." -directive @skip("Skipped when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`." -directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean) on FIELD diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Model_With_Nullables.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Model_With_Nullables.snap deleted file mode 100644 index 9f1ff8b5e43..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.Model_With_Nullables.snap +++ /dev/null @@ -1,11 +0,0 @@ -schema { - query: FooWithNullable -} - -type FooWithNullable { - bar: Boolean - bars: [Boolean] -} - -"The `Boolean` scalar type represents `true` or `false`." -scalar Boolean diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.ObjectType_From_Dictionary_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.ObjectType_From_Dictionary_NETCOREAPP2_1.snap deleted file mode 100644 index eee5c7c20d6..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/ObjectTypeTests.ObjectType_From_Dictionary_NETCOREAPP2_1.snap +++ /dev/null @@ -1,31 +0,0 @@ -schema { - query: FooWithDict -} - -type Bar { - baz: String! -} - -type FooWithDict { - map: [KeyValuePairOfStringAndBar!] -} - -type KeyValuePairOfStringAndBar { - key: String - value: Bar -} - -"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`." -directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema,such as deprecated fields on a type or deprecated enum values." -directive @deprecated("Deprecations include a reason for why it is deprecated, which is formatted using Markdown syntax (as specified by CommonMark)." reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE - -"Directs the executor to include this field or fragment only when the `if` argument is true." -directive @include("Included when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"Directs the executor to skip this field or fragment when the `if` argument is true." -directive @skip("Skipped when true." if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`." -directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean) on FIELD diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/PaginationTests.Execute_NestedOffsetPaging_NoCyclicDependencies.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/PaginationTests.Execute_NestedOffsetPaging_NoCyclicDependencies.snap deleted file mode 100644 index a23f75cfe42..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/PaginationTests.Execute_NestedOffsetPaging_NoCyclicDependencies.snap +++ /dev/null @@ -1,20 +0,0 @@ -{ - "data": { - "users": { - "items": [ - { - "parents": { - "items": [ - { - "firstName": "Mother" - }, - { - "firstName": "Father" - } - ] - } - } - ] - } - } -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/PaginationTests.Execute_NestedOffsetPaging_With_Indirect_Cycles.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/PaginationTests.Execute_NestedOffsetPaging_With_Indirect_Cycles.snap deleted file mode 100644 index d7f37ad0df4..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/PaginationTests.Execute_NestedOffsetPaging_With_Indirect_Cycles.snap +++ /dev/null @@ -1,26 +0,0 @@ -{ - "data": { - "users": { - "items": [ - { - "groups": { - "items": [ - { - "members": { - "items": [ - { - "firstName": "Mother" - }, - { - "firstName": "Father" - } - ] - } - } - ] - } - } - ] - } - } -} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomething.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomething.snap deleted file mode 100644 index b92e2bda30a..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomething.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomething": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObj.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObj.snap deleted file mode 100644 index 537f18f573b..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObj.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObj": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObjTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObjTask.snap deleted file mode 100644 index dc469080154..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObjTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObjValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObjValueTask.snap deleted file mode 100644 index a1c36fb253d..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingObjValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingTask.snap deleted file mode 100644 index 072a592dc1f..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingValueTask.snap deleted file mode 100644 index 291de681beb..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_AsyncEnumerable_onSomethingValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomething.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomething.snap deleted file mode 100644 index b92e2bda30a..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomething.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomething": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObj.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObj.snap deleted file mode 100644 index 537f18f573b..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObj.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObj": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObjTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObjTask.snap deleted file mode 100644 index dc469080154..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObjTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObjValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObjValueTask.snap deleted file mode 100644 index a1c36fb253d..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingObjValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingTask.snap deleted file mode 100644 index 072a592dc1f..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingValueTask.snap deleted file mode 100644 index 291de681beb..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Enumerable_onSomethingValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomething.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomething.snap deleted file mode 100644 index b92e2bda30a..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomething.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomething": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObj.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObj.snap deleted file mode 100644 index 537f18f573b..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObj.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObj": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObjTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObjTask.snap deleted file mode 100644 index dc469080154..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObjTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObjValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObjValueTask.snap deleted file mode 100644 index a1c36fb253d..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingObjValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingTask.snap deleted file mode 100644 index 072a592dc1f..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingValueTask.snap deleted file mode 100644 index 291de681beb..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Observable_onSomethingValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomething.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomething.snap deleted file mode 100644 index b92e2bda30a..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomething.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomething": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomething": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObj.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObj.snap deleted file mode 100644 index 537f18f573b..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObj.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObj": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObj": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObjTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObjTask.snap deleted file mode 100644 index dc469080154..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObjTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObjValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObjValueTask.snap deleted file mode 100644 index a1c36fb253d..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingObjValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingObjValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingObjValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingTask.snap deleted file mode 100644 index 072a592dc1f..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingValueTask.snap b/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingValueTask.snap deleted file mode 100644 index 291de681beb..00000000000 --- a/src/HotChocolate/Core/test/Types.Tests/Types/__snapshots__/SubscriptionTypeTests.Subscribe_Attribute_Queryable_onSomethingValueTask.snap +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "Data": { - "onSomethingValueTask": "a" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "b" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - }, - { - "Data": { - "onSomethingValueTask": "c" - }, - "Errors": null, - "Extensions": null, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeAsync_Serialize.snap b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeAsync_Serialize.snap index 3f356ce4b66..9819fe502a4 100644 --- a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeAsync_Serialize.snap +++ b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeAsync_Serialize.snap @@ -1,4 +1,4 @@ -schema { +schema { query: Query } diff --git a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeTypes.snap b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeTypes.snap index 55475933ab4..5837265fc5c 100644 --- a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeTypes.snap +++ b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/SchemaSerializerTests.SerializeTypes.snap @@ -1,3 +1,3 @@ -type Query { +type Query { foo: Foo } diff --git a/src/HotChocolate/Data/test/Data.Projections.Tests/IntegrationTests.cs b/src/HotChocolate/Data/test/Data.Projections.Tests/IntegrationTests.cs index cbc7f84922d..111a2dcf01d 100644 --- a/src/HotChocolate/Data/test/Data.Projections.Tests/IntegrationTests.cs +++ b/src/HotChocolate/Data/test/Data.Projections.Tests/IntegrationTests.cs @@ -486,7 +486,11 @@ public IQueryable ModifySingleOrDefault() [UseProjection] public IQueryable CreateRecord(bool throwError) { - if (throwError) throw new AnError("this is only a test"); + if (throwError) + { + throw new AnError("this is only a test"); + } + return new Foo[] { new() { Bar = "A" }, new() { Bar = "B" } }.AsQueryable(); } diff --git a/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityEnricher.cs b/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityEnricher.cs index 788a963fa7f..5fb8dad1b53 100644 --- a/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityEnricher.cs +++ b/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityEnricher.cs @@ -620,7 +620,7 @@ protected virtual void EnrichError(IError error, Activity activity) var tags = new List> { new("graphql.error.message", error.Message), - new("graphql.error.code", error.Code) + new("graphql.error.code", error.Code), }; if (error.Locations is { Count: > 0 }) diff --git a/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityScopes.cs b/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityScopes.cs index a1c3cac9a05..079231ce33d 100644 --- a/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityScopes.cs +++ b/src/HotChocolate/Diagnostics/src/Diagnostics/ActivityScopes.cs @@ -38,5 +38,5 @@ public enum ActivityScopes CompileOperation | ExecuteOperation | ResolveFieldValue | - DataLoaderBatch + DataLoaderBatch, } diff --git a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs index a26ec38321a..69d822f6d61 100644 --- a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs +++ b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs @@ -35,7 +35,7 @@ await server.PostAsync(new ClientQueryRequest hero { name } - }" + }", }); // assert @@ -64,7 +64,7 @@ await server.PostAsync(new ClientQueryRequest hero { name } - }" + }", }); // assert @@ -93,7 +93,7 @@ await server.GetAsync(new ClientQueryRequest hero { name } - }" + }", }); // assert @@ -123,7 +123,7 @@ await server.PostAsync(new ClientQueryRequest name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -157,7 +157,7 @@ await server.PostAsync(new ClientQueryRequest name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -191,7 +191,7 @@ await server.PostAsync(new ClientQueryRequest name } }", - Variables = new Dictionary { { "episode", "NEW_HOPE" } } + Variables = new Dictionary { { "episode", "NEW_HOPE" } }, }); // assert @@ -222,7 +222,7 @@ await server.PostAsync(new ClientQueryRequest } }", Variables = new Dictionary { { "episode", "NEW_HOPE" } }, - Extensions = new Dictionary { { "test", "abc" } } + Extensions = new Dictionary { { "test", "abc" } }, }); // assert @@ -280,7 +280,7 @@ ... on Droid @defer(label: ""my_id"") id } } - }" + }", }); // assert @@ -319,7 +319,7 @@ await server.PostRawAsync(new ClientQueryRequest } } } - }" + }", }); // assert @@ -358,7 +358,7 @@ await server.PostRawAsync(new ClientQueryRequest } } } - }" + }", }); // assert @@ -389,7 +389,7 @@ await server.PostRawAsync(new ClientQueryRequest Query = @" { 1 - }" + }", }); // assert @@ -420,7 +420,7 @@ await server.PostRawAsync(new ClientQueryRequest Query = @" { abc - }" + }", }); // assert diff --git a/src/HotChocolate/Fusion/src/CommandLine/packages.lock.json b/src/HotChocolate/Fusion/src/CommandLine/packages.lock.json index 0b7eeeaf40c..4e5750e56e3 100644 --- a/src/HotChocolate/Fusion/src/CommandLine/packages.lock.json +++ b/src/HotChocolate/Fusion/src/CommandLine/packages.lock.json @@ -225,7 +225,7 @@ "HotChocolate.Subscriptions.InMemory": "[0.0.0, )", "HotChocolate.Transport.Sockets": "[0.0.0, )", "HotChocolate.Types.Scalars.Upload": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )" + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )" } }, "hotchocolate.authorization": { @@ -241,7 +241,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[7.0.0, )", "System.Threading.Channels": "[7.0.0, )" @@ -726,7 +726,7 @@ "HotChocolate.Subscriptions.InMemory": "[0.0.0, )", "HotChocolate.Transport.Sockets": "[0.0.0, )", "HotChocolate.Types.Scalars.Upload": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )" + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )" } }, "hotchocolate.authorization": { @@ -742,7 +742,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[8.0.0, )", "System.Threading.Channels": "[8.0.0, )" diff --git a/src/HotChocolate/Fusion/test/Shared/packages.lock.json b/src/HotChocolate/Fusion/test/Shared/packages.lock.json index 201cdb518a0..88b2e4f15c8 100644 --- a/src/HotChocolate/Fusion/test/Shared/packages.lock.json +++ b/src/HotChocolate/Fusion/test/Shared/packages.lock.json @@ -1270,7 +1270,7 @@ "HotChocolate.Subscriptions.InMemory": "[0.0.0, )", "HotChocolate.Transport.Sockets": "[0.0.0, )", "HotChocolate.Types.Scalars.Upload": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )" + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )" } }, "hotchocolate.aspnetcore.tests.utilities": { @@ -1302,7 +1302,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[7.0.0, )", "System.Threading.Channels": "[7.0.0, )" diff --git a/src/HotChocolate/Language/src/Language.SyntaxTree/Utilities/SyntaxPrinter.cs b/src/HotChocolate/Language/src/Language.SyntaxTree/Utilities/SyntaxPrinter.cs index b3981945528..102294bdba9 100644 --- a/src/HotChocolate/Language/src/Language.SyntaxTree/Utilities/SyntaxPrinter.cs +++ b/src/HotChocolate/Language/src/Language.SyntaxTree/Utilities/SyntaxPrinter.cs @@ -61,9 +61,13 @@ public static async ValueTask PrintToAsync( CancellationToken cancellationToken = default) { #if NETSTANDARD2_0 - using var streamWriter = new StreamWriter(stream, Encoding.UTF8); + using var streamWriter = new StreamWriter( + stream, + new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true)); #else - await using var streamWriter = new StreamWriter(stream, Encoding.UTF8); + await using var streamWriter = new StreamWriter( + stream, + new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true)); #endif var syntaxWriter = StringSyntaxWriter.Rent(); diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorBooleanTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorBooleanTests.cs index 68b2c797ac7..c0a5ccabf06 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorBooleanTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorBooleanTests.cs @@ -11,7 +11,7 @@ public class QueryableFilterVisitorBooleanTests private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = true }, new() { Bar = null }, new() { Bar = false } + new() { Bar = true }, new() { Bar = null }, new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorComparableTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorComparableTests.cs index 8518f58a914..4735eb9e6e6 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorComparableTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorComparableTests.cs @@ -9,7 +9,7 @@ public class QueryableFilterVisitorComparableTests { private static readonly Foo[] _fooEntities = { - new() { BarShort = 12 }, new() { BarShort = 14 }, new() { BarShort = 13 } + new() { BarShort = 12 }, new() { BarShort = 14 }, new() { BarShort = 13 }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -17,7 +17,7 @@ public class QueryableFilterVisitorComparableTests new() { BarShort = 12 }, new() { BarShort = null }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorEnumTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorEnumTests.cs index 2fb165f3866..45c67a2ba24 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorEnumTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorEnumTests.cs @@ -12,7 +12,7 @@ public class QueryableFilterVisitorEnumTests new() { BarEnum = FooEnum.BAR }, new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -21,7 +21,7 @@ public class QueryableFilterVisitorEnumTests new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, new() { BarEnum = null }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private readonly SchemaCache _cache; @@ -323,7 +323,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX + QUX, } public class FooFilterInput : FilterInputType diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorExecutableTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorExecutableTests.cs index b74af7ec9fc..18e7e9e90b3 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorExecutableTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorExecutableTests.cs @@ -10,14 +10,14 @@ public class QueryableFilterVisitorExecutableTests private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true }, new() { Bar = null }, - new() { Bar = false } + new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs index 6df80b84ce5..afa36e92773 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs @@ -12,7 +12,7 @@ public class QueryableFilterVisitorInterfacesTests private static readonly BarInterface[] _barEntities = { new() { Test = new InterfaceImpl1 { Prop = "a" } }, - new() { Test = new InterfaceImpl1 { Prop = "b" } } + new() { Test = new InterfaceImpl1 { Prop = "b" } }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorListTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorListTests.cs index 8fc6afe343a..de7cbef36ef 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorListTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorListTests.cs @@ -15,8 +15,8 @@ public class QueryableFilterVisitorListTests { new() { Bar = "a" }, new() { Bar = "a" }, - new() { Bar = "a" } - } + new() { Bar = "a" }, + }, }, new() { @@ -24,8 +24,8 @@ public class QueryableFilterVisitorListTests { new() { Bar = "c" }, new() { Bar = "a" }, - new() { Bar = "a" } - } + new() { Bar = "a" }, + }, }, new() { @@ -33,8 +33,8 @@ public class QueryableFilterVisitorListTests { new() { Bar = "a" }, new() { Bar = "d" }, - new() { Bar = "b" } - } + new() { Bar = "b" }, + }, }, new() { @@ -42,8 +42,8 @@ public class QueryableFilterVisitorListTests { new() { Bar = "c" }, new() { Bar = "d" }, - new() { Bar = "b" } - } + new() { Bar = "b" }, + }, }, new() { @@ -51,9 +51,9 @@ public class QueryableFilterVisitorListTests { new() { Bar = null! }, new() { Bar = "d" }, - new() { Bar = "b" } - } - } + new() { Bar = "b" }, + }, + }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorObjectTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorObjectTests.cs index 84cf3e2e171..0a6fc4b3b3a 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorObjectTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorObjectTests.cs @@ -19,9 +19,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new Foo { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -33,9 +33,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 14, BarString = "d" } } - } - } + new() { Foo = new Foo { BarShort = 14, BarString = "d" } }, + }, + }, }, new() { @@ -46,8 +46,8 @@ public class QueryableFilterVisitorObjectTests BarEnum = BarEnum.FOO, BarString = "testctest", ObjectArray = null, - } - } + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -62,9 +62,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 12 } } - } - } + new() { Foo = new FooNullable { BarShort = 12 } }, + }, + }, }, new() { @@ -76,9 +76,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = null } } - } - } + new() { Foo = new FooNullable { BarShort = null } }, + }, + }, }, new() { @@ -90,9 +90,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 14 } } - } - } + new() { Foo = new FooNullable { BarShort = 14 } }, + }, + }, }, new() { @@ -102,9 +102,9 @@ public class QueryableFilterVisitorObjectTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } - } + ObjectArray = null, + }, + }, }; private readonly SchemaCache _cache; @@ -726,6 +726,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorStringTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorStringTests.cs index 22aa92623b9..ad1fa87e099 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorStringTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/QueryableFilterVisitorStringTests.cs @@ -10,14 +10,14 @@ public class QueryableFilterVisitorStringTests private static readonly Foo[] _fooEntities = { new() { Bar = "testatest" }, - new() { Bar = "testbtest" } + new() { Bar = "testbtest" }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = "testatest" }, new() { Bar = "testbtest" }, - new() { Bar = null } + new() { Bar = null }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorBooleanTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorBooleanTests.cs index fb87c91d349..888530d2c44 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorBooleanTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorBooleanTests.cs @@ -11,7 +11,7 @@ public class QueryableSortVisitorBooleanTests private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = true }, new() { Bar = null }, new() { Bar = false } + new() { Bar = true }, new() { Bar = null }, new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorComparableTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorComparableTests.cs index 963757be8a4..3cfe73a7dd1 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorComparableTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorComparableTests.cs @@ -9,7 +9,7 @@ public class QueryableSortVisitorComparableTests { private static readonly Foo[] _fooEntities = { - new() { BarShort = 12 }, new() { BarShort = 14 }, new() { BarShort = 13 } + new() { BarShort = 12 }, new() { BarShort = 14 }, new() { BarShort = 13 }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -17,7 +17,7 @@ public class QueryableSortVisitorComparableTests new() { BarShort = 12 }, new() { BarShort = null }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorEnumTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorEnumTests.cs index 517fd51ed2c..2a02067a3f5 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorEnumTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorEnumTests.cs @@ -12,7 +12,7 @@ public class QueryableSortVisitorEnumTests new() { BarEnum = FooEnum.BAR }, new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -21,7 +21,7 @@ public class QueryableSortVisitorEnumTests new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, new() { BarEnum = null }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private readonly SchemaCache _cache; @@ -109,7 +109,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX + QUX, } public class FooSortType : SortInputType diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExecutableTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExecutableTests.cs index 38eab08f82c..edce4fd6ea7 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExecutableTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExecutableTests.cs @@ -11,7 +11,7 @@ public class QueryableSortVisitorExecutableTests private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = true }, new() { Bar = null }, new() { Bar = false } + new() { Bar = true }, new() { Bar = null }, new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExpressionTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExpressionTests.cs index ab4ee82123d..2585afad4f3 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExpressionTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorExpressionTests.cs @@ -14,8 +14,8 @@ public class QueryableSortVisitorExpressionTests new Foo { Name = "Sam", LastName = "Sampleman", Bars = new List() }, new Foo { - Name = "Foo", LastName = "Galoo", Bars = new List() { new() { Value = "A" } } - } + Name = "Foo", LastName = "Galoo", Bars = new List() { new() { Value = "A" } }, + }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorObjectTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorObjectTests.cs index 640dcdc239e..5007b6d124c 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorObjectTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorObjectTests.cs @@ -19,9 +19,9 @@ public class QueryableSortVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new Foo { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -39,11 +39,11 @@ public class QueryableSortVisitorObjectTests Foo = new Foo { //ScalarArray = new[] { "c", "d", "b" } - BarShort = 14, BarString = "d" - } - } - } - } + BarShort = 14, BarString = "d", + }, + }, + }, + }, }, new() { @@ -55,8 +55,8 @@ public class QueryableSortVisitorObjectTests BarString = "testctest", //ScalarArray = null, ObjectArray = null, - } - } + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -78,10 +78,10 @@ public class QueryableSortVisitorObjectTests { //ScalarArray = new[] { "c", "d", "a" } BarShort = 12, - } - } - } - } + }, + }, + }, + }, }, new() { @@ -100,10 +100,10 @@ public class QueryableSortVisitorObjectTests { //ScalarArray = new[] { "c", "d", "b" } BarShort = null, - } - } - } - } + }, + }, + }, + }, }, new() { @@ -122,10 +122,10 @@ public class QueryableSortVisitorObjectTests { //ScalarArray = new[] { "c", "d", "b" } BarShort = 14, - } - } - } - } + }, + }, + }, + }, }, new() { @@ -136,10 +136,10 @@ public class QueryableSortVisitorObjectTests BarEnum = BarEnum.FOO, BarString = "testdtest", //ScalarArray = null, - ObjectArray = null - } + ObjectArray = null, + }, }, - new() { Foo = null } + new() { Foo = null }, }; private readonly SchemaCache _cache; @@ -519,10 +519,10 @@ query testSort($order: [BarSortInput!]) { "foo", new Dictionary { - { "barShort", "ASC" }, { "barBool", "ASC" } + { "barShort", "ASC" }, { "barBool", "ASC" }, } - } - } + }, + }, }) .Create()); @@ -546,14 +546,14 @@ query testSort($order: [BarSortInput!]) { { { "foo", new Dictionary { { "barShort", "ASC" } } - } + }, }, new() { { "foo", new Dictionary { { "barBool", "ASC" } } - } - } + }, + }, }) .Create()); @@ -579,10 +579,10 @@ query testSort($order: [BarSortInput!]) { "foo", new Dictionary { - { "barShort", "DESC" }, { "barBool", "DESC" } + { "barShort", "DESC" }, { "barBool", "DESC" }, } - } - } + }, + }, }) .Create()); @@ -606,14 +606,14 @@ query testSort($order: [BarSortInput!]) { { { "foo", new Dictionary { { "barShort", "DESC" } } - } + }, }, new() { { "foo", new Dictionary { { "barBool", "DESC" } } - } - } + }, + }, }) .Create()); @@ -700,6 +700,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorStringTests.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorStringTests.cs index 60c591128c6..392f55b2889 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorStringTests.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/QueryableSortVisitorStringTests.cs @@ -9,12 +9,12 @@ public class QueryableSortVisitorStringTests { private static readonly Foo[] _fooEntities = { - new() { Bar = "testatest" }, new() { Bar = "testbtest" } + new() { Bar = "testatest" }, new() { Bar = "testbtest" }, }; private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = "testatest" }, new() { Bar = "testbtest" }, new() { Bar = null } + new() { Bar = "testatest" }, new() { Bar = "testbtest" }, new() { Bar = null }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/MongoDb/src/Data/Driver/AndFilterDefinition.cs b/src/HotChocolate/MongoDb/src/Data/Driver/AndFilterDefinition.cs index f5f76cb9543..a4379781f75 100644 --- a/src/HotChocolate/MongoDb/src/Data/Driver/AndFilterDefinition.cs +++ b/src/HotChocolate/MongoDb/src/Data/Driver/AndFilterDefinition.cs @@ -16,8 +16,8 @@ public sealed class AndFilterDefinition : MongoDbFilterDefinition "$geoWithin", "$near", "$geoIntersects", - "$nearSphere" - }; + "$nearSphere", + }; private readonly MongoDbFilterDefinition[] _filters; diff --git a/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAllOperationHandler.cs b/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAllOperationHandler.cs index 008b0c255ee..268f18acea7 100644 --- a/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAllOperationHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAllOperationHandler.cs @@ -40,7 +40,7 @@ protected override MongoDbFilterDefinition HandleListOperation( new BsonDocument { { "$exists", true }, - { "$nin", new BsonArray { new BsonArray(), BsonNull.Value } } + { "$nin", new BsonArray { new BsonArray(), BsonNull.Value } }, }), new NotMongoDbFilterDefinition( new OrMongoDbFilterDefinition(negatedChilds) diff --git a/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAnyOperationHandler.cs b/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAnyOperationHandler.cs index 10c3c8df938..5d2a6620f97 100644 --- a/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAnyOperationHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListAnyOperationHandler.cs @@ -52,7 +52,7 @@ parsedValue is bool parsedBool && new BsonDocument { { "$exists", true }, - { "$nin", new BsonArray { new BsonArray(), BsonNull.Value } } + { "$nin", new BsonArray { new BsonArray(), BsonNull.Value } }, }); } @@ -62,7 +62,7 @@ parsedValue is bool parsedBool && new BsonDocument { { "$exists", true }, - { "$in", new BsonArray { new BsonArray(), BsonNull.Value } } + { "$in", new BsonArray { new BsonArray(), BsonNull.Value } }, }), new MongoDbFilterOperation( path, diff --git a/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListNoneOperationHandler.cs b/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListNoneOperationHandler.cs index d10259f7c3b..2d5831a02a2 100644 --- a/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListNoneOperationHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListNoneOperationHandler.cs @@ -26,7 +26,7 @@ protected override MongoDbFilterDefinition HandleListOperation( new BsonDocument { { "$exists", true }, - { "$nin", new BsonArray { new BsonArray(), BsonNull.Value } } + { "$nin", new BsonArray { new BsonArray(), BsonNull.Value } }, }), new MongoDbFilterOperation( path, diff --git a/src/HotChocolate/MongoDb/src/Data/Filters/MongoDbFilterCombinator.cs b/src/HotChocolate/MongoDb/src/Data/Filters/MongoDbFilterCombinator.cs index 5a45be604ac..6bdde3b7272 100644 --- a/src/HotChocolate/MongoDb/src/Data/Filters/MongoDbFilterCombinator.cs +++ b/src/HotChocolate/MongoDb/src/Data/Filters/MongoDbFilterCombinator.cs @@ -25,7 +25,7 @@ public override bool TryCombineOperations( FilterCombinator.And => CombineWithAnd(operations), FilterCombinator.Or => CombineWithOr(operations), _ => throw ThrowHelper - .Filtering_MongoDbCombinator_InvalidCombinator(this, combinator) + .Filtering_MongoDbCombinator_InvalidCombinator(this, combinator), }; return true; diff --git a/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbCursorPagingHandler.cs b/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbCursorPagingHandler.cs index cb810e008d3..fa0b6a7c631 100644 --- a/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbCursorPagingHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbCursorPagingHandler.cs @@ -37,7 +37,7 @@ private IMongoPagingContainer CreatePagingContainer(object source) CreatePagingContainer(mae.BuildPipeline()), MongoDbFindFluentExecutable mfe => CreatePagingContainer(mfe.BuildPipeline()), - _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()) + _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()), }; } } diff --git a/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbOffsetPagingHandler.cs b/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbOffsetPagingHandler.cs index e929c8bb7cf..61eff376e09 100644 --- a/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbOffsetPagingHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Paging/MongoDbOffsetPagingHandler.cs @@ -37,7 +37,7 @@ private IMongoPagingContainer CreatePagingContainer(object source) CreatePagingContainer(mae.BuildPipeline()), MongoDbFindFluentExecutable mfe => CreatePagingContainer(mfe.BuildPipeline()), - _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()) + _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()), }; } } diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbAggregateFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbAggregateFluentTests.cs index 481104a0b79..40051b9868e 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbAggregateFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbAggregateFluentTests.cs @@ -17,13 +17,13 @@ public class MongoDbAggregateFluentTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly Bar[] _barEntities = { new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbCollectionTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbCollectionTests.cs index 5029890473f..b945d50d010 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbCollectionTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbCollectionTests.cs @@ -16,13 +16,13 @@ public class MongoDbCollectionTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly Bar[] _barEntities = { new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterCombinatorTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterCombinatorTests.cs index 74e19db0aa9..495460f25ec 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterCombinatorTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterCombinatorTests.cs @@ -13,7 +13,7 @@ public class MongoDbFilterCombinatorTests private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; public MongoDbFilterCombinatorTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorBooleanTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorBooleanTests.cs index a2561fef5ab..e4174fe5591 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorBooleanTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorBooleanTests.cs @@ -13,14 +13,14 @@ public class MongoDbFilterVisitorBooleanTests private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true }, new() { Bar = null }, - new() { Bar = false } + new() { Bar = false }, }; public MongoDbFilterVisitorBooleanTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorComparableTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorComparableTests.cs index 57b0109b894..4f0fb3e3662 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorComparableTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorComparableTests.cs @@ -16,18 +16,18 @@ public class MongoDbFilterVisitorComparableTests new() { BarShort = 12, - BarDateTime = new DateTime(2000, 1, 12, 0, 0, 0, DateTimeKind.Utc) + BarDateTime = new DateTime(2000, 1, 12, 0, 0, 0, DateTimeKind.Utc), }, new() { BarShort = 14, - BarDateTime = new DateTime(2000, 1, 14, 0, 0, 0, DateTimeKind.Utc) + BarDateTime = new DateTime(2000, 1, 14, 0, 0, 0, DateTimeKind.Utc), }, new() { BarShort = 13, - BarDateTime = new DateTime(2000, 1, 13, 0, 0, 0, DateTimeKind.Utc) - } + BarDateTime = new DateTime(2000, 1, 13, 0, 0, 0, DateTimeKind.Utc), + }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -35,19 +35,19 @@ public class MongoDbFilterVisitorComparableTests new() { BarShort = 12, - BarDateTime = new DateTime(2000, 1, 12, 0, 0, 0, DateTimeKind.Utc) + BarDateTime = new DateTime(2000, 1, 12, 0, 0, 0, DateTimeKind.Utc), }, new() { BarShort = null, BarDateTime = null }, new() { BarShort = 14, - BarDateTime = new DateTime(2000, 1, 14, 0, 0, 0, DateTimeKind.Utc) + BarDateTime = new DateTime(2000, 1, 14, 0, 0, 0, DateTimeKind.Utc), }, new() { BarShort = 13, - BarDateTime = new DateTime(2000, 1, 13, 0, 0, 0, DateTimeKind.Utc) - } + BarDateTime = new DateTime(2000, 1, 13, 0, 0, 0, DateTimeKind.Utc), + }, }; public MongoDbFilterVisitorComparableTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorDateOnlyTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorDateOnlyTests.cs index ce681999791..da2d5743565 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorDateOnlyTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorDateOnlyTests.cs @@ -16,14 +16,14 @@ public class MongoDbFilterVisitorDateOnlyTests private static readonly Foo[] _fooEntities = { new() { Bar = new DateOnly(2022, 01, 16) }, - new() { Bar = new DateOnly(2022, 01, 15) } + new() { Bar = new DateOnly(2022, 01, 15) }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = new DateOnly(2022, 01, 16) }, new() { Bar = null }, - new() { Bar = new DateOnly(2022, 01, 15) } + new() { Bar = new DateOnly(2022, 01, 15) }, }; public MongoDbFilterVisitorDateOnlyTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorEnumTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorEnumTests.cs index 9452298a5ae..2638e4e52c6 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorEnumTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorEnumTests.cs @@ -15,7 +15,7 @@ public class MongoDbFilterVisitorEnumTests new() { BarEnum = FooEnum.BAR }, new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -24,7 +24,7 @@ public class MongoDbFilterVisitorEnumTests new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, new() { BarEnum = null }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; public MongoDbFilterVisitorEnumTests(MongoResource resource) @@ -301,7 +301,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX + QUX, } public class FooFilterType : FilterInputType diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorListTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorListTests.cs index eb7352f9313..94f4b13940b 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorListTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorListTests.cs @@ -18,8 +18,8 @@ public class MongoDbFilterVisitorListTests { new FooNested { Bar = "a" }, new FooNested { Bar = "a" }, - new FooNested { Bar = "a" } - } + new FooNested { Bar = "a" }, + }, }, new() { @@ -27,8 +27,8 @@ public class MongoDbFilterVisitorListTests { new FooNested { Bar = "c" }, new FooNested { Bar = "a" }, - new FooNested { Bar = "a" } - } + new FooNested { Bar = "a" }, + }, }, new() { @@ -36,8 +36,8 @@ public class MongoDbFilterVisitorListTests { new FooNested { Bar = "a" }, new FooNested { Bar = "d" }, - new FooNested { Bar = "b" } - } + new FooNested { Bar = "b" }, + }, }, new() { @@ -45,8 +45,8 @@ public class MongoDbFilterVisitorListTests { new FooNested { Bar = "c" }, new FooNested { Bar = "d" }, - new FooNested { Bar = "b" } - } + new FooNested { Bar = "b" }, + }, }, new() { @@ -54,11 +54,11 @@ public class MongoDbFilterVisitorListTests { new FooNested { Bar = null }, new FooNested { Bar = "d" }, - new FooNested { Bar = "b" } - } + new FooNested { Bar = "b" }, + }, }, new() { FooNested = null }, - new() { FooNested = Array.Empty() } + new() { FooNested = Array.Empty() }, }; private static readonly FooSimple[] _fooSimple = @@ -69,8 +69,8 @@ public class MongoDbFilterVisitorListTests { "a", "a", - "a" - } + "a", + }, }, new() { @@ -78,8 +78,8 @@ public class MongoDbFilterVisitorListTests { "c", "a", - "a" - } + "a", + }, }, new() { @@ -87,8 +87,8 @@ public class MongoDbFilterVisitorListTests { "a", "d", - "b" - } + "b", + }, }, new() { @@ -96,8 +96,8 @@ public class MongoDbFilterVisitorListTests { "c", "d", - "b" - } + "b", + }, }, new() { @@ -105,11 +105,11 @@ public class MongoDbFilterVisitorListTests { null, "d", - "b" - } + "b", + }, }, new() { Bar = null }, - new() { Bar = Array.Empty() } + new() { Bar = Array.Empty() }, }; public MongoDbFilterVisitorListTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectIdTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectIdTests.cs index b50781eef73..0b5ef2e9162 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectIdTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectIdTests.cs @@ -15,7 +15,7 @@ public class MongoDbFilterVisitorObjectIdTests { new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f69") }, new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f6a") }, - new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f6b") } + new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f6b") }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -23,7 +23,7 @@ public class MongoDbFilterVisitorObjectIdTests new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f69") }, new() { }, new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f6a") }, - new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f6b") } + new() { ObjectId = new ObjectId("6124e80f3f5fc839830c1f6b") }, }; public MongoDbFilterVisitorObjectIdTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectTests.cs index f72f3c37135..ebdf807b32e 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorObjectTests.cs @@ -22,9 +22,9 @@ public class MongoDbFilterVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new Foo { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -36,9 +36,9 @@ public class MongoDbFilterVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 14, BarString = "d" } } - } - } + new() { Foo = new Foo { BarShort = 14, BarString = "d" } }, + }, + }, }, new() { @@ -50,8 +50,8 @@ public class MongoDbFilterVisitorObjectTests BarString = "testctest", //ScalarArray = null, ObjectArray = null, - } - } + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -66,9 +66,9 @@ public class MongoDbFilterVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 12 } } - } - } + new() { Foo = new FooNullable { BarShort = 12 } }, + }, + }, }, new() { @@ -80,9 +80,9 @@ public class MongoDbFilterVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = null } } - } - } + new() { Foo = new FooNullable { BarShort = null } }, + }, + }, }, new() { @@ -94,9 +94,9 @@ public class MongoDbFilterVisitorObjectTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 14, } } - } - } + new() { Foo = new FooNullable { BarShort = 14 } }, + }, + }, }, new() { @@ -106,9 +106,9 @@ public class MongoDbFilterVisitorObjectTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } - } + ObjectArray = null, + }, + }, }; public MongoDbFilterVisitorObjectTests(MongoResource resource) @@ -694,6 +694,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorStringTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorStringTests.cs index 572879743d8..62b8755de1a 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorStringTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorStringTests.cs @@ -13,14 +13,14 @@ public class MongoDbFilterVisitorStringTests private static readonly Foo[] _fooEntities = { new() { Bar = "testatest" }, - new() { Bar = "testbtest" } + new() { Bar = "testbtest" }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = "testatest" }, new() { Bar = "testbtest" }, - new() { Bar = null } + new() { Bar = null }, }; public MongoDbFilterVisitorStringTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorTimeOnlyTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorTimeOnlyTests.cs index 1c800615eec..d2cf5ddfad3 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorTimeOnlyTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorTimeOnlyTests.cs @@ -16,14 +16,14 @@ public class MongoDbFilterVisitorTimeOnlyTests private static readonly Foo[] _fooEntities = { new() { Bar = new TimeOnly(06, 30) }, - new() { Bar = new TimeOnly(16, 00) } + new() { Bar = new TimeOnly(16, 00) }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = new TimeOnly(06, 30) }, new() { Bar = null }, - new() { Bar = new TimeOnly(16, 00) } + new() { Bar = new TimeOnly(16, 00) }, }; public MongoDbFilterVisitorTimeOnlyTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFindFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFindFluentTests.cs index b6f69cd3378..cf20b9c7ac6 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFindFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFindFluentTests.cs @@ -17,20 +17,20 @@ public class MongoDbFindFluentTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly Bar[] _barEntities = { new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, }; private static readonly Baz[] _bazEntities = { new() { Bar = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, new() { Bar = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, - new() { Bar = new DateTimeOffset(1996, 1, 11, 0, 0, 0, TimeSpan.Zero) } + new() { Bar = new DateTimeOffset(1996, 1, 11, 0, 0, 0, TimeSpan.Zero) }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbCursorPagingAggregateFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbCursorPagingAggregateFluentTests.cs index adcf114893b..b239fe72ff1 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbCursorPagingAggregateFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbCursorPagingAggregateFluentTests.cs @@ -19,7 +19,7 @@ public class MongoDbCursorPagingAggregateFluentTests : IClassFixture new Foo { Bar = "b" }, new Foo { Bar = "d" }, new Foo { Bar = "e" }, - new Foo { Bar = "f" } + new Foo { Bar = "f" }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingAggregateTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingAggregateTests.cs index 714cc1e8e10..c0979da31c0 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingAggregateTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingAggregateTests.cs @@ -19,7 +19,7 @@ public class MongoDbOffsetPagingAggregateTests : IClassFixture new Foo { Bar = "b" }, new Foo { Bar = "d" }, new Foo { Bar = "e" }, - new Foo { Bar = "f" } + new Foo { Bar = "f" }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingFindFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingFindFluentTests.cs index 373d9b93308..0befa1709f7 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingFindFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/MongoDbOffsetPagingFindFluentTests.cs @@ -18,7 +18,7 @@ public class MongoDbOffsetPagingFindFluentTests : IClassFixture new Foo { Bar = "b" }, new Foo { Bar = "d" }, new Foo { Bar = "e" }, - new Foo { Bar = "f" } + new Foo { Bar = "f" }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionObjectsTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionObjectsTests.cs index 8cb916cd24c..3cfc28595ec 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionObjectsTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionObjectsTests.cs @@ -18,15 +18,15 @@ public class MongoDbProjectionObjectTests : IClassFixture BarShort = 15, NestedObject = new BarNullableDeep { - Foo = new FooDeep { BarString = "Foo" } - } - } + Foo = new FooDeep { BarString = "Foo" }, + }, + }, }, new() { - Number = 2, Foo = new FooNullable { BarEnum = BarEnum.FOO, BarShort = 14 } + Number = 2, Foo = new FooNullable { BarEnum = BarEnum.FOO, BarShort = 14 }, }, - new() { Number = 2 } + new() { Number = 2 }, }; private readonly SchemaCache _cache; @@ -211,6 +211,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorIsProjectedTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorIsProjectedTests.cs index 20af9e721f0..b66884fc6fd 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorIsProjectedTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorIsProjectedTests.cs @@ -11,13 +11,13 @@ public class MongoDbProjectionVisitorIsProjectedTests private static readonly Foo[] _fooEntities = { new() { IsProjectedTrue = true, IsProjectedFalse = false }, - new() { IsProjectedTrue = true, IsProjectedFalse = false } + new() { IsProjectedTrue = true, IsProjectedFalse = false }, }; private static readonly Bar[] _barEntities = { new() { IsProjectedFalse = false }, - new() { IsProjectedFalse = false } + new() { IsProjectedFalse = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorPagingTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorPagingTests.cs index e6ffae1193a..57bb74ac91f 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorPagingTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorPagingTests.cs @@ -11,14 +11,14 @@ public class MongoDbProjectionVisitorPagingTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true, Baz = "a" }, - new() { Bar = false, Baz = "b" } + new() { Bar = false, Baz = "b" }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true, Baz = "a" }, new() { Bar = null, Baz = null }, - new() { Bar = false, Baz = "c" } + new() { Bar = false, Baz = "c" }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorScalarTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorScalarTests.cs index 2c88acfe2a1..b82f0a3631c 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorScalarTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/MongoDbProjectionVisitorScalarTests.cs @@ -11,7 +11,7 @@ public class MongoDbProjectionVisitorScalarTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true, Baz = "a" }, - new() { Bar = false, Baz = "b" } + new() { Bar = false, Baz = "b" }, }; private readonly SchemaCache _cache; @@ -71,7 +71,7 @@ public async Task Create_ProjectsOneProperty_WithResolver() .Resolve( new[] { - "foo" + "foo", }) .Type>())); diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs index bad746d8045..b587b3c9944 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs @@ -16,14 +16,14 @@ public class MongoDbAggregateFluentTests : IClassFixture { private static readonly Foo[] _fooEntities = { - new Foo { Bar = true }, new Foo { Bar = false } - }; + new Foo { Bar = true }, new Foo { Bar = false }, + }; private static readonly Bar[] _barEntities = { new Bar { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, - new Bar { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } - }; + new Bar { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, + }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs index 4484176212e..1a6e2abae53 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs @@ -16,13 +16,13 @@ public class MongoDbSortCollectionTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly Bar[] _barEntities = { new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs index 0b317b3257f..eea83c72441 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs @@ -17,20 +17,20 @@ public class MongoDbFindFluentTests : IClassFixture private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly Bar[] _barEntities = { new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) }, }; private static readonly Baz[] _bazEntities = { new() { Bar = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero), Qux = 1 }, new() { Bar = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = 0 }, - new() { Bar = new DateTimeOffset(1996, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = -1 } + new() { Bar = new DateTimeOffset(1996, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = -1 }, }; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs index 5b704f251a4..352663bc9db 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs @@ -13,14 +13,14 @@ public class MongoDbSortVisitorBooleanTests private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true }, new() { Bar = null }, - new() { Bar = false } + new() { Bar = false }, }; public MongoDbSortVisitorBooleanTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs index a69c2b1ffb6..c924aecfa9a 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs @@ -14,7 +14,7 @@ public class MongoDbSortVisitorComparableTests { new() { BarShort = 12 }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -22,7 +22,7 @@ public class MongoDbSortVisitorComparableTests new() { BarShort = 12 }, new() { BarShort = null }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; public MongoDbSortVisitorComparableTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs index 57091b64296..832fb1aec83 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs @@ -15,7 +15,7 @@ public class MongoDbSortVisitorEnumTests new() { BarEnum = FooEnum.BAR }, new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -24,7 +24,7 @@ public class MongoDbSortVisitorEnumTests new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, new() { BarEnum = null }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; public MongoDbSortVisitorEnumTests(MongoResource resource) @@ -104,7 +104,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX + QUX, } public class FooSortType : SortInputType diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs index 0a0b2ed2916..35630de281e 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs @@ -22,9 +22,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new Foo { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -36,9 +36,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 14, BarString = "d" } } - } - } + new() { Foo = new Foo { BarShort = 14, BarString = "d" } }, + }, + }, }, new() { @@ -49,8 +49,8 @@ public class MongoDbSortVisitorObjectTests BarEnum = BarEnum.FOO, BarString = "testctest", ObjectArray = null!, - } - } + }, + }, }; private static readonly BarNullable?[] _barNullableEntities = @@ -65,9 +65,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 12 } } - } - } + new() { Foo = new FooNullable { BarShort = 12 } }, + }, + }, }, new() { @@ -79,9 +79,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = null } } - } - } + new() { Foo = new FooNullable { BarShort = null } }, + }, + }, }, new() { @@ -93,9 +93,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 14 } } - } - } + new() { Foo = new FooNullable { BarShort = 14 } }, + }, + }, }, new() { @@ -105,10 +105,10 @@ public class MongoDbSortVisitorObjectTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } + ObjectArray = null, + }, }, - new() { Foo = null } + new() { Foo = null }, }; public MongoDbSortVisitorObjectTests(MongoResource resource) @@ -419,6 +419,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs index 69f1cce3dfd..8008b24ace2 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs @@ -13,14 +13,14 @@ public class MongoDbSortVisitorStringTests private static readonly Foo[] _fooEntities = { new() { Bar = "testatest" }, - new() { Bar = "testbtest" } + new() { Bar = "testbtest" }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = "testatest" }, new() { Bar = "testbtest" }, - new() { Bar = null } + new() { Bar = null }, }; public MongoDbSortVisitorStringTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Types.MongoDb/BsonTypeTests.cs b/src/HotChocolate/MongoDb/test/Types.MongoDb/BsonTypeTests.cs index d24f3263112..a3583872149 100644 --- a/src/HotChocolate/MongoDb/test/Types.MongoDb/BsonTypeTests.cs +++ b/src/HotChocolate/MongoDb/test/Types.MongoDb/BsonTypeTests.cs @@ -113,8 +113,8 @@ await executor.ExecuteAsync( { ["val"] = new Dictionary { - ["foo"] = true - } + ["foo"] = true, + }, }); // assert @@ -146,7 +146,7 @@ await executor.ExecuteAsync( "query Test($val: Bson){ in(val:$val) }", new Dictionary { - ["val"] = new List { "foo", "bar" } + ["val"] = new List { "foo", "bar" }, }); // assert @@ -255,7 +255,7 @@ await executor.ExecuteAsync( "query Test($val: Bson){ in(val:$val) }", new Dictionary { - ["val"] = value + ["val"] = value, }); // assert @@ -1112,7 +1112,7 @@ public void Deserialize_Dictionary() var toDeserialize = new Dictionary { - { "Foo", new StringValueNode("Bar") } + { "Foo", new StringValueNode("Bar") }, }; // act @@ -1139,7 +1139,7 @@ public void Deserialize_NestedDictionary() var toDeserialize = new Dictionary { - { "Foo", new Dictionary { { "Bar", new StringValueNode("Baz") } } } + { "Foo", new Dictionary { { "Bar", new StringValueNode("Baz") } } }, }; // act @@ -1213,7 +1213,7 @@ public class OutputQuery 3, 4, 5, - 6 + 6, }); public BsonDecimal128 Decimal => new(42.123456789123456789123456789123456789123456789m); @@ -1225,7 +1225,7 @@ public class OutputQuery public BsonArray BsonArray => new(new[] { BsonBoolean.False, - BsonBoolean.True + BsonBoolean.True, }); public BsonString String => new("String"); @@ -1248,7 +1248,7 @@ public class OutputQuery 3, 4, 5, - 6 + 6, }), ["Double"] = new BsonDouble(42.23), ["Double"] = new BsonDouble(42.23), @@ -1256,7 +1256,7 @@ public class OutputQuery ["BsonArray"] = new BsonArray(new[] { BsonBoolean.False, - BsonBoolean.True + BsonBoolean.True, }), ["String"] = new BsonString("String"), ["Null"] = BsonNull.Value, @@ -1264,7 +1264,7 @@ public class OutputQuery { ["Int32"] = new BsonInt32(42), ["Int64"] = new BsonInt64(42), - } + }, }; } } diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Helpers/ObjectTypeFactory.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Helpers/ObjectTypeFactory.cs index 54d2943ecc4..fdd786cd6a3 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Helpers/ObjectTypeFactory.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Helpers/ObjectTypeFactory.cs @@ -31,7 +31,7 @@ public static INamedType ParseType(OpenApiWrapperContext context, string typeNam var type = new ObjectType(typeName) { - Description = schema.Description + Description = schema.Description, }; var typeInfo = context.GetSchemaTypeInfo(schema); @@ -70,8 +70,8 @@ private static OutputField CreateField(OpenApiWrapperContext context, OpenApiSch Description = property.Value.Description, ContextData = { - [OpenApiResources.OpenApiPropertyName] = property.Key - } + [OpenApiResources.OpenApiPropertyName] = property.Key, + }, }; ParseType(context, fieldType.NamedType().Name, typeInfo.RootSchema); diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs index 59a8e10773b..367839c6a2b 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs @@ -11,7 +11,11 @@ private OpenApiWrapperPipelineBuilder() public OpenApiWrapperDelegate Build() { OpenApiWrapperDelegate next = _ => { }; - for (var i = _pipeline.Count - 1; i >= 0; i--) next = _pipeline[i].Invoke(next); + for (var i = _pipeline.Count - 1; i >= 0; i--) + { + next = _pipeline[i].Invoke(next); + } + return next; } diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs index 11d1ae71d95..3c64bc0e5d1 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs @@ -79,7 +79,11 @@ private static void AddInputType(OpenApiWrapperContext context, Operation operat private static void AddIfNecessary(OpenApiWrapperContext context, InputObjectType inputObjectType) { - if (context.MutableSchema.Types.ContainsName(inputObjectType.Name)) return; + if (context.MutableSchema.Types.ContainsName(inputObjectType.Name)) + { + return; + } + context.MutableSchema.Types.Add(inputObjectType); } diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs index 9bac554ab20..a9eab8b1b93 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs @@ -23,7 +23,10 @@ private static void CreateMutationType(OpenApiWrapperContext context) { var operations = context.GetMutationOperations(); - if (operations.Count == 0) return; + if (operations.Count == 0) + { + return; + } var mutationType = new ObjectType(OpenApiResources.RootTypeMutation); @@ -31,7 +34,7 @@ private static void CreateMutationType(OpenApiWrapperContext context) { var outputField = new OutputField(GetFieldName(operation.Value.OperationId)) { - Type = context.OperationPayloadTypeLookup[operation.Value.OperationId] + Type = context.OperationPayloadTypeLookup[operation.Value.OperationId], }; if (operation.Value.Parameters.Count > 0 || operation.Value.RequestBody is not null) diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreatePayloadTypesMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreatePayloadTypesMiddleware.cs index 02b2dc346d6..06ba0da0789 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreatePayloadTypesMiddleware.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreatePayloadTypesMiddleware.cs @@ -33,7 +33,7 @@ private static void CreatePayloadType(OpenApiWrapperContext context, Operation o var payloadType = new ObjectType(typeName); var field = new OutputField(OpenApiResources.PayloadSuccessField) { - Type = new ObjectType(nameof(Boolean)) + Type = new ObjectType(nameof(Boolean)), }; payloadType.Fields.Add(field); context.MutableSchema.Types.Add(payloadType); diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateQueryTypeMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateQueryTypeMiddleware.cs index 1842bb7a230..c97944aefc0 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateQueryTypeMiddleware.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateQueryTypeMiddleware.cs @@ -40,7 +40,7 @@ private static void CreateQueryType(OpenApiWrapperContext context) var outputField = new OutputField(OpenApiNamingHelper.GetFieldName(operation.Value.OperationId)) { - Type = type + Type = type, }; ObjectTypeFactory.ParseType(context, type.NamedType().Name, typeInfo.RootSchema); diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs index 49eb04cad2d..283a278db7f 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs @@ -33,7 +33,7 @@ public void Invoke(OpenApiWrapperContext context, OpenApiWrapperDelegate next) ? operationKeyValue.Value.Summary : operationKeyValue.Value.Description, Response = response.Value, - RequestBody = operationKeyValue.Value.RequestBody + RequestBody = operationKeyValue.Value.RequestBody, }; foreach (var openApiParameter in operationKeyValue.Value.Parameters) @@ -41,7 +41,11 @@ public void Invoke(OpenApiWrapperContext context, OpenApiWrapperDelegate next) resultOperation.AddParameter(openApiParameter); } - if (context.Operations.ContainsKey(resultOperation.OperationId)) continue; + if (context.Operations.ContainsKey(resultOperation.OperationId)) + { + continue; + } + context.Operations.Add(resultOperation.OperationId, resultOperation); } } diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/SchemaTypeInfo.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/SchemaTypeInfo.cs index e4d5b90363e..9de28724834 100644 --- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/SchemaTypeInfo.cs +++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/SchemaTypeInfo.cs @@ -89,7 +89,7 @@ private static string GetGraphQLTypeName(string openApiSchemaTypeName, string? f "number" => ScalarNames.Float, "integer" => format == "int64" ? ScalarNames.Long : ScalarNames.Int, "boolean" => ScalarNames.Boolean, - _ => OpenApiNamingHelper.GetTypeName(openApiSchemaTypeName) + _ => OpenApiNamingHelper.GetTypeName(openApiSchemaTypeName), }; return typename ?? throw new InvalidOperationException(); } diff --git a/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs b/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs index 662a7472bc8..299aeb423f7 100644 --- a/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs +++ b/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs @@ -32,7 +32,11 @@ public IActionResult DeletePet([FromRoute] [Required] long? id) { var toDelete = _pets.FirstOrDefault(p => p.Id == id); - if (toDelete is null) return BadRequest("Pet not found"); + if (toDelete is null) + { + return BadRequest("Pet not found"); + } + _pets.Remove(toDelete); return Ok(); diff --git a/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/UberController.cs b/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/UberController.cs index e3f67946fad..b37c5bc4ab7 100644 --- a/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/UberController.cs +++ b/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/UberController.cs @@ -51,7 +51,7 @@ public class UberController private static readonly List _products = new() { new Product("ProductA", "Desc", "Product A", "Cap", "http://img.png"), - new Product("ProductB", "Desc", "Product B", "Cap", "http://img.png") + new Product("ProductB", "Desc", "Product B", "Cap", "http://img.png"), }; [HttpGet] diff --git a/src/HotChocolate/Raven/src/Data/Filtering/Handlers/RavenFilterExpressionBuilder.cs b/src/HotChocolate/Raven/src/Data/Filtering/Handlers/RavenFilterExpressionBuilder.cs index 057ddb6647f..7b9b15b7836 100644 --- a/src/HotChocolate/Raven/src/Data/Filtering/Handlers/RavenFilterExpressionBuilder.cs +++ b/src/HotChocolate/Raven/src/Data/Filtering/Handlers/RavenFilterExpressionBuilder.cs @@ -28,7 +28,7 @@ public static Expression In( { return Expression.Call( _inMethod.MakeGenericMethod(genericType), - new[] { property, Expression.Constant(parsedValue), }); + new[] { property, Expression.Constant(parsedValue) }); } public static Expression IsMatch( @@ -39,6 +39,6 @@ public static Expression IsMatch( return Expression.Call( _isMatch, - new[] { property, Expression.Constant(parsedValue), }); + new[] { property, Expression.Constant(parsedValue) }); } } diff --git a/src/HotChocolate/Raven/src/Data/Filtering/RavenQueryableFilterProvider.cs b/src/HotChocolate/Raven/src/Data/Filtering/RavenQueryableFilterProvider.cs index 3cbce68b17d..1e5a33d9e43 100644 --- a/src/HotChocolate/Raven/src/Data/Filtering/RavenQueryableFilterProvider.cs +++ b/src/HotChocolate/Raven/src/Data/Filtering/RavenQueryableFilterProvider.cs @@ -46,6 +46,6 @@ protected override void Configure(IFilterProviderDescriptor q => new RavenAsyncDocumentQueryExecutable( q.Query.ToQueryable().Where(where).ToAsyncDocumentQuery()), - _ => input + _ => input, }; } diff --git a/src/HotChocolate/Raven/src/Data/Pagination/RavenCursorPagingHandler.cs b/src/HotChocolate/Raven/src/Data/Pagination/RavenCursorPagingHandler.cs index aa8dc7c5fc0..e92a09a9814 100644 --- a/src/HotChocolate/Raven/src/Data/Pagination/RavenCursorPagingHandler.cs +++ b/src/HotChocolate/Raven/src/Data/Pagination/RavenCursorPagingHandler.cs @@ -30,6 +30,6 @@ private static RavenPagingContainer CreatePagingContainer(object source RavenAsyncDocumentQueryExecutable e => e.Query, IRavenQueryable e => e.ToAsyncDocumentQuery(), IAsyncDocumentQuery f => f, - _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()) + _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()), }); } diff --git a/src/HotChocolate/Raven/src/Data/Pagination/RavenOffsetPagingHandler.cs b/src/HotChocolate/Raven/src/Data/Pagination/RavenOffsetPagingHandler.cs index b7a7661f8db..81a1ff02711 100644 --- a/src/HotChocolate/Raven/src/Data/Pagination/RavenOffsetPagingHandler.cs +++ b/src/HotChocolate/Raven/src/Data/Pagination/RavenOffsetPagingHandler.cs @@ -31,7 +31,7 @@ private static RavenPagingContainer CreatePagingContainer(object source RavenAsyncDocumentQueryExecutable e => e.Query, IRavenQueryable e => e.ToAsyncDocumentQuery(), IAsyncDocumentQuery f => f, - _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()) + _ => throw ThrowHelper.PagingTypeNotSupported(source.GetType()), }); } } diff --git a/src/HotChocolate/Raven/src/Data/Projections/RavenQueryableProjectionProvider.cs b/src/HotChocolate/Raven/src/Data/Projections/RavenQueryableProjectionProvider.cs index a9c63d03d9c..d2ff7612816 100644 --- a/src/HotChocolate/Raven/src/Data/Projections/RavenQueryableProjectionProvider.cs +++ b/src/HotChocolate/Raven/src/Data/Projections/RavenQueryableProjectionProvider.cs @@ -35,7 +35,7 @@ protected override void Configure(IProjectionProviderDescriptor descriptor) RavenAsyncDocumentQueryExecutable q => new RavenAsyncDocumentQueryExecutable( q.Query.NoTracking().ToQueryable().Select(projection).ToAsyncDocumentQuery()), - _ => input + _ => input, }; /// diff --git a/src/HotChocolate/Raven/src/Data/Sorting/RavenQueryableSortProvider.cs b/src/HotChocolate/Raven/src/Data/Sorting/RavenQueryableSortProvider.cs index 46e97f73a67..a3a8912b024 100644 --- a/src/HotChocolate/Raven/src/Data/Sorting/RavenQueryableSortProvider.cs +++ b/src/HotChocolate/Raven/src/Data/Sorting/RavenQueryableSortProvider.cs @@ -30,6 +30,6 @@ public RavenQueryableSortProvider( RavenAsyncDocumentQueryExecutable q => new RavenAsyncDocumentQueryExecutable( sort(q.Query.ToQueryable()).ToAsyncDocumentQuery()), - _ => input + _ => input, }; } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ConventionTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ConventionTests.cs index 3de9673a752..ea6db66a39b 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ConventionTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ConventionTests.cs @@ -30,8 +30,8 @@ public class TypeWithList { new() { - List = new List() { new() { Foo = "Foo" }, new() { Foo = "Bar" } } - } + List = new List() { new() { Foo = "Foo" }, new() { Foo = "Bar" } }, + }, }; public string? Id { get; set; } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/FilteringAndPaging.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/FilteringAndPaging.cs index c34fe723957..664c6ce4494 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/FilteringAndPaging.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/FilteringAndPaging.cs @@ -9,7 +9,7 @@ public class FilteringAndPaging private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorBooleanTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorBooleanTests.cs index 46b59ab56e8..305395d35a9 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorBooleanTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorBooleanTests.cs @@ -9,14 +9,14 @@ public class QueryableFilterVisitorBooleanTests private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true }, new() { Bar = null }, - new() { Bar = false } + new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorComparableTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorComparableTests.cs index 0e7d6ccae5e..60c299e1333 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorComparableTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorComparableTests.cs @@ -10,7 +10,7 @@ public class QueryableFilterVisitorComparableTests { new() { BarShort = 12 }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -18,7 +18,7 @@ public class QueryableFilterVisitorComparableTests new() { BarShort = 12 }, new() { BarShort = null }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorEnumTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorEnumTests.cs index baf0141e42e..466e35c778d 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorEnumTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorEnumTests.cs @@ -12,7 +12,7 @@ public class QueryableFilterVisitorEnumTests new() { BarEnum = FooEnum.BAR }, new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -21,7 +21,7 @@ public class QueryableFilterVisitorEnumTests new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, new() { BarEnum = null }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private readonly SchemaCache _cache; @@ -299,7 +299,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX + QUX, } public class FooFilterInput : FilterInputType diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorExecutableTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorExecutableTests.cs index fb142652cdc..37d063e1442 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorExecutableTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorExecutableTests.cs @@ -9,14 +9,14 @@ public class QueryableFilterVisitorExecutableTests private static readonly Foo[] _fooEntities = { new() { Bar = true }, - new() { Bar = false } + new() { Bar = false }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true }, new() { Bar = null }, - new() { Bar = false } + new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs index 676956ef8bd..1bcda630d45 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorInterfacesTests.cs @@ -13,7 +13,7 @@ public class QueryableFilterVisitorInterfacesTests private static readonly BarInterface[] _barEntities = { new() { Test = new InterfaceImpl1 { Prop = "a" } }, - new() { Test = new InterfaceImpl1 { Prop = "b" } } + new() { Test = new InterfaceImpl1 { Prop = "b" } }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorListTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorListTests.cs index 0007c5d71e9..4ff921e5008 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorListTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorListTests.cs @@ -16,37 +16,37 @@ public class QueryableFilterVisitorListTests { FooNested = new List() { - new() { Bar = "a" }, new() { Bar = "a" }, new() { Bar = "a" } - } + new() { Bar = "a" }, new() { Bar = "a" }, new() { Bar = "a" }, + }, }, new() { FooNested = new List() { - new() { Bar = "c" }, new() { Bar = "a" }, new() { Bar = "a" } - } + new() { Bar = "c" }, new() { Bar = "a" }, new() { Bar = "a" }, + }, }, new() { FooNested = new List() { - new() { Bar = "a" }, new() { Bar = "d" }, new() { Bar = "b" } - } + new() { Bar = "a" }, new() { Bar = "d" }, new() { Bar = "b" }, + }, }, new() { FooNested = new List() { - new() { Bar = "c" }, new() { Bar = "d" }, new() { Bar = "b" } - } + new() { Bar = "c" }, new() { Bar = "d" }, new() { Bar = "b" }, + }, }, new() { FooNested = new List() { - new() { Bar = null! }, new() { Bar = "d" }, new() { Bar = "b" } - } - } + new() { Bar = null! }, new() { Bar = "d" }, new() { Bar = "b" }, + }, + }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorObjectTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorObjectTests.cs index d897f4fe366..e3fbf7052b5 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorObjectTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorObjectTests.cs @@ -21,9 +21,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new Foo { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -35,9 +35,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 14, BarString = "d" } } - } - } + new() { Foo = new Foo { BarShort = 14, BarString = "d" } }, + }, + }, }, new() { @@ -48,8 +48,8 @@ public class QueryableFilterVisitorObjectTests BarEnum = BarEnum.FOO, BarString = "testctest", ObjectArray = null, - } - } + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -64,9 +64,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 12 } } - } - } + new() { Foo = new FooNullable { BarShort = 12 } }, + }, + }, }, new() { @@ -78,9 +78,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = null } } - } - } + new() { Foo = new FooNullable { BarShort = null } }, + }, + }, }, new() { @@ -92,9 +92,9 @@ public class QueryableFilterVisitorObjectTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 14 } } - } - } + new() { Foo = new FooNullable { BarShort = 14 } }, + }, + }, }, new() { @@ -104,9 +104,9 @@ public class QueryableFilterVisitorObjectTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } - } + ObjectArray = null, + }, + }, }; private readonly SchemaCache _cache; @@ -705,6 +705,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorStringTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorStringTests.cs index 8b0efeaf043..fde6bb967be 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorStringTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/QueryableFilterVisitorStringTests.cs @@ -11,14 +11,14 @@ public class QueryableFilterVisitorStringTests private static readonly Foo[] _fooEntities = { new() { Bar = "testatest" }, - new() { Bar = "testbtest" } + new() { Bar = "testbtest" }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = "testatest" }, new() { Bar = "testbtest" }, - new() { Bar = null } + new() { Bar = null }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenAsyncDocumentQueryTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenAsyncDocumentQueryTests.cs index 237da87a813..4daa929b479 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenAsyncDocumentQueryTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenAsyncDocumentQueryTests.cs @@ -22,7 +22,7 @@ public class RavenAsyncDocumentQueryTests new Foo { Bar = "b" }, new Foo { Bar = "d" }, new Foo { Bar = "e" }, - new Foo { Bar = "f" } + new Foo { Bar = "f" }, }; private readonly SchemaCache _resource; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenDocumentQueryTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenDocumentQueryTests.cs index c6652a77d4a..f07e33c2057 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenDocumentQueryTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/RavenDocumentQueryTests.cs @@ -22,7 +22,7 @@ public class RavenQueryableTests new Foo { Bar = "b" }, new Foo { Bar = "d" }, new Foo { Bar = "e" }, - new Foo { Bar = "f" } + new Foo { Bar = "f" }, }; private readonly SchemaCache _resource; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableFirstOrDefaultTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableFirstOrDefaultTests.cs index b5e4390e313..b4de68a7e99 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableFirstOrDefaultTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableFirstOrDefaultTests.cs @@ -21,13 +21,13 @@ public class QueryableFirstOrDefaultTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "a" } + Foo = new FooDeep { BarShort = 12, BarString = "a" }, }, ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -40,14 +40,14 @@ public class QueryableFirstOrDefaultTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "d" } + Foo = new FooDeep { BarShort = 12, BarString = "d" }, }, ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } }, + }, + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -62,9 +62,9 @@ public class QueryableFirstOrDefaultTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 12 } } - } - } + new() { Foo = new FooDeep { BarShort = 12 } }, + }, + }, }, new() { @@ -76,9 +76,9 @@ public class QueryableFirstOrDefaultTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 9 } } - } - } + new() { Foo = new FooDeep { BarShort = 9 } }, + }, + }, }, new() { @@ -90,9 +90,9 @@ public class QueryableFirstOrDefaultTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 14 } } - } - } + new() { Foo = new FooDeep { BarShort = 14 } }, + }, + }, }, new() { @@ -102,9 +102,9 @@ public class QueryableFirstOrDefaultTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } - } + ObjectArray = null, + }, + }, }; private readonly SchemaCache _cache; @@ -349,6 +349,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionFilterTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionFilterTests.cs index b28ebb9717e..23f9e39b67c 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionFilterTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionFilterTests.cs @@ -19,9 +19,9 @@ public class QueryableProjectionFilterTests NestedObject = new BarDeep { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -34,10 +34,10 @@ public class QueryableProjectionFilterTests NestedObject = new BarDeep { Foo = new FooDeep { BarShort = 12, BarString = "d" } }, ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } }, + }, + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -52,9 +52,9 @@ public class QueryableProjectionFilterTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 12 } } - } - } + new() { Foo = new FooDeep { BarShort = 12 } }, + }, + }, }, new() { @@ -66,9 +66,9 @@ public class QueryableProjectionFilterTests BarString = "testbtest", ObjectArray = new List { - new BarNullableDeep { Foo = new FooDeep { BarShort = 9 } } - } - } + new BarNullableDeep { Foo = new FooDeep { BarShort = 9 } }, + }, + }, }, new() { @@ -80,9 +80,9 @@ public class QueryableProjectionFilterTests BarString = "testctest", ObjectArray = new List { - new BarNullableDeep { Foo = new FooDeep { BarShort = 14 } } - } - } + new BarNullableDeep { Foo = new FooDeep { BarShort = 14 } }, + }, + }, }, new() { @@ -92,9 +92,9 @@ public class QueryableProjectionFilterTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } - } + ObjectArray = null, + }, + }, }; private static readonly BarNullable[] _barWithoutRelation = @@ -109,20 +109,20 @@ public class QueryableProjectionFilterTests { Foo = new FooDeep { - BarString = "Foo" - } - } - } + BarString = "Foo", + }, + }, + }, }, new() { Foo = new FooNullable { BarEnum = BarEnum.FOO, - BarShort = 14 - } + BarShort = 14, + }, }, - new() + new(), }; private readonly SchemaCache _cache; @@ -447,6 +447,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionHashSetTest.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionHashSetTest.cs index 0c5ab6dae4b..5271193c92f 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionHashSetTest.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionHashSetTest.cs @@ -19,13 +19,13 @@ public class QueryableProjectionHashSetTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "a" } + Foo = new FooDeep { BarShort = 12, BarString = "a" }, }, ObjectSet = new HashSet { - new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -38,14 +38,14 @@ public class QueryableProjectionHashSetTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "d" } + Foo = new FooDeep { BarShort = 12, BarString = "d" }, }, ObjectSet = new HashSet { - new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } }, + }, + }, + }, }; private readonly SchemaCache _cache; @@ -196,6 +196,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionInterfaceTypeTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionInterfaceTypeTests.cs index 8e90ee97969..26172eab2cd 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionInterfaceTypeTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionInterfaceTypeTests.cs @@ -15,7 +15,7 @@ public class QueryableProjectionInterfaceTypeTests private static readonly AbstractType[] _barEntities = { new Bar { Name = "Bar", BarProp = "BarProp" }, - new Foo { Name = "Foo", FooProp = "FooProp" } + new Foo { Name = "Foo", FooProp = "FooProp" }, }; private static readonly NestedObject[] _barNestedEntities = @@ -31,16 +31,16 @@ public class QueryableProjectionInterfaceTypeTests List = new() { new Foo { Name = "Foo", FooProp = "FooProp" }, - new Bar { Name = "Bar", BarProp = "BarProp" } - } + new Bar { Name = "Bar", BarProp = "BarProp" }, + }, }, new() { List = new() { new Bar { Name = "Bar", BarProp = "BarProp" }, - new Foo { Name = "Foo", FooProp = "FooProp" } - } + new Foo { Name = "Foo", FooProp = "FooProp" }, + }, }, }; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionNestedTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionNestedTests.cs index d170ab5da7c..99debc0c64c 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionNestedTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionNestedTests.cs @@ -8,8 +8,8 @@ public class QueryableProjectionNestedTests { private static readonly Bar[] _barEntities = { - new() { Foo = new Foo { BarString = "testatest", } }, - new() { Foo = new Foo { BarString = "testbtest", } } + new() { Foo = new Foo { BarString = "testatest" } }, + new() { Foo = new Foo { BarString = "testbtest" } }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSetTest.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSetTest.cs index 714680d5f40..99490a53aec 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSetTest.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSetTest.cs @@ -20,9 +20,9 @@ public class QueryableProjectionISetTests new BarDeep { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, ObjectSet = new HashSet { - new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -36,10 +36,10 @@ public class QueryableProjectionISetTests new BarDeep { Foo = new FooDeep { BarShort = 12, BarString = "d" } }, ObjectSet = new HashSet { - new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } }, + }, + }, + }, }; private readonly SchemaCache _cache; @@ -190,6 +190,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortedSetTest.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortedSetTest.cs index 58c639d85ed..3e3ee3e3904 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortedSetTest.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortedSetTest.cs @@ -19,13 +19,13 @@ public class QueryableProjectionSortedSetTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "a" } + Foo = new FooDeep { BarShort = 12, BarString = "a" }, }, ObjectSet = new SortedSet { - new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -38,14 +38,14 @@ public class QueryableProjectionSortedSetTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "d" } + Foo = new FooDeep { BarShort = 12, BarString = "d" }, }, ObjectSet = new SortedSet { - new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } }, + }, + }, + }, }; private readonly SchemaCache _cache; @@ -196,6 +196,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortingTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortingTests.cs index 664b5c09cd2..f742d004ad1 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortingTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionSortingTests.cs @@ -21,9 +21,9 @@ public class QueryableProjectionSortingTests { new() { Foo = new FooDeep { BarShort = 1, BarString = "a" } }, new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, - new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } }, + }, + }, }, new() { @@ -38,10 +38,10 @@ public class QueryableProjectionSortingTests { new() { Foo = new FooDeep { BarShort = 1, BarString = "a" } }, new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, - new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } }, + }, + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -59,9 +59,9 @@ public class QueryableProjectionSortingTests { new() { Foo = new FooDeep { BarShort = 1, BarString = "a" } }, new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, - new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } }, + }, + }, }, new() { @@ -73,15 +73,15 @@ public class QueryableProjectionSortingTests BarString = "testbtest", NestedObject = new BarDeepNullable { - Foo = new FooDeep { BarShort = 12, BarString = "a" } + Foo = new FooDeep { BarShort = 12, BarString = "a" }, }, ObjectArray = new List { new() { Foo = new FooDeep { BarShort = 1, BarString = "a" } }, new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, - new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } }, + }, + }, }, new() { @@ -93,15 +93,15 @@ public class QueryableProjectionSortingTests BarString = "testctest", NestedObject = new BarDeepNullable { - Foo = new FooDeep { BarShort = 12, BarString = "a" } + Foo = new FooDeep { BarShort = 12, BarString = "a" }, }, ObjectArray = new List { new() { Foo = new FooDeep { BarShort = 1, BarString = "a" } }, new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, - new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 3, BarString = "a" } }, + }, + }, }, new() { @@ -111,9 +111,9 @@ public class QueryableProjectionSortingTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null! - } - } + ObjectArray = null!, + }, + }, }; private readonly SchemaCache _cache; @@ -356,6 +356,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionUnionTypeTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionUnionTypeTests.cs index c5f738009ec..948550df9ba 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionUnionTypeTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionUnionTypeTests.cs @@ -13,7 +13,7 @@ public class QueryableProjectionUnionTypeTests private static readonly AbstractType[] _barEntities = { new Bar { Name = "Bar", BarProp = "BarProp" }, - new Foo { Name = "Foo", FooProp = "FooProp" } + new Foo { Name = "Foo", FooProp = "FooProp" }, }; private static readonly NestedObject[] _barNestedEntities = @@ -29,16 +29,16 @@ public class QueryableProjectionUnionTypeTests List = new() { new Foo { Name = "Foo", FooProp = "FooProp" }, - new Bar { Name = "Bar", BarProp = "BarProp" } - } + new Bar { Name = "Bar", BarProp = "BarProp" }, + }, }, new() { List = new() { new Bar { Name = "Bar", BarProp = "BarProp" }, - new Foo { Name = "Foo", FooProp = "FooProp" } - } + new Foo { Name = "Foo", FooProp = "FooProp" }, + }, }, }; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorExecutableTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorExecutableTests.cs index 217451bb3af..f2842e2290f 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorExecutableTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorExecutableTests.cs @@ -11,7 +11,7 @@ public class QueryableProjectionVisitorExecutableTests private static readonly Foo[] _fooEntities = { new() { Bar = true, Baz = "a" }, - new() { Bar = false, Baz = "b" } + new() { Bar = false, Baz = "b" }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorIsProjectedTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorIsProjectedTests.cs index 817e4d51f45..6114e76cd1b 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorIsProjectedTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorIsProjectedTests.cs @@ -10,19 +10,19 @@ public class QueryableProjectionVisitorIsProjectedTests private static readonly Foo[] _fooEntities = { new() { IsProjectedTrue = true, IsProjectedFalse = false }, - new() { IsProjectedTrue = true, IsProjectedFalse = false } + new() { IsProjectedTrue = true, IsProjectedFalse = false }, }; private static readonly MultipleFoo[] _fooMultipleEntities = { new() { IsProjectedTrue1 = true, IsProjectedFalse = false }, - new() { IsProjectedTrue1 = true, IsProjectedFalse = false } + new() { IsProjectedTrue1 = true, IsProjectedFalse = false }, }; private static readonly Bar[] _barEntities = { new() { IsProjectedFalse = false }, - new() { IsProjectedFalse = false } + new() { IsProjectedFalse = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorPagingTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorPagingTests.cs index b390359ebfe..5b3fa13f46d 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorPagingTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorPagingTests.cs @@ -14,14 +14,14 @@ public class QueryableProjectionVisitorPagingTests private static readonly Foo[] _fooEntities = { new() { Bar = true, Baz = "a" }, - new() { Bar = false, Baz = "b" } + new() { Bar = false, Baz = "b" }, }; private static readonly FooNullable[] _fooNullableEntities = { new() { Bar = true, Baz = "a" }, new() { Bar = null, Baz = null }, - new() { Bar = false, Baz = "c" } + new() { Bar = false, Baz = "c" }, }; private readonly SchemaCache _cache; @@ -521,7 +521,7 @@ protected override void OnConfigure( new List { new() { BarBaz = "a_a", BarQux = "a_c" }, - new() { BarBaz = "a_b", BarQux = "a_d" } + new() { BarBaz = "a_b", BarQux = "a_d" }, }); } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorScalarTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorScalarTests.cs index 60de58493fe..37d6625cfd2 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorScalarTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableProjectionVisitorScalarTests.cs @@ -10,7 +10,7 @@ public class QueryableProjectionVisitorScalarTests { private static readonly Foo[] _fooEntities = { - new() { Bar = true, Baz = "a" }, new() { Bar = false, Baz = "b" } + new() { Bar = true, Baz = "a" }, new() { Bar = false, Baz = "b" }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableSingleOrDefaultTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableSingleOrDefaultTests.cs index d436ac2c9dd..d149e55d662 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableSingleOrDefaultTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/QueryableSingleOrDefaultTests.cs @@ -19,13 +19,13 @@ public class QueryableSingleOrDefaultTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "a" } + Foo = new FooDeep { BarShort = 12, BarString = "a" }, }, ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new FooDeep { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -38,14 +38,14 @@ public class QueryableSingleOrDefaultTests NestedObject = new BarDeep { - Foo = new FooDeep { BarShort = 12, BarString = "d" } + Foo = new FooDeep { BarShort = 12, BarString = "d" }, }, ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } } - } - } - } + new() { Foo = new FooDeep { BarShort = 14, BarString = "d" } }, + }, + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -60,9 +60,9 @@ public class QueryableSingleOrDefaultTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 12 } } - } - } + new() { Foo = new FooDeep { BarShort = 12 } }, + }, + }, }, new() { @@ -74,9 +74,9 @@ public class QueryableSingleOrDefaultTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 9 } } - } - } + new() { Foo = new FooDeep { BarShort = 9 } }, + }, + }, }, new() { @@ -88,9 +88,9 @@ public class QueryableSingleOrDefaultTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooDeep { BarShort = 14 } } - } - } + new() { Foo = new FooDeep { BarShort = 14 } }, + }, + }, }, new() { @@ -100,9 +100,9 @@ public class QueryableSingleOrDefaultTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null - } - } + ObjectArray = null, + }, + }, }; private readonly SchemaCache _cache; @@ -347,6 +347,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorBooleanTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorBooleanTests.cs index a382e9c2927..2d666f52782 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorBooleanTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorBooleanTests.cs @@ -10,7 +10,7 @@ public class QueryableSortVisitorBooleanTests private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = true }, new() { Bar = null }, new() { Bar = false } + new() { Bar = true }, new() { Bar = null }, new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorComparableTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorComparableTests.cs index f9062e91f59..66c47a605c3 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorComparableTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorComparableTests.cs @@ -8,7 +8,7 @@ public class QueryableSortVisitorComparableTests { private static readonly Foo[] _fooEntities = { - new() { BarShort = 12 }, new() { BarShort = 14 }, new() { BarShort = 13 } + new() { BarShort = 12 }, new() { BarShort = 14 }, new() { BarShort = 13 }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -16,7 +16,7 @@ public class QueryableSortVisitorComparableTests new() { BarShort = 12 }, new() { BarShort = null }, new() { BarShort = 14 }, - new() { BarShort = 13 } + new() { BarShort = 13 }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorEnumTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorEnumTests.cs index 0a47c8346c9..19c5f4f4b4d 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorEnumTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorEnumTests.cs @@ -12,7 +12,7 @@ public class QueryableSortVisitorEnumTests new() { BarEnum = FooEnum.BAR }, new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private static readonly FooNullable[] _fooNullableEntities = @@ -21,7 +21,7 @@ public class QueryableSortVisitorEnumTests new() { BarEnum = FooEnum.BAZ }, new() { BarEnum = FooEnum.FOO }, new() { BarEnum = null }, - new() { BarEnum = FooEnum.QUX } + new() { BarEnum = FooEnum.QUX }, }; private readonly SchemaCache _cache; @@ -101,7 +101,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX + QUX, } public class FooSortType : SortInputType diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExecutableTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExecutableTests.cs index c23eccf04fe..bf2fcf29a88 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExecutableTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExecutableTests.cs @@ -11,7 +11,7 @@ public class QueryableSortVisitorExecutableTests private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = true }, new() { Bar = null }, new() { Bar = false } + new() { Bar = true }, new() { Bar = null }, new() { Bar = false }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExpressionTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExpressionTests.cs index 761175e9d9e..7cf0594bc38 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExpressionTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorExpressionTests.cs @@ -15,8 +15,8 @@ public class QueryableSortVisitorExpressionTests { Name = "Foo", LastName = "Galoo", - Bars = new List() { new() { Value = "A" } } - } + Bars = new List() { new() { Value = "A" } }, + }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorObjectTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorObjectTests.cs index 0df087648bb..6c6fb00ed60 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorObjectTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorObjectTests.cs @@ -18,9 +18,9 @@ public class QueryableSortVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new Foo { BarShort = 12, BarString = "a" } } - } - } + new() { Foo = new Foo { BarShort = 12, BarString = "a" } }, + }, + }, }, new() { @@ -38,11 +38,11 @@ public class QueryableSortVisitorObjectTests Foo = new Foo { //ScalarArray = new[] { "c", "d", "b" } - BarShort = 14, BarString = "d" - } - } - } - } + BarShort = 14, BarString = "d", + }, + }, + }, + }, }, new() { @@ -54,8 +54,8 @@ public class QueryableSortVisitorObjectTests BarString = "testctest", //ScalarArray = null, ObjectArray = null, - } - } + }, + }, }; private static readonly BarNullable[] _barNullableEntities = @@ -77,10 +77,10 @@ public class QueryableSortVisitorObjectTests { //ScalarArray = new[] { "c", "d", "a" } BarShort = 12, - } - } - } - } + }, + }, + }, + }, }, new() { @@ -99,10 +99,10 @@ public class QueryableSortVisitorObjectTests { //ScalarArray = new[] { "c", "d", "b" } BarShort = null, - } - } - } - } + }, + }, + }, + }, }, new() { @@ -121,10 +121,10 @@ public class QueryableSortVisitorObjectTests { //ScalarArray = new[] { "c", "d", "b" } BarShort = 14, - } - } - } - } + }, + }, + }, + }, }, new() { @@ -135,10 +135,10 @@ public class QueryableSortVisitorObjectTests BarEnum = BarEnum.FOO, BarString = "testdtest", //ScalarArray = null, - ObjectArray = null - } + ObjectArray = null, + }, }, - new() { Foo = null } + new() { Foo = null }, }; private readonly SchemaCache _cache; @@ -478,10 +478,10 @@ query testSort($order: [BarSortInput!]) { "foo", new Dictionary { - { "barShort", "ASC" }, { "barBool", "ASC" } + { "barShort", "ASC" }, { "barBool", "ASC" }, } - } - } + }, + }, }) .Create()); @@ -505,14 +505,14 @@ query testSort($order: [BarSortInput!]) { { { "foo", new Dictionary { { "barShort", "ASC" } } - } + }, }, new() { { "foo", new Dictionary { { "barBool", "ASC" } } - } - } + }, + }, }) .Create()); @@ -538,10 +538,10 @@ query testSort($order: [BarSortInput!]) { "foo", new Dictionary { - { "barShort", "DESC" }, { "barBool", "DESC" } + { "barShort", "DESC" }, { "barBool", "DESC" }, } - } - } + }, + }, }) .Create()); @@ -565,14 +565,14 @@ query testSort($order: [BarSortInput!]) { { { "foo", new Dictionary { { "barShort", "DESC" } } - } + }, }, new() { { "foo", new Dictionary { { "barBool", "DESC" } } - } - } + }, + }, }) .Create()); @@ -651,6 +651,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX + QUX, } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorStringTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorStringTests.cs index bf65032f8e4..4bf60466376 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorStringTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/QueryableSortVisitorStringTests.cs @@ -8,12 +8,12 @@ public class QueryableSortVisitorStringTests { private static readonly Foo[] _fooEntities = { - new() { Bar = "testatest" }, new() { Bar = "testbtest" } + new() { Bar = "testatest" }, new() { Bar = "testbtest" }, }; private static readonly FooNullable[] _fooNullableEntities = { - new() { Bar = "testatest" }, new() { Bar = "testbtest" }, new() { Bar = null } + new() { Bar = "testatest" }, new() { Bar = "testbtest" }, new() { Bar = null }, }; private readonly SchemaCache _cache; diff --git a/src/HotChocolate/Raven/test/Data.Raven.Tests/FluentApiTests.cs b/src/HotChocolate/Raven/test/Data.Raven.Tests/FluentApiTests.cs index 3eeef47a1a0..07561e20db4 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Tests/FluentApiTests.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Tests/FluentApiTests.cs @@ -261,7 +261,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) .Resolve(ctx => ctx.AsyncSession().Query()) .UsePaging>(options: new PagingOptions() { - ProviderName = RavenPagination.ProviderName, IncludeTotalCount = true + ProviderName = RavenPagination.ProviderName, IncludeTotalCount = true, }) .UseProjection() .UseSorting() @@ -271,7 +271,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) .Resolve(ctx => ctx.AsyncSession().Query().AsExecutable()) .UsePaging>(options: new PagingOptions() { - ProviderName = RavenPagination.ProviderName, IncludeTotalCount = true + ProviderName = RavenPagination.ProviderName, IncludeTotalCount = true, }); descriptor.Field("pagingRaven") diff --git a/src/HotChocolate/Spatial/src/Types/GeoJsonGeometryType.cs b/src/HotChocolate/Spatial/src/Types/GeoJsonGeometryType.cs index 83c02a89981..441cad5bd43 100644 --- a/src/HotChocolate/Spatial/src/Types/GeoJsonGeometryType.cs +++ b/src/HotChocolate/Spatial/src/Types/GeoJsonGeometryType.cs @@ -8,5 +8,5 @@ public enum GeoJsonGeometryType MultiLineString, Polygon, MultiPolygon, - GeometryCollection + GeometryCollection, } diff --git a/src/HotChocolate/Spatial/src/Types/GeoJsonResolvers.cs b/src/HotChocolate/Spatial/src/Types/GeoJsonResolvers.cs index 5941e3e77df..76f9d720b3c 100644 --- a/src/HotChocolate/Spatial/src/Types/GeoJsonResolvers.cs +++ b/src/HotChocolate/Spatial/src/Types/GeoJsonResolvers.cs @@ -27,7 +27,7 @@ public GeoJsonGeometryType GetType([Parent] Geometry geometry) => OgcGeometryType.MultiPoint => GeoJsonGeometryType.MultiPoint, OgcGeometryType.MultiLineString => GeoJsonGeometryType.MultiLineString, OgcGeometryType.MultiPolygon => GeoJsonGeometryType.MultiPolygon, - _ => throw Resolver_Type_InvalidGeometryType() + _ => throw Resolver_Type_InvalidGeometryType(), }; public IReadOnlyCollection GetBbox([Parent] Geometry geometry) diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonInputObjectSerializer.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonInputObjectSerializer.cs index 83f13a052e9..162b2b27960 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonInputObjectSerializer.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonInputObjectSerializer.cs @@ -59,7 +59,7 @@ public override bool TrySerialize( GeoJsonTypeSerializer.Default.Serialize(type, _geometryType) ?? throw Serializer_CouldNotSerialize(type) }, - { CrsFieldName, g.SRID } + { CrsFieldName, g.SRID }, }; return true; @@ -151,7 +151,7 @@ public override IValueNode ParseResult(IType type, object? resultValue) { new ObjectFieldNode( TypeFieldName, - GeoJsonTypeSerializer.Default.ParseResult(type, _geometryType)) + GeoJsonTypeSerializer.Default.ParseResult(type, _geometryType)), }; if (dict.TryGetValue(CoordinatesFieldName, out var value) && @@ -211,7 +211,7 @@ public override IValueNode ParseValue(IType type, object? runtimeValue) ParseCoordinateValue(type, geometry)), new ObjectFieldNode( CrsFieldName, - new IntValueNode(geometry.SRID)) + new IntValueNode(geometry.SRID)), }; return new ObjectValueNode(list); diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiLineStringSerializer.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiLineStringSerializer.cs index c75ee4ea6bc..8086007e336 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiLineStringSerializer.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiLineStringSerializer.cs @@ -139,7 +139,7 @@ public override IValueNode ParseValue(IType type, object? runtimeValue) ParseCoordinateValue(type, geometry)), new ObjectFieldNode( CrsFieldName, - new IntValueNode(geometry.SRID)) + new IntValueNode(geometry.SRID)), }; return new ObjectValueNode(list); diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiPolygonSerializer.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiPolygonSerializer.cs index 41a114564e1..3f0a5cfbc20 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiPolygonSerializer.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonMultiPolygonSerializer.cs @@ -131,7 +131,7 @@ public override IValueNode ParseValue(IType type, object? runtimeValue) ParseCoordinateValue(type, geometry)), new ObjectFieldNode( CrsFieldName, - new IntValueNode(geometry.SRID)) + new IntValueNode(geometry.SRID)), }; return new ObjectValueNode(list); diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPolygonSerializer.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPolygonSerializer.cs index 51da755ddbc..d5688574d4f 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPolygonSerializer.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPolygonSerializer.cs @@ -128,7 +128,7 @@ public override IValueNode ParseValue(IType type, object? runtimeValue) type, GeoJsonGeometryType.Polygon)), new(CoordinatesFieldName, ParseCoordinateValue(type, geometry)), - new(CrsFieldName, new IntValueNode(geometry.SRID)) + new(CrsFieldName, new IntValueNode(geometry.SRID)), }; return new ObjectValueNode(list); diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPositionSerializer.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPositionSerializer.cs index 25a803f544a..a782a7d6757 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPositionSerializer.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonPositionSerializer.cs @@ -290,16 +290,16 @@ public override bool TrySerialize(IType type, object? value, out object? seriali { coordinate.X, coordinate.Y, - coordinate.Z - }; + coordinate.Z, + }; return true; } serialized = new[] { coordinate.X, - coordinate.Y - }; + coordinate.Y, + }; return true; } diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonSerializers.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonSerializers.cs index 354b5272363..7682dada17e 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonSerializers.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonSerializers.cs @@ -16,7 +16,7 @@ public static readonly IReadOnlyDictionary @@ -28,7 +28,7 @@ public static readonly IReadOnlyDictionary ["LineString"] = GeoJsonLineStringSerializer.Default, ["MultiLineString"] = GeoJsonMultiLineStringSerializer.Default, ["Polygon"] = GeoJsonPolygonSerializer.Default, - ["MultiPolygon"] = GeoJsonMultiPolygonSerializer.Default + ["MultiPolygon"] = GeoJsonMultiPolygonSerializer.Default, }; public static readonly IReadOnlyDictionary diff --git a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonTypeSerializer.cs b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonTypeSerializer.cs index 224181cf18e..44941728677 100644 --- a/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonTypeSerializer.cs +++ b/src/HotChocolate/Spatial/src/Types/Serialization/GeoJsonTypeSerializer.cs @@ -17,7 +17,7 @@ internal class GeoJsonTypeSerializer : GeoJsonSerializerBase _valueLookup = diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs index 39c833d07f1..21352c26408 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs @@ -16,7 +16,7 @@ public class QueryableFilterVisitorContainsTests : SchemaCache new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(2, 0), - new Coordinate(0, 0) + new Coordinate(0, 0), })); private static readonly Polygon _falsePolygon = new( @@ -26,13 +26,13 @@ public class QueryableFilterVisitorContainsTests : SchemaCache new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(-2, 0), - new Coordinate(0, 0) + new Coordinate(0, 0), })); private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableFilterVisitorContainsTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs index 38b644461f8..5d443c9b32a 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs @@ -17,7 +17,7 @@ public class QueryableFilterVisitorDistanceTests new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(2, 0), - new Coordinate(0, 0) + new Coordinate(0, 0), })); private static readonly Polygon _falsePolygon = new( @@ -27,13 +27,13 @@ public class QueryableFilterVisitorDistanceTests new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(-2, 0), - new Coordinate(0, 0) + new Coordinate(0, 0), })); private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableFilterVisitorDistanceTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs index d008481bdfb..483a8dac015 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs @@ -33,7 +33,7 @@ public class QueryableFilterVisitorIntersectsTests private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableFilterVisitorIntersectsTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs index 7fd3b8df412..323f739e906 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs @@ -18,7 +18,7 @@ public class QueryableFilterVisitorOverlapsTests : SchemaCache new Coordinate(140, 20), new Coordinate(20, 20), new Coordinate(70, 70), - new Coordinate(150, 150) + new Coordinate(150, 150), })); private static readonly Polygon _falsePolygon = @@ -34,7 +34,7 @@ public class QueryableFilterVisitorOverlapsTests : SchemaCache private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableFilterVisitorOverlapsTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs index 3751ad6e8dd..2935d696f8d 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs @@ -16,7 +16,7 @@ public class QueryableFilterVisitorTouchesTests : SchemaCache new Coordinate(160, 20), new Coordinate(20, 20), new Coordinate(20, 120), - new Coordinate(140, 120) + new Coordinate(140, 120), })); private static readonly Polygon _falsePolygon = @@ -32,7 +32,7 @@ public class QueryableFilterVisitorTouchesTests : SchemaCache private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableFilterVisitorTouchesTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs index 23d1bea0264..59031ccdea9 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs @@ -32,7 +32,7 @@ public class QueryableFilterVisitorWithinTests : SchemaCache private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableFilterVisitorWithinTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/QueryableFilterVisitorTests.cs b/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/QueryableFilterVisitorTests.cs index 62bb05974be..d08e1fd114e 100644 --- a/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/QueryableFilterVisitorTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/QueryableFilterVisitorTests.cs @@ -18,7 +18,7 @@ public class QueryableProjectionVisitorTests new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(2, 0), - new Coordinate(0, 0) + new Coordinate(0, 0), })); private static readonly Polygon _falsePolygon = @@ -29,13 +29,13 @@ public class QueryableProjectionVisitorTests new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(-2, 0), - new Coordinate(0, 0) + new Coordinate(0, 0), })); private static readonly Foo[] _fooEntities = { new() { Id = 1, Bar = _truePolygon }, - new() { Id = 2, Bar = _falsePolygon } + new() { Id = 2, Bar = _falsePolygon }, }; public QueryableProjectionVisitorTests(PostgreSqlResource resource) diff --git a/src/HotChocolate/Spatial/test/Data.Tests/Expressions/QueryableFilterVisitorGeometryTests.cs b/src/HotChocolate/Spatial/test/Data.Tests/Expressions/QueryableFilterVisitorGeometryTests.cs index 2ae4aa055c6..65c1bfe0096 100644 --- a/src/HotChocolate/Spatial/test/Data.Tests/Expressions/QueryableFilterVisitorGeometryTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Tests/Expressions/QueryableFilterVisitorGeometryTests.cs @@ -38,8 +38,8 @@ public void Line_Contains_Point() { new Coordinate(10, 20), new Coordinate(20, 20), - new Coordinate(30, 20) - }) + new Coordinate(30, 20), + }), }; Assert.True(func(a)); @@ -49,8 +49,8 @@ public void Line_Contains_Point() { new Coordinate(10, 10), new Coordinate(20, 10), - new Coordinate(30, 10) - }) + new Coordinate(30, 10), + }), }; Assert.False(func(b)); } @@ -86,8 +86,8 @@ public void Polygon_Contains_Buffered_Point() new Coordinate(0, 6), new Coordinate(6, 6), new Coordinate(6, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.True(func(a), "polygon a does not contain the buffered point"); @@ -100,8 +100,8 @@ public void Polygon_Contains_Buffered_Point() new Coordinate(6, 6), new Coordinate(4, 4), new Coordinate(6, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.False(func(b), "polygon c contains the buffered point"); } @@ -140,8 +140,8 @@ public void Point_to_Line() { new Coordinate(2, 0), new Coordinate(0, 0), - new Coordinate(1, 0) - }) + new Coordinate(1, 0), + }), }; Assert.True(func(a)); @@ -151,8 +151,8 @@ public void Point_to_Line() { new Coordinate(0.5, 0.5), new Coordinate(0, 0), - new Coordinate(1, 0) - }) + new Coordinate(1, 0), + }), }; Assert.False(func(b)); } @@ -184,8 +184,8 @@ public void Line_to_Line() Bar = new LineString(new[] { new Coordinate(0, 0), - new Coordinate(1, 0) - }) + new Coordinate(1, 0), + }), }; Assert.True(func(a)); } @@ -220,8 +220,8 @@ public void Point_in_Poly() new Coordinate(0, 0), new Coordinate(1, 2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.True(func(a)); @@ -232,8 +232,8 @@ public void Point_in_Poly() new Coordinate(0, 0), new Coordinate(1, -2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.False(func(b)); } @@ -265,8 +265,8 @@ public void Line_in_Poly() new Coordinate(0, 0), new Coordinate(1, 2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.True(func(a)); @@ -277,8 +277,8 @@ public void Line_in_Poly() new Coordinate(0, 0), new Coordinate(1, -2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.False(func(b)); } @@ -310,8 +310,8 @@ public void Poly_in_Poly() new Coordinate(0, 0), new Coordinate(1, 2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.True(func(a)); @@ -322,8 +322,8 @@ public void Poly_in_Poly() new Coordinate(0, 0), new Coordinate(1, -2), new Coordinate(2, -1), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.False(func(b)); } @@ -357,8 +357,8 @@ public void Line_and_Line() { new Coordinate(0, 0), new Coordinate(1, 2), - new Coordinate(2, 0) - }) + new Coordinate(2, 0), + }), }; Assert.True(func(a)); @@ -368,8 +368,8 @@ public void Line_and_Line() { new Coordinate(0, 0), new Coordinate(1, -2), - new Coordinate(2, 0) - }) + new Coordinate(2, 0), + }), }; Assert.False(func(b)); } @@ -401,8 +401,8 @@ public void Poly_and_Poly() new Coordinate(0, 0), new Coordinate(1, 2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.True(func(a)); @@ -413,8 +413,8 @@ public void Poly_and_Poly() new Coordinate(0, 0), new Coordinate(1, -2), new Coordinate(2, -1), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.False(func(b)); } @@ -445,13 +445,13 @@ public void Point_Within_Line() // assert var a = new Foo { - Bar = new Point(20, 20) + Bar = new Point(20, 20), }; Assert.True(func(a)); var b = new Foo { - Bar = new Point(20, 30) + Bar = new Point(20, 30), }; Assert.False(func(b)); } @@ -487,8 +487,8 @@ public void Polygon_Within_Buffered_Point() new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(2, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.True(func(a)); @@ -501,8 +501,8 @@ public void Polygon_Within_Buffered_Point() new Coordinate(9, 9), new Coordinate(3, 3), new Coordinate(9, 0), - new Coordinate(0, 0) - })) + new Coordinate(0, 0), + })), }; Assert.False(func(b)); } diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringSerializerTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringSerializerTests.cs index 678b539b114..9482d60511a 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringSerializerTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringSerializerTests.cs @@ -23,8 +23,8 @@ public class GeoJsonLineStringSerializerTests { new Coordinate(30, 10), new Coordinate(10, 30), - new Coordinate(40, 40) - }); + new Coordinate(40, 40), + }); private readonly string _geometryType = "LineString"; @@ -32,8 +32,8 @@ public class GeoJsonLineStringSerializerTests { new[] { 30.0, 10.0 }, new[] { 10.0, 30.0 }, - new[] { 40.0, 40.0 } - }; + new[] { 40.0, 40.0 }, + }; [Theory] [InlineData(GeometryTypeName)] @@ -424,7 +424,7 @@ public void Deserialize_Should_Pass_When_AllFieldsInDictionary(string typeName) { { WellKnownFields.TypeFieldName, _geometryType }, { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, 26912 } + { WellKnownFields.CrsFieldName, 26912 }, }; // act @@ -445,7 +445,7 @@ public void Deserialize_Should_Pass_When_CrsIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CoordinatesFieldName, _geometryParsed } + { WellKnownFields.CoordinatesFieldName, _geometryParsed }, }; // act @@ -466,7 +466,7 @@ public void Deserialize_Should_Fail_When_TypeNameIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act @@ -486,7 +486,7 @@ public void Deserialize_Should_When_CoordinatesAreMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringTypeTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringTypeTests.cs index 1de04d18cc6..39f00e91d38 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringTypeTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonLineStringTypeTests.cs @@ -11,7 +11,7 @@ public class GeoJsonLineStringTypeTests { new Coordinate(30, 10), new Coordinate(10, 30), - new Coordinate(40, 40) + new Coordinate(40, 40), }); [Fact] diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringSerializerTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringSerializerTests.cs index 4e2ee13d983..154a27fe6bc 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringSerializerTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringSerializerTests.cs @@ -40,15 +40,15 @@ public class GeoJsonMultiLineStringSerializerTests { new Coordinate(10, 10), new Coordinate(20, 20), - new Coordinate(10, 40) + new Coordinate(10, 40), }), new LineString(new[] { new Coordinate(40, 40), new Coordinate(30, 30), new Coordinate(40, 20), - new Coordinate(30, 10) - }) + new Coordinate(30, 10), + }), }); private readonly string _geometryType = "MultiLineString"; @@ -59,16 +59,16 @@ public class GeoJsonMultiLineStringSerializerTests { new[] { 10.0, 10.0 }, new[] { 20.0, 20.0 }, - new[] { 10.0, 40.0 } + new[] { 10.0, 40.0 }, }, new[] { new[] { 40.0, 40.0 }, new[] { 30.0, 30.0 }, new[] { 40.0, 20.0 }, - new[] { 30.0, 10.0 } - } - }; + new[] { 30.0, 10.0 }, + }, + }; [Theory] [InlineData(GeometryTypeName)] @@ -494,7 +494,7 @@ public void Deserialize_Should_Pass_When_AllFieldsInDictionary(string typeName) { { WellKnownFields.TypeFieldName, _geometryType }, { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, 26912 } + { WellKnownFields.CrsFieldName, 26912 }, }; // act @@ -516,7 +516,7 @@ public void Deserialize_Should_Pass_When_CrsIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CoordinatesFieldName, _geometryParsed } + { WellKnownFields.CoordinatesFieldName, _geometryParsed }, }; // act @@ -538,7 +538,7 @@ public void Deserialize_Should_Fail_WhenTypeNameIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act @@ -558,7 +558,7 @@ public void Deserialize_Should_When_CoordinatesAreMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringTypeTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringTypeTests.cs index 0b3ba19e88c..014ede70802 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringTypeTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiLineStringTypeTests.cs @@ -14,15 +14,15 @@ public class GeoJsonMultiLineStringTypeTests { new Coordinate(10, 10), new Coordinate(20, 20), - new Coordinate(10, 40) + new Coordinate(10, 40), }), new LineString(new[] { new Coordinate(40, 40), new Coordinate(30, 30), new Coordinate(40, 20), - new Coordinate(30, 10) - }) + new Coordinate(30, 10), + }), }); [Fact] diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPointSerializerTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPointSerializerTests.cs index d4aa8465e75..83b119468a2 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPointSerializerTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPointSerializerTests.cs @@ -37,7 +37,7 @@ public class GeoJsonMultiPointSerializerTests new[] { 10.0, 40.0 }, new[] { 40.0, 30.0 }, new[] { 20.0, 20.0 }, - new[] { 30.0, 10.0 } + new[] { 30.0, 10.0 }, }; [Theory] @@ -437,7 +437,7 @@ public void Deserialize_Should_Pass_When_AllFieldsInDictionary(string typeName) { { WellKnownFields.TypeFieldName, _geometryType }, { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, 26912 } + { WellKnownFields.CrsFieldName, 26912 }, }; // act @@ -458,7 +458,7 @@ public void Deserialize_Should_Pass_When_CrsIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CoordinatesFieldName, _geometryParsed } + { WellKnownFields.CoordinatesFieldName, _geometryParsed }, }; // act @@ -479,7 +479,7 @@ public void Deserialize_Should_Fail_WhentypeNameIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act @@ -498,7 +498,7 @@ public void Deserialize_Should_When_CoordinatesAreMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonSerializerTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonSerializerTests.cs index a7b75023ae5..70cd4d2a9e7 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonSerializerTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonSerializerTests.cs @@ -51,7 +51,7 @@ public class GeoJsonMultiPolygonSerializerTests new Coordinate(30, 20), new Coordinate(45, 40), new Coordinate(10, 40), - new Coordinate(30, 20) + new Coordinate(30, 20), })), new Polygon( new LinearRing( @@ -61,8 +61,8 @@ public class GeoJsonMultiPolygonSerializerTests new Coordinate(40, 10), new Coordinate(10, 20), new Coordinate(5, 15), - new Coordinate(15, 5) - })) + new Coordinate(15, 5), + })), }); private readonly string _geometryType = "MultiPolygon"; @@ -76,8 +76,8 @@ public class GeoJsonMultiPolygonSerializerTests new[] { 30.0, 20.0 }, new[] { 45.0, 40.0 }, new[] { 10.0, 40.0 }, - new[] { 30.0, 20.0 } - } + new[] { 30.0, 20.0 }, + }, }, new[] { @@ -87,10 +87,10 @@ public class GeoJsonMultiPolygonSerializerTests new[] { 40.0, 10.0 }, new[] { 10.0, 20.0 }, new[] { 5.0, 15.0 }, - new[] { 15.0, 5.0 } - } - } - }; + new[] { 15.0, 5.0 }, + }, + }, + }; [Theory] [InlineData(GeometryTypeName)] @@ -515,7 +515,7 @@ public void Deserialize_Should_Pass_When_AllFieldsInDictionary(string typeName) { { WellKnownFields.TypeFieldName, _geometryType }, { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, 26912 } + { WellKnownFields.CrsFieldName, 26912 }, }; // act @@ -536,7 +536,7 @@ public void Deserialize_Should_Pass_When_CrsIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CoordinatesFieldName, _geometryParsed } + { WellKnownFields.CoordinatesFieldName, _geometryParsed }, }; // act @@ -557,7 +557,7 @@ public void Deserialize_Should_Fail_WhenTypeNameIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act @@ -576,7 +576,7 @@ public void Deserialize_Should_When_CoordinatesAreMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonTypeTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonTypeTests.cs index a7e9e921043..7912bf48c06 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonTypeTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonTypeTests.cs @@ -14,7 +14,7 @@ public class GeoJsonMultiPolygonTypeTests new Coordinate(30, 20), new Coordinate(45, 40), new Coordinate(10, 40), - new Coordinate(30, 20) + new Coordinate(30, 20), })), new Polygon(new LinearRing(new[] { @@ -22,8 +22,8 @@ public class GeoJsonMultiPolygonTypeTests new Coordinate(40, 10), new Coordinate(10, 20), new Coordinate(5, 15), - new Coordinate(15, 5) - })) + new Coordinate(15, 5), + })), }); [Fact] diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPointSerializerTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPointSerializerTests.cs index bfcbd8d2e28..4948a57536d 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPointSerializerTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPointSerializerTests.cs @@ -443,7 +443,7 @@ public void Deserialize_Should_Pass_When_AllFieldsInDictionary(string typeName) { { WellKnownFields.TypeFieldName, _geometryType }, { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, 26912 } + { WellKnownFields.CrsFieldName, 26912 }, }; // act @@ -464,7 +464,7 @@ public void Deserialize_Should_Pass_When_CrsIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CoordinatesFieldName, _geometryParsed } + { WellKnownFields.CoordinatesFieldName, _geometryParsed }, }; // act @@ -485,7 +485,7 @@ public void Deserialize_Should_Fail_WhenTypeNameIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act @@ -504,7 +504,7 @@ public void Deserialize_Should_When_CoordinatesAreMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonSerializerTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonSerializerTests.cs index 452f39ba10c..bf0a44ef01b 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonSerializerTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonSerializerTests.cs @@ -33,7 +33,7 @@ public class GeoJsonPolygonSerializerTests new Coordinate(40, 40), new Coordinate(20, 40), new Coordinate(10, 20), - new Coordinate(30, 10) + new Coordinate(30, 10), })); private readonly string _geometryType = "Polygon"; @@ -45,30 +45,30 @@ public class GeoJsonPolygonSerializerTests new[] { 30.0, - 10.0 + 10.0, }, new[] { 40.0, - 40.0 + 40.0, }, new[] { 20.0, - 40.0 + 40.0, }, new[] { 10.0, - 20.0 + 20.0, }, new[] { 30.0, - 10.0 - } - } - }; + 10.0, + }, + }, + }; [Theory] [InlineData(GeometryTypeName)] @@ -175,7 +175,7 @@ public void IsInstanceOfType_Should_Fail_When_DifferentGeoJsonObject(string type GeometryFactory.Default.CreateGeometryCollection( new Geometry[] { - new Point(1, 2) + new Point(1, 2), }))); } @@ -501,7 +501,7 @@ public void Deserialize_Should_Pass_When_AllFieldsInDictionary(string typeName) { { WellKnownFields.TypeFieldName, _geometryType }, { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, 26912 } + { WellKnownFields.CrsFieldName, 26912 }, }; // act @@ -522,7 +522,7 @@ public void Deserialize_Should_Pass_When_CrsIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CoordinatesFieldName, _geometryParsed } + { WellKnownFields.CoordinatesFieldName, _geometryParsed }, }; // act @@ -543,7 +543,7 @@ public void Deserialize_Should_Fail_WhentypeNameIsMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.CoordinatesFieldName, _geometryParsed }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act @@ -562,7 +562,7 @@ public void Deserialize_Should_When_CoordinatesAreMissing(string typeName) var serialized = new Dictionary { { WellKnownFields.TypeFieldName, _geometryType }, - { WellKnownFields.CrsFieldName, new IntValueNode(0) } + { WellKnownFields.CrsFieldName, new IntValueNode(0) }, }; // act diff --git a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonTypeTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonTypeTests.cs index 649a9cbf181..caadb5aea71 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonTypeTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/GeoJsonPolygonTypeTests.cs @@ -14,7 +14,7 @@ public class GeoJsonPolygonTypeTests new Coordinate(40, 40), new Coordinate(20, 40), new Coordinate(10, 20), - new Coordinate(30, 10) + new Coordinate(30, 10), })); [Fact] diff --git a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs index a4daa5f463a..b21db48f19d 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs @@ -88,7 +88,7 @@ public async Task Execute_OutputUnknownCRS_RaiseException() { new Coordinate(30, 10), new Coordinate(10, 30), - new Coordinate(40, 40) + new Coordinate(40, 40), }); var schema = SchemaBuilder.New() @@ -133,7 +133,7 @@ public async Task Execute_CoordinateZM_RaiseException() new Coordinate(30, 10), new Coordinate(10, 30), new CoordinateZM(10, 30, 12, 15), - new Coordinate(40, 40) + new Coordinate(40, 40), }); var schema = SchemaBuilder.New() @@ -179,7 +179,7 @@ public async Task Execute_CoordinateM_RaiseException() new Coordinate(30, 10), new Coordinate(10, 30), new CoordinateM(10, 30, 12), - new Coordinate(40, 40) + new Coordinate(40, 40), }); var schema = SchemaBuilder.New() @@ -225,7 +225,7 @@ public async Task Execute_CoordinateZ_NotRaiseException() new Coordinate(30, 10), new Coordinate(10, 30), new CoordinateZ(10, 30, 12), - new Coordinate(40, 40) + new Coordinate(40, 40), }); var schema = SchemaBuilder.New() @@ -404,8 +404,8 @@ public async Task Execute_CrsEmpty_TakeDefaultSrid() new Coordinate(30, 10), new Coordinate(10, 30), new CoordinateZ(10, 30, 12), - new Coordinate(40, 40) - }); + new Coordinate(40, 40), + }); var schema = SchemaBuilder.New() .AddDocumentFromString( @@ -519,7 +519,7 @@ public async Task Execute_SourceDifferentThanCrsRequest_Transform() { new Coordinate(30, 10), new Coordinate(10, 30), - new Coordinate(40, 40) + new Coordinate(40, 40), }); var schema = SchemaBuilder.New() @@ -564,7 +564,7 @@ public async Task Execute_SourceEqualToCrsRequest_NotTransform() { new Coordinate(30, 10), new Coordinate(10, 30), - new Coordinate(40, 40) + new Coordinate(40, 40), }); var schema = SchemaBuilder.New() diff --git a/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.Download_Schema_SDL.snap b/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.Download_Schema_SDL.snap index 4a5b40ffcfc..6339cddb5d6 100644 --- a/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.Download_Schema_SDL.snap +++ b/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.Download_Schema_SDL.snap @@ -1,4 +1,4 @@ -schema { +schema { query: Query mutation: Mutation subscription: Subscription diff --git a/src/StrawberryShake/Client/src/Core/ExecutionStrategy.cs b/src/StrawberryShake/Client/src/Core/ExecutionStrategy.cs index 54bd187ebf7..2b04753f8e5 100644 --- a/src/StrawberryShake/Client/src/Core/ExecutionStrategy.cs +++ b/src/StrawberryShake/Client/src/Core/ExecutionStrategy.cs @@ -4,5 +4,5 @@ public enum ExecutionStrategy { CacheFirst, CacheAndNetwork, - NetworkOnly + NetworkOnly, } diff --git a/src/StrawberryShake/Client/src/Core/Json/JsonErrorParser.cs b/src/StrawberryShake/Client/src/Core/Json/JsonErrorParser.cs index c6e039cf5da..02ae7fc1f4f 100644 --- a/src/StrawberryShake/Client/src/Core/Json/JsonErrorParser.cs +++ b/src/StrawberryShake/Client/src/Core/Json/JsonErrorParser.cs @@ -65,7 +65,7 @@ private static IClientError ParseError(JsonElement error) { JsonValueKind.String => element.GetString()!, JsonValueKind.Number => element.GetInt32(), - _ => "NOT_SUPPORTED_VALUE" + _ => "NOT_SUPPORTED_VALUE", }; } diff --git a/src/StrawberryShake/Client/src/Core/Json/JsonResultPatcher.cs b/src/StrawberryShake/Client/src/Core/Json/JsonResultPatcher.cs index ef0db68cb26..c12e9953321 100644 --- a/src/StrawberryShake/Client/src/Core/Json/JsonResultPatcher.cs +++ b/src/StrawberryShake/Client/src/Core/Json/JsonResultPatcher.cs @@ -74,7 +74,7 @@ public Response PatchResponse(Response response) JsonValueKind.String => current[path[i].GetString()!]!, JsonValueKind.Number => current[path[i].GetInt32()]!, _ => throw new NotSupportedException( - JsonResultPatcher_PathSegmentMustBeStringOrInt) + JsonResultPatcher_PathSegmentMustBeStringOrInt), }; } } diff --git a/src/StrawberryShake/Client/src/Core/OperationKind.cs b/src/StrawberryShake/Client/src/Core/OperationKind.cs index 69070b31e4d..55d2745236c 100644 --- a/src/StrawberryShake/Client/src/Core/OperationKind.cs +++ b/src/StrawberryShake/Client/src/Core/OperationKind.cs @@ -4,5 +4,5 @@ public enum OperationKind : byte { Query = 0, Mutation = 1, - Subscription = 2 + Subscription = 2, } diff --git a/src/StrawberryShake/Client/src/Core/OperationResultBuilder.cs b/src/StrawberryShake/Client/src/Core/OperationResultBuilder.cs index bfef29c8944..609efaa1fb8 100644 --- a/src/StrawberryShake/Client/src/Core/OperationResultBuilder.cs +++ b/src/StrawberryShake/Client/src/Core/OperationResultBuilder.cs @@ -63,8 +63,8 @@ public IOperationResult Build( exception: ex, extensions: new Dictionary { - { nameof(ex.StackTrace), ex.StackTrace } - }) + { nameof(ex.StackTrace), ex.StackTrace }, + }), }; if (errors is not null) @@ -87,8 +87,8 @@ public IOperationResult Build( exception: response.Exception, extensions: new Dictionary { - { nameof(response.Exception.StackTrace), response.Exception.StackTrace } - }) + { nameof(response.Exception.StackTrace), response.Exception.StackTrace }, + }), }; } diff --git a/src/StrawberryShake/Client/src/Core/OperationStore.cs b/src/StrawberryShake/Client/src/Core/OperationStore.cs index 40c9d2215e8..760180cebfe 100644 --- a/src/StrawberryShake/Client/src/Core/OperationStore.cs +++ b/src/StrawberryShake/Client/src/Core/OperationStore.cs @@ -265,7 +265,7 @@ private void OnUpdate( operation.Request, operation.LastResult, operation.Subscribers, - operation.LastModified) + operation.LastModified), }, kind); diff --git a/src/StrawberryShake/Client/src/Core/OperationUpdateKind.cs b/src/StrawberryShake/Client/src/Core/OperationUpdateKind.cs index 2448c60e72f..7a2ff7742bf 100644 --- a/src/StrawberryShake/Client/src/Core/OperationUpdateKind.cs +++ b/src/StrawberryShake/Client/src/Core/OperationUpdateKind.cs @@ -3,5 +3,5 @@ namespace StrawberryShake; public enum OperationUpdateKind { Updated, - Removed + Removed, } diff --git a/src/StrawberryShake/Client/src/Core/RequestStrategy.cs b/src/StrawberryShake/Client/src/Core/RequestStrategy.cs index 913d99b0aba..9902fee7098 100644 --- a/src/StrawberryShake/Client/src/Core/RequestStrategy.cs +++ b/src/StrawberryShake/Client/src/Core/RequestStrategy.cs @@ -19,5 +19,5 @@ public enum RequestStrategy /// The full GraphQL query is only send if the server has not yet stored the /// persisted query. /// - AutomaticPersistedQuery + AutomaticPersistedQuery, } diff --git a/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs b/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs index 2e0b4c98346..899fc02bd80 100644 --- a/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs +++ b/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs @@ -305,10 +305,14 @@ internal static bool TryParse(string s, out TimeSpan? result) // Normalize to nanosecond intervals for (; numDigits > 9; numDigits--) + { value /= 10; + } for (; numDigits < 9; numDigits++) + { value *= 10; + } nanoseconds |= (uint)value; diff --git a/src/StrawberryShake/Client/src/Core/Serialization/TimeSpanFormat.cs b/src/StrawberryShake/Client/src/Core/Serialization/TimeSpanFormat.cs index be149ab3596..050f362e47e 100644 --- a/src/StrawberryShake/Client/src/Core/Serialization/TimeSpanFormat.cs +++ b/src/StrawberryShake/Client/src/Core/Serialization/TimeSpanFormat.cs @@ -11,5 +11,5 @@ public enum TimeSpanFormat /// TimeSpan .NET Constant ("c") Format /// https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings#the-constant-c-format-specifier /// - DotNet + DotNet, } diff --git a/src/StrawberryShake/Client/src/Core/ThrowHelper.cs b/src/StrawberryShake/Client/src/Core/ThrowHelper.cs index 27a2174bde7..e25cf6901f5 100644 --- a/src/StrawberryShake/Client/src/Core/ThrowHelper.cs +++ b/src/StrawberryShake/Client/src/Core/ThrowHelper.cs @@ -24,7 +24,7 @@ internal static GraphQLClientException DateTimeSerializer_InvalidFormat( "For more information read: `https://www.graphql-scalars.com/date-time`.", extensions: new Dictionary { - { "serializedValue", serializedValue } + { "serializedValue", serializedValue }, })); internal static GraphQLClientException DateSerializer_InvalidFormat( @@ -33,7 +33,7 @@ internal static GraphQLClientException DateSerializer_InvalidFormat( "The serialized format for Date must be `yyyy-MM-dd`.", extensions: new Dictionary { - { "serializedValue", serializedValue } + { "serializedValue", serializedValue }, })); internal static GraphQLClientException UrlFormatter_CouldNotParseUri(string value) => diff --git a/src/StrawberryShake/Client/src/Core/ValueKind.cs b/src/StrawberryShake/Client/src/Core/ValueKind.cs index 7a51e80b173..e3ac2c327ea 100644 --- a/src/StrawberryShake/Client/src/Core/ValueKind.cs +++ b/src/StrawberryShake/Client/src/Core/ValueKind.cs @@ -6,5 +6,5 @@ public enum ValueKind Integer, Float, Boolean, - Enum + Enum, } diff --git a/src/StrawberryShake/Client/src/Persistence.SQLite/DatabaseHelper.cs b/src/StrawberryShake/Client/src/Persistence.SQLite/DatabaseHelper.cs index 03a57c9f03e..ca655fc6bbb 100644 --- a/src/StrawberryShake/Client/src/Persistence.SQLite/DatabaseHelper.cs +++ b/src/StrawberryShake/Client/src/Persistence.SQLite/DatabaseHelper.cs @@ -90,7 +90,7 @@ public async IAsyncEnumerable GetAllEntitiesAsync( { Id = reader.GetString(0), Value = reader.GetString(1), - Type = reader.GetString(2) + Type = reader.GetString(2), }; } } @@ -138,7 +138,7 @@ public async IAsyncEnumerable GetAllOperationsAsync( Id = reader.GetString(0), Variables = reader.GetString(1), ResultType = reader.GetString(2), - DataInfo = reader.GetString(3) + DataInfo = reader.GetString(3), }; } } diff --git a/src/StrawberryShake/Client/src/Persistence.SQLite/SQLitePersistence.cs b/src/StrawberryShake/Client/src/Persistence.SQLite/SQLitePersistence.cs index 1d98ed6083e..b47491f3a3b 100644 --- a/src/StrawberryShake/Client/src/Persistence.SQLite/SQLitePersistence.cs +++ b/src/StrawberryShake/Client/src/Persistence.SQLite/SQLitePersistence.cs @@ -18,7 +18,7 @@ public class SQLitePersistence : IDisposable { Formatting = Formatting.None, TypeNameHandling = TypeNameHandling.All, - TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple + TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple, }; private readonly JsonOperationRequestSerializer _requestSerializer = new(); @@ -205,7 +205,7 @@ private async Task WriteEntityAsync( { Id = serializedId, Value = JsonConvert.SerializeObject(entity, _serializerSettings), - Type = entity.GetType().FullName! + Type = entity.GetType().FullName!, }; await database.SaveEntityAsync( @@ -245,7 +245,7 @@ private async Task WriteOperationAsync( DataInfo = JsonConvert.SerializeObject( operationVersion.Result.DataInfo, _serializerSettings), - ResultType = $"{dataType.FullName}, {dataType.Assembly.GetName().Name}" + ResultType = $"{dataType.FullName}, {dataType.Assembly.GetName().Name}", }; await database.SaveOperationAsync( diff --git a/src/StrawberryShake/Client/src/Transport.InMemory/DependencyInjection/InMemoryClient.cs b/src/StrawberryShake/Client/src/Transport.InMemory/DependencyInjection/InMemoryClient.cs index 223e4b9f456..4437757c0b5 100644 --- a/src/StrawberryShake/Client/src/Transport.InMemory/DependencyInjection/InMemoryClient.cs +++ b/src/StrawberryShake/Client/src/Transport.InMemory/DependencyInjection/InMemoryClient.cs @@ -154,7 +154,7 @@ private static void GetFileValueOrDefault( { (Dictionary s, string prop) when s.ContainsKey(prop) => s[prop], (List l, int i) when i < l.Count => l[i], - _ => null + _ => null, }; } diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/DependencyInjection/WebSocketClientFactoryServiceCollectionExtensions.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/DependencyInjection/WebSocketClientFactoryServiceCollectionExtensions.cs index f4b32b84777..b311b7f0d9c 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/DependencyInjection/WebSocketClientFactoryServiceCollectionExtensions.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/DependencyInjection/WebSocketClientFactoryServiceCollectionExtensions.cs @@ -204,7 +204,7 @@ private static IServiceCollection AddWebSocketClient(this IServiceCollection ser services.TryAddSingleton>( new ISocketProtocolFactory[] { - new GraphQLWebSocketProtocolFactory() + new GraphQLWebSocketProtocolFactory(), }); services.TryAddSingleton(); services.TryAddSingleton(sp => diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/Messaging/Messages/OperationMessageType.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/Messaging/Messages/OperationMessageType.cs index 72a0fac0832..b85e303a216 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/Messaging/Messages/OperationMessageType.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/Messaging/Messages/OperationMessageType.cs @@ -8,5 +8,5 @@ public enum OperationMessageType Error, Data, Cancelled, - Complete + Complete, } \ No newline at end of file diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageParser.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageParser.cs index 633288ee8f0..99341d6d44b 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageParser.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageParser.cs @@ -28,13 +28,13 @@ internal ref struct GraphQLWebSocketMessageParser (byte)'t', (byte)'y', (byte)'p', - (byte)'e' + (byte)'e', }; private static ReadOnlySpan Id => new[] { (byte)'i', - (byte)'d' + (byte)'d', }; private static ReadOnlySpan Payload => new[] @@ -45,7 +45,7 @@ internal ref struct GraphQLWebSocketMessageParser (byte)'l', (byte)'o', (byte)'a', - (byte)'d' + (byte)'d', }; private Utf8JsonReader _reader; diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageType.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageType.cs index f7f4b34fd7b..291444c2889 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageType.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageType.cs @@ -168,5 +168,5 @@ internal enum GraphQLWebSocketMessageType /// /// /// - Stop + Stop, } \ No newline at end of file diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageTypeSpans.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageTypeSpans.cs index b8fa376ded5..4fd746d178b 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageTypeSpans.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketMessageTypeSpans.cs @@ -20,7 +20,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'i', (byte)'n', (byte)'i', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan ConnectionAccept => new[] @@ -38,7 +38,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'_', (byte)'a', (byte)'c', - (byte)'k' + (byte)'k', }; public static ReadOnlySpan ConnectionError => new[] @@ -58,13 +58,13 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'r', (byte)'r', (byte)'o', - (byte)'r' + (byte)'r', }; public static ReadOnlySpan KeepAlive => new[] { (byte)'k', - (byte)'a' + (byte)'a', }; public static ReadOnlySpan ConnectionTerminate => new[] @@ -88,7 +88,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'n', (byte)'a', (byte)'t', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Start => new[] @@ -97,7 +97,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'t', (byte)'a', (byte)'r', - (byte)'t' + (byte)'t', }; public static ReadOnlySpan Data => new[] @@ -105,7 +105,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'d', (byte)'a', (byte)'t', - (byte)'a' + (byte)'a', }; public static ReadOnlySpan Error => new[] @@ -114,7 +114,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'r', (byte)'r', (byte)'o', - (byte)'r' + (byte)'r', }; public static ReadOnlySpan Complete => new[] @@ -126,7 +126,7 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'l', (byte)'e', (byte)'t', - (byte)'e' + (byte)'e', }; public static ReadOnlySpan Stop => new[] @@ -134,6 +134,6 @@ public static class GraphQLWebSocketMessageTypeSpans (byte)'s', (byte)'t', (byte)'o', - (byte)'p' + (byte)'p', }; } \ No newline at end of file diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocol.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocol.cs index 46a39438ffd..a04f9ceb56b 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocol.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocol.cs @@ -140,7 +140,7 @@ private ValueTask ProcessAsync( _ => CloseSocketOnProtocolError( "Invalid message type received: " + message.Type, - cancellationToken) + cancellationToken), }; } } diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketWriterExtension.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketWriterExtension.cs index bc6c7f319d8..19d0c38072a 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketWriterExtension.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/Protocols/GraphQLWebSocket/GraphQLWebSocketWriterExtension.cs @@ -118,7 +118,7 @@ private static void WriteType( GraphQLWebSocketMessageType.Error => Error, GraphQLWebSocketMessageType.Complete => Complete, GraphQLWebSocketMessageType.Stop => Stop, - _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) + _ => throw new ArgumentOutOfRangeException(nameof(type), type, null), }; writer.Writer.WriteStringValue(typeToWriter); diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/SocketCloseStatus.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/SocketCloseStatus.cs index ab830960959..842e31d3671 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/SocketCloseStatus.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/SocketCloseStatus.cs @@ -14,5 +14,5 @@ public enum SocketCloseStatus PolicyViolation, MessageTooBig, MandatoryExtension, - InternalServerError + InternalServerError, } \ No newline at end of file diff --git a/src/StrawberryShake/Client/src/Transport.WebSockets/WebSocketClient.cs b/src/StrawberryShake/Client/src/Transport.WebSockets/WebSocketClient.cs index 977580d0072..0c0779cc40a 100644 --- a/src/StrawberryShake/Client/src/Transport.WebSockets/WebSocketClient.cs +++ b/src/StrawberryShake/Client/src/Transport.WebSockets/WebSocketClient.cs @@ -242,7 +242,7 @@ private static WebSocketCloseStatus MapCloseStatus(SocketCloseStatus closeStatus SocketCloseStatus.NormalClosure => WebSocketCloseStatus.NormalClosure, SocketCloseStatus.PolicyViolation => WebSocketCloseStatus.PolicyViolation, SocketCloseStatus.ProtocolError => WebSocketCloseStatus.ProtocolError, - _ => WebSocketCloseStatus.Empty + _ => WebSocketCloseStatus.Empty, }; /// diff --git a/src/StrawberryShake/Client/test/Core.Tests/Json/JsonOperationRequestSerializerTests.cs b/src/StrawberryShake/Client/test/Core.Tests/Json/JsonOperationRequestSerializerTests.cs index eb35e713546..ec0755f0c78 100644 --- a/src/StrawberryShake/Client/test/Core.Tests/Json/JsonOperationRequestSerializerTests.cs +++ b/src/StrawberryShake/Client/test/Core.Tests/Json/JsonOperationRequestSerializerTests.cs @@ -24,10 +24,10 @@ public void Serialize_Request_With_InputObject() new KeyValuePair[] { new("s", "def"), - } + }, }), new("sl", new List { "a", "b", "c" }), - new("il", new[] { 1, 2, 3 }) + new("il", new[] { 1, 2, 3 }), }; // act @@ -98,7 +98,7 @@ public void Serialize_Request_With_Extensions() new KeyValuePair[] { new("s", "def"), - } + }, }); operationRequest.Extensions.Add("sl", new List { "a", "b", "c" }); operationRequest.Extensions.Add("il", new[] { 1, 2, 3 }); diff --git a/src/StrawberryShake/Client/test/Core.Tests/OperationRequestTests.cs b/src/StrawberryShake/Client/test/Core.Tests/OperationRequestTests.cs index a86917ba6a1..53be64c446d 100644 --- a/src/StrawberryShake/Client/test/Core.Tests/OperationRequestTests.cs +++ b/src/StrawberryShake/Client/test/Core.Tests/OperationRequestTests.cs @@ -69,7 +69,7 @@ public void Equals_With_Variables_3() "a", new ConcurrentDictionary( new Dictionary { { "a", "b" } }) - } + }, }); var b = new OperationRequest( @@ -82,7 +82,7 @@ public void Equals_With_Variables_3() "a", new ConcurrentDictionary( new Dictionary { { "a", "b" } }) - } + }, }); // act @@ -272,7 +272,7 @@ public void NotEquals_With_Variables_7() "a", new ConcurrentDictionary( new Dictionary { { "a", "b" } }) - } + }, }); var b = new OperationRequest( @@ -285,7 +285,7 @@ public void NotEquals_With_Variables_7() "a", new ConcurrentDictionary( new Dictionary { { "c", "b" } }) - } + }, }); // act @@ -309,7 +309,7 @@ public void NotEquals_With_Variables_8() "a", new ConcurrentDictionary( new Dictionary { { "a", "b" } }) - } + }, }); var b = new OperationRequest( @@ -322,7 +322,7 @@ public void NotEquals_With_Variables_8() "a", new ConcurrentDictionary( new Dictionary { { "a", "c" } }) - } + }, }); // act @@ -369,7 +369,7 @@ public void NotEquals_With_Variables_10() "a", new ConcurrentDictionary( new Dictionary { { "a", null } }) - } + }, }); var b = new OperationRequest( @@ -382,7 +382,7 @@ public void NotEquals_With_Variables_10() "a", new ConcurrentDictionary( new Dictionary { { "c", "b" } }) - } + }, }); // act @@ -517,11 +517,11 @@ public void Equals_With_Variables_JSON() { "e", new List { 1, 2, 3, 4 } }, { "f", true } } }, - { "g", 123 } + { "g", 123 }, } - } + }, } - } + }, }); var b = new OperationRequest( @@ -539,11 +539,11 @@ public void Equals_With_Variables_JSON() { "e", new List { 1, 2, 3, 4 } }, { "f", true } } }, - { "g", 123 } + { "g", 123 }, } - } + }, } - } + }, }); // act @@ -566,10 +566,10 @@ public void Equals_With_Variables_KeyValuePair() { new KeyValuePair("b", new List> { - new KeyValuePair("id", "123456") - }) + new KeyValuePair("id", "123456"), + }), } - } + }, }); var b = new OperationRequest( @@ -582,10 +582,10 @@ public void Equals_With_Variables_KeyValuePair() { new KeyValuePair("b", new List> { - new KeyValuePair("id", "123456") - }) + new KeyValuePair("id", "123456"), + }), } - } + }, }); // act diff --git a/src/StrawberryShake/Client/test/Core.Tests/Serialization/Iso8601DurationTests.cs b/src/StrawberryShake/Client/test/Core.Tests/Serialization/Iso8601DurationTests.cs index 3ca6a8952d5..877c2137365 100644 --- a/src/StrawberryShake/Client/test/Core.Tests/Serialization/Iso8601DurationTests.cs +++ b/src/StrawberryShake/Client/test/Core.Tests/Serialization/Iso8601DurationTests.cs @@ -9,7 +9,7 @@ public class Iso8601DurationTests { new object[] { "-P1D", TimeSpan.FromDays(-1) }, new object[] { "PT0.0000001S", TimeSpan.FromMilliseconds(1) / 1000 / 10 }, - new object[] { "-PT0.0000001S", TimeSpan.FromMilliseconds(-1) / 1000 / 10 } + new object[] { "-PT0.0000001S", TimeSpan.FromMilliseconds(-1) / 1000 / 10 }, }; [Theory] diff --git a/src/StrawberryShake/Client/test/Core.Tests/Serialization/SerializerResolverTests.cs b/src/StrawberryShake/Client/test/Core.Tests/Serialization/SerializerResolverTests.cs index 204f8b7ed67..f4120a31bb3 100644 --- a/src/StrawberryShake/Client/test/Core.Tests/Serialization/SerializerResolverTests.cs +++ b/src/StrawberryShake/Client/test/Core.Tests/Serialization/SerializerResolverTests.cs @@ -97,8 +97,8 @@ public void Constructor_CustomIntSerializerRegistered_PreferOverBuiltInt() ISerializer[] serializers = { new CustomIntSerializer(), - new IntSerializer() - }; + new IntSerializer(), + }; var resolver = new SerializerResolver(serializers); // act @@ -114,8 +114,8 @@ public void GetLeaveValueParser_SerializerRegistered_ReturnSerializer() // arrange ISerializer[] serializers = { - new IntSerializer() - }; + new IntSerializer(), + }; var resolver = new SerializerResolver(serializers); // act @@ -132,8 +132,8 @@ public void GetLeaveValueParser_SerializerRegisteredDifferentName_ThrowException // arrange ISerializer[] serializers = { - new IntSerializer() - }; + new IntSerializer(), + }; var resolver = new SerializerResolver(serializers); // act @@ -149,8 +149,8 @@ public void GetLeaveValueParser_SerializerRegisteredDifferentType_ThrowException // arrange ISerializer[] serializers = { - new IntSerializer() - }; + new IntSerializer(), + }; var resolver = new SerializerResolver(serializers); // act @@ -166,8 +166,8 @@ public void GetLeaveValueParser_TypeNull_ThrowException() // arrange ISerializer[] serializers = { - new IntSerializer() - }; + new IntSerializer(), + }; var resolver = new SerializerResolver(serializers); // act @@ -184,8 +184,8 @@ public void GetInputValueFormatter_FormatterRegistered_ReturnFormatter() // arrange ISerializer[] serializers = { - new CustomInputValueFormatter() - }; + new CustomInputValueFormatter(), + }; var resolver = new SerializerResolver(serializers); @@ -202,8 +202,8 @@ public void GetInputValueFormatter_FormatterRegisteredDifferentName_ThrowExcepti // arrange ISerializer[] serializers = { - new CustomInputValueFormatter() - }; + new CustomInputValueFormatter(), + }; var resolver = new SerializerResolver(serializers); // act @@ -221,8 +221,8 @@ public void GetInputValueFormatter_FormatterRegisteredDifferentType_ThrowExcepti serializerMock.Setup(x => x.TypeName).Returns("Int"); ISerializer[] serializers = { - serializerMock.Object - }; + serializerMock.Object, + }; var resolver = new SerializerResolver(serializers); @@ -239,8 +239,8 @@ public void GetInputValueFormatter_TypeNull_ThrowException() // arrange ISerializer[] serializers = { - new IntSerializer() - }; + new IntSerializer(), + }; var resolver = new SerializerResolver(serializers); // act diff --git a/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocolTests.cs b/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocolTests.cs index 9b0afce5044..7f3fb43bb5d 100644 --- a/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocolTests.cs +++ b/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/Protocols/GraphQLWebSocket/GraphQLWebSocketProtocolTests.cs @@ -86,7 +86,7 @@ public async Task InitializeAsync_SocketIsOpen_SendConnectionInitPayload() var socketClient = new SocketClientStub { IsClosed = false, - ConnectionInterceptor = connectionInterceptorMock.Object + ConnectionInterceptor = connectionInterceptorMock.Object, }; var protocol = new GraphQLWebSocketProtocol(socketClient); diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/Inheritance.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/Inheritance.cs index e030b469713..ead2f07f750 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/Inheritance.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/Inheritance.cs @@ -5,5 +5,5 @@ public enum Inheritance None, Sealed, Override, - Virtual + Virtual, } \ No newline at end of file diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/MethodCallBuilder.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/MethodCallBuilder.cs index 405255226b8..5474c600040 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/MethodCallBuilder.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/MethodCallBuilder.cs @@ -31,7 +31,7 @@ public MethodCallBuilder SetMethodName(string methodName) { _methodName = new[] { - methodName + methodName, }; return this; } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/TypeReferenceBuilder.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/TypeReferenceBuilder.cs index 84df8ca0aed..012bde493b7 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/TypeReferenceBuilder.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/TypeReferenceBuilder.cs @@ -59,7 +59,7 @@ public TypeReferenceBuilder SetIsNullable(bool isNullable) private enum TypeKindToken { List, - Nullable + Nullable, } public override string ToString() diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGenerator.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGenerator.cs index a43ddbf0c87..71a960bf393 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGenerator.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGenerator.cs @@ -39,7 +39,7 @@ public static class CSharpGenerator new ResultTypeGenerator(), new StoreAccessorGenerator(), new NoStoreAccessorGenerator(), new InputTypeGenerator(), new InputTypeStateInterfaceGenerator(), new ResultInterfaceGenerator(), new DataTypeGenerator(), new RazorQueryGenerator(), - new RazorSubscriptionGenerator() + new RazorSubscriptionGenerator(), }; public static async Task GenerateAsync( diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGeneratorSettings.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGeneratorSettings.cs index 7bfd1b51ad8..f6e4e8077ed 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGeneratorSettings.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/CSharpGeneratorSettings.cs @@ -75,6 +75,6 @@ public class CSharpGeneratorSettings new TransportProfile( TransportProfile.DefaultProfileName, TransportType.Http, - subscription: TransportType.WebSocket) + subscription: TransportType.WebSocket), }; } \ No newline at end of file diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/ClassBuilderExtensions.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/ClassBuilderExtensions.cs index 1921cd53e54..3aa45ed5121 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/ClassBuilderExtensions.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/ClassBuilderExtensions.cs @@ -312,7 +312,7 @@ ICode BuildPropertyInternal( .SetMethodName(TypeNames.SequenceEqual) .AddArgument(propertyName) .AddArgument($"{other}.{propertyName}"), - _ => throw new ArgumentOutOfRangeException() + _ => throw new ArgumentOutOfRangeException(), }; } } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/DescriptorExtensions.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/DescriptorExtensions.cs index c7c628d103f..3b27d6d4020 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/DescriptorExtensions.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/DescriptorExtensions.cs @@ -57,7 +57,7 @@ public static TypeReferenceBuilder ToTypeReference( INamedTypeDescriptor named => actualBuilder.SetName(named.RuntimeType.ToString()), - _ => throw new ArgumentOutOfRangeException(nameof(typeReferenceDescriptor)) + _ => throw new ArgumentOutOfRangeException(nameof(typeReferenceDescriptor)), }; } @@ -106,7 +106,7 @@ public static TypeReferenceBuilder ToStateTypeReference( INamedTypeDescriptor d => actualBuilder.SetName(d.RuntimeType.ToString()), - _ => throw new ArgumentOutOfRangeException(nameof(typeDescriptor)) + _ => throw new ArgumentOutOfRangeException(nameof(typeDescriptor)), }; } } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/HashCodeBuilderExtensions.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/HashCodeBuilderExtensions.cs index ee44134d6bf..8076ded6ba9 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/HashCodeBuilderExtensions.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Extensions/HashCodeBuilderExtensions.cs @@ -53,7 +53,7 @@ ICode BuildPropertyInternal( .New() .SetLoopHeader($"var {variableName}_elm in {variableName}") .AddCode(BuildPropertyInternal(d.InnerType, variableName + "_elm", true)), - _ => throw new ArgumentOutOfRangeException() + _ => throw new ArgumentOutOfRangeException(), }; if (isNullable && currentType is not NonNullTypeDescriptor) diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/DependencyInjectionGenerator.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/DependencyInjectionGenerator.cs index 9d42fa5a0df..b3e03e59723 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/DependencyInjectionGenerator.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/DependencyInjectionGenerator.cs @@ -42,7 +42,7 @@ public class DependencyInjectionGenerator : CodeGenerator _alternativeTypeNames = new() @@ -53,7 +53,7 @@ public class DependencyInjectionGenerator : CodeGenerator profile.Subscription, QueryOperationDescriptor => profile.Query, MutationOperationDescriptor => profile.Mutation, - _ => throw ThrowHelper.DependencyInjection_InvalidOperationKind(operation) + _ => throw ThrowHelper.DependencyInjection_InvalidOperationKind(operation), }; var connectionKind = operationKind switch @@ -542,7 +542,7 @@ private static ICode GenerateInternalMethodBody( TransportType.Http => IHttpConnection, TransportType.WebSocket => IWebSocketConnection, TransportType.InMemory => IInMemoryConnection, - var v => throw ThrowHelper.DependencyInjection_InvalidTransportType(v) + var v => throw ThrowHelper.DependencyInjection_InvalidTransportType(v), }; var operationName = operation.Name; @@ -788,7 +788,7 @@ private static ICode RegisterConnection(TransportType transportProfile, string c TransportType.WebSocket => RegisterWebSocketConnection(clientName), TransportType.Http => RegisterHttpConnection(clientName), TransportType.InMemory => RegisterInMemoryConnection(clientName), - var v => throw ThrowHelper.DependencyInjection_InvalidTransportType(v) + var v => throw ThrowHelper.DependencyInjection_InvalidTransportType(v), }; } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/InputValueFormatterGenerator.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/InputValueFormatterGenerator.cs index 74f2b3c54dd..6e590273d9a 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/InputValueFormatterGenerator.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/InputValueFormatterGenerator.cs @@ -247,7 +247,7 @@ ICode GenerateSerializerLocal( assignment == @return ? $"return {variable}_list;" : $"{assignment}.Add({variable}_list);")), - _ => throw new InvalidOperationException() + _ => throw new InvalidOperationException(), }; if (isNullable && currentType is not NonNullTypeDescriptor) diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs index 1a0b394cd17..949c3f61754 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/JsonResultBuilderGenerator.cs @@ -362,7 +362,7 @@ private static string BuildDeserializeMethodName( InterfaceTypeDescriptor { ImplementedBy.Count: > 1, - ParentRuntimeType: { } parentRuntimeType + ParentRuntimeType: { } parentRuntimeType, } => parentRuntimeType.Name, INamedTypeDescriptor { Kind: TypeKind.Entity } d => @@ -381,7 +381,7 @@ private static string BuildDeserializeMethodName( ? BuildDeserializeMethodName(nonNullTypeDescriptor.InnerType) + "NonNullable" : "NonNullable" + BuildDeserializeMethodName(nonNullTypeDescriptor.InnerType), - _ => throw new ArgumentOutOfRangeException(nameof(typeDescriptor)) + _ => throw new ArgumentOutOfRangeException(nameof(typeDescriptor)), }; } } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/OperationDocumentGenerator.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/OperationDocumentGenerator.cs index 452529bc285..940385cef01 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/OperationDocumentGenerator.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/OperationDocumentGenerator.cs @@ -28,7 +28,7 @@ protected override void Generate(OperationDescriptor descriptor, MutationOperationDescriptor => "Mutation", QueryOperationDescriptor => "Query", SubscriptionOperationDescriptor => "Subscription", - _ => throw new ArgumentOutOfRangeException(nameof(descriptor)) + _ => throw new ArgumentOutOfRangeException(nameof(descriptor)), }; var classBuilder = ClassBuilder diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_EntityHandler.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_EntityHandler.cs index 77eaa3a417d..cc959e2b573 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_EntityHandler.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_EntityHandler.cs @@ -114,14 +114,14 @@ private static ICode GenerateEntityHandlerIfClause( { _entityId, "Name", - nameof(string.Equals) + nameof(string.Equals), } : new[] { _entityId, "Value", "Name", - nameof(string.Equals) + nameof(string.Equals), }) .AddArgument(objectTypeDescriptor.Name.AsStringToken()) .AddArgument(TypeNames.OrdinalStringComparison)); diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_MapMethodMeta.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_MapMethodMeta.cs index 1008fed9ed1..7165cb9525c 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_MapMethodMeta.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/TypeMapperGenerator_MapMethodMeta.cs @@ -77,7 +77,7 @@ private static string BuildMapMethodName( { ImplementedBy.Count: > 1, Kind: TypeKind.Entity, - ParentRuntimeType: { } parentRuntimeType + ParentRuntimeType: { } parentRuntimeType, } => parentRuntimeType.Name, INamedTypeDescriptor namedTypeDescriptor => @@ -87,7 +87,7 @@ private static string BuildMapMethodName( ? BuildMapMethodName(nonNullTypeDescriptor.InnerType) + "NonNullable" : "NonNullable" + BuildMapMethodName(nonNullTypeDescriptor.InnerType), - _ => throw new ArgumentOutOfRangeException(nameof(typeDescriptor)) + _ => throw new ArgumentOutOfRangeException(nameof(typeDescriptor)), }; } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/JsonUtils.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/JsonUtils.cs index f27d11dd3e3..8dd045d897e 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/JsonUtils.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/JsonUtils.cs @@ -27,7 +27,7 @@ public static string GetParseMethod(RuntimeTypeInfo serializationType) TypeNames.TimeSpan => nameof(JsonElement.GetString), TypeNames.Boolean => nameof(JsonElement.GetBoolean), TypeNames.Guid => nameof(JsonElement.GetGuid), - _ => throw new NotSupportedException("Serialization format not supported.") + _ => throw new NotSupportedException("Serialization format not supported."), }; } @@ -53,7 +53,7 @@ public static string GetWriteMethod(RuntimeTypeInfo serializationType) TypeNames.TimeSpan => nameof(Utf8JsonWriter.WriteString), TypeNames.Boolean => nameof(Utf8JsonWriter.WriteBoolean), TypeNames.Guid => nameof(Utf8JsonWriter.WriteString), - _ => throw new NotSupportedException("Serialization format not supported.") + _ => throw new NotSupportedException("Serialization format not supported."), }; } } \ No newline at end of file diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/SourceDocumentKind.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/SourceDocumentKind.cs index 744b4a983a8..093e178c9f5 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/SourceDocumentKind.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/SourceDocumentKind.cs @@ -4,5 +4,5 @@ public enum SourceDocumentKind { CSharp, Razor, - GraphQL + GraphQL, } \ No newline at end of file diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/AccessModifier.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/AccessModifier.cs index 42a318f8bf9..641b6373332 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/AccessModifier.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/AccessModifier.cs @@ -5,5 +5,5 @@ public enum AccessModifier Public = 0, Internal = 1, Protected = 2, - Private = 3 + Private = 3, } \ No newline at end of file diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentHelper.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentHelper.cs index 1094a60d393..489cbb11e03 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentHelper.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentHelper.cs @@ -25,7 +25,7 @@ public static class FragmentHelper directive.Arguments[0] is { Name: { Value: "fragment" }, - Value: StringValueNode { Value: { Length: > 0 } } sv + Value: StringValueNode { Value: { Length: > 0 } } sv, }) { return sv.Value; diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentKind.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentKind.cs index 3e0c1ccedb3..ce7c6f1feb4 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentKind.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FragmentKind.cs @@ -4,5 +4,5 @@ public enum FragmentKind { Structure, Named, - Inline + Inline, } \ No newline at end of file diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/OutputModelKind.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/OutputModelKind.cs index c4c1d0589cd..ccad7c5ee5a 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/OutputModelKind.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/OutputModelKind.cs @@ -9,5 +9,5 @@ public enum OutputModelKind Interface = 1, Fragment = 2, FragmentInterface = Fragment | Interface, - FragmentObject = Fragment | Object + FragmentObject = Fragment | Object, } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/BuiltInScalarNames.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/BuiltInScalarNames.cs index d809b422920..7f582c8edb0 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/BuiltInScalarNames.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/BuiltInScalarNames.cs @@ -30,7 +30,7 @@ public static class BuiltInScalarNames ScalarNames.ByteArray, ScalarNames.Any, ScalarNames.JSON, - ScalarNames.TimeSpan + ScalarNames.TimeSpan, }; public static bool IsBuiltInScalar(string typeName) => _typeNames.Contains(typeName); diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Descriptors/TypeDescriptors/TypeKind.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Descriptors/TypeDescriptors/TypeKind.cs index 3cda40a2de7..d8a80608fd1 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Descriptors/TypeDescriptors/TypeKind.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Descriptors/TypeDescriptors/TypeKind.cs @@ -43,5 +43,5 @@ public enum TypeKind /// /// A preserved fragment. /// - Fragment + Fragment, } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Extensions/TypeDescriptorExtensions.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Extensions/TypeDescriptorExtensions.cs index 36dbc8b3bee..5ff45fe781e 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Extensions/TypeDescriptorExtensions.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Extensions/TypeDescriptorExtensions.cs @@ -28,7 +28,7 @@ public static bool ContainsEntity(this ITypeDescriptor typeDescriptor) .Any(prop => prop.Type.IsEntity() || prop.Type.ContainsEntity()), NonNullTypeDescriptor nonNullTypeDescriptor => nonNullTypeDescriptor.InnerType.ContainsEntity(), - _ => false + _ => false, }; } @@ -51,7 +51,7 @@ public static bool IsOrContainsEntity(this ITypeDescriptor typeDescriptor) NonNullTypeDescriptor d => d.InnerType.IsOrContainsEntity(), - _ => false + _ => false, }; } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Keywords.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Keywords.cs index a2c720340fa..f511ab20516 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Keywords.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Keywords.cs @@ -118,7 +118,7 @@ public static class Keywords "when", "where", "with", - "yield" + "yield", }; public static string ToSafeName(string name) diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/OperationDescriptorMapper.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/OperationDescriptorMapper.cs index 2ce4dc2ffbd..4e48875235e 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/OperationDescriptorMapper.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/OperationDescriptorMapper.cs @@ -108,6 +108,6 @@ private static ITypeDescriptor Rewrite( ListType lt => new ListTypeDescriptor( Rewrite(lt.InnerType(), namedTypeDescriptor)), INamedType => namedTypeDescriptor, - _ => throw new InvalidOperationException() + _ => throw new InvalidOperationException(), }; } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/TypeInfos.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/TypeInfos.cs index fdca7487bed..ff0035ea5d4 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/TypeInfos.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/TypeInfos.cs @@ -102,7 +102,7 @@ public sealed class TypeInfos { DateTimeSerializer, new RuntimeTypeInfo(DateTimeSerializer) }, { DateSerializer, new RuntimeTypeInfo(DateSerializer) }, { ByteArraySerializer, new RuntimeTypeInfo(ByteArraySerializer) }, - { TimeSpanSerializer, new RuntimeTypeInfo(TimeSpanSerializer) } + { TimeSpanSerializer, new RuntimeTypeInfo(TimeSpanSerializer) }, }; public RuntimeTypeInfo GetOrAdd(string fullTypeName, bool valueType = false) => diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/DocumentHelper.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/DocumentHelper.cs index 45f92d1bb20..517ecbabdbc 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/DocumentHelper.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/DocumentHelper.cs @@ -66,7 +66,7 @@ public static void IndexSyntaxNodes( VisitArguments = true, VisitDescriptions = true, VisitDirectives = true, - VisitNames = true + VisitNames = true, }) .Visit(file.Document); } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/CSharpCompiler.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/CSharpCompiler.cs index f84a0c682d0..aa1b7d0ad5b 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/CSharpCompiler.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/CSharpCompiler.cs @@ -34,7 +34,7 @@ internal static class CSharpCompiler { // warning CS1702: Assuming assembly reference is of different version "CS1702", - "CS1701" + "CS1701", }; public static IReadOnlyList GetDiagnosticErrors(params string[] sourceText) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/DependencyInjectionGeneratorTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/DependencyInjectionGeneratorTests.cs index 29f6e3ce2e8..3ede05cbef4 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/DependencyInjectionGeneratorTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/DependencyInjectionGeneratorTests.cs @@ -57,8 +57,8 @@ public void Default_InMemory() => { new TransportProfile( TransportProfile.DefaultProfileName, - TransportType.InMemory) - } + TransportType.InMemory), + }, }, "query GetPerson { person { name } }", "subscription onPerson { onPerson { name } }", @@ -77,8 +77,8 @@ public void Default_MultiProfile() => Profiles = { TransportProfile.Default, - new TransportProfile("InMemory", TransportType.InMemory) - } + new TransportProfile("InMemory", TransportType.InMemory), + }, }, "query GetPerson { person { name } }", "subscription onPerson { onPerson { name } }", @@ -101,8 +101,8 @@ public void Default_DifferentTransportMethods() => TransportType.InMemory, query: TransportType.Http, mutation: TransportType.WebSocket, - subscription: TransportType.InMemory) - } + subscription: TransportType.InMemory), + }, }, "query GetPerson { person { name } }", "subscription onPerson { onPerson { name } }", diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/GeneratorTestHelper.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/GeneratorTestHelper.cs index 3093acca314..c4ef7705e9f 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/GeneratorTestHelper.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/GeneratorTestHelper.cs @@ -25,7 +25,7 @@ public static IReadOnlyList AssertError(params string[] fileNames) { Namespace = "Foo.Bar", ClientName = "FooClient", - AccessModifier = AccessModifier.Public + AccessModifier = AccessModifier.Public, }) .Result; @@ -94,7 +94,7 @@ public static void AssertResult( NoStore = settings.NoStore, InputRecords = settings.InputRecords, EntityRecords = settings.EntityRecords, - RazorComponents = settings.RazorComponents + RazorComponents = settings.RazorComponents, }); Assert.False( @@ -231,8 +231,8 @@ public static AssertSettings CreateIntegrationTest( NoStore = noStore, Profiles = (profiles ?? new[] { - TransportProfile.Default - }).ToList() + TransportProfile.Default, + }).ToList(), }; } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.cs index c1978a7eab7..427469856ee 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/EntityIdOrDataTest.cs @@ -47,7 +47,7 @@ public class Query new Baz { Id = "BarId" }, new Baz2 { Id = "Bar2Id" }, new Quox { Foo = "QuoxFoo" }, - new Quox2 { Foo = "Quox2Foo" } + new Quox2 { Foo = "Quox2Foo" }, }; } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/TestGeneration.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/TestGeneration.cs index 2a3c927bb7b..f5824fe813d 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/TestGeneration.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/TestGeneration.cs @@ -53,7 +53,7 @@ public void MultiProfile() => CreateIntegrationTest(profiles: new[] { new TransportProfile("InMemory", TransportType.InMemory), - TransportProfile.Default + TransportProfile.Default, }), @"query GetHero { hero(episode: NEW_HOPE) { @@ -148,7 +148,7 @@ public void EntityIdOrData() => AssertResult( CreateIntegrationTest(profiles: new[] { - new TransportProfile("Default", TransportType.InMemory) + new TransportProfile("Default", TransportType.InMemory), }), skipWarnings: true, @" @@ -243,7 +243,7 @@ public void StarWarsOnReviewSubCompletion() => CreateIntegrationTest(profiles: new[] { new TransportProfile("InMemory", TransportType.InMemory), - TransportProfile.Default + TransportProfile.Default, }), @"subscription OnReviewSub { onReview(episode: NEW_HOPE) { @@ -270,7 +270,7 @@ public void StarWarsOnReviewSubGraphQLSSE() => AssertStarWarsResult( CreateIntegrationTest(profiles: new[] { - new TransportProfile("default", TransportType.Http) + new TransportProfile("default", TransportType.Http), }), @"subscription OnReviewSub { onReview(episode: NEW_HOPE) { @@ -350,7 +350,7 @@ public void UploadScalar() => AssertResult( CreateIntegrationTest(profiles: new[] { - new TransportProfile("Default", TransportType.Http) + new TransportProfile("Default", TransportType.Http), }), skipWarnings: true, UploadQueries, @@ -362,7 +362,7 @@ public void UploadScalar_InMemory() => AssertResult( CreateIntegrationTest(profiles: new[] { - new TransportProfile("Default", TransportType.InMemory) + new TransportProfile("Default", TransportType.InMemory), }), skipWarnings: true, UploadQueries, diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.cs index 016567e2652..28287637088 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.cs @@ -105,8 +105,8 @@ public async Task Execute_Input_Argument() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(data, "test-file") } - } + Baz = new BazInput() { File = new Upload(data, "test-file") }, + }, }, null, null, @@ -138,16 +138,16 @@ public async Task Execute_InputList_Argument() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataA, "A") } - } + Baz = new BazInput() { File = new Upload(dataA, "A") }, + }, }, new TestInput() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataB, "B") } - } - } + Baz = new BazInput() { File = new Upload(dataB, "B") }, + }, + }, }, null, cancellationToken: ct); @@ -182,16 +182,16 @@ public async Task Execute_InputNested_Argument() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataA, "A") } - } + Baz = new BazInput() { File = new Upload(dataA, "A") }, + }, }, new TestInput() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataB, "B") } - } - } + Baz = new BazInput() { File = new Upload(dataB, "B") }, + }, + }, }, }, cancellationToken: ct); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.cs index d0c1f81b363..11cb3dd0dfc 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalar_InMemoryTest.cs @@ -92,8 +92,8 @@ public async Task Execute_Input_Argument() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(data, "test-file") } - } + Baz = new BazInput() { File = new Upload(data, "test-file") }, + }, }, null, null); @@ -122,16 +122,16 @@ public async Task Execute_InputList_Argument() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataA, "A") } - } + Baz = new BazInput() { File = new Upload(dataA, "A") }, + }, }, new TestInput() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataB, "B") } - } - } + Baz = new BazInput() { File = new Upload(dataB, "B") }, + }, + }, }, null); @@ -163,17 +163,17 @@ public async Task Execute_InputNested_Argument() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataA, "A") } - } + Baz = new BazInput() { File = new Upload(dataA, "A") }, + }, }, new TestInput() { Bar = new BarInput() { - Baz = new BazInput() { File = new Upload(dataB, "B") } - } - } - } + Baz = new BazInput() { File = new Upload(dataB, "B") }, + }, + }, + }, }); // assert diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/PersistedQueryGeneratorTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/PersistedQueryGeneratorTests.cs index bf5e240da22..6a6a41cd469 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/PersistedQueryGeneratorTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/PersistedQueryGeneratorTests.cs @@ -11,7 +11,7 @@ public void Simple_Custom_Scalar() => AssertResult( new AssertSettings { - RequestStrategy = RequestStrategyGen.PersistedQuery + RequestStrategy = RequestStrategyGen.PersistedQuery, }, "query GetPerson { person { name email } }", "type Query { person: Person }", diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/StarWarsGeneratorTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/StarWarsGeneratorTests.cs index 195f0b4cc0c..570823e78cc 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/StarWarsGeneratorTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/StarWarsGeneratorTests.cs @@ -97,7 +97,7 @@ public void Generate_Client_With_Internal_Access_Modifier() AssertStarWarsResult( new AssertSettings { StrictValidation = true, - AccessModifier = AccessModifier.Internal + AccessModifier = AccessModifier.Internal, }, @"query GetHero { hero(episode: NEW_HOPE) { diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/CSharpCompiler.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/CSharpCompiler.cs index f84a0c682d0..aa1b7d0ad5b 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/CSharpCompiler.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/CSharpCompiler.cs @@ -34,7 +34,7 @@ internal static class CSharpCompiler { // warning CS1702: Assuming assembly reference is of different version "CS1702", - "CS1701" + "CS1701", }; public static IReadOnlyList GetDiagnosticErrors(params string[] sourceText) diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/GeneratorTestHelper.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/GeneratorTestHelper.cs index 5eefb154dca..0282f46b141 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/GeneratorTestHelper.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/GeneratorTestHelper.cs @@ -29,7 +29,7 @@ public static IReadOnlyList AssertError(params string[] fileNames) new CSharpGeneratorSettings { Namespace = "Foo.Bar", - ClientName = "FooClient" + ClientName = "FooClient", }) .Result; @@ -97,7 +97,7 @@ public static void AssertResult( NoStore = settings.NoStore, InputRecords = settings.InputRecords, EntityRecords = settings.EntityRecords, - RazorComponents = settings.RazorComponents + RazorComponents = settings.RazorComponents, }); Assert.False( @@ -233,8 +233,8 @@ public static AssertSettings CreateIntegrationTest( NoStore = noStore, Profiles = (profiles ?? new[] { - TransportProfile.Default - }).ToList() + TransportProfile.Default, + }).ToList(), }; } diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Analyzers/DocumentAnalyzerTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Analyzers/DocumentAnalyzerTests.cs index fa650d6ec07..2bbeb66a704 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Analyzers/DocumentAnalyzerTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Analyzers/DocumentAnalyzerTests.cs @@ -31,7 +31,7 @@ public async Task One_Document_One_Op_One_Field_No_Fragments() { new(schema.ToDocument()), new(Utf8GraphQLParser.Parse( - @"extend scalar String @runtimeType(name: ""Abc"")")) + @"extend scalar String @runtimeType(name: ""Abc"")")), }); var document = @@ -98,7 +98,7 @@ public async Task One_Fragment_One_Deferred_Fragment() new(Utf8GraphQLParser.Parse( @"extend scalar String @runtimeType(name: ""Abc"")")), new(Utf8GraphQLParser.Parse( - "extend schema @key(fields: \"id\")")) + "extend schema @key(fields: \"id\")")), }); var document = diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ClientDescriptorMapperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ClientDescriptorMapperTests.cs index ceecf3f6891..1d6f1c082b5 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ClientDescriptorMapperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ClientDescriptorMapperTests.cs @@ -44,7 +44,7 @@ subscription OnReview { RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map(clientModel, context); OperationDescriptorMapper.Map(clientModel, context); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/DataTypeMapperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/DataTypeMapperTests.cs index 5d9c2dae423..79bc2d21933 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/DataTypeMapperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/DataTypeMapperTests.cs @@ -44,7 +44,7 @@ query GetHeroEdges { RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map( @@ -125,7 +125,7 @@ public void MapDataTypeDescriptors_DataUnionType() RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map( clientModel, @@ -219,7 +219,7 @@ public void MapDataTypeDescriptors_DataInterfaceType() RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map( clientModel, diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/EnumDescriptorMapperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/EnumDescriptorMapperTests.cs index 9b779c1f256..9c20e4373cd 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/EnumDescriptorMapperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/EnumDescriptorMapperTests.cs @@ -31,7 +31,7 @@ public async Task MapEnumTypeDescriptors() RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map(clientModel, context); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/OperationDescriptorMapperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/OperationDescriptorMapperTests.cs index 9c96e995adc..56d07a6f097 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/OperationDescriptorMapperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/OperationDescriptorMapperTests.cs @@ -46,7 +46,7 @@ subscription OnReview { RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map(clientModel, context); OperationDescriptorMapper.Map(clientModel, context); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ResultBuilderDescriptorMapperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ResultBuilderDescriptorMapperTests.cs index 41ca6c1dd17..e5f23b57392 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ResultBuilderDescriptorMapperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/ResultBuilderDescriptorMapperTests.cs @@ -46,7 +46,7 @@ subscription OnReview { RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map(clientModel, context); ResultBuilderDescriptorMapper.Map(clientModel, context); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TestDataHelper.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TestDataHelper.cs index 4e8dd8008c8..13f41b27606 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TestDataHelper.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TestDataHelper.cs @@ -19,7 +19,7 @@ public static ClientModel CreateClientModelAsync( new GraphQLFile[] { new(Utf8GraphQLParser.Parse(Open(schemaResource))), - new(Utf8GraphQLParser.Parse("extend schema @key(fields: \"id\")")) + new(Utf8GraphQLParser.Parse("extend schema @key(fields: \"id\")")), }); var document = Utf8GraphQLParser.Parse(Open(queryResource)); @@ -45,7 +45,7 @@ public static async Task CreateClientModelAsync(string query) new GraphQLFile[] { new(schema.ToDocument()), - new(Utf8GraphQLParser.Parse("extend schema @key(fields: \"id\")")) + new(Utf8GraphQLParser.Parse("extend schema @key(fields: \"id\")")), }); var document = Utf8GraphQLParser.Parse(query); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TypeDescriptorMapperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TypeDescriptorMapperTests.cs index 3095a8fd366..2f49082ed98 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TypeDescriptorMapperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Mappers/TypeDescriptorMapperTests.cs @@ -31,7 +31,7 @@ public async Task MapClientTypeDescriptors() RequestStrategyGen.Default, new[] { - TransportProfile.Default + TransportProfile.Default, }); TypeDescriptorMapper.Map(clientModel, context); diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/QueryDocumentRewriterTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/QueryDocumentRewriterTests.cs index da32becc0c2..cf711159b7d 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/QueryDocumentRewriterTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/QueryDocumentRewriterTests.cs @@ -27,7 +27,7 @@ public async Task GetReturnTypeName() new GraphQLFile[] { new(schema.ToDocument()), - new(Utf8GraphQLParser.Parse("extend schema @key(fields: \"id\")")) + new(Utf8GraphQLParser.Parse("extend schema @key(fields: \"id\")")), }); var document = diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/SchemaHelperTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/SchemaHelperTests.cs index 9d96c526121..e847ea0bb2a 100644 --- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/SchemaHelperTests.cs +++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Tests/Utilities/SchemaHelperTests.cs @@ -21,7 +21,7 @@ public void LoadGitHubSchema() new GraphQLFile[] { new("GitHub.graphql", Utf8GraphQLParser.Parse(schemaSdl)), - new("GitHub.extensions.graphql", Utf8GraphQLParser.Parse(extensionsSdl)) + new("GitHub.extensions.graphql", Utf8GraphQLParser.Parse(extensionsSdl)), }); // assert diff --git a/src/StrawberryShake/Tooling/src/Configuration/GraphQLConfig.cs b/src/StrawberryShake/Tooling/src/Configuration/GraphQLConfig.cs index dc8885a8800..2ebb74fd934 100644 --- a/src/StrawberryShake/Tooling/src/Configuration/GraphQLConfig.cs +++ b/src/StrawberryShake/Tooling/src/Configuration/GraphQLConfig.cs @@ -25,7 +25,7 @@ public override string ToString() new StrawberryShakeSettingsTransportProfile { Default = TransportType.Http, - Subscription = TransportType.WebSocket + Subscription = TransportType.WebSocket, }); } @@ -56,7 +56,7 @@ public static GraphQLConfig FromJson(string json) new StrawberryShakeSettingsTransportProfile { Default = TransportType.Http, - Subscription = TransportType.WebSocket + Subscription = TransportType.WebSocket, }); } diff --git a/src/StrawberryShake/Tooling/src/Configuration/RequestStrategy.cs b/src/StrawberryShake/Tooling/src/Configuration/RequestStrategy.cs index 50d1d90f55e..2f447e0aa8e 100644 --- a/src/StrawberryShake/Tooling/src/Configuration/RequestStrategy.cs +++ b/src/StrawberryShake/Tooling/src/Configuration/RequestStrategy.cs @@ -4,5 +4,5 @@ public enum RequestStrategy { Default = 0, PersistedQuery = 1, - AutomaticPersistedQuery = 2 + AutomaticPersistedQuery = 2, } diff --git a/src/StrawberryShake/Tooling/src/Configuration/StrawberryShakeSettings.cs b/src/StrawberryShake/Tooling/src/Configuration/StrawberryShakeSettings.cs index cfca6673ade..8a3b550f464 100644 --- a/src/StrawberryShake/Tooling/src/Configuration/StrawberryShakeSettings.cs +++ b/src/StrawberryShake/Tooling/src/Configuration/StrawberryShakeSettings.cs @@ -74,7 +74,7 @@ public class StrawberryShakeSettings new() { Inputs = false, - Entities = false + Entities = false, }; /// diff --git a/src/StrawberryShake/Tooling/src/Configuration/TransportType.cs b/src/StrawberryShake/Tooling/src/Configuration/TransportType.cs index ec7064a82e7..a16bd7e42a2 100644 --- a/src/StrawberryShake/Tooling/src/Configuration/TransportType.cs +++ b/src/StrawberryShake/Tooling/src/Configuration/TransportType.cs @@ -6,5 +6,5 @@ public enum TransportType WebSocket = 1, InMemory = 2, SignalR = 3, - Grpc = 4 + Grpc = 4, } \ No newline at end of file diff --git a/src/StrawberryShake/Tooling/src/dotnet-graphql/GeneratorHelpers.cs b/src/StrawberryShake/Tooling/src/dotnet-graphql/GeneratorHelpers.cs index d066d0f8e2e..64bd438d932 100644 --- a/src/StrawberryShake/Tooling/src/dotnet-graphql/GeneratorHelpers.cs +++ b/src/StrawberryShake/Tooling/src/dotnet-graphql/GeneratorHelpers.cs @@ -87,7 +87,7 @@ private static AccessModifier GetAccessModifier(string? accessModifier) { "public" => AccessModifier.Public, "internal" => AccessModifier.Internal, - _ => throw new NotSupportedException($"The access modifier `{accessModifier}` is not supported.") + _ => throw new NotSupportedException($"The access modifier `{accessModifier}` is not supported."), }; } @@ -98,7 +98,7 @@ private static IDocumentHashProvider GetHashProvider(string hashAlgorithm) "sha1" => new Sha1DocumentHashProvider(HashFormat.Hex), "sha256" => new Sha256DocumentHashProvider(HashFormat.Hex), _ => throw new NotSupportedException( - $"The hash algorithm `{hashAlgorithm}` is not supported.") + $"The hash algorithm `{hashAlgorithm}` is not supported."), }; private static List MapTransportProfiles( diff --git a/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs b/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs index 58f300916da..d26b75798da 100644 --- a/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs +++ b/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs @@ -135,9 +135,9 @@ private async Task WriteConfigurationAsync( { Name = context.ClientName, Namespace = context.CustomNamespace, - Url = context.Uri - } - } + Url = context.Uri, + }, + }, }; await FileSystem.WriteTextAsync(configFilePath, configuration.ToString()).ConfigureAwait(false); diff --git a/src/StrawberryShake/Tooling/src/dotnet-graphql/JsonConsoleOutputCommand.cs b/src/StrawberryShake/Tooling/src/dotnet-graphql/JsonConsoleOutputCommand.cs index edc0464885c..063c3a1a20a 100644 --- a/src/StrawberryShake/Tooling/src/dotnet-graphql/JsonConsoleOutputCommand.cs +++ b/src/StrawberryShake/Tooling/src/dotnet-graphql/JsonConsoleOutputCommand.cs @@ -22,7 +22,7 @@ public void Dispose() #else IgnoreNullValues = true, #endif - IgnoreReadOnlyProperties = false + IgnoreReadOnlyProperties = false, }); Console.WriteLine(json); } diff --git a/src/StrawberryShake/Tooling/src/dotnet-graphql/OAuth/TokenClient.cs b/src/StrawberryShake/Tooling/src/dotnet-graphql/OAuth/TokenClient.cs index f67463c0f79..e3e79c5ded8 100644 --- a/src/StrawberryShake/Tooling/src/dotnet-graphql/OAuth/TokenClient.cs +++ b/src/StrawberryShake/Tooling/src/dotnet-graphql/OAuth/TokenClient.cs @@ -22,7 +22,7 @@ public static async Task GetTokenAsync( Address = tokenEndpoint, ClientId = clientId, ClientSecret = clientSecret, - Scope = string.Join(" ", scopes) + Scope = string.Join(" ", scopes), }, cancellationToken).ConfigureAwait(false); return tokenRes.AccessToken; diff --git a/src/StrawberryShake/Tooling/src/dotnet-graphql/packages.lock.json b/src/StrawberryShake/Tooling/src/dotnet-graphql/packages.lock.json index 39a1712a7ae..44e4a60bb69 100644 --- a/src/StrawberryShake/Tooling/src/dotnet-graphql/packages.lock.json +++ b/src/StrawberryShake/Tooling/src/dotnet-graphql/packages.lock.json @@ -1242,7 +1242,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[6.0.0, )", "System.Threading.Channels": "[6.0.0, )" @@ -2628,7 +2628,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[7.0.0, )", "System.Threading.Channels": "[7.0.0, )" @@ -4014,7 +4014,7 @@ "HotChocolate.Execution.Abstractions": "[0.0.0, )", "HotChocolate.Fetching": "[0.0.0, )", "HotChocolate.Types": "[0.0.0, )", - "HotChocolate.Utilities.DependencyInjection": "[14.0.0-preview.build.0, )", + "HotChocolate.Utilities.DependencyInjection": "[0.0.0, )", "HotChocolate.Validation": "[0.0.0, )", "Microsoft.Extensions.DependencyInjection": "[8.0.0, )", "System.Threading.Channels": "[8.0.0, )"