Skip to content

Commit bf0e1ac

Browse files
authored
Merge pull request #21 from itk-dev/feature/4268-api-platform-v4-yaml-action
YAML action
2 parents db7ea74 + 81cdc2d commit bf0e1ac

20 files changed

+294
-279
lines changed

.github/workflows/pr.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,6 @@ jobs:
2929
run: |
3030
task --yes api:test
3131
32-
coding-standards-yaml:
33-
name: Coding standards YAML
34-
runs-on: ubuntu-latest
35-
steps:
36-
- uses: actions/checkout@v4
37-
38-
# https://taskfile.dev/installation/#github-actions
39-
- uses: arduino/setup-task@v2
40-
41-
- run: |
42-
docker network create frontend
43-
44-
- name: Check YAML coding standards
45-
run: |
46-
task --yes coding-standards:yaml:check
47-
48-
- name: Check that nothing has changed
49-
run: git diff --exit-code
50-
5132
code-analysis-phpstan:
5233
runs-on: ubuntu-latest
5334
name: PHPStan static analysis

.github/workflows/yaml.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/symfony/yaml.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Symfony YAML
6+
###
7+
### Validates Symfony YAML files.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `prettier` for running
12+
### [Prettier](https://prettier.io/) exists.
13+
14+
name: YAML
15+
16+
on:
17+
pull_request:
18+
push:
19+
branches:
20+
- main
21+
- develop
22+
23+
jobs:
24+
yaml-lint:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- run: |
30+
docker network create frontend
31+
32+
- run: |
33+
docker compose run --rm prettier '.github/workflows/*.{yml,yaml}' 'config/**/*.{yml,yaml}' --check

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ See [keep a changelog] for information about writing changes to this log.
88

99
## [Unreleased]
1010

11+
- [PR-21](https://github.com/itk-dev/event-database-api/pull/21)
12+
Linted YAML
1113
- [PR-18](https://github.com/itk-dev/event-database-api/pull/18)
1214
- Updated docker compose setup
1315
- Added simple API tests and resolved some deprecations

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vars:
1010
DOCKER_COMPOSE: '{{.TASK_DOCKER_COMPOSE | default "docker compose"}}'
1111

1212
# We're not yet ready to normalize config files …
13-
YAML_FILES_GLOB: "Taskfile.yml .github/workflows/**.{yml,yaml} phpstan.dist.neon"
13+
YAML_FILES_GLOB: "'.github/workflows/*.{yml,yaml}' 'config/**/*.{yml,yaml}' Taskfile.yml phpstan.dist.neon"
1414

1515
tasks:
1616
site:update:

config/packages/api_platform.yaml

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
api_platform:
2-
title: '%env(OPENAPI_TITLE)%'
3-
description: '%env(OPENAPI_DESCRIPTION)%'
4-
version: 2.0.0
5-
show_webby: false
6-
7-
openapi:
8-
contact:
9-
name: '%env(OPENAPI_CONTACT_NAME)%'
10-
url: '%env(OPENAPI_CONTACT_URL)%'
11-
email: '%env(OPENAPI_CONTACT_EMAIL)%'
12-
termsOfService: '%env(OPENAPI_TERMS_OF_SERVICE)%'
13-
14-
formats:
15-
jsonld: ['application/ld+json']
16-
17-
docs_formats:
18-
jsonld: ['application/ld+json']
19-
jsonopenapi: ['application/vnd.openapi+json']
20-
html: ['text/html']
21-
22-
mapping:
23-
paths:
24-
- '%kernel.project_dir%/src/Api/Dto'
25-
26-
doctrine:
27-
enabled: false
28-
29-
swagger:
30-
api_keys:
31-
ApiKeyAuth:
32-
name: 'X-Api-Key'
33-
type: header
34-
35-
elasticsearch:
36-
hosts: ['%env(INDEX_URL)%']
37-
38-
defaults:
39-
stateless: true
40-
pagination_items_per_page: '%env(int:PAGINATION_ITEMS_PER_PAGE)%'
41-
pagination_maximum_items_per_page: '%env(int:PAGINATION_MAXIMUM_ITEMS_PER_PAGE)%'
42-
cache_headers:
43-
max_age: 3600
44-
shared_max_age: 3600
45-
vary: ['Content-Type', 'Authorization', 'Origin']
46-
extra_properties:
47-
# Note: The api-platform/core 3.4 recipe sets `standard_put` eventhough
48-
# https://api-platform.com/docs/core/upgrade-guide/#api-platform-34
49-
# (probably) tells us to remove it
50-
# standard_put: true
51-
# https://api-platform.com/docs/core/upgrade-guide/#api-platform-34
52-
rfc_7807_compliant_errors: true
53-
# Note: The api-platform/core 3.4 recipe wants `use_symfony_listeners` to be true
54-
use_symfony_listeners: false
55-
56-
# https://api-platform.com/docs/core/upgrade-guide/#upgrade-guide
57-
serializer:
58-
hydra_prefix: true
2+
title: "%env(OPENAPI_TITLE)%"
3+
description: "%env(OPENAPI_DESCRIPTION)%"
4+
version: 2.0.0
5+
show_webby: false
6+
7+
openapi:
8+
contact:
9+
name: "%env(OPENAPI_CONTACT_NAME)%"
10+
url: "%env(OPENAPI_CONTACT_URL)%"
11+
email: "%env(OPENAPI_CONTACT_EMAIL)%"
12+
termsOfService: "%env(OPENAPI_TERMS_OF_SERVICE)%"
13+
14+
formats:
15+
jsonld: ["application/ld+json"]
16+
17+
docs_formats:
18+
jsonld: ["application/ld+json"]
19+
jsonopenapi: ["application/vnd.openapi+json"]
20+
html: ["text/html"]
21+
22+
mapping:
23+
paths:
24+
- "%kernel.project_dir%/src/Api/Dto"
25+
26+
doctrine:
27+
enabled: false
28+
29+
swagger:
30+
api_keys:
31+
ApiKeyAuth:
32+
name: "X-Api-Key"
33+
type: header
34+
35+
elasticsearch:
36+
hosts: ["%env(INDEX_URL)%"]
37+
38+
defaults:
39+
stateless: true
40+
pagination_items_per_page: "%env(int:PAGINATION_ITEMS_PER_PAGE)%"
41+
pagination_maximum_items_per_page: "%env(int:PAGINATION_MAXIMUM_ITEMS_PER_PAGE)%"
42+
cache_headers:
43+
max_age: 3600
44+
shared_max_age: 3600
45+
vary: ["Content-Type", "Authorization", "Origin"]
46+
extra_properties:
47+
# Note: The api-platform/core 3.4 recipe sets `standard_put` eventhough
48+
# https://api-platform.com/docs/core/upgrade-guide/#api-platform-34
49+
# (probably) tells us to remove it
50+
# standard_put: true
51+
# https://api-platform.com/docs/core/upgrade-guide/#api-platform-34
52+
rfc_7807_compliant_errors: true
53+
# Note: The api-platform/core 3.4 recipe wants `use_symfony_listeners` to be true
54+
use_symfony_listeners: false
55+
56+
# https://api-platform.com/docs/core/upgrade-guide/#upgrade-guide
57+
serializer:
58+
hydra_prefix: true

config/packages/cache.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
framework:
2-
cache:
3-
# Unique name of your app: used to compute stable namespaces for cache keys.
4-
#prefix_seed: your_vendor_name/app_name
2+
cache:
3+
# Unique name of your app: used to compute stable namespaces for cache keys.
4+
#prefix_seed: your_vendor_name/app_name
55

6-
# The "app" cache stores to the filesystem by default.
7-
# The data in this cache should persist between deploys.
8-
# Other options include:
6+
# The "app" cache stores to the filesystem by default.
7+
# The data in this cache should persist between deploys.
8+
# Other options include:
99

10-
# Redis
11-
#app: cache.adapter.redis
12-
#default_redis_provider: redis://localhost
10+
# Redis
11+
#app: cache.adapter.redis
12+
#default_redis_provider: redis://localhost
1313

14-
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
15-
#app: cache.adapter.apcu
14+
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
15+
#app: cache.adapter.apcu
1616

17-
# Namespaced pools use the above "app" backend by default
18-
#pools:
19-
#my.dedicated.cache: null
17+
# Namespaced pools use the above "app" backend by default
18+
#pools:
19+
#my.dedicated.cache: null

config/packages/framework.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# see https://symfony.com/doc/current/reference/configuration/framework.html
22
framework:
3-
secret: '%env(APP_SECRET)%'
4-
annotations: false
5-
http_method_override: false
6-
handle_all_throwables: true
3+
secret: "%env(APP_SECRET)%"
4+
annotations: false
5+
http_method_override: false
6+
handle_all_throwables: true
77

8-
# Enables session support. Note that the session will ONLY be started if you read or write from it.
9-
# Remove or comment this section to explicitly disable session support.
10-
session:
11-
handler_id: null
12-
cookie_secure: auto
13-
cookie_samesite: lax
8+
# Enables session support. Note that the session will ONLY be started if you read or write from it.
9+
# Remove or comment this section to explicitly disable session support.
10+
session:
11+
handler_id: null
12+
cookie_secure: auto
13+
cookie_samesite: lax
1414

15-
#esi: true
16-
#fragments: true
17-
php_errors:
18-
log: true
15+
#esi: true
16+
#fragments: true
17+
php_errors:
18+
log: true
1919

20-
assets:
21-
base_path: '%env(APP_PATH_PREFIX)%'
20+
assets:
21+
base_path: "%env(APP_PATH_PREFIX)%"
2222

2323
when@test:
24-
framework:
25-
test: true
26-
session:
27-
storage_factory_id: session.storage.factory.mock_file
24+
framework:
25+
test: true
26+
session:
27+
storage_factory_id: session.storage.factory.mock_file

config/packages/http_discovery.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
services:
2-
Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory'
3-
Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory'
4-
Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory'
5-
Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory'
6-
Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory'
7-
Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory'
2+
Psr\Http\Message\RequestFactoryInterface: "@http_discovery.psr17_factory"
3+
Psr\Http\Message\ResponseFactoryInterface: "@http_discovery.psr17_factory"
4+
Psr\Http\Message\ServerRequestFactoryInterface: "@http_discovery.psr17_factory"
5+
Psr\Http\Message\StreamFactoryInterface: "@http_discovery.psr17_factory"
6+
Psr\Http\Message\UploadedFileFactoryInterface: "@http_discovery.psr17_factory"
7+
Psr\Http\Message\UriFactoryInterface: "@http_discovery.psr17_factory"
88

9-
http_discovery.psr17_factory:
10-
class: Http\Discovery\Psr17Factory
9+
http_discovery.psr17_factory:
10+
class: Http\Discovery\Psr17Factory

config/packages/nelmio_cors.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
nelmio_cors:
2-
defaults:
3-
origin_regex: true
4-
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
5-
allow_methods: ['GET', 'OPTIONS']
6-
allow_headers: ['Content-Type', 'X-Api-Key']
7-
expose_headers: ['Link']
8-
max_age: 3600
9-
paths:
10-
'^/': null
2+
defaults:
3+
origin_regex: true
4+
allow_origin: ["%env(CORS_ALLOW_ORIGIN)%"]
5+
allow_methods: ["GET", "OPTIONS"]
6+
allow_headers: ["Content-Type", "X-Api-Key"]
7+
expose_headers: ["Link"]
8+
max_age: 3600
9+
paths:
10+
"^/": null

config/packages/routing.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
framework:
2-
router:
3-
utf8: true
2+
router:
3+
utf8: true
44

5-
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
6-
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
7-
#default_uri: http://localhost
5+
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
6+
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
7+
#default_uri: http://localhost
88

99
when@prod:
10-
framework:
11-
router:
12-
strict_requirements: null
10+
framework:
11+
router:
12+
strict_requirements: null

0 commit comments

Comments
 (0)