-
Notifications
You must be signed in to change notification settings - Fork 14
Labels
Description
The current validation rules for directive collisions in schema composition, specifically EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE and OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE, appear to be both inconsistent and incomplete.
Current Behavior
Rules and Algorithms
-
OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE- Let {schemas} be the set of all source schemas to be composed. - For each {schema} in {schemas}: - Let {types} be the set of all composite types in {schema}. - For each {type} in {types}: - Let {fields} be the set of fields on {type}. - For each {field} in {fields}: - If {field} is annotated with `@override`: - {field} must **not** be annotated with `@external` -
EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE- Let {schemas} be the set of all source schemas to be composed. - For each {schema} in {schemas}: - Let {types} be the set of all composite types in {schema}. - For each {type} in {types}: - Let {fields} be the set of fields on {type}. - For each {field} in {fields}: - If {field} is annotated with `@external`: - For each {argument} in {field}: - {argument} must **not** be annotated with `@require` - {field} must **not** be annotated with `@provides`
Issues with the Current Rules
-
Inconsistent Scope:
OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVEfocuses specifically on@overrideand@externalcollisions, whileEXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVEhandles@externalwith@requireand@provides.- Why does
@overridehave its own rule, while other directive collisions are grouped underEXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE?
-
Ambiguity:
- It’s unclear which directives fall under the scope of each rule. This makes understanding and maintaining these rules challenging.
Proposal
Introduce a separate rule for each combination of directives. Examples:
EXTERNAL_OVERRIDE_COLLISION:EXTERNAL_PROVIDES_COLLISION:EXTERNAL_REQUIRE_COLLISION: