Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 61015e7

Browse files
Merge pull request #188 from regulaforensics/new-generator
NEW GENERATOR
2 parents 6697fd9 + e107c27 commit 61015e7

File tree

300 files changed

+24211
-37511
lines changed

Some content is hidden

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

300 files changed

+24211
-37511
lines changed

‎.openapi-generator-ignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ README.md
1111
.gitignore
1212
setup.py
1313
regula/documentreader/webclient/__init__.py
14+
pyproject.toml
15+
.github/workflows/python.yml

‎.openapi-generator/FILES‎

Lines changed: 99 additions & 23 deletions
Large diffs are not rendered by default.

‎.openapi-generator/VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
7.12.0

‎Pipfile‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ name = "pypi"
66
[packages]
77
certifi = ">=2024年07月04日"
88
six = ">=1.10"
9-
python-dateutil = ">=2.5.3"
10-
urllib3 = ">=1.26.19"
9+
python-dateutil = ">=2.8.2"
10+
urllib3 = ">=1.25.3, <3.0.0"
1111
vistir = ">=0.4.0, <=0.6.1"
1212
idna = "==3.7"
1313
requests = ">=2.32.3"
14+
pydantic = ">=2"
15+
typing-extensions = ">=4.7.1"
1416

1517
[dev-packages]
1618
setuptools = "==74.1.1"
1719
wheel = "*"
1820
twine = "*"
1921
chardet = "*"
2022
packaging = ">=22.0"
23+
types-python-dateutil = ">=2.8.19.14"
24+
mypy = ">=1.5"
2125

2226
[requires]
2327
python_version = "3.8"

‎Pipfile.lock‎

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

‎dev.md‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
# Development
22

3-
To regenerate models, clone [latest OpenAPI definitions](https://github.com/regulaforensics/DocumentReader-web-openapi)
4-
and use next command from the project root:
3+
Models generation based on [openapi spec](https://github.com/regulaforensics/DocumentReader-api-openapi).
4+
5+
## Generation
6+
7+
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.
510
```bash
611
./update-models.sh
712
```
13+
14+
## Generator configuration Features
15+
16+
1. When generating oneOf schemas, the generator creates its
17+
own abstract class, which does not look like it would like.
18+
The problem was solved by replacing the abstract generator
19+
class with ours using typeMappings in the generator config.
20+
2. The generator treats the discriminator value as a string,
21+
but in our case it's numbers. To solve this problem, changes
22+
have been made to the model_generic.mustache template.
23+
24+
## Problem solving
25+
26+
To solve new problems, use the generator
27+
settings ([python](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/python.md),
28+
[common](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md))
29+
and [templates](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/python).
30+
31+
**Do not edit the generated files! They will be overwritten after generation!**

‎example/README.md‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,29 @@ API_BASE_PATH="http://127.0.0.1:8080" python example.py
5454
```
5555

5656
### Output
57+
5758
This sample generates the following text output:
59+
5860
```text
5961
---------------------------------------------------------------------------
60-
Document Overall Status: not valid
61-
Document Number Visual: OO0000000
62-
Document Number MRZ: OO0000000
63-
Validity Of Document Number Visual: 0
64-
Validity Of Document Number MRZ: 0
65-
MRZ-Visual values comparison: 1
62+
Web API version: 7.5.308602.1848
6663
---------------------------------------------------------------------------
64+
Document Overall Status: not valid
65+
Document Number Visual: C01YPTNHM
66+
Document Type: Germany - ePassport (2017) Service
67+
Validity Of Document Number Visual: 2
68+
69+
-----------------------All Text Fields------------------------
70+
Source: Surname, Value: MUSTERMANN
71+
Source: Surname And Given Names, Value: MUSTERMANN ERIKA
72+
Source: Document Status, Value: SPECIMEN
73+
Source: Surname, Value: MUSTERMANN
74+
Source: Surname And Given Names, Value: MUSTERMANN ERIKA
75+
Source: Document Number Checkdigit, Value: 1
76+
Source: Document Class Code, Value: PO
77+
78+
...
6779
```
80+
6881
Also, it stores [portrait](portrait.jpg) and [document image](document-image.jpg) images in the current folder.
6982
You can modify [this example](../example/example.py) and re-run it to get your own results.

‎example/encrypted-rcl.txt‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎example/example-rcl.py‎

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

‎example/example.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"X-CLIENT-KEY": "123",
2525
"Authorization": "Bearer 123"
2626
}
27-
params = ProcessParams(already_cropped=True, scenario=Scenario.FULL_PROCESS)
27+
params = ProcessParams(alreadyCropped=True, scenario=Scenario.FULLPROCESS)
2828

2929
# Add license to request
3030
# request = RecognitionRequest(system_info=ProcessSystemInfo(license=base64.b64encode(regula_license).decode()), process_params=params, images=[
@@ -38,8 +38,8 @@
3838
])
3939
response = api.process(request)
4040

41-
request_json = request.json # example for request & response raw json
42-
response_json = response.json
41+
request_json = request.to_json() # example for request & response raw json
42+
response_json = response.to_json()
4343

4444
# status examples
4545
response_status = response.status

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /