File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,18 @@ mkdir -p "$ROOT_DIR/$OUTPUT_DIR"
2222echo " # generated by generate-python-dataclasses" > " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2323echo " name = 'models'" >> " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2424
25- for f in " $ROOT_DIR /$YAML_DIR " /* .yaml; do
25+ if [ -f $ROOT_DIR /$YAML_DIR /airbyte_protocol.yaml ]; then
26+ echo ERROR: File airbyte_protocol.yaml exists in both $ROOT_DIR /$YAML_DIR and $ROOT_DIR /$YAML_DIR /v0. Only one is expected
27+ exit 1
28+ fi
29+
30+ for f in " $ROOT_DIR /$YAML_DIR " /* .yaml " $ROOT_DIR /$YAML_DIR " /v0/airbyte_protocol.yaml; do
2631 filename_wo_ext=$( basename " $f " | cut -d . -f 1)
2732 echo " from .$filename_wo_ext import *" >> " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2833
2934 datamodel-codegen \
3035 --input-file-type jsonschema \
31- --input " $ROOT_DIR / $YAML_DIR / $filename_wo_ext .yaml " \
36+ --input " $f " \
3237 --output " $ROOT_DIR /$OUTPUT_DIR /$filename_wo_ext .py" \
3338 --output-model-type dataclasses.dataclass \
3439 --target-python-version 3.9 \
Original file line number Diff line number Diff line change @@ -22,13 +22,18 @@ mkdir -p "$ROOT_DIR/$OUTPUT_DIR"
2222echo " # generated by generate-python-pydantic-v2" > " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2323echo " name = 'models'" >> " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2424
25- for f in " $ROOT_DIR /$YAML_DIR " /* .yaml; do
25+ if [ -f $ROOT_DIR /$YAML_DIR /airbyte_protocol.yaml ]; then
26+ echo ERROR: File airbyte_protocol.yaml exists in both $ROOT_DIR /$YAML_DIR and $ROOT_DIR /$YAML_DIR /v0. Only one is expected
27+ exit 1
28+ fi
29+
30+ for f in " $ROOT_DIR /$YAML_DIR " /* .yaml " $ROOT_DIR /$YAML_DIR " /v0/airbyte_protocol.yaml; do
2631 filename_wo_ext=$( basename " $f " | cut -d . -f 1)
2732 echo " from .$filename_wo_ext import *" >> " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2833
2934 datamodel-codegen \
3035 --input-file-type jsonschema \
31- --input " $ROOT_DIR / $YAML_DIR / $filename_wo_ext .yaml " \
36+ --input " $f " \
3237 --output " $ROOT_DIR /$OUTPUT_DIR /$filename_wo_ext .py" \
3338 --output-model-type pydantic_v2.BaseModel \
3439 --target-python-version 3.10 \
Original file line number Diff line number Diff line change @@ -22,12 +22,17 @@ mkdir -p "$ROOT_DIR/$OUTPUT_DIR"
2222echo " # generated by generate-python-pydantic.sh" > " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2323echo " name = 'models'" >> " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2424
25- for f in " $ROOT_DIR /$YAML_DIR " /* .yaml; do
25+ if [ -f $ROOT_DIR /$YAML_DIR /airbyte_protocol.yaml ]; then
26+ echo ERROR: File airbyte_protocol.yaml exists in both $ROOT_DIR /$YAML_DIR and $ROOT_DIR /$YAML_DIR /v0. Only one is expected
27+ exit 1
28+ fi
29+
30+ for f in " $ROOT_DIR /$YAML_DIR " /* .yaml " $ROOT_DIR /$YAML_DIR " /v0/airbyte_protocol.yaml; do
2631 filename_wo_ext=$( basename " $f " | cut -d . -f 1)
2732 echo " from .$filename_wo_ext import *" >> " $ROOT_DIR /$OUTPUT_DIR " /__init__.py
2833
2934 datamodel-codegen \
30- --input " $ROOT_DIR / $YAML_DIR / $filename_wo_ext .yaml " \
35+ --input " $f " \
3136 --output " $ROOT_DIR /$OUTPUT_DIR /$filename_wo_ext .py" \
3237 --use-title-as-name \
3338 --disable-timestamp
You can’t perform that action at this time.
0 commit comments