Ask a Question

Generate Client HTML: lost parameters

matspring
New Contributor

Generate Client HTML: lost parameters

I'm using Swagger Editor to produce documentation from YAML. When I Generate Client > HTML important parameter information is lost. See below where XX-ERROR-MSG is lost.

matspring_0-1637774002163.png

See the generated HTML page below where XX-ERROR-MSG is not displayed.

matspring_1-1637774229200.png

Why is this? Am I doing something wrong or is this a limitation?

 

Any help appreciated

 

MAt

 

3 REPLIES 3
abonstrom
Staff

Re: Generate Client HTML: lost parameters

@matspring,

 

I think you're absolutely right in believing this is a limitation. I created a similar file in the editor, added a similar header to the response of my endpoint, and generated HTML documentation. I saw the same thing you did (missing header), and decided to take a look at the HTML file itself. What I found is that there was no evidence at all of my ERROR-MSG object in the HTML file generated, so it is completely ignored by that code generation option.

 

I tried doing the same with the HTML2 option and was in fact able to get the header to show up.

abonstrom_0-1638197850297.png

My recommendation would be to use this option if you want to generate HTML style API documentation.

 

Let me know if you have any other concerns/questions!

matspring
New Contributor

Re: Generate Client HTML: lost parameters

Thanks abonstrom

 

I'm kinda glad that you experienced the same outcome as me and accept that using HTML2 is a possible solution..... however..

 

I also need to output/document report text, see below

 

matspring_0-1638270463968.png

I have a couple of issues here:

 

1. The report text formatting is poor, the carriage returns that are visible in the YAML are lost in the WS interpretation. Is there anything I can do here to preserve the carriage returns? Apologies if this is a basic question - I admit that I've C&P'ed the report text into the YAML file / Swagger Editor

2. When I Generate Client > HTML the report text formatting is unacceptable. This relates to issue 1

matspring_1-1638270780891.png

3. When I Generate Client > HTML2 the report text is lost! Could this be due to the YAML formatting?

matspring_2-1638270857381.png

 

At the moment neither Client Generate to HTML or HTML2 gives me what I need (both parameter output and report text output with carriage returns)

 

Any help appreciated

 

Thanks

 

abonstrom
Staff

Re: Generate Client HTML: lost parameters

@matspring,

 

I've found a stack overflow question that helped me break a long string into several lines: https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines/2169... 

 

Using the "|" symbol adds a line break to every line in your yaml file so your report is formatted properly in the SwaggerUI.

abonstrom_0-1638286057642.png

 

I looked into the HTML document generation options and it doesn't look like there is any way to edit how the documents are created. The document generators appear to have been created by a company called Reverb (doesn't look like it exists anymore). 

 

One suggestion I have to solve this would be to create your own Swagger Codegen template for HTML. That way you could generate HTML docs based off your OpenAPI documentation.

 

Hope this helps!

 

cancel
Showing results for 
Search instead for 
Did you mean: