Table of Contents generated with DocToc
- Changelog
- #44 - @KronicDeth
Alembic.Document.from_ecto_changeset/2
converts theerrors
inecto_changeset
toAlembic.Error.t
in a singleAlembic.Document.t
. Bypasses a bug inJaSerializer
where it assumes all fields that don't end in_id
are attribute names, which leads to association names (as opposed to their foreign key) being put under/data/attributes
.Alembic.Document.from_ecto_changeset
reflects on theEcto.Changeset.t
data
struct module to get the__schema__/1
information from theEcto.Schema.t
. It also assumes that if the field maps to no known attribute, association or foreign key, then the error should not have anAlembic.Source.t
instead of defaulting to/data/attributes
.- Update
circle.yml
- Erlang
19.3
- Elixir
1.4.2
- Erlang
- #45 - @KronicDeth
Alembic.Pagination.Page.count
calculates the number of pages given the pagesize
and thetotal_size
of resources to be paginated.Alembic.Pagination.Page.first
returns theAlembic.Pagination.Page.t
for thefirst
forAlembic.Pagination.t
given any page and the page count.Alembic.Pagination.Page.last
is the last page forAlembic.Pagination.t
given any page and the page count.Alembic.Pagination.Page.next
is the next page after the currentpage
. Ifpage
number
matchescount
, then it must be the last page and so next will benil
.Alembic.Paginaton.Page.previous
is the previous page to the currentpage
. If thepage
number
is1
, then it is the first page, and the previous page isnil
.Alembic.Pagination.Page.to_pagination
takes the currentpage
and thetotal_size
of resources to paginated and produces theAlembic.Pagination
withfirst
,last
,next
, andprevious
around thatpage
. Ifpage
number
is greater than the calculated page count{:error, Alembic.Document.t}
is returned instead of{:ok, Alembic.Pagination.t}
.Alembic.FromJson.integer_from_json
Alembic.FromJson.integer_to_positive_integer
takes an integer and returns it if positive, otherwise returns errorDocument
if0
or below.Alembic.Pagination.Page.from_params
parses param format with quoted integer page number and size or JSON format with integer page number and size.- Allow pagination opt-out with
%{"page" => nil}
.Alembic.Pagination.Page.from_params(%{"page" => nil})
will return{:ok, :all}
while no"page"
param will return{:ok, nil}
. - Update dependencies
- Update
ex_doc
to0.16.1
- Update
excoveralls
to0.7.0
- Update
credo
to0.8.1
- Update
- #46 - Use IntelliJ Elixir formatter for make the formatting consistent - @KronicDeth
- #47 - @KronicDeth
- Convert to CircleCI 2.0
- Turn on workflows, so that
build
, which includesmix deps.get
andmix compile
is a dependency of all, butmix dialyze
,mix docs
,mix inch.report
, andmix coveralls.circleci
can run in parallel after it.
- Turn on workflows, so that
- Convert to CircleCI 2.0
- #48 - Wrap
}
after wrapped keys - @KronicDeth - #49
- Support
many_to_many
associations inAlembic.ToEctoSchema.to_ecto_schema/2
- @jeffutter Alembic.ToEctoSchema.to_ecto_schema/2
doctest
s - @KronicDeth- Increase code coverage to 95.5%
- Cover new
many_to_many
support
- Update dependencies - @KronicDeth
credo
0.8.5
ecto
2.1.6
ex_doc
0.16.2
excoveralls
0.7.2
- Support
- #45 - @KronicDeth
- Allow
next
andprevious
to benil
inPagination.t
@type
since they were already allowed to benil
in use for the last and first page, respectively. Alembic.Pagination.Page
number
ispos_integer
becausenon_neg_integer
allows 0, but that's not valid becausenumber
is 1-based, not 0-based.- Remove extra blank lines from
@doc
s - Switch to github version of
earmark
to get bug fix in pragdave/earmark#144. - Remove spaces inside
{ }
.
- Allow
- #44 - @KronicDeth
Alembic.Document.from_ecto_changeset/2
converts theerrors
inecto_changeset
toAlembic.Error.t
in a singleAlembic.Document.t
. Bypasses a bug inJaSerializer
where it assumes all fields that don't end in_id
are attribute names, which leads to association names (as opposed to their foreign key) being put under/data/attributes
.Alembic.Document.from_ecto_changeset
reflects on theEcto.Changeset.t
data
struct module to get the__schema__/1
information from theEcto.Schema.t
. It also assumes that if the field maps to no known attribute, association or foreign key, then the error should not have anAlembic.Source.t
instead of defaulting to/data/attributes
.- Update
circle.yml
- Erlang
19.3
- Elixir
1.4.1
- Erlang
- #43 - @KronicDeth
- Allow
Alembic.Error.t
source
to benil
- Lower minimum coverage because coverage number varies from run to run.
- Allow
- #42 - @KronicDeth
- Switch from
coverex
toexcoveralls
, so coverage data can be published to Coveralls.io. - Update dependencies
ex_doc
to0.15.1
inch_ex
to0.5.6
ecto
to2.1.4
junit_formatter
to1.3.0
credo
to0.7.3
- Allow
poison
to include~> 3.0
- Switch from
- #42 - @KronicDeth
- Fix Elixir 1.4 warnings
- #41 - @KronicDeth
- Allow
atom
forAlembic.Error.t
:meta
value asatom
is used for"action"
and"sender"
values in error templates. Alembic.Source.t
needs to be clarified to show that either the:parameter
is aString.t
and:pointer
isnil
OR:parameter
isnil
and:pointer
is a JSON pointer.
- Allow
- #40 -
Alembic.Fetch.from_params
, in addition to parsing out the includes will not also parse out the sorts in the"sort"
parameter usingAlembic.Fetch.Sorts.from_params
. To transform theAlembic.Fetch.Sorts.t
back to the string format in"sort"
, you can useAlembic.Fetch.Sorts.to_string/1
. - @KronicDeth
- #40 - Change
:include
to:includes
in the@typedoc
forAlembic.Fetch.t
- @KronicDeth
- #39 - @KronicDeth
- Update dependencies
credo
to0.5.2
ex_doc
to0.14.3
inch_ex
to0.5.5
junit_formatter
to1.1.0
- Build with Erlang 19.1 and Elixir 1.3.4 on CircleCI.
- Update dependencies
- #39 - @KronicDeth
- Ecto 2.1 makes the warning about
cast/4
instead ofcast/3
noisy, but Ecto 1.X had the opposite warning to usecast/4
instead ofcast/3
, so usecast/3
. - Fix all Erlang 19.1 dialyzer warnings.
- Ecto 2.1 makes the warning about
- #39 - Drop Ecto 1.0 since Ecto 1.0's
cast/3
is different than Ecto 2.0'scast/3.
- @KronicDeth
- #38 - CodeClimate just added credo support to their beta engines channel. Running on CodeClimate will allow the credo tests to run in parallel with CircleCI, leading to faster overall build times. - @KronicDeth
- #32 -
Alembic.Pagination.to_links/2
allows convertingAlembic.Pagination.t
fromAlembic.Links.to_pagination
back toAlembic.Links.t
with urls. - @KronicDeth - #33 - @KronicDeth
- Update
coverex
to1.4.10
- Update
credo
to0.4.11
- Update
ecto
to2.0.5
- Update
hackney
to1.6.1
- Update
httpoison
to0.9.1
- Update
inch_ex
to0.5.4
- Update
junit_formatter
to1.1.0
- JUnit output location changed from
_build/test/test-junit-report.xml
to_build/test/lib/alembic/test-junit-report.xml
- JUnit output location changed from
- Update
- #32 - Fix
alias
that wasn't renamed - @KronicDeth
- #31 - @KronicDeth
- Update
ex_doc
to0.12.0
- Update
credo
to0.4.5
- Update
ecto
to2.0.2
. Compatibility range is changed from~> 1.1
to~> 1.1 or ~> 2.0
, so no incompatibility is introduced for runtime dependencies.
- Update
- #30 - Elixir 1.3.0 compatibility - @KronicDeth
- Work-around elixir-lang/elixir#4874) by aliasing
Alembic.Source
and usingSource.t
instead of@for.t
. - Use Erlang 18.3 instead of Erlang 19.0 until dialyer bug (http://bugs.erlang.org/browse/ERL-177) is fixed.
- Work-around elixir-lang/elixir#4874) by aliasing
- #27 - Add more doctests to Alembic.ToParams.nested_to_foreign_keys - @KronicDeth
nil
for the nested parameters converts to anil
foreign key parameter- When the nested parameters are not even present, the foreign key won't be added
*
has_many
nested params are unchanged
- #27 - Convert
nil
nested params tonil
foreign key - @KronicDeth
- #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
- #10 -
ToEctoSchema
andToParams
- @KronicDethAlembic.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
.
- Use
- #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.
- Allow compatibility with projects that haven't upgraded to Poison 2.0. Nothing in the
- #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.
- Use
- #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.
- Use
- #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.
- Use
- #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.
- Like
- #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.
- Removed the
- #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
- #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
- Use
- #4 - @KronicDeth
- #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
- Configure
- #6 - @KronicDeth
- Use
dialyze
for dialyzer access withmix dialyze
- Use
- #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{}}
.
- JSON API errors documents can be validated and converted to
- #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>
.
- #8 - JSON API (non-errors) Documents - @KronicDeth
Alembic.FromJsonTest.assert_idempotent
has moved toAlembic.FromJsonCase
.