Skip to content

fix(plugin-id/backend): expose @POST create() on GroupResource and CompanyResource#24

Merged
fdaugan merged 1 commit into
feature/vuejsfrom
norman/fix-container-resource-post
May 19, 2026
Merged

fix(plugin-id/backend): expose @POST create() on GroupResource and CompanyResource#24
fdaugan merged 1 commit into
feature/vuejsfrom
norman/fix-container-resource-post

Conversation

@Terracosmos
Copy link
Copy Markdown
Collaborator

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 pick
up the annotation on the concrete bean because of type erasure on the
generic parameter V — the runtime sees the erased create(Object) which
is 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 GroupResource
and CompanyResource, delegating to super.create(). Same pattern that
already works for UserOrgResource.java:360.

@Produces(MediaType.TEXT_PLAIN) is added because the return value is
the 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).

…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.
@Terracosmos Terracosmos requested a review from fdaugan May 19, 2026 11:41
@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

@fdaugan fdaugan merged commit ed58187 into feature/vuejs May 19, 2026
4 of 5 checks passed
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.

2 participants