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

Add enum types valuemust be the same across source schemas #42

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions spec/Section 4 -- Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ ENUM_VALUES_MUST_BE_THE_SAME_ACROSS_SCHEMAS

**Formal Specification**

- Let {enumsByName} be a map where the key is the name of an enum type, and the value is a list of all enum types from different source schemas with that name.
- For each {listOfEnums} in {enumsByName}:
- {EnumsAreMergeable(listOfEnums)} must be true.
- Let {enumNames} be the set of all enum type names across all source schemas.
- For each {enumName} in {enumNames}:
- Let {enums} be the list of all enum types from different source schemas with the name {enumName}.
- {EnumsAreMergeable(enums)} must be true.

EnumsAreMergeable(enums):

- Let {values} be the set of all values of the first enum in {enums}
- Let {inaccessibleValues} be the set of values that are declared as `@inaccessible` in {enums}.
- Let {requriedValues} be the set of values in {enums} that are not in {inaccessibleValues}.
PascalSenn marked this conversation as resolved.
Show resolved Hide resolved
- For each {enum} in {enums}
- Let {enumValues} be the set of all values of {enum}
- {values} must be equal to {enumValues}
- Let {enumValues} be the set of all values of {enum} that are not in {inaccessibleValues}.
- {requriedValues} must be equal to {enumValues}
PascalSenn marked this conversation as resolved.
Show resolved Hide resolved

**Explanatory Text**

Expand Down Expand Up @@ -66,6 +68,19 @@ enum Enum1 {
}
```

Here, the two definitions of `Enum1` have shared values and additional values declared as `@inaccessible`, satisfying the rule:

```graphql example
enum Enum1 {
BAR
BAZ @inaccessible
}

enum Enum1 {
BAR
}
```

### Merge

### Post Merge Validation
Expand Down