Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Url proxy endpoint featuring OpenAPI #141

Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b40aaf6
Adding experiment with openapi / openapi_rest
spaceo Oct 3, 2022
9d2cb41
Solving the url param problem in the rest resource
spaceo Oct 3, 2022
2a36181
Correcting UrlParamConverter::convert return type
spaceo Oct 4, 2022
d616550
Make sure url proxy endpoint is varying on url
spaceo Oct 4, 2022
de23403
Reorder patched projects alphabetically
kasperg Oct 4, 2022
35c3b5f
Patch OpenAPI module to ensure it generates a valid spec
kasperg Oct 4, 2022
648a053
Patch OpenAPI REST module to support parameter and response specs
kasperg Oct 4, 2022
73024ce
Implement parameter for url proxy resource as plain GET parameter
kasperg Oct 4, 2022
21c9d1d
Remove obsolete routing for url proxy module
kasperg Oct 4, 2022
b5c9ef6
Update url proxy response format and add specification
kasperg Oct 4, 2022
284c931
Do not modify urls if no proxy expression is configured
kasperg Oct 4, 2022
3be9f4b
Fix coverage in text format when running PHPUnit tests
kasperg Oct 4, 2022
97adfd1
Allow anonymous users to access our API documentation
kasperg Oct 4, 2022
9f470ed
Maintain a up to date an valid version of the Drupal OpenAPI spec
kasperg Oct 4, 2022
dee8752
Do not not(!) ignore url proxy settings
kasperg Oct 4, 2022
018ffbf
Use DPL prefix for url proxy module name
kasperg Oct 4, 2022
6b45d95
Fix url proxy resource code style
kasperg Oct 5, 2022
bbcd403
Fix UrlProxyResource test code style
kasperg Oct 5, 2022
a5cab4f
Rewrap response in data
kasperg Oct 5, 2022
1b015ba
Disable modules related to development of REST services
kasperg Oct 5, 2022
0f9c6bf
Remove obsolete modules
kasperg Oct 5, 2022
8fefa5b
Merge pull request #2 from reload/DDFSOEG-245-part-2
spaceo Oct 5, 2022
ab8c54e
Add initial ADR to document the usage of REST and OpenAPI
kasperg Oct 5, 2022
31ec6cf
Link to both Orval and GraphQL definitions in API spec ADR
kasperg Oct 5, 2022
baee32e
Do not quote keys in Lighthouse configuration
kasperg Oct 5, 2022
afbfdae
Reduce Lighthouse throttling
kasperg Oct 5, 2022
758f7e9
Fix Lighthouse throttling
kasperg Oct 5, 2022
5a3934c
Fix link to Taskfile in ADR
kasperg Oct 5, 2022
a6752bd
Make sure that url is defaulting to url_param
spaceo Oct 5, 2022
d2bf748
Add developer documentation for implementing new APIs
kasperg Oct 5, 2022
63164f1
Add proper description of UrlProxyResource
kasperg Oct 5, 2022
e7a65ce
Remove obsolete url proxy controller
kasperg Oct 5, 2022
8fb9c28
Update url proxy resource cache tag handling
kasperg Oct 6, 2022
e4ec424
Revert user role names to english
kasperg Oct 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,23 @@ jobs:
run: npm install
- name: Run ESLint
run: npx eslint .

CheckOpenApiSpec:
name: Check OpenAPI specification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Our Taskfile requires a proper checkout to function because of
# certain vars.
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v1
- name: Setup site
run: task ci:reset
- name: Validate specification
run: task ci:openapi:validate
- name: Download current specification
run: task ci:openapi:download
- name: Ensure specification has not drifted
run: git diff --exit-code openapi.json
51 changes: 30 additions & 21 deletions .lighthouserc.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
module.exports = {
"ci": {
"collect": {
"url": [
'http://varnish:8080/',
],
ci: {
collect: {
url: ["http://varnish:8080/"],
// Use 3 runs to test both cold and warm caches.
"numberOfRuns": 3,
"settings": {
"chromeFlags": "--no-sandbox",
numberOfRuns: 3,
settings: {
chromeFlags: "--no-sandbox",
// Lighthouse best practices require HTTPS but we do not this available
// on our CI environments so disable that check. It should not keep our
// score down.
"skipAudits": ["is-on-https"]
}
skipAudits: ["is-on-https"],
throttling: {
// Lighthouse will throttle CPU by 4x by default to mimick the
// performance of a midrange smartphone instead of a desktop
// workstation. Experience shows that Docker containers and GitHub
// Actions runners have significantly fewer resources than a desktop and
// thus should be throttled less. This value is based on a benchmark
// index of 1000. The actual benchmark in a run can be seen under
// CPU/Memory Power in the generated report.
// https://lighthouse-cpu-throttling-calculator.vercel.app/
cpuSlowdownMultiplier: 2.9,
},
},
},
"assert": {
"assertions": {
assert: {
assertions: {
// Our quality standard requires all categories to be green. Green
// translates to a score between 90 and 100 - or 0.9-1.
"categories:performance": ["error", {"minScore": 0.9}],
"categories:accessibility": ["error", {"minScore": 0.9}],
"categories:best-practices": ["error", {"minScore": 0.9}],
"categories:seo": ["error", {"minScore": 0.9}]
}
"categories:performance": ["error", { minScore: 0.9 }],
"categories:accessibility": ["error", { minScore: 0.9 }],
"categories:best-practices": ["error", { minScore: 0.9 }],
"categories:seo": ["error", { minScore: 0.9 }],
},
},
"upload": {
upload: {
// Update to Googles public storage to make reports easily accessible.
// The fact that the storage is public is fine. The project is open.
"target": "temporary-public-storage"
}
}
target: "temporary-public-storage",
},
},
};
14 changes: 13 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ tasks:
dev:phpunit:
desc: Run PHPUnit tests with code coverage
cmds:
- docker compose run -e XDEBUG_ENABLE=true cli vendor/bin/phpunit --coverage-text
- docker compose run -e XDEBUG_ENABLE=true -e XDEBUG_MODE=coverage,debug cli vendor/bin/phpunit --coverage-text

dev:restore:database:
desc: 'Restore database from db dump file. Only one sql should be present the "{{ .DIR_RESTORE_DATABASE }}" directory.'
Expand Down Expand Up @@ -177,6 +177,18 @@ tasks:
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run node-chrome npm ci
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run node-chrome npx lhci autorun

ci:openapi:validate:
desc: Validate the Drupal OpenAPI specification
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run node-chrome npm ci
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run node-chrome npx swagger-cli validate http://varnish:8080/openapi/rest?_format=json

ci:openapi:download:
desc: Download the Drupal OpenAPI specification from the running local site to the local filesystem
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run node-chrome npm ci
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run node-chrome curl http://varnish:8080/openapi/rest?_format=json | npx jsome -r > openapi.json

source:build:
summary: Build core source image.
cmds:
Expand Down
16 changes: 13 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@
"drupal/devel": "^4.1",
"drupal/jsonlog": "^3.0",
"drupal/libraries": "^3.0@beta",
"drupal/openapi": "^2.0",
"drupal/openapi_rest": "^2.0@RC",
"drupal/openid_connect": "^1.1",
"drupal/purge": "^3.2",
"drupal/redis": "^1.5",
"drupal/restui": "^1.21",
"drupal/varnish_purge": "^2.1",
"drush/drush": "10.4.3",
"thecodingmachine/safe": "^1.3",
Expand Down Expand Up @@ -96,7 +99,8 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-project-message": true,
"phpstan/extension-installer": true,
"zaporylie/composer-drupal-optimizations": true
"zaporylie/composer-drupal-optimizations": true,
"drupal/console-extend-plugin": true
}
},
"autoload-dev": {
Expand Down Expand Up @@ -142,11 +146,17 @@
"2936067: CSS aggregation fails on many variations of @import": "https://git.drupalcode.org/project/drupal/-/commit/5aa154d.patch",
"Configure core to not check permissions before accepting an updated module": "patches/disable-core-upload-permission-check.diff"
},
"drupal/jsonlog": {
"3251587: Change logging from stdout to stderr": "https://www.drupal.org/files/issues/2021-11-29/jsonlog-change-stdout-to-stderr-3251587-3.patch"
},
"drupal/redis": {
"3207574: Patch against redis being include too late": "https://www.drupal.org/files/issues/2021-04-07/redis-report_warnings-3207574-2.patch"
},
"drupal/jsonlog": {
"3251587: Change logging from stdout to stderr": "https://www.drupal.org/files/issues/2021-11-29/jsonlog-change-stdout-to-stderr-3251587-3.patch"
"drupal/openapi": {
"3313521: OpenAPI security field does not validate": "https://git.drupalcode.org/project/openapi/-/merge_requests/6.patch"
},
"drupal/openapi_rest": {
"3171530 + 3116760: Add support for parameter and response descriptions": "patches/openapi-parameter-response-descriptions.patch"
}
}
}
Expand Down
Loading