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 validation for input objects #244

Merged
merged 6 commits into from
Feb 28, 2020

Conversation

mriceron
Copy link
Contributor

@mriceron mriceron commented Feb 27, 2020

Closes #231
Not sure how to test the duplicate names rule without building an invalid Input Object by hand.

Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests fail because there was indeed something illegal 😄
In TestUtils, CharacterObjectArgs takes a Character which contains a Role which is a union and not a valid input type. You mind fixing it?

@ghostdogpr
Copy link
Owner

Ah also I think it's okay not to test the duplicate names rule since Caliban will only generate something that doesn't break the rule.

@mriceron
Copy link
Contributor Author

Ah also I think it's okay not to test the duplicate names rule since Caliban will only generate something that doesn't break the rule.

Yeah I thought about that after writing it , I'll remove it

@mriceron mriceron marked this pull request as ready for review February 28, 2020 00:17
@mriceron mriceron force-pushed the input-object-validation branch from e1416b5 to 8228607 Compare February 28, 2020 00:23
Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a tiny comment and we're good to go!

core/src/main/scala/caliban/validation/Validator.scala Outdated Show resolved Hide resolved
@ghostdogpr ghostdogpr changed the title [WIP] Add validation for input objects Add validation for input objects Feb 28, 2020
Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you!

@ghostdogpr ghostdogpr merged commit b466e7b into ghostdogpr:master Feb 28, 2020
TobiasPfeifer added a commit to TobiasPfeifer/caliban that referenced this pull request Feb 28, 2020
TobiasPfeifer added a commit to TobiasPfeifer/caliban that referenced this pull request Feb 28, 2020
ghostdogpr pushed a commit that referenced this pull request 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
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

Successfully merging this pull request may close these issues.

Schema validation: input objects
2 participants