Skip to content
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

tsp, bug fix multiple content-type + json-patch+json #2870

Conversation

weidongxu-microsoft
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft commented Jul 19, 2024

source is appconfiguration
https://github.com/Azure/azure-rest-api-specs/blob/c65e8cbbb18fc9d79165f12291d38d91eb340f0f/specification/appconfiguration/AppConfiguration/routes.tsp#L323-L336

which generates a PutKeyValueRequestContentType contentType, where it should be String contentType, for WithResponse API.

typespec-tests/tsp/multiple-content-types.tsp Show resolved Hide resolved
return map(parameter, false);
}

public ClientMethodParameter map(Parameter parameter, boolean isProtocolMethod) {
Copy link
Member Author

@weidongxu-microsoft weidongxu-microsoft Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a isProtocolMethod boolean and the logic here.

@haolingdong-msft
I am not sure about the background that we add this CustomClientParameterMapper. Is it purely for json-merge-patch?
Can we merge it with ClientParameterMapper, or extract the shared logic (I assume at least half of the logic here is duplicated)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, this one is application/json-patch+json
That's ancient code path.

Copy link
Member Author

@weidongxu-microsoft weidongxu-microsoft Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can merge CustomClientParameterMapper with ClientParameterMapper, as there seems to be only one block of code diff (about array).

But there is CustomProxyParameterMapper as well... Guess I would wait the background of these classes first.

@weidongxu-microsoft weidongxu-microsoft changed the title tsp, bug fix multiple content-type + json merge patch tsp, bug fix multiple content-type + json patch json Jul 19, 2024
@weidongxu-microsoft weidongxu-microsoft marked this pull request as ready for review July 19, 2024 07:07
@weidongxu-microsoft weidongxu-microsoft changed the title tsp, bug fix multiple content-type + json patch json tsp, bug fix multiple content-type + json-patch+json Jul 19, 2024
@weidongxu-microsoft weidongxu-microsoft merged commit 667dab8 into Azure:main Jul 22, 2024
5 checks passed
@weidongxu-microsoft weidongxu-microsoft deleted the tsp_bug-fix-multiple-content-type-json-merge-patch branch July 22, 2024 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants