-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
AnyType + BodySerializationMethod #423
Comments
@MeikelLP thanks for taking the time to suggest this If you know what the Refit interface should look like in such a scenario, then it would be easier for me to add support. If what you need, has to be done on the contracts/models/dto then Refitter is limited by what NSwag can do for generating contracts/models/dto |
Thanks for the quick response! Currently the interface method is generated as Task<IApiResponse<System.Text.Json.JsonElement>> CreateMessageAsync([Body] System.Text.Json.JsonElement body, CancellationToken cancellationToken = default); however I'd like it to be like this: Task<IApiResponse<System.Text.Json.JsonElement>> CreateMessageAsync([Body(BodySerializationMethod.Serialized)] System.Text.Json.JsonElement body, CancellationToken cancellationToken = default); This will cause the |
@MeikelLP I have never used Would you mind providing an example OpenAPI spec I can use to try things out? |
I'm currently working with a closed source proprietary API thus I cannot share the original schema. {
"openapi": "3.0.0",
"info": {
"title": "Example",
"version": "1.0.0"
},
"paths": {
"/some/endpoint": {
"post": {
"summary": "Example",
"operationId": "someThing",
"requestBody": {
"required": true,
"content": {
"application/ld+json": {
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
}
}
} |
Is your feature request related to a problem? Please describe.
I want to send and receive
AnyType
asSystem.Text.Json.JsonElement
for max convinienceDescribe the solution you'd like
Add a property alongside
anyType
likeanyTypeBodySerializationMethod
and let us adjust how the body is send.Describe alternatives you've considered
Writing the interface myself :(
Additional context
System.Text.Json.JsonElement
is send as a stream. This might work in some cases but most of the time we just wanna send it as string which is only possible withBodySerializationMethod.Json
from what I can tellMaybe my assumption is wrong - I'm new to Refit
The text was updated successfully, but these errors were encountered: