-
Notifications
You must be signed in to change notification settings - Fork 9
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
Adds Input With Missing Required Fields #41
Open
PascalSenn
wants to merge
10
commits into
graphql:main
Choose a base branch
from
PascalSenn:pse/adds-input-with-different-fields
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bdf5886
Adds input with differnt fields to composition
PascalSenn 95d5ec4
Adds input with differnt fields to composition
PascalSenn d073806
Update spec/Section 4 -- Composition.md
PascalSenn 54f2927
Update spec/Section 4 -- Composition.md
PascalSenn ba43537
Update spec/Section 4 -- Composition.md
PascalSenn 3b67439
Update spec/Section 4 -- Composition.md
PascalSenn 7b0398b
Update spec/Section 4 -- Composition.md
PascalSenn 1847dfa
Update spec/Section 4 -- Composition.md
PascalSenn c50924a
Update spec/Section 4 -- Composition.md
PascalSenn 5732570
Cleanup rule
PascalSenn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,80 @@ run in sequence to produce the composite execution schema. | |
|
||
### Pre Merge Validation | ||
|
||
#### **Input With Missing Required Fields** | ||
|
||
**Error Code:** | ||
|
||
REQUIRED_INPUT_FIELD_MISSING_IN_SOME_SUBGRAPH | ||
|
||
**Severity:** | ||
|
||
ERROR | ||
|
||
**Formal Specification:** | ||
|
||
- Let {typeNames} be the set of all input object types from all source schemas that are not declared as `@inaccessible`. | ||
- For each {typeName} in {typeNames}: | ||
- Let `{types}` be the list of all input object types from different source schemas with the name {typeName}. | ||
- `{AreTypesConsistent(types)}` must be true. | ||
|
||
**Function Definition:** | ||
|
||
`AreTypesConsistent(inputs):` | ||
|
||
- Let `{requiredFields}` be the intersection of all required field names across all input objects in `{inputs}`. | ||
- For each `{input}` in `{inputs}`: | ||
- Let `{inputFields}` be the set of all field names in of required fields in `{input}`. | ||
- `{inputFields}` must equal `{requiredFields}`. | ||
|
||
**Explanatory Text** | ||
|
||
Input types are merged by intersection, meaning that the merged input type will have all fields that are present in all input types with the same name. | ||
This rule ensures that input object types with the same name across different subgraphs share a consistent set of required fields. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we reverting to "subgraph" naming again? |
||
|
||
When an input object is defined across multiple subgraphs, this rule ensures that any required field present in one subgraph is present in all others defining the input object. | ||
This allows for reliable usage of input objects in queries across subgraphs. | ||
|
||
### Examples | ||
|
||
**Valid Example:** | ||
|
||
If all subgraphs define `Input1` with the required field `field1`, the rule is satisfied: | ||
|
||
```graphql | ||
# Subgraph 1 | ||
input Input1 { | ||
field1: String! | ||
field2: String | ||
} | ||
|
||
# Subgraph 2 | ||
input Input1 { | ||
field1: String! | ||
field3: Int | ||
} | ||
``` | ||
|
||
**Invalid Example:** | ||
|
||
If `field1` is required in one subgraph but missing in another, this violates the rule: | ||
|
||
```graphql | ||
# Subgraph 1 | ||
input Input1 { | ||
field1: String! | ||
field2: String | ||
} | ||
|
||
# Subgraph 2 | ||
input Input1 { | ||
field2: String | ||
field3: Int | ||
} | ||
``` | ||
|
||
In this invalid case, `field1` is mandatory in `Subgraph 1` but not defined in `Subgraph 2`, causing inconsistency in required fields across subgraphs. | ||
|
||
PascalSenn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### Merge | ||
|
||
### Post Merge Validation | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.