api-platform / api-platform/core

[RFC] Use custom validation groups to build swagger doc

未关闭
#1,835 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
RFC
主要语言
PHP
星标
2.6k
派生
980
平均合并
2 天 5 小时
30 天内合并 PR
48

描述

```
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 https://github.com/api-platform/api-platform/issues/518

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。