swagger-typescript-api 13.6.5 → 13.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +11 -11
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-9Z1llXJS.mjs → src-B-lBUhqS.mjs} +59 -3
- package/dist/src-B-lBUhqS.mjs.map +1 -0
- package/dist/{src-DNKGwk6n.cjs → src-BROE-dEG.cjs} +59 -3
- package/dist/src-BROE-dEG.cjs.map +1 -0
- package/package.json +9 -9
- package/dist/src-9Z1llXJS.mjs.map +0 -1
- package/dist/src-DNKGwk6n.cjs.map +0 -1
|
@@ -213,7 +213,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region package.json
|
|
215
215
|
var name = "swagger-typescript-api";
|
|
216
|
-
var version = "13.6.
|
|
216
|
+
var version = "13.6.6";
|
|
217
217
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/constants.ts
|
|
@@ -2367,6 +2367,61 @@ var SchemaRoutes = class {
|
|
|
2367
2367
|
};
|
|
2368
2368
|
//#endregion
|
|
2369
2369
|
//#region src/util/parse-schema-content.ts
|
|
2370
|
+
/**
|
|
2371
|
+
* Some OpenAPI YAML files use a double-quoted value that spans a newline without
|
|
2372
|
+
* a trailing `\` (invalid YAML 1.2; see acacode/swagger-typescript-api#1433):
|
|
2373
|
+
*
|
|
2374
|
+
* description: "first line
|
|
2375
|
+
* tail"
|
|
2376
|
+
*
|
|
2377
|
+
* `yaml` rejects that with "Missing closing quote". We fold it into one line using
|
|
2378
|
+
* an escaped newline inside the scalar: `"first line\ntail"`.
|
|
2379
|
+
*
|
|
2380
|
+
* If the first line ends with `\`, it is a normal YAML line continuation and is
|
|
2381
|
+
* left for {@link normalizeYamlEscapedLineBreaks}.
|
|
2382
|
+
*/
|
|
2383
|
+
function mergeBrokenDoubleQuotedMapLines(content) {
|
|
2384
|
+
const lines = content.split(/\r?\n|\r/);
|
|
2385
|
+
const result = [];
|
|
2386
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
2387
|
+
const current = lines[i];
|
|
2388
|
+
if (current === void 0) break;
|
|
2389
|
+
const following = lines[i + 1];
|
|
2390
|
+
const repaired = following === void 0 ? null : tryRepairSplitDoubleQuotedMapValue(current, following);
|
|
2391
|
+
if (repaired) {
|
|
2392
|
+
result.push(repaired);
|
|
2393
|
+
i += 1;
|
|
2394
|
+
continue;
|
|
2395
|
+
}
|
|
2396
|
+
result.push(current);
|
|
2397
|
+
}
|
|
2398
|
+
return result.join("\n");
|
|
2399
|
+
}
|
|
2400
|
+
function tryRepairSplitDoubleQuotedMapValue(line, nextLine) {
|
|
2401
|
+
const unterminated = matchMapKeyOpeningDoubleQuotedScalar(line);
|
|
2402
|
+
if (!unterminated) return null;
|
|
2403
|
+
const closing = matchSingleWordThenClosingQuote(nextLine);
|
|
2404
|
+
if (!closing) return null;
|
|
2405
|
+
const { keyPrefixAndQuote, valueBeforeBreak } = unterminated;
|
|
2406
|
+
const { closingWord } = closing;
|
|
2407
|
+
if (valueBeforeBreak.endsWith("\\")) return null;
|
|
2408
|
+
return `${keyPrefixAndQuote}${valueBeforeBreak}\\n${closingWord}"`;
|
|
2409
|
+
}
|
|
2410
|
+
/** ` foo: "text` with no `"` before end of line (value may be empty). */
|
|
2411
|
+
function matchMapKeyOpeningDoubleQuotedScalar(line) {
|
|
2412
|
+
const match = /^(\s+[A-Za-z_][\w-]*:\s*")([^"]*)$/.exec(line);
|
|
2413
|
+
if (!match?.[1] || match[2] === void 0) return null;
|
|
2414
|
+
return {
|
|
2415
|
+
keyPrefixAndQuote: match[1],
|
|
2416
|
+
valueBeforeBreak: match[2]
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
/** ` word"` — only indentation, one identifier, closing quote. */
|
|
2420
|
+
function matchSingleWordThenClosingQuote(line) {
|
|
2421
|
+
const match = /^(\s*)([A-Za-z_][\w-]*)"\s*$/.exec(line);
|
|
2422
|
+
if (!match?.[2]) return null;
|
|
2423
|
+
return { closingWord: match[2] };
|
|
2424
|
+
}
|
|
2370
2425
|
function normalizeYamlEscapedLineBreaks(content) {
|
|
2371
2426
|
let normalized = "";
|
|
2372
2427
|
let inDoubleQuotedScalar = false;
|
|
@@ -2404,7 +2459,8 @@ function parseSchemaContent(content) {
|
|
|
2404
2459
|
try {
|
|
2405
2460
|
return JSON.parse(content);
|
|
2406
2461
|
} catch {
|
|
2407
|
-
|
|
2462
|
+
const merged = mergeBrokenDoubleQuotedMapLines(content);
|
|
2463
|
+
return yaml.parse(normalizeYamlEscapedLineBreaks(merged));
|
|
2408
2464
|
}
|
|
2409
2465
|
}
|
|
2410
2466
|
//#endregion
|
|
@@ -3650,4 +3706,4 @@ Object.defineProperty(exports, "version", {
|
|
|
3650
3706
|
}
|
|
3651
3707
|
});
|
|
3652
3708
|
|
|
3653
|
-
//# sourceMappingURL=src-
|
|
3709
|
+
//# sourceMappingURL=src-BROE-dEG.cjs.map
|