-
Notifications
You must be signed in to change notification settings - Fork 91
XML example return value is rendered as escaped text, wrapped within <notagname> #2199
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
Comments
How about something like this? @XmlRootElement(name = "foo")
static class FooSchema { }
@APIResponse(responseCode = "200", description = "Bla bla", content = {
@Content(mediaType = MediaType.APPLICATION_JSON, example = "JSON example"),
@Content(mediaType = MediaType.APPLICATION_XML, example = XML,
schema = @Schema(implementation = FooSchema.class)),
@Content(mediaType = MediaType.TEXT_PLAIN, example = "Text example") }) |
Thanks, that's a workaround which works. However, it's kind of obscure :-) , so it would be nice if this was generated correctly right out of the box. By this I mean that it's clear from the MediaType that it's XML, so the plugin could generate what's necessary to get it right. |
Right, I agree. It seems to be more an issue with Swagger UI in my opinion. I'd expect it to perhaps be aware of the representation for the XML media type without requiring the schema. I wouldn't have guessed the work-around without the |
Unfortunately, just from the |
Too bad... so there's no solution except defining schemas by hand? |
Do you already have a class that represents the XML that includes |
Thanks for the information. Unfortunately, at the moment I'm not able to take out some time of my schedule. But maybe one day I'll be able to convince my boss :-) Anyway, since the other feature request already exists, please close this one - and thanks for the workaround! |
I have an example of an XML document as it would be returned:
This is used within the REST endpoint:
In the
openapi.yml
this is rendered asBut in SwaggerUI, I see a strange escaped text:
See also fastapi/fastapi#8440
The text was updated successfully, but these errors were encountered: