-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improvement: update 'any object' examples to be flatter #4083
Conversation
@@ -596,25 +588,17 @@ Creates a new document index.", | |||
{ | |||
"key": { | |||
"type": "string", | |||
"value": "indexing_config", | |||
"value": "key", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any thoughts on why the value
here is now key
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatted offline, but this was similarly intentional for the same reason as the other comment! And since these are the example TRs, this is what we wanna see
@@ -974,11 +974,11 @@ exports[`generate IR from OpenAPI 1`] = ` | |||
"map": [ | |||
{ | |||
"key": { | |||
"jsonExample": "custom_fields", | |||
"jsonExample": "key", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar issue here with custom_fields
-> key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one's intentional, it's outlined at the end of the pr body, but since it was {"custom_fields": "custom_fields"}
I updated to {"key": "value"}
Previously, we'd create nested objects if we received an
any object
e.g. an unknown value we're binding to an object (since we make thosemap<string, unknown>
).Those generated examples would become:
"object": {"object": {"key": "value"}}
, now we short circuit the example generation to special casemap<string, unknown>
to just return{"key": "value"}
, making the above now"object": {"key": "value"}
As a bonus I also changed the map key and value generation to fall back to "key" and "value" as opposed to the field name which led to some awkward examples like
{"custom_fields": "custom_fields" }
seen below