@sebspark/openapi-typegen 3.0.0 → 3.0.1
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/index.js +15 -15
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -41,6 +41,16 @@ var import_node_path = require("path");
|
|
|
41
41
|
var import_change_case2 = require("change-case");
|
|
42
42
|
var YAML = __toESM(require("yaml"));
|
|
43
43
|
|
|
44
|
+
// src/generator/formatter.ts
|
|
45
|
+
var import_prettier = require("prettier");
|
|
46
|
+
var options = {
|
|
47
|
+
parser: "typescript",
|
|
48
|
+
singleQuote: true,
|
|
49
|
+
semi: false,
|
|
50
|
+
trailingComma: "all"
|
|
51
|
+
};
|
|
52
|
+
var format = async (code) => (0, import_prettier.format)(code, options);
|
|
53
|
+
|
|
44
54
|
// src/generator/common.ts
|
|
45
55
|
var import_change_case = require("change-case");
|
|
46
56
|
|
|
@@ -379,7 +389,7 @@ var wrapArgs = (args, wrap) => {
|
|
|
379
389
|
return `LowerCaseHeaders<${args}>`;
|
|
380
390
|
};
|
|
381
391
|
var argsOptional = (args) => (
|
|
382
|
-
// biome-ignore lint/style/noNonNullAssertion:
|
|
392
|
+
// biome-ignore lint/style/noNonNullAssertion: will never be null
|
|
383
393
|
parts.reduce((o, p) => o && (!args[p] || args[p].optional), true)
|
|
384
394
|
);
|
|
385
395
|
|
|
@@ -529,16 +539,6 @@ var generateComponents = (components) => {
|
|
|
529
539
|
return tokens.join("\n\n");
|
|
530
540
|
};
|
|
531
541
|
|
|
532
|
-
// src/generator/formatter.ts
|
|
533
|
-
var import_prettier = require("prettier");
|
|
534
|
-
var options = {
|
|
535
|
-
parser: "typescript",
|
|
536
|
-
singleQuote: true,
|
|
537
|
-
semi: false,
|
|
538
|
-
trailingComma: "all"
|
|
539
|
-
};
|
|
540
|
-
var format = async (code) => (0, import_prettier.format)(code, options);
|
|
541
|
-
|
|
542
542
|
// src/parser/common.ts
|
|
543
543
|
var parseRef = (ref) => ref.substring(ref.lastIndexOf("/") + 1);
|
|
544
544
|
var parseEnumType = (name, schema) => ({ name, type: "enum", values: schema.enum || [] });
|
|
@@ -710,7 +710,7 @@ var parseHeader = (name, schema) => {
|
|
|
710
710
|
const header = {
|
|
711
711
|
name,
|
|
712
712
|
optional: !schema.required,
|
|
713
|
-
// biome-ignore lint/style/noNonNullAssertion:
|
|
713
|
+
// biome-ignore lint/style/noNonNullAssertion: here it is always defined
|
|
714
714
|
type: parseSchema(void 0, schema.schema),
|
|
715
715
|
...parseDocumentation(schema)
|
|
716
716
|
};
|
|
@@ -727,7 +727,7 @@ var parseParameter = (name, schema) => {
|
|
|
727
727
|
in: schema.in,
|
|
728
728
|
parameterName: schema.name,
|
|
729
729
|
optional: !schema.required,
|
|
730
|
-
// biome-ignore lint/style/noNonNullAssertion:
|
|
730
|
+
// biome-ignore lint/style/noNonNullAssertion: schema is always defined here
|
|
731
731
|
type: parseSchema(void 0, schema.schema),
|
|
732
732
|
...parseDocumentation(schema)
|
|
733
733
|
};
|
|
@@ -785,7 +785,7 @@ var joinArg = (arg1, arg2) => {
|
|
|
785
785
|
var parseSecurity = (security = [], components = {}) => {
|
|
786
786
|
const args = {};
|
|
787
787
|
for (const secReq of security) {
|
|
788
|
-
for (const [name
|
|
788
|
+
for (const [name] of Object.entries(secReq)) {
|
|
789
789
|
const param2 = findRef(
|
|
790
790
|
components,
|
|
791
791
|
`#/components/securitySchemes/${name}`
|
|
@@ -822,7 +822,7 @@ var parseParameters2 = (parameters = [], components = {}) => {
|
|
|
822
822
|
arg.properties.push({
|
|
823
823
|
name,
|
|
824
824
|
optional: !header.required,
|
|
825
|
-
// biome-ignore lint/style/noNonNullAssertion:
|
|
825
|
+
// biome-ignore lint/style/noNonNullAssertion: schema is never null here
|
|
826
826
|
type: [{ type: parseSchema(void 0, header.schema).type }],
|
|
827
827
|
...parseDocumentation(header.schema || {})
|
|
828
828
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/openapi-typegen",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"boxen": "<6",
|
|
27
27
|
"chalk": "<5",
|
|
28
28
|
"change-case": "4.1.2",
|
|
29
|
-
"prettier": "3.6.
|
|
30
|
-
"yaml": "2.8.
|
|
29
|
+
"prettier": "3.6.2",
|
|
30
|
+
"yaml": "2.8.1",
|
|
31
31
|
"yargs": "17.7.2"
|
|
32
32
|
}
|
|
33
33
|
}
|