Re: [PR] Add Grails 8 HTTP client guide (v8 prose, snippets, guides.yml) [grails-static-website]

2026-07-21 Thread via GitHub


jamesfredley merged PR #520:
URL: https://github.com/apache/grails-static-website/pull/520


-- 
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]



Re: [PR] Add Grails 8 HTTP client guide (v8 prose, snippets, guides.yml) [grails-static-website]

2026-07-18 Thread via GitHub


sanjana2505006 commented on PR #520:
URL: 
https://github.com/apache/grails-static-website/pull/520#issuecomment-5012162987

   @jamesfredley i just updated this pr, please have a look and let me know if 
there's any scope for improvements


-- 
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]



Re: [PR] Add Grails 8 HTTP client guide (v8 prose, snippets, guides.yml) [grails-static-website]

2026-07-15 Thread via GitHub


jamesfredley commented on code in PR #520:
URL: 
https://github.com/apache/grails-static-website/pull/520#discussion_r3590404597


##
guides/grails-http-client/v8/guide/httpClientSetup.adoc:
##
@@ -0,0 +1,39 @@
+Register HTTP service interfaces on the application class with 
`@ImportHttpServices`:
+
+[source,groovy]
+.grails-app/init/example/Application.groovy
+
+include::../snippets/grails-app/init/example/Application.groovy[]
+
+
+Spring Boot scans `example` for `@HttpExchange` interfaces and auto-configures 
a `RestClient` proxy for each one.

Review Comment:
   This is inaccurate about the mechanism. It is not Spring Boot component 
scanning / autoconfiguration that registers the client - it's 
`@ImportHttpServices(basePackages = 'example')` (Spring Framework 7 / Spring 
Boot 4, which Grails 8 ships) that scans `example` for `@HttpExchange` 
interfaces and registers an HTTP-service proxy for each. Suggested reword:
   
   > `@ImportHttpServices` scans `example` for `@HttpExchange` interfaces and 
registers a `RestClient`-backed proxy bean for each one.
   
   Worth noting this requires the Grails 8 Spring 7 / Boot 4 baseline.



##
guides/grails-http-client/v8/guide/gettingStarted.adoc:
##
@@ -0,0 +1,22 @@
+Clone the repository and run the starting application:
+
+[source,bash]
+
+git clone -b grails8 https://github.com/grails-guides/grails-http-client.git
+cd grails-http-client/initial
+./gradlew bootRun
+
+
+Open http://localhost:8080/[http://localhost:8080/] for the welcome JSON 
payload. The `initial/` project is a vanilla Grails 8 REST API starter with no 
HTTP client yet.
+
+To skip ahead, `cd complete` and run the same commands — that tree contains 
the finished `@HttpExchange` client, services, and tests.

Review Comment:
   Two issues on this line:
   
   1. **Broken `cd`** - the reader was just told to `cd 
grails-http-client/initial` above, so `cd complete` resolves to 
`initial/complete` (which doesn't exist). Use `cd ../complete`.
   2. **Em dash** - `commands — that tree` should use a plain hyphen `-` per 
the repo's typography convention.



##
guides/grails-http-client/v8/guide/requirements.adoc:
##
@@ -0,0 +1,5 @@
+* Approximately 45 minutes
+* JDK 21 (Apache Grails 8 requires Java 21)
+* A https://www.grails.org/[Grails] installation or the bundled Gradle wrapper 
in `initial/` and `complete/`
+* **Docker** — required for integration tests (Testcontainers PostgreSQL)
+* **PostgreSQL** on `localhost:5432` — required for `./gradlew bootRun` in 
both `initial/` and `complete/` (default database `devDb`; see 
`grails-app/conf/application.yml`)

Review Comment:
   **Em dash** - `localhost:5432` — required` should be a plain hyphen `-`.



##
guides/grails-http-client/v8/guide/testing.adoc:
##
@@ -0,0 +1,52 @@
+[[unitTests]]
+== Unit tests
+
+Domain constraints:
+
+[source,groovy]
+.src/test/groovy/example/RecordLabelSpec.groovy
+
+include::../snippets/src/test/groovy/example/RecordLabelSpec.groovy[]
+
+
+Service delegation to the HTTP client with a mock:
+
+[source,groovy]
+.src/test/groovy/example/ItunesSearchServiceSpec.groovy
+
+include::../snippets/src/test/groovy/example/ItunesSearchServiceSpec.groovy[]
+
+
+[[integrationTests]]
+== Integration tests
+
+Verify the HTTP client is registered as a Spring bean:
+
+[source,groovy]
+.src/integration-test/groovy/example/ItunesClientIntegrationSpec.groovy
+
+include::../snippets/src/integration-test/groovy/example/ItunesClientIntegrationSpec.groovy[]
+
+
+Assert GORM persistence against real PostgreSQL (Testcontainers):
+
+[source,groovy]
+.src/integration-test/groovy/example/RecordLabelIntegrationSpec.groovy
+
+include::../snippets/src/integration-test/groovy/example/RecordLabelIntegrationSpec.groovy[]
+
+
+Run unit tests:
+
+[source,bash]
+
+cd complete

Review Comment:
   `cd complete` assumes the reader is at the repository root, but following 
the guide they were left in `grails-http-client/initial` (see gettingStarted). 
Either use `cd ../complete` or state explicitly that this block runs from the 
repo root.



##
guides/grails-http-client/v8/guide/requirements.adoc:
##
@@ -0,0 +1,5 @@
+* Approximately 45 minutes
+* JDK 21 (Apache Grails 8 requires Java 21)
+* A https://www.grails.org/[Grails] installation or the bundled Gradle wrapper 
in `initial/` and `complete/`
+* **Docker** — required for integration tests (Testcontainers PostgreSQL)

Review Comment:
   **Em dash** - `**Docker** — required` should be a plain hyphen `-`.



##
guides/grails-http-client/v8/guide/httpClientSetup.adoc:
##
@@ -0,0 +1,39 @@
+Register HTTP service interfaces on the application class with 
`@ImportHttpServices`:
+
+[source,groovy]
+.grails-app/init/example/Application.groovy
+
+include::../snippets/grails-app/init/example/Application.groovy[]
+
+
+Spring Boot scans `example` for `@HttpExchange`