Merge pull request #20009 from npiyush97/fix-18778

Fix 18778 : template editor fails with multiple templates per file
This commit is contained in:
Fredrik Adelöw
2023-09-20 21:30:25 +02:00
committed by GitHub
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
fixed issue related template editor fails with multiple templates per file.
@@ -123,7 +123,10 @@ export function TemplateEditorForm(props: TemplateEditorFormProps) {
setSteps(undefined);
return;
}
const parsed: JsonValue = yaml.parse(content);
const parsed: JsonValue = yaml
.parseAllDocuments(content)
.filter(c => c)
.map(c => c.toJSON())[0];
if (!isJsonObject(parsed)) {
setSteps(undefined);