rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.61k stars 271 forks source link

null example value leads to incorrect example JSON #997

Open brunchboy opened 5 months ago

brunchboy commented 5 months ago

If we have an attribute in our response defined as follows:

          "providerExpiration": {
            "type": "string",
            "description": "When this provider (account) is configured to expire, if ever",
            "format": "date-time",
            "example": null
          }

the resulting example created by Rapidoc is invalid, it is missing a comma after the null:

"name": "Jackson Doe",
"providerExpiration": null
"providerId": "18d1dc35-0d80-4000-8734-63dfdee46d01",

If we remove the setting of the example value to null, a random timestamp is generated and rendered correctly with a subsequent comma:

"name": "Jackson Doe",
"providerExpiration": "1970-01-01T00:00:00.000Z",
"providerId": "18d1dbc3-b530-4000-82b9-f53653214a01",