Skip to content

Commit

Permalink
feat: Added more OpenApi context to generated api resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Jul 26, 2023
1 parent 535cad7 commit 29c8fa3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
7 changes: 7 additions & 0 deletions config/api_resources/nsarticle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ App\GeneratedEntity\NSArticle:
- walker_metadata
- meta
- children
openapiContext:
tags:
- WebResponse
summary: 'Get a resource by its path wrapped in a WebResponse object'
description: 'Get a resource by its path wrapped in a WebResponse'
parameters:
- { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }
7 changes: 7 additions & 0 deletions config/api_resources/nsoffer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,10 @@ App\GeneratedEntity\NSOffer:
- walker_metadata
- meta
- children
openapiContext:
tags:
- WebResponse
summary: 'Get a resource by its path wrapped in a WebResponse object'
description: 'Get a resource by its path wrapped in a WebResponse'
parameters:
- { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }
7 changes: 7 additions & 0 deletions config/api_resources/nspage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ App\GeneratedEntity\NSPage:
- walker_metadata
- meta
- children
openapiContext:
tags:
- WebResponse
summary: 'Get a resource by its path wrapped in a WebResponse object'
description: 'Get a resource by its path wrapped in a WebResponse'
parameters:
- { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }
4 changes: 2 additions & 2 deletions lib/RoadizCoreBundle/config/services.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
parameters:
roadiz_core.cms_version: '2.1.32'
roadiz_core.cms_version_prefix: 'main'
roadiz_core.cms_version: '2.2.x-dev'
roadiz_core.cms_version_prefix: 'develop'
env(APP_NAMESPACE): "roadiz"
env(APP_VERSION): "0.1.0"
env(APP_USE_ACCEPT_LANGUAGE_HEADER): 'false'
Expand Down
17 changes: 17 additions & 0 deletions lib/RoadizCoreBundle/src/NodeType/ApiResourceGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,23 @@ protected function getItemOperations(NodeTypeInterface $nodeType): array
'children',
])
],
'openapiContext' => [
'tags' => ['WebResponse'],
'summary' => 'Get a resource by its path wrapped in a WebResponse object',
'description' => 'Get a resource by its path wrapped in a WebResponse',
'parameters' => [
[
'type' => 'string',
'name' => 'path',
'in' => 'query',
'required' => true,
'description' => 'Resource path, or `/` for home page',
'schema' => [
'type' => 'string',
],
]
]
]
];
}

Expand Down

0 comments on commit 29c8fa3

Please sign in to comment.