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

Schema validation: interfaces #229

Closed
ghostdogpr opened this issue Feb 22, 2020 · 4 comments
Closed

Schema validation: interfaces #229

ghostdogpr opened this issue Feb 22, 2020 · 4 comments
Labels
good first issue Good for newcomers server Issue related to caliban server

Comments

@ghostdogpr
Copy link
Owner

ghostdogpr commented Feb 22, 2020

In Validator.validateSchema, verify the rules for interface types

  1. An Interface type must define one or more fields.
  2. For each field of an Interface type:
    1. The field must have a unique name within that Interface type;
      no two fields may share the same name.
    2. The field must not have a name which begins with the
      characters {"__"} (two underscores).
    3. The field must return a type where {IsOutputType(fieldType)}
      returns {true}.
    4. For each argument of the field:
      1. The argument must not have a name which begins with the
        characters {"__"} (two underscores).
      2. The argument must accept a type where {IsInputType(argumentType)}
        returns {true}.
@TobiasPfeifer
Copy link
Contributor

I'd like to work on this

@TobiasPfeifer
Copy link
Contributor

From the given rules its not 100% clear to me if empty names for fields and arguments are valid. Empty names don't make sense imo though. Other thoughts on this?

@ghostdogpr
Copy link
Owner Author

@TobiasPfeifer I don't think we need to check for empty names because they are derived from Scala case class parameters and those can't be empty anyway.

ghostdogpr pushed a commit that referenced this issue Feb 29, 2020
* initial schema validation method layout for interfaces

* reformat code

* apply review feedback

* interface field and argument name validation

* refactor & reuse existing validations after merge of #244

* fix valiation rule

* add tests

* improve error messages

* improve error messages: provide context information

* refactoring: duplicate code
@ghostdogpr
Copy link
Owner Author

Closed by #243

@ghostdogpr ghostdogpr added server Issue related to caliban server core labels Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers server Issue related to caliban server
Projects
None yet
Development

No branches or pull requests

2 participants