graph-quilt / graph-quilt/graphql-xtext

Validate types implement interfaces

Open
#25 1 comment 0 reactions 0 assignees View on GitHub
enhancement hacktoberfest hacktoberfest2023
Dominant language
Xtend
Stars
21
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Add a schema validation rule ensuring object and interface types have all the fields that they need to implement the interfaces they say they implement.

```
//Object
ObjectTypeDefinition : desc=StringValue? 'type' name=Name implementsInterfaces=ImplementsInterfaces? directives+=Directive* ('{' fieldDefinition+=FieldDefinition* '}')?;
ObjectTypeExtensionDefinition:'extend' 'type' name=Name implementsInterfaces=ImplementsInterfaces? directives+=Directive* ('{' fieldDefinition+=FieldDefinition* '}')? ;

//Interface
InterfaceTypeDefinition : desc=StringValue? 'interface' name=Name implementsInterfaces=ImplementsInterfaces? directives+=Directive* ('{' fieldDefinition+=FieldDefinition* '}')?;

InterfaceTypeExtensionDefinition: 'extend' 'interface' name=Name implementsInterfaces=ImplementsInterfaces? directives+=Directive* ('{' fieldDefinition+=FieldDefinition* '}')?;
```

[Other validations for reference](https://github.com/graph-quilt/graphql-xtext/tree/master/com.intuit.graphql.parent/com.intuit.graphql/src/com/intuit/graphql/validation)

Add to an existing validation class or link a new validation [here](https://github.com/graph-quilt/graphql-xtext/blob/82f5b5adffea5df64b4e953ae2c63a83bdbf66c6/com.intuit.graphql.parent/com.intuit.graphql/src/com/intuit/graphql/validation/GraphQLValidator.java#L14)

[similar validation in graphql-java](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/validation/TypesImplementInterfaces.java)

Contributor guide

Open the contributing guide

Research direction

Start with the existing validators under com.intuit.graphql.parent/com.intuit.graphql/src/com/intuit/graphql/validation and inspect the GraphQLValidator.java link to see how validations are registered. Compare the requested rule with the graphql-java TypesImplementInterfaces.java reference. Done means object and interface types are rejected when they omit fields required by declared interfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, java
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.