Skip to content

Commit

Permalink
experimental: Build pydantic from schema
Browse files Browse the repository at this point in the history
  • Loading branch information
JB Lovland committed Jan 11, 2024
1 parent b204db8 commit cc39ad7
Show file tree
Hide file tree
Showing 3 changed files with 522 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

datamodel-codegen \
--disable-timestamp \
--enable-version-header \
--enum-field-as-literal one \
--field-constraints \
--input $1 \
--input-file-type "jsonschema" \
--output-model-type pydantic_v2.BaseModel \
--snake-case-field \
--strict-nullable \
--target-python-version 3.8 \
--use-default-kwarg \
--use-double-quotes \
--use-schema-description \
--use-standard-collections \
--use-subclass-enum \
--use-title-as-name \
--use-union-operator
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"numpy",
"pandas",
"pyarrow",
"pydantic>=2.0.0",
"PyYAML",
"xtgeo>=2.16",
]
Expand Down
Loading

0 comments on commit cc39ad7

Please sign in to comment.