Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

jsonapi-java-annotations

Runtime-visible, dependency-free annotations that assign JSON:API semantic roles to domain classes, records, and properties for later adapter mapping.

The public API is the com.kazforge.jsonapi.annotation package: @JsonApiResource, @JsonApiId, @JsonApiLocalId, @JsonApiAttribute, @JsonApiRelationship, @JsonApiMeta, and @JsonApiRelationshipMeta.

Usage

@JsonApiResource(type = "articles")
public record Article(
    @JsonApiId String id,
    @JsonApiLocalId String localId,
    @JsonApiAttribute String title,
    @JsonApiRelationship String writtenBy,
    @JsonApiMeta ArticleMeta meta,
    @JsonApiRelationshipMeta(relationship = "writtenBy") AuthorMeta authorMeta) {}

Annotations assign roles only. Configured Jackson owns property discovery, visibility, external names, mix-ins, creators, and conversion. @JsonApiResource.type() is JSON:API semantic data rather than a Java property name.

id and lid are independent roles and never fall back to one another; there is no conventional implicit lid. Resource meta, relationship meta, and per-linkage identifier meta are distinct. Identifier meta uses the neutral RelationshipLinkage<T, M> value rather than another annotation.

This module provides no codec, document model, inclusion/fetch/cascade policy, query parser, or framework integration. See the architecture overview, ADR-004, and ADR-011.