private static ITypeReference RewriteTypeToNullableType(
        FilterFieldDefinition definition,
        ITypeInspector typeInspector)
    {
        ITypeReference reference = definition.Type;

        if (reference is ExtendedTypeReference extendedTypeRef)
        {
            return(extendedTypeRef.Type.IsNullable
                ? extendedTypeRef
                : extendedTypeRef.WithType(
                       typeInspector.ChangeNullability(extendedTypeRef.Type, true)));
        }

        if (reference is SchemaTypeReference schemaRef)
        {
            return(schemaRef.Type is NonNullType nnt
                ? schemaRef.WithType(nnt.Type)
                : schemaRef);
        }

        if (reference is SyntaxTypeReference syntaxRef)
        {
            return(syntaxRef.Type is NonNullTypeNode nnt
                ? syntaxRef.WithType(nnt.Type)
                : syntaxRef);
        }

        throw new NotSupportedException();
    }
Exemple #2
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     FilterInputTypeDefinition typeDefinition,
     FilterFieldDefinition fieldDefinition)
 {
     return(true);
 }
Exemple #3
0
 public Response DeleteFilterField([FromBody] FilterFieldDefinition filterField)
 {
     return(GetResponse(() =>
     {
         new EditorService(User).DeleteFilterField(filterField);
     }));
 }
Exemple #4
0
 public Response <FilterFieldDefinition> CreateFilterField([FromBody] FilterFieldDefinition filterField)
 {
     return(GetResponse(() =>
     {
         return new EditorService(User).CreateFilterField(filterField);
     }));
 }
Exemple #5
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     FilterInputTypeDefinition typeDefinition,
     FilterFieldDefinition fieldDefinition)
 {
     return(fieldDefinition is FilterOperationFieldDefinition def &&
            def.Id == DefaultOperations.Data);
 }
Exemple #6
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     FilterInputTypeDefinition typeDefinition,
     FilterFieldDefinition fieldDefinition)
 {
     return(fieldDefinition is FilterOperationFieldDefinition {
         Id : 155
     });
Exemple #7
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     FilterInputTypeDefinition typeDefinition,
     FilterFieldDefinition fieldDefinition)
 {
     return(context.Type is IEnumOperationInput &&
            fieldDefinition is FilterOperationFieldDefinition operationField &&
            operationField.Id == Operation);
 }
Exemple #8
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     FilterInputTypeDefinition typeDefinition,
     FilterFieldDefinition fieldDefinition)
 {
     return(context.Type is IListFilterInputType &&
            fieldDefinition is FilterOperationFieldDefinition operationField &&
            operationField.Id == DefaultOperations.Any);
 }
 public static SchemaException FilterInterceptor_NoHandlerFoundForField(
     FilterInputTypeDefinition type,
     FilterFieldDefinition field) =>
 new SchemaException(
     SchemaErrorBuilder.New()
     .SetMessage(
         "For the field {0} of type {1} was no handler found.",
         field.Name,
         type.Name)
     .Build());
 public static SchemaException FilterInterceptor_NoHandlerFoundForField(
     FilterInputTypeDefinition type,
     FilterFieldDefinition field) =>
 new SchemaException(
     SchemaErrorBuilder.New()
     .SetMessage(
         DataResources.FilterInterceptor_NoHandlerFoundForField,
         field.Name,
         type.Name)
     .Build());
Exemple #11
0
 internal FilterField(FilterFieldDefinition definition)
     : base(definition, default)
 {
     Member  = definition.Member;
     Handler = definition.Handler !;
 }
Exemple #12
0
 public override bool CanHandle(
     ITypeDiscoveryContext context,
     FilterInputTypeDefinition typeDefinition,
     FilterFieldDefinition fieldDefinition) =>
 !(fieldDefinition is FilterOperationFieldDefinition) &&
 fieldDefinition.Member is not null;