LatestOct 29, 2026
1.0.0
First release.
Added
- Object model: the 29 objects of the OpenAPI specification (
OpenApi,Info,PathItem,Operation,Parameter,RequestBody,MediaType,Response,Schema,Components,SecurityScheme…), final and immutable, with one method per field named exactly like the specification. - Semantic shortcuts:
Schema::string(),Operation::get(),Parameter::path(),Response::ok(),MediaType::json(),SecurityScheme::http()…, and::ref()shortcuts building the component path. - Two methods per list or map field: the field name replaces,
add+ the field name appends. Map entries are keyed by theirobjectId; a missing or duplicate key throws. - Extensions on every extensible object (
x()), "not set" distinct fromnullfor free values (default,example,const), immediate exceptions for values forbidden in every version (malformed status code, exclusive fields set together). - Serialization to PHP arrays, JSON and YAML (
toArray(),toJson(),toYaml()withsymfony/yaml) for OpenAPI 3.0.0 → 3.0.4, 3.1.0 → 3.1.2 and 3.2.0; 3.1.2 by default. - Conversions between versions:
nullable, exclusive bounds,const, schemaexamples, several types,nulltype, boolean schemas,$refsiblings,contentEncoding/contentMediaType, emptypaths, responsedescription, non-OAuth scopes, reserved extension prefixes. - Strict mode (default): one
UnsupportedFeatureExceptionlists every feature the target version cannot express. Lenient mode (Serializer::for($version, Strictness::Lenient)) drops them and reports each removal and conversion as a diagnostic with its JSON Pointer. - Redoc vendor extensions, off by default (
VendorExtensions::Redoc, argument ofSerializer::for(),toJson(),toYaml(),toArray()andValidator::validate()): webhooks written asx-webhooksbefore 3.1, tag parents asx-tagGroupsbefore 3.2, reported as conversions. Anx-webhooksorx-tagGroupsset by the document wins. - Validation:
Validatorwrites the document, checks it against the official schema of its version (OpisJsonSchemaValidator, withopis/json-schema) and runs ten semantic rules: uniqueoperationId, path parameters, unique parameters, local references, security requirements, declared tags, tag parents, equivalent paths, non-empty document and value types. Rules can be removed or added (Ruleinterface). - The official schemas of OpenAPI 3.0, 3.1 and 3.2 and the JSON Schema 2020-12 meta-schemas are embedded.
- No runtime dependency besides
ext-json; PHP 8.2 to 8.5. - Agent skill
skills/openapi-writer/(rules, API reference, recipes, version matrix) for AI coding agents that use the library, with its examples run by the test suite.