@@ -377,6 +377,53 @@ public void FilterInputType_Should_InfereType_When_ItIsAInterface()
377377 schema . MatchSnapshot ( ) ;
378378 }
379379
380+ [ Fact ]
381+ public void FilterInputType_WithGlobalObjectIdentification_AppliesGlobalIdFormatter ( )
382+ {
383+ // arrange
384+ var builder = SchemaBuilder . New ( )
385+ . ModifyOptions ( x => x . StrictValidation = false )
386+ . AddGlobalObjectIdentification ( )
387+ . AddFiltering ( )
388+ . AddQueryType (
389+ d => d
390+ . Field ( "books" )
391+ . UseFiltering < BookFilterInput > ( )
392+ . Resolve ( new List < Book > ( ) ) ) ;
393+
394+ // act
395+ var schema = builder . Create ( ) ;
396+ var idFilterField = ( ( BookFilterInput ) schema . Types [ nameof ( BookFilterInput ) ] ) . Fields [ "id" ] ;
397+
398+ // assert
399+ Assert . True (
400+ ( ( IdOperationFilterInputType ) idFilterField . Type ) . Fields . All (
401+ f => f . Formatter is FilterGlobalIdInputValueFormatter ) ) ;
402+ }
403+
404+ [ Fact ]
405+ public void FilterInputType_WithoutGlobalObjectIdentification_DoesNotApplyGlobalIdFormatter ( )
406+ {
407+ // arrange
408+ var builder = SchemaBuilder . New ( )
409+ . ModifyOptions ( x => x . StrictValidation = false )
410+ . AddFiltering ( )
411+ . AddQueryType (
412+ d => d
413+ . Field ( "books" )
414+ . UseFiltering < BookFilterInput > ( )
415+ . Resolve ( new List < Book > ( ) ) ) ;
416+
417+ // act
418+ var schema = builder . Create ( ) ;
419+ var idFilterField = ( ( BookFilterInput ) schema . Types [ nameof ( BookFilterInput ) ] ) . Fields [ "id" ] ;
420+
421+ // assert
422+ Assert . True (
423+ ( ( IdOperationFilterInputType ) idFilterField . Type ) . Fields . All (
424+ f => f . Formatter is not FilterGlobalIdInputValueFormatter ) ) ;
425+ }
426+
380427 [ Fact ]
381428 public async Task Execute_CoerceWhereArgument_MatchesSnapshot ( )
382429 {
@@ -608,4 +655,12 @@ public class FilterWithStruct
608655 }
609656
610657 public record struct ExampleValueType ( string Foo , string Bar ) ;
658+
659+ private class BookFilterInput : FilterInputType < Book >
660+ {
661+ protected override void Configure ( IFilterInputTypeDescriptor < Book > descriptor )
662+ {
663+ descriptor . Field ( b => b . Id ) . Type < IdOperationFilterInputType > ( ) ;
664+ }
665+ }
611666}
0 commit comments