/jsonapi4j:jsonapi4jfrom jsonapi4j
Builds JSON:API-compliant REST backends using the jsonapi4j framework (pro.api4). Covers resources, relationships, operations, compound documents, validation, security, config, and RestAssured testing for Spring Boot, Quarkus, or Jakarta Servlet.
Ships in jsonapi4j. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
jsonapi4j (pro.api4, by Aliaksei Taliuk) is a persistence-agnostic Java framework for building
JSON:API-compliant REST APIs. No JPA/ORM required — it works over any data
source (JdbcTemplate, a REST client, in-memory, …). It ships three integrations: Spring Boot,
Quarkus, and plain Jakarta Servlet. Docs: https://api4.pro/.
This skill is the consumer's guide — how to build with the framework. Keep SKILL.md lean; open the
matching reference/<file>.md when you go deep on a topic (paths below). When you confirm a new pattern
or quirk, add it to the relevant reference file.
When you write anything down — a note in reference/, the app's README, or an operation
description that ships in the published OpenAPI document — document what the caller must choose,
know, or watch out for, never what the code does. "Returns a paginated list of users; page[cursor]
comes from the previous response's links.next" earns its place; "iterates the result set and maps
each row" does not. A rule that fits in a sentence gets a sentence, not a code block.
Versioned behavior: edge behaviors are version-specific (current line is 1.11.x). Treat the
"known behaviors" notes as "verify against the version on your classpath and the framework's own
tests," not gospel. The canonical, runnable reference is the framework's examples/ sample apps
(Spring Boot / Quarkus / Servlet over a shared domain).
Every resource (and every relationship) is split into small single-purpose classes, auto-discovered as
beans (Spring @Component / Quarkus CDI / registered in the Servlet context):
Resource<DTO> — maps a backend DTO to a JSON:API resource: resolveResourceId +
resolveAttributes. Annotated @JsonApiResource(resourceType = "users").Relationship<REF> — maps to a resource identifier ({type, id} + optional identifier meta/links).
It has no attributes. Annotated
@JsonApiRelationship(relationshipName = "citizenships", parentResource = UserResource.class).
Default to ToOneRefRelationship<ResourceRef> / ToManyRefRelationship<ResourceRef> (refs created via
DefaultResourceRef.of(type, id); nothing to implement). When the ref needs more (e.g. identifier meta),
use your own record implementing ResourceRef as the type argument.*Operations — the data access. Annotated @JsonApiResourceOperation(resource = ...) or
@JsonApiRelationshipOperation(relationship = ...). Implement the composite
ResourceOperations<DTO> / ToOneRelationshipOperations<PARENT, CHILD> /
ToManyRelationshipOperations<PARENT, CHILD> — each method defaults to throwing
OperationNotFoundException, so you override only what your resource actually supports, plus the
matching validateXxx hooks.@Component
@JsonApiResource(resourceType = "users")
public class UserResource implements Resource<UserDbEntity> {
public String resolveResourceId(UserDbEntity u) { return u.getId(); }
public UserAttributes resolveAttributes(UserDbEntity u) {
return new UserAttributes(u.getFullName(), u.getEmail());
}
}
(See the real thing: examples/jsonapi4j-sampleapp-domain/.../domain/user/UserResource.java.)
Resource<DTO> + an *Attributes class holding only this
resource's own data.ResourceOperations<DTO>: readById, readPage (+ validateReadById / validateReadMultiple);
throw ResourceNotFoundException on a miss. Choose a pagination strategy for readPage.ToOne/ToManyRefRelationship<ResourceRef> by default — prefer it over heavy
DTOs; when the identifier needs meta, use a record implementing ResourceRef as the type argument
(ToOne/ToManyRelationship<REF> for DTOs that can't implement it — only id/type/meta are read);
*Operations with readOne/readMany (+ readOneForResource/readManyForResource and/or batch
ops to avoid N+1 on includes).filter[id] on its readPage (+ a
jsonapi4j.cd.mapping.<type>.maxBatchSize). A cd.mapping.<type>.url is only for types another
service serves — same-app types are read in-process.@OasResourceInfo(attributes = XAttributes.class) on the
Resource — without it the published schema is empty. Declare sortableFields / filters on the
operation, or they go undocumented even though they work.?include= cases (random port is fine; CD profile).reference/resources-and-operations.md — Resource contract, the composite operations, pagination
modes and PaginationAwareResponse factories (incl. null vs empty()), the one-mapper-per-resource
data-layer rule.reference/relationships.md — to-one/to-many, lightweight refs vs full DTOs,
readOneForResource/readManyForResource and batch ops (N+1 avoidance), edge data in identifier meta.reference/compound-documents.md — ?include=, resolution (in-process for same-app types,
cd.mapping over HTTP for cross-service), multi-hop, synthetic-primary caveat, header/param propagation.reference/performance.md — filter[id] batching, in-house resolution, parallel ExecutorService,
hop/size caps, the compound-docs cache + Cache-Control.reference/validation-and-security.md — validateXxx hooks, the fluent JsonApiRequestValidator,
exceptions (400/404/custom), the two independent security layers + the AC plugin.reference/configuration.md — the jsonapi4j.* property reference.reference/openapi.md — the generated OpenAPI document: @OasResourceInfo / @OasOperationInfo,
which query params are published only when declared, OAuth2 scopes per grant flow, OasCustomizer
and the springdoc hand-off.reference/testing.md — RestAssured black-box patterns; ?include= tests; test profiles;
Testcontainers/Flyway/auth stubs.reference/separation-of-concerns.md — attribute ownership; migrating a denormalized field out to
an ?included relationship safely.reference/known-behaviors.md — version-specific quirks (related-URL 404s, to-one linkage
rendering, null refs, cursor meta key, enum attributes, etc.).reference/compound-documents.md (opens in a new tab)reference/configuration.md (opens in a new tab)reference/known-behaviors.md (opens in a new tab)reference/openapi.md (opens in a new tab)reference/performance.md (opens in a new tab)reference/relationships.md (opens in a new tab)reference/resources-and-operations.md (opens in a new tab)reference/separation-of-concerns.md (opens in a new tab)reference/testing.md (opens in a new tab)reference/validation-and-security.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub moonworm/jsonapi4j --plugin jsonapi4jOther plugins' skills for the same job