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

fix(api): Fix openapi documentation display script #805

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions templates/docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,10 @@ <h3>{{tag}}</h3>
{%endfor%}
{%endif%}
{%if "requestBody" in item[endpoint][method]%}
{%if "parameters" not in item[endpoint] and "parameters" not in item[endpoint][method]%}
<p><strong>Parameters</strong></p>
<hr />
{%endif%}
{%for property in item[endpoint][method]["requestBody"]["content"]["application/json"]["schema"]["properties"]%}
<p><md-block><code>{{property}}</code> (<em>{{item[endpoint][method]["requestBody"]["content"]["application/json"]["schema"]["properties"][property]["type"]}}</em>): {%if property in item[endpoint][method]["requestBody"]["content"]["application/json"]["schema"]["required"]%}Required{%else%}Optional{%endif%}. {{item[endpoint][method]["requestBody"]["content"]["application/json"]["schema"]["properties"][property]["description"].replace(" -", "\n -")}}</md-block></p>
<p><strong>Request body (multipart/form-data)</strong></p>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is true for all request_bodys or only the ones with files. Or to put it differently, can we check for item[endpoint][method]["requestBody"]["content"]["multipart/form-data"] directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can check for this, but currently I am sure that this is true for all request bodies - trying this with "application/json" results in errors, but having run this locally with the most recent schema, there are no errors when using "multipart/form-data". I've checked through the schema to verify this as well.

<hr />
{%for property in item[endpoint][method]["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"]%}
<p><md-block><code>{{property}}</code> (<em>{{item[endpoint][method]["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"][property]["type"]}}</em>): {%if property in item[endpoint][method]["requestBody"]["content"]["multipart/form-data"]["schema"]["required"]%}Required{%else%}Optional{%endif%}. {{item[endpoint][method]["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"][property]["description"].replace(" -", "\n -")}}</md-block></p>
{%endfor%}
{%endif%}
<p><strong>Responses</strong></p>
Expand Down