Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown missing a newline after simple response types #27

Closed
kylewm opened this issue Apr 6, 2023 · 3 comments · Fixed by #29
Closed

Markdown missing a newline after simple response types #27

kylewm opened this issue Apr 6, 2023 · 3 comments · Fixed by #29
Assignees

Comments

@kylewm
Copy link

kylewm commented Apr 6, 2023

When a response either has no content or is a reference to a response schema, the newline after it is getting stripped. Here's a small example:

openapi: 3.0.0
info:
  title: Test
  description: Demonstrate newline bug
  version: 0.0.0
paths:
  /cats:
    get:
      summary: Get a list of cats
      responses:
        "200":
          $ref: "#/components/responses/GetCatsResponse"
    post:
      summary: Create a new cat
      responses:
        "200":
          description: Success
    delete:
      summary: Delete a cat
      responses:
        "200":
          description: Success

components:
  responses:
    GetCatsResponse:
      description: List of cats

Renders markdown like this

❯ oad gen-docs -s openapi.yaml -d output.md --style MARKDOWN
...
### GET /cats
Get a list of cats

### Response 200 OK
Refer to the common response description: [GetCatsResponse](#getcatsresponse)### POST /cats
Create a new cat

### Response 200 OK### DELETE /cats
Delete a cat

### Response 200 OK
...

i.e., ### POST and ### DELETE are not on their own line.

Thanks for taking a look!

@RobertoPrevato
Copy link
Member

Hi @kylewm
Thank You for reporting this issue. I take a look - the good news is that it will be easy to fix. 😄
The Jinja templates in this project are quite complex, also because of the number of combinations that are possible with OpenAPI specification.

@RobertoPrevato RobertoPrevato self-assigned this Apr 6, 2023
@kylewm
Copy link
Author

kylewm commented Apr 6, 2023

That's great to hear, and thank you for the speedy response! I started taking a look at it myself, but quickly got overwhelmed by jinja's whitespace stripping behavior 😄 so wanted to at least capture the issue.

RobertoPrevato added a commit that referenced this issue May 1, 2023
RobertoPrevato added a commit that referenced this issue May 1, 2023
* Fix #27, #28, improve tests

* Replace setup.py with pyproject.toml

* make flake8 happy

* Update requirements.txt

* Fix pipeline
@RobertoPrevato
Copy link
Member

Hi @kylewm
This is now fixed, please upgrade with

pip install -U essentials-openapi

Once again, this took me much time because I am focused on my web framework these days.

With this release I also fixed another bug and made a bit of workflow maintenance (upgrading to pyproject.toml and Hatch build).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants