Skip to content

Commit

Permalink
feat: WebResponse as an API Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Apr 13, 2022
1 parent 727a4c8 commit fd41c30
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 73 deletions.
72 changes: 0 additions & 72 deletions config/api_resources/nodes_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,75 +20,3 @@ RZ\Roadiz\CoreBundle\Entity\NodesSources:
method: 'GET'
normalization_context:
groups: ["nodes_sources", "urls", "tag_base", "translation_base", "document_display"]
getByPath:
method: 'GET'
path: '/web_response_by_path'
read: false
controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController
normalization_context:
groups:
- web_response
- position
- walker
- walker_level
- walker_metadata
- meta
- children
- children_count
- nodes_sources
- urls
- tag_base
- translation_base
- document_display
openapi_context:
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
responses:
200:
description: WebResponse object
content:
application/json:
schema:
type: object
properties:
item:
type: object
description: A resource, for example a NodesSources
example:
title: Title
url: /my-resource
breadcrumbs:
type: object
description: Breadcrumbs object
example:
items:
- title: Title
url: /my-resource
- title: Other title
url: /my-second-resource
head:
type: object
description:
example:
shareImage: {}
homePageUrl: "/"
siteName: "Example"
blocks:
type: object
description:
example:
- children: []
item:
title: My block title
- children: []
item:
title: My other block title
29 changes: 29 additions & 0 deletions config/api_resources/web_response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
RZ\Roadiz\CoreBundle\Api\Model\WebResponse:
collectionOperations: [ ]
itemOperations:
getByPath:
method: 'GET'
path: '/web_response_by_path'
read: false
controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController
pagination_enabled: false
normalization_context:
pagination_enabled: false
groups:
- get
- web_response
- position
- walker
- walker_level
- meta
- children
- children_count
- nodes_sources
- urls
- tag_base
- translation_base
- document_display
openapi_context:
summary: Get a resource by its path wrapped in a WebResponse object
description: |
Get a resource by its path wrapped in a WebResponse
6 changes: 6 additions & 0 deletions config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ api_platform:
title: "Roadiz development app"
description: "Roadiz development app"
version: '0.1.0'
enable_swagger_ui: false
enable_re_doc: true
graphql:
graphiql:
enabled: false
show_webby: false
mapping:
paths:
- '%kernel.project_dir%/src/Entity'
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/node-types/Page.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@
],
"default_ttl": 0,
"searchable": true
}
}

0 comments on commit fd41c30

Please sign in to comment.