Sign inSign up

benale/amati

By benale

•Updated 4 months ago

Validates that a .yaml or .json file conforms to the OpenAPI Specifications 3.x.

Image
API management
0

2.2K

benale/amati repository overview

⁠amati

amati is designed to validate that a file conforms to the OpenAPI Specification v3.x⁠ (OAS).

⁠Name

"amati" means to observe in Malay, especially with attention to detail. It's also one of the plurals of beloved or favourite in Italian.

⁠Usage

python amati/amati.py --help
usage: amati [-h] [-s SPEC] [--consistency-check] [-d DISCOVER] [--local] [--html-report]

Tests whether a OpenAPI specification is valid. Will look an openapi.json or openapi.yaml file in the directory that
amati is called from. If --discover is set will search the directory tree. If the specification does not follow the
naming recommendation the --spec switch should be used. Creates a file <filename>.errors.json alongside the original
specification containing a JSON representation of all the errors.

options:
  -h, --help            show this help message and exit
  -s, --spec SPEC       The specification to be parsed
  --consistency-check   Runs a consistency check between the input specification and the parsed specification
  -d, --discover DISCOVER
                        Searches the specified directory tree for openapi.yaml or openapi.json.
  --local               Store errors local to the caller in a file called <file-name>.errors.json; a .amati/ directory
                        will be created.
  --html-report         Creates an HTML report of the errors, called <file-name>.errors.html, alongside the original
                        file or in a .amati/ directory if the --local switch is used

Whilst an alpha build only the image tagged alpha will be maintained. If there are breaking API changes these will be detailed in releases going forward. Releases can be separately watched using the custom option when watching the GitHub repository⁠.

To run against a specific specification the location of the specification needs to be mounted in the container.

docker run -v "<path-to-specification>:/<mount-name> benale/amati:alpha <options>

e.g. where you have a specification located in /Users/myuser/myrepo/myspec.yaml and create a mount /data:

docker run -v /Users/myuser/myrepo:/data benale/amati:alpha --spec /data/myspec.yaml --html-report

⁠Architecture

amati uses Pydantic, especially the validation, and Typing to construct the entire OAS as a single data type. Passing a dictionary to the top-level data type runs all the validation in the Pydantic models constructing a single set of inherited classes and datatypes that validate that the API specification is accurate. To the extent that Pydantic is functional, amati has a functional core and an imperative shell⁠.

Where the specification conforms, but relies on implementation-defined behavior (e.g. data type formats⁠), a warning will be raised.

Tag summary

Content type

Image

Digest

sha256:b6b8b1b3a…

Size

72.3 MB

Last updated

4 months ago

docker pull benale/amati:alpha