yuppi 1.2.5 → 1.2.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/README.md CHANGED
@@ -125,7 +125,7 @@ Yuppi
125
125
  Briefly as follows.
126
126
 
127
127
  ```typescript
128
- import { Yuppi, Patterns } from "yuppi";
128
+ import { Yuppi, Patterns } from 'yuppi';
129
129
  ```
130
130
 
131
131
  ### Constructors
@@ -141,7 +141,7 @@ Yuppi schema builder.
141
141
  > Example:
142
142
  >
143
143
  > ```typescript
144
- > const Yupp: Yuppi = new Yuppi();
144
+ > const Yupp = new Yuppi();
145
145
  > ```
146
146
 
147
147
  ### Methods
@@ -162,7 +162,7 @@ Validate the properties with your Yuppi schema.
162
162
  > ```typescript
163
163
  > const schema: Schema = {
164
164
  > display_name: {
165
- > type: "string",
165
+ > type: 'string',
166
166
  > min: 1,
167
167
  > max: 32,
168
168
  > nullable: false,
@@ -170,7 +170,7 @@ Validate the properties with your Yuppi schema.
170
170
  > },
171
171
  >
172
172
  > username: {
173
- > type: "string",
173
+ > type: 'string',
174
174
  > min: 3,
175
175
  > max: 16,
176
176
  > pattern: Patterns.Username,
@@ -179,7 +179,7 @@ Validate the properties with your Yuppi schema.
179
179
  > },
180
180
  >
181
181
  > email: {
182
- > type: "string",
182
+ > type: 'string',
183
183
  > pattern: Patterns.Email,
184
184
  > lowercase: true,
185
185
  > nullable: false,
@@ -187,10 +187,10 @@ Validate the properties with your Yuppi schema.
187
187
  > }
188
188
  > };
189
189
  >
190
- > const properties: AnyObject = {
191
- > display_name: "Fırat",
192
- > username: "fir4tozden",
193
- > email: "fir4tozden@gmail.com"
190
+ > const properties = {
191
+ > display_name: 'Fırat',
192
+ > username: 'fir4tozden',
193
+ > email: 'fir4tozden@gmail.com'
194
194
  > };
195
195
  >
196
196
  > try {
@@ -202,7 +202,7 @@ Validate the properties with your Yuppi schema.
202
202
  > email: "fir4tozden@gmail.com"
203
203
  > }
204
204
  > */
205
- > } catch((error: ValidationError)) {
205
+ > } catch (error) {
206
206
  > console.log(error.message); // "Field email must match the required pattern ^[a-zA-Z0-9._-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$"
207
207
  > }
208
208
  > ```
@@ -224,7 +224,7 @@ Convert your Yuppi schema into Yup schema.
224
224
  > ```typescript
225
225
  > const schema: Schema = {
226
226
  > display_name: {
227
- > type: "string",
227
+ > type: 'string',
228
228
  > min: 1,
229
229
  > max: 32,
230
230
  > nullable: false,
@@ -232,7 +232,7 @@ Convert your Yuppi schema into Yup schema.
232
232
  > },
233
233
  >
234
234
  > username: {
235
- > type: "string",
235
+ > type: 'string',
236
236
  > min: 3,
237
237
  > max: 16,
238
238
  > pattern: Patterns.Username,
@@ -241,7 +241,7 @@ Convert your Yuppi schema into Yup schema.
241
241
  > },
242
242
  >
243
243
  > email: {
244
- > type: "string",
244
+ > type: 'string',
245
245
  > pattern: Patterns.Email,
246
246
  > lowercase: true,
247
247
  > nullable: false,
@@ -269,7 +269,7 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
269
269
  > ```typescript
270
270
  > const schema: Schema = {
271
271
  > display_name: {
272
- > type: "string",
272
+ > type: 'string',
273
273
  > min: 1,
274
274
  > max: 32,
275
275
  > nullable: false,
@@ -277,7 +277,7 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
277
277
  > },
278
278
  >
279
279
  > username: {
280
- > type: "string",
280
+ > type: 'string',
281
281
  > min: 3,
282
282
  > max: 16,
283
283
  > pattern: Patterns.Username,
@@ -286,7 +286,7 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
286
286
  > },
287
287
  >
288
288
  > email: {
289
- > type: "string",
289
+ > type: 'string',
290
290
  > pattern: Patterns.Email,
291
291
  > lowercase: true,
292
292
  > nullable: false,
@@ -5,7 +5,7 @@ type Base = {
5
5
  required: boolean;
6
6
  };
7
7
  type String = Base & {
8
- type: "string";
8
+ type: 'string';
9
9
  enum?: string[];
10
10
  min?: number;
11
11
  max?: number;
@@ -13,7 +13,7 @@ type String = Base & {
13
13
  uppercase?: boolean;
14
14
  };
15
15
  type Number = Base & {
16
- type: "number";
16
+ type: 'number';
17
17
  enum?: number[];
18
18
  min?: number;
19
19
  max?: number;
@@ -22,19 +22,19 @@ type Number = Base & {
22
22
  negative?: boolean;
23
23
  };
24
24
  type Boolean = Base & {
25
- type: "boolean";
25
+ type: 'boolean';
26
26
  };
27
27
  type Date = Base & {
28
- type: "date";
28
+ type: 'date';
29
29
  min?: string;
30
30
  max?: string;
31
31
  };
32
32
  type Object$1 = Base & {
33
- type: "object";
33
+ type: 'object';
34
34
  properties: Schema;
35
35
  };
36
36
  type Array = Base & {
37
- type: "array";
37
+ type: 'array';
38
38
  min?: number;
39
39
  max?: number;
40
40
  items: Types;
@@ -5,7 +5,7 @@ type Base = {
5
5
  required: boolean;
6
6
  };
7
7
  type String = Base & {
8
- type: "string";
8
+ type: 'string';
9
9
  enum?: string[];
10
10
  min?: number;
11
11
  max?: number;
@@ -13,7 +13,7 @@ type String = Base & {
13
13
  uppercase?: boolean;
14
14
  };
15
15
  type Number = Base & {
16
- type: "number";
16
+ type: 'number';
17
17
  enum?: number[];
18
18
  min?: number;
19
19
  max?: number;
@@ -22,19 +22,19 @@ type Number = Base & {
22
22
  negative?: boolean;
23
23
  };
24
24
  type Boolean = Base & {
25
- type: "boolean";
25
+ type: 'boolean';
26
26
  };
27
27
  type Date = Base & {
28
- type: "date";
28
+ type: 'date';
29
29
  min?: string;
30
30
  max?: string;
31
31
  };
32
32
  type Object$1 = Base & {
33
- type: "object";
33
+ type: 'object';
34
34
  properties: Schema;
35
35
  };
36
36
  type Array = Base & {
37
- type: "array";
37
+ type: 'array';
38
38
  min?: number;
39
39
  max?: number;
40
40
  items: Types;
@@ -1,6 +1,7 @@
1
+ import * as yup from 'yup';
1
2
  import { TObject } from '@sinclair/typebox';
2
3
  import { Schema } from '../types/Schema.type.mjs';
3
4
 
4
- declare const convertToJSONSchema: (schema: Schema) => TObject;
5
+ declare const convertToJSONSchema: (schema: Schema) => TObject<yup.AnyObject>;
5
6
 
6
7
  export { convertToJSONSchema };
@@ -1,6 +1,7 @@
1
+ import * as yup from 'yup';
1
2
  import { TObject } from '@sinclair/typebox';
2
3
  import { Schema } from '../types/Schema.type.js';
3
4
 
4
- declare const convertToJSONSchema: (schema: Schema) => TObject;
5
+ declare const convertToJSONSchema: (schema: Schema) => TObject<yup.AnyObject>;
5
6
 
6
7
  export { convertToJSONSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuppi",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Schemas that can be converted to Yup and JSON Schema.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/keift/yuppi",
@@ -21,7 +21,7 @@
21
21
  "yup": "^1.7.0"
22
22
  },
23
23
  "devDependencies": {
24
- "neatlint": "^1.1.4",
24
+ "neatlint": "^1.1.6",
25
25
  "prettier": "^3.6.2",
26
26
  "tsup": "^8.5.0"
27
27
  },