Skip to content

[RFC] Use custom validation groups to build swagger doc #1835

Open
@Simperfit

Description

@Simperfit
I have a bunch of dynamic role based normalization/denormalization groups. However, the swagger always seems to generate based on the default groups (or at least static ones in the entity files). This creates problems both with the swagger docs not being accurate for what you can do and/or make using the react admin difficult.

For example, I don't allow the username to be changed after sign-up (by the user). This is a dynamic de-normalization group that only allows that field when signing up (the admin can change it anytime). It works great, but it means username doesn't appear as a field option in the swagger document anywhere even in the POST method for the collection. (it does appear as a read-only field because I made a static group for public read only).

My suggestion is you allow the user to specify normalization/denormalization groups for document generation (overriding the functional ones). That way I can specify all the groups that should be documented and it would use those instead of the functional ones. (that way I can specify dynamic groups that should be documented but are restricted by user dynamically).

Is this doable? Thoughts? Ask any questions. It seems like changing the context's used to build the swagger shouldn't be all that difficult.

--Derrek

from @dleute api-platform/api-platform#518

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions