Annotation Interface JsonApiType


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface JsonApiType
Marks a field or method as the source of the JSON:API resource type.

This annotation can be applied to fields or getter methods to explicitly specify which property should be used as the type member of a JSON:API resource object. The value of the annotated field or method return value will be serialized as the resource's type.

If this annotation is not present, the JSON:API for Spring HATEOASrary will derive the type from:

  1. The JsonApiTypeForClass annotation on the class
  2. The class name (optionally pluralized and/or lowercased based on JsonApiConfiguration)

Example usage:


 public class Movie {
   @JsonApiType
   private String resourceType = "films";
   // or on getter:
   @JsonApiType
   public String getResourceType() {
     return "films";
   }
 }
 
See Also: