api-platform / api-platform/schema-generator

Generate API Platform operations from OpenAPI

Aberta
#440 0 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
PHP
Estrelas
474
Forks
107
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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?

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.