@sdk-it/typescript 0.37.1 → 0.39.0
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/connect.d.ts +1 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/global.d.js +1 -0
- package/dist/global.d.js.map +7 -0
- package/dist/index.js +102 -541
- package/dist/index.js.map +2 -2
- package/dist/lib/client.d.ts +1 -2
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/connect.d.ts +162 -0
- package/dist/lib/connect.d.ts.map +1 -0
- package/dist/lib/generate.d.ts.map +1 -1
- package/dist/lib/generator.d.ts.map +1 -1
- package/dist/lib/sdk.d.ts +1 -5
- package/dist/lib/sdk.d.ts.map +1 -1
- package/dist/lib/style.d.ts +0 -3
- package/dist/lib/style.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/lib/agent/ai-sdk.js +60 -0
- package/dist/src/lib/agent/ai-sdk.js.map +7 -0
- package/dist/src/lib/agent/openai-agents.js +42 -0
- package/dist/src/lib/agent/openai-agents.js.map +7 -0
- package/dist/src/lib/client.js +152 -0
- package/dist/src/lib/client.js.map +7 -0
- package/dist/src/lib/emitters/interface.js +169 -0
- package/dist/src/lib/emitters/interface.js.map +7 -0
- package/dist/src/lib/emitters/snippet.js +191 -0
- package/dist/src/lib/emitters/snippet.js.map +7 -0
- package/dist/src/lib/emitters/zod.js +271 -0
- package/dist/src/lib/emitters/zod.js.map +7 -0
- package/dist/src/lib/generate.js +382 -0
- package/dist/src/lib/generate.js.map +7 -0
- package/dist/src/lib/generator.js +268 -0
- package/dist/src/lib/generator.js.map +7 -0
- package/dist/src/lib/import-utilities.js +56 -0
- package/dist/src/lib/import-utilities.js.map +7 -0
- package/dist/src/lib/options.js +3 -0
- package/dist/src/lib/options.js.map +7 -0
- package/dist/src/lib/readme/prop.emitter.js +283 -0
- package/dist/src/lib/readme/prop.emitter.js.map +7 -0
- package/dist/src/lib/readme/readme.js +105 -0
- package/dist/src/lib/readme/readme.js.map +7 -0
- package/dist/src/lib/sdk.js +236 -0
- package/dist/src/lib/sdk.js.map +7 -0
- package/dist/src/lib/status-map.js +28 -0
- package/dist/src/lib/status-map.js.map +7 -0
- package/dist/src/lib/style.js +1 -0
- package/dist/src/lib/style.js.map +7 -0
- package/dist/src/lib/typescript-snippet.js +738 -0
- package/dist/src/lib/typescript-snippet.js.map +7 -0
- package/package.json +4 -4
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { followRef, isRef, parseRef, pascalcase } from "@sdk-it/core";
|
|
2
|
+
import { isPrimitiveSchema, sanitizeTag } from "@sdk-it/spec";
|
|
3
|
+
class TypeScriptEmitter {
|
|
4
|
+
#spec;
|
|
5
|
+
constructor(spec) {
|
|
6
|
+
this.#spec = spec;
|
|
7
|
+
}
|
|
8
|
+
#stringifyKey = (value) => {
|
|
9
|
+
return `'${value}'`;
|
|
10
|
+
};
|
|
11
|
+
object(schema, required = false) {
|
|
12
|
+
const properties = schema.properties || {};
|
|
13
|
+
const propEntries = Object.entries(properties).map(([key, propSchema]) => {
|
|
14
|
+
const isRequired = (schema.required ?? []).includes(key);
|
|
15
|
+
const tsType = this.handle(propSchema, isRequired);
|
|
16
|
+
return `${this.#stringifyKey(key)}: ${tsType}`;
|
|
17
|
+
});
|
|
18
|
+
if (schema.additionalProperties) {
|
|
19
|
+
if (typeof schema.additionalProperties === "object") {
|
|
20
|
+
const indexType = this.handle(schema.additionalProperties, true);
|
|
21
|
+
propEntries.push(`[key: string]: ${indexType}`);
|
|
22
|
+
} else if (schema.additionalProperties === true) {
|
|
23
|
+
propEntries.push("[key: string]: any");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return `${propEntries.length ? `{ ${propEntries.join("; ")} }` : "unknown"}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Handle arrays (items could be a single schema or a tuple)
|
|
30
|
+
*/
|
|
31
|
+
#array(schema, required = false) {
|
|
32
|
+
const { items } = schema;
|
|
33
|
+
if (!items) {
|
|
34
|
+
return "any[]";
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(items)) {
|
|
37
|
+
const tupleItems = items.map((sub) => this.handle(sub, true));
|
|
38
|
+
return `[${tupleItems.join(", ")}]`;
|
|
39
|
+
}
|
|
40
|
+
const itemsType = this.handle(items, true);
|
|
41
|
+
return itemsType.length > 1 ? `(${itemsType})[]` : `${itemsType}[]`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Convert a basic type (string | number | boolean | object | array, etc.) to TypeScript
|
|
45
|
+
*/
|
|
46
|
+
normal(type, schema, required = false) {
|
|
47
|
+
switch (type) {
|
|
48
|
+
case "string":
|
|
49
|
+
return this.string(schema, required);
|
|
50
|
+
case "number":
|
|
51
|
+
case "integer":
|
|
52
|
+
return this.number(schema, required);
|
|
53
|
+
case "boolean":
|
|
54
|
+
return appendOptional("boolean", required);
|
|
55
|
+
case "object":
|
|
56
|
+
return this.object(schema, required);
|
|
57
|
+
case "array":
|
|
58
|
+
return this.#array(schema, required);
|
|
59
|
+
case "null":
|
|
60
|
+
return "null";
|
|
61
|
+
default:
|
|
62
|
+
console.warn(`Unknown type: ${type}`);
|
|
63
|
+
return appendOptional("any", required);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
#ref($ref, required) {
|
|
67
|
+
const schemaName = pascalcase(sanitizeTag(parseRef($ref).model));
|
|
68
|
+
const schema = followRef(this.#spec, $ref);
|
|
69
|
+
if (isPrimitiveSchema(schema)) {
|
|
70
|
+
return this.handle(schema, required);
|
|
71
|
+
}
|
|
72
|
+
return `models.${appendOptional(schemaName, required)}`;
|
|
73
|
+
}
|
|
74
|
+
allOf(schemas) {
|
|
75
|
+
const allOfTypes = schemas.map((sub) => this.handle(sub, true));
|
|
76
|
+
return allOfTypes.length > 1 ? `${allOfTypes.join(" & ")}` : allOfTypes[0];
|
|
77
|
+
}
|
|
78
|
+
oneOf(schemas, required) {
|
|
79
|
+
const oneOfTypes = schemas.map((sub) => this.handle(sub, true));
|
|
80
|
+
return appendOptional(
|
|
81
|
+
oneOfTypes.length > 1 ? `${oneOfTypes.join(" | ")}` : oneOfTypes[0],
|
|
82
|
+
required
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
anyOf(schemas, required) {
|
|
86
|
+
return this.oneOf(schemas, required);
|
|
87
|
+
}
|
|
88
|
+
enum(values, required) {
|
|
89
|
+
const enumValues = values.map((val) => typeof val === "string" ? `'${val}'` : `${val}`).join(" | ");
|
|
90
|
+
return appendOptional(enumValues, required);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Handle string type with formats
|
|
94
|
+
*/
|
|
95
|
+
string(schema, required) {
|
|
96
|
+
let type;
|
|
97
|
+
if (schema.contentEncoding === "binary") {
|
|
98
|
+
return appendOptional("Blob", required);
|
|
99
|
+
}
|
|
100
|
+
switch (schema.format) {
|
|
101
|
+
case "date-time":
|
|
102
|
+
case "datetime":
|
|
103
|
+
case "date":
|
|
104
|
+
type = "Date";
|
|
105
|
+
break;
|
|
106
|
+
case "binary":
|
|
107
|
+
case "byte":
|
|
108
|
+
type = "Blob";
|
|
109
|
+
break;
|
|
110
|
+
case "int64":
|
|
111
|
+
type = "bigint";
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
type = "string";
|
|
115
|
+
}
|
|
116
|
+
return appendOptional(type, required);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Handle number/integer types with formats
|
|
120
|
+
*/
|
|
121
|
+
number(schema, required) {
|
|
122
|
+
const type = schema.format === "int64" ? "bigint" : "number";
|
|
123
|
+
return appendOptional(type, required);
|
|
124
|
+
}
|
|
125
|
+
handle(schema, required) {
|
|
126
|
+
if (isRef(schema)) {
|
|
127
|
+
return this.#ref(schema.$ref, required);
|
|
128
|
+
}
|
|
129
|
+
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
130
|
+
return this.allOf(schema.allOf);
|
|
131
|
+
}
|
|
132
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
133
|
+
return this.anyOf(schema.anyOf, required);
|
|
134
|
+
}
|
|
135
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
136
|
+
return this.oneOf(schema.oneOf, required);
|
|
137
|
+
}
|
|
138
|
+
if (schema.enum && Array.isArray(schema.enum)) {
|
|
139
|
+
return this.enum(schema.enum, required);
|
|
140
|
+
}
|
|
141
|
+
if (schema.const) {
|
|
142
|
+
return this.enum([schema.const], true);
|
|
143
|
+
}
|
|
144
|
+
const types = Array.isArray(schema.type) ? schema.type : schema.type ? [schema.type] : [];
|
|
145
|
+
if (!types.length) {
|
|
146
|
+
if ("properties" in schema) {
|
|
147
|
+
return this.object(schema, required);
|
|
148
|
+
}
|
|
149
|
+
return appendOptional("any", required);
|
|
150
|
+
}
|
|
151
|
+
if (types.length > 1) {
|
|
152
|
+
const realTypes = types.filter((t) => t !== "null");
|
|
153
|
+
if (realTypes.length === 1 && types.includes("null")) {
|
|
154
|
+
const tsType = this.normal(realTypes[0], schema, false);
|
|
155
|
+
return appendOptional(`${tsType} | null`, required);
|
|
156
|
+
}
|
|
157
|
+
const typeResults = types.map((t) => this.normal(t, schema, false));
|
|
158
|
+
return appendOptional(typeResults.join(" | "), required);
|
|
159
|
+
}
|
|
160
|
+
return this.normal(types[0], schema, required);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function appendOptional(type, isRequired) {
|
|
164
|
+
return isRequired ? type : `${type} | undefined`;
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
TypeScriptEmitter
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/lib/emitters/interface.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n ReferenceObject,\n SchemaObject\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef, parseRef, pascalcase } from '@sdk-it/core';\nimport { type IR, isPrimitiveSchema, sanitizeTag } from '@sdk-it/spec';\n\nexport class TypeScriptEmitter {\n #spec: IR;\n\n constructor(spec: IR) {\n this.#spec = spec;\n }\n #stringifyKey = (value: string): string => {\n return `'${value}'`;\n };\n\n object(schema: SchemaObject, required = false): string {\n const properties = schema.properties || {};\n\n const propEntries = Object.entries(properties).map(([key, propSchema]) => {\n const isRequired = (schema.required ?? []).includes(key);\n const tsType = this.handle(propSchema, isRequired);\n return `${this.#stringifyKey(key)}: ${tsType}`;\n });\n\n if (schema.additionalProperties) {\n if (typeof schema.additionalProperties === 'object') {\n const indexType = this.handle(schema.additionalProperties, true);\n propEntries.push(`[key: string]: ${indexType}`);\n } else if (schema.additionalProperties === true) {\n propEntries.push('[key: string]: any');\n }\n }\n\n return `${propEntries.length ? `{ ${propEntries.join('; ')} }` : 'unknown'}`;\n }\n\n /**\n * Handle arrays (items could be a single schema or a tuple)\n */\n #array(schema: SchemaObject, required = false): string {\n const { items } = schema;\n if (!items) {\n // No items => any[]\n return 'any[]';\n }\n\n // If items is an array => tuple\n if (Array.isArray(items)) {\n const tupleItems = items.map((sub) => this.handle(sub, true));\n return `[${tupleItems.join(', ')}]`;\n }\n\n // If items is a single schema => standard array\n const itemsType = this.handle(items, true);\n return itemsType.length > 1 ? `(${itemsType})[]` : `${itemsType}[]`;\n }\n\n /**\n * Convert a basic type (string | number | boolean | object | array, etc.) to TypeScript\n */\n normal(type: string, schema: SchemaObject, required = false): string {\n switch (type) {\n case 'string':\n return this.string(schema, required);\n case 'number':\n case 'integer':\n return this.number(schema, required);\n case 'boolean':\n return appendOptional('boolean', required);\n case 'object':\n return this.object(schema, required);\n case 'array':\n return this.#array(schema, required);\n case 'null':\n return 'null';\n default:\n console.warn(`Unknown type: ${type}`);\n // Unknown type -> fallback\n return appendOptional('any', required);\n }\n }\n\n #ref($ref: string, required: boolean): string {\n const schemaName = pascalcase(sanitizeTag(parseRef($ref).model));\n const schema = followRef(this.#spec, $ref);\n if (isPrimitiveSchema(schema)) {\n return this.handle(schema, required);\n }\n\n return `models.${appendOptional(schemaName, required)}`;\n }\n\n allOf(schemas: (SchemaObject | ReferenceObject)[]): string {\n // For TypeScript we use intersection types for allOf\n const allOfTypes = schemas.map((sub) => this.handle(sub, true));\n return allOfTypes.length > 1 ? `${allOfTypes.join(' & ')}` : allOfTypes[0];\n }\n\n oneOf(\n schemas: (SchemaObject | ReferenceObject)[],\n required: boolean,\n ): string {\n // For TypeScript we use union types for anyOf/oneOf\n const oneOfTypes = schemas.map((sub) => this.handle(sub, true));\n return appendOptional(\n oneOfTypes.length > 1 ? `${oneOfTypes.join(' | ')}` : oneOfTypes[0],\n required,\n );\n }\n anyOf(\n schemas: (SchemaObject | ReferenceObject)[],\n required: boolean,\n ): string {\n return this.oneOf(schemas, required);\n }\n\n enum(values: unknown[], required: boolean): string {\n // For TypeScript enums as union of literals\n const enumValues = values\n .map((val) => (typeof val === 'string' ? `'${val}'` : `${val}`))\n .join(' | ');\n return appendOptional(enumValues, required);\n }\n\n /**\n * Handle string type with formats\n */\n string(schema: SchemaObject, required?: boolean): string {\n let type: string;\n\n if (schema.contentEncoding === 'binary') {\n return appendOptional('Blob', required);\n }\n\n switch (schema.format) {\n case 'date-time':\n case 'datetime':\n case 'date':\n type = 'Date';\n break;\n case 'binary':\n case 'byte':\n type = 'Blob';\n break;\n case 'int64':\n type = 'bigint';\n break;\n default:\n type = 'string';\n }\n\n return appendOptional(type, required);\n }\n\n /**\n * Handle number/integer types with formats\n */\n number(schema: SchemaObject, required?: boolean): string {\n const type = schema.format === 'int64' ? 'bigint' : 'number';\n return appendOptional(type, required);\n }\n\n handle(schema: SchemaObject | ReferenceObject, required: boolean): string {\n if (isRef(schema)) {\n return this.#ref(schema.$ref, required);\n }\n\n // Handle allOf (intersection in TypeScript)\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return this.allOf(schema.allOf);\n }\n\n // anyOf (union in TypeScript)\n if (schema.anyOf && Array.isArray(schema.anyOf)) {\n return this.anyOf(schema.anyOf, required);\n }\n\n // oneOf (union in TypeScript)\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return this.oneOf(schema.oneOf, required);\n }\n\n // enum\n if (schema.enum && Array.isArray(schema.enum)) {\n return this.enum(schema.enum, required);\n }\n\n if (schema.const) {\n return this.enum([schema.const], true);\n }\n\n // Handle types, in TypeScript we can have union types directly\n const types = Array.isArray(schema.type)\n ? schema.type\n : schema.type\n ? [schema.type]\n : [];\n\n // If no explicit \"type\", fallback to any\n if (!types.length) {\n // unless properties are defined then assume object\n if ('properties' in schema) {\n return this.object(schema, required);\n }\n return appendOptional('any', required);\n }\n\n // Handle union types (multiple types)\n if (types.length > 1) {\n const realTypes = types.filter((t) => t !== 'null');\n if (realTypes.length === 1 && types.includes('null')) {\n // Single real type + \"null\"\n const tsType = this.normal(realTypes[0], schema, false);\n return appendOptional(`${tsType} | null`, required);\n }\n\n // Multiple different types\n const typeResults = types.map((t) => this.normal(t, schema, false));\n return appendOptional(typeResults.join(' | '), required);\n }\n\n // Single type\n return this.normal(types[0], schema, required);\n }\n}\n\nfunction appendOptional(type: string, isRequired?: boolean): string {\n return isRequired ? type : `${type} | undefined`;\n}\n"],
|
|
5
|
+
"mappings": "AAKA,SAAS,WAAW,OAAO,UAAU,kBAAkB;AACvD,SAAkB,mBAAmB,mBAAmB;AAEjD,MAAM,kBAAkB;AAAA,EAC7B;AAAA,EAEA,YAAY,MAAU;AACpB,SAAK,QAAQ;AAAA,EACf;AAAA,EACA,gBAAgB,CAAC,UAA0B;AACzC,WAAO,IAAI,KAAK;AAAA,EAClB;AAAA,EAEA,OAAO,QAAsB,WAAW,OAAe;AACrD,UAAM,aAAa,OAAO,cAAc,CAAC;AAEzC,UAAM,cAAc,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,UAAU,MAAM;AACxE,YAAM,cAAc,OAAO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AQ;AAC1B,eAAO,KAAK,OAAO,QAAQ,QAAQ;AAAA,MACrC;AACA,aAAO,eAAe,OAAO,QAAQ;AAAA,IACvC;AAGA,QAAI,MAAM,SAAS,GAAG;AACpB,YAAM,YAAY,MAAM,OAAO,CAAC,MAAM,MAAM,MAAM;AAClD,UAAI,UAAU,WAAW,KAAK,MAAM,SAAS,MAAM,GAAG;AAEpD,cAAM,SAAS,KAAK,OAAO,UAAU,CAAC,GAAG,QAAQ,KAAK;AACtD,eAAO,eAAe,GAAG,MAAM,WAAW,QAAQ;AAAA,MACpD;AAGA,YAAM,cAAc,MAAM,IAAI,CAAC,MAAM,KAAK,OAAO,GAAG,QAAQ,KAAK,CAAC;AAClE,aAAO,eAAe,YAAY,KAAK,KAAK,GAAG,QAAQ;AAAA,IACzD;AAGA,WAAO,KAAK,OAAO,MAAM,CAAC,GAAG,QAAQ,QAAQ;AAAA,EAC/C;AACF;AAEA,SAAS,eAAe,MAAc,YAA8B;AAClE,SAAO,aAAa,OAAO,GAAG,IAAI;AACpC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { followRef, isRef, resolveRef } from "@sdk-it/core";
|
|
2
|
+
class SnippetEmitter {
|
|
3
|
+
spec;
|
|
4
|
+
generatedRefs = /* @__PURE__ */ new Set();
|
|
5
|
+
cache = /* @__PURE__ */ new Map();
|
|
6
|
+
constructor(spec) {
|
|
7
|
+
this.spec = spec;
|
|
8
|
+
}
|
|
9
|
+
object(schema) {
|
|
10
|
+
const schemaObj = resolveRef(this.spec, schema);
|
|
11
|
+
const result = {};
|
|
12
|
+
const properties = schemaObj.properties || {};
|
|
13
|
+
for (const [propName, propSchema] of Object.entries(properties)) {
|
|
14
|
+
const isRequired = (schemaObj.required ?? []).includes(propName);
|
|
15
|
+
const resolvedProp = resolveRef(this.spec, propSchema);
|
|
16
|
+
if (isRequired || resolvedProp.example !== void 0 || resolvedProp.default !== void 0) {
|
|
17
|
+
result[propName] = this.handle(propSchema);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (schemaObj.additionalProperties && typeof schemaObj.additionalProperties === "object") {
|
|
21
|
+
result["additionalPropExample"] = this.handle(
|
|
22
|
+
schemaObj.additionalProperties
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
array(schema) {
|
|
28
|
+
const schemaObj = resolveRef(this.spec, schema);
|
|
29
|
+
const itemsSchema = schemaObj.items;
|
|
30
|
+
if (!itemsSchema) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const count = Math.min(schemaObj.minItems ?? 1, 2);
|
|
34
|
+
const result = [];
|
|
35
|
+
for (let i = 0; i < count; i++) {
|
|
36
|
+
result.push(this.handle(itemsSchema));
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
string(schema) {
|
|
41
|
+
if (schema.example !== void 0) return String(schema.example);
|
|
42
|
+
if (schema.default !== void 0) return String(schema.default);
|
|
43
|
+
switch (schema.format) {
|
|
44
|
+
case "date-time":
|
|
45
|
+
case "datetime":
|
|
46
|
+
return `2025-07-17T09:08:00.097Z`;
|
|
47
|
+
case "date":
|
|
48
|
+
return `2025-07-17`;
|
|
49
|
+
case "time":
|
|
50
|
+
return `09:08:00.097Z`;
|
|
51
|
+
case "email":
|
|
52
|
+
return "user@example.com";
|
|
53
|
+
case "uuid":
|
|
54
|
+
return "123e4567-e89b-12d3-a456-426614174000";
|
|
55
|
+
case "uri":
|
|
56
|
+
case "url":
|
|
57
|
+
return "https://example.com";
|
|
58
|
+
case "ipv4":
|
|
59
|
+
return "192.168.1.1";
|
|
60
|
+
case "ipv6":
|
|
61
|
+
return "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
|
|
62
|
+
case "hostname":
|
|
63
|
+
return "example.com";
|
|
64
|
+
case "binary":
|
|
65
|
+
case "byte":
|
|
66
|
+
return `new Blob(['example'], { type: 'text/plain' })`;
|
|
67
|
+
default:
|
|
68
|
+
if (schema.enum && schema.enum.length > 0) {
|
|
69
|
+
return String(schema.enum[0]);
|
|
70
|
+
}
|
|
71
|
+
return schema.pattern ? `string matching ${schema.pattern}` : "example";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
number(schema) {
|
|
75
|
+
if (schema.example !== void 0) return Number(schema.example);
|
|
76
|
+
if (schema.default !== void 0) return Number(schema.default);
|
|
77
|
+
let value;
|
|
78
|
+
if (typeof schema.exclusiveMinimum === "number") {
|
|
79
|
+
value = schema.exclusiveMinimum + 1;
|
|
80
|
+
} else if (typeof schema.minimum === "number") {
|
|
81
|
+
value = schema.minimum;
|
|
82
|
+
} else {
|
|
83
|
+
value = schema.type === "integer" ? 42 : 42.42;
|
|
84
|
+
}
|
|
85
|
+
if (typeof schema.exclusiveMaximum === "number" && value >= schema.exclusiveMaximum) {
|
|
86
|
+
value = schema.exclusiveMaximum - 1;
|
|
87
|
+
} else if (typeof schema.maximum === "number" && value > schema.maximum) {
|
|
88
|
+
value = schema.maximum;
|
|
89
|
+
}
|
|
90
|
+
if (typeof schema.multipleOf === "number" && value % schema.multipleOf !== 0) {
|
|
91
|
+
value = Math.floor(value / schema.multipleOf) * schema.multipleOf;
|
|
92
|
+
}
|
|
93
|
+
return schema.type === "integer" ? Math.floor(value) : value;
|
|
94
|
+
}
|
|
95
|
+
boolean(schema) {
|
|
96
|
+
if (schema.example !== void 0) return Boolean(schema.example);
|
|
97
|
+
if (schema.default !== void 0) return Boolean(schema.default);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
null() {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
ref($ref) {
|
|
104
|
+
const parts = $ref.split("/");
|
|
105
|
+
const refKey = parts[parts.length - 1] || "";
|
|
106
|
+
if (this.cache.has($ref)) {
|
|
107
|
+
return this.cache.get($ref);
|
|
108
|
+
}
|
|
109
|
+
this.cache.set($ref, { _ref: refKey });
|
|
110
|
+
const resolved = followRef(this.spec, $ref);
|
|
111
|
+
const result = this.handle(resolved);
|
|
112
|
+
this.cache.set($ref, result);
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
allOf(schemas) {
|
|
116
|
+
const initial = {};
|
|
117
|
+
return schemas.reduce((result, schema) => {
|
|
118
|
+
const example = this.handle(schema);
|
|
119
|
+
if (typeof example === "object" && example !== null) {
|
|
120
|
+
return { ...result, ...example };
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}, initial);
|
|
124
|
+
}
|
|
125
|
+
anyOf(schemas) {
|
|
126
|
+
if (schemas.length === 0) return {};
|
|
127
|
+
return this.handle(schemas[0]);
|
|
128
|
+
}
|
|
129
|
+
oneOf(schemas) {
|
|
130
|
+
if (schemas.length === 0) return {};
|
|
131
|
+
return this.handle(schemas[0]);
|
|
132
|
+
}
|
|
133
|
+
enum(schema) {
|
|
134
|
+
return Array.isArray(schema.enum) && schema.enum.length > 0 ? schema.enum[0] : void 0;
|
|
135
|
+
}
|
|
136
|
+
handle(schemaOrRef) {
|
|
137
|
+
if (isRef(schemaOrRef)) {
|
|
138
|
+
return this.ref(schemaOrRef.$ref);
|
|
139
|
+
}
|
|
140
|
+
const schema = resolveRef(this.spec, schemaOrRef);
|
|
141
|
+
if (schema.example !== void 0) {
|
|
142
|
+
return schema.example;
|
|
143
|
+
}
|
|
144
|
+
if (schema.default !== void 0) {
|
|
145
|
+
return schema.default;
|
|
146
|
+
}
|
|
147
|
+
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
148
|
+
return this.allOf(schema.allOf);
|
|
149
|
+
}
|
|
150
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
151
|
+
return this.anyOf(schema.anyOf);
|
|
152
|
+
}
|
|
153
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
154
|
+
return this.oneOf(schema.oneOf);
|
|
155
|
+
}
|
|
156
|
+
if (schema.enum && Array.isArray(schema.enum) && schema.enum.length > 0) {
|
|
157
|
+
return this.enum(schema);
|
|
158
|
+
}
|
|
159
|
+
const types = Array.isArray(schema.type) ? schema.type : schema.type ? [schema.type] : [];
|
|
160
|
+
if (types.length === 0) {
|
|
161
|
+
if (schema.properties || schema.additionalProperties) {
|
|
162
|
+
return this.object(schema);
|
|
163
|
+
} else if (schema.items) {
|
|
164
|
+
return this.array(schema);
|
|
165
|
+
}
|
|
166
|
+
return "example";
|
|
167
|
+
}
|
|
168
|
+
const primaryType = types.find((t) => t !== "null") || types[0];
|
|
169
|
+
switch (primaryType) {
|
|
170
|
+
case "string":
|
|
171
|
+
return this.string(schema);
|
|
172
|
+
case "number":
|
|
173
|
+
case "integer":
|
|
174
|
+
return this.number(schema);
|
|
175
|
+
case "boolean":
|
|
176
|
+
return this.boolean(schema);
|
|
177
|
+
case "object":
|
|
178
|
+
return this.object(schema);
|
|
179
|
+
case "array":
|
|
180
|
+
return this.array(schema);
|
|
181
|
+
case "null":
|
|
182
|
+
return this.null();
|
|
183
|
+
default:
|
|
184
|
+
return "unknown";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export {
|
|
189
|
+
SnippetEmitter
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=snippet.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/lib/emitters/snippet.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport { followRef, isRef, resolveRef } from '@sdk-it/core';\nimport type { IR } from '@sdk-it/spec';\n\n/**\n * Generate example values for OpenAPI schemas\n * This emitter creates sample input payloads for API documentation and code snippets\n */\nexport class SnippetEmitter {\n private spec: IR;\n public generatedRefs = new Set<string>();\n private cache = new Map<string, unknown>();\n\n constructor(spec: IR) {\n this.spec = spec;\n }\n\n public object(\n schema: SchemaObject | ReferenceObject,\n ): Record<string, unknown> {\n const schemaObj = resolveRef(this.spec, schema) as SchemaObject;\n const result: Record<string, unknown> = {};\n const properties = schemaObj.properties || {};\n\n for (const [propName, propSchema] of Object.entries(properties)) {\n const isRequired = (schemaObj.required ?? []).includes(propName);\n const resolvedProp = resolveRef(this.spec, propSchema);\n\n if (\n isRequired ||\n resolvedProp.example !== undefined ||\n resolvedProp.default !== undefined\n ) {\n result[propName] = this.handle(propSchema);\n }\n }\n\n if (\n schemaObj.additionalProperties &&\n typeof schemaObj.additionalProperties === 'object'\n ) {\n result['additionalPropExample'] = this.handle(\n schemaObj.additionalProperties,\n );\n }\n\n return result;\n }\n\n public array(schema: SchemaObject | ReferenceObject): unknown[] {\n const schemaObj = resolveRef(this.spec, schema);\n const itemsSchema = schemaObj.items;\n if (!itemsSchema) {\n return [];\n }\n\n const count = Math.min(schemaObj.minItems ?? 1, 2);\n const result: unknown[] = [];\n\n for (let i = 0; i < count; i++) {\n result.push(this.handle(itemsSchema));\n }\n\n return result;\n }\n\n public string(schema: SchemaObject): string {\n if (schema.example !== undefined) return String(schema.example);\n if (schema.default !== undefined) return String(schema.default);\n\n switch (schema.format) {\n case 'date-time':\n case 'datetime':\n return `2025-07-17T09:08:00.097Z`;\n case 'date':\n return `2025-07-17`;\n case 'time':\n return `09:08:00.097Z`;\n case 'email':\n return 'user@example.com';\n case 'uuid':\n return '123e4567-e89b-12d3-a456-426614174000';\n case 'uri':\n case 'url':\n return 'https://example.com';\n case 'ipv4':\n return '192.168.1.1';\n case 'ipv6':\n return '2001:0db8:85a3:0000:0000:8a2e:0370:7334';\n case 'hostname':\n return 'example.com';\n case 'binary':\n case 'byte':\n return `new Blob(['example'], { type: 'text/plain' })`;\n default:\n if (schema.enum && schema.enum.length > 0) {\n return String(schema.enum[0]);\n }\n return schema.pattern ? `string matching ${schema.pattern}` : 'example';\n }\n }\n\n public number(schema: SchemaObject): number {\n if (schema.example !== undefined) return Number(schema.example);\n if (schema.default !== undefined) return Number(schema.default);\n\n let value: number;\n if (typeof schema.exclusiveMinimum === 'number') {\n value = schema.exclusiveMinimum + 1;\n } else if (typeof schema.minimum === 'number') {\n value = schema.minimum;\n } else {\n value = schema.type === 'integer' ? 42 : 42.42;\n }\n\n if (\n typeof schema.exclusiveMaximum === 'number' &&\n value >= schema.exclusiveMaximum\n ) {\n value = schema.exclusiveMaximum - 1;\n } else if (typeof schema.maximum === 'number' && value > schema.maximum) {\n value = schema.maximum;\n }\n\n if (\n typeof schema.multipleOf === 'number' &&\n value % schema.multipleOf !== 0\n ) {\n value = Math.floor(value / schema.multipleOf) * schema.multipleOf;\n }\n\n return schema.type === 'integer' ? Math.floor(value) : value;\n }\n\n public boolean(schema: SchemaObject): boolean {\n if (schema.example !== undefined) return Boolean(schema.example);\n if (schema.default !== undefined) return Boolean(schema.default);\n return true;\n }\n\n public null(): null {\n return null;\n }\n\n public ref($ref: string): unknown {\n const parts = $ref.split('/');\n const refKey = parts[parts.length - 1] || '';\n\n if (this.cache.has($ref)) {\n return this.cache.get($ref) as unknown;\n }\n\n this.cache.set($ref, { _ref: refKey });\n\n const resolved = followRef<SchemaObject>(this.spec, $ref);\n const result = this.handle(resolved);\n\n this.cache.set($ref, result);\n return result;\n }\n\n public allOf(schemas: (SchemaObject | ReferenceObject)[]): unknown {\n const initial: Record<string, unknown> = {};\n return schemas.reduce<Record<string, unknown>>((result, schema) => {\n const example = this.handle(schema);\n if (typeof example === 'object' && example !== null) {\n return { ...result, ...example };\n }\n return result;\n }, initial);\n }\n\n public anyOf(schemas: (SchemaObject | ReferenceObject)[]): unknown {\n if (schemas.length === 0) return {};\n return this.handle(schemas[0]);\n }\n\n public oneOf(schemas: (SchemaObject | ReferenceObject)[]): unknown {\n if (schemas.length === 0) return {};\n return this.handle(schemas[0]);\n }\n\n public enum(schema: SchemaObject): unknown {\n return Array.isArray(schema.enum) && schema.enum.length > 0\n ? schema.enum[0]\n : undefined;\n }\n\n public handle(schemaOrRef: SchemaObject | ReferenceObject): unknown {\n if (isRef(schemaOrRef)) {\n return this.ref(schemaOrRef.$ref);\n }\n\n const schema = resolveRef(this.spec, schemaOrRef);\n\n if (schema.example !== undefined) {\n return schema.example;\n }\n\n if (schema.default !== undefined) {\n return schema.default;\n }\n\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return this.allOf(schema.allOf);\n }\n if (schema.anyOf && Array.isArray(schema.anyOf)) {\n return this.anyOf(schema.anyOf);\n }\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return this.oneOf(schema.oneOf);\n }\n\n if (schema.enum && Array.isArray(schema.enum) && schema.enum.length > 0) {\n return this.enum(schema);\n }\n\n const types = Array.isArray(schema.type)\n ? schema.type\n : schema.type\n ? [schema.type]\n : [];\n\n if (types.length === 0) {\n if (schema.properties || schema.additionalProperties) {\n return this.object(schema);\n } else if (schema.items) {\n return this.array(schema);\n }\n return 'example';\n }\n\n const primaryType = types.find((t) => t !== 'null') || types[0];\n\n switch (primaryType) {\n case 'string':\n return this.string(schema);\n case 'number':\n case 'integer':\n return this.number(schema);\n case 'boolean':\n return this.boolean(schema);\n case 'object':\n return this.object(schema);\n case 'array':\n return this.array(schema);\n case 'null':\n return this.null();\n default:\n return 'unknown';\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,WAAW,OAAO,kBAAkB;AAOtC,MAAM,eAAe;AAAA,EAClB;AAAA,EACD,gBAAgB,oBAAI,IAAY;AAAA,EAC/B,QAAQ,oBAAI,IAAqB;AAAA,EAEzC,YAAY,MAAU;AACpB,SAAK,OAAO;AAAA,EACd;AAAA,EAEO,OACL,QACyB;AACzB,UAAM,YAAY,WAAW,KAAK,MAAM,MAAM;AAC9C,UAAM,SAAkC,CAAC;AACzC,UAAM,aAAa,UAAU,cAAc,CAAC;AAE5C,eAAW,CAAC,UAAU,UAAU,KAAK,OAAO,QAAQ,UAAU,GAAG;AAC/D,YAAM,cAAc,UAAU,YAAY,CAAC,GAAG,SAAS,QAAQ;AAC/D,YAAM,eAAe,WAAW,KAAK,M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