Table of Contents generated with DocToc

Changelog

v2.1.1

Bug Fixes

v2.1.0

Enhancements

  • #27 - Add more doctests to Alembic.ToParams.nested_to_foreign_keys - KronicDeth
  • nil for the nested parameters converts to a nil foreign key parameter
  • When the nested parameters are not even present, the foreign key won’t be added *has_many nested params are unchanged

Bug Fixes

  • #27 - Convert nil nested params to nil foreign 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 as arg0 and arg1 in the generated docs.
    • Use those names in the Paramaters section and code block teh format of the error template.

v2.0.0

Enhancements

  • #10 - ToEctoSchema and ToParams - KronicDeth
  • Alembic.Document.to_params/1 takes an Alembic.Document.t and converts it to the params format used by Ecto.Changset.cast/4
  • Alembic.Document.to_ecto_schema/2 takes an Alembic.Document.t and converts it to Ecto.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 for Ecto.Repo.preload or Ecto.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 and preload_by_include types types instead of generic term and map.
  • #14 - Allow jsonapi field in Document.t, so that jsonapi can be set to %{ "version" => "1.0" } to match JaSerializer output. - KronicDeth
  • #15 - ToParams.nest_to_foreign_keys/2 converts nested parameters for belongs_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 the page[number] and page[size] from a URI.
  • Link.to_page can convert a URL to an Pagination.Page
  • Pagination can store the first, last, next, and previous Pagination.Pages
  • Document.to_pagination will extract the first, last, and next, and previous Pagination.Page from the "first", "last", "next", and "prev" top-level links. The total_size will be extracted from the top-level meta "record_count". This gives compatibility with the paged paginator in JSONAPI::Resources with config.top_level_meta_include_record_count = true.
  • #18 - Document.error_status_consensus - KronicDeth
  • Document.error_status_consensus(document :: Document.t) :: String.t returns the consensus Error.t status for all the errors in the document. If there are no errors or statuses, then it is nil; 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" because 400 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 structs
  • Fetch.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 and ToParams - KronicDeth
  • Use Alembic.ResourceIdentifier.t in Alembic.Relationship.t for data’s value type.
  • Use Alembic.Meta.t in Alembic.Relationship.t for meta’s value type.
  • #13 - KronicDeth
  • Use :unset instead of nil for unset %Alembic.Document{} data as it was too difficult to properly infer when nil was unset and when it was a singleton that was not present.
  • Alembic.Resource.to_params now treats nil %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 is nil, 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 an ArgumentError to String.to_existing_atom.
  • Resource.to_ecto_schema only sets the foreign key when the relationship is present, which prevent running nil.id.
  • #20 - Indirect relationships - KronicDeth
  • to_params and to_ecto_schema properly handles indirect relationships.
  • #21 - Fix deprecation warnings for Ecto 1.1 - KronicDeth
  • Use Ecto.Changeset.cast/4 instead of cast/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 have Relationship.t default to :unset instead of nil, the same way Document.t works now. This means adding a Poison.Encoder implementation to not encode the :unset and changing the ToParams behaviour to allow for an {:error, :unset} return that the Relationship.to_params can return when data is :unset, so that Relationships.to_params will skip including the output in the map of all relationship params.

Incompatible Changes

  • #10 - ToEctoSchema and ToParams - KronicDeth
  • Removed the Alembic.Relationship.resource_identifier type that was made obsolete by Alembic.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 requires to_params/3 in addition to to_params/2
  • Remove to_ecto_schema/3 that are no longer called because of recursion in ToEctoSchema.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 and earmark to generate documentation with mix 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 against lib and test to maintain consistency with Ruby projects that use rubocop on lib and spec.
  • Run mix credo --strict on CircleCI to check style and consistency in CI
  • #6 - KronicDeth
  • Use dialyze for dialyzer access with mix dialyze
  • #7 - Validation and conversion of JSON API errors Documents - KronicDeth
  • JSON API errors documents can be validated and converted to %Alembic.Document{} using Alembic.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 using from_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 parse from_json, represent, and encode with Poison.encode all document format, including data and meta, in addition to the prior support for errors
  • assert_idempotent is defined in a module, Alembic.FromJsonCase under test/support, so it’s no longer necessary to run mix test <file> test/interpreter_server/api/from_json_test.exs to get access to assert_idempotent in <file>.

Incompatible Changes

  • #8 - JSON API (non-errors) Documents - KronicDeth
  • Alembic.FromJsonTest.assert_idempotent has moved to Alembic.FromJsonCase.