Skip to content

Commit

Permalink
fix: display parameter description first instead of its schema descri…
Browse files Browse the repository at this point in the history
…ption (#109)
  • Loading branch information
anbreaker authored Oct 22, 2020
1 parent 05ab530 commit 959b31a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions partials/description.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% macro getDescription(description) %}

<div class="text-sm markdown">{{ description | markdown2html | safe }}</div>

{% endmacro %}
2 changes: 1 addition & 1 deletion partials/operation.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h3 class="font-mono text-base">
<div class="children bg-grey-lighter p-4 rounded">
<div class="bg-grey-lightest pl-8 pr-8 rounded">
{% for parameterName, parameter in channel.parameters() %}
{{ schemaProp(parameter.schema(), parameterName, odd=false, specialName=false, required=true) }}
{{ schemaProp(parameter.schema(), parameterName, odd=false, specialName=false, required=true, altDescription=parameter.description()) }}
{% endfor %}
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions partials/schema-prop.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% from "./type.html" import type %}
{% from "./schema-item.html" import schemaItem %}
{% from "./description.html" import getDescription %}

{% macro schemaProp(prop, propName, open=false, root=false, odd=false, specialName=false, required=false, circularPropsParent) %}
{% macro schemaProp(prop, propName, open=false, root=false, odd=false, specialName=false, required=false, altDescription=null, circularPropsParent) %}

<div class="{% if odd %}bg-grey-lighter{% else %}bg-grey-lightest{% endif %} {% if not root %}pl-8 pr-8{% endif %} rounded">
<div class="{% if open %}is-open{% endif %}">
Expand Down Expand Up @@ -80,9 +81,8 @@
</div>
</div>

{% if prop.description() %}
<div class="text-sm markdown">{{ prop.description() | markdown2html | safe }}</div>
{% endif %}
{{ getDescription(altDescription or prop.description()) }}

{% if prop.default() !== undefined %}
<div class="text-xs">Default: {{prop.default() | dump}}</div>
{% endif %}
Expand Down

0 comments on commit 959b31a

Please sign in to comment.