Skip to content

Commit

Permalink
feat: generate API interface types for kennisartikel & vac
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 committed Oct 4, 2024
1 parent 8fae958 commit 8322757
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ gql
**/yarn-error.log
**/.strapi-updater.json
**/generated
apps/kennisbank-api/src/types
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,8 @@ dist/
# Sitemap plugin
**/**/public/*.xml
**/**/public/*.txt

############################
# kennisbank-api
############################
apps/kennisbank-api/src/types
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ yarn.lock
.strapi-updater.json
generated
gql
apps/kennisbank-api/src/types
7 changes: 4 additions & 3 deletions apps/kennisbank-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"license": "EUPL-1.2",
"keywords": [],
"scripts": {
"prebuild": "yarn clean",
"prebuild": "yarn clean && yarn generate-types",
"build": "tsc -p ./tsconfig.json",
"watch": "tsc -p ./tsconfig.json -w",
"start": "node dist/server.js",
"dev": "nodemon src/server.ts",
"clean": "rimraf dist",
"lint-build": "tsc --noEmit --project tsconfig.json"
"clean": "rimraf dist src/types",
"generate-types": "openapi-typescript src/docs/openapi.yaml --output src/types/openapi.ts"
},
"dependencies": {
"cors": "2.8.5",
Expand All @@ -27,6 +27,7 @@
"@types/swagger-ui-express": "4.1.6",
"@types/yamljs": "0.2.34",
"nodemon": "3.1.7",
"openapi-typescript": "7.4.1",
"rimraf": "6.0.1",
"typescript": "5.0.4"
},
Expand Down
3 changes: 3 additions & 0 deletions apps/kennisbank-api/src/controllers/kennisartikel/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { RequestHandler } from 'express';
import { SEARCH_PRODUCT } from '../../queries';
import { paths } from '../../types/openapi';
import { fetchData } from '../../utils';

type SuccessResponse = paths['/kennisartikel']['get']['responses'][200]['content']['application/json'][0];

export const kennisartikelController: RequestHandler = async (req, res, next) => {
const locale = (req.query?.locale as string) || 'nl';
const graphqlURL = new URL('/graphql', process.env.STRAPI_PRIVATE_URL);
Expand Down
2 changes: 1 addition & 1 deletion apps/kennisbank-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"outDir": "dist"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.test.ts"]
"exclude": ["node_modules", "**/*.test.ts", "./src/types/openapi.ts"]
}
114 changes: 110 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@
"@babel/highlight" "^7.24.7"
picocolors "^1.0.0"

"@babel/code-frame@^7.22.13":
version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.25.7.tgz#438f2c524071531d643c6f0188e1e28f130cebc7"
integrity sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==
dependencies:
"@babel/highlight" "^7.25.7"
picocolors "^1.0.0"

"@babel/compat-data@^7.20.5", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.25.2", "@babel/compat-data@^7.25.4":
version "7.25.4"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.4.tgz#7d2a80ce229890edcf4cc259d4d696cb4dae2fcb"
Expand Down Expand Up @@ -491,6 +499,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db"
integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==

"@babel/helper-validator-identifier@^7.25.7":
version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5"
integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==

"@babel/helper-validator-option@^7.24.7", "@babel/helper-validator-option@^7.24.8":
version "7.24.8"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d"
Expand Down Expand Up @@ -523,6 +536,16 @@
js-tokens "^4.0.0"
picocolors "^1.0.0"

"@babel/highlight@^7.25.7":
version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.25.7.tgz#20383b5f442aa606e7b5e3043b0b1aafe9f37de5"
integrity sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==
dependencies:
"@babel/helper-validator-identifier" "^7.25.7"
chalk "^2.4.2"
js-tokens "^4.0.0"
picocolors "^1.0.0"

"@babel/parser@^7.1.0", "@babel/parser@^7.14.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.8", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.0", "@babel/parser@^7.25.4":
version "7.25.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.4.tgz#af4f2df7d02440286b7de57b1c21acfb2a6f257a"
Expand Down Expand Up @@ -5218,6 +5241,38 @@
resolved "https://registry.yarnpkg.com/@react-leaflet/core/-/core-2.1.0.tgz#383acd31259d7c9ae8fb1b02d5e18fe613c2a13d"
integrity sha512-Qk7Pfu8BSarKGqILj4x7bCSZ1pjuAPZ+qmRwH5S7mDS91VSbVVsJSrW4qA+GPrro8t69gFYVMWb1Zc4yFmPiVg==

"@redocly/ajv@^8.11.2":
version "8.11.2"
resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.11.2.tgz#46e1bf321ec0ac1e0fd31dea41a3d1fcbdcda0b5"
integrity sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js-replace "^1.0.1"

"@redocly/config@^0.12.1":
version "0.12.1"
resolved "https://registry.yarnpkg.com/@redocly/config/-/config-0.12.1.tgz#7b905a17d710244550ef826542d0db164d5ace02"
integrity sha512-RW3rSirfsPdr0uvATijRDU3f55SuZV3m7/ppdTDvGw4IB0cmeZRkFmqTrchxMqWP50Gfg1tpHnjdxUCNo0E2qg==

"@redocly/openapi-core@^1.25.3":
version "1.25.4"
resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.25.4.tgz#99e2535a55f6fa186bab0b3fe28603da1d1f4d38"
integrity sha512-qnpr4Z1rzfXdtxQxt/lfGD0wW3UVrm3qhrTpzLG5R/Ze+z+1u8sSRiQHp9N+RT3IuMjh00wq59nop9x9PPa1jQ==
dependencies:
"@redocly/ajv" "^8.11.2"
"@redocly/config" "^0.12.1"
colorette "^1.2.0"
https-proxy-agent "^7.0.4"
js-levenshtein "^1.1.6"
js-yaml "^4.1.0"
lodash.isequal "^4.5.0"
minimatch "^5.0.1"
node-fetch "^2.6.1"
pluralize "^8.0.0"
yaml-ast-parser "0.0.43"

"@reduxjs/[email protected]":
version "1.9.7"
resolved "https://registry.yarnpkg.com/@reduxjs/toolkit/-/toolkit-1.9.7.tgz#7fc07c0b0ebec52043f8cb43510cf346405f78a6"
Expand Down Expand Up @@ -10079,6 +10134,11 @@ change-case@^4.1.2:
snake-case "^3.0.4"
tslib "^2.0.3"

change-case@^5.4.4:
version "5.4.4"
resolved "https://registry.yarnpkg.com/change-case/-/change-case-5.4.4.tgz#0d52b507d8fb8f204343432381d1a6d7bff97a02"
integrity sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==

char-regex@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf"
Expand Down Expand Up @@ -10522,7 +10582,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798"
integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==

colorette@^1.1.0:
colorette@^1.1.0, colorette@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40"
integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==
Expand Down Expand Up @@ -15374,7 +15434,7 @@ [email protected], https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1:
agent-base "6"
debug "4"

https-proxy-agent@^7.0.0:
https-proxy-agent@^7.0.0, https-proxy-agent@^7.0.4:
version "7.0.5"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2"
integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==
Expand Down Expand Up @@ -15636,6 +15696,11 @@ indent-string@^5.0.0:
resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5"
integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==

index-to-position@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/index-to-position/-/index-to-position-0.1.2.tgz#e11bfe995ca4d8eddb1ec43274488f3c201a7f09"
integrity sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==

infer-owner@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467"
Expand Down Expand Up @@ -17085,6 +17150,11 @@ [email protected], js-cookie@^2.2.1:
dependencies:
acorn "^8.0.5"

js-levenshtein@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"
integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==

js-sdsl@^4.1.4:
version "4.4.2"
resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.2.tgz#2e3c031b1f47d3aca8b775532e3ebb0818e7f847"
Expand Down Expand Up @@ -20851,6 +20921,18 @@ open@^9.1.0:
is-inside-container "^1.0.0"
is-wsl "^2.2.0"

[email protected]:
version "7.4.1"
resolved "https://registry.yarnpkg.com/openapi-typescript/-/openapi-typescript-7.4.1.tgz#1e42ecbd286ea62f6f8dc994b9aeccaa8b31c537"
integrity sha512-HrRoWveViADezHCNgQqZmPKmQ74q7nuH/yg9ursFucZaYQNUqsX38fE/V2sKBHVM+pws4tAHpuh/ext2UJ/AoQ==
dependencies:
"@redocly/openapi-core" "^1.25.3"
ansi-colors "^4.1.3"
change-case "^5.4.4"
parse-json "^8.1.0"
supports-color "^9.4.0"
yargs-parser "^21.1.1"

opener@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598"
Expand Down Expand Up @@ -21237,6 +21319,15 @@ parse-json@^5.0.0, parse-json@^5.2.0:
json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6"

parse-json@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-8.1.0.tgz#91cdc7728004e955af9cb734de5684733b24a717"
integrity sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==
dependencies:
"@babel/code-frame" "^7.22.13"
index-to-position "^0.1.2"
type-fest "^4.7.1"

parse-numeric-range@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/parse-numeric-range/-/parse-numeric-range-1.3.0.tgz#7c63b61190d61e4d53a1197f0c83c47bb670ffa3"
Expand Down Expand Up @@ -21664,7 +21755,7 @@ plur@^4.0.0:
dependencies:
irregular-plurals "^3.2.0"

[email protected]:
[email protected], pluralize@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==
Expand Down Expand Up @@ -26009,6 +26100,11 @@ supports-color@^8.0.0, supports-color@^8.1.1, supports-color@~8.1.1:
dependencies:
has-flag "^4.0.0"

supports-color@^9.4.0:
version "9.4.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954"
integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==

supports-hyperlinks@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624"
Expand Down Expand Up @@ -26688,6 +26784,11 @@ type-fest@^3.12.0:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.13.1.tgz#bb744c1f0678bea7543a2d1ec24e83e68e8c8706"
integrity sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==

type-fest@^4.7.1:
version "4.26.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.1.tgz#a4a17fa314f976dd3e6d6675ef6c775c16d7955e"
integrity sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==

type-func@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/type-func/-/type-func-1.0.3.tgz#ab184234ae80d8d50057cefeff3b2d97d08ae9b0"
Expand Down Expand Up @@ -27103,6 +27204,11 @@ upper-case@^2.0.2:
dependencies:
tslib "^2.0.3"

uri-js-replace@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/uri-js-replace/-/uri-js-replace-1.0.1.tgz#c285bb352b701c9dfdaeffc4da5be77f936c9048"
integrity sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==

uri-js@^4.2.2, uri-js@^4.4.1:
version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
Expand Down Expand Up @@ -28008,7 +28114,7 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

yaml-ast-parser@^0.0.43:
yaml-ast-parser@0.0.43, yaml-ast-parser@^0.0.43:
version "0.0.43"
resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb"
integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==
Expand Down

0 comments on commit 8322757

Please sign in to comment.