Skip to content

Commit ae069e6

Browse files
authored
[Python] Update python-pydantic-v1 generator to respect the --git-host argument (#19404)
* Update pyproject.mustache chore(pyproject): replace static `github.com` with variable `{{{gitHost}}}` * chore: follow contribution guidelines
1 parent deb007b commit ae069e6

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

bin/configs/python-pydantic-v1.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ generatorName: python-pydantic-v1
22
outputDir: samples/openapi3/client/petstore/python-pydantic-v1
33
inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml
44
templateDir: modules/openapi-generator/src/main/resources/python-pydantic-v1
5+
gitHost: GIT_HOST
6+
gitUserId: GIT_USER_ID
7+
gitRepoId: GIT_REPO_ID
58
additionalProperties:
69
packageName: petstore_api
710
useOneOfDiscriminatorLookup: "true"

modules/openapi-generator/src/main/resources/python-pydantic-v1/pyproject.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "{{{appName}}}"
55
authors = ["{{infoName}}{{^infoName}}OpenAPI Generator Community{{/infoName}} <{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}>"]
66
license = "{{{licenseInfo}}}{{^licenseInfo}}NoLicense{{/licenseInfo}}"
77
readme = "README.md"
8-
repository = "https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}"
8+
repository = "https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}"
99
keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"]
1010
include = ["{{packageName}}/py.typed"]
1111

samples/openapi3/client/petstore/python-pydantic-v1/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Python 3.7+
1818
If the python package is hosted on a repository, you can install directly using:
1919

2020
```sh
21-
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
21+
pip install git+https://GIT_HOST/GIT_USER_ID/GIT_REPO_ID.git
2222
```
23-
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
23+
(you may need to run `pip` with root permission: `sudo pip install git+https://GIT_HOST/GIT_USER_ID/GIT_REPO_ID.git`)
2424

2525
Then import the package:
2626
```python

samples/openapi3/client/petstore/python-pydantic-v1/git_push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ release_note=$3
99
git_host=$4
1010

1111
if [ "$git_host" = "" ]; then
12-
git_host="github.com"
12+
git_host="GIT_HOST"
1313
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
1414
fi
1515

samples/openapi3/client/petstore/python-pydantic-v1/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "OpenAPI Petstore"
55
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
66
license = "Apache-2.0"
77
readme = "README.md"
8-
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
8+
repository = "https://GIT_HOST/GIT_USER_ID/GIT_REPO_ID"
99
keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"]
1010
include = ["petstore_api/py.typed"]
1111

0 commit comments

Comments
 (0)