-
Notifications
You must be signed in to change notification settings - Fork 9
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
JSON is not parsed in responses for APIs that set custom mime types #71
Comments
A quick monkeypatch for my current issue is: @eval OpenApi.Clients is_json_mime(mime::T) where {T <: AbstractString} = ("*/*" == mime) || occursin(r"(?i)application\/json(;.*)?", mime) || occursin(r"(?i)application\/(.*)-patch\+json(;.*)?", mime) || occursin(r"(?i)application\/vnd.(.*)\+json(;.*)?", mime) Can we look for |
Fascinating! I had no idea this was the failure mode as yes, these errors are inscrutable and I still do not know how to fix them. My terrible fix is to basically pirate myself in the package I am working on here: https://github.com/JuliaHealth/IPUMS.jl/blob/tcp-extracts/src/piracy.jl Meaning, I am overwriting the calls that OpenAPI should've generated correctly for me using my OpenAPI yaml. Not sure really what to do from here... Thanks @asinghvi17 for CC'ing me! Still don't know how to fix this, but I am curious to learn more. |
Turns out after some sleuthing @asinghvi17 and I discovered these are two different issues -- opened an issue here: #73 |
Just wanted to bump this issue - what's the best way forward here? |
Imo we should be looking for the A PR would be appreciated, of course :) |
possibly |
I agree, we could expand the accepted mime types to include those. The |
Technically any mime with a |
True. RFC6838 is very generic. IANA mime type list can be a good reference point. |
The MIME string formats for JSON are hardcoded here:
OpenAPI.jl/src/client.jl
Line 261 in 6c820c5
but some servers like Phylopic respond in their own application-specific MIME types that are nevertheless JSON. There needs to be some form of switch to control which MIME type is accepted for JSON parsing. Otherwise, OpenAPI calls fail with inscrutable errors like:
cc @TheCedarPrince who is possibly having the same issue.
The text was updated successfully, but these errors were encountered: