Skip to content

Releases: sunrise-php/http-router

v3.3.0 | Make OpenAPI generation reusable and support @var array item types for views

15 Jun 09:25
e941ed9

Choose a tag to compare

What changed

This PR significantly reworks the OpenAPI part of sunrise/http-router.

The main goal of these changes is to make the OpenAPI API more reusable and less tightly coupled to HTTP Router itself. The OpenAPI generator is still shipped together with the router, but its internal architecture is now less dependent on a specific routing implementation and can be used as a standalone foundation for integrations with other frameworks.

One practical result of this refactoring is a separate Symfony bundle:

https://github.com/sunrise-studio-development/symfony-openapi

It uses the OpenAPI API from sunrise/http-router, while adding full support for Symfony routes and Symfony attributes. This is a good example of how the OpenAPI layer can now be extended and reused outside the main HTTP Router.

@var support for output/view objects

For users who use sunrise/http-router as their router, this PR also adds support for PHPDoc @var annotations when generating OpenAPI schemas for output/view objects.

Previously, describing array item types in OpenAPI required using the Subtype attribute from sunrise/hydrator. This was not always convenient, especially for response objects where Subtype was needed not for data hydration, but only to produce a correct OpenAPI schema.

Now array item types in view/output objects can be described with PHPDoc:

/**
 * @var UserView[]
 */
public array $users;

or with similar PHPDoc types supported by the parser.

Subtype is still relevant for input DTOs, where it is required for correct hydrator behavior. But response objects no longer need to use Subtype only for OpenAPI generation.

Why this matters

These changes make the OpenAPI part of the package more flexible:

  • the OpenAPI API is now easier to use outside sunrise/http-router;
  • integrations with other frameworks are easier to build;
  • output/view objects no longer need an extra dependency on hydrator attributes just for documentation;
  • users can describe array item types in the familiar PHPDoc way with @var.

Overall, the existing HTTP Router behavior remains compatible for current users, while the OpenAPI layer becomes more standalone and extensible.

v3.2.1

13 Apr 20:55
37e0952

Choose a tag to compare

Insignificant changes.

v3.2.0

27 Nov 23:55
78050a4

Choose a tag to compare

Merge pull request #126 from sunrise-php/release/v3.2.0

v3.2

v3.2.0-rc.2

25 Jul 01:09

Choose a tag to compare

v3.2.0-rc.2 Pre-release
Pre-release

v3.2.0-rc.1

06 Jul 01:58

Choose a tag to compare

v3.2.0-rc.1 Pre-release
Pre-release
  • Added SchemaName attribute for custom OpenAPI schema naming;
  • Replacement of oneOf[items, additionalProperties] with items for array and collection documentation.

v3.1.0

21 Apr 00:44
4f32d4b

Choose a tag to compare

  • Improved payload decoding;
  • Improved string trimming;
  • Improved OpenAPI document generation;
  • Improved localization capabilities.

v3.0.2

19 Apr 03:13
c45662e

Choose a tag to compare

  • Minor fixes.

v3.0.1

25 Mar 23:46
81f44bd

Choose a tag to compare

  • Translations improved.

v3.0.0

11 Mar 03:39

Choose a tag to compare

  • 🚀 v3.

v3.0.0-rc.1

25 Feb 05:45

Choose a tag to compare

v3.0.0-rc.1 Pre-release
Pre-release
v3