Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta views #480

Merged
merged 109 commits into from
Mar 7, 2025
Merged

Meta views #480

merged 109 commits into from
Mar 7, 2025

Conversation

eceltov
Copy link
Collaborator

@eceltov eceltov commented Feb 21, 2025

Added the new concept of formats. Formats are classes that streamline request parameter validation. There are two types of formats:

  • Loose formats: PHP Attribute classes that replace existing @param and @Param endpoint annotations to make the syntax more consistent, add syntax highlighting, and add more control over parameter validation with Validator classes.
  • Format classes: Standalone classes acting as containers for loose format attributes. Instead of adding a loose format attribute for each parameter, the endpoint can be attributed with a single format attribute referencing the format class.

A new command meta:convert was added that can convert @param and @Param endpoint annotations to loose format attributes.

The swagger generator was made dependent on the new format attributes and newly includes endpoint descriptions, value examples based on format type, and array type support.

The existing endpoints were converted using meta:convert. The BasePresenter was refactored to validate requests using the new format attributes. The RegistrationPresenter::actionCreateInvitation endpoint was refactored to use a format class as an example.

PATH parameters are not validated yet, but were assigned loose format attributes. Nested format classes are not yet supported.

…e done using Validators (except for nullability/required)
…rter, changed param attribute argument order
@krulis-martin krulis-martin merged commit 049de89 into master Mar 7, 2025
12 checks passed
@krulis-martin krulis-martin deleted the meta-views branch March 7, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants