dto - 如何在 api-platform 中为 Dto 模型提供自定义名称?
问题描述
当我在 api 文档的模型中使用 Dto 时,Dto 的名称记录如下,Customer: 01d691680190c1b19dfee75af0f2e292,可以将此名称自定义为 Customer: Input 或其他任何内容。
这是我的资源的配置:
App\Entity\Customer\Customer:
collectionOperations:
register:
method: POST
path: /register
controller: App\Controller\ShopApi\Customer\RegisterCustomerAction
input:
class: App\Dto\RegisterCustomerRequest
name: RegisterCustomerRequest
itemOperations:
get:
normalization_context:
jsonld_embed_context: true
groups: ['customer:read']
swagger_definition_name: CustomerResponse
但后来在 api doc 中我得到了一个模型:
Customer:01d691680190c1b19dfee75af0f2e292 {
email* string
plainPassword* string
firstName* string
lastName* string
gender* string
identificationNumber* string
typeIdentificationNumber* string
subscribedToNewsletter boolean
confirmTermsConditions boolean
addressAlias string
address* string
countryCode* string
provinceCode string
provinceName string
city* string
postcode* string
phoneNumber* string }
解决方案
推荐阅读
- java - Java:使用 javazoom 时控制台停止工作
- android - 从另一个类将文本设置为 DialogFragment
- mysql - 如何在全组中编写以下简单逻辑?
- python - Pandas:按出现次数过滤分组系列
- c++ - 使用 CPPCHECK 在 Red Hat Enterprise Linux (RHEL) 上出现 C++ 宏问题
- node.js - 在 node.js 中使用 node-fetch 将数据发送到 Pure Data (Pd) 导致 ETIMEDOUT
- python - 检查条件时打印不正确
- amazon-web-services - 安全连接到托管在 S3 存储桶上的静态网页
- java - 发生错误后禁用 Jenkins 代理:java.io.IOException: Backing channel 'JNLP4-connect connection from ip-'XXX' is disconnected
- android - Android Studio 如何知道向后兼容性问题?