A Spring Boot application demonstrating how GraphQL eliminates the need for API versioning through field-level evolution and deprecation.
This project showcases GraphQL's approach to API evolution by maintaining backward compatibility while introducing new fields. Instead of creating /api/v2 endpoints, GraphQL allows both old and new clients to coexist by requesting only the fields they need.
- Field-level deprecation using
@deprecateddirective - Backward compatibility with deprecated
namefield - Forward evolution with new
firstNameandlastNamefields - Client flexibility - each client requests exactly what they need
# Run the application
./mvnw spring-boot:run
# Run tests
./mvnw testAccess GraphiQL at: http://localhost:8080/graphiql
Legacy client using deprecated field:
query {
user(id: "123") {
name
email
}
}Modern client using new fields:
query {
user(id: "123") {
firstName
lastName
email
avatar
lastLoginAt
}
}Both queries work simultaneously without versioning.
- Spring Boot 3.5.6
- Spring for GraphQL
- Java 25
- Maven