Skip to content

Commit ac58906

Browse files
authored
Experimenting with DMCG flags to have more readable pydantic models (#2)
* update dmcg * test more flags * ruff format * added model typestrings * experiment with dmcg flags * regen with current flags * delete old files * move fast break things * regen models using non dotted schema names * init py * renamed final module to models * readme * added versions
1 parent f5756c1 commit ac58906

File tree

78 files changed

+26971
-21234
lines changed

Some content is hidden

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

78 files changed

+26971
-21234
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,10 @@ cython_debug/
170170
# PyPI configuration file
171171
.pypirc
172172

173-
.envrc
173+
.envrc
174+
175+
private
176+
177+
# build dir contains the cloned specs
178+
# from which we generate the pydantic classes
179+
build

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
# Pydantic EDA
22

3-
**WIP!**
4-
53
Pydantic models for EDA OpenAPI spec. Models are generated for the EDA Core API as well as for the apps shipped with EDA Playground at the time of the generation.
64

75
## Usage
86

97
## Generation
108

11-
Store Github auth token in a `GH_AUTH_TOKEN` environment variable. For example, with `gh` cli:
9+
Install dev dependencies:
1210

1311
```
14-
export GH_AUTH_TOKEN=$(gh auth token)
12+
uv sync --all-groups
1513
```
1614

17-
Install dev dependencies:
15+
Generate models for a specific version of the openapi repo (git ref):
1816

1917
```
20-
uv add --dev 'datamodel-code-generator[http]' rich ruff httpx
18+
python gen_models.py --version v25.4.1
2119
```
2220

23-
Generate models for a specific version of openapi repo:
21+
The generation script clones the eda-labs/openapi repo at the provided ref and generated models from there.
2422

25-
```
26-
python gen_models.py --version v24.12.1
27-
```
23+
## Modifications
24+
25+
The generation script transforms all schema objects in the source openapi files by removing `com.nokia.eda.<name>.<version>`, as DMCG project has issues with treating schema nodes with dots in their names as module-based schemas. Therefore, the original schema nodes undergo that mutation by the script.
26+
27+
## Versions
28+
29+
The following table matches the project version with the version of the EDA delivery from which the models were generated.
30+
31+
| pydantic_eda | EDA release |
32+
| ------------ | ----------- |
33+
| 0.3.0 | 25.4.1 |

cached_specs.json

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

0 commit comments

Comments
 (0)