Skip to content

Remove GraphQL implementation and migrate to REST-only architecture#4

Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1765185338-remove-graphql
Open

Remove GraphQL implementation and migrate to REST-only architecture#4
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1765185338-remove-graphql

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Dec 8, 2025

Remove GraphQL implementation and migrate to REST-only architecture

Summary

This PR removes the entire GraphQL implementation from the Spring Boot RealWorld application, standardizing on REST API only. The application previously supported both REST and GraphQL APIs sharing the same underlying business logic.

Changes made:

  • Deleted the entire io.spring.graphql package (12 files including resolvers, mutations, and exception handlers)
  • Deleted the GraphQL schema file at src/main/resources/schema/schema.graphqls
  • Removed Netflix DGS Framework dependencies from build.gradle:
    • com.netflix.dgs.codegen plugin (v5.0.6)
    • graphql-dgs-spring-boot-starter dependency (v4.9.21)
    • generateJava task configuration

Preserved (not modified):

  • api package - REST controllers
  • application package - Application services
  • core package - Domain entities and repository interfaces
  • infrastructure package - MyBatis implementations
  • Security layer (Spring Security + JWT)

Updates since last revision

  • Fixed CI workflow by updating actions/cache from v2 to v4 (GitHub deprecated v2)

Review & Testing Checklist for Human

  • Verify the application starts without errors (./gradlew bootRun) - ensure no GraphQL auto-configuration issues occur
  • Confirm REST API endpoints work correctly (test /articles, /users, /profiles, /tags endpoints)
  • Check that no other code references the deleted GraphQL generated types (search for io.spring.graphql imports)

Recommended test plan:

  1. Run ./gradlew test to verify all 68 tests pass
  2. Start the application with ./gradlew bootRun
  3. Test a few REST endpoints: curl http://localhost:8080/tags and curl http://localhost:8080/articles

Notes

  • Build and all 68 tests verified passing locally
  • Local testing completed: app starts successfully, REST endpoints (/tags, /articles, user registration) work correctly
  • The REST API already covers all functionality that was available via GraphQL

Link to Devin run: https://app.devin.ai/sessions/b58e96a99a5c4e0eb02867c5a88640e2
Requested by: sachet.agarwal@windsurf.com (@SachetCognition)

- Remove entire graphql package (resolvers, mutations, datafetchers)
- Remove GraphQL schema file (schema.graphqls)
- Remove Netflix DGS Framework dependency from build.gradle
- Remove DGS codegen plugin and generateJava task configuration

The REST API already covers all functionality that was in GraphQL:
- Articles CRUD operations (/articles endpoints)
- User authentication and management (/users endpoints)
- Profile operations (/profiles endpoints)
- Comments operations (/articles/{slug}/comments endpoints)
- Favorites operations (/articles/{slug}/favorite endpoints)
- Tags operations (/tags endpoint)

All 68 existing tests pass, confirming the REST API remains fully functional.

Co-Authored-By: sachet.agarwal@windsurf.com <sachet.agarwal@windsurf.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

Original prompt from sachet.agarwal
# Task: Migrate Application to REST-Only Architecture and Ensure Full Test Coverage

## Background
This Spring Boot RealWorld application currently implements both REST and GraphQL APIs that share the same underlying business logic. The codebase follows a layered architecture with:
- **API layer** (`api` package) - REST controllers and GraphQL resolvers
- **Application layer** (`application` package) - High-level query services
- **Core layer** (`core` package) - Domain entities and repository interfaces
- **Infrastructure layer** (`infrastructure` package) - MyBatis implementations

Both APIs use the same application services:
- Article operations use `ArticleCommandService` and `ArticleQueryService`
- User operations delegate to `UserService`
- Both use the same JWT-based security system

## Objective
Remove the GraphQL implementation and standardize on REST API only, while maintaining all functionality and ensuring comprehensive test coverage.

## Tasks to Complete

### 1. Remove GraphQL Implementation
- Delete the entire `graphql` package which contains GraphQL resolvers including:
  - `ArticleDatafetcher.java`
  - `UserMutation.java`
  - `MeDatafetcher.java`
  - And other GraphQL-related classes
- Delete the GraphQL schema file at `src/main/resources/schema/schema.graphqls`

### 2. Remove GraphQL Dependencies
In `build.gradle`, remove the Netflix DGS Framework dependency (version 4.9.21) and any other GraphQL-related dependencies.

### 3. Keep Core Business Logic
**DO NOT MODIFY** the following packages as they contain the shared business logic:
- `core` package - Domain entities and repository interfaces
- `application` package - Application services
- `infrastructure` package - MyBatis implementations

**DO NOT MODIFY** the `api` package which contains the REST controllers that should remain.

### 4. Verify REST API Coverage
Ensure the REST API (`api` package) covers all functionality that was in GraphQL:
- Articles CRUD operations (available at `/articles` e... (1049 chars truncated...)

@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: sachet.agarwal@windsurf.com <sachet.agarwal@windsurf.com>
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.

0 participants