Skip to content

Commit aa785d0

Browse files
authored
fix: Fix optional params defaulting to __SPEAKEASY_UNSET__ (#99)
See #94 for example. Our api uses `anyOf` for optional params, and if there's no default value, the client sets the default __SPEAKEASY_UNSET__. This string gets sent for all optional params and causes the server to basically always return a validation error. We need to add a null default like so: ``` "combine_under_n_chars": { "anyOf": [ { "type": "integer", "default": null }, { "type": "null" } ], }, ``` However, doing this on the server breaks the js-client. Over there, optional params are undefined by default, and adding a null default causes us to send a literal `null`, causing the same validation issues. Thus the fix is to set the defaults only on the python side and remove the workaround on the server. To test, run `make client-generate && make test`.
1 parent 16a29a8 commit aa785d0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

overlay_client.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ actions:
2121
"type": "integer",
2222
"default": 5,
2323
}
24+
- target: $["components"]["schemas"]["partition_parameters"]["properties"][*].anyOf[0]
25+
description: Add a null default to all optional parameters. Prevents the sdk from sending a default string when param is not specified.
26+
update:
27+
"default": null

0 commit comments

Comments
 (0)