packagist zircote/swagger-php 7.9.0

50 minutes ago

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

Don't miss a new swagger-php release

NewReleases is sending notifications on new releases.