-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TSPS-320 Auto-generate thin python client based off of openapi.yml (#132
- Loading branch information
1 parent
ba055dd
commit f4465f2
Showing
9 changed files
with
45 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,4 +74,3 @@ compileJava { | |
dependsOn(spotlessApply) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
rootProject.name = 'terra-scientific-pipelines-service' | ||
include('service', 'scripts', 'client', 'rawls-client') | ||
|
||
gradle.ext.releaseVersion = "0.0.69-SNAPSHOT" | ||
include 'scripts:git-hooks' | ||
include('service', 'scripts', 'scripts:git-hooks', 'client', 'rawls-client', 'teaspoons-cli') | ||
findProject(':scripts:git-hooks')?.name = 'git-hooks' | ||
|
||
gradle.ext.releaseVersion = "0.0.69-SNAPSHOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Teaspoons CLI | ||
|
||
## Python thin client auto-generation | ||
We use the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) to generate the "thin" Python client, | ||
which is then used to build the Python-based "thick" CLI tool. | ||
|
||
To generate the Python thin client, run the following command: | ||
```bash | ||
./gradlew :teaspoons-cli:openApiGenerate | ||
``` | ||
|
||
This will produce generated files at `/teaspoons-cli/build/`. | ||
|
||
Note we do not run the openApiGenerate task as part of the main Teaspoons build, as it is not necessary for the | ||
service itself and we don't want any potential bugs in the CLI to affect the service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id 'org.openapi.generator' version '7.8.0' | ||
} | ||
|
||
apply plugin: 'java' | ||
|
||
apply from: 'teaspoons-client.gradle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tasks.openApiGenerate { | ||
generatorName.set("python") | ||
inputSpec.set("$rootDir/common/openapi.yml") | ||
outputDir.set("$rootDir/teaspoons-cli/build") | ||
configOptions.put("projectName", "teaspoons-client") | ||
configOptions.put("packageName", "teaspoons_client") | ||
configOptions.put("packageVersion", "0.0.0") | ||
configOptions.put("httpUserAgent", "teaspoons-client/0.0.0/python") | ||
} | ||
|
||
// we do NOT want to build this project when building the main service project, to prevent a bug in the cli code from breaking the main service build | ||
//compileJava.dependsOn tasks.openApiGenerate | ||
|
||
task customCleanUp(type:Delete) { | ||
delete "${rootDir}/teaspoons-cli/build/" | ||
} | ||
|
||
tasks.clean.dependsOn(tasks.customCleanUp) |