openapi-contrib / openapi3-generator

Use your API OpenAPI 3 definition to generate code, documentation, and literally anything you need.
Apache License 2.0
90 stars 27 forks source link

Empty table cells in markdown when using additionalProperties #10

Open farshidtz opened 5 years ago

farshidtz commented 5 years ago

I use additionalProperties to define a dictionary as suggested here.

When the dictionary value is object, the resulting markdown will have rows for summaryAsHTML , descriptionAsHTML, generatedExample with empty cells in Type and Description columns. This somehow breaks the HTML parsing of the table.

openapi: 3.0.0

info:
  description: Test specs
  version: "0.0.0"
  title: Test specs

paths:
  /test:
    get:
      summary: retrieves a dictionary
      responses:
        '200':
          description: success response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                  properties:
                    x:
                      type: string
                    y:
                      type: string
# Test specs

Test specs

## Table of Contents

* [Paths](#paths)
  - [`GET` /test](#op-get-test) 
* [Schemas](#schemas)

## Paths

### `GET` /test
<a id="op-get-test" />

> retrieves a dictionary

#### Responses

##### ▶ 200 - success response

###### Headers
_No headers specified_

###### application/json

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
      <th>Accepted values</th>
    </tr>
  </thead>
  <tbody>
      <tr>
        <td>Response</td>
        <td>
          object
        </td>
        <td></td>
        <td><em>Any</em></td>
      </tr>
      <tr>
        <td>Response.x</td>
        <td>
          string
        </td>
        <td></td>
        <td><em>Any</em></td>
      </tr>
      <tr>
        <td>Response.y</td>
        <td>
          string
        </td>
        <td></td>
        <td><em>Any</em></td>
      </tr>
      <tr>
        <td>Response.summaryAsHTML</td>
        <td>

        </td>
        <td></td>
        <td><em>Any</em></td>
      </tr>
      <tr>
        <td>Response.descriptionAsHTML</td>
        <td>

        </td>
        <td></td>
        <td><em>Any</em></td>
      </tr>
      <tr>
        <td>Response.generatedExample</td>
        <td>

        </td>
        <td></td>
        <td><em>Any</em></td>
      </tr>
  </tbody>
</table>

</div>

Any suggestions?

fmvilas commented 5 years ago

Sorry, for some reason I missed this issue.

The reason is that the template doesn't iterate over additionalProperties and thus you don't get them. It would be just a matter of fixing the Markdown template.