Skip to content

toedter/spring-hateoas-jsonapi-examples

Repository files navigation

build Apache 2.0

JSON:API for Spring HATEOAS Examples

This repository contains example projects to interact with JSON:API for Spring HATEOAS.

Examples

example-model

In this library project the data model used by all examples is defined. Movie and Director are the JPA Entities, also Spring Data repositories are defined and filled with 250 sample movies.

example-basic

Basic usage of the representation models provided by Spring HATEOAS. No JSON:API specific features are used, but the resulting JSON is rendered as JSON:API.

example-advanced

Advanced usage of JSON:API specific features like relationships, included resources and sparse fieldsets.

example-restdocs-openapi

This adds a test to the example-advanced that produces an OpenAPI v3 specification. You can create the spec running ../gradlew openapi3. You find the generated spec at build/api-spec/openapi3.yaml

Note
This example is currently not working with Spring Boot 4. We have to wait for a new version of com.epages:restdocs-api-spec-mockmvc that supports Spring Boot 4. See ePages-de/restdocs-api-spec#289

example-data-rest

This example demonstrates Spring Data REST integration with JSON:API.

Running the Examples

  • Make sure Java 17 or later JDK is installed

  • Clone this Git repository and cd into spring-hateoas-jsonapi-examples

  • cd to the one of the example directories

  • Invoke ../gradlew bootrun (..\gradlew on Windows)

  • Open http://localhost:8080/api/movies

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages