Skip to content

7.2.0

Choose a tag to compare

@DerManoMann DerManoMann released this 04 Nov 19:45
· 36 commits to master since this release
59335df

7.2 is about describing a class more than once, which 7.1 started. Each description now gets a name of its own, and a resolver can make one when a reference asks for it. Everything below applies to spec and hybrid mode. Classic mode is unchanged.

Two changes affect the generated document. Changed output in 7.2 has the details.

Changed output

  • A component whose key has qualifiers, and no explicit name, is named after its key: Author-groups.summary rather than Author. It used to take its class's name and clash with the plain component, so the document kept only one of them. Components without qualifiers keep their names (#2345)
  • Parameters, response headers and inline schemas derived from a property take its docblock description. A component schema backed by a method no longer takes the method's description and deprecated (#2335)

New

  • Resolving a key. A resolver implementing KeyResolverInterface is asked about a class plus its qualifiers, so a Schema\Ref with qualifiers no component has can have its description made on demand. KeyResolverTrait answers resolve() with resolveKey(). Resolvers that only know class names keep working, and are asked about references without qualifiers only (#2346, docs)
  • Builder services by interface. The builder hands its component namer, attribute factory and type resolver to every augmenter, resolver and merger implementing ComponentNamerAwareInterface, AttributeFactoryAwareInterface or TypeResolverAwareInterface. One type resolver is shared by everything reading PHP types (#2353, #2354)
  • Builder::setTypeResolver(). A type resolver set on Types with setTypeResolver() is now replaced when the build runs. Set it on the builder instead (#2357)
  • Walker. Walker::visit() takes a list of classes and visits each matching attribute once, and Walker::eachTypedAttribute() visits the properties, parameters and request bodies that Types types (#2355, #2358)

Fixes

  • A docblock type that type-info can read but not build, such as T&\Countable with an unbounded T, is logged as unsupported rather than ending the build (#2352)
  • An empty media type or a security requirement naming no scheme compiles to {}, as OpenAPI requires. Also in 6.20.2 (#2348)
  • Warnings from the compiler checks come in document order rather than grouped by attribute class (#2358)

Changed

  • Spec\Header::$description defaults to Undefined::UNDEFINED, so an omitted description can be inferred and an explicit null suppresses it. Code checking the default with === null should use Undefined::isDefault() (#2335)

Deprecated, removed in 8.0

  • ResolverInterface. Implement KeyResolverInterface, which extends it; a class name is the key without qualifiers. A resolver implementing ResolverInterface alone triggers a runtime deprecation naming its class (#2347)

What's Changed

  • feat(ComponentNamer): name a described class after its key by @DerManoMann in #2345
  • feat(Resolver): ask resolvers about a key, not just a class by @DerManoMann in #2346
  • refactor(Resolver): deprecate ResolverInterface by @DerManoMann in #2347
  • fix(Compiler): an empty media type or security requirement is an object by @DerManoMann in #2348
  • chore(deps-dev): bump @redocly/cli from 2.71.0 to 2.72.1 in the npm group across 1 directory by @dependabot[bot] in #2349
  • chore(deps-dev): update phpstan/phpstan requirement from 2.3.1 to 2.3.4 by @dependabot[bot] in #2350
  • fix(Type): report a docblock type type-info cannot build, rather than crash by @DerManoMann in #2352
  • refactor(Builder): hand the namer and attribute factory out by interface by @DerManoMann in #2353
  • refactor(Type): share one TypeResolver between everything reading PHP types by @DerManoMann in #2354
  • refactor(Specification): list the attributes Types types in one place by @DerManoMann in #2355
  • docs(Resolver): regenerate the extension points reference by @DerManoMann in #2356
  • fix(Builder): let a type resolver be set on the builder by @DerManoMann in #2357
  • feat(Augmenter): enrich parameter, header and inline schema docblocks by @krissss in #2335
  • refactor(Specification): let visit() walk several attribute classes at once by @DerManoMann in #2358

Full Changelog: 7.1.0...7.2.0