gtx-cli 2.5.39 → 2.5.40
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.5.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#927](https://github.com/generaltranslation/gt/pull/927) [`f0f86f3`](https://github.com/generaltranslation/gt/commit/f0f86f3c2dbb90d43029f64def2b3dc43584bad7) Thanks [@fernando-aviles](https://github.com/fernando-aviles)! - Adding YAML support for Mintlify OpenAPI configurations
|
|
8
|
+
|
|
3
9
|
## 2.5.39
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.5.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.5.40";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const PACKAGE_VERSION = '2.5.
|
|
2
|
+
export const PACKAGE_VERSION = '2.5.40';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ const HTTP_METHODS = new Set([
|
|
|
16
16
|
'HEAD',
|
|
17
17
|
'TRACE',
|
|
18
18
|
]);
|
|
19
|
+
const OPENAPI_SPEC_EXTENSIONS = new Set(['.json', '.yaml', '.yml']);
|
|
19
20
|
/**
|
|
20
21
|
* Postprocess Mintlify OpenAPI references to point to locale-specific spec files.
|
|
21
22
|
* - Uses openapi.files (ordered) to resolve ambiguities (first match wins).
|
|
@@ -78,7 +79,7 @@ export default async function processOpenApi(settings, includeFiles) {
|
|
|
78
79
|
/**
|
|
79
80
|
* Resolve configured OpenAPI files to absolute paths and collect the operations,
|
|
80
81
|
* schemas, and webhooks they expose. Warns and skips when files are missing,
|
|
81
|
-
* unsupported (non-JSON), or fail to parse so later steps can continue gracefully.
|
|
82
|
+
* unsupported (non-JSON/YAML), or fail to parse so later steps can continue gracefully.
|
|
82
83
|
*/
|
|
83
84
|
function buildSpecAnalyses(openapiFiles, configDir) {
|
|
84
85
|
const analyses = [];
|
|
@@ -88,17 +89,19 @@ function buildSpecAnalyses(openapiFiles, configDir) {
|
|
|
88
89
|
logger.warn(`OpenAPI file not found: ${configEntry}`);
|
|
89
90
|
continue;
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
const ext = path.extname(absPath).toLowerCase();
|
|
93
|
+
if (!OPENAPI_SPEC_EXTENSIONS.has(ext)) {
|
|
94
|
+
logger.warn(`Skipping OpenAPI file (only .json/.yml/.yaml supported): ${configEntry}`);
|
|
93
95
|
continue;
|
|
94
96
|
}
|
|
95
97
|
let spec;
|
|
96
98
|
try {
|
|
97
99
|
const raw = fs.readFileSync(absPath, 'utf8');
|
|
98
|
-
spec = JSON.parse(raw);
|
|
100
|
+
spec = ext === '.json' ? JSON.parse(raw) : YAML.parse(raw);
|
|
99
101
|
}
|
|
100
102
|
catch {
|
|
101
|
-
|
|
103
|
+
const format = ext === '.json' ? 'JSON' : 'YAML';
|
|
104
|
+
logger.warn(`Failed to parse OpenAPI ${format}: ${configEntry}`);
|
|
102
105
|
continue;
|
|
103
106
|
}
|
|
104
107
|
analyses.push({
|
|
@@ -254,7 +257,7 @@ function parseOpenApiValue(value) {
|
|
|
254
257
|
const first = tokens[0];
|
|
255
258
|
const second = tokens[1];
|
|
256
259
|
const methodCandidate = second?.toUpperCase();
|
|
257
|
-
const firstLooksLikeSpec = first
|
|
260
|
+
const firstLooksLikeSpec = hasOpenApiSpecExtension(first) ||
|
|
258
261
|
(second &&
|
|
259
262
|
(second.toLowerCase() === 'webhook' ||
|
|
260
263
|
(methodCandidate && HTTP_METHODS.has(methodCandidate))));
|
|
@@ -291,7 +294,7 @@ function parseSchemaValue(value) {
|
|
|
291
294
|
return null;
|
|
292
295
|
let cursor = 0;
|
|
293
296
|
let specPath;
|
|
294
|
-
if (tokens[0]
|
|
297
|
+
if (hasOpenApiSpecExtension(tokens[0])) {
|
|
295
298
|
specPath = tokens[0];
|
|
296
299
|
cursor = 1;
|
|
297
300
|
}
|
|
@@ -416,6 +419,9 @@ function stripExtension(p) {
|
|
|
416
419
|
const parsed = path.parse(p);
|
|
417
420
|
return normalizeSlashes(path.join(parsed.dir, parsed.name));
|
|
418
421
|
}
|
|
422
|
+
function hasOpenApiSpecExtension(value) {
|
|
423
|
+
return OPENAPI_SPEC_EXTENSIONS.has(path.extname(value).toLowerCase());
|
|
424
|
+
}
|
|
419
425
|
/** Normalize separators for stable comparisons and output. */
|
|
420
426
|
function normalizeSlashes(p) {
|
|
421
427
|
return p.replace(/\\/g, '/');
|