From f815f94359d00f413a601d2ac329aa5ea7857c76 Mon Sep 17 00:00:00 2001 From: Amrit Date: Mon, 11 Mar 2024 10:29:17 -0700 Subject: [PATCH 1/2] fix: set default version temporarily --- packages/openapi-parser/src/lib/Validator/Validator.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/openapi-parser/src/lib/Validator/Validator.ts b/packages/openapi-parser/src/lib/Validator/Validator.ts index 46bd8ac..d1e7e8b 100644 --- a/packages/openapi-parser/src/lib/Validator/Validator.ts +++ b/packages/openapi-parser/src/lib/Validator/Validator.ts @@ -52,6 +52,12 @@ export class Validator { // TODO: How does this work with a filesystem? this.specification = specification + // TODO: defaulting info.version to keep parser compatible with the previous one + // we should bubble this error up and not throw on it + if (this.specification?.info && !this.specification.info.version) { + this.specification.info.version = '0.0.1' + } + try { // AnyObject is empty or invalid if (specification === undefined || specification === null) { From 60554a53e9760b4b33253344a4b3139ae88793bd Mon Sep 17 00:00:00 2001 From: Amrit Date: Mon, 11 Mar 2024 10:36:48 -0700 Subject: [PATCH 2/2] docs(changeset): fix: make new parser behave like previous one on missing info.version --- .changeset/moody-rabbits-drum.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/moody-rabbits-drum.md diff --git a/.changeset/moody-rabbits-drum.md b/.changeset/moody-rabbits-drum.md new file mode 100644 index 0000000..43727cf --- /dev/null +++ b/.changeset/moody-rabbits-drum.md @@ -0,0 +1,5 @@ +--- +"@scalar/openapi-parser": patch +--- + +fix: make new parser behave like previous one on missing info.version