Skip to content
小树 edited this page May 2, 2026 · 4 revisions

APICORE Python

High-performance APICORE parser and validator for APICORE v1 and v2.

Version 2.0.0 is a full rewrite of the old 1.0.0 package line, while keeping full APICORE v1 support and adding native APICORE v2 support.

Quick Links

Installation

uv add APICORE_Python

or

pip install APICORE_Python

Quick Start

from 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")

validated = load("legacy.api.json", version="v1")
print(validated.friendly_name)

Tools

  • apicore-validate validates one file from the command line.
  • apicore-gui opens the desktop validator for batch inspection.
  • load(), loads(), and validate() all return typed V1Document or V2Document instances.

Validation Notes

  • If APICORE_version is omitted, parsing defaults to v2.
  • Forcing version="v1" or version="v2" conflicts with a declared document version and raises ValidationError.
  • Disabled parameters may use an empty friendly_name, but enabled parameters must still provide a non-empty label.
  • response.image.path may be empty for BINARY, but URL responses still require a non-empty path.

About

A collaboration by Little Tree Studio and SRInternet Studio.

Clone this wiki locally