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

add openapi documentation and script to generate client api #180

Merged
merged 4 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM node:16
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y curl jq
RUN mkdir -p packages/{types,validators,client,server}
COPY package.json ./
COPY packages/types/package.json packages/types/
Expand Down
28 changes: 17 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"eslint": "eslint --ext .js,.jsx,.ts,.tsx",
"prettier:all": "prettier --ignore-path .eslintignore \"**/*.{js,jsx,ts,tsx,md}\"",
"--shortcuts to run commands in workspaces--": "",
"client": "yarn workspace @ccelluloide/client",
"client": "yarn workspace @celluloid/client",
"server": "yarn workspace @celluloid/server",
"docker-build": "docker build -t celluloid:local ."
},
Expand All @@ -30,20 +30,21 @@
"@babel/preset-env": "^7.14.2",
"@babel/preset-typescript": "^7.13.0",
"@types/jest": "^26.0.23",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"@types/swagger-ui-express": "^4.1.3",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"babel-jest": "^27.0.1",
"concurrently": "^6.2.0",
"dotenv": "^10.0.0",
"eslint": "^8.26.0",
"concurrently": "^7.5.0",
"dotenv": "^16.0.3",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.3",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint_d": "^10.1.2",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint_d": "^12.2.1",
"jest": "^27.0.1",
"mock-req": "^0.2.0",
"mock-res": "^0.5.0",
Expand All @@ -56,7 +57,12 @@
"typescript": "^4.3.2"
},
"dependencies": {
"lerna": "^6.0.1"
"eslint-config-react-app": "^7.0.1",
"lerna": "^6.0.1",
"orval": "^6.10.3",
"server": "^1.0.37",
"swagger-ui-express": "^4.6.0",
"tsoa": "^4.1.3"
},
"prettier": {
"trailingComma": "es5",
Expand Down
18 changes: 18 additions & 0 deletions packages/client/orval.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// const { faker } = require("@faker-js/faker");
module.exports = {
celluloid: {
output: {
mode: "split",
target: "src/api/index.ts",
schemas: "src/api/model",
client: "react-query",
mock: false,
},
input: {
target: "../server/public/swagger.json"
},
hooks: {
afterAllFilesWrite: "prettier --write",
},
},
};
3 changes: 2 additions & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"generate-api": "orval"
},
"dependencies": {
"@celluloid/types": "^0.1.0",
Expand Down
Loading