Table of Contents generated with DocToc
Changelog
v2.0.1
Enhancements
Bug Fixes
- #25 - Documentation formatting - KronicDeth
- Wrong number of spaces and missing closing backquotes led to some doctests not being rendered correctly.
Fix docs for FromJson.from_json callback
- Use
<name> :: <type>
format for parameters, so they don’t appear asarg0
andarg1
in the generated docs. - Use those names in the Paramaters section and code block teh format of the error template.
- Use
Incompatible Changes
v2.0.0
Enhancements
- #10 -
ToEctoSchema
andToParams
- KronicDeth Alembic.Document.to_params/1
takes anAlembic.Document.t
and converts it to the params format used byEcto.Changset.cast/4
Alembic.Document.to_ecto_schema/2
takes anAlembic.Document.t
and converts it toEcto.Schema
structs that an be used in the rest of an application.- #11 - Parse include params - KronicDeth
Alembic.Fetch.from_params
can extract and normalize params for controlling JSON API fetching into an%Alembic.Fetch{}
.Alembic.Fetch.Includes.to_preloads
can convert the normalized includes to a list of preloads forEcto.Repo.preload
orEcto.Query.preload
.Alembic.Fetch.to_query
will add the preloads for%Alembic.Fetch{}
includes to a query.- #12 - Fetch.Include.preload and preload_by_include types - KronicDeth
- Use
Fetch.Include.preload
andpreload_by_include types
types instead of genericterm
andmap
. - #14 - Allow
jsonapi
field inDocument.t
, so that jsonapi can be set to%{ "version" => "1.0" }
to matchJaSerializer
output. - KronicDeth - #15 -
ToParams.nest_to_foreign_keys/2
converts nested parameters forbelongs_to
associations to a foreign key parameter. - KronicDeth - #16 - Check for “Closing unclosed backquotes” from
mix docs
on CircleCI - KronicDeth - #17 - Pagination - KronicDeth
Pagination.Page
can store thepage[number]
andpage[size]
from aURI
.Link.to_page
can convert a URL to anPagination.Page
Pagination
can store thefirst
,last
,next
, andprevious
Pagination.Page
sDocument.to_pagination
will extract thefirst
,last
, andnext
, andprevious
Pagination.Page
from the"first"
,"last"
,"next"
, and"prev"
top-levellinks
. Thetotal_size
will be extracted from the top-levelmeta
"record_count"
. This gives compatibility with the paged paginator inJSONAPI::Resources
withconfig.top_level_meta_include_record_count = true
.- #18 - Document.error_status_consensus - KronicDeth
Document.error_status_consensus(document :: Document.t) :: String.t
returns the consensusError.t
status
for all theerrors
in thedocument
. If there are no errors or statuses, then it isnil
; otherwise, the consensus is the status shared between all (non-nil
) errors or the max 100s status. For example,"404"
and"422"
would have a consensus of"400"
because400
covers both errors. For"404"
and"500"
the consensus would be"500"
because"500"
is more serious than any 4XX error.- #20 - Indirect relationships - KronicDeth
ToEctoSchema.to_ecto_schema(params, module)
recursively converts nested params to the associated structsFetch.Includes.to_string
will take a list of includes and convert it back to the common-separated string format used by JSONAPI query parameters.- #23 - Allow Poison ~> 1.5 or ~> 2.0 - KronicDeth
- Allow compatibility with projects that haven’t upgraded to Poison 2.0. Nothing in the
Poison.Encoder
implementations is 2.0 specific, so allow both major versions.
Bug Fixes
- #10 -
ToEctoSchema
andToParams
- KronicDeth - Use
Alembic.ResourceIdentifier.t
inAlembic.Relationship.t
fordata
’s value type. - Use
Alembic.Meta.t
inAlembic.Relationship.t
formeta
’s value type. - #13 - KronicDeth
- Use
:unset
instead ofnil
for unset%Alembic.Document{}
data
as it was too difficult to properly infer whennil
was unset and when it was a singleton that was not present. Alembic.Resource.to_params
now treatsnil
%Alembic.Resource{}
attributes
as%{}
when building the params so invalid input from user does not cause an exception.- #14 - Don’t encode
ResourceIdentifier.meta
when it isnil
, so that"meta":null
doesn’t occur in the encoded version. - KronicDeth - #16 - Add missing backquotes - KronicDeth
- #19 - KronicDeth
Resource.to_ecto_schema
now ignores relationships that don’t map to known associations, which manifested as anArgumentError
toString.to_existing_atom
.Resource.to_ecto_schema
only sets the foreign key when the relationship is present, which prevent runningnil.id
.- #20 - Indirect relationships - KronicDeth
to_params
andto_ecto_schema
properly handles indirect relationships.- #21 - Fix deprecation warnings for Ecto 1.1 - KronicDeth
- Use
Ecto.Changeset.cast/4
instead ofcast/3
to eliminate deprecation warning. - #22 - Represent no relationship data different than null data - KronicDeth
- Like
Document
,Relationship
needs to differentiate between"data":null
in the JSON and no data key at all, so haveRelationship.t
default to:unset
instead ofnil
, the same wayDocument.t
works now. This means adding aPoison.Encoder
implementation to not encode the:unset
and changing theToParams
behaviour to allow for an{:error, :unset}
return that theRelationship.to_params
can return whendata
is:unset
, so thatRelationships.to_params
will skip including the output in the map of all relationship params.
Incompatible Changes
- #10 -
ToEctoSchema
andToParams
- KronicDeth - Removed the
Alembic.Relationship.resource_identifier
type that was made obsolete byAlembic.ResourceIdentifier.t
- Updating relations by nesting attributes is no longer supported as it is not supported in the JSONAPI spec.
- #17 - Make
Link.href_from_json
private as it should have alway been. - KronicDeth - #20 - Indirect relationships - KronicDeth
ToParams
behaviour now requiresto_params/3
in addition toto_params/2
Remove
to_ecto_schema/3
that are no longer called because of recursion inToEctoSchema.to_ecto_schema/2
Relationship
Relationships
ResourceIdentifier
ResourceLinkage
v1.0.0
Enhancements
- #1 - KronicDeth
- CircleCI build setup
- JUnit formatter for CircleCI’s test output parsing
- #2 - KronicDeth
mix test --cover
with CoverEx- Archive coverage reports on CircleCI
- #3 - KronicDeth
- Use
ex_doc
andearmark
to generate documentation withmix docs
- Use
mix inch (--pedantic)
to see coverage for documentation - #4 - KronicDeth
- Add repository to hexfaktor, so that outdated hex dependencies are automatically notified through CI.
- Add hexfaktor badge to README.md
- #5 - KronicDeth
- Configure
mix credo
to run againstlib
andtest
to maintain consistency with Ruby projects that userubocop
onlib
andspec
. - Run
mix credo --strict
on CircleCI to check style and consistency in CI - #6 - KronicDeth
- Use
dialyze
for dialyzer access withmix dialyze
- #7 - Validation and conversion of JSON API errors Documents - KronicDeth
- JSON API errors documents can be validated and converted to
%Alembic.Document{}
usingAlembic.Document.from_json/2
. Invalid documents return{:error, %Alembic.Document{}}
. The%Alembic.Document{}
can be sent back to the sender, which can be validated on the other end usingfrom_json/2
. Valid documents return{:ok, %Alembic.Document{}}
. - #8 - JSON API (non-errors) Documents - KronicDeth
Alembic.ResourceIdentifier
Alembic.ResourceLinkage
Alembic.Relationship
Alembic.Relationships
Alembic.Resource
Alembic.Document
can parsefrom_json
, represent, and encode withPoison.encode
all document format, includingdata
andmeta
, in addition to the prior support forerrors
assert_idempotent
is defined in a module,Alembic.FromJsonCase
undertest/support
, so it’s no longer necessary to runmix test <file> test/interpreter_server/api/from_json_test.exs
to get access toassert_idempotent
in<file>
.
Bug Fixes
Incompatible Changes
- #8 - JSON API (non-errors) Documents - KronicDeth
Alembic.FromJsonTest.assert_idempotent
has moved toAlembic.FromJsonCase
.