I’ve just published the first version of a new JSON:API library. This project was born as a fork of the jsonapi library (GitHub - beam-community/jsonapi: JSON:API Serializer and Query Handler for Elixir) but has since been almost completly rewritten and is a different project.
jsonapi_plug has to offer to users of Phoenix/Plug for building
JSON:API compliant APIs:
An extensible system based on behaviours to convert
JSON:APIpayloads and query parameters from/to whatever format best suits the library user. Default implementations are provided to convert payloads and query parameters to an Ecto friendly format, which is probably the most common scenario for the data source of APIs in Phoenix based applications. Behaviours are available to customize parsing and/or easily parse non-standard specified query parameters (filter, page).
Ability to have multiple APIs with different configurations sourced from the hosting application configuration to avoid single global configuration rigidity. This allows to serve multiple different APIs from a single Phoenix/Plug application instance.
A declarative resource system allowing users to control rendering, rename fields between
JSON:APIpayloads and internal data, customize (de)serialization of fields values and more without writing additional business logic code.
I’ve been using this for some time in production, but I’d love to get some feedback. It currently targets JSON:API 1.0, but I’d love to add support for the recently finalized JSON:API 1.1 spec.