api-platform / api-platform/schema-generator

Generate API Platform operations from OpenAPI

オープン
#440 コメント 0 件 リアクション 1 件 担当者 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 を短くまとめたダイジェスト。