very-express 0.4.11 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +37 -37
- package/.gitattributes +2 -2
- package/.github/workflows/npm-publish.yml +38 -0
- package/LICENSE +21 -21
- package/README.md +61 -60
- package/docs/developmentNote.md +22 -22
- package/docs/roadMap/RoadMap.md +30 -30
- package/docs/roadMap/v0-5-0.md +19 -19
- package/docs/roadMap/v0-6-0.md +6 -6
- package/docs/roadMap/v0-7-0.md +3 -3
- package/docs/vexJsonSchema.md +54 -54
- package/package.json +59 -59
- package/scripts/build.js +13 -13
- package/scripts/copyTsTemplates.js +24 -24
- package/tsconfig.json +121 -121
- package/vex.config.json +1 -1
- package/dist/index.js +0 -1441
- package/dist/templates/_controller/_ControllerFactory.ts +0 -7
- package/dist/templates/_controllers/_ControllerFactory.ts +0 -9
- package/dist/templates/_plugins/PassportGoogle.ts +0 -84
- package/dist/templates/_plugins/oauthVerify.ts +0 -39
- package/dist/templates/_roles/_RoleFactory.ts +0 -22
- package/dist/templates/_services/VexDbConnector.ts +0 -70
- package/dist/templates/_types/responseMsg.ts +0 -20
- package/dist/templates/_utils/common.ts +0 -53
- package/dist/templates/_utils/index.ts +0 -13
- package/dist/templates/_utils/logger.ts +0 -55
- package/dist/templates/_utils/response.ts +0 -27
- package/dist/templates/_utils/validator.ts +0 -7
- package/dist/templates/jsonSchema/User.json +0 -56
- package/dist/templates/root/.env +0 -5
- package/dist/templates/root/README.md +0 -33
- package/dist/templates/root/package.json +0 -40
- package/dist/templates/root/tsconfig.json +0 -22
package/.eslintrc.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended"
|
|
9
|
-
],
|
|
10
|
-
"parser": "@typescript-eslint/parser",
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": "latest",
|
|
13
|
-
"sourceType": "module"
|
|
14
|
-
},
|
|
15
|
-
"plugins": [
|
|
16
|
-
"@typescript-eslint"
|
|
17
|
-
],
|
|
18
|
-
"rules": {
|
|
19
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
20
|
-
"indent": [
|
|
21
|
-
"error",
|
|
22
|
-
4
|
|
23
|
-
],
|
|
24
|
-
"linebreak-style": [
|
|
25
|
-
"error",
|
|
26
|
-
"unix"
|
|
27
|
-
],
|
|
28
|
-
"quotes": [
|
|
29
|
-
"error",
|
|
30
|
-
"double"
|
|
31
|
-
],
|
|
32
|
-
"semi": [
|
|
33
|
-
"error",
|
|
34
|
-
"always"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended"
|
|
9
|
+
],
|
|
10
|
+
"parser": "@typescript-eslint/parser",
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"ecmaVersion": "latest",
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
"plugins": [
|
|
16
|
+
"@typescript-eslint"
|
|
17
|
+
],
|
|
18
|
+
"rules": {
|
|
19
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
20
|
+
"indent": [
|
|
21
|
+
"error",
|
|
22
|
+
4
|
|
23
|
+
],
|
|
24
|
+
"linebreak-style": [
|
|
25
|
+
"error",
|
|
26
|
+
"unix"
|
|
27
|
+
],
|
|
28
|
+
"quotes": [
|
|
29
|
+
"error",
|
|
30
|
+
"double"
|
|
31
|
+
],
|
|
32
|
+
"semi": [
|
|
33
|
+
"error",
|
|
34
|
+
"always"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
package/.gitattributes
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
# Auto detect text files and perform LF normalization
|
|
2
|
-
* text=auto
|
|
1
|
+
# Auto detect text files and perform LF normalization
|
|
2
|
+
* text=auto
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: 22
|
|
21
|
+
- run: npm ci
|
|
22
|
+
- run: npm run build
|
|
23
|
+
- run: node ./dist/index.js -i
|
|
24
|
+
- run: npm run start
|
|
25
|
+
|
|
26
|
+
publish-npm:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-node@v3
|
|
32
|
+
with:
|
|
33
|
+
node-version: 22
|
|
34
|
+
registry-url: https://registry.npmjs.org/
|
|
35
|
+
- run: npm version patch --no-git-tag-version
|
|
36
|
+
- run: npm publish
|
|
37
|
+
env:
|
|
38
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 justin26l
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 justin26l
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
# VeryExpress
|
|
2
|
-
this is a generator to make [Express](https://github.com/expressjs/express) REST API app based on [Json Schema](https://github.com/json-schema-org) and [Open Api](https://github.com/OAI)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Why?
|
|
6
|
-
bored on writing CRUD API time after time ?
|
|
7
|
-
then this tool might save your time,
|
|
8
|
-
all you need is define the **Json Schema** files.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# Quick Start
|
|
12
|
-
1. install package globally.
|
|
13
|
-
```npm i -g very-express```
|
|
14
|
-
|
|
15
|
-
3. use cli to initialize configuration file **vex.config.json** under your project root directory.
|
|
16
|
-
`vex -init`
|
|
17
|
-
|
|
18
|
-
2. create a empty directory name it as value of vex.config's "jsonSchemaDir", default
|
|
19
|
-
`mkdir jsonSchema`.
|
|
20
|
-
|
|
21
|
-
4.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
├──
|
|
31
|
-
|
|
32
|
-
├──
|
|
33
|
-
└──
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
npm
|
|
43
|
-
npm
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- [
|
|
58
|
-
- [
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
# VeryExpress
|
|
2
|
+
this is a generator to make [Express](https://github.com/expressjs/express) REST API app based on [Json Schema](https://github.com/json-schema-org) and [Open Api](https://github.com/OAI)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Why?
|
|
6
|
+
bored on writing CRUD API time after time ?
|
|
7
|
+
then this tool might save your time,
|
|
8
|
+
all you need is define the **Json Schema** files.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Quick Start
|
|
12
|
+
1. install package globally.
|
|
13
|
+
```npm i -g very-express```
|
|
14
|
+
|
|
15
|
+
3. use cli to initialize configuration file **vex.config.json** under your project root directory.
|
|
16
|
+
`vex -init`
|
|
17
|
+
|
|
18
|
+
2. create a empty directory and name it as value of vex.config's "jsonSchemaDir", by default `jsonSchema`.
|
|
19
|
+
`mkdir jsonSchema`.
|
|
20
|
+
|
|
21
|
+
4. you can create your db collection/table now in directory `./jsonSchema` just created,
|
|
22
|
+
refer to [Define Json Schmea](./docs/vexJsonSchema.md),
|
|
23
|
+
every changes require to regenerate app.
|
|
24
|
+
|
|
25
|
+
6. generate the app with vex.config param.
|
|
26
|
+
`vex`
|
|
27
|
+
|
|
28
|
+
7. you should saw a express typescript app being generated (with src, package.json etc) .
|
|
29
|
+
```
|
|
30
|
+
├── jsonSchema/
|
|
31
|
+
│ └── ...
|
|
32
|
+
├── src/
|
|
33
|
+
│ └── ...
|
|
34
|
+
├── package.json
|
|
35
|
+
├── tsconfig.json
|
|
36
|
+
├── vex.config.json
|
|
37
|
+
└── .env
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
8. start the generated express app.
|
|
41
|
+
```
|
|
42
|
+
npm i
|
|
43
|
+
npm build
|
|
44
|
+
npm run start
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
# Feature Supported
|
|
48
|
+
- generate REST API server
|
|
49
|
+
- API Validator by [express-validator](https://express-validator.github.io/docs/)
|
|
50
|
+
- generate OpenApi
|
|
51
|
+
- [Swagger UI Express](https://github.com/scottie1984/swagger-ui-express)
|
|
52
|
+
- OAuth by [Passport.js](https://www.passportjs.org/)
|
|
53
|
+
- Database Driver
|
|
54
|
+
- MongoDB by [Mongoose](https://mongoosejs.com/)
|
|
55
|
+
|
|
56
|
+
# Resource
|
|
57
|
+
- [Documents](./docs/)
|
|
58
|
+
- [Road Map](./docs/roadMap/)
|
|
59
|
+
- [ReleaseNote](./docs/releaseNote)
|
|
60
|
+
|
|
61
|
+
- [Discord](https://discord.gg/PZGMzDp7)
|
package/docs/developmentNote.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# Development Note
|
|
2
|
-
- "Project" or "The Project" is refer to this package which named "VeryExpress", github repository "[Justin26l/VeryExpress](https://github.com/Justin26l/VeryExpress)", npm package "[very-express](https://www.npmjs.com/package/very-express)".
|
|
3
|
-
|
|
4
|
-
- "Package" is refer to one of the node module, npm package, third-party library.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
1. **TypeScript**
|
|
8
|
-
this project is based on [TypeScript](https://www.typescriptlang.org/).
|
|
9
|
-
we do not use ts-node in development due to file structure of the project,
|
|
10
|
-
you can refer to [package.json](./../package.json) "dev" script to know how to run the project in development.
|
|
11
|
-
|
|
12
|
-
2. **Esbuild**
|
|
13
|
-
the project require to compile into bundle to run.
|
|
14
|
-
due to the single file design, working directory of the project will always be at "dist/".
|
|
15
|
-
refer to [package.json](./../package.json) `scripts > compile`.
|
|
16
|
-
|
|
17
|
-
3. **File Generate Template**
|
|
18
|
-
if there is any function calling pass by object need to be write in file output,
|
|
19
|
-
use syntax: `FUNC{{ <myFunc(){...}> }}`.
|
|
20
|
-
refer to :
|
|
21
|
-
1. [controller custom validatior](./../src/generators/controller/controllers.generator.ts#L<202>)
|
|
22
|
-
2. [controller template return](./../src/generators/controller/controller.template.ts#L<246>)
|
|
1
|
+
# Development Note
|
|
2
|
+
- "Project" or "The Project" is refer to this package which named "VeryExpress", github repository "[Justin26l/VeryExpress](https://github.com/Justin26l/VeryExpress)", npm package "[very-express](https://www.npmjs.com/package/very-express)".
|
|
3
|
+
|
|
4
|
+
- "Package" is refer to one of the node module, npm package, third-party library.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
1. **TypeScript**
|
|
8
|
+
this project is based on [TypeScript](https://www.typescriptlang.org/).
|
|
9
|
+
we do not use ts-node in development due to file structure of the project,
|
|
10
|
+
you can refer to [package.json](./../package.json) "dev" script to know how to run the project in development.
|
|
11
|
+
|
|
12
|
+
2. **Esbuild**
|
|
13
|
+
the project require to compile into bundle to run.
|
|
14
|
+
due to the single file design, working directory of the project will always be at "dist/".
|
|
15
|
+
refer to [package.json](./../package.json) `scripts > compile`.
|
|
16
|
+
|
|
17
|
+
3. **File Generate Template**
|
|
18
|
+
if there is any function calling pass by object need to be write in file output,
|
|
19
|
+
use syntax: `FUNC{{ <myFunc(){...}> }}`.
|
|
20
|
+
refer to :
|
|
21
|
+
1. [controller custom validatior](./../src/generators/controller/controllers.generator.ts#L<202>)
|
|
22
|
+
2. [controller template return](./../src/generators/controller/controller.template.ts#L<246>)
|
|
23
23
|
3. [template formatter function](./../src/utils/template.ts#L<6>)
|
package/docs/roadMap/RoadMap.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# Road Map
|
|
2
|
-
|
|
3
|
-
## Compatibility
|
|
4
|
-
|
|
5
|
-
- [ ] Dockernize
|
|
6
|
-
|
|
7
|
-
- [x] Generate App
|
|
8
|
-
- [x] generate openapi based on json schema
|
|
9
|
-
- [x] generate controllers based on openapi
|
|
10
|
-
- [x] CRUD API
|
|
11
|
-
- [x] data validation (express-validator)
|
|
12
|
-
|
|
13
|
-
- [ ] Database
|
|
14
|
-
- [x] MongoDB
|
|
15
|
-
- SQL **(ON HOLD)**
|
|
16
|
-
|
|
17
|
-
- [ ] OAuth2
|
|
18
|
-
- [x] google
|
|
19
|
-
- [ ] microsoft
|
|
20
|
-
- [ ] github
|
|
21
|
-
|
|
22
|
-
## Features
|
|
23
|
-
|
|
24
|
-
- [ ] Schema Definition
|
|
25
|
-
- [ ] App level foreign-key. `x-foreign-key`
|
|
26
|
-
- [ ] DB field encryption. `x-encrypt`
|
|
27
|
-
|
|
28
|
-
- [x] Role Base Access Control
|
|
29
|
-
- [x] API access control
|
|
30
|
-
- different controller data validation rule by role **(ON HOLD)**
|
|
1
|
+
# Road Map
|
|
2
|
+
|
|
3
|
+
## Compatibility
|
|
4
|
+
|
|
5
|
+
- [ ] Dockernize
|
|
6
|
+
|
|
7
|
+
- [x] Generate App
|
|
8
|
+
- [x] generate openapi based on json schema
|
|
9
|
+
- [x] generate controllers based on openapi
|
|
10
|
+
- [x] CRUD API
|
|
11
|
+
- [x] data validation (express-validator)
|
|
12
|
+
|
|
13
|
+
- [ ] Database
|
|
14
|
+
- [x] MongoDB
|
|
15
|
+
- SQL **(ON HOLD)**
|
|
16
|
+
|
|
17
|
+
- [ ] OAuth2
|
|
18
|
+
- [x] google
|
|
19
|
+
- [ ] microsoft
|
|
20
|
+
- [ ] github
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- [ ] Schema Definition
|
|
25
|
+
- [ ] App level foreign-key. `x-foreign-key`
|
|
26
|
+
- [ ] DB field encryption. `x-encrypt`
|
|
27
|
+
|
|
28
|
+
- [x] Role Base Access Control
|
|
29
|
+
- [x] API access control
|
|
30
|
+
- different controller data validation rule by role **(ON HOLD)**
|
package/docs/roadMap/v0-5-0.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# v0.5.0 Plan
|
|
2
|
-
|
|
3
|
-
### App level foreign-key
|
|
4
|
-
- [ ] at JsonSchmea properties item, add attribute `x-foreignKey: "collectionName"`
|
|
5
|
-
use this column value to match with target collectionName's "_id" fields.
|
|
6
|
-
```JSON
|
|
7
|
-
{
|
|
8
|
-
"invoiceId": {
|
|
9
|
-
"type" : "string",
|
|
10
|
-
"x-foreignKey" : "invoice"
|
|
11
|
-
},
|
|
12
|
-
"orderId": {
|
|
13
|
-
"type" : "string",
|
|
14
|
-
"x-foreignKey" : "order"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
- [ ] REST API, to request data with foreign-key collection:
|
|
19
|
-
add field name as stringified array into querystring "join"
|
|
1
|
+
# v0.5.0 Plan
|
|
2
|
+
|
|
3
|
+
### App level foreign-key
|
|
4
|
+
- [ ] at JsonSchmea properties item, add attribute `x-foreignKey: "collectionName"`
|
|
5
|
+
use this column value to match with target collectionName's "_id" fields.
|
|
6
|
+
```JSON
|
|
7
|
+
{
|
|
8
|
+
"invoiceId": {
|
|
9
|
+
"type" : "string",
|
|
10
|
+
"x-foreignKey" : "invoice"
|
|
11
|
+
},
|
|
12
|
+
"orderId": {
|
|
13
|
+
"type" : "string",
|
|
14
|
+
"x-foreignKey" : "order"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
- [ ] REST API, to request data with foreign-key collection:
|
|
19
|
+
add field name as stringified array into querystring "join"
|
|
20
20
|
example `/myDataApi?join=[invoiceId,orderId]`
|
package/docs/roadMap/v0-6-0.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# v0.6.0 Plan
|
|
2
|
-
|
|
3
|
-
### dockernize
|
|
4
|
-
- [ ] dockernize
|
|
5
|
-
### oauth2 support
|
|
6
|
-
- [ ] microsoft
|
|
1
|
+
# v0.6.0 Plan
|
|
2
|
+
|
|
3
|
+
### dockernize
|
|
4
|
+
- [ ] dockernize
|
|
5
|
+
### oauth2 support
|
|
6
|
+
- [ ] microsoft
|
|
7
7
|
- [ ] github
|
package/docs/roadMap/v0-7-0.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# v0.7.0 Plan
|
|
2
|
-
|
|
3
|
-
## app level foreign-key.
|
|
1
|
+
# v0.7.0 Plan
|
|
2
|
+
|
|
3
|
+
## app level foreign-key.
|
|
4
4
|
- [ ] db fields encryption
|
package/docs/vexJsonSchema.md
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
# Define Json Schema for VeryExpress
|
|
2
|
-
|
|
3
|
-
## x-documentConfig:
|
|
4
|
-
|
|
5
|
-
| Fields | Data Type | Options | Description |
|
|
6
|
-
| - | - | - | - |
|
|
7
|
-
| documentName | `string` | - | auto generated using file name. used to name **Collection**, **TS Interface**, **ODM Model** etc. |
|
|
8
|
-
| methods | `array<string>` | `get`, `post`, `put`, `patch`, `delete` | array of **REST API Method** to be enable. |
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Properties Definition:
|
|
12
|
-
|
|
13
|
-
| Fields | Data Type | Required | options | Description |
|
|
14
|
-
| - | - | - | - | - |
|
|
15
|
-
| type | `string` | true | - | [JsonSchema's type field](https://json-schema.org/understanding-json-schema/reference/type) |
|
|
16
|
-
| required | `boolean` | false | - | rest api's validator will check value cannot be falsy / undefined. |
|
|
17
|
-
| x-vexData | `string` | false | `primaryKey`, `role` | determine veryExpress generation process. |
|
|
18
|
-
| x-foreignKey | - | - | - | `documentName` from other JsonSchema, auto index. plan to implemented on [v0.5.0](./RoadMap/v0-5-0.md) |
|
|
19
|
-
<!-- | format | `string` | false | - | veryExpress did not handle this field | -->
|
|
20
|
-
|
|
21
|
-
### System Fields
|
|
22
|
-
which mean there field properties is not changable.
|
|
23
|
-
- `_id` : if defined in schema, will auto set as `"index": true`, `"x-vexData": "ObjectId"`.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
#### Example :
|
|
27
|
-
```JSON
|
|
28
|
-
{
|
|
29
|
-
"x-documentConfig": {
|
|
30
|
-
"documentName": "user", // auto generated using name
|
|
31
|
-
"methods": [
|
|
32
|
-
"get",
|
|
33
|
-
"post",
|
|
34
|
-
"put",
|
|
35
|
-
"patch",
|
|
36
|
-
"delete"
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
"properties": {
|
|
40
|
-
"_id": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"index": true,
|
|
43
|
-
"x-vexData": "ObjectId"
|
|
44
|
-
},
|
|
45
|
-
"username": {
|
|
46
|
-
"type": "string"
|
|
47
|
-
},
|
|
48
|
-
"invoice_id": {
|
|
49
|
-
"type": "string",
|
|
50
|
-
"required": true,
|
|
51
|
-
"x-foreignKey": "invoice"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
# Define Json Schema for VeryExpress
|
|
2
|
+
|
|
3
|
+
## x-documentConfig:
|
|
4
|
+
|
|
5
|
+
| Fields | Data Type | Options | Description |
|
|
6
|
+
| - | - | - | - |
|
|
7
|
+
| documentName | `string` | - | auto generated using file name. used to name **Collection**, **TS Interface**, **ODM Model** etc. |
|
|
8
|
+
| methods | `array<string>` | `get`, `post`, `put`, `patch`, `delete` | array of **REST API Method** to be enable. |
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Properties Definition:
|
|
12
|
+
|
|
13
|
+
| Fields | Data Type | Required | options | Description |
|
|
14
|
+
| - | - | - | - | - |
|
|
15
|
+
| type | `string` | true | - | [JsonSchema's type field](https://json-schema.org/understanding-json-schema/reference/type) |
|
|
16
|
+
| required | `boolean` | false | - | rest api's validator will check value cannot be falsy / undefined. |
|
|
17
|
+
| x-vexData | `string` | false | `primaryKey`, `role` | determine veryExpress generation process. |
|
|
18
|
+
| x-foreignKey | - | - | - | `documentName` from other JsonSchema, auto index. plan to implemented on [v0.5.0](./RoadMap/v0-5-0.md) |
|
|
19
|
+
<!-- | format | `string` | false | - | veryExpress did not handle this field | -->
|
|
20
|
+
|
|
21
|
+
### System Fields
|
|
22
|
+
which mean there field properties is not changable.
|
|
23
|
+
- `_id` : if defined in schema, will auto set as `"index": true`, `"x-vexData": "ObjectId"`.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
#### Example :
|
|
27
|
+
```JSON
|
|
28
|
+
{
|
|
29
|
+
"x-documentConfig": {
|
|
30
|
+
"documentName": "user", // auto generated using name
|
|
31
|
+
"methods": [
|
|
32
|
+
"get",
|
|
33
|
+
"post",
|
|
34
|
+
"put",
|
|
35
|
+
"patch",
|
|
36
|
+
"delete"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"properties": {
|
|
40
|
+
"_id": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"index": true,
|
|
43
|
+
"x-vexData": "ObjectId"
|
|
44
|
+
},
|
|
45
|
+
"username": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"invoice_id": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"required": true,
|
|
51
|
+
"x-foreignKey": "invoice"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
55
|
```
|