Open thompson-tomo opened 2 days ago
Hi @thompson-tomo Thank you for using kiota and for reaching out.
I'd say this description is not specific enough. From what it describes, it'd mean I could also send it an image, YAML, etc... Which I'm pretty sure the API would be unhappy with. It'd be much better for this description to have two entries, one for application/json and another for application/xml
We don't have any plans to add any "compatibility" mechanism, allowing users to say "map star/star to application/json during the generation", it'd be a slippery slope.
My use-case is different but is excluded by the lack of this functionality. I am working with an API where you can attach files/images/etc. to a request and in it’s documentation it says it supports / so by extensions when you call /attachment/{sys_id}/file it can return nearly any content type.
Here is the documentation for reference: https://www.servicenow.com/docs/bundle/xanadu-api-reference/page/integrate/inbound-rest/concept/c_AttachmentAPI.html
The section in question is: Attachment - GET /now/attachment/{sys_id}/file
Agree @michaeldcanady use case is deeply connected to this.
For me what would be most beneficial is if not otherwise specified it is expected that the api will return the same content type as the request for instance posting json is expected to return json unless the api or developer specifies otherwise.
Within the openapi spec i am using (https://api.parkassist.com/docs/index.html) it is using generic media types for requests due to supporting both json & xml.
The above is generating the following method
which is valid, however if the full media type is specified in the openapi, the below method is generated which is easy for a user to use.
What would be helpful is if the media type is defined as one of the below:
where star = *
The below method is generated, and it uses application/json
And it also generates which would is expecting "application/json" and if not matched, results in a failure.
When #342 is implemented that also becomes a supported media type to be passed in.