Skip to content

Commit 6c8e087

Browse files
committed
template: Save additional top-level properties
1 parent 79abc54 commit 6c8e087

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Add "responses" information from AS3 tasks to FAST tasks
66
* Add operation information (e.g., update vs delete) to FAST tasks
77
* Merge definitions and default parameters from base templates
8+
* Save additional, top-level properties found on YAML templates
89

910
## Fixed
1011
* Missing type schema when merging templates

lib/template.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,15 @@ class Template {
457457
const tmpl = new this();
458458
const yamldata = yaml.safeLoad(yamltext);
459459
tmpl._recordSource('YAML', yamltext);
460-
tmpl.templateText = yamldata.template;
461460

462-
if (yamldata.title) tmpl.title = yamldata.title;
463-
if (yamldata.description) tmpl.description = yamldata.description;
464-
if (yamldata.definitions) tmpl.definitions = yamldata.definitions;
465-
if (yamldata.parameters) tmpl.defaultParameters = yamldata.parameters;
466-
if (yamldata.contentType) tmpl.contentType = yamldata.contentType;
461+
Object.assign(tmpl, yamldata);
462+
tmpl.templateText = tmpl.template || tmpl.templateText;
463+
delete tmpl.template;
464+
tmpl.defaultParameters = tmpl.parameters || tmpl.defaultParameters;
465+
delete tmpl.parameters;
466+
delete tmpl.anyOf;
467+
delete tmpl.oneOf;
468+
delete tmpl.anyOf;
467469

468470
const oneOf = yamldata.oneOf || [];
469471
const allOf = yamldata.allOf || [];

0 commit comments

Comments
 (0)