Skip to content

Commit

Permalink
Add option to return none on unknown union variants (#718)
Browse files Browse the repository at this point in the history
* Upgrade conjure-python-client to 1.10.8

* Add option to return none on unknown union variants

* Fix tests

---------

Co-authored-by: Mark Greatorex <[email protected]>
  • Loading branch information
markgrex and Mark Greatorex authored May 23, 2023
1 parent e725c89 commit 017e343
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ default void emit(PythonPoetWriter poetWriter) {
poetWriter.writeIndentedLine("_decoder = ConjureDecoder()");
if (isOptionalReturnType()) {
poetWriter.writeIndentedLine(
"return None if _response.status_code == 204 else _decoder.decode(_response.json(), %s)",
"return None if _response.status_code == 204 else _decoder.decode(_response.json()"
+ ", %s, self._return_none_for_unknown_union_types)",
pythonReturnType().get());
} else {
poetWriter.writeIndentedLine(
"return _decoder.decode(_response.json(), %s)",
"return _decoder.decode(_response.json(), %s, self._return_none_for_unknown_union_types)",
pythonReturnType().get());
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class ConjurePythonGeneratorTest {
.packageName("package-name")
.packageVersion("0.0.0")
.packageDescription("project description")
.minConjureClientVersion("1.0.0")
.minConjureClientVersion("1.10.8")
.generatorVersion("0.0.0")
.shouldWriteCondaRecipe(true)
.generateRawSource(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ requirements:
- setuptools
- requests
- typing
- conjure-python-client >=1.0.0,<2
- conjure-python-client >=1.10.8,<2

run:
- python
- requests
- typing
- conjure-python-client >=1.0.0,<2
- conjure-python-client >=1.10.8,<2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ requirements:
- setuptools
- requests
- typing
- conjure-python-client >=1.0.0,<2
- conjure-python-client >=1.10.8,<2

run:
- python
- requests
- typing
- conjure-python-client >=1.0.0,<2
- conjure-python-client >=1.10.8,<2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion conjure-python-verifier/python/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
conjure-python-client = "==1.4.0"
conjure-python-client = "==1.10.8"

[dev-packages]
setuptools = "*"
Expand Down
Loading

0 comments on commit 017e343

Please sign in to comment.