absinthe_sorting_codec

Codec for generating Absinthe JSON schemas in a deterministic format with alphabetically ordered type definitions

Latest version: 1.0.1 registry icon
Maintenance score
0
Safety score
0
Popularity score
70
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High
1.0.1 0 0 0 0
1.0.0 0 0 0 0

Stability
Latest release:

1.0.1 - this version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Absinthe Sorting Codec

Build Status Hex pm Hex Docs License

Convert the JSON output of an introspection query into a deterministic ordering of types (sorted by name). This results in saner diffs when committing schemas to version control.

Standalone

Can convert the output of introspection queries in JSON format to a sorted, deterministic ordering of types. See the test fixtures.

Example

AbsintheSortingCodec.encode!(Jason.decode!("swapi.json"))

Absinthe

Can be used to convert an Absinthe schema to a deterministic format by using AbsintheSortingCodec as the JSON encoder.

Example

mix absinthe.schema.json --schema MySchema --json-codec AbsintheSortingCodec --pretty

NOTE: If the mix command gives the following error --

(Argument Error) you atttempted to apply :module on "AbsintheSortingCodec". If you are using apply/3, make sure the module is an atom. If you are using the dot syntax, such as map.field or module.function, make sure the left side of the dot is an atom or a map

-- you need to upgrade to Absinthe 1.4.14 or 1.5 or later.

Installation

If available in Hex, the package can be installed by adding absinthe_sorting_codec to your list of dependencies in mix.exs:

def deps do
  [
    {:absinthe_sorting_codec, "~> 1.0.1"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/absinthe_sorting_codec.

Attribution

Thanks to Maarten van Vliet for developing Absinthe SDL, which this project is patterned after.