Skip to content

Commit

Permalink
format swagger info box and more info in readme
Browse files Browse the repository at this point in the history
works for GET - not so good for POST yet.
  • Loading branch information
Dave Conway-Jones committed Dec 23, 2019
1 parent 2d26d43 commit e234952
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
22 changes: 12 additions & 10 deletions templates/swagger/README.md.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@ Node-RED node for {{&nodeName}}

{{&description}}

Install
-------
## Install

To install the stable version use the `Menu - Manage palette - Install`
option and search for {{&projectName}}, or run the following
To install the stable version use the `Menu - Manage palette - Install`
option and search for {{&projectName}}, or run the following
command in your Node-RED user directory, typically `~/.node-red`

npm install {{&projectName}}

Usage
-----
## Usage

### Methods

{{#methods}}
- {{&method}} {{&path}}
#### {{&method}} {{&path}}

{{&summary}}

{{#parameters}}
{{&name}}
{{&name}} : {{&type}}
{{/parameters}}

{{&summary}}

{{#headers}}
{{&name}} : {{&value}}
{{/headers}}

{{/methods}}
22 changes: 13 additions & 9 deletions templates/swagger/node.html.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
},
inputs: 1,
outputs: 1,
icon: '{{&icon}}',
label: function () {
return this.name || this.method || "{{&nodeName}}";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
icon: '{{&icon}}',
align: 'left',
oneditprepare: function () {
var selectedMethod = $('#node-input-method option:selected');
if (!selectedMethod.val()) {
Expand Down Expand Up @@ -116,7 +115,7 @@
});
</script>

<script type="text/x-red" data-template-name="{{&nodeName}}">
<script type="text/html" data-template-name="{{&nodeName}}">
{{#hasServiceParams}}
<div class="form-row">
<label for="node-input-service"><i class="fa fa-cloud"></i> <span data-i18n="{{&className}}.label.service"></span></label>
Expand Down Expand Up @@ -171,13 +170,18 @@
</div>
</script>

<script type="text/x-red" data-help-name="{{&nodeName}}">
<script type="text/html" data-help-name="{{&nodeName}}">
{{{name}}}
<p>{{&description}}</p>
<h2>Methods</h2>
<p><b>Methods</b></p>
{{#methods}}
<h3>{{&methodName}}</h3>
<h4>{{&summary}}</h4>
<h3>{{&method}} {{&path}}</h3>
<p>{{&summary}}</p>
<dl class="message-properties">
{{#parameters}}
<dt>{{&name}} <span class="property-type">{{&type}}</span></dt>
{{/parameters}}
</dl>
{{/methods}}
</script>
{{#hasServiceParams}}
Expand Down Expand Up @@ -251,7 +255,7 @@
});
</script>

<script type="text/x-red" data-template-name="{{&nodeName}}-service">
<script type="text/html" data-template-name="{{&nodeName}}-service">
{{^domain}}
<div class="form-row">
<label for="node-config-input-host"><i class="fa fa-globe"></i> <span data-i18n="{{&className}}.label.host"></span></label>
Expand Down Expand Up @@ -295,7 +299,7 @@
</div>
</script>

<script type="text/x-red" data-help-name="{{&nodeName}}-service">
<script type="text/html" data-help-name="{{&nodeName}}-service">
{{^domain}}
<p><b>Host</b>: URL to connect</p>
{{/domain}}
Expand Down

0 comments on commit e234952

Please sign in to comment.