swaggie 1.5.3-beta.5 → 1.6.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/gen/genOperations.js +1 -2
- package/dist/index.js +5 -5
- package/dist/swagger/typesExtractor.js +30 -1
- package/dist/types.d.ts +0 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var _gen = require('./gen'); var _gen2 = _interopRequireDefault(_gen);
|
|
5
5
|
|
|
6
|
-
var _types = require('./types');
|
|
7
6
|
var _utils = require('./utils');
|
|
7
|
+
var _swagger = require('./swagger');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Runs the whole code generation process.
|
|
@@ -78,7 +78,7 @@ function readFile(filePath) {
|
|
|
78
78
|
function prepareAppOptions(cliOpts) {
|
|
79
79
|
const { allowDots, arrayFormat, template, queryParamsSerialization = {}, ...rest } = cliOpts;
|
|
80
80
|
const mergedQueryParamsSerialization = {
|
|
81
|
-
...
|
|
81
|
+
..._swagger.APP_DEFAULTS.queryParamsSerialization,
|
|
82
82
|
...Object.fromEntries(
|
|
83
83
|
Object.entries(queryParamsSerialization).filter(([_, v]) => v !== undefined)
|
|
84
84
|
),
|
|
@@ -88,9 +88,9 @@ function readFile(filePath) {
|
|
|
88
88
|
|
|
89
89
|
return {
|
|
90
90
|
...rest,
|
|
91
|
-
template: _nullishCoalesce(template, () => (
|
|
92
|
-
servicePrefix: _nullishCoalesce(rest.servicePrefix, () => (
|
|
93
|
-
nullableStrategy: _nullishCoalesce(rest.nullableStrategy, () => (
|
|
91
|
+
template: _nullishCoalesce(template, () => ( _swagger.APP_DEFAULTS.template)),
|
|
92
|
+
servicePrefix: _nullishCoalesce(rest.servicePrefix, () => ( _swagger.APP_DEFAULTS.servicePrefix)),
|
|
93
|
+
nullableStrategy: _nullishCoalesce(rest.nullableStrategy, () => ( _swagger.APP_DEFAULTS.nullableStrategy)),
|
|
94
94
|
queryParamsSerialization: mergedQueryParamsSerialization,
|
|
95
95
|
};
|
|
96
96
|
} exports.prepareAppOptions = prepareAppOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
3
|
var _utils = require('../utils');
|
|
4
4
|
|
|
@@ -256,3 +256,32 @@ function getTypeFromComposites(schema, options) {
|
|
|
256
256
|
.filter((v) => '$ref' in v)
|
|
257
257
|
.map((s) => getSafeIdentifier(s.$ref.split('/').pop()));
|
|
258
258
|
} exports.getRefCompositeTypes = getRefCompositeTypes;
|
|
259
|
+
|
|
260
|
+
/** Default values applied to every field of AppOptions that has a default. */
|
|
261
|
+
const APP_DEFAULTS = {
|
|
262
|
+
template: 'axios',
|
|
263
|
+
servicePrefix: '',
|
|
264
|
+
nullableStrategy: 'ignore',
|
|
265
|
+
queryParamsSerialization: {
|
|
266
|
+
allowDots: true,
|
|
267
|
+
arrayFormat: 'repeat',
|
|
268
|
+
},
|
|
269
|
+
}; exports.APP_DEFAULTS = APP_DEFAULTS;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Fills in all AppOptions defaults for a partial ClientOptions object.
|
|
273
|
+
* Used at the boundary between public API / test helpers and the internal pipeline.
|
|
274
|
+
*/
|
|
275
|
+
function resolveOptions(opts) {
|
|
276
|
+
return {
|
|
277
|
+
src: _nullishCoalesce(opts.src, () => ( '')),
|
|
278
|
+
...opts,
|
|
279
|
+
template: _nullishCoalesce(opts.template, () => ( exports.APP_DEFAULTS.template)),
|
|
280
|
+
servicePrefix: _nullishCoalesce(opts.servicePrefix, () => ( exports.APP_DEFAULTS.servicePrefix)),
|
|
281
|
+
nullableStrategy: _nullishCoalesce(opts.nullableStrategy, () => ( exports.APP_DEFAULTS.nullableStrategy)),
|
|
282
|
+
queryParamsSerialization: {
|
|
283
|
+
...exports.APP_DEFAULTS.queryParamsSerialization,
|
|
284
|
+
...opts.queryParamsSerialization,
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
} exports.resolveOptions = resolveOptions;
|
package/dist/types.d.ts
CHANGED
|
@@ -64,13 +64,6 @@ export interface AppOptions extends ClientOptions {
|
|
|
64
64
|
arrayFormat: ArrayFormat;
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
/** Default values applied to every field of AppOptions that has a default. */
|
|
68
|
-
export declare const APP_DEFAULTS: Partial<AppOptions>;
|
|
69
|
-
/**
|
|
70
|
-
* Fills in all AppOptions defaults for a partial ClientOptions object.
|
|
71
|
-
* Used at the boundary between public API / test helpers and the internal pipeline.
|
|
72
|
-
*/
|
|
73
|
-
export declare function resolveOptions(opts: Partial<ClientOptions>): AppOptions;
|
|
74
67
|
/**
|
|
75
68
|
* Local type that represent Operation as understood by Swaggie
|
|
76
69
|
**/
|