@xyd-js/openapi-sampler 0.1.0-build.138
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 +848 -0
- package/LICENSE +21 -0
- package/dist/index.js +3422 -0
- package/dist/index.js.map +1 -0
- package/package.json +21 -0
- package/rollup.config.js +20 -0
- package/src/index.d.ts +46 -0
- package/src/index.js +4 -0
package/rollup.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
input: 'src/index.js',
|
|
6
|
+
output: {
|
|
7
|
+
file: 'dist/index.js',
|
|
8
|
+
format: 'esm',
|
|
9
|
+
sourcemap: true
|
|
10
|
+
},
|
|
11
|
+
plugins: [
|
|
12
|
+
nodeResolve({
|
|
13
|
+
preferBuiltins: true
|
|
14
|
+
}),
|
|
15
|
+
commonjs({
|
|
16
|
+
include: /node_modules/
|
|
17
|
+
})
|
|
18
|
+
],
|
|
19
|
+
external: []
|
|
20
|
+
};
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface OpenAPISamplerOptions {
|
|
2
|
+
skipReadOnly?: boolean;
|
|
3
|
+
maxSampleDepth?: number;
|
|
4
|
+
format?: string;
|
|
5
|
+
quiet?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface OpenAPISamplerSpec {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface JSONSchema {
|
|
13
|
+
type?: string;
|
|
14
|
+
properties?: Record<string, JSONSchema>;
|
|
15
|
+
items?: JSONSchema;
|
|
16
|
+
required?: string[];
|
|
17
|
+
example?: any;
|
|
18
|
+
examples?: Record<string, any>;
|
|
19
|
+
format?: string;
|
|
20
|
+
minimum?: number;
|
|
21
|
+
maximum?: number;
|
|
22
|
+
minLength?: number;
|
|
23
|
+
maxLength?: number;
|
|
24
|
+
pattern?: string;
|
|
25
|
+
enum?: any[];
|
|
26
|
+
allOf?: JSONSchema[];
|
|
27
|
+
anyOf?: JSONSchema[];
|
|
28
|
+
oneOf?: JSONSchema[];
|
|
29
|
+
$ref?: string;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function sample(schema: JSONSchema, options?: OpenAPISamplerOptions, spec?: OpenAPISamplerSpec): any;
|
|
34
|
+
|
|
35
|
+
export function _registerSampler(type: string, sampler: Function): void;
|
|
36
|
+
|
|
37
|
+
export const _samplers: Record<string, Function>;
|
|
38
|
+
|
|
39
|
+
export function inferType(schema: JSONSchema): string;
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
sample,
|
|
43
|
+
_registerSampler,
|
|
44
|
+
_samplers,
|
|
45
|
+
inferType
|
|
46
|
+
};
|
package/src/index.js
ADDED