You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have defined the application/json serializer with Oat::Adapters::HAL without including any links. This works accept the :evidence collection is wrapped in a HAL _embedded property.
Is there a way to represent vanilla JSON when the client does not accept hypermedia formats?
I think your approach works. You define a special adapter with no-op methods so it's compatible with all other adapters you're using.
How do content negotiation and swap adapters is up to you and the web framework you'll be using. After deciding which adapter you want to use you can pass it to the serializers on a per-request basis. See https://github.com/ismasan/oat#switching-adapters-dynamically
I am attempting to define single Serializer class to handle resources for application/json and application/hal+json.
Currently I have an Evidence resource defined using two serializers:
I have defined the application/json serializer with Oat::Adapters::HAL without including any links. This works accept the
:evidence
collection is wrapped in a HAL_embedded
property.Is there a way to represent vanilla JSON when the client does not accept hypermedia formats?
An adapter like this gist does the job.
The text was updated successfully, but these errors were encountered: