Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directive Collision Rules are Inconsistent #106

Open
PascalSenn opened this issue Jan 2, 2025 · 0 comments
Open

Directive Collision Rules are Inconsistent #106

PascalSenn opened this issue Jan 2, 2025 · 0 comments

Comments

@PascalSenn
Copy link
Contributor

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

  1. 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`
    
  2. 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

  1. Inconsistent Scope:

    • OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE focuses specifically on @override and @external collisions, while EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE handles @external with @require and @provides.
    • Why does @override have its own rule, while other directive collisions are grouped under EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE?
  2. 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:

  1. EXTERNAL_OVERRIDE_COLLISION:
  2. EXTERNAL_PROVIDES_COLLISION:
  3. EXTERNAL_REQUIRE_COLLISION:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant