readmeio / oas

Comprehensive tooling for working with OpenAPI definitions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Blank" lines in comment lead to cut off definitions

DonMartin76 opened this issue · comments

Thanks for a great initiative, I like the thinking behind this. I have run into a couple of issues, among those there is this behavior:

Consider the following comment:

  /**
   * @oas [get] /tenant/{tenantId}/csv-imports
   * description: "Returns all CSV imports done on this tenant"
   * parameters:
   * - (path) tenantId=5bc8873b2264ca9989fd2d96 {String} The ID of the tenant to operate on
   * 
   * responses:
   *   200:
   *     description: Success
   *     content:
   *       application/json:
   *         schema:
   *           $ref: '#/components/schemas/CsvImports'
   */

The resulting JSON looks as follows:

      "get": {
        "description": "Returns all CSV imports done on this tenant",
        "parameters": [
          {
            "in": "path",
            "name": "tenantId",
            "required": true,
            "description": "The ID of the tenant to operate on",
            "schema": {
              "type": "string",
              "default": "5bc8873b2264ca9989fd2d96"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      },

The actual response type is missing here. The culprit is the "blank" line (just containing the *); if I take away the blank line, the output is as expected (using the responses section of the endpoint definition).

Is this on purpose?

For the sake of readability, I would want to be able to have blank lines in there.

Fixed! I'm not sure what the logic was when the code was being written, but it seems like a silly thing to stop from happening. If you upgrade, it should work as expected:

npm install oas@0.8.10 -g

Thanks for the bug report!