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
[release-1.x] getPreferredMediaType
doesn't handle empty arrays resulting in None of the given media types are supported:
#1075
Comments
Maybe this is rather a problem with either a) the OpenAPI specs over at the Kubernetes repo or b) in the OpenAPI generator. Another potential fix was in the |
after taking a look, I think you're correct. The current generated code doesn't respect the I can take a shot at it this week. I don't know if it makes more sense to check explicitly for an |
Any movement on this @davidgamero? I was going to give it a shot tomorrow. |
I've tried to find a simple solution in the upstream MIME type code, but it got tricky in the Java/outside typescript generator level. It may be worth adding a fix substituting the full list of MIME values in the python we use to pull the swagger to get around this, but Id love your thoughts when you take a look tomorrow! |
Closed by #1127, I will try to cut a new release today. |
@brendandburns Could you please release another version when you get a chance, so that we can test the changes? 😊 |
Describe the bug
getPreferredMediaType
only checks ifmediaTypes
is falsy and not if it's an empty array:https://github.com/kubernetes-client/javascript/blob/release-1.x/src/gen/models/ObjectSerializer.ts#L1745-L1749
The API provides an empty array, e.g:
https://github.com/kubernetes-client/javascript/blob/release-1.x/src/gen/apis/CoreV1Api.ts#L2779
If the TypeScript types can be trusted,
mediaTypes
should never beundefined
anyway.I didn't know where to provide a fix, because those files are generated?
Might be related to #893
Client Version
1.0.0-rc2
Server Version
1.24.10
To Reproduce
Steps to reproduce the behavior:
None of the given media types are supported:
Expected behavior
Not throw
None of the given media types are supported:
Example Code
The text was updated successfully, but these errors were encountered: