DocsBuildCode CoveragePackageLicenseDownloads

Pravda logo

Pravda: An OpenAPI 3.0 validator plug for phoenix.

Pravda is a plug for phoenix to validate input and output against a provided spec. It also supports having multiple versions of the same spec lodaded at one time, and the ability to migrate the input version to the current spec, and downgrade the output to the desired sepc. It supports custom error messages via callbacks, and extra logging via callback as well.

Metrics are implemented via telemetry.

Example

    plug(Pravda, %{
      spec_var: "spec-version",
      all_paths_required: true,
      error_callback: MyApp.Utils.PravdaErrorLogger,
      migration_callback: MyApp.Utils.PravdaMigrations,
      specs: Pravda.Loader.read_dir("deps/my_specs/suppored_releases"),
    })

Installation

Add the following to the deps block in mix.exs:

{:pravda, "~>0.6.0"}

Configuration

Configuration can be specified in the opts argument to all Pravda functions, by setting config values with e.g., Application.put_env, or by a combination of the two.

The following configuration options are supported:

TODO

Metrics

Metrics are offered via the Telemetry library. The following metrics are emitted:

Contributing

Thanks for considering contributing to this project, and to the free software ecosystem at large!

Interested in contributing a bug report? Terrific! Please open a GitHub issue and include as much detail as you can. If you have a solution, even better -- please open a pull request with a clear description and tests.

Have a feature idea? Excellent! Please open a GitHub issue for discussion.

Want to implement an issue that's been discussed? Fantastic! Please open a GitHub pull request and write a clear description of the patch. We'll merge your PR a lot sooner if it is well-documented and fully tested.

Authorship and License

Copyright 2020, Matthew O'Gorman.

This software is released under the MIT License.