@@ -119,8 +119,8 @@ export type bySeed = typeof bySeed
119119export const bySeed = invert ( byTag )
120120
121121export const identifier = fc . stringMatching ( new RegExp ( PATTERN . identifierNoDollar , 'u' ) ) . map ( ( x ) => `${ x . charAt ( 0 ) . toUpperCase ( ) } ${ x . slice ( 1 ) } ` )
122- export const name = fc . lorem ( { maxCount : 1 } )
123- export const alias = name
122+ // export const name = fc.lorem({ maxCount: 1 })
123+ export const alias = identifier
124124export const target = fc . constantFrom ( ...F . DirectiveTargets )
125125
126126export const description = ( $ : Constraints ) => $ . noDescriptions ? fc . constant ( null ) : fc . oneof (
@@ -253,7 +253,7 @@ export declare namespace Seed {
253253 Field : byTag [ 'Field' ] ,
254254 name : string ,
255255 alias : string ,
256- selectionSet : T ,
256+ selectionSet : T | null ,
257257 arguments : readonly T [ ] ,
258258 directives : readonly T [ ] ,
259259 ]
@@ -570,7 +570,7 @@ export type Seed<T = unknown> = (
570570
571571const NamedType = ( _tie : fc . LetrecTypedTie < Seed > , _$ : Constraints ) : fc . Arbitrary < Seed . NamedType > => fc . tuple (
572572 fc . constant ( byTag [ 'NamedType' ] ) ,
573- name ,
573+ identifier ,
574574)
575575
576576const Boolean = ( _tie : fc . LetrecTypedTie < Seed > , _$ : Constraints ) : fc . Arbitrary < Seed . Boolean > => fc . constant ( [ byTag [ 'Boolean' ] ] )
@@ -599,12 +599,12 @@ const ScalarTypeDefinition = (_tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc
599599
600600const EnumValue = ( _tie : fc . LetrecTypedTie < Seed > , _$ : Constraints ) : fc . Arbitrary < Seed . EnumValue > => fc . tuple (
601601 fc . constant ( byTag [ 'EnumValue' ] ) ,
602- name ,
602+ identifier ,
603603)
604604
605605const EnumValueDefinition = ( _tie : fc . LetrecTypedTie < Seed > , _$ : Constraints ) : fc . Arbitrary < Seed . EnumValueDefinition > => fc . tuple (
606606 fc . constant ( byTag [ 'EnumValueDefinition' ] ) ,
607- name ,
607+ identifier ,
608608)
609609
610610/**
@@ -680,7 +680,7 @@ const NonNullType = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrary
680680 */
681681const UnionTypeDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . UnionTypeDefinition > => fc . tuple (
682682 fc . constant ( byTag [ 'UnionTypeDefinition' ] ) ,
683- name ,
683+ identifier ,
684684 fc . uniqueArray (
685685 NamedType ( tie , $ ) ,
686686 $ . NamedType !
@@ -709,7 +709,7 @@ const UnionTypeDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.A
709709 */
710710const Variable = ( _tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . Variable > => fc . tuple (
711711 fc . constant ( byTag [ 'Variable' ] ) ,
712- name ,
712+ identifier ,
713713 description ( $ ) ,
714714)
715715
@@ -733,9 +733,9 @@ const Variable = (_tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrary<S
733733 */
734734const EnumTypeDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . EnumTypeDefinition > => fc . tuple (
735735 fc . constant ( byTag [ 'EnumTypeDefinition' ] ) ,
736- name ,
736+ identifier ,
737737 description ( $ ) ,
738- fc . uniqueArray ( name ) ,
738+ fc . uniqueArray ( identifier ) ,
739739 fc . uniqueArray (
740740 // TODO:
741741 // ConstDirective(tie, $),
@@ -766,9 +766,11 @@ const EnumTypeDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Ar
766766 */
767767const Field = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . Field > => fc . tuple (
768768 fc . constant ( byTag [ 'Field' ] ) ,
769- name ,
769+ identifier ,
770770 alias ,
771- tie ( 'SelectionSet' ) ,
771+ fc . oneof (
772+ fc . constant ( null ) , NonEmptySelectionSet ( tie , $ )
773+ ) ,
772774 fc . uniqueArray (
773775 tie ( 'Argument' ) ,
774776 $ . Argument !
@@ -801,7 +803,7 @@ const Field = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrary<Seed.
801803 */
802804const FieldDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . FieldDefinition > => fc . tuple (
803805 fc . constant ( byTag [ 'FieldDefinition' ] ) ,
804- name ,
806+ identifier ,
805807 description ( $ ) ,
806808 TypeNode ( tie , $ ) ,
807809 fc . uniqueArray (
@@ -911,7 +913,7 @@ const InterfaceTypeDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints):
911913 */
912914const Argument = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . Argument > => fc . tuple (
913915 fc . constant ( byTag [ 'Argument' ] ) ,
914- name ,
916+ identifier ,
915917 ValueNode ( tie , $ ) ,
916918)
917919
@@ -935,7 +937,7 @@ const Argument = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrary<Se
935937 */
936938const InputObjectTypeDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . InputObjectTypeDefinition > => fc . tuple (
937939 fc . constant ( byTag [ 'InputObjectTypeDefinition' ] ) ,
938- name ,
940+ identifier ,
939941 description ( $ ) ,
940942 fc . uniqueArray (
941943 tie ( 'InputValueDefinition' ) ,
@@ -971,7 +973,7 @@ const InputObjectTypeDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints)
971973 */
972974const InputValueDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . InputValueDefinition > => fc . tuple (
973975 fc . constant ( byTag [ 'InputValueDefinition' ] ) ,
974- name ,
976+ identifier ,
975977 description ( $ ) ,
976978 TypeNode ( tie , $ ) ,
977979 ConstValueNode ( tie , $ ) ,
@@ -1002,7 +1004,7 @@ const InputValueDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.
10021004 */
10031005const VariableDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . VariableDefinition > => fc . tuple (
10041006 fc . constant ( byTag [ 'VariableDefinition' ] ) ,
1005- name ,
1007+ identifier ,
10061008 TypeNode ( tie , $ ) ,
10071009 ConstValueNode ( tie , $ ) ,
10081010 fc . uniqueArray (
@@ -1030,7 +1032,7 @@ const VariableDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Ar
10301032const Directive = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . Directive > => {
10311033 return fc . tuple (
10321034 fc . constant ( byTag [ 'Directive' ] ) ,
1033- name ,
1035+ identifier ,
10341036 fc . uniqueArray (
10351037 tie ( 'Argument' ) ,
10361038 $ . Argument !
@@ -1060,7 +1062,7 @@ const Directive = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrary<S
10601062 */
10611063const DirectiveDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . DirectiveDefinition > => fc . tuple (
10621064 fc . constant ( byTag [ 'DirectiveDefinition' ] ) ,
1063- name ,
1065+ identifier ,
10641066 description ( $ ) ,
10651067 fc . boolean ( ) ,
10661068 fc . uniqueArray (
@@ -1093,8 +1095,8 @@ const DirectiveDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.A
10931095 */
10941096const FragmentDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . FragmentDefinition > => fc . tuple (
10951097 fc . constant ( byTag [ 'FragmentDefinition' ] ) ,
1096- name ,
1097- name ,
1098+ identifier ,
1099+ identifier ,
10981100 tie ( 'SelectionSet' ) ,
10991101 fc . uniqueArray (
11001102 tie ( 'Directive' ) ,
@@ -1119,7 +1121,7 @@ const FragmentDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Ar
11191121 */
11201122const FragmentSpread = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . FragmentSpread > => fc . tuple (
11211123 fc . constant ( byTag [ 'FragmentSpread' ] ) ,
1122- name ,
1124+ identifier ,
11231125 fc . uniqueArray (
11241126 tie ( 'Directive' ) ,
11251127 $ . Directive !
@@ -1144,14 +1146,23 @@ const FragmentSpread = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitr
11441146 */
11451147const InlineFragment = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . InlineFragment > => fc . tuple (
11461148 fc . constant ( byTag [ 'InlineFragment' ] ) ,
1147- name ,
1148- tie ( 'SelectionSet' ) ,
1149+ identifier ,
1150+ NonEmptySelectionSet ( tie , $ ) ,
11491151 fc . uniqueArray (
11501152 tie ( 'Directive' ) ,
11511153 $ . Directive !
11521154 ) ,
11531155)
11541156
1157+ // used in OperationDefinition
1158+ const NonEmptySelectionSet = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . SelectionSet > => fc . tuple (
1159+ fc . constant ( byTag [ 'SelectionSet' ] ) ,
1160+ fc . uniqueArray (
1161+ Selection ( tie , $ ) ,
1162+ { ...$ . SelectionSet , minLength : 1 } ,
1163+ ) ,
1164+ )
1165+
11551166/**
11561167 * @example
11571168 * type OperationDefinition<T = unknown> = [
@@ -1174,9 +1185,9 @@ const InlineFragment = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitr
11741185 */
11751186const OperationDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . OperationDefinition > => fc . tuple (
11761187 fc . constant ( byTag [ 'OperationDefinition' ] ) ,
1177- name ,
1188+ identifier ,
11781189 operationType ,
1179- tie ( 'SelectionSet' ) ,
1190+ NonEmptySelectionSet ( tie , $ ) ,
11801191 fc . uniqueArray (
11811192 tie ( 'VariableDefinition' ) ,
11821193 $ . VariableDefinition !
@@ -1185,7 +1196,6 @@ const OperationDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.A
11851196 tie ( 'Directive' ) ,
11861197 $ . Directive !
11871198 ) ,
1188- // tie('Directive'),
11891199)
11901200
11911201/**
@@ -1204,7 +1214,7 @@ const OperationDefinition = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.A
12041214 */
12051215const OperationTypeDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . OperationTypeDefinition > => fc . tuple (
12061216 fc . constant ( byTag [ 'OperationTypeDefinition' ] ) ,
1207- name ,
1217+ identifier ,
12081218 operationType ,
12091219 // tie('OperationT'),
12101220)
@@ -1247,7 +1257,7 @@ const SelectionSet = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrar
12471257 */
12481258const SchemaDefinition = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . SchemaDefinition > => fc . tuple (
12491259 fc . constant ( byTag [ 'SchemaDefinition' ] ) ,
1250- name ,
1260+ identifier ,
12511261 description ( $ ) ,
12521262 fc . uniqueArray (
12531263 OperationTypeDefinition ( tie , $ ) ,
@@ -1304,7 +1314,7 @@ const Document = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitrary<Se
13041314 */
13051315const ConstArgument = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . Argument > => fc . tuple (
13061316 fc . constant ( byTag [ 'Argument' ] ) ,
1307- name ,
1317+ identifier ,
13081318 ConstValueNode ( tie , $ ) ,
13091319)
13101320
@@ -1324,7 +1334,7 @@ const ConstArgument = (tie: fc.LetrecTypedTie<Seed>, $: Constraints): fc.Arbitra
13241334 */
13251335const ConstDirective = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . Directive > => fc . tuple (
13261336 fc . constant ( byTag [ 'Directive' ] ) ,
1327- name ,
1337+ identifier ,
13281338 fc . uniqueArray (
13291339 ConstArgument ( tie , $ ) ,
13301340 $ . Argument !
@@ -1385,7 +1395,7 @@ const ValueNode = (_tie: fc.LetrecTypedTie<Seed>, $: Constraints) => fc.oneof(
13851395 BooleanValue ( _tie , $ ) ,
13861396 NullValue ( _tie , $ ) ,
13871397 EnumValue ( _tie , $ ) ,
1388- Variable ( _tie , $ ) ,
1398+ // Variable(_tie, $),
13891399 // ObjectValue(),
13901400 // ListValue(),
13911401)
@@ -1406,7 +1416,7 @@ const ValueNode = (_tie: fc.LetrecTypedTie<Seed>, $: Constraints) => fc.oneof(
14061416 */
14071417const ObjectField = ( tie : fc . LetrecTypedTie < Seed > , $ : Constraints ) : fc . Arbitrary < Seed . ObjectField > => fc . tuple (
14081418 fc . constant ( byTag [ 'ObjectField' ] ) ,
1409- name ,
1419+ identifier ,
14101420 ValueNode ( tie , $ ) ,
14111421)
14121422
0 commit comments