Skip to content

Commit

Permalink
Merge pull request #198 from aroskanalen/feature/398-route-v2
Browse files Browse the repository at this point in the history
398: Changed route prefix to v2
  • Loading branch information
tuj authored Apr 3, 2024
2 parents 0aabf55 + f9a1c4e commit 4d91fe5
Show file tree
Hide file tree
Showing 51 changed files with 515 additions and 513 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php_upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist --ignore-platform-reqs

- name: Export specifications
run: bin/console api:openapi:export --yaml --output=public/api-spec-v1.yaml --no-interaction
run: bin/console api:openapi:export --yaml --output=public/api-spec-v2.yaml --no-interaction

- name: Check for changes in specifications
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.yaml
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.yaml
8 changes: 4 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,16 @@ jobs:
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

- name: Export specifications (yaml)
run: bin/console api:openapi:export --yaml --output=public/api-spec-v1.yaml --no-interaction
run: bin/console api:openapi:export --yaml --output=public/api-spec-v2.yaml --no-interaction

- name: Check for changes in specifications (yaml)
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.yaml
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.yaml

- name: Export specifications (json)
run: bin/console api:openapi:export --output=public/api-spec-v1.json --no-interaction
run: bin/console api:openapi:export --output=public/api-spec-v2.json --no-interaction

- name: Check for changes in specifications (json)
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.json
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.json

changelog:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#198](https://github.com/os2display/display-api-service/pull/198)
- Changed route prefix to v2.
- [#197](https://github.com/os2display/display-api-service/pull/197)
- Fixed weight issue when assigning slides to playlist.
- [#194](https://github.com/os2display/display-api-service/pull/194)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## OpenAPI specification

The OpenAPI specification is committed to this repo as `public/api-spec-v1.yaml`
and as `public/api-spec-v1.json`.
The OpenAPI specification is committed to this repo as `public/api-spec-v2.yaml`
and as `public/api-spec-v2.json`.

A CI check will compare the current API implementation to the spec. If they
are different the check will fail.
Expand All @@ -18,7 +18,7 @@ If these are _breaking_ changes the API version must be changed accordingly.

## Stateless

The API is stateless except `/v1/authentication` routes.
The API is stateless except `/v2/authentication` routes.
Make sure to set the `CORS_ALLOW_ORIGIN` correctly in `.env.local`.

## Rest API & Relationships
Expand All @@ -27,7 +27,7 @@ To avoid embedding all relations in REST representations but still allow the cli
they have to make all endpoints that have relations also has a `relationsModified` field:

```json
"@id": "/v1/screens/000XB4RQW418KK14AJ054W1FN2",
"@id": "/v2/screens/000XB4RQW418KK14AJ054W1FN2",
...
"relationsModified": {
"campaigns": "cf9bb7d5fd04743dd21b5e3361db7eed575258e0",
Expand Down Expand Up @@ -155,11 +155,11 @@ docker compose exec phpfpm bin/console app:user:add
```

You can now obtain a token by sending a `POST` request to the
`/v1/authentication/token` endpoint:
`/v2/authentication/token` endpoint:

```curl
curl --location --request 'POST' \
'http://displayapiservice.local.itkdev.dk/v1/authentication/token' \
'http://displayapiservice.local.itkdev.dk/v2/authentication/token' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
Expand All @@ -180,7 +180,7 @@ as the api key value. Or by adding an auth header to your requests

```curl
curl --location --request 'GET' \
'http://displayapiservice.local.itkdev.dk/v1/layouts?page=1&itemsPerPage=10' \
'http://displayapiservice.local.itkdev.dk/v2/layouts?page=1&itemsPerPage=10' \
--header 'accept: application/ld+json' \
--header 'Authorization: Bearer <token>'
```
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
"bin/console --env=test doctrine:migrations:migrate --no-interaction --quiet"
],
"update-api-spec": [
"bin/console api:openapi:export --output=public/api-spec-v1.yaml --yaml --no-interaction",
"bin/console api:openapi:export --output=public/api-spec-v1.json --no-interaction"
"bin/console api:openapi:export --output=public/api-spec-v2.yaml --yaml --no-interaction",
"bin/console api:openapi:export --output=public/api-spec-v2.json --no-interaction"
]
}
}
4 changes: 2 additions & 2 deletions config/api_platform/feed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resources:
openapiContext:
description: Get data from a feed.
summary: Get data from a feed.
operationId: get-v1-feed-id-data
operationId: get-v2-feed-id-data
tags:
- Feeds
parameters:
Expand Down Expand Up @@ -70,7 +70,7 @@ resources:
- 'created.at.order_filter'
- 'modified.at.order_filter'
openapiContext:
operationId: get-v1-feeds
operationId: get-v2-feeds
description: Retrieves a collection of Feed resources.
summary: Retrieves a collection of Feed resources.
tags:
Expand Down
4 changes: 2 additions & 2 deletions config/api_platform/feed_source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resources:
openapiContext:
description: Get config for name from a feed source.
summary: Get config for name from a feed source.
operationId: get-v1-feed-source-id-config-name
operationId: get-v2-feed-source-id-config-name
tags:
- FeedSources
parameters:
Expand Down Expand Up @@ -78,7 +78,7 @@ resources:
- 'modified.at.order_filter'
- 'feed_source.search_filter'
openapiContext:
operationId: get-v1-feed-sources
operationId: get-v2-feed-sources
description: Retrieves a collection of FeedSource resources.
summary: Retrieves a collection of FeedSource resources.
tags:
Expand Down
4 changes: 2 additions & 2 deletions config/api_platform/layout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resources:
openapiContext:
description: Retrieves a screen layout resource.
summary: Retrieve a screen layout resource.
operationId: get-v1-layouts-id
operationId: get-v2-layouts-id
tags:
- Layouts
parameters:
Expand All @@ -38,7 +38,7 @@ resources:
summary: Retrieves a collection of layouts resources.
tags:
- Layouts
operationId: get-v1-layouts
operationId: get-v2-layouts
parameters:
- schema:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions config/api_platform/media.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resources:
openapiContext:
description: Retrieves a Media resource.
summary: Retrieve a Media resource.
operationId: getV1MediaById
operationId: getv2MediaById
tags:
- Media
parameters:
Expand All @@ -36,7 +36,7 @@ resources:
openapiContext:
description: Delete a Media resource.
summary: Delete a Media resource.
operationId: delete-v1-media-id
operationId: delete-v2-media-id
tags:
- Media
parameters:
Expand All @@ -60,7 +60,7 @@ resources:
summary: Retrieves a collection of Media resources.
tags:
- Media
operationId: get-v1-medias
operationId: get-v2-medias
parameters:
- schema:
type: integer
Expand Down
10 changes: 5 additions & 5 deletions config/api_platform/playlist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resources:
normalizationContext:
jsonld_embed_context: true
openapiContext:
operationId: get-v1-playlist-id
operationId: get-v2-playlist-id
description: Retrieve a Playlist resource.
summary: Retrieves a Playlist resource.
tags:
Expand All @@ -38,7 +38,7 @@ resources:
openapiContext:
description: Update a Playlist resource.
summary: Update a Playlist resource.
operationId: put-v1-playlist-id
operationId: put-v2-playlist-id
tags:
- Playlists
parameters:
Expand All @@ -54,7 +54,7 @@ resources:
openapiContext:
description: Delete a Playlist resource.
summary: Delete a Playlist resource.
operationId: delete-v1-playlist-id
operationId: delete-v2-playlist-id
tags:
- Playlists
parameters:
Expand All @@ -77,7 +77,7 @@ resources:
- 'modified.at.order_filter'
- 'App\Filter\SharedWithMe'
openapiContext:
operationId: get-v1-playlists
operationId: get-v2-playlists
description: Retrieves a collection of Playlist resources.
summary: Retrieve a collection of Playlist resources.
tags:
Expand All @@ -103,7 +103,7 @@ resources:
normalizationContext:
jsonld_embed_context: true
openapiContext:
operationId: create-v1-playlist
operationId: create-v2-playlist
description: Creates a Playlist resource.
summary: Creates a Playlist resource.
tags:
Expand Down
2 changes: 1 addition & 1 deletion config/api_platform/playlist_screen_region.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ resources:
filters: ['App\Filter\SharedWithMe']
uriTemplate: '/screens/{id}/regions/{regionId}/playlists'
openapiContext:
operationId: get-v1-playlist-screen-regions
operationId: get-v2-playlist-screen-regions
description: Retrieve a Playlist resources base on screen regions.
summary: Retrieves a Playlist resources base on screen region.
tags:
Expand Down
10 changes: 5 additions & 5 deletions config/api_platform/playlist_slide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resources:
openapiContext:
description: Delete a slide from a playlist.
summary: Delete a slide from a playlist.
operationId: delete-v1-playlist-slide-id
operationId: delete-v2-playlist-slide-id
tags:
- Playlists
parameters:
Expand Down Expand Up @@ -49,7 +49,7 @@ resources:
openapiContext:
description: Update the collection of slide on a playlist.
summary: Update the collection of slide on a playlist.
operationId: put-v1-playlist-slide-id
operationId: put-v2-playlist-slide-id
tags:
- Playlists
requestBody:
Expand Down Expand Up @@ -102,7 +102,7 @@ resources:
openapiContext:
description: Get the collection of playlist connected to a slide.
summary: Get the collection of playlist connected to a slide.
operationId: put-v1-slide-playlist-id
operationId: put-v2-slide-playlist-id
tags:
- Playlists
parameters:
Expand Down Expand Up @@ -152,7 +152,7 @@ resources:
openapiContext:
description: Retrieves collection of playlist resources.
summary: Retrieves collection of playlistresources.
operationId: get-v1-slide-playlist-id
operationId: get-v2-slide-playlist-id
tags:
- Playlists
parameters:
Expand Down Expand Up @@ -194,7 +194,7 @@ resources:
openapiContext:
description: Retrieves collection of weighted slide resources.
summary: Retrieves collection of weighted slide resources.
operationId: get-v1-playlist-slide-id
operationId: get-v2-playlist-slide-id
tags:
- Playlists
parameters:
Expand Down
8 changes: 4 additions & 4 deletions config/api_platform/screen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resources:
openapiContext:
description: Update a Screen resource.
summary: Update a Screen resource.
operationId: put-v1-screen-id
operationId: put-v2-screen-id
tags:
- Screens
parameters:
Expand All @@ -55,7 +55,7 @@ resources:
openapiContext:
description: Delete a Screen resource.
summary: Delete a Screen resource.
operationId: delete-v1-screen-id
operationId: delete-v2-screen-id
tags:
- Screens
parameters:
Expand All @@ -75,7 +75,7 @@ resources:
- 'created.at.order_filter'
- 'modified.at.order_filter'
openapiContext:
operationId: get-v1-screens
operationId: get-v2-screens
description: Retrieves a collection of Screen resources.
summary: Retrieves a collection of Screen resources.
tags:
Expand Down Expand Up @@ -108,7 +108,7 @@ resources:
normalizationContext:
jsonld_embed_context: true
openapiContext:
operationId: create-v1-screens
operationId: create-v2-screens
description: Creates a Screen resource.
summary: Creates a Screen resource.
tags:
Expand Down
8 changes: 4 additions & 4 deletions config/api_platform/screen_campaign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resources:
openapiContext:
description: Delete a campaign from a screen.
summary: Delete a campaign from a screen.
operationId: delete-v1-screen-campaign-id
operationId: delete-v2-screen-campaign-id
tags:
- Screens
parameters:
Expand Down Expand Up @@ -49,7 +49,7 @@ resources:
openapiContext:
description: Update the collection of screens on a playlist.
summary: Update the collection of screens on a playlist.
operationId: put-v1-screen-campaign-id
operationId: put-v2-screen-campaign-id
tags:
- Screens
requestBody:
Expand Down Expand Up @@ -99,7 +99,7 @@ resources:
openapiContext:
description: Retrieves collection of campaign resources.
summary: Retrieves collection of campaign resources.
operationId: get-v1-screen-campaign-id
operationId: get-v2-screen-campaign-id
tags:
- Screens
parameters:
Expand Down Expand Up @@ -146,7 +146,7 @@ resources:
openapiContext:
description: Get screens connected to a campaign.
summary: Get screens connected to a campaign.
operationId: get-v1-campaign-id-screen
operationId: get-v2-campaign-id-screen
tags:
- Playlists
parameters:
Expand Down
Loading

0 comments on commit 4d91fe5

Please sign in to comment.