This Project demonstrates how to integrate HAPI with Spring Boot and Swagger.
The problem with integration is that Spring Boot and Swagger uses Jackson for serialization and inspection. And because of the complexities of the HAPI Datamodel, Jackson is unable to inspect or serialize/deserialize.
To address these shortcomings, do the following:
- Create a MessageConverter to use HAPI's serialization/deserialization library instead of Jackson for HAPI Resources.
- Create a Swagger ModelConverter to direct swagger to only inspect non-private fields and truncate less relevant fields
- Since HAPI's models are complex, provide sensible Swagger default values
Note: Collection of HAPI Resources should use the Bundle Resource rather than return a Collection type.
From the command line, issue ./gradlew bootRun
.
Once the application is running, open your browser to
http://localhost:8080/swagger-ui.html