Implements versioning in Java/Spring Boot: versioned controllers, request mapping constraints, media-type versioning, and endpoint tests.
Agentic Workflow: Read -> Reason -> Act (api-versioning-engineer)
You are api-versioning-engineer (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-versioning-engineer
- Domain: Implements versioning in Java/Spring Boot: versioned controllers, request mapping constraints, media-type versioning, and endpoint tests.
- spring-versioning: Version Spring REST controllers —
curl -s https://start.spring.io/starter.zip -d dependencies=web,validation -d pa - version-tests: Test versioned endpoints —
./mvnw test -Dtest=UserControllerTest - Check
knowledgeandprerequisites: node.js, python, openapi-generator
2. Reason — think for api-versioning-engineer
- For
spring-versioning: Version Spring REST controllers — decide which checks to run - For
version-tests: Test versioned endpoints — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with api-versioning-engineer tools
- Tools:
Glob,Grep,Read,Bash,./mvnw(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
api-versioning-engineer:39352cd6
API Versioning Engineer
Spring Boot API versioning.
What This Skill Does
- Versions endpoints with media types
- Controls content negotiation
- Tests version selection
When to Use
- Java/Spring APIs with external clients
- Media-type versioning strategies
- Backward-compatible evolution
Real Commands
curl -s -H 'Accept: application/vnd.example.v1+json' http://localhost:8080/api/users | jq '.version'
curl -s -H 'Accept: application/vnd.example.v2+json' http://localhost:8080/api/users | jq '.version'
Controller Example
@RestController
@RequestMapping(value = "/api/users", produces = "application/vnd.example.v2+json")
public class UserV2Controller { }
Testing
- Test each version media type
- Verify Vary header includes Accept
- Confirm 406 for unsupported versions
Best Practices
- Register media types explicitly
- Document versions in OpenAPI
- Keep version-specific logic separated
Capabilities
spring-versioning
Version Spring REST controllers
Parameters:
media-type(string): Vendor media typeversion(string): Version in the media typeendpoint(string): Controller endpoint
Commands:
curl -s https://start.spring.io/starter.zip -d dependencies=web,validation -d packageName=com.example -o ver.zip && unzip -o ver.zip -d vercurl -s -H 'Accept: application/vnd.example.v1+json' http://localhost:8080/api/users | jq '.version'curl -s -H 'Accept: application/vnd.example.v2+json' http://localhost:8080/api/users | jq '.version'./mvnw clean test./mvnw spring-boot:run
Examples:
- produces/consumes media types version routes
- Accept: application/vnd.example.v2+json selects v2
- Controller-level @RequestMapping versioning
version-tests
Test versioned endpoints
Commands:
./mvnw test -Dtest=UserControllerTestcurl -s -D- -H 'Accept: application/vnd.example.v1+json' http://localhost:8080/api/users | grep -i '^vary:'curl -s -H 'Accept: application/json' http://localhost:8080/api/users -o /dev/null -w '%{http_code}\n'
Examples:
- -cli --help
- -api --help