fix(plugin-id/backend): expose @POST create() on GroupResource and CompanyResource#24
Merged
Merged
Conversation
…mpanyResource The parent AbstractContainerResource declares @post create(V container) at line 149, but JAX-RS doesn't pick up the annotation on the concrete bean because of type erasure on the generic parameter. Result: POST /group and POST /company returned 405 Method Not Allowed, blocking container creation from the UI. Re-declare create() with the concrete type and the @post annotation in GroupResource and CompanyResource, delegating to super.create() — same pattern as UserOrgResource.java:360 which has always worked. Also override @produces with text/plain on these two methods: the return value is a raw identifier string, not a JSON document. With the class-level JSON default the serializer emits an unquoted scalar that clients cannot parse (e.g. response.json() throws SyntaxError). text/plain matches the actual payload and lets clients read it via response.text(). PUT/update on containers is out of scope (not declared on the abstract parent either, would require a new implementation). To be addressed in a separate PR if needed.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fix 405 Method Not Allowed on POST /rest/service/id/group and
POST /rest/service/id/company.
Cause
GroupResource and CompanyResource extend AbstractContainerResource which
declares
@POST create(V container)at line 149. But JAX-RS doesn't pickup the annotation on the concrete bean because of type erasure on the
generic parameter V — the runtime sees the erased
create(Object)whichis not registered as a route.
Result: POST routes were never exposed, blocking container creation
from the UI (caught when fixing the "Mode démo" probes in PR
norman/fix-demo-banner-probes, which exposed the first real POST call
that was previously bypassed by the demo toast).
Fix
Re-declare
@POST create()with the concrete type in both GroupResourceand CompanyResource, delegating to
super.create(). Same pattern thatalready works for UserOrgResource.java:360.
@Produces(MediaType.TEXT_PLAIN)is added because the return value isthe bare ID string (not JSON) — without it, the frontend fails on
response.json().Out of scope
PUT/update on containers is also missing — neither in the abstract
parent nor in IContainerRepository (plugin-api). A separate
architectural decision is needed (4 options being discussed with
Fabrice — see Teams).