Table of Contents generated with DocToc
Changelog
v4.0.0
Enhancements
-
Update alembic to support Ecto 3.0
- This required very minimal code changes, only updates to doctests
Dropping support for Ecto 2.x and Elixir < 1.7
- These versions should still continue to work, but we don’t have matrix builds setup so we can’t guarantee backwards compatibility going forward
Update
circle.yml- Erlang
21 - Elixir
1.7.2
- Erlang
- Introduce
mix formatand enforce it on CI
v3.4.0
Enhancements
-
Alembic.Document.from_ecto_changeset/2converts theerrorsinecto_changesettoAlembic.Error.tin a singleAlembic.Document.t. Bypasses a bug inJaSerializerwhere it assumes all fields that don’t end in_idare attribute names, which leads to association names (as opposed to their foreign key) being put under/data/attributes.Alembic.Document.from_ecto_changesetreflects on theEcto.Changeset.tdatastruct module to get the__schema__/1information 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.tinstead of defaulting to/data/attributes.Update
circle.yml- Erlang
19.3 - Elixir
1.4.2
- Erlang
-
Alembic.Pagination.Page.countcalculates the number of pages given the pagesizeand thetotal_sizeof resources to be paginated.Alembic.Pagination.Page.firstreturns theAlembic.Pagination.Page.tfor thefirstforAlembic.Pagination.tgiven any page and the page count.Alembic.Pagination.Page.lastis the last page forAlembic.Pagination.tgiven any page and the page count.Alembic.Pagination.Page.nextis the next page after the currentpage. Ifpagenumbermatchescount, then it must be the last page and so next will benil.Alembic.Paginaton.Page.previousis the previous page to the currentpage. If thepagenumberis1, then it is the first page, and the previous page isnil.Alembic.Pagination.Page.to_paginationtakes the currentpageand thetotal_sizeof resources to paginated and produces theAlembic.Paginationwithfirst,last,next, andpreviousaround thatpage. Ifpagenumberis greater than the calculated page count{:error, Alembic.Document.t}is returned instead of{:ok, Alembic.Pagination.t}.Alembic.FromJson.integer_from_jsonAlembic.FromJson.integer_to_positive_integertakes an integer and returns it if positive, otherwise returns errorDocumentif0or below.Alembic.Pagination.Page.from_paramsparses 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_docto0.16.1 - Update
excoverallsto0.7.0 - Update
credoto0.8.1
- Update
- #46 - Use IntelliJ Elixir formatter for make the formatting consistent - @KronicDeth
-
Convert to CircleCI 2.0
- Turn on workflows, so that
build, which includesmix deps.getandmix compileis a dependency of all, butmix dialyze,mix docs,mix inch.report, andmix coveralls.circlecican run in parallel after it.
- Turn on workflows, so that
- #48 - Wrap
}after wrapped keys - @KronicDeth -
- Support
many_to_manyassociations inAlembic.ToEctoSchema.to_ecto_schema/2- @jeffutter Alembic.ToEctoSchema.to_ecto_schema/2doctests - @KronicDeth- Increase code coverage to 95.5%
- Cover new
many_to_manysupport
Update dependencies - @KronicDeth
credo0.8.5ecto2.1.6ex_doc0.16.2excoveralls0.7.2
- Support
Bug Fixes
-
- Allow
nextandpreviousto benilinPagination.t@typesince they were already allowed to benilin use for the last and first page, respectively. Alembic.Pagination.Pagenumberispos_integerbecausenon_neg_integerallows 0, but that’s not valid becausenumberis 1-based, not 0-based.- Remove extra blank lines from
@docs - Switch to github version of
earmarkto get bug fix in pragdave/earmark#144. - Remove spaces inside
{ }.
- Allow
v3.3.0
Enhancements
-
Alembic.Document.from_ecto_changeset/2converts theerrorsinecto_changesettoAlembic.Error.tin a singleAlembic.Document.t. Bypasses a bug inJaSerializerwhere it assumes all fields that don’t end in_idare attribute names, which leads to association names (as opposed to their foreign key) being put under/data/attributes.Alembic.Document.from_ecto_changesetreflects on theEcto.Changeset.tdatastruct module to get the__schema__/1information 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.tinstead of defaulting to/data/attributes.Update
circle.yml- Erlang
19.3 - Elixir
1.4.1
- Erlang
Bug Fixes
-
- Allow
Alembic.Error.tsourceto benil - Lower minimum coverage because coverage number varies from run to run.
- Allow
v3.2.0
Enhancements
-
- Switch from
coverextoexcoveralls, so coverage data can be published to Coveralls.io. Update dependencies
ex_docto0.15.1inch_exto0.5.6ectoto2.1.4junit_formatterto1.3.0credoto0.7.3
- Allow
poisonto include~> 3.0
- Switch from
Bug Fixes
-
- Fix Elixir 1.4 warnings
v3.1.1
Bug Fixes
-
- Allow
atomforAlembic.Error.t:metavalue asatomis used for"action"and"sender"values in error templates. Alembic.Source.tneeds to be clarified to show that either the:parameteris aString.tand:pointerisnilOR:parameterisniland:pointeris a JSON pointer.
- Allow
v3.1.0
Enhancements
- #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.tback to the string format in"sort", you can useAlembic.Fetch.Sorts.to_string/1. - @KronicDeth
Bug Fixes
- #40 - Change
:includeto:includesin the@typedocforAlembic.Fetch.t- @KronicDeth
v3.0.0
Enhancements
-
Update dependencies
credoto0.5.2ex_docto0.14.3inch_exto0.5.5junit_formatterto1.1.0
- Build with Erlang 19.1 and Elixir 1.3.4 on CircleCI.
Bug Fixes
-
- Ecto 2.1 makes the warning about
cast/4instead ofcast/3noisy, but Ecto 1.X had the opposite warning to usecast/4instead ofcast/3, so usecast/3. - Fix all Erlang 19.1 dialyzer warnings.
- Ecto 2.1 makes the warning about
Incompatible Changes
- #39 - Drop Ecto 1.0 since Ecto 1.0’s
cast/3is different than Ecto 2.0’scast/3.- @KronicDeth
v2.4.0
Enhancements
- #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
v2.3.0
Enhancements
- #32 -
Alembic.Pagination.to_links/2allows convertingAlembic.Pagination.tfromAlembic.Links.to_paginationback toAlembic.Links.twith urls. - @KronicDeth -
- Update
coverexto1.4.10 - Update
credoto0.4.11 - Update
ectoto2.0.5 - Update
hackneyto1.6.1 - Update
httpoisonto0.9.1 - Update
inch_exto0.5.4 Update
junit_formatterto1.1.0- JUnit output location changed from
_build/test/test-junit-report.xmlto_build/test/lib/alembic/test-junit-report.xml
- JUnit output location changed from
- Update
Bug Fixes
- #32 - Fix
aliasthat wasn’t renamed - @KronicDeth
v2.2.0
Enhancements
-
- Update
ex_docto0.12.0 - Update
credoto0.4.5 - Update
ectoto2.0.2. Compatibility range is changed from~> 1.1to~> 1.1 or ~> 2.0, so no incompatibility is introduced for runtime dependencies.
- Update
v2.1.1
Bug Fixes
#30 - Elixir 1.3.0 compatibility - @KronicDeth
- Work-around elixir-lang/elixir#4874) by aliasing
Alembic.Sourceand usingSource.tinstead 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
v2.1.0
Enhancements
#27 - Add more doctests to Alembic.ToParams.nested_to_foreign_keys - @KronicDeth
nilfor the nested parameters converts to anilforeign key parameter- When the nested parameters are not even present, the foreign key won’t be added
*
has_manynested params are unchanged
Bug Fixes
- #27 - Convert
nilnested params tonilforeign key - @KronicDeth
v2.0.1
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 asarg0andarg1in the generated docs. - Use those names in the Paramaters section and code block teh format of the error template.
- Use
v2.0.0
Enhancements
#10 -
ToEctoSchemaandToParams- @KronicDethAlembic.Document.to_params/1takes anAlembic.Document.tand converts it to the params format used byEcto.Changset.cast/4Alembic.Document.to_ecto_schema/2takes anAlembic.Document.tand converts it toEcto.Schemastructs that an be used in the rest of an application.
#11 - Parse include params - @KronicDeth
Alembic.Fetch.from_paramscan extract and normalize params for controlling JSON API fetching into an%Alembic.Fetch{}.Alembic.Fetch.Includes.to_preloadscan convert the normalized includes to a list of preloads forEcto.Repo.preloadorEcto.Query.preload.Alembic.Fetch.to_querywill add the preloads for%Alembic.Fetch{}includes to a query.
#12 - Fetch.Include.preload and preload_by_include types - @KronicDeth
- Use
Fetch.Include.preloadandpreload_by_include typestypes instead of generictermandmap.
- Use
- #14 - Allow
jsonapifield inDocument.t, so that jsonapi can be set to%{ "version" => "1.0" }to matchJaSerializeroutput. - @KronicDeth - #15 -
ToParams.nest_to_foreign_keys/2converts nested parameters forbelongs_toassociations to a foreign key parameter. - @KronicDeth - #16 - Check for “Closing unclosed backquotes” from
mix docson CircleCI - @KronicDeth #17 - Pagination - @KronicDeth
Pagination.Pagecan store thepage[number]andpage[size]from aURI.Link.to_pagecan convert a URL to anPagination.PagePaginationcan store thefirst,last,next, andpreviousPagination.PagesDocument.to_paginationwill extract thefirst,last, andnext, andpreviousPagination.Pagefrom the"first","last","next", and"prev"top-levellinks. Thetotal_sizewill be extracted from the top-levelmeta"record_count". This gives compatibility with the paged paginator inJSONAPI::Resourceswithconfig.top_level_meta_include_record_count = true.
#18 - Document.error_status_consensus - @KronicDeth
Document.error_status_consensus(document :: Document.t) :: String.treturns the consensusError.tstatusfor all theerrorsin 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"because400covers 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_stringwill 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.Encoderimplementations is 2.0 specific, so allow both major versions.
- Allow compatibility with projects that haven’t upgraded to Poison 2.0. Nothing in the
Bug Fixes
#10 -
ToEctoSchemaandToParams- @KronicDeth- Use
Alembic.ResourceIdentifier.tinAlembic.Relationship.tfordata’s value type. - Use
Alembic.Meta.tinAlembic.Relationship.tformeta’s value type.
- Use
-
- Use
:unsetinstead ofnilfor unset%Alembic.Document{}dataas it was too difficult to properly infer whennilwas unset and when it was a singleton that was not present. Alembic.Resource.to_paramsnow treatsnil%Alembic.Resource{}attributesas%{}when building the params so invalid input from user does not cause an exception.
- Use
- #14 - Don’t encode
ResourceIdentifier.metawhen it isnil, so that"meta":nulldoesn’t occur in the encoded version. - @KronicDeth - #16 - Add missing backquotes - @KronicDeth
-
Resource.to_ecto_schemanow ignores relationships that don’t map to known associations, which manifested as anArgumentErrortoString.to_existing_atom.Resource.to_ecto_schemaonly sets the foreign key when the relationship is present, which prevent runningnil.id.
#20 - Indirect relationships - @KronicDeth
to_paramsandto_ecto_schemaproperly handles indirect relationships.
#21 - Fix deprecation warnings for Ecto 1.1 - @KronicDeth
- Use
Ecto.Changeset.cast/4instead ofcast/3to eliminate deprecation warning.
- Use
#22 - Represent no relationship data different than null data - @KronicDeth
- Like
Document,Relationshipneeds to differentiate between"data":nullin the JSON and no data key at all, so haveRelationship.tdefault to:unsetinstead ofnil, the same wayDocument.tworks now. This means adding aPoison.Encoderimplementation to not encode the:unsetand changing theToParamsbehaviour to allow for an{:error, :unset}return that theRelationship.to_paramscan return whendatais:unset, so thatRelationships.to_paramswill skip including the output in the map of all relationship params.
- Like
Incompatible Changes
#10 -
ToEctoSchemaandToParams- @KronicDeth- Removed the
Alembic.Relationship.resource_identifiertype 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_jsonprivate as it should have alway been. - @KronicDeth #20 - Indirect relationships - @KronicDeth
ToParamsbehaviour now requiresto_params/3in addition toto_params/2Remove
to_ecto_schema/3that are no longer called because of recursion inToEctoSchema.to_ecto_schema/2RelationshipRelationshipsResourceIdentifierResourceLinkage
v1.0.0
Enhancements
-
- CircleCI build setup
- JUnit formatter for CircleCI’s test output parsing
-
mix test --coverwith CoverEx- Archive coverage reports on CircleCI
-
- Use
ex_docandearmarkto generate documentation withmix docs - Use
mix inch (--pedantic)to see coverage for documentation
- Use
-
- Configure
mix credoto run againstlibandtestto maintain consistency with Ruby projects that userubocoponlibandspec. - Run
mix credo --stricton CircleCI to check style and consistency in CI
- Configure
-
- Use
dialyzefor 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.ResourceIdentifierAlembic.ResourceLinkageAlembic.RelationshipAlembic.RelationshipsAlembic.ResourceAlembic.Documentcan parsefrom_json, represent, and encode withPoison.encodeall document format, includingdataandmeta, in addition to the prior support forerrorsassert_idempotentis defined in a module,Alembic.FromJsonCaseundertest/support, so it’s no longer necessary to runmix test <file> test/interpreter_server/api/from_json_test.exsto get access toassert_idempotentin<file>.
Incompatible Changes
#8 - JSON API (non-errors) Documents - @KronicDeth
Alembic.FromJsonTest.assert_idempotenthas moved toAlembic.FromJsonCase.