Skip to content

Commit

Permalink
Merge branch 'grails5-update' of github.com:grails/gorm-graphql into …
Browse files Browse the repository at this point in the history
…grails5-update
  • Loading branch information
puneetbehl committed Nov 23, 2023
2 parents e0e6222 + ca7680b commit d65f482
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Artist {

static graphql = GraphQLMapping.build {
add('paintings', [Painting]) {
input(false)
dataFetcher {
return [new Painting(name: 'test', artistName: 'Picasso', heightCm: 60, widthCm: 120)]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BookIntegrationSpec extends Specification implements GraphQLSpec {

then:
result.errors.size() == 1
result.errors[0].message == "Validation error of type FieldUndefined: Field 'bookList' in type 'Query' is undefined @ 'bookList'"
result.errors[0].message == "Validation error (FieldUndefined@[bookList]) : Field 'bookList' in type 'Query' is undefined"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec {

then:
result.errors.size() == 1
result.errors[0].message == "Validation error of type FieldUndefined: Field 'paymentCreate' in type 'Mutation' is undefined @ 'paymentCreate'"
result.errors[0].message == "Validation error (FieldUndefined@[paymentCreate]) : Field 'paymentCreate' in type 'Mutation' is undefined"
}

void "test creating a credit card payment"() {
Expand Down Expand Up @@ -108,7 +108,7 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec {
then: 'An error is returned'
obj.data == null
obj.errors.size() == 1
obj.errors[0].message == "Validation error of type FieldUndefined: Field 'cardNumber' in type 'Payment' is undefined @ 'payment/cardNumber'"
obj.errors[0].message == "Validation error (FieldUndefined@[payment/cardNumber]) : Field 'cardNumber' in type 'Payment' is undefined"
}

void "test querying a list of credit card payments"() {
Expand Down Expand Up @@ -196,7 +196,8 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec {
then: 'An error is thrown'
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[paymentUpdate])')
obj.errors[0].message.endsWith("contains a field not in 'PaymentUpdate': 'cardNumber'")

when:
resp = graphQL.graphql("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[profile]'")

when: 'The profile is provided, but missing a required field'
resp = graphQL.graphql("""
Expand All @@ -63,7 +64,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[lastName]'")
}

void "test creating a user without an address"() {
Expand All @@ -88,7 +90,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[address]'")

when: 'The address is provided, but missing a required field'
resp = graphQL.graphql("""
Expand All @@ -115,7 +118,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[zip]'")
}

void "test creating the top level manager"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class UserRoleIntegrationSpec extends Specification implements GraphQLSpec {

then:
result.errors.size() == 1
result.errors[0].message == "Validation error of type FieldUndefined: Field 'userRoleUpdate' in type 'Mutation' is undefined @ 'userRoleUpdate'"
result.errors[0].message == "Validation error (FieldUndefined@[userRoleUpdate]) : Field 'userRoleUpdate' in type 'Mutation' is undefined"
}

void "test listing entities with a complex composite id"() {
Expand Down
13 changes: 6 additions & 7 deletions plugin/src/main/resources/graphiql.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@
If you do not want to rely on a CDN, you can host these files locally or
include them directly in your favored resource bunder.
-->
<script src="//cdn.jsdelivr.net/es6-promise/4.0.5/es6-promise.auto.min.js"></script>
<script src="//cdn.jsdelivr.net/fetch/0.9.0/fetch.min.js"></script>
<script src="//cdn.jsdelivr.net/react/15.4.2/react.min.js"></script>
<script src="//cdn.jsdelivr.net/react/15.4.2/react-dom.min.js"></script>

<!--
These two files can be found in the npm module, however you may wish to
copy them directly into your environment, or perhaps include them in your
favored resource bundler.
-->
<link rel="stylesheet" href="{staticBase}/graphiql.css" />
<script src="{staticBase}/graphiql.js"></script>

<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/graphiql/graphiql.min.js" type="application/javascript"></script>
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
<script src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js" crossorigin></script>
<link rel="stylesheet" href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css"/>
</head>
<body>
<div id="graphiql">Loading...</div>
Expand Down

0 comments on commit d65f482

Please sign in to comment.