Skip to content

Releases

7.11.0

Choose a tag to compare

@DerManoMann DerManoMann released this 25 Nov 23:44
e5c7acb

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 ArrayAccess or Traversable such 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 $ref to another document, such as a URL or a file, is written as given without an error (#2452)
  • Spec and hybrid: a keyword beside $ref that repeats the referenced component, such as type: '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\ComponentKeys is a new default augmenter (#2448)
  • RefInterface::getRefKey() returns null for 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

Choose a tag to compare

@DerManoMann DerManoMann released this 24 Nov 20:33
244fb23

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's callbacks, or filed into components.callbacks with component: and referenced with ref: (#2425)
  • PathFilter takes excludeTags and excludePaths, applied after the include lists (#2436)

Changed output

  • Hybrid: callbacks: on a classic Components is written to components.callbacks. Before, it was left out without a message. A document passed to Builder::withDocument() keeps its components.callbacks too (#2425)
  • Spec and hybrid: a 3.2 document leaves out a tag's parent that names no tag of the document on every compile, not only after validate() (#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, then and else are 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 Components list holding anything other than spec attributes throws, naming the list (#2425)
  • OpenApi32Compiler::validate() no longer changes the tags it checks, and Augmenter\MediaTypes no longer keys encoding lists (#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

Choose a tag to compare

@DerManoMann DerManoMann released this 23 Nov 03:10
d79af11

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 required flag 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 explicit required list on the schema (#2421)

Changed output

  • A union of integer ranges such as int<1, 5>|int<10, 20> becomes an anyOf with one schema per range. Before, any union of two ranges was described as non-zero-int, which accepts every integer but 0 (#2420)
  • A docblock string pseudo-type that rules out the empty string, such as non-empty-string or non-falsy-string, sets minLength: 1 (#2422)
  • Spec and hybrid: items or additionalProperties given on an attribute without a type take the type from the docblock, as classic does. Before, @var list<positive-int> with items: new OA\Schema() came out as items: {} (#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, ServerVariableEnum and Schema\AdditionalProperties are no longer final, and the private members in src are protected. Protected signatures may change (#2429)
  • A tidy-up across src, with no change in output (#2426 - #2432)

What's Changed

Full Changelog: 7.8.0...7.9.0

7.8.0

Choose a tag to compare

@DerManoMann DerManoMann released this 18 Nov 02:33
503f9d1

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 - self on the document, a server name, a response summary, an example's dataValue and serializedValue, a discriminator's defaultMapping, and deprecated and oauth2MetadataUrl on a security scheme (#2149)
  • Spec: the device authorization flow, and the cookie parameter style (#2408)
  • Spec: itemSchema on a media type, and encodings by position with prefixEncoding and itemEncoding (#2412)
  • Spec: the querystring parameter location, with OA\Parameter\Querystring (#2414)
  • Spec: OA\Operation\Query for the query method (#2416)
  • Spec: any HTTP method on an operation, written to additionalOperations (#2417)
  • Spec: the XML nodeType, written as attribute or wrapped before 3.2 where they say the same (#2418). A schema can take the node type alone, as xml: 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 COPY to additionalOperations. Before, it was left out with a warning (#2417)
  • Spec and hybrid: 3.0 and 3.1 leave out style: cookie with 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

Full Changelog: 7.7.0...7.8.0

7.7.0

Choose a tag to compare

@DerManoMann DerManoMann released this 17 Nov 00:47
cbbeeab

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, parent and kind, and at 3.0 an info summary and eight 2020-12 schema keywords. Before, they were left out without a message. The license identifier and media type component warnings now read like the others (#2396, #2404)
  • Spec and hybrid: x on #[OA\Components] is written on components, and x on 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, and filter() drops it. The 3.0 compiler's own compileInfo() and compileLicense() and the 3.2 compiler's own compileTag() are gone (#2403, docs)
  • TypeResolver reads a member's types and maps them in two steps, so a subclass can change the types in between through toSchemaType() (#2398)

Deprecated

  • x on Security\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

Choose a tag to compare

@DerManoMann DerManoMann released this 12 Nov 02:56
9e782a7

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 use now 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\Parser reads an OpenAPI 3.1 document into a Specification, and Builder::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, Link and Security\Scheme take a summary, written beside a $ref from 3.1 on (#2389)

Changed

  • AttributeFactory takes any SourceInspectorInterface. The default SourceInspector tells a class's own members by reflection, so a spec build parses no PHP. A subclass reading $tokenScanner gets the interface (#2373, #2374, docs)
  • A subclass declaring its own $summary on one of those six attributes needs it as public ?string $summary (#2389)

Deprecated

  • TokenScanner, removed in 8.0. Use SourceInspector (#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.json no longer conflicts with symfony/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 TokenScanner by @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 Specification by @DerManoMann in #2387
  • docs(Guide): changed output in 7.6 by @DerManoMann in #2397

New Contributors

Full Changelog: 7.5.0...7.6.0

6.20.4

Choose a tag to compare

@DerManoMann DerManoMann released this 11 Nov 21:56
52063c0

Output

  • A trait or interface imported through a grouped use, for example something like use Vendor\Model\{HasFields, Contract};, resolves now. Before, the trait's properties were missing from the schema, with an Unexpected @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

Choose a tag to compare

@DerManoMann DerManoMann released this 08 Nov 22:16
a97bfe5

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 a warning, where the document is invalid or something declared is lost. Such a build makes Result::isValid() false, and the CLI exits with 1. Classic type aliases and the array form of a security requirement log a notice (#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 component now reads Reference "#/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::All where classic copied an attribute into several others, such as one response beside both a Get and a Post. 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

Choose a tag to compare

@DerManoMann DerManoMann released this 08 Nov 05:36
515ef71

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 @example is cast by the property's type, so @example 1 on an int writes 1 rather than '1'. #[OA\Examples(value:)] keeps false and 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 by getPropertyTypes(). A subclass overriding it overrides getPropertyTypes() instead (#2361, docs)

Performance

  • One TypeContextFactory per TypeResolver, and TokenScanner::detailsFor() answered from the cache for a scanned file. Thanks @leo-pansonato (#2364, #2365)

What's Changed

New Contributors

Full Changelog: 7.3.0...7.4.0

6.20.3

Choose a tag to compare

@DerManoMann DerManoMann released this 08 Nov 19:42

What's Changed

Full Changelog: 6.20.2...6.20.3