@kubb/plugin-oas 2.26.4 → 2.26.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/{Schema-CkGDfE-r.d.ts → Schema-CuyurjSt.d.ts} +1 -1
- package/dist/{Schema-CxKiczSe.d.cts → Schema-zMzShjL_.d.cts} +1 -1
- package/dist/{SchemaMapper-BLcXlDBz.d.cts → SchemaMapper-BpjlzuXc.d.cts} +8 -4
- package/dist/{SchemaMapper-BLcXlDBz.d.ts → SchemaMapper-BpjlzuXc.d.ts} +8 -4
- package/dist/{chunk-QOM3GBVG.js → chunk-2554UG3K.js} +33 -2
- package/dist/chunk-2554UG3K.js.map +1 -0
- package/dist/{chunk-HUFRXC4N.cjs → chunk-HJ3WPZIC.cjs} +3 -3
- package/dist/{chunk-HUFRXC4N.cjs.map → chunk-HJ3WPZIC.cjs.map} +1 -1
- package/dist/{chunk-2YX4XBMY.js → chunk-LZNNIZXR.js} +2 -2
- package/dist/{chunk-2YX4XBMY.js.map → chunk-LZNNIZXR.js.map} +1 -1
- package/dist/{chunk-2BGY3BRC.cjs → chunk-NYLS3UNE.cjs} +2 -2
- package/dist/{chunk-2BGY3BRC.cjs.map → chunk-NYLS3UNE.cjs.map} +1 -1
- package/dist/{chunk-YJ3OFCLL.js → chunk-S2XK63DP.js} +3 -3
- package/dist/{chunk-7R4J27KH.cjs → chunk-XL6T57NL.cjs} +52 -21
- package/dist/chunk-XL6T57NL.cjs.map +1 -0
- package/dist/{chunk-B3QCCJ62.js → chunk-ZEDQKDE3.js} +2 -2
- package/dist/{chunk-WA7WV7KK.cjs → chunk-ZPBFS6LC.cjs} +23 -23
- package/dist/{chunk-WA7WV7KK.cjs.map → chunk-ZPBFS6LC.cjs.map} +1 -1
- package/dist/components.cjs +5 -5
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/components.js +3 -3
- package/dist/hooks.cjs +13 -13
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +3 -3
- package/dist/index.cjs +20 -20
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/utils.cjs +8 -8
- package/dist/utils.js +2 -2
- package/package.json +9 -9
- package/src/SchemaGenerator.ts +35 -0
- package/src/SchemaMapper.ts +6 -4
- package/src/utils/getSchemaFactory.ts +1 -1
- package/dist/chunk-7R4J27KH.cjs.map +0 -1
- package/dist/chunk-QOM3GBVG.js.map +0 -1
- /package/dist/{chunk-YJ3OFCLL.js.map → chunk-S2XK63DP.js.map} +0 -0
- /package/dist/{chunk-B3QCCJ62.js.map → chunk-ZEDQKDE3.js.map} +0 -0
package/dist/components.cjs
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkZPBFS6LCcjs = require('./chunk-ZPBFS6LC.cjs');
|
|
6
|
+
require('./chunk-XL6T57NL.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkNYLS3UNEcjs = require('./chunk-NYLS3UNE.cjs');
|
|
10
10
|
|
|
11
11
|
// src/components/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.Oas =
|
|
17
|
+
exports.Oas = _chunkZPBFS6LCcjs.Oas; exports.Operation = _chunkZPBFS6LCcjs.Operation; exports.Schema = _chunkZPBFS6LCcjs.Schema;
|
|
18
18
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as Schema } from './Schema-
|
|
1
|
+
import { S as Schema } from './Schema-zMzShjL_.cjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
|
|
4
4
|
import { KubbNode } from '@kubb/react';
|
|
5
5
|
import { a as OperationGenerator } from './OperationGenerator-8tADySO6.cjs';
|
|
6
6
|
import '@kubb/fs/types';
|
|
7
|
-
import './SchemaMapper-
|
|
7
|
+
import './SchemaMapper-BpjlzuXc.cjs';
|
|
8
8
|
import '@kubb/core';
|
|
9
9
|
import './types-RVAPVtNi.cjs';
|
|
10
10
|
|
package/dist/components.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as Schema } from './Schema-
|
|
1
|
+
import { S as Schema } from './Schema-CuyurjSt.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
|
|
4
4
|
import { KubbNode } from '@kubb/react';
|
|
5
5
|
import { a as OperationGenerator } from './OperationGenerator-DvyNt6Xi.js';
|
|
6
6
|
import '@kubb/fs/types';
|
|
7
|
-
import './SchemaMapper-
|
|
7
|
+
import './SchemaMapper-BpjlzuXc.js';
|
|
8
8
|
import '@kubb/core';
|
|
9
9
|
import './types-RVAPVtNi.js';
|
|
10
10
|
|
package/dist/components.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Oas,
|
|
3
3
|
Operation,
|
|
4
4
|
Schema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-S2XK63DP.js";
|
|
6
|
+
import "./chunk-2554UG3K.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LZNNIZXR.js";
|
|
10
10
|
|
|
11
11
|
// src/components/index.ts
|
|
12
12
|
init_esm_shims();
|
package/dist/hooks.cjs
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkZPBFS6LCcjs = require('./chunk-ZPBFS6LC.cjs');
|
|
6
|
+
require('./chunk-XL6T57NL.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkNYLS3UNEcjs = require('./chunk-NYLS3UNE.cjs');
|
|
10
10
|
|
|
11
11
|
// src/hooks/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
// src/hooks/useOas.ts
|
|
15
|
-
|
|
15
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
16
16
|
var _react = require('@kubb/react');
|
|
17
17
|
function useOas() {
|
|
18
|
-
const { oas } = _react.useContext.call(void 0,
|
|
18
|
+
const { oas } = _react.useContext.call(void 0, _chunkZPBFS6LCcjs.Oas.Context);
|
|
19
19
|
if (!oas) {
|
|
20
20
|
throw new Error("Oas is not defined");
|
|
21
21
|
}
|
|
@@ -23,10 +23,10 @@ function useOas() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// src/hooks/useOperation.ts
|
|
26
|
-
|
|
26
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
27
27
|
|
|
28
28
|
function useOperation() {
|
|
29
|
-
const { operation } = _react.useContext.call(void 0,
|
|
29
|
+
const { operation } = _react.useContext.call(void 0, _chunkZPBFS6LCcjs.Operation.Context);
|
|
30
30
|
if (!operation) {
|
|
31
31
|
throw new Error("Operation is not defined");
|
|
32
32
|
}
|
|
@@ -34,11 +34,11 @@ function useOperation() {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// src/hooks/useOperationManager.ts
|
|
37
|
-
|
|
37
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
38
38
|
|
|
39
39
|
function useOperationManager() {
|
|
40
40
|
const { plugin, pluginManager } = _react.useApp.call(void 0, );
|
|
41
|
-
const { generator } = _react.useContext.call(void 0,
|
|
41
|
+
const { generator } = _react.useContext.call(void 0, _chunkZPBFS6LCcjs.Oas.Context);
|
|
42
42
|
if (!generator) {
|
|
43
43
|
throw new Error(`'generator' is not defined`);
|
|
44
44
|
}
|
|
@@ -139,10 +139,10 @@ function useOperationManager() {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// src/hooks/useOperations.ts
|
|
142
|
-
|
|
142
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
143
143
|
|
|
144
144
|
function useOperations({ method, path } = {}) {
|
|
145
|
-
const { operations } = _react.useContext.call(void 0,
|
|
145
|
+
const { operations } = _react.useContext.call(void 0, _chunkZPBFS6LCcjs.Oas.Context);
|
|
146
146
|
if (!operations) {
|
|
147
147
|
throw new Error("Operations is not defined");
|
|
148
148
|
}
|
|
@@ -161,5 +161,5 @@ function useOperations({ method, path } = {}) {
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
|
|
164
|
-
exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema =
|
|
164
|
+
exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkZPBFS6LCcjs.useSchema;
|
|
165
165
|
//# sourceMappingURL=hooks.cjs.map
|
package/dist/hooks.d.cts
CHANGED
|
@@ -2,10 +2,10 @@ import { Oas, Operation, HttpMethod } from '@kubb/oas';
|
|
|
2
2
|
import { Plugin, ResolveNameParams, FileMetaBase } from '@kubb/core';
|
|
3
3
|
import * as KubbFile from '@kubb/fs/types';
|
|
4
4
|
import { f as OperationSchemas } from './types-RVAPVtNi.cjs';
|
|
5
|
-
import { a as SchemaContextProps } from './Schema-
|
|
5
|
+
import { a as SchemaContextProps } from './Schema-zMzShjL_.cjs';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@kubb/react';
|
|
8
|
-
import './SchemaMapper-
|
|
8
|
+
import './SchemaMapper-BpjlzuXc.cjs';
|
|
9
9
|
|
|
10
10
|
declare function useOas(): Oas;
|
|
11
11
|
|
package/dist/hooks.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { Oas, Operation, HttpMethod } from '@kubb/oas';
|
|
|
2
2
|
import { Plugin, ResolveNameParams, FileMetaBase } from '@kubb/core';
|
|
3
3
|
import * as KubbFile from '@kubb/fs/types';
|
|
4
4
|
import { f as OperationSchemas } from './types-RVAPVtNi.js';
|
|
5
|
-
import { a as SchemaContextProps } from './Schema-
|
|
5
|
+
import { a as SchemaContextProps } from './Schema-CuyurjSt.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@kubb/react';
|
|
8
|
-
import './SchemaMapper-
|
|
8
|
+
import './SchemaMapper-BpjlzuXc.js';
|
|
9
9
|
|
|
10
10
|
declare function useOas(): Oas;
|
|
11
11
|
|
package/dist/hooks.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Oas,
|
|
3
3
|
Operation,
|
|
4
4
|
useSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-S2XK63DP.js";
|
|
6
|
+
import "./chunk-2554UG3K.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LZNNIZXR.js";
|
|
10
10
|
|
|
11
11
|
// src/hooks/index.ts
|
|
12
12
|
init_esm_shims();
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHJ3WPZICcjs = require('./chunk-HJ3WPZIC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkXL6T57NLcjs = require('./chunk-XL6T57NL.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,13 +13,13 @@ var _chunk7R4J27KHcjs = require('./chunk-7R4J27KH.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkNYLS3UNEcjs = require('./chunk-NYLS3UNE.cjs');
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
|
-
|
|
19
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
|
|
21
21
|
// src/plugin.ts
|
|
22
|
-
|
|
22
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
23
23
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
24
24
|
var _core = require('@kubb/core');
|
|
25
25
|
var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
|
|
@@ -28,7 +28,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
28
28
|
const { output = { path: "schemas", export: false }, validate = true, serverIndex = 0, contentType, oasClass } = options;
|
|
29
29
|
const getOas = async ({ config, logger }) => {
|
|
30
30
|
try {
|
|
31
|
-
const oas = await
|
|
31
|
+
const oas = await _chunkHJ3WPZICcjs.parseFromConfig.call(void 0, config, oasClass);
|
|
32
32
|
if (validate) {
|
|
33
33
|
await oas.valdiate();
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
36
36
|
} catch (e) {
|
|
37
37
|
const error = e;
|
|
38
38
|
logger.emit("warning", _optionalChain([error, 'optionalAccess', _ => _.message]));
|
|
39
|
-
return
|
|
39
|
+
return _chunkHJ3WPZICcjs.parseFromConfig.call(void 0, config, oasClass);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
return {
|
|
@@ -50,7 +50,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
50
50
|
},
|
|
51
51
|
async getSchemas({ includes } = {}) {
|
|
52
52
|
const oas = await this.getOas();
|
|
53
|
-
return
|
|
53
|
+
return _chunkNYLS3UNEcjs.getSchemas.call(void 0, { oas, contentType, includes });
|
|
54
54
|
},
|
|
55
55
|
async getBaseURL() {
|
|
56
56
|
const oasInstance = await this.getOas();
|
|
@@ -85,7 +85,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
85
85
|
logger: this.logger
|
|
86
86
|
});
|
|
87
87
|
await oas.dereference();
|
|
88
|
-
const schemas =
|
|
88
|
+
const schemas = _chunkNYLS3UNEcjs.getSchemas.call(void 0, { oas, contentType });
|
|
89
89
|
const mapSchema = async ([name, schema]) => {
|
|
90
90
|
const resolvedPath = this.resolvePath({
|
|
91
91
|
baseName: `${name}.json`,
|
|
@@ -115,21 +115,21 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
// src/OperationGenerator.ts
|
|
118
|
-
|
|
118
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
var _operationsByMethod, _OperationGenerator_instances, getOptions_fn, isExcluded_fn, isIncluded_fn, methods_get;
|
|
122
122
|
var OperationGenerator = class extends _core.Generator {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(...arguments);
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
_chunkNYLS3UNEcjs.__privateAdd.call(void 0, this, _OperationGenerator_instances);
|
|
126
|
+
_chunkNYLS3UNEcjs.__privateAdd.call(void 0, this, _operationsByMethod, {});
|
|
127
127
|
}
|
|
128
128
|
get operationsByMethod() {
|
|
129
|
-
return
|
|
129
|
+
return _chunkNYLS3UNEcjs.__privateGet.call(void 0, this, _operationsByMethod);
|
|
130
130
|
}
|
|
131
131
|
set operationsByMethod(paths) {
|
|
132
|
-
|
|
132
|
+
_chunkNYLS3UNEcjs.__privateSet.call(void 0, this, _operationsByMethod, paths);
|
|
133
133
|
}
|
|
134
134
|
getSchemas(operation, { forStatusCode, resolveName = (name) => name } = {}) {
|
|
135
135
|
const pathParamsSchema = this.context.oas.getParametersSchema(operation, "path");
|
|
@@ -212,9 +212,9 @@ var OperationGenerator = class extends _core.Generator {
|
|
|
212
212
|
const methods = Object.keys(method);
|
|
213
213
|
methods.forEach((method2) => {
|
|
214
214
|
const operation = oas.operation(path2, method2);
|
|
215
|
-
if (operation &&
|
|
216
|
-
const isExcluded =
|
|
217
|
-
const isIncluded = this.context.include ?
|
|
215
|
+
if (operation && _chunkNYLS3UNEcjs.__privateGet.call(void 0, this, _OperationGenerator_instances, methods_get)[method2]) {
|
|
216
|
+
const isExcluded = _chunkNYLS3UNEcjs.__privateMethod.call(void 0, this, _OperationGenerator_instances, isExcluded_fn).call(this, operation, method2);
|
|
217
|
+
const isIncluded = this.context.include ? _chunkNYLS3UNEcjs.__privateMethod.call(void 0, this, _OperationGenerator_instances, isIncluded_fn).call(this, operation, method2) : true;
|
|
218
218
|
if (isIncluded && !isExcluded) {
|
|
219
219
|
if (!acc[path2]) {
|
|
220
220
|
acc[path2] = {};
|
|
@@ -235,8 +235,8 @@ var OperationGenerator = class extends _core.Generator {
|
|
|
235
235
|
const methods = this.operationsByMethod[path2] ? Object.keys(this.operationsByMethod[path2]) : [];
|
|
236
236
|
methods.forEach((method) => {
|
|
237
237
|
const { operation } = _optionalChain([this, 'access', _37 => _37.operationsByMethod, 'access', _38 => _38[path2], 'optionalAccess', _39 => _39[method]]);
|
|
238
|
-
const options =
|
|
239
|
-
const promiseMethod = _optionalChain([
|
|
238
|
+
const options = _chunkNYLS3UNEcjs.__privateMethod.call(void 0, this, _OperationGenerator_instances, getOptions_fn).call(this, operation, method);
|
|
239
|
+
const promiseMethod = _optionalChain([_chunkNYLS3UNEcjs.__privateGet.call(void 0, this, _OperationGenerator_instances, methods_get), 'access', _40 => _40[method], 'optionalAccess', _41 => _41.call, 'call', _42 => _42(this, operation, {
|
|
240
240
|
...this.options,
|
|
241
241
|
...options
|
|
242
242
|
})]);
|
|
@@ -391,5 +391,5 @@ var src_default = definePluginDefault;
|
|
|
391
391
|
|
|
392
392
|
|
|
393
393
|
|
|
394
|
-
exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator =
|
|
394
|
+
exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator = _chunkXL6T57NLcjs.SchemaGenerator; exports.default = src_default; exports.isKeyword = _chunkXL6T57NLcjs.isKeyword; exports.pluginOas = pluginOas; exports.pluginOasName = pluginOasName; exports.schemaKeywords = _chunkXL6T57NLcjs.schemaKeywords;
|
|
395
395
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -5,8 +5,8 @@ export { A as API, E as Exclude, I as Include, f as OperationSchemas, g as Opera
|
|
|
5
5
|
export { G as GetOperationGeneratorOptions, a as OperationGenerator, O as OperationMethodResult } from './OperationGenerator-8tADySO6.cjs';
|
|
6
6
|
import * as KubbFile from '@kubb/fs/types';
|
|
7
7
|
import { SchemaObject, Oas, contentType } from '@kubb/oas';
|
|
8
|
-
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-
|
|
9
|
-
export { b as SchemaKeyword, c as SchemaKeywordBase, d as SchemaMapper, i as isKeyword, s as schemaKeywords } from './SchemaMapper-
|
|
8
|
+
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-BpjlzuXc.cjs';
|
|
9
|
+
export { b as SchemaKeyword, c as SchemaKeywordBase, d as SchemaMapper, i as isKeyword, s as schemaKeywords } from './SchemaMapper-BpjlzuXc.cjs';
|
|
10
10
|
|
|
11
11
|
declare const pluginOasName = "plugin-oas";
|
|
12
12
|
declare const pluginOas: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginOas>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export { A as API, E as Exclude, I as Include, f as OperationSchemas, g as Opera
|
|
|
5
5
|
export { G as GetOperationGeneratorOptions, a as OperationGenerator, O as OperationMethodResult } from './OperationGenerator-DvyNt6Xi.js';
|
|
6
6
|
import * as KubbFile from '@kubb/fs/types';
|
|
7
7
|
import { SchemaObject, Oas, contentType } from '@kubb/oas';
|
|
8
|
-
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-
|
|
9
|
-
export { b as SchemaKeyword, c as SchemaKeywordBase, d as SchemaMapper, i as isKeyword, s as schemaKeywords } from './SchemaMapper-
|
|
8
|
+
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-BpjlzuXc.js';
|
|
9
|
+
export { b as SchemaKeyword, c as SchemaKeywordBase, d as SchemaMapper, i as isKeyword, s as schemaKeywords } from './SchemaMapper-BpjlzuXc.js';
|
|
10
10
|
|
|
11
11
|
declare const pluginOasName = "plugin-oas";
|
|
12
12
|
declare const pluginOas: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginOas>;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFromConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZEDQKDE3.js";
|
|
4
4
|
import {
|
|
5
5
|
SchemaGenerator,
|
|
6
6
|
isKeyword,
|
|
7
7
|
schemaKeywords
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2554UG3K.js";
|
|
9
9
|
import {
|
|
10
10
|
__privateAdd,
|
|
11
11
|
__privateGet,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
__privateSet,
|
|
14
14
|
getSchemas,
|
|
15
15
|
init_esm_shims
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LZNNIZXR.js";
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
19
|
init_esm_shims();
|
package/dist/utils.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHJ3WPZICcjs = require('./chunk-HJ3WPZIC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkNYLS3UNEcjs = require('./chunk-NYLS3UNE.cjs');
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
|
-
|
|
11
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
12
12
|
|
|
13
13
|
// src/utils/getComments.ts
|
|
14
|
-
|
|
14
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
15
15
|
var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
|
|
16
16
|
var _utils = require('@kubb/core/utils');
|
|
17
17
|
function getComments(operation) {
|
|
@@ -24,7 +24,7 @@ function getComments(operation) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// src/utils/getGroupedByTagFiles.ts
|
|
27
|
-
|
|
27
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
28
28
|
var _path = require('path');
|
|
29
29
|
var _core = require('@kubb/core');
|
|
30
30
|
|
|
@@ -69,7 +69,7 @@ async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs,
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// src/utils/getParams.ts
|
|
72
|
-
|
|
72
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
73
73
|
var _oas = require('@kubb/oas');
|
|
74
74
|
|
|
75
75
|
function getASTParams(operationSchema, {
|
|
@@ -104,7 +104,7 @@ function getPathParams(operationSchema, options = {}) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// src/utils/refSorter.ts
|
|
107
|
-
|
|
107
|
+
_chunkNYLS3UNEcjs.init_cjs_shims.call(void 0, );
|
|
108
108
|
function refsSorter(a, b) {
|
|
109
109
|
if (_optionalChain([Object, 'access', _10 => _10.keys, 'call', _11 => _11(a.import.refs), 'optionalAccess', _12 => _12.length]) < _optionalChain([Object, 'access', _13 => _13.keys, 'call', _14 => _14(b.import.refs), 'optionalAccess', _15 => _15.length])) {
|
|
110
110
|
return -1;
|
|
@@ -123,5 +123,5 @@ function refsSorter(a, b) {
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory =
|
|
126
|
+
exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory = _chunkNYLS3UNEcjs.getSchemaFactory; exports.getSchemas = _chunkNYLS3UNEcjs.getSchemas; exports.parseFromConfig = _chunkHJ3WPZICcjs.parseFromConfig; exports.refsSorter = refsSorter;
|
|
127
127
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFromConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZEDQKDE3.js";
|
|
4
4
|
import {
|
|
5
5
|
getSchemaFactory,
|
|
6
6
|
getSchemas,
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LZNNIZXR.js";
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
11
|
init_esm_shims();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.6",
|
|
4
4
|
"description": "Generator swagger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@stoplight/yaml": "^4.3.0",
|
|
70
70
|
"remeda": "^2.14.0",
|
|
71
|
-
"@kubb/
|
|
72
|
-
"@kubb/
|
|
73
|
-
"@kubb/
|
|
74
|
-
"@kubb/
|
|
71
|
+
"@kubb/fs": "2.26.6",
|
|
72
|
+
"@kubb/oas": "2.26.6",
|
|
73
|
+
"@kubb/react": "2.26.6",
|
|
74
|
+
"@kubb/core": "2.26.6"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/react": "^18.3.8",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"react": "^18.3.1",
|
|
80
80
|
"tsup": "^8.3.0",
|
|
81
81
|
"typescript": "^5.6.2",
|
|
82
|
-
"@kubb/config-biome": "2.26.
|
|
83
|
-
"@kubb/config-ts": "2.26.
|
|
84
|
-
"@kubb/config-tsup": "2.26.
|
|
82
|
+
"@kubb/config-biome": "2.26.6",
|
|
83
|
+
"@kubb/config-ts": "2.26.6",
|
|
84
|
+
"@kubb/config-tsup": "2.26.6"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@kubb/react": "2.26.
|
|
87
|
+
"@kubb/react": "2.26.6"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=18"
|
package/src/SchemaGenerator.ts
CHANGED
|
@@ -452,10 +452,16 @@ export abstract class SchemaGenerator<
|
|
|
452
452
|
baseItems.push({ keyword: schemaKeywords.readOnly })
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
if (schema.writeOnly) {
|
|
456
|
+
baseItems.push({ keyword: schemaKeywords.writeOnly })
|
|
457
|
+
}
|
|
458
|
+
|
|
455
459
|
if (isReference(schema)) {
|
|
456
460
|
return [
|
|
457
461
|
...this.#getRefAlias(schema),
|
|
458
462
|
nullable && { keyword: schemaKeywords.nullable },
|
|
463
|
+
schema.readOnly && { keyword: schemaKeywords.readOnly },
|
|
464
|
+
schema.writeOnly && { keyword: schemaKeywords.writeOnly },
|
|
459
465
|
{
|
|
460
466
|
keyword: schemaKeywords.schema,
|
|
461
467
|
args: {
|
|
@@ -617,6 +623,35 @@ export abstract class SchemaGenerator<
|
|
|
617
623
|
]
|
|
618
624
|
}
|
|
619
625
|
|
|
626
|
+
if (schema.type === 'boolean') {
|
|
627
|
+
// we cannot use z.enum when enum type is boolean
|
|
628
|
+
const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']
|
|
629
|
+
return [
|
|
630
|
+
{
|
|
631
|
+
keyword: schemaKeywords.enum,
|
|
632
|
+
args: {
|
|
633
|
+
name: enumName,
|
|
634
|
+
typeName,
|
|
635
|
+
asConst: true,
|
|
636
|
+
items: enumNames?.args?.items
|
|
637
|
+
? [...new Set(enumNames.args.items)].map(({ name, value }) => ({
|
|
638
|
+
name,
|
|
639
|
+
value,
|
|
640
|
+
format: 'boolean',
|
|
641
|
+
}))
|
|
642
|
+
: [...new Set(filteredValues)].map((value: string) => {
|
|
643
|
+
return {
|
|
644
|
+
name: value,
|
|
645
|
+
value,
|
|
646
|
+
format: 'boolean',
|
|
647
|
+
}
|
|
648
|
+
}),
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
...baseItems.filter((item) => item.keyword !== schemaKeywords.matches),
|
|
652
|
+
]
|
|
653
|
+
}
|
|
654
|
+
|
|
620
655
|
if (extensionEnums.length > 0 && extensionEnums[0]) {
|
|
621
656
|
return extensionEnums[0]
|
|
622
657
|
}
|
package/src/SchemaMapper.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type SchemaKeywordMapper = {
|
|
|
12
12
|
strict: { keyword: 'strict' }
|
|
13
13
|
url: { keyword: 'url' }
|
|
14
14
|
readOnly: { keyword: 'readOnly' }
|
|
15
|
+
writeOnly: { keyword: 'writeOnly' }
|
|
15
16
|
uuid: { keyword: 'uuid' }
|
|
16
17
|
email: { keyword: 'email' }
|
|
17
18
|
firstName: { keyword: 'firstName' }
|
|
@@ -34,8 +35,8 @@ export type SchemaKeywordMapper = {
|
|
|
34
35
|
asConst: boolean
|
|
35
36
|
items: Array<{
|
|
36
37
|
name: string | number
|
|
37
|
-
format: 'string' | 'number'
|
|
38
|
-
value?: string | number
|
|
38
|
+
format: 'string' | 'number' | 'boolean'
|
|
39
|
+
value?: string | number | boolean
|
|
39
40
|
}>
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -44,8 +45,8 @@ export type SchemaKeywordMapper = {
|
|
|
44
45
|
keyword: 'const'
|
|
45
46
|
args: {
|
|
46
47
|
name: string | number
|
|
47
|
-
format: 'string' | 'number'
|
|
48
|
-
value?: string | number
|
|
48
|
+
format: 'string' | 'number' | 'boolean'
|
|
49
|
+
value?: string | number | boolean
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
union: { keyword: 'union'; args: Schema[] }
|
|
@@ -107,6 +108,7 @@ export const schemaKeywords = {
|
|
|
107
108
|
max: 'max',
|
|
108
109
|
optional: 'optional',
|
|
109
110
|
readOnly: 'readOnly',
|
|
111
|
+
writeOnly: 'writeOnly',
|
|
110
112
|
|
|
111
113
|
// custom ones
|
|
112
114
|
object: 'object',
|
|
@@ -26,7 +26,7 @@ export function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (s
|
|
|
26
26
|
const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'
|
|
27
27
|
|
|
28
28
|
return {
|
|
29
|
-
schema,
|
|
29
|
+
schema: oas.dereferenceWithRef(schema),
|
|
30
30
|
version,
|
|
31
31
|
} as SchemaResult<TWithRef>
|
|
32
32
|
}
|