swagger2markup
swagger2markup copied to clipboard
Example values of nested objects are rendered as JSON with escaped <br> in them
Consider a swagger that includes this on the a resource definition:
errorContext:
type: object
description: Map with additional error information
example:
field: currency
The markdown that is generated looks like this:
|**errorContext** <br>*optional*|**Example** : `{<br> "field" : "currency",<br> "message" : "Wrong currency code"<br>}`|object|
And this markdown gets converted into this HTML:
<tr>
<td><strong>errorContext</strong> <br><em>optional</em></td>
<td>Map with additional error information <br><strong>Example</strong> : <code>{<br> "field" : "currency"<br>}</code></td>
<td>object</td>
</tr>
Obviously the <br> in the JSON blobs are not desired.
errorContext:
type: string
description: Map with additional error information
example: '{"field": "currency", "message": "Wrong currency code"}'
By enclosing the JSON example within double quotes and treating it as a string, you can avoid the unwanted
tags in the generated Markdown
|errorContext <br>optional|Example : {"field": "currency", "message": "Wrong currency code"}|object|