Skip to content

7.0.0

Choose a tag to compare

@DerManoMann DerManoMann released this 28 Oct 19:50
· 65 commits to master since this release
a0ce3c8

Hybrid is now the default mode, and spec attributes are stable. Classic attributes and docblock annotations still work, in hybrid and in classic mode. They are deprecated and removed in 8.0.

Builder is now the entry point for generating a document. In 6.x it was available next to Generator. With Generator deprecated, code that calls it directly moves to Builder.

For most installations upgrading does not require any code changes. Migrating to v7 covers the details.

The default mode

Without a mode set, the document is built in hybrid mode. Hybrid scans the same classic attributes and docblock annotations as classic, so for most projects the document stays the same. The known differences:

  • The output is OpenAPI 3.1.0 instead of 3.0.0. Builder::setVersion('3.0.0') or --version 3.0.0 keeps 3.0.0
  • Components that no path references are removed. cleanup.enabled set to false keeps them
  • A class docblock becomes the description of each schema declared on the class
  • properties declared beside allOf on a nested property stay beside it
  • -c takes augmenter keys rather than processor keys, apart from generator.*

Custom processors only see the annotation instances as scanned in hybrid mode. A project that depends on them can stay on classic with Builder::setMode(Mode::CLASSIC) or --mode classic while the processors are rewritten as augmenters.

Requirements

  • nikic/php-parser ^5.0
  • Symfony components ^5.4 || ^6.4 || ^7.0 || ^8.0

Removed

The elements deprecated for 7.0:

  • LegacyTypeResolver
  • The aliases left at the old names of TokenScanner, Pipeline, SourceFinder and TypeMapper
  • TypeResolverInterface::NATIVE_TYPE_MAP

Deprecated, removed in 8.0

  • Classic attributes and docblock annotations. The Rector set rewrites classic attributes to spec attributes
  • Processors, Generator, Analysis and the analysers. Augmenters and Builder replace them
  • Builder::setMode(), Mode and the CLI's --mode
  • Raw security arrays on spec attributes. SecurityToRequirementRector rewrites them

In 8.0 spec attributes move from OpenApi\Spec to OpenApi\Attributes. For code already written against OpenApi\Spec, that is one use line per file.

What's Changed

  • feat(Builder): v7 - hybrid by default, classic deprecated by @DerManoMann in #2321
  • docs(Guide): rewrite the attributes page for spec attributes by @DerManoMann in #2322
  • docs(Guide): one terminology for attributes, annotations and annotating by @DerManoMann in #2323

Full Changelog: 6.20.0...7.0.0