Repository navigation
Releases
7.11.0
7.11 fixes what two Laravel applications ran into on 7.10: references a class's schemas could not resolve, external $refs reported as errors, Laravel resources written as arrays, and messages ending in in unknown.
Some of this changes the generated document or a message. Changed output in 7.11 has the details.
Changed output
- Classic, spec and hybrid: a docblock type naming a collection class, one implementing
ArrayAccessorTraversablesuch as a Laravel resource, references the class's schema where it has one. Before, it was an array of anything, and a list of such a class an array of arrays (#2453) - Spec and hybrid: a class declaring several schemas, exactly one of them without a name, is referenced as that one. Before, the reference was reported as ambiguous (#2448)
- Spec and hybrid: a
$refto another document, such as a URL or a file, is written as given without an error (#2452) - Spec and hybrid: a keyword beside
$refthat repeats the referenced component, such astype: 'object', is dropped without a warning (#2451) - Spec and hybrid: an unresolved, ambiguous or dangling reference is reported once per place it is written, with that place's location (#2450)
- Spec and hybrid: more messages about nested attributes, the classic type-alias notice among them, name the nearest attribute with a location instead of
in unknown(#2449, #2454) - Spec and hybrid: the message for an unmatched union member says the whole union is omitted (#2447)
Changed
Augmenter\ComponentKeysis a new default augmenter (#2448)RefInterface::getRefKey()returnsnullfor a ref to another document (#2452)- Changed in 7.11 lists the protected methods that changed, for subclasses
What's Changed
- fix(Augmenter): report an unmatched union member as omitting the whole union by @DerManoMann in #2447
- fix(Augmenter): reference the unnamed schema of a class that also declares named ones by @DerManoMann in #2448
- fix(Compiler): report nested attributes without a location at their nearest located holder by @DerManoMann in #2449
- fix(Compiler): drop a sibling beside $ref that repeats the referenced schema without a warning by @DerManoMann in #2451
- fix(Refs): leave a $ref to another document alone by @DerManoMann in #2452
- fix(Refs): report an unresolved reference where it is written by @DerManoMann in #2450
- chore(Config): raise the test suites' memory limit to 512M by @DerManoMann in #2455
- fix(TypeAliases): report a nested alias at its nearest located holder by @DerManoMann in #2454
- fix(Types): reference a collection class's schema where it has one by @DerManoMann in #2453
- docs(Guide): changed output in 7.11 by @DerManoMann in #2456
Full Changelog: 7.10.0...7.11.0
7.10.0
7.10 adds reusable callbacks in components and exclude lists to PathFilter, and reports several things that used to go missing without a word.
Some of this changes the generated document or a message. Changed output in 7.10 has the details.
Added
- Spec:
#[OA\Callback], a runtime expression and the operations sent to it. Nested in an operation'scallbacks, or filed intocomponents.callbackswithcomponent:and referenced withref:(#2425) PathFiltertakesexcludeTagsandexcludePaths, applied after the include lists (#2436)
Changed output
- Hybrid:
callbacks:on a classicComponentsis written tocomponents.callbacks. Before, it was left out without a message. A document passed toBuilder::withDocument()keeps itscomponents.callbackstoo (#2425) - Spec and hybrid: a 3.2 document leaves out a tag's
parentthat names no tag of the document on every compile, not only aftervalidate()(#2437) - Spec and hybrid: an encoding without a name is an error wherever its media type sits. Before, some were left out without a message (#2441)
- Spec and hybrid: in 3.0,
prefixItems,unevaluatedItems,unevaluatedProperties,if,thenandelseare warnings, one per keyword. Before, they were errors (#2440) - Spec and hybrid: messages about a nested schema, encoding, header, link or example name the location of the attribute holding it, instead of
in unknown(#2440, #2441)
Changed
- A spec
Componentslist holding anything other than spec attributes throws, naming the list (#2425) OpenApi32Compiler::validate()no longer changes the tags it checks, andAugmenter\MediaTypesno longer keysencodinglists (#2437, #2441)- A plugins page in the guide (#2434)
What's Changed
- ci(Workflows): skip the test workflows on text-only changes by @DerManoMann in #2435
- docs(Guide): add a plugins page by @DerManoMann in #2434
- docs(Roadmap): link the new roadmap issue by @DerManoMann in #2439
- feat(Augmenter): add exclude lists to PathFilter by @DerManoMann in #2436
- fix(Compiler): leave out an unknown tag parent in 3.2 without validating first by @DerManoMann in #2437
- chore(deps-dev): update rector/rector requirement from 2.8.4 to 2.8.5 by @dependabot[bot] in #2445
- chore(deps-dev): update phpstan/phpstan requirement from 2.3.5 to 2.3.7 by @dependabot[bot] in #2444
- chore(deps-dev): update friendsofphp/php-cs-fixer requirement from 3.95.30 to 3.95.32 by @dependabot[bot] in #2443
- chore(deps-dev): bump @redocly/cli from 2.78.0 to 2.82.0 in the npm group across 1 directory by @dependabot[bot] in #2442
- fix(Augmenter): report an encoding without a name instead of dropping it silently by @DerManoMann in #2441
- fix(Compiler): report schema keywords and locations alike in 3.0 and 3.1 by @DerManoMann in #2440
- feat(Spec): reusable callbacks in components by @DerManoMann in #2425
- docs(Guide): changed output in 7.10 by @DerManoMann in #2446
Full Changelog: 7.9.0...7.10.0
7.9.0
7.9 lets a property declare itself required, and gets more out of docblock types: unions of integer ranges, non-empty strings, and the items of an attribute that gives no type.
Some of this changes the generated document or a warning. Changed output in 7.9 has the details.
Added
- Spec: a
requiredflag on#[OA\Property]and#[OA\Property\Encoded], used over the answer inferred from the PHP type. A nullable or defaulted property that is always sent can be marked required without an explicitrequiredlist on the schema (#2421)
Changed output
- A union of integer ranges such as
int<1, 5>|int<10, 20>becomes ananyOfwith one schema per range. Before, any union of two ranges was described asnon-zero-int, which accepts every integer but 0 (#2420) - A docblock string pseudo-type that rules out the empty string, such as
non-empty-stringornon-falsy-string, setsminLength: 1(#2422) - Spec and hybrid:
itemsoradditionalPropertiesgiven on an attribute without a type take the type from the docblock, as classic does. Before,@var list<positive-int>withitems: new OA\Schema()came out asitems: {}(#2423) - Spec and hybrid: a 3.0 warning about a schema nested in a property's or parameter's schema, such as its
items, names that property or parameter. Before, it had no location (#2424)
Changed
Undefined,ComponentKey,JsonPointer,SourceLocation,SecurityRequirement,ServerVariableEnumandSchema\AdditionalPropertiesare no longerfinal, and theprivatemembers insrcareprotected. Protected signatures may change (#2429)- A tidy-up across
src, with no change in output (#2426 - #2432)
What's Changed
- fix(Type): describe a union of integer ranges by its ranges, not as
non-zero-intby @DerManoMann in #2420 - feat(Spec): let a property declare itself required by @DerManoMann in #2421
- feat(Type): describe non-empty string pseudo-types with minLength by @DerManoMann in #2422
- fix(Compiler): name the member that holds a nested schema in its warnings by @DerManoMann in #2424
- fix(Augmenter): fill an attribute's typeless items from the docblock by @DerManoMann in #2423
- refactor(Type): tidy the type resolvers by @DerManoMann in #2426
- refactor(Augmenter): tidy the schema augmenters by @DerManoMann in #2427
- refactor(Augmenter): tidy the operation and component augmenters by @DerManoMann in #2428
- refactor(Conventions): open final classes and private members by @DerManoMann in #2429
- refactor(Pipeline): tidy the builder, assembler, resolver and specification by @DerManoMann in #2430
- refactor(Utils): tidy the utilities by @DerManoMann in #2431
- refactor(Compiler): tidy the compilers and the parser by @DerManoMann in #2432
- docs(Guide): changed output in 7.9 by @DerManoMann in #2433
Full Changelog: 7.8.0...7.9.0
7.8.0
7.8 brings all the OpenAPI 3.2 support to the spec attributes. A 3.2 document can use every field and value the version adds. 3.0 and 3.1 write a field in its older form where there is one, and leave it out with a warning where there is not.
Some of this changes the generated document. Changed output in 7.8 has the details.
Added
- Spec: the plain 3.2 fields -
selfon the document, a servername, a responsesummary, an example'sdataValueandserializedValue, a discriminator'sdefaultMapping, anddeprecatedandoauth2MetadataUrlon a security scheme (#2149) - Spec: the device authorization flow, and the
cookieparameter style (#2408) - Spec:
itemSchemaon a media type, and encodings by position withprefixEncodinganditemEncoding(#2412) - Spec: the
querystringparameter location, withOA\Parameter\Querystring(#2414) - Spec:
OA\Operation\Queryfor thequerymethod (#2416) - Spec: any HTTP method on an operation, written to
additionalOperations(#2417) - Spec: the XML
nodeType, written asattributeorwrappedbefore 3.2 where they say the same (#2418). A schema can take the node type alone, asxml: OA\XmlNodeType::Cdata(#2419)
Changed output
- Spec: a 3.2 document writes an inline response's
summary. Before, it was left out with a warning (#2149) - Spec: a 3.2 document writes an operation with a method such as
COPYtoadditionalOperations. Before, it was left out with a warning (#2417) - Spec and hybrid: 3.0 and 3.1 leave out
style: cookiewith a warning. Before, it was written, and the document was invalid (#2408)
What's Changed
- chore(deps-dev): update friendsofphp/php-cs-fixer requirement from 3.95.29 to 3.95.30 by @dependabot[bot] in #2411
- chore(deps-dev): bump @redocly/cli from 2.76.0 to 2.78.0 in the npm group across 1 directory by @dependabot[bot] in #2409
- chore(Tests): type the expected match in testMatchNested by @DerManoMann in #2413
- chore(deps-dev): update rector/rector requirement from 2.8.3 to 2.8.4 by @dependabot[bot] in #2410
- feat(Spec): add plain OpenAPI 3.2 fields by @DerManoMann in #2149
- feat(Spec): add the OpenAPI 3.2 device authorization flow and cookie style by @DerManoMann in #2408
- feat(Spec): add the OpenAPI 3.2 media type items and positional encodings by @DerManoMann in #2412
- docs(Contributing): fix the PSR-5 draft link by @farisbasha in #2415
- feat(Spec): add the OpenAPI 3.2 querystring parameter location by @DerManoMann in #2414
- feat(Spec): add the OpenAPI 3.2 query operation by @DerManoMann in #2416
- feat(Spec): write OpenAPI 3.2 additionalOperations by @DerManoMann in #2417
- feat(Spec): add the OpenAPI 3.2 XML node type by @DerManoMann in #2418
- feat(Spec): take an XML node type as a schema's xml by @DerManoMann in #2419
New Contributors
- @farisbasha made their first contribution in #2415
Full Changelog: 7.7.0...7.8.0
7.7.0
7.7 reports every property an OpenAPI version leaves out, where most were dropped without a word before, and writes the extensions on components and properties that were lost.
Both change the log or the generated document. Changed output in 7.7 has the details.
Changed output
- Spec and hybrid: 3.0 and 3.1 warn about the properties they leave out, such as a tag's
summary,parentandkind, and at 3.0 an infosummaryand eight 2020-12 schema keywords. Before, they were left out without a message. The licenseidentifierand media type component warnings now read like the others (#2396, #2404) - Spec and hybrid:
xon#[OA\Components]is written oncomponents, andxon a property on its schema. Before, both were left out without a warning (#2405)
Changed
- A compiler subclass lists what a version leaves out in
UNSUPPORTED_PROPERTIES, andfilter()drops it. The 3.0 compiler's owncompileInfo()andcompileLicense()and the 3.2 compiler's owncompileTag()are gone (#2403, docs) TypeResolverreads a member's types and maps them in two steps, so a subclass can change the types in between throughtoSchemaType()(#2398)
Deprecated
xonSecurity\Requirement, removed in 8.0. A Security Requirement Object cannot carry extensions, so it is left out with a warning (#2405)
What's Changed
- refactor(Type): split reading a member's types from mapping them by @DerManoMann in #2398
- feat(Compiler): warn about properties a version leaves out by @DerManoMann in #2396
- refactor(Compiler): leave out the listed properties in
filter()by @DerManoMann in #2403 - refactor(Compiler): leave out media type components through the lists by @DerManoMann in #2404
- fix(Compiler): write the extensions of components and properties by @DerManoMann in #2405
- test(Compiler): check that every property is written or reported by @DerManoMann in #2406
- docs(Guide): changed output in 7.7 by @DerManoMann in #2407
Full Changelog: 7.6.0...7.7.0
7.6.0
7.6 adds a parser for OpenAPI 3.1 documents. With it, Builder::withDocument() adds a hand-written document to what the attributes describe, for example webhooks with no PHP code behind them. Plugins can now also be found through the packages installed, and a spec build no longer parses PHP files.
Two changes affect the generated document or the log. Changed output in 7.6 has the details.
Changed output
- Classic and hybrid: a trait imported through a grouped
usenow adds its properties. Before, they were missing, with a warning. Thanks @vencakrecl (#2392) - Spec and hybrid: validation messages from different checks come out mixed, since the checks now run in one pass (#2367)
New
OpenApi\Parserreads an OpenAPI 3.1 document into aSpecification, andBuilder::withDocument()adds one to a spec or hybrid build. Where both describe the same thing, the attributes win. Only 3.1 documents are supported (#2387, docs, cookbook)Builder::withDiscoveredPlugins()adds the plugins installed packages declare in their Composer metadata. It is opt-in (#2385, docs)Parameter,RequestBody,Response,Header,LinkandSecurity\Schemetake asummary, written beside a$reffrom 3.1 on (#2389)
Changed
AttributeFactorytakes anySourceInspectorInterface. The defaultSourceInspectortells a class's own members by reflection, so a spec build parses no PHP. A subclass reading$tokenScannergets the interface (#2373, #2374, docs)- A subclass declaring its own
$summaryon one of those six attributes needs it aspublic ?string $summary(#2389)
Deprecated
TokenScanner, removed in 8.0. UseSourceInspector(#2388)
Fixed
- A docblock the type resolver fails on is reported as unsupported, and the build carries on. Before, some ended the build (#2393)
composer.jsonno longer conflicts withsymfony/process, which swagger-php does not depend on (#2395)
Performance
- The validation checks share one walk:
validate()at 500 schemas went from 97 to 39 ms (#2367)
What's Changed
- refactor(Utils): ask a source inspector which members and traits are a class's own by @DerManoMann in #2373
- perf(Utils): tell a class's own members by reflection, without parsing by @DerManoMann in #2374
- chore(Config): keep the tool caches in .cache/ by @DerManoMann in #2378
- chore(deps-dev): update friendsofphp/php-cs-fixer requirement from 3.95.27 to 3.95.29 by @dependabot[bot] in #2381
- chore(deps-dev): update phpstan/phpstan requirement from 2.3.4 to 2.3.5 by @dependabot[bot] in #2382
- chore(deps-dev): bump @redocly/cli from 2.72.1 to 2.76.0 in the npm group across 1 directory by @dependabot[bot] in #2380
- refactor(Compiler): share one walk between the validation checks by @DerManoMann in #2367
- chore(Config): run the test suites with a 256M memory limit by @DerManoMann in #2390
- chore(Utils): drop the @internal tag on SourceInspector::tokens() by @DerManoMann in #2379
- feat(Spec): add a summary beside a $ref on every referenceable attribute by @DerManoMann in #2389
- fix(TokenScanner): resolve grouped class imports by @vencakrecl in #2392
- fix(Type): report any docblock the type resolver fails on by @DerManoMann in #2393
- chore(Utils): deprecate
TokenScannerby @DerManoMann in #2388 - chore(Augmenter): drop the docblocks on the aware setters by @DerManoMann in #2384
- feat(Builder): discover the plugins installed packages declare by @DerManoMann in #2385
- fix(Composer): drop the symfony/process conflict by @DerManoMann in #2395
- feat(Parser): read an OpenAPI 3.1 document into a
Specificationby @DerManoMann in #2387 - docs(Guide): changed output in 7.6 by @DerManoMann in #2397
New Contributors
- @vencakrecl made their first contribution in #2392
Full Changelog: 7.5.0...7.6.0
6.20.4
Output
- A trait or interface imported through a grouped
use, for example something likeuse Vendor\Model\{HasFields, Contract};, resolves now. Before, the trait's properties were missing from the schema, with anUnexpected @OA\Property()warning (#2392 by @vencakrecl, reported in #2391)
Backported from master in #2394.
Full Changelog: 6.20.3...6.20.4
7.5.0
7.5 is about the messages spec and hybrid log. A problem that makes the document invalid, or loses something declared, is now an error, and every message follows one form. The Rector set also keeps the operations it used to lose where classic copied an attribute into several others.
Both message changes affect builds and tests that read the log. Changed output in 7.5 has the details.
Changed output
- Spec and hybrid log an
error, rather than awarning, where the document is invalid or something declared is lost. Such a build makesResult::isValid()false, and the CLI exits with 1. Classic type aliases and the array form of a security requirement log anotice(#2375) - Spec and hybrid messages are reworded to start with what they are about and end with where it was declared. For example,
Ref: dangling reference '#/components/schemas/Pet' - no such componentnow readsReference "#/components/schemas/Pet" points to no component. A test matching log lines in full needs updating. Classic's messages are unchanged (#2377)
New
- The Rector set adds
fan: Fan::Allwhere classic copied an attribute into several others, such as one response beside both aGetand aPost. Spec used to skip such a method as an ambiguous merge.->withSkip([FanOutRector::class])turns it off (#2372, docs) - Writing messages, the form and levels of spec pipeline messages, for contributors (#2375)
What's Changed
- fix(Rector): add fan: Fan::All where classic copied an attribute into several by @DerManoMann in #2372
- fix(Spec): log an error where the document is invalid or input is lost by @DerManoMann in #2375
- fix(Spec): word messages subject first and location last by @DerManoMann in #2377
Full Changelog: 7.4.0...7.5.0
7.4.0
7.4 is a fixes and performance release. Scanning no longer reads a class's source again for every property, which matters most on slow filesystems such as Docker Desktop bind mounts.
Two changes affect the generated document. Changed output in 7.4 has the details.
Changed output
- A public property with neither a property nor a schema attribute no longer puts its class in
components. Where nothing else adds the class, a type that used it is left out, with a warning (#2361) - Classic: a docblock
@exampleis cast by the property's type, so@example 1on anintwrites1rather than'1'.#[OA\Examples(value:)]keepsfalseand floats as given (#2368)
New
- Warnings for schema keywords dropped beside a
$ref, under 3.0 and 3.1 (#2362) - 3.0 schema warnings name where the schema was declared (#2370)
Builder::createSpecification(), so a subclass can supply its own specification (#2366)
Changed
Resolver::getTypedReflectors()is replaced bygetPropertyTypes(). A subclass overriding it overridesgetPropertyTypes()instead (#2361, docs)
Performance
- One
TypeContextFactoryperTypeResolver, andTokenScanner::detailsFor()answered from the cache for a scanned file. Thanks @leo-pansonato (#2364, #2365)
What's Changed
- fix(Compiler): warn about schema keywords dropped beside a $ref by @DerManoMann in #2362
- fix(Resolver): chase only the types of documented properties by @DerManoMann in #2361
- fix(Classic): keep example values typed by @DerManoMann in #2368
- refactor(Type): keep one TypeContextFactory per TypeResolver by @leo-pansonato in #2364
- perf(Utils): answer TokenScanner::detailsFor() for a scanned file from the cache by @leo-pansonato in #2365
- test(Benchmarks): add a performance harness by @DerManoMann in #2366
- chore(Config): ignore phpbench's result store by @DerManoMann in #2369
- fix(Compiler): name the declaration in 3.0 schema warnings by @DerManoMann in #2370
- docs(Guide): add typed classic examples to Changed output in 7.4 by @DerManoMann in #2371
New Contributors
- @leo-pansonato made their first contribution in #2364
Full Changelog: 7.3.0...7.4.0
6.20.3
What's Changed
- fix(Backport): three fixes from master for 6.20.3 by @DerManoMann in #2376
Full Changelog: 6.20.2...6.20.3