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 validate --help
usage: amati validate [-h] -s SPEC [--consistency-check] [--local] [--html-report]
options:
-h, --help show this help message and exit
-s, --spec SPEC The specification to be validated
--consistency-check Runs a consistency check between the input specification and the parsed specification
--local Store errors local to the caller in .amati/<file-name>.errors.json
--html-report Creates an HTML report of the errors, called <file-name>.errors.html, alongside <filename>.errors.json
Docker
A Dockerfile is available on DockerHub or docker pull benale/amati:alpha.
Whilst an alpha build, only the image tagged alpha will be maintained. If there are breaking API changes these will be detailed in releases. Releases can be separately watched using the custom option when watching this 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 validate --spec <path-to-spec> <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 validate --spec /data/myspec.yaml --html-report
PyPI
amati is available on PyPI, to run everything:
>>> from amati import amati
>>> amati.run('tests/data/openapi.yaml', consistency_check=True, local=True, html_report=True)
True
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.
Contributing
Prerequisites
Starting
The project uses a pyproject.toml file to determine what to build.
To get started run:
sh bin/startup.sh
Testing and formatting
This project uses:
- Pytest as a testing framework
- Pyright on strict mode for type checking
- Ruff as a linter and formatter
- Hypothesis for test data generation
- Coverage on both the tests and code for test coverage
- Shellcheck for as SAST for shell scripts
- deptry to check for missing or unused dependencies
It's expected that there are no errors and 100% of the code is reached and executed. The strategy for test coverage is based on parsing test specifications and not unit tests.
amati runs tests on the external specifications, detailed in tests/data/.amati.tests.yaml. To be able to run these tests the GitHub repos containing the specifications need to be available locally. Specific revisions of the repos can be downloaded by running the following, which will clone the repos into .amati/amati-tests-specs/<repo-name>.
python scripts/setup_test_specs.py
If there are some issues with the specification a JSON file detailing those should be placed into tests/data/ and the name of that file noted in tests/data/.amati.tests.yaml for the test suite to pick it up and check that the errors are expected. Any specifications that close the coverage gap are gratefully received.
To run everything, from linting, type checking to downloading test specs and building and testing the Docker image run:
sh bin/checks.sh
Docker
A Dockerfile is provided, to build:
docker build -t amati -f Dockerfile .
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> amati validate -s <path-to-spec> <options>
This can be tested against a provided specification, from the root directory
docker run --detach -v "$(pwd):/data" amati validate -s <path-to-spec> <options>
Data
There are some scripts to create the data needed by the project, for example, all the registered TLDs. To refresh the data, run:
python amati/amati.py refresh
Metadata
Release files for amati 0.3.51
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| amati-0.3.51.tar.gz | 167.8 kB | Without provenance | Details for amati-0.3.51.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| amati-0.3.51-py3-none-any.whl | Python 3 | none | any | Details for amati-0.3.51-py3-none-any.whl |
Total release size: 286.0 kB
Release files / amati-0.3.51.tar.gz
| Download URL | amati-0.3.51.tar.gz |
|---|---|
| Size | 167.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c094855547d9e850038feb65b7320a0b79ac7ace5c9a57f76dbd2fb3202c42e8
|
|
BLAKE2b-256 checksum How to use checksums |
befd4695b1aa7428030af10f2b32e36e0e86cda0b11c51a9635e30bf74642220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / amati-0.3.51-py3-none-any.whl
| Download URL | amati-0.3.51-py3-none-any.whl |
|---|---|
| Size | 118.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5e05fef7855723b6f8fbc72f5f56c383e8e9e02b64db671edc6bea0b416d567
|
|
BLAKE2b-256 checksum How to use checksums |
2ca87bbcca8c16306e50fdbd09d7f84e3bac55946c631143a3fed8689ee03795
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for amati 0.3.51
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.