Forum Discussion

matspring's avatar
matspring
New Contributor
3 years ago

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.

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

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

 

Any help appreciated

 

MAt

 

3 Replies

  • 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.

    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's avatar
      matspring
      New Contributor

      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

       

      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

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

       

      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's avatar
        abonstrom
        Staff

        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/21699210 

         

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

         

        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!