Skip to content

Commit e8dec07

Browse files
Merge pull request #194 from regulaforensics/new-openapi
UPDATED GENERATOR
2 parents 83bb674 + f174d3f commit e8dec07

File tree

287 files changed

+11799
-5405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+11799
-5405
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/sast.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
# List of paths (space separated) to ignore
1717
# Supports PATTERNS
1818
# EXCLUDE_PATHS: 'foo bar/baz file.txt dir/*.yml'
19-
EXCLUDE_PATHS: 'examples'
19+
EXCLUDE_PATHS: 'examples generator-templates'
2020
# List of rules (space separated) to ignore
2121
# EXCLUDE_RULES: 'generic.secrets.security.detected-aws-account-id.detected-aws-account-id'
2222
# See https://github.com/semgrep/semgrep-rules for rules registry

dev.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
# Development
22

3-
Js client is written using typescript, mainly generated from [openapi spec](https://github.com/regulaforensics/DocumentReader-api-openapi).
4-
Openapi-generator output used as implementation base(see packages `/src/api`, `/scr/models`).
5-
All custom logic, on top of generated files, should be places in `/src/ext` folder.
3+
Models generation based on [openapi spec](https://github.com/regulaforensics/DocumentReader-api-openapi).
4+
5+
## Generation
66

77
To regenerate models from openapi definition,
8-
clone [latest open api definitions](https://github.com/regulaforensics/DocumentReader-api-openapi)
9-
and use next command from the project root:
8+
clone [latest open api definitions](https://github.com/regulaforensics/DocumentReader-api-openapi)
9+
and use next command from the project root.
1010
```bash
1111
./update-models.sh
1212
```
13+
14+
## Generator configuration Features
15+
16+
1. The generator treats the discriminator value as a string,
17+
but in our case it's numbers. To solve this problem, changes
18+
have been made to the modelOneOf.mustache template.
19+
20+
## Problem solving
21+
22+
To solve new problems, use the generator
23+
settings ([typescript](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/typescript-axios.md),
24+
[common](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md))
25+
and [templates](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/typescript-axios).
26+
27+
**Do not edit the generated files! They will be overwritten after generation!**

eslint.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import prettierRecommended from 'eslint-plugin-prettier/recommended';
5+
6+
export default [
7+
{
8+
files: ['**/*.{js,mjs,cjs,ts}'],
9+
},
10+
{
11+
languageOptions: {
12+
globals: { ...globals.browser, ...globals.node },
13+
},
14+
},
15+
pluginJs.configs.recommended,
16+
...tseslint.configs.recommended,
17+
prettierRecommended,
18+
{
19+
ignores: ['dist/*', 'lib/*', '!.*'],
20+
},
21+
{
22+
rules: {
23+
'@typescript-eslint/no-explicit-any': 'off',
24+
'@typescript-eslint/no-unused-vars': 'off',
25+
},
26+
},
27+
];

examples/auth/client/package-lock.json

Lines changed: 18 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/auth/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"dependencies": {
55
"@regulaforensics/document-reader-webclient": "file:../../..",
6-
"axios": "^1.8.3",
6+
"axios": "^1.8.4",
77
"qs": "^6.14.0"
88
},
99
"version": "0.0.0"

examples/auth/server/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/auth/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "node index.js"
1010
},
1111
"dependencies": {
12-
"axios": "^1.8.3",
12+
"axios": "^1.8.4",
1313
"body-parser": "^1.20.3",
1414
"cors": "^2.8.5",
1515
"express": "^5.0.1",

examples/basic/README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,34 @@ If the instance has been launched successfully, use the following line command t
5454
API_BASE_PATH="http://127.0.0.1:8080" node .
5555
```
5656

57+
### Output
5758

58-
59-
### Output
6059
This sample generates the following text output:
60+
6161
```text
62-
---------------------------------------------------------------------------
63-
Document Overall Status: 0
64-
Document Number Visual: OO0000000
65-
Document Number MRZ: OO0000000
66-
Validity Of Document Number Visual: 0
67-
Validity Of Document Number MRZ: 0
68-
MRZ-Visual values comparison: 1
69-
---------------------------------------------------------------------------
62+
---------------------------------------------------------------
63+
Document name: Germany - ePassport (2017) Service
64+
---------------------------------------------------------------
65+
66+
[Surname]
67+
- Source: VISUAL
68+
Value : MUSTERMANN
69+
---------------------------------------------------------------
70+
71+
[Surname And Given Names]
72+
- Source: VISUAL
73+
Value : MUSTERMANN ERIKA
74+
---------------------------------------------------------------
75+
76+
[Document Status]
77+
- Source: MRZ
78+
Value : SPECIMEN
79+
- Source: VISUAL
80+
Value : SPECIMEN
81+
82+
...
7083
```
84+
7185
Also, it stores [portrait](portrait.jpg) and [document image](document-image.jpg) images in the current folder.
72-
You can modify [this example](/index.js)
86+
You can modify [this example](./index.js)
7387
and re-run it to get your own results.

0 commit comments

Comments
 (0)