Skip to content

Commit

Permalink
Feature/df 423.update pydantic version (#16)
Browse files Browse the repository at this point in the history
* DF-423: add pydantic version and text replace

* DF-423: carret for version

---------

Co-authored-by: Sebastian Lacki <[email protected]>
  • Loading branch information
adamMQM and slacki123 authored Apr 10, 2024
1 parent 8491fd6 commit 4ccce27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions generate/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ do
echo "$new_contents" > $file
done

# list all API files, and text replace. Workaround until we start using pydantic directly with OpenApi generator
api_files=$(find $sdk_output_folder/$app_name/api -type f -maxdepth 1)
for file in $api_files
do
# replace "from pydantic import" with "from pydantic.v1 import"
new_contents=$(sed 's/from pydantic import/from pydantic.v1 import/' $file)
echo "$new_contents" > $file
done

(
cd $sdk_output_folder;
poetry install;
Expand Down
2 changes: 1 addition & 1 deletion generate/templates/model_generic.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import json

{{#vendorExtensions.x-py-datetime-imports}}{{#-first}}from datetime import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-datetime-imports}}
{{#vendorExtensions.x-py-typing-imports}}{{#-first}}from typing import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-typing-imports}}
{{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}}
{{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic.v1 import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}}
{{#vendorExtensions.x-py-model-imports}}
{{{.}}}
{{/vendorExtensions.x-py-model-imports}}
Expand Down
2 changes: 1 addition & 1 deletion generate/templates/pyproject.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tornado = "^4.2"
pem = "^19.3.0"
pycryptodome = "^3.9.0"
{{/hasHttpSignatureMethods}}
pydantic = "^1.10.5"
pydantic = "^2.6.3"
aenum = "^3.1.11"

[tool.poetry.dev-dependencies]
Expand Down

0 comments on commit 4ccce27

Please sign in to comment.