Skip to content

Commit

Permalink
Remove hateoas dependencies, api platform implementations and restruc…
Browse files Browse the repository at this point in the history
…ture
  • Loading branch information
mattamon committed Apr 8, 2024
1 parent 717f32c commit 11191b8
Show file tree
Hide file tree
Showing 62 changed files with 290 additions and 934 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"pimcore/static-resolver-bundle": "^1.3",
"pimcore/generic-data-index-bundle": "1.x-dev",
"pimcore/pimcore": "^11.0",
"nelmio/api-doc-bundle": "^4.2",
"willdurand/hateoas-bundle": "^2.6"
"nelmio/api-doc-bundle": "^4.2"
},
"require-dev": {
"pimcore/admin-ui-classic-bundle": "^v1.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/api/v1/assets:
/studio/api/assets:
get:
tags: [Assets]
summary: Get all assets
security:
- access_token: [ ]
parameters:
- in: query
name: page
Expand Down
4 changes: 3 additions & 1 deletion config/api/V1/getAsset.yaml → config/api/asset/get.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/api/v1/assets/{id}:
/studio/api/assets/{id}:
get:
tags: [Assets]
summary: Get asset with id
security:
- access_token: [ ]
parameters:
- in: path
name: id
Expand Down
23 changes: 23 additions & 0 deletions config/api/login.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/studio/api/login:
post:
tags: [Authorization]
summary: Login with user credentials and get access token
requestBody:
description: username and password
content:
application/json:
schema:
ref: '#/components/schemas/Credentials'
responses:
'200':
description: Successful response
content:
application/json:
schema:
ref: '#/components/schemas/Token'
'403':
description: Unauthorized
content:
application/json:
schema:
ref: '#/components/schemas/Unauthorized'
27 changes: 27 additions & 0 deletions config/api/refresh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/studio/api/refresh:
post:
tags: [Authorization]
summary: Refresh access token
requestBody:
description: token
content:
application/json:
schema:
ref: '#/components/schemas/RefreshToken'
responses:
'200':
description: Successful response
content:
application/json:
schema:
ref: '#/components/schemas/Token'
'403':
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: 'Unauthorized'
9 changes: 9 additions & 0 deletions config/api/schemas/credentials.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Credentials:
type: object
properties:
username:
type: string
example: admin
password:
type: string
example: '*****'
6 changes: 6 additions & 0 deletions config/api/schemas/refresh-token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
RefreshToken:
type: object
properties:
token:
type: string
example: refresh_token
12 changes: 12 additions & 0 deletions config/api/schemas/token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Token:
type: object
properties:
token:
type: string
example: generated_token
username:
type: string
example: admin
lifetime:
type: integer
example: 3600
11 changes: 11 additions & 0 deletions config/api/schemas/translation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Translation:
type: object
properties:
locale:
type: string
example: en
keys:
type: array
items:
type: string
example: username
10 changes: 10 additions & 0 deletions config/api/schemas/unauthorized.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Unauthorized:
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: 'Unauthorized'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/api/v1/translations:
/studio/api/translations:
post:
tags: [Translation]
summary: Get all translations
Expand Down
21 changes: 0 additions & 21 deletions config/pimcore/config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
imports:
- { resource: 'packages/nelmio_api_doc.yaml' }

#api_platform:
# title: 'Pimcore Studio API'
# description: 'API for Pimcore Studio UI'
# version: 0.0.1
# graphql:
# graphql_playground: false
# graphiql:
# enabled: false
# event_listeners_backward_compatibility_layer: false
# keep_legacy_inflector: false
# enable_docs: true
# enable_entrypoint: false
# enable_swagger_ui: false
# enable_re_doc: false
# show_webby: false
# swagger:
# api_keys:
# access_token:
# name: 'Authorization'
# type: 'header'

pimcore:
translations:
domains:
Expand Down
18 changes: 3 additions & 15 deletions config/pimcore/packages/nelmio_api_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@ nelmio_api_doc:
- { alias: Asset, type: Pimcore\Bundle\StudioApiBundle\Dto\Asset }
areas:
path_patterns: # an array of regexps (document only routes under /api, except /api/doc)
- ^/api(?!/doc$)
- ^/studio/api(?!/doc$)
host_patterns: # document only routes with a host of the form api.*
- ^api\.
- ^studio/api\.
documentation:
info:
title: Studio Api
description: It is an API platform with the rest API in the core.
version: 0.0.1

components:
securitySchemes:
access_token:
type: http
scheme: bearer
schemas:
Translation:
type: object
properties:
locale:
type: string
example: en
keys:
type: array
items:
type: string
example: key1

6 changes: 3 additions & 3 deletions config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
api_dcos:
path: /api/docs
path: /studio/api/docs
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger_ui }

openapi_docs:
path: /api/docs/openapi
path: /studio/api/docs/openapi
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger }

studio_api:
resource: "../../src/Controller/Api"
type: annotation
prefix: /api
prefix: /studio/api
options:
expose: true
20 changes: 0 additions & 20 deletions config/serialization/asset.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions config/serialization/asset/document.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions config/serialization/asset/image.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions config/serialization/asset/metaData.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions config/serialization/asset/permissions.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions config/serialization/asset/video.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions config/serialization/dependency.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions config/serialization/element.yaml

This file was deleted.

Loading

0 comments on commit 11191b8

Please sign in to comment.