jamesfredley commented on code in PR #15587:
URL: https://github.com/apache/grails-core/pull/15587#discussion_r3144288495
##########
grails-data-graphql/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/GormGraphqlGrailsPlugin.groovy:
##########
@@ -38,65 +38,73 @@ import
org.grails.gorm.graphql.types.DefaultGraphQLTypeManager
class GormGraphqlGrailsPlugin extends Plugin {
- def grailsVersion = "4.0.0 > *"
- def title = "Gorm GraphQL"
- def author = "James Kleeh"
- def authorEmail = "[email protected]"
+ def grailsVersion = '7.1.0 > *'
+ def title = 'Gorm GraphQL'
+ def author = 'James Kleeh'
Review Comment:
Done in d695a96152. def author, def authorEmail, and def developers are
gone; the plugin metadata block now matches MongodbGrailsPlugin
(license/organization/issueManagement/scm/grailsVersion/profiles/title/description/documentation
only). Any additional author attribution can be added to the publish gradle
when needed. Resolving.
##########
grails-test-examples/graphql/grails-docs-app/build.gradle:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+plugins {
+ id 'org.apache.grails.buildsrc.properties'
+ id 'org.apache.grails.buildsrc.compile'
+}
+
+version = projectVersion
+group = 'examples'
+
+apply plugin: 'groovy'
+apply plugin: 'org.apache.grails.gradle.grails-web'
+apply plugin: 'org.apache.grails.gradle.grails-gson'
+
+dependencies {
+ implementation platform(project(':grails-bom'))
+
+ implementation 'org.springframework.boot:spring-boot-starter-logging'
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+ implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ implementation 'org.springframework.boot:spring-boot-starter-tomcat'
+
+ implementation 'org.apache.grails:grails-core'
+ implementation 'org.apache.grails:grails-url-mappings'
+ implementation 'org.apache.grails:grails-rest-transforms'
+ implementation 'org.apache.grails:grails-codecs'
+ implementation 'org.apache.grails:grails-interceptors'
+ implementation 'org.apache.grails:grails-services'
+ implementation 'org.apache.grails:grails-datasource'
+ implementation 'org.apache.grails:grails-databinding'
+ implementation 'org.apache.grails:grails-web-boot'
+ implementation 'org.apache.grails:grails-logging'
+ implementation 'org.apache.grails:grails-cache'
+ implementation 'org.apache.grails:grails-async'
+ implementation 'org.apache.grails:grails-events'
+ implementation 'org.apache.grails:grails-data-hibernate5'
+ implementation 'org.apache.grails:grails-views-gson'
+ implementation 'org.apache.grails:grails-data-mongodb-gson-templates'
+
+ implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version"
+ implementation
"io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version"
+ // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait.
+ implementation
"io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion"
+
+ implementation project(':grails-data-graphql')
+
+ console 'org.apache.grails:grails-console'
+ profile 'org.apache.grails.profiles:rest-api'
+
+ runtimeOnly 'com.h2database:h2'
+ runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
+
+ testImplementation 'org.apache.grails:grails-testing-support-datamapping'
+ testImplementation 'org.apache.grails:grails-testing-support-web'
+}
+
+bootRun {
+ jvmArgs('-Dspring.output.ansi.enabled=always')
+ sourceResources sourceSets.main
Review Comment:
ootRun {} block removed in d695a96152. Resolving.
##########
grails-test-examples/graphql/grails-multi-datastore-app/build.gradle:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+plugins {
+ id 'org.apache.grails.buildsrc.properties'
+ id 'org.apache.grails.buildsrc.compile'
+}
+
+version = projectVersion
+group = 'examples'
+
+apply plugin: 'groovy'
+apply plugin: 'org.apache.grails.gradle.grails-web'
+apply plugin: 'org.apache.grails.gradle.grails-gson'
+
+dependencies {
+ implementation platform(project(':grails-bom'))
+
+ implementation 'org.springframework.boot:spring-boot-starter-logging'
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+ implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ implementation 'org.springframework.boot:spring-boot-starter-tomcat'
+
+ implementation 'org.apache.grails:grails-core'
+ implementation 'org.apache.grails:grails-url-mappings'
+ implementation 'org.apache.grails:grails-rest-transforms'
+ implementation 'org.apache.grails:grails-codecs'
+ implementation 'org.apache.grails:grails-interceptors'
+ implementation 'org.apache.grails:grails-services'
+ implementation 'org.apache.grails:grails-datasource'
+ implementation 'org.apache.grails:grails-databinding'
+ implementation 'org.apache.grails:grails-web-boot'
+ implementation 'org.apache.grails:grails-logging'
+ implementation 'org.apache.grails:grails-cache'
+ implementation 'org.apache.grails:grails-async'
+ implementation 'org.apache.grails:grails-data-hibernate5'
+ implementation 'org.apache.grails:grails-data-mongodb'
+ implementation 'org.apache.grails:grails-views-gson'
+ implementation 'org.apache.grails:grails-data-mongodb-gson-templates'
+
+ implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version"
+ implementation "com.graphql-java:graphql-java:$graphqlJavaVersion"
+ implementation
"io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version"
+ // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait.
+ implementation
"io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion"
+
+ implementation 'com.h2database:h2'
+ implementation 'org.apache.tomcat:tomcat-jdbc'
+
+ implementation project(':grails-data-graphql')
+
+ console 'org.apache.grails:grails-console'
+ profile 'org.apache.grails.profiles:rest-api'
+
+ compileOnly 'org.apache.grails:grails-testing-support-datamapping'
+ compileOnly 'org.apache.grails:grails-testing-support-web'
+
+ testImplementation 'org.apache.grails:grails-testing-support-datamapping'
+ testImplementation 'org.apache.grails:grails-testing-support-web'
+}
+
+bootRun {
Review Comment:
ootRun {} block removed in d695a96152. Resolving.
##########
grails-data-graphql/README.md:
##########
@@ -14,15 +14,48 @@ See the License for the specific language governing
permissions and
limitations under the License.
-->
-# Gorm GraphQL
+# GORM for GraphQL
-This project has not been updated for Grails 7 yet and is not included in the
build.
+An automatic GraphQL schema generator for
[GORM](https://grails.apache.org/docs/latest/grails-data/).
-## An automatic GraphQL schema generator for GORM
+This project is part of the main Grails monorepo build. The published modules
+are wired into the root `settings.gradle`:
-Current documentation
https://grails.github.io/grails-data-graphql/3.0.x/hibernate/guide/index.html
+| Module | Gradle path | Maven coordinates
|
+| --------------- | ---------------------------- |
------------------------------------------------- |
+| Core schema lib | `:grails-data-graphql-core` |
`org.apache.grails.data:grails-data-graphql-core` |
+| Grails plugin | `:grails-data-graphql` |
`org.apache.grails:grails-data-graphql` |
+| Reference guide | `:grails-data-graphql-docs` | (not published)
|
Review Comment:
Fixed in d695a96152. The README now references
https://grails.apache.org/docs/{latest,snapshot}/grails-data/graphql/manual/
(matches the grails-data-mongodb README style). Resolving.
##########
grails-data-graphql/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/GrailsGraphQLConfiguration.groovy:
##########
@@ -22,16 +22,30 @@ package org.grails.gorm.graphql.plugin
import grails.config.Config
import grails.core.GrailsApplication
import groovy.transform.CompileStatic
-import org.grails.plugins.databinding.DataBindingGrailsPlugin
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.ConfigurationProperties
-import javax.annotation.PostConstruct
+import jakarta.annotation.PostConstruct
@CompileStatic
@ConfigurationProperties(prefix = 'grails.gorm.graphql')
class GrailsGraphQLConfiguration {
+ // Kept in sync with AbstractDataBindingGrailsPlugin.DEFAULT_DATE_FORMATS
in Grails 7.1.0.
+ // Inlined to avoid coupling to a class whose location has shifted between
Grails
+ // releases (was DataBindingGrailsPlugin in 6.x).
Review Comment:
Good catch. In d695a96152 I dropped the duplicated DEFAULT_DATE_FORMATS list
and instead @Autowired the existing
org.grails.plugins.databinding.DataBindingConfigurationProperties bean, then
read dateFormats and dataParsingLenient straight off it. Single source of
truth, no copy of the list. Resolving.
##########
grails-data-graphql/core/src/test/groovy/org/grails/gorm/graphql/entity/property/impl/HibernatePersistentGraphQLPropertySpec.groovy:
##########
@@ -359,8 +359,11 @@ class HibernatePersistentGraphQLPropertySpec extends
HibernateSpec {
'order8' | 8 //specified via mapping
'order0' | 0 //specified as 0
'orderNeg' | -21 //specified as -10
- 'orderNullc' | 6 //not specified, gorm supplied
- 'orderNulld' | 7 //not specified, gorm supplied
+ // Grails 7: GORM no longer auto-supplies a constraint order for
properties
Review Comment:
Fair callout - I dropped the speculative comment in d695a96152. The expected
values genuinely shifted (orderNullc 6 -> 5, orderNulld 7 -> 6) when the spec
was run against Grails 7.1.0's GORM, but I don't have a definitive root cause
yet, so claiming "GORM no longer auto-supplies a constraint order" was a guess.
If you'd prefer I dig in further (or revert the assertions and let the spec
fail until we identify the upstream change), say the word. Leaving the thread
open so we can decide.
##########
grails-data-graphql/plugin/src/test/groovy/gorm/graphql/GraphqlControllerSpec.groovy:
##########
@@ -213,8 +213,11 @@ class GraphqlControllerSpec extends Specification
implements ControllerUnitTest<
controller.browser()
then:
- !response.text.empty
- response.contentType == "text/html;charset=utf-8"
+ // The bundled graphiql.html was removed from this plugin (commit
a9b9fa2598
+ // "Remove graphql html, css and js"). Without the classpath resource
the
+ // controller returns 404; downstream apps that supply their own
+ // graphiql.html will continue to get a 200 with the rendered page.
Review Comment:
Linked to the discussion on the rowser() controller action above (#15587
(comment) - thread on GraphqlController.groovy). My take: I'd be fine dropping
the bundled-browser feature entirely (controller action + spec + config flag),
since the bundled assets are already gone upstream and standalone
GraphiQL/Playground tools are easy to point at any /graphql endpoint. But
that's a behaviour change, so I'd want your sign-off before doing it. Leaving
open until we decide.
##########
grails-test-examples/graphql/grails-docs-app/build.gradle:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+plugins {
+ id 'org.apache.grails.buildsrc.properties'
+ id 'org.apache.grails.buildsrc.compile'
+}
+
+version = projectVersion
+group = 'examples'
+
+apply plugin: 'groovy'
+apply plugin: 'org.apache.grails.gradle.grails-web'
+apply plugin: 'org.apache.grails.gradle.grails-gson'
+
+dependencies {
+ implementation platform(project(':grails-bom'))
+
+ implementation 'org.springframework.boot:spring-boot-starter-logging'
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+ implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ implementation 'org.springframework.boot:spring-boot-starter-tomcat'
+
+ implementation 'org.apache.grails:grails-core'
+ implementation 'org.apache.grails:grails-url-mappings'
+ implementation 'org.apache.grails:grails-rest-transforms'
+ implementation 'org.apache.grails:grails-codecs'
+ implementation 'org.apache.grails:grails-interceptors'
+ implementation 'org.apache.grails:grails-services'
+ implementation 'org.apache.grails:grails-datasource'
+ implementation 'org.apache.grails:grails-databinding'
+ implementation 'org.apache.grails:grails-web-boot'
+ implementation 'org.apache.grails:grails-logging'
+ implementation 'org.apache.grails:grails-cache'
+ implementation 'org.apache.grails:grails-async'
+ implementation 'org.apache.grails:grails-events'
+ implementation 'org.apache.grails:grails-data-hibernate5'
+ implementation 'org.apache.grails:grails-views-gson'
+ implementation 'org.apache.grails:grails-data-mongodb-gson-templates'
+
+ implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version"
+ implementation
"io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version"
+ // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait.
+ implementation
"io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion"
+
+ implementation project(':grails-data-graphql')
+
+ console 'org.apache.grails:grails-console'
+ profile 'org.apache.grails.profiles:rest-api'
+
+ runtimeOnly 'com.h2database:h2'
+ runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
+
+ testImplementation 'org.apache.grails:grails-testing-support-datamapping'
+ testImplementation 'org.apache.grails:grails-testing-support-web'
+}
+
+bootRun {
+ jvmArgs('-Dspring.output.ansi.enabled=always')
Review Comment:
Removed in d695a96152 (the entire ootRun {} block is gone - see the related
comment below). Resolving.
##########
grails-data-graphql/plugin/build.gradle:
##########
@@ -17,37 +17,98 @@
* under the License.
*/
-
plugins {
- id "org.apache.grails.gradle.grails-plugin"
- id "org.apache.grails.gradle.grails-gson"
+ id 'org.apache.grails.buildsrc.properties'
+ id 'org.apache.grails.gradle.grails-plugin'
+ id 'org.apache.grails.gradle.grails-gson'
+ id 'org.apache.grails.buildsrc.compile'
+ id 'org.apache.grails.buildsrc.publish'
+ id 'org.apache.grails.buildsrc.sbom'
+ id 'org.apache.grails.gradle.grails-code-style'
+}
+
+version = projectVersion
+group = 'org.apache.grails'
+
+ext {
+ gormApiDocs = true
+ pomTitle = 'GORM for GraphQL'
+ pomDescription = 'Generates a GraphQL schema based on entities in GORM'
}
dependencies {
- api "org.apache.grails:grails-controllers"
- api "org.apache.grails:grails-databinding"
- api("org.apache.grails:grails-rest-transforms") {
+
+ implementation platform(project(':grails-bom'))
+
+ api project(':grails-data-graphql-core'), {
+ // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation
+ }
+ api project(':grails-controllers'), {
+ // api: GraphqlController extends from grails controller infrastructure
+ }
+ api project(':grails-databinding'), {
+ // api: data binding for GraphQL request payloads
+ }
+ api project(':grails-rest-transforms'), {
+ // api: REST transforms used for JSON marshalling
exclude group: 'org.apache.grails', module: 'grails-converters'
}
- api "org.apache.grails:grails-url-mappings"
- api "org.apache.grails:grails-views-gson:$viewsJsonVersion"
- api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0'
- api "javax.servlet:javax.servlet-api:$servletApiVersion"
- api "io.micronaut:micronaut-http-client:$micronautVersion"
- api "org.apache.grails:grails-converters:3.3.1"
- api 'com.github.javaparser:javaparser-core:3.25.7'
- api "com.graphql-java:graphql-java:$graphqlJavaVersion"
- testImplementation "org.apache.grails:grails-testing-support-web"
- testImplementation "cglib:cglib-nodep:3.3.0"
- profile "org.apache.grails.profiles:web-plugin"
+ api project(':grails-url-mappings'), {
+ // api: URL mappings for /graphql endpoint
+ }
+ api project(':grails-converters'), {
+ // api: JSON converters used by the controller
+ }
+ api project(':grails-views-gson'), {
+ // api: GSON view rendering for GraphQL responses
+ }
+ api 'com.github.javaparser:javaparser-core', {
+ // api: parsing of GORM entity sources for schema introspection
+ }
+ api "com.graphql-java:graphql-java:$graphqlJavaVersion", {
+ // api: GraphQL execution and schema types
+ }
+ api 'jakarta.servlet:jakarta.servlet-api', {
+ // api: HttpServletRequest/Response in GraphqlController
+ }
+ api "io.micronaut:micronaut-http-client:$micronautHttpClientVersion", {
+ // api: HTTP client used by integration tests / playground
+ }
+ api
"io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version", {
+ // api: RxJava2 variant of micronaut-http-client used by integration
tests
+ }
- api project(":gorm-graphql")
+ testImplementation project(':grails-testing-support-web')
+ // Spock 2.3 on Groovy 4 / JDK 17 uses net.bytebuddy for class mocking;
+ // cglib-nodep no longer works on JDK 17+.
+ testImplementation 'net.bytebuddy:byte-buddy'
+ testImplementation 'org.spockframework:spock-core'
}
compileGsonViews {
- packageName = "gorm-graphql"
+ packageName = 'gorm-graphql'
+}
+
+// compileGsonViews writes compiled GSON view classes into
build/gson-classes/main,
+// which the Groovy plugin treats as part of the main source-set output.
Without an
+// explicit dependency the groovydoc task implicitly consumes that output,
which
+// Gradle 8.x rejects as an undeclared task input.
+tasks.named('groovydoc').configure {
+ dependsOn tasks.named('compileGsonViews')
}
-tasks.withType(Test) {
+def disabledTasks = ['bootRun', 'bootTestRun']
Review Comment:
Added a comment in d695a96152 explaining the rationale: :grails-data-graphql
is a Grails plugin (library), not an application, so the Spring Boot
ootRun/ootTestRun tasks are inapplicable. Mirrors the same disable block in
grails-data-mongodb/grails-plugin/build.gradle. Resolving.
##########
grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/PostIntegrationSpec.groovy:
##########
@@ -31,7 +31,7 @@ import java.text.SimpleDateFormat
@Stepwise
class PostIntegrationSpec extends Specification implements GraphQLSpec {
- @Shared SimpleDateFormat format = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")
+ @Shared SimpleDateFormat format = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX")
Review Comment:
You're right that pinning to .SSSX was a regression for the no-millisecond
response shape. In d695a96152 I dropped the SimpleDateFormat entirely and
switched the assertion to java.time.Instant.parse(...), which transparently
accepts both 2026-01-01T12:00:00Z and 2026-01-01T12:00:00.123Z. The integration
test still passes locally and is no longer coupled to a specific format string.
Resolving.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]