Skip to content

Commit

Permalink
(fix): make sure that deep object query params are reverse migrated t… (
Browse files Browse the repository at this point in the history
#3172)

* (fix): make sure that deep object query params are reverse migrated to optional strings

* fix snapshots
  • Loading branch information
dsinghvi authored Mar 13, 2024
1 parent f53b56e commit 8a01d0b
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,86 @@ exports[`migrateFromV33ToV32 snapshot 1`] = `
"type": "primitive",
},
},
{
"allowMultiple": false,
"availability": undefined,
"docs": undefined,
"name": {
"name": {
"camelCase": {
"safeName": "user",
"unsafeName": "user",
},
"originalName": "user",
"pascalCase": {
"safeName": "User",
"unsafeName": "User",
},
"screamingSnakeCase": {
"safeName": "USER",
"unsafeName": "USER",
},
"snakeCase": {
"safeName": "user",
"unsafeName": "user",
},
},
"wireValue": "user",
},
"valueType": {
"_visit": [Function],
"container": {
"_visit": [Function],
"optional": {
"_visit": [Function],
"primitive": "STRING",
"type": "primitive",
},
"type": "optional",
},
"type": "container",
},
},
{
"allowMultiple": false,
"availability": undefined,
"docs": undefined,
"name": {
"name": {
"camelCase": {
"safeName": "map",
"unsafeName": "map",
},
"originalName": "map",
"pascalCase": {
"safeName": "Map",
"unsafeName": "Map",
},
"screamingSnakeCase": {
"safeName": "MAP",
"unsafeName": "MAP",
},
"snakeCase": {
"safeName": "map",
"unsafeName": "map",
},
},
"wireValue": "map",
},
"valueType": {
"_visit": [Function],
"container": {
"_visit": [Function],
"optional": {
"_visit": [Function],
"primitive": "STRING",
"type": "primitive",
},
"type": "optional",
},
"type": "container",
},
},
{
"allowMultiple": false,
"availability": undefined,
Expand Down Expand Up @@ -562,6 +642,46 @@ exports[`migrateFromV33ToV32 snapshot 1`] = `
"type": "container",
},
},
{
"allowMultiple": true,
"availability": undefined,
"docs": undefined,
"name": {
"name": {
"camelCase": {
"safeName": "multipleUser",
"unsafeName": "multipleUser",
},
"originalName": "multipleUser",
"pascalCase": {
"safeName": "MultipleUser",
"unsafeName": "MultipleUser",
},
"screamingSnakeCase": {
"safeName": "MULTIPLE_USER",
"unsafeName": "MULTIPLE_USER",
},
"snakeCase": {
"safeName": "multiple_user",
"unsafeName": "multiple_user",
},
},
"wireValue": "multipleUser",
},
"valueType": {
"_visit": [Function],
"container": {
"_visit": [Function],
"optional": {
"_visit": [Function],
"primitive": "STRING",
"type": "primitive",
},
"type": "optional",
},
"type": "container",
},
},
{
"allowMultiple": true,
"availability": undefined,
Expand Down Expand Up @@ -594,6 +714,46 @@ exports[`migrateFromV33ToV32 snapshot 1`] = `
"type": "primitive",
},
},
{
"allowMultiple": false,
"availability": undefined,
"docs": undefined,
"name": {
"name": {
"camelCase": {
"safeName": "any",
"unsafeName": "any",
},
"originalName": "any",
"pascalCase": {
"safeName": "Any",
"unsafeName": "Any",
},
"screamingSnakeCase": {
"safeName": "ANY",
"unsafeName": "ANY",
},
"snakeCase": {
"safeName": "any",
"unsafeName": "any",
},
},
"wireValue": "any",
},
"valueType": {
"_visit": [Function],
"container": {
"_visit": [Function],
"optional": {
"_visit": [Function],
"primitive": "STRING",
"type": "primitive",
},
"type": "optional",
},
"type": "container",
},
},
],
"requestBody": undefined,
"response": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ class Converter {
public convertEndpoint(endpoint: IrVersions.V33.HttpEndpoint): IrVersions.V32.HttpEndpoint {
return {
...endpoint,
queryParameters: endpoint.queryParameters.filter(
// Filter out all the object query parameters.
(queryParameter) => !this.isTypeReferenceObject(queryParameter.valueType)
queryParameters: endpoint.queryParameters.map(
// Object based query parameters are reverse migrated to optional string query parameters.
(queryParameter) =>
this.isTypeReferenceObject(queryParameter.valueType)
? {
...queryParameter,
valueType: IrVersions.V33.TypeReference.container(
IrVersions.V33.ContainerType.optional(
IrVersions.V33.TypeReference.primitive("STRING")
)
)
}
: queryParameter
),
examples: convertExamples({
examples: endpoint.examples,
Expand Down
2 changes: 1 addition & 1 deletion seed/python-sdk/exhaustive/additional_init_exports
Submodule additional_init_exports updated from 9f6872 to 39ada5

0 comments on commit 8a01d0b

Please sign in to comment.