Align entity write endpoints with request bodies + author entity resource in OpenAPI spec#151
Conversation
dmccoystephenson
left a comment
There was a problem hiding this comment.
Self-review rubric (adversarial; CI is green on head as the external anchor):
Universal
- Scope: PASS — all 8 files serve #135 (entity write endpoints + entity resource in spec + the doc/test reflections). The one cross-resource line (env POST 200→201) is flagged inline as a judgment call.
- Tests-new: PASS — both changed write methods are exercised (createEntity_ReturnsCreated, updateEntityName_Success) and two new validation tests (createEntity_BlankName_ReturnsBadRequest, updateEntityName_BlankName_ReturnsBadRequest) cover the new @Valid behavior.
- Tests-fix: N/A — refactor, not a bug fix; new validation behavior is nonetheless covered.
- Sibling structure: PASS — CreateEntityRequest/UpdateEntityNameRequest mirror CreateEnvironmentRequest/UpdateEnvironmentNameRequest byte-for-byte in shape.
- Sibling renames: PASS — entity write endpoints brought in line with the already-aligned environment pair (#137).
- Docs: PASS — MVP.md line 57 (which explicitly tracked #135) marked implemented; spec authored; tickets.md/README/PLANNING/REBUILD_PLAN verified accurate. The stale Postman collection is the separate issue #136, deliberately untouched.
- Issue resolution: PASS — #135's named surface (entity write endpoints + 'add entity resource to viron-api.json') is fully changed.
- CI: PASS — build green on head c460b86.
Repo-specific
- DTO boundary: PASS — createEntity returns EntityDto via mapper; no internal model exposed.
- Spec alignment: PASS — every added entity path matches the controller (DELETE→204, POST→201, PATCH→200, relation GETs with correctly-named path params).
- Java/Python parallelism: PASS — entityService create_entity/update_entity_name updated to JSON bodies to match Java; both test surfaces updated and green (mvn test exit 0; pytest 80 passed on py3.11).
- Override correctness: N/A — no @OverRide added.
One non-blocking observation left inline. Not auto-merging: this PR edits the wire contract (docs/openapi/viron-api.json), which is on the do-not-auto-merge list — handing to a human reviewer.
| }, | ||
| "responses": { | ||
| "200": { | ||
| "201": { |
There was a problem hiding this comment.
Judgment call (not part of the entity surface): changed the environment POST response from 200 to 201 to match the controller's @ResponseStatus(HttpStatus.CREATED). This spec discrepancy was explicitly tracked under #135's "Related spec discrepancy" note, so it's included here rather than left dangling. Flagging in case a reviewer prefers it split into its own change.
|
Triage / skip reasons for this cycle (for auditability) Picked: #135 (this PR). Deferred this cycle:
drafted by Claude on behalf of Daniel Stephenson |
…urce in OpenAPI spec
- Switch POST /api/v1/entities and PATCH /api/v1/entities/{id}/name to
@Valid @RequestBody DTOs (CreateEntityRequest, UpdateEntityNameRequest),
mirroring the environment endpoints; drops the path-variable anti-pattern.
- Add the full entity resource to docs/openapi/viron-api.json (all GET/POST/
DELETE/PATCH paths + request/response schemas); add creationDate to EntityDTO.
- Correct the environment POST response status in the spec from 200 to 201 to
match the controller's @ResponseStatus(CREATED) (tracked under #135).
- Update the Python client (entityService) to send JSON bodies, and update both
Java MockMvc and Python tests; add blank-name validation tests.
Closes #135
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…y endpoints
The in-repo Java client called the old path-variable endpoints
(POST /entities/{name}, PATCH /entities/{id}/name/{name}); align it with the
new request-body form so the Java and Python clients stay parallel.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2d4d64f to
1d09451
Compare
|
Update: rebased onto latest
CI green on the rebased head. Still not auto-merging — this PR edits the wire contract ( drafted by Claude on behalf of Daniel Stephenson |
Summary
POST /api/v1/entities/{name}→POST /api/v1/entitieswith aCreateEntityRequestbody.PATCH /api/v1/entities/{id}/name/{name}→PATCH /api/v1/entities/{id}/namewith anUpdateEntityNameRequestbody.CreateEntityRequest/UpdateEntityNameRequestDTOs with@NotBlankvalidation (mirrorsCreateEnvironmentRequest/UpdateEnvironmentNameRequest).docs/openapi/viron-api.json— it previously had no entity paths at all. Added all entity paths (list, by-id, by-environment/grid/location, unassigned, create, delete, rename) plus the two request schemas, and added the missingcreationDatefield toEntityDTO.POSTresponse status in the spec from200to201to match the controller's@ResponseStatus(CREATED)(spec discrepancy explicitly tracked under Align entity write endpoints with request bodies + add entity resource to OpenAPI spec #135).entityService) to send JSON bodies for create/rename, keeping the Java and Python clients parallel.Test plan
mvn test(Java 21) — passes;EntityControllerTestupdated to body-based requests + added blank-name validation tests for both write endpoints (now inherit@WithMockUserfrom the Endpoints are unauthenticated over plain HTTP; RFC 0001 specifies JWT auth over HTTPS #149 auth merge).pytest(Python 3.11) — 80 passed;test_entityServiceupdated to assert JSON-body calls.EntityDtoonly); endpoints now match the spec.Notes
main(includes the Endpoints are unauthenticated over plain HTTP; RFC 0001 specifies JWT auth over HTTPS #149 JWT-auth merge / PR feat(security): require JWT authentication on the Viron API (#149) #150); diff is scoped to the 7 entity/spec files only.docs/openapi/viron-api.json), so this is intentionally not auto-merged and needs human review.EnvironmentDTOspec schema is itself stale (width/heightinstead ofcreationDate).Closes #135