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