ja_serializer
ja_serializer copied to clipboard
JSONAPI.org Serialization in Elixir.
Hi! So I am trying to reuse an existing serializer for a relation that has a different (include) name/type. For example: ```elixir defmodule AuthorView do has_many :articles, serializer: ArticleView, link:...
I have a serializer defined like this: ```elixir attributes([ :name, :custom_property ]) ``` Where `:name` exists in the original struct, but `:custom_property` is calculated in same named function. If I...
This was reported on #249 but the issue and PR are closed without being merged and released. [`EctoErrorSerializer.format/3`](https://github.com/vt-elixir/ja_serializer/blob/574afb8d3170fa50e1f0dd918275936e32d06671/lib/ja_serializer/ecto_error_serializer.ex#L42-L43) calls `changeset.errors` directly instead of using `traverse_errors/2` to walk through the changeset...
In dsl.ex, if you have :format as attribute def default_attributes(serializer, struct, conn) do serializer.__attributes |> Enum.map(&({&1, apply(serializer, &1, [struct, conn])})) you get warning: Elixir.MyApp.V1.PhotoView.format/3 is deprecated. Please use JaSerializer.format/4 instead,...
For some implementations of `relationships/2`, it can be expensive to calculate. For the top level, we've already calculated the relationships as a part of the `%ResourceObject{}` so we don't need...
I have been using the solution to implement nested formatting found here: #302 This is serving me very well for a while now. However, just now I tried to release...
I noticed the library adds the version member by default, with no way to exclude it from the JSON payload. The [specification](https://jsonapi.org/format/#document-jsonapi-object) marks that as a **MAY**, I'm curious to...
Having a view like so (minified): ```elixir defmodule HalWeb.V2.Inventory.MovementView do use HalWeb, :v2_view has_one :location, serializer: LocationView, link: :location_link def location_link(movement, conn), do: inventory_location_path(conn, :show, movement.location_id) end ``` results in...
Is it currently possible to paginate relationships? From what I found in the code and the docs, this doesn't seem to be officially supported anywhere. The best solution I could...
Using the default dasherized fields, here's an example: ```elixir GET "/admin-users?fields[admin-user]=first-name,last-name" params["fields"] == %{"admin_user" => "first-name,last-name"} ``` Note: the resource name was underscored, and the field names were left untouched....