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 摘要。