High-performance APICORE parser and validator for APICORE v1 and v2.
A collaboration by Little Tree Studio and SRInternet Studio.
- Import name is
apicore, while the published package name isAPICORE_Python. - Uses
orjsonfor fast JSON decoding. - Uses
ruamel.yamlwithruamel.yaml.clibfor YAML decoding. - Keeps
msgspecfor fast TOML decoding. - Supports APICORE v1 and v2 with a single API.
- Defaults to v2 when
APICORE_versionis omitted, unless you manually forceversion="v1". - Preserves custom v2 parameter fields in
Parameter.extra. - Includes a CLI validator for release pipelines and local checks.
- Includes a desktop GUI validator for interactive file and folder inspection.
- Exposes typed document models plus
APICoreError,ParseError, andValidationErrorfor precise error handling.
uv add APICORE_Pythonor
pip install APICORE_Pythonfrom apicore import __version__, load, loads
print(__version__)
document = load("example.api.yaml")
print(document.apicore_version)
inline = loads("""
friendly_name: Demo
link: https://api.example.com/v2/generate
func: POST
parameters:
- name: api_key
type: string
friendly_name: API Key
value: ''
response:
image:
content_type: URL
path: data.output.url
""", format="yaml")
forced_v1 = loads("""
{
"friendly_name": "Legacy",
"link": "https://api.example.com/legacy",
"func": "POST",
"APICORE_version": "1.0",
"parameters": [],
"response": {
"image": {
"content_type": "URL",
"path": "data.image.url"
}
}
}
""", version="v1")apicore-validate path/to/config.api.yaml
apicore-validate path/to/config.api.json --version v1apicore-guiThe GUI lets you open files or folders, validate multiple APICORE documents, and inspect parsed metadata, parameters, response mappings, configs, and handlers.
from apicore import load
from apicore.errors import APICoreError, ParseError, ValidationError
try:
doc = load("example.api.yaml")
except ParseError as exc:
print(f"Syntax error: {exc}")
except ValidationError as exc:
print(f"Schema error: {exc}")
except APICoreError as exc:
print(f"APICORE error: {exc}")uv run python benchmarks/parse_benchmark.pyuv sync --all-groups
uv run pytest -q
uv build
uv run --with twine twine check dist/*Detailed release steps are in RELEASING.md.
Full documentation is available on the GitHub Wiki.
- Wiki home: docs/Home.md
- API reference: docs/API-Reference.md
- CLI and GUI: docs/CLI.md
- Data models: docs/Models.md
- Errors: docs/Errors.md
- Changelog summary: docs/Changelog.md
