From f72bc86516b6fe219930dec4ddd53c82cf7b8078 Mon Sep 17 00:00:00 2001 From: Eric Wittmann Date: Fri, 3 May 2024 12:28:04 -0400 Subject: [PATCH] Fixed a YAML load/dump error (dependency upgrade) --- .../_components/dialogs/add-aai-example.component.ts | 4 ++-- .../editor/_components/dialogs/add-example-20.component.ts | 2 +- .../editor/_components/dialogs/add-example.component.ts | 2 +- .../_components/dialogs/edit-aai-example.component.ts | 6 +++--- .../_components/dialogs/edit-example-20.component.ts | 2 +- .../editor/_components/dialogs/edit-example.component.ts | 2 +- .../src/app/editor/_components/forms/source-form.base.ts | 7 ++++--- .../src/app/editor/_services/api-catalog.service.ts | 2 +- ui/ui-editors/src/app/editor/aaieditor.component.ts | 4 ++-- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ui/ui-editors/src/app/editor/_components/dialogs/add-aai-example.component.ts b/ui/ui-editors/src/app/editor/_components/dialogs/add-aai-example.component.ts index a0c1ee276..6a02863f3 100644 --- a/ui/ui-editors/src/app/editor/_components/dialogs/add-aai-example.component.ts +++ b/ui/ui-editors/src/app/editor/_components/dialogs/add-aai-example.component.ts @@ -69,7 +69,7 @@ export class AddAsyncApiExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) { } @@ -89,7 +89,7 @@ export class AddAsyncApiExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) { } diff --git a/ui/ui-editors/src/app/editor/_components/dialogs/add-example-20.component.ts b/ui/ui-editors/src/app/editor/_components/dialogs/add-example-20.component.ts index c6e7462e1..3427bb1e6 100644 --- a/ui/ui-editors/src/app/editor/_components/dialogs/add-example-20.component.ts +++ b/ui/ui-editors/src/app/editor/_components/dialogs/add-example-20.component.ts @@ -63,7 +63,7 @@ export class AddExample20DialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) { } diff --git a/ui/ui-editors/src/app/editor/_components/dialogs/add-example.component.ts b/ui/ui-editors/src/app/editor/_components/dialogs/add-example.component.ts index 8f18fe6ca..d33ae5e81 100644 --- a/ui/ui-editors/src/app/editor/_components/dialogs/add-example.component.ts +++ b/ui/ui-editors/src/app/editor/_components/dialogs/add-example.component.ts @@ -63,7 +63,7 @@ export class AddExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) { } diff --git a/ui/ui-editors/src/app/editor/_components/dialogs/edit-aai-example.component.ts b/ui/ui-editors/src/app/editor/_components/dialogs/edit-aai-example.component.ts index 2e5ef0c1c..add4108de 100644 --- a/ui/ui-editors/src/app/editor/_components/dialogs/edit-aai-example.component.ts +++ b/ui/ui-editors/src/app/editor/_components/dialogs/edit-aai-example.component.ts @@ -75,7 +75,7 @@ export class EditAsyncApiExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) { } @@ -95,7 +95,7 @@ export class EditAsyncApiExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) { } @@ -221,7 +221,7 @@ export class EditAsyncApiExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) {} } diff --git a/ui/ui-editors/src/app/editor/_components/dialogs/edit-example-20.component.ts b/ui/ui-editors/src/app/editor/_components/dialogs/edit-example-20.component.ts index bc1f1a2ca..56369d285 100644 --- a/ui/ui-editors/src/app/editor/_components/dialogs/edit-example-20.component.ts +++ b/ui/ui-editors/src/app/editor/_components/dialogs/edit-example-20.component.ts @@ -159,7 +159,7 @@ export class EditExample20DialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) {} } diff --git a/ui/ui-editors/src/app/editor/_components/dialogs/edit-example.component.ts b/ui/ui-editors/src/app/editor/_components/dialogs/edit-example.component.ts index a67f15dbb..019d1a7a8 100644 --- a/ui/ui-editors/src/app/editor/_components/dialogs/edit-example.component.ts +++ b/ui/ui-editors/src/app/editor/_components/dialogs/edit-example.component.ts @@ -157,7 +157,7 @@ export class EditExampleDialogComponent { } else { this.model.format = CodeEditorMode.YAML; try { - YAML.safeLoad(value); + YAML.load(value); this.model.valid = true; } catch (e) {} } diff --git a/ui/ui-editors/src/app/editor/_components/forms/source-form.base.ts b/ui/ui-editors/src/app/editor/_components/forms/source-form.base.ts index e42dbc6e2..28a90318e 100644 --- a/ui/ui-editors/src/app/editor/_components/forms/source-form.base.ts +++ b/ui/ui-editors/src/app/editor/_components/forms/source-form.base.ts @@ -86,7 +86,7 @@ export abstract class SourceFormComponent extends AbstractBaseCo try { let newJsObject: any; if (this._sourceFormat === CodeEditorMode.YAML) { - newJsObject = YAML.safeLoad(newSource); + newJsObject = YAML.load(newSource); } else { newJsObject = JSON.parse(newSource); } @@ -99,6 +99,7 @@ export abstract class SourceFormComponent extends AbstractBaseCo this._source.valid = true; } catch (e) { // OK to suppress this - it's likely the case that the text isn't valid/parseable. + console.error(e); } } @@ -177,7 +178,7 @@ export abstract class SourceFormComponent extends AbstractBaseCo parsedSource = JSON.parse(this._sourceText); this.setSourceFormat(CodeEditorMode.YAML); } else { - parsedSource = YAML.safeLoad(this._sourceText); + parsedSource = YAML.load(this._sourceText); this.setSourceFormat(CodeEditorMode.JSON); } if (parsedSource) { @@ -207,7 +208,7 @@ export abstract class SourceFormComponent extends AbstractBaseCo if (this.isSourceFormatJson()) { parsedSource = JSON.parse(this._sourceText); } else { - parsedSource = YAML.safeLoad(this._sourceText); + parsedSource = YAML.load(this._sourceText); } if (parsedSource) { let newSource: string; diff --git a/ui/ui-editors/src/app/editor/_services/api-catalog.service.ts b/ui/ui-editors/src/app/editor/_services/api-catalog.service.ts index a8d9f0430..6934362ad 100644 --- a/ui/ui-editors/src/app/editor/_services/api-catalog.service.ts +++ b/ui/ui-editors/src/app/editor/_services/api-catalog.service.ts @@ -172,7 +172,7 @@ export class ApiCatalogService { return body; } try { return JSON.parse(body); } catch (e) {} - try { return YAML.safeLoad(body); } catch (e) {} + try { return YAML.load(body); } catch (e) {} // TODO debug or warning here return null; } diff --git a/ui/ui-editors/src/app/editor/aaieditor.component.ts b/ui/ui-editors/src/app/editor/aaieditor.component.ts index db1d895b6..722ebc6f3 100644 --- a/ui/ui-editors/src/app/editor/aaieditor.component.ts +++ b/ui/ui-editors/src/app/editor/aaieditor.component.ts @@ -581,7 +581,7 @@ export class AaiEditorComponent extends AbstractApiEditorComponent implements On console.info("[AsyncApiEditorComponent] Saving source code changes"); try { let doc: AaiDocument = this.document(); - let newJs: any = YAML.safeLoad(this.sourceValue); + let newJs: any = YAML.load(this.sourceValue); let newDoc: AaiDocument = Library.readDocument(newJs) as AaiDocument; let command: ICommand = CommandFactory.createReplaceDocumentCommand(doc, newDoc); this.commandService.emit(command); @@ -603,7 +603,7 @@ export class AaiEditorComponent extends AbstractApiEditorComponent implements On */ public validate(): void { try { - YAML.safeLoad(this.sourceValue); + YAML.load(this.sourceValue); this.sourceIsValid = true; } catch (e) { this.sourceIsValid = false;