@skmtc/core 0.0.419 → 0.0.420
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/esm/oas/string/String.d.ts +13 -2
- package/esm/oas/string/String.d.ts.map +1 -1
- package/esm/oas/string/String.js +20 -0
- package/esm/oas/string/string-types.d.ts +7 -2
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/string-types.js +27 -23
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +5 -1
- package/package.json +1 -1
- package/script/oas/string/String.d.ts +13 -2
- package/script/oas/string/String.d.ts.map +1 -1
- package/script/oas/string/String.js +20 -0
- package/script/oas/string/string-types.d.ts +7 -2
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/string-types.js +27 -23
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +5 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { OasRef } from '../ref/Ref.js';
|
|
2
|
+
import type { StringFormat } from './string-types.js';
|
|
2
3
|
export type StringFields = {
|
|
3
4
|
title?: string;
|
|
4
5
|
description?: string;
|
|
5
|
-
format?:
|
|
6
|
+
format?: StringFormat;
|
|
6
7
|
enums?: string[];
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
minLength?: number;
|
|
7
10
|
nullable?: boolean;
|
|
8
11
|
extensionFields?: Record<string, unknown>;
|
|
9
12
|
example?: string;
|
|
@@ -32,11 +35,19 @@ export declare class OasString {
|
|
|
32
35
|
/**
|
|
33
36
|
* The format of the string.
|
|
34
37
|
*/
|
|
35
|
-
format:
|
|
38
|
+
format: StringFormat | undefined;
|
|
36
39
|
/**
|
|
37
40
|
* An array of allowed values for the string.
|
|
38
41
|
*/
|
|
39
42
|
enums: string[] | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The maximum length of the string.
|
|
45
|
+
*/
|
|
46
|
+
maxLength: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The minimum length of the string.
|
|
49
|
+
*/
|
|
50
|
+
minLength: number | undefined;
|
|
40
51
|
/**
|
|
41
52
|
* Indicates whether value can be null.
|
|
42
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,YAAY,CAAA;IAErB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,WAAoB;IACxB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,gCAAgC;IAChC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEf,MAAM,EAAE,YAAY;IAgBhC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;CAGzB"}
|
package/esm/oas/string/String.js
CHANGED
|
@@ -58,6 +58,24 @@ export class OasString {
|
|
|
58
58
|
writable: true,
|
|
59
59
|
value: void 0
|
|
60
60
|
});
|
|
61
|
+
/**
|
|
62
|
+
* The maximum length of the string.
|
|
63
|
+
*/
|
|
64
|
+
Object.defineProperty(this, "maxLength", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* The minimum length of the string.
|
|
72
|
+
*/
|
|
73
|
+
Object.defineProperty(this, "minLength", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
value: void 0
|
|
78
|
+
});
|
|
61
79
|
/**
|
|
62
80
|
* Indicates whether value can be null.
|
|
63
81
|
*/
|
|
@@ -88,6 +106,8 @@ export class OasString {
|
|
|
88
106
|
this.nullable = fields.nullable;
|
|
89
107
|
this.extensionFields = fields.extensionFields;
|
|
90
108
|
this.example = fields.example;
|
|
109
|
+
this.maxLength = fields.maxLength;
|
|
110
|
+
this.minLength = fields.minLength;
|
|
91
111
|
}
|
|
92
112
|
// get pattern() {
|
|
93
113
|
// return this.fields.pattern
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const oasStringData: z.ZodType<OasStringData>;
|
|
3
|
+
export type StringFormat = 'date-time' | 'time' | 'date' | 'duration' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uuid' | 'uri' | 'regex' | 'password';
|
|
3
4
|
export type OasStringData = {
|
|
4
5
|
oasType: 'schema';
|
|
5
6
|
title?: string;
|
|
6
7
|
description?: string;
|
|
7
8
|
default?: string;
|
|
8
9
|
type: 'string';
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
minLength?: number;
|
|
9
12
|
pattern?: string;
|
|
10
|
-
|
|
11
|
-
format?:
|
|
13
|
+
enum?: string[];
|
|
14
|
+
format?: StringFormat;
|
|
15
|
+
nullable?: boolean;
|
|
16
|
+
example?: string;
|
|
12
17
|
};
|
|
13
18
|
//# sourceMappingURL=string-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmBvB,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAenC,CAAA;AAEhB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,OAAO,GACP,UAAU,CAAA;AAId,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,QAAQ,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
const stringFormat = z.enum([
|
|
3
|
+
'date-time',
|
|
4
|
+
'time',
|
|
5
|
+
'date',
|
|
6
|
+
'duration',
|
|
7
|
+
'email',
|
|
8
|
+
'hostname',
|
|
9
|
+
'ipv4',
|
|
10
|
+
'ipv6',
|
|
11
|
+
'uuid',
|
|
12
|
+
'uri',
|
|
13
|
+
'regex',
|
|
14
|
+
'password'
|
|
15
|
+
// 'byte',
|
|
16
|
+
// 'binary'
|
|
17
|
+
]);
|
|
18
|
+
export const oasStringData = z
|
|
19
|
+
.object({
|
|
3
20
|
oasType: z.literal('schema'),
|
|
21
|
+
type: z.literal('string'),
|
|
4
22
|
title: z.string().optional(),
|
|
5
23
|
description: z.string().optional(),
|
|
6
24
|
default: z.string().optional(),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// maxLength: z.number().optional(),
|
|
10
|
-
// minLength: z.number().optional(),
|
|
25
|
+
maxLength: z.number().optional(),
|
|
26
|
+
minLength: z.number().optional(),
|
|
11
27
|
pattern: z.string().optional(),
|
|
12
|
-
|
|
13
|
-
format:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'duration',
|
|
19
|
-
'email',
|
|
20
|
-
'hostname',
|
|
21
|
-
'ipv4',
|
|
22
|
-
'ipv6',
|
|
23
|
-
'uuid',
|
|
24
|
-
'uri',
|
|
25
|
-
'regex',
|
|
26
|
-
'binary'
|
|
27
|
-
])
|
|
28
|
-
.optional()
|
|
29
|
-
});
|
|
28
|
+
enum: z.array(z.string()).optional(),
|
|
29
|
+
format: stringFormat.optional(),
|
|
30
|
+
nullable: z.boolean().optional(),
|
|
31
|
+
example: z.string().optional()
|
|
32
|
+
})
|
|
33
|
+
.passthrough();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SA2B3D,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OasString } from './String.js';
|
|
2
2
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
import { oasStringData } from './string-types.js';
|
|
3
4
|
export const toString = ({ value, context }) => {
|
|
4
|
-
const { type: _type, title, description, enum: enums, nullable, example, ...skipped } = value;
|
|
5
|
+
const { type: _type, title, description, enum: enums, nullable, example, format, maxLength, minLength, ...skipped } = oasStringData.parse(value);
|
|
5
6
|
const extensionFields = toSpecificationExtensionsV3({ skipped, context });
|
|
6
7
|
return new OasString({
|
|
7
8
|
title,
|
|
@@ -9,6 +10,9 @@ export const toString = ({ value, context }) => {
|
|
|
9
10
|
enums,
|
|
10
11
|
nullable,
|
|
11
12
|
example,
|
|
13
|
+
format,
|
|
14
|
+
maxLength,
|
|
15
|
+
minLength,
|
|
12
16
|
extensionFields
|
|
13
17
|
});
|
|
14
18
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { OasRef } from '../ref/Ref.js';
|
|
2
|
+
import type { StringFormat } from './string-types.js';
|
|
2
3
|
export type StringFields = {
|
|
3
4
|
title?: string;
|
|
4
5
|
description?: string;
|
|
5
|
-
format?:
|
|
6
|
+
format?: StringFormat;
|
|
6
7
|
enums?: string[];
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
minLength?: number;
|
|
7
10
|
nullable?: boolean;
|
|
8
11
|
extensionFields?: Record<string, unknown>;
|
|
9
12
|
example?: string;
|
|
@@ -32,11 +35,19 @@ export declare class OasString {
|
|
|
32
35
|
/**
|
|
33
36
|
* The format of the string.
|
|
34
37
|
*/
|
|
35
|
-
format:
|
|
38
|
+
format: StringFormat | undefined;
|
|
36
39
|
/**
|
|
37
40
|
* An array of allowed values for the string.
|
|
38
41
|
*/
|
|
39
42
|
enums: string[] | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The maximum length of the string.
|
|
45
|
+
*/
|
|
46
|
+
maxLength: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The minimum length of the string.
|
|
49
|
+
*/
|
|
50
|
+
minLength: number | undefined;
|
|
40
51
|
/**
|
|
41
52
|
* Indicates whether value can be null.
|
|
42
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,YAAY,CAAA;IAErB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,WAAoB;IACxB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,gCAAgC;IAChC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEf,MAAM,EAAE,YAAY;IAgBhC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;CAGzB"}
|
|
@@ -61,6 +61,24 @@ class OasString {
|
|
|
61
61
|
writable: true,
|
|
62
62
|
value: void 0
|
|
63
63
|
});
|
|
64
|
+
/**
|
|
65
|
+
* The maximum length of the string.
|
|
66
|
+
*/
|
|
67
|
+
Object.defineProperty(this, "maxLength", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: void 0
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* The minimum length of the string.
|
|
75
|
+
*/
|
|
76
|
+
Object.defineProperty(this, "minLength", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
configurable: true,
|
|
79
|
+
writable: true,
|
|
80
|
+
value: void 0
|
|
81
|
+
});
|
|
64
82
|
/**
|
|
65
83
|
* Indicates whether value can be null.
|
|
66
84
|
*/
|
|
@@ -91,6 +109,8 @@ class OasString {
|
|
|
91
109
|
this.nullable = fields.nullable;
|
|
92
110
|
this.extensionFields = fields.extensionFields;
|
|
93
111
|
this.example = fields.example;
|
|
112
|
+
this.maxLength = fields.maxLength;
|
|
113
|
+
this.minLength = fields.minLength;
|
|
94
114
|
}
|
|
95
115
|
// get pattern() {
|
|
96
116
|
// return this.fields.pattern
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const oasStringData: z.ZodType<OasStringData>;
|
|
3
|
+
export type StringFormat = 'date-time' | 'time' | 'date' | 'duration' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uuid' | 'uri' | 'regex' | 'password';
|
|
3
4
|
export type OasStringData = {
|
|
4
5
|
oasType: 'schema';
|
|
5
6
|
title?: string;
|
|
6
7
|
description?: string;
|
|
7
8
|
default?: string;
|
|
8
9
|
type: 'string';
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
minLength?: number;
|
|
9
12
|
pattern?: string;
|
|
10
|
-
|
|
11
|
-
format?:
|
|
13
|
+
enum?: string[];
|
|
14
|
+
format?: StringFormat;
|
|
15
|
+
nullable?: boolean;
|
|
16
|
+
example?: string;
|
|
12
17
|
};
|
|
13
18
|
//# sourceMappingURL=string-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmBvB,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAenC,CAAA;AAEhB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,OAAO,GACP,UAAU,CAAA;AAId,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,QAAQ,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
|
@@ -2,31 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.oasStringData = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
const stringFormat = zod_1.z.enum([
|
|
6
|
+
'date-time',
|
|
7
|
+
'time',
|
|
8
|
+
'date',
|
|
9
|
+
'duration',
|
|
10
|
+
'email',
|
|
11
|
+
'hostname',
|
|
12
|
+
'ipv4',
|
|
13
|
+
'ipv6',
|
|
14
|
+
'uuid',
|
|
15
|
+
'uri',
|
|
16
|
+
'regex',
|
|
17
|
+
'password'
|
|
18
|
+
// 'byte',
|
|
19
|
+
// 'binary'
|
|
20
|
+
]);
|
|
21
|
+
exports.oasStringData = zod_1.z
|
|
22
|
+
.object({
|
|
6
23
|
oasType: zod_1.z.literal('schema'),
|
|
24
|
+
type: zod_1.z.literal('string'),
|
|
7
25
|
title: zod_1.z.string().optional(),
|
|
8
26
|
description: zod_1.z.string().optional(),
|
|
9
27
|
default: zod_1.z.string().optional(),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// maxLength: z.number().optional(),
|
|
13
|
-
// minLength: z.number().optional(),
|
|
28
|
+
maxLength: zod_1.z.number().optional(),
|
|
29
|
+
minLength: zod_1.z.number().optional(),
|
|
14
30
|
pattern: zod_1.z.string().optional(),
|
|
15
|
-
|
|
16
|
-
format:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'duration',
|
|
22
|
-
'email',
|
|
23
|
-
'hostname',
|
|
24
|
-
'ipv4',
|
|
25
|
-
'ipv6',
|
|
26
|
-
'uuid',
|
|
27
|
-
'uri',
|
|
28
|
-
'regex',
|
|
29
|
-
'binary'
|
|
30
|
-
])
|
|
31
|
-
.optional()
|
|
32
|
-
});
|
|
31
|
+
enum: zod_1.z.array(zod_1.z.string()).optional(),
|
|
32
|
+
format: stringFormat.optional(),
|
|
33
|
+
nullable: zod_1.z.boolean().optional(),
|
|
34
|
+
example: zod_1.z.string().optional()
|
|
35
|
+
})
|
|
36
|
+
.passthrough();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SA2B3D,CAAA"}
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toString = void 0;
|
|
4
4
|
const String_js_1 = require("./String.js");
|
|
5
5
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
6
|
+
const string_types_js_1 = require("./string-types.js");
|
|
6
7
|
const toString = ({ value, context }) => {
|
|
7
|
-
const { type: _type, title, description, enum: enums, nullable, example, ...skipped } = value;
|
|
8
|
+
const { type: _type, title, description, enum: enums, nullable, example, format, maxLength, minLength, ...skipped } = string_types_js_1.oasStringData.parse(value);
|
|
8
9
|
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({ skipped, context });
|
|
9
10
|
return new String_js_1.OasString({
|
|
10
11
|
title,
|
|
@@ -12,6 +13,9 @@ const toString = ({ value, context }) => {
|
|
|
12
13
|
enums,
|
|
13
14
|
nullable,
|
|
14
15
|
example,
|
|
16
|
+
format,
|
|
17
|
+
maxLength,
|
|
18
|
+
minLength,
|
|
15
19
|
extensionFields
|
|
16
20
|
});
|
|
17
21
|
};
|