[rust-server] Allow text/html plaintext responses#1180
[rust-server] Allow text/html plaintext responses#1180colelawrence wants to merge 1 commit intoOpenAPITools:masterfrom
Conversation
| consumesXml = true; | ||
| } else if (isMimetypePlainText(mimeType)) { | ||
| consumesPlainText = true; | ||
| } else if (isMimetypeHtmlText(mimeType)) { |
There was a problem hiding this comment.
Consuming html plaintext may not make sense (I don't know what is supposed to happen), we can adjust this.
|
Thanks for the contribution. This seems like a sensible way of handling HTML initially. We can then integrate a full parser/generator later if needed. It would, however, be nice to see the effect this PR has - would it be possible to add a sample HTML endpoint to https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/rust-server/rust-server-test.yaml? That should give us some confidence that the change has the right effect, as well as making it harder to regress this function in future. |
|
@bjgill yes, I will add a test for this! |
|
Thanks. I suspect you'll want to add something like: /html:
post:
summary: Test HTML handling
consumes: [text/html]
produces: [text/html]
parameters:
- in: body
name: body
required: true
schema:
type: string
responses:
200:
description: Success
schema:
type: string |
|
I've now got this working (with sample) at https://github.com/Metaswitch/openapi-generator/tree/rust-server-html. Unless you want to fold those changes into this PR, I'll open a new PR tomorrow. |
|
Thanks for your contribution. I've created #1329, which adds the sample update. |
|
Thanks Benjamin!
…On Fri, Oct 26, 2018, 11:03 AM Benjamin Gill ***@***.***> wrote:
Closed #1180 <#1180>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1180 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACyjU__shDTweRcWqvRI72JQVE7wJrzKks5uoyQxgaJpZM4XKlTG>
.
|
Builds on #1180 by @colelawrence. This addition to the rust-server generator enables the use of text/html responses as plaintext. I've added an html endpoint to the sample to demonstrate that this works (and fixed the problem that that uncovered).
Builds on OpenAPITools#1180 by @colelawrence. This addition to the rust-server generator enables the use of text/html responses as plaintext. I've added an html endpoint to the sample to demonstrate that this works (and fixed the problem that that uncovered).
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,3.4.x,4.0.x. Default:master.Description of the PR
Hello @frol, @farcaller, and @bjgill,
This addition to the rust-server generator enables the use of
text/htmlresponses as plaintext.@bjgill, I'm sorry I did not add an issue to gather feedback.
I can run shell scripts in the checklist in a few moments