Skip to content

Commit c01a838

Browse files
author
Dave Conway-Jones
committed
Add license to swagger README
1 parent c4b1df3 commit c01a838

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

lib/nodegen.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,20 @@ function swagger2node(data, options) {
522522
mustache: {
523523
nodeName: data.name,
524524
projectName: data.module,
525+
licenseName: function () {
526+
if (swagger.info.license && swagger.info.license.name) {
527+
return swagger.info.license.name;
528+
} else {
529+
return 'Apache-2.0';
530+
}
531+
},
532+
licenseUrl: function () {
533+
if (swagger.info.license && swagger.info.license.url) {
534+
return swagger.info.license.url;
535+
} else {
536+
return '';
537+
}
538+
}
525539
},
526540
lint: false,
527541
beautify: false

templates/swagger/LICENSE.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{{&licenseName}}
2-
{{&licenseUrl}}
1+
#### {{&licenseName}}
32

3+
{{&licenseUrl}}

templates/swagger/README.md.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ command in your Node-RED user directory, typically `~/.node-red`
3131
{{/headers}}
3232

3333
{{/methods}}
34+
35+
## License
36+
37+
#### {{&licenseName}}
38+
39+
{{&licenseUrl}}

0 commit comments

Comments
 (0)