# Swagger api to generate HTML from yaml

**URL:** <https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246>\
**Category:** Swagger OS\
**Tags:** api, migrated, swagger-oss, swagger-codegen, swagger-editor\
**Created:** [September 27, 2021, 8:23am UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246 "2021-09-27T08:23:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 27, 2021, 8:23am UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/1 "2021-09-27T08:23:54Z")

</div>

> Originally posted by **amitrao2344** on September 27, 2021

I am trying to generate HTML from YAML file using . [https://generator3.swagger.io/api/generate](https://generator3.swagger.io/api/generate) enpoint but if my yaml file has markdown text it does not seem to support and the html file which is generated does not parse markdown text .

How can I parse markdown text ?

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 27, 2021, 9:02am UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/2 "2021-09-27T09:02:01Z")

</div>

> Originally posted by **ponelat** on September 27, 2021

Hi amitrao2344

It’ll depend on which template you use, there are currently three: html, html2 and dynamic-html.

From what I can tell, html and html2 both support Markdown as you’d expect but dynamic-html doesn’t appear to.

Here is a curl command to generate a html2 template using the petstore 3 example. In it you can see the markdown is rendered.

```auto
#!/usr/bin/env bash

curl -X POST "https://generator3.swagger.io/api/generate" -H "accept: application/octet-stream" -H "Content-Type: application/json" -d "{\"lang\":\"html2\",\"specURL\":\"https://petstore3.swagger.io/api/v3/openapi.json\",\"type\":\"CLIENT\",\"codegenVersion\":\"V3\",\"options\":{}}" -o output.zip

```

Screenshot:

 ![ponelat_0-1632733293386.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/269a48dc60c24ee713f85e1d2679804c1caaf526.png)

Petstore3 example: [https://petstore3.swagger.io/](https://petstore3.swagger.io/)

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 27, 2021, 11:36am UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/3 "2021-09-27T11:36:10Z")

</div>

> Originally posted by **amitrao2344** on September 27, 2021

I am using html2 template and passing below yaml properties

description: |-

```
        Invalid request. There was an issue with the metric data provided in the request body. Possible error codes returned:

        Error Code | Description | Parameters Example

        --------------------------|----------------------|----------------------------

        BAD\_REQUEST | Cannot read request body for some reason. For instance, request contains fields with invalid format of integer, number, boolean, etc. | |

        INVALID\_DATE\_TIME\_FORMAT | The date time format of start time and/or end time fields is invalid. | |

        MISSING\_REQUIRED\_FIELDS | One or more required fields for the metric were not provided or have nullable value. | "fields": \["deploymentUuid", "productShortCode", "measureUnit", "quantity", "startTime", "endTime"\]

        OUT\_OF\_BOUNDS\_VALUE | One or more fields have out of bounds value. | "fields": \[{"fieldName": "quantity", "minValue": 1, "maxValue": 2147483647} \]

        MIN\_LENGTH\_REQUIRED | One or more fields have the minimum field value length less than required. | "fields": \[{"fieldName": "productShortCode", "minLength": 1}\]

        MAX\_LENGTH\_EXCEEDED | One or more fields exceeded the maximum field value length. | "fields": \[{"fieldName": "measureunit", "maxLength": 50}\]

        INVALID\_DEPLOYMENT\_UUID | Deployment UUID should contain only alphanumeric characters and dashes. | |

        START\_TIME\_AFTER\_END\_TIME | Start time value should be before the end time value. | |

        REQUEST\_EXPIRED | The request reached the service more than 24 hours after the end time value. | |

        END\_TIME\_IN\_FUTURE | End time should not be in the future. | |

        MAX\_TIME\_PERIOD\_DURATION\_EXCEEDED | Time period between start and end time should not be greater than max time period duration. | "maxTimePeriodDurationInHours": 24

        CUSTOM\_DATA\_MAX\_SIZE\_EXCEEDED | Custom data field exceeded maximum number of key/value pairs. | "maxCustomDataSize": 10|

        CUSTOM\_DATA\_PROPERTY\_MIN\_LENGTH\_REQUIRED | One or more custom data property key and/or value are nullable or have min length less than required. | "minKeyLength": 1, "minValueLength": 1

        CUSTOM\_DATA\_PROPERTY\_MAX\_LENGTH\_EXCEEDED | One or more custom data property key and/or value have exceeded max length. | "maxKeyLength": 256, "maxValueLength": 256

```

But it shows up in converted HTML as below

 ![amitrao2344_0-1632742550675.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/6ef58c4bcf3705ce555f2be35dd5e8b6941a63d8.png)

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 27, 2021, 1:45pm UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/4 "2021-09-27T13:45:28Z")

</div>

> Originally posted by **amitrao2344** on September 27, 2021

Markdown parsing works but not on all attributes of YAML file .

I have attached sample YAML file which get transferred to corresponding HTML but does not parse Markdown text at line 106

but it get converted to HTML on line 30 .

Note: I have attached yaml file with xml extension .

Can you please help .

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 28, 2021, 8:16am UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/5 "2021-09-28T08:16:29Z")

</div>

> Originally posted by **amitrao2344** on September 28, 2021

ponelat can you please look into this issue ?

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [September 28, 2021, 8:44am UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/6 "2021-09-28T08:44:49Z")

</div>

> Originally posted by **ponelat** on September 28, 2021

Hi amitrao2344

The html2 template does support Markdown in `description` fields, particularly the one in an operation.

Although Markdown tables can be tricky to get right. In this case there are line breaks between the rows which cause it not to render a table. If you remove the lines between rows you should see better results.

```auto
openapi: 3.0.0
info:
  title: Test API
  version: 1.0.0

paths:
  /something:
    post:
      description: |-
        Invalid request. There was an issue with the metric data provided in the request body. Possible error codes returned:

        Error Code | Description | Parameters Example
        --------------------------|----------------------|----------------------------
        BAD_REQUEST | Cannot read request body for some reason. For instance, request contains fields with invalid format of integer, number, boolean, etc. | |
        INVALID_DATE_TIME_FORMAT | The date time format of start time and/or end time fields is invalid. | |
        MISSING_REQUIRED_FIELDS | One or more required fields for the metric were not provided or have nullable value. | "fields": \["deploymentUuid", "productShortCode", "measureUnit", "quantity", "startTime", "endTime"\]
        OUT_OF_BOUNDS_VALUE | One or more fields have out of bounds value. | "fields": \[{"fieldName": "quantity", "minValue": 1, "maxValue": 2147483647} \]
        MIN_LENGTH_REQUIRED | One or more fields have the minimum field value length less than required. | "fields": \[{"fieldName": "productShortCode", "minLength": 1}\]
        MAX_LENGTH_EXCEEDED | One or more fields exceeded the maximum field value length. | "fields": \[{"fieldName": "measureunit", "maxLength": 50}\]
        INVALID_DEPLOYMENT_UUID | Deployment UUID should contain only alphanumeric characters and dashes. | |
        START_TIME_AFTER_END_TIME | Start time value should be before the end time value. | |
        REQUEST_EXPIRED | The request reached the service more than 24 hours after the end time value. | |
        END_TIME_IN_FUTURE | End time should not be in the future. | |
        MAX_TIME_PERIOD_DURATION_EXCEEDED | Time period between start and end time should not be greater than max time period duration. | "maxTimePeriodDurationInHours": 24
        CUSTOM_DATA_MAX_SIZE_EXCEEDED | Custom data field exceeded maximum number of key/value pairs. | "maxCustomDataSize": 10|
        CUSTOM_DATA_PROPERTY_MIN_LENGTH_REQUIRED | One or more custom data property key and/or value are nullable or have min length less than required. | "minKeyLength": 1, "minValueLength": 1
        CUSTOM_DATA_PROPERTY_MAX_LENGTH_EXCEEDED | One or more custom data property key and/or value have exceeded max length. | "maxKeyLength": 256, "maxValueLength": 256

      tags:
      - Notification
      responses:
       default: 
         description: ok

```

 ![ponelat_0-1632818676132.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/02f40399d339599f14e67733dea50448a71f8812.png)

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [October 4, 2021, 1:26pm UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/7 "2021-10-04T13:26:34Z")

</div>

> Originally posted by **sonya\_m** on October 04, 2021

Thank you ponelat!

Hi amitrao2344 , looks like you replied straight to the email notification, this way your message won’t reach the Community. Please make sure to reply inside the Community. Thank you!

---

<div class="post-metadata">

**Author:** ![quickbuild\_dev](https://yyz1.discourse-cdn.com/flex049/user_avatar/community.smartbear.com/quickbuild_dev/32/1132_2.png) [@quickbuild\_dev](https://community.smartbear.com/u/quickbuild_dev)\
**Post date:** [November 16, 2026, 6:23pm UTC](https://community.smartbear.com/t/swagger-api-to-generate-html-from-yaml/246/8 "2026-11-16T18:23:30Z")

</div>

If you are still using `generator3.swagger.io`, ponelat’s html2 answer is the one I would try first. The html2 template does render Markdown in operation `description` fields. The table in your spec failed because of the blank lines between rows. Once those empty lines are removed, as in ponelat’s sample, html2 should parse the table.

If you would rather build static HTML from the same Swagger or OpenAPI YAML on your machine, without posting the spec to the hosted generator, [Sourcey](https://sourcey.com/) is another option. I checked [sourcey.com/oss](https://sourcey.com/oss) on 17 Nov 2026: the current docs generator is 3.9.5, dated 8 Nov 2026, license AGPL-3.0-only. The README install and build steps are:

```bash
npm install -g sourcey
sourcey build api.yaml -o dist/

```

Point `api.yaml` at your spec. The build writes static HTML to `dist/`, with no dashboard and no call to a hosted generator at render time, so you can copy the folder onto any static host.

Sourcey’s configuration docs treat descriptions in the API reference as Markdown. I have not found a documented guarantee that Markdown tables inside those descriptions render as tables, so I would not rely on that for this layout.

One limitation: this writes a site (multiple pages, search, code samples), not a single packed HTML document like the html2 zip. It also needs Node 22.22.2+, 24.15+ or 26+.

I am not affiliated with Sourcey.
