api-platform / api-platform/schema-generator

Generate API Platform operations from OpenAPI

未关闭
#440 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
474
派生
107
PR 合并指标
30 天内没有已合并 PR

描述

For now, we can create operations with the `generate` command manually by customizing the `yml` config file.

My request is the following:

If the generation is done from an OpenApi file, there is a way to add operations directly in the ApiResource.

Example:

```yaml
# openapi.yaml
paths:
/books:
get:
operationId: getBookCollection
tags:
- Book
# ...
/books/{id}:
get:
operationId: getBookItem
tags:
- Book
# ...
```

Output:

```php
/**
* A book.
*
* @see https://schema.org/Book
*/
#[ORM\Entity]
#[ApiResource(
types: ['https://schema.org/Book'],
operations: [
new GetCollection(
uriTemplate: '/books',
name: 'getBookCollection',
),
new Get(
uriTemplate: '/books/{id}',
name: 'getBookItem',
),
],
)]
class Book
{
// ...
}
```

WDYT?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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