@sinclair/typebox 0.23.2 → 0.23.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.23.2",
3
+ "version": "0.23.3",
4
4
  "description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "json-schema",
@@ -26,7 +26,7 @@
26
26
  "test": "npm run spec"
27
27
  },
28
28
  "devDependencies": {
29
- "@sinclair/hammer": "^0.15.8",
29
+ "@sinclair/hammer": "^0.16.3",
30
30
  "@types/chai": "^4.2.22",
31
31
  "@types/mocha": "^9.0.0",
32
32
  "@types/node": "^16.11.9",
package/readme.md CHANGED
@@ -598,7 +598,7 @@ In addition to JSON schema types, TypeBox provides several extended types that a
598
598
 
599
599
  ### Strict
600
600
 
601
- TypeBox schemas contain the properties `kind` and `modifier`. These properties are provided to enable runtime type reflection on schemas, as well as helping TypeBox apply the appropriate static type inference rules. These properties are not strictly valid JSON schema so in some cases it may be desirable to omit them. TypeBox provides a `Type.Strict()` function that will omit these properties if nessasary.
601
+ TypeBox schemas contain the properties `kind` and `modifier`. These properties are provided to enable runtime type reflection on schemas, as well as helping TypeBox apply the appropriate static type inference rules. These properties are not strictly valid JSON schema so in some cases it may be desirable to omit them. TypeBox provides a `Type.Strict()` function that will omit these properties if necessary.
602
602
 
603
603
  ```typescript
604
604
  const T = Type.Object({ // const T = {
@@ -697,7 +697,7 @@ Please refer to the official AJV [documentation](https://ajv.js.org/guide/gettin
697
697
 
698
698
  ### OpenAPI
699
699
 
700
- TypeBox can be used to create schemas for OpenAPI, however users should be aware of the various disparities between the JSON Schema and OpenAPI schema specifications. Two common instances where OpenAPI diverges from the JSON Schema specification is OpenAPI's handling of string enums and nullable schemas. The following shows how you can use TypeBox to construct these types.
700
+ TypeBox can be used to create schemas for OpenAPI, however users should be mindful of some disparities between the JSON Schema and OpenAPI for versions prior to OpenAPI 3.1. Two common instances where OpenAPI diverges is the handling nullable and string enum schemas types. The following shows how you can use TypeBox to construct these types.
701
701
 
702
702
  ```typescript
703
703
  import { Type, Static, TNull, TLiteral, TUnion, TSchema } from '@sinclair/typebox'
package/typebox.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare type TOptional<T extends TSchema> = T & {
11
11
  export declare type TReadonly<T extends TSchema> = T & {
12
12
  modifier: typeof ReadonlyModifier;
13
13
  };
14
- export declare const BoxKind: unique symbol;
14
+ export declare const NamespaceKind: unique symbol;
15
15
  export declare const KeyOfKind: unique symbol;
16
16
  export declare const IntersectKind: unique symbol;
17
17
  export declare const UnionKind: unique symbol;
@@ -68,7 +68,7 @@ export declare type TDefinitions = {
68
68
  [key: string]: TSchema;
69
69
  };
70
70
  export declare type TNamespace<T extends TDefinitions> = {
71
- kind: typeof BoxKind;
71
+ kind: typeof NamespaceKind;
72
72
  $defs: T;
73
73
  } & CustomOptions;
74
74
  export interface TSchema {
package/typebox.js CHANGED
@@ -27,7 +27,7 @@ THE SOFTWARE.
27
27
 
28
28
  ---------------------------------------------------------------------------*/
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.Type = exports.TypeBuilder = exports.VoidKind = exports.UndefinedKind = exports.PromiseKind = exports.FunctionKind = exports.ConstructorKind = exports.RefKind = exports.AnyKind = exports.UnknownKind = exports.NullKind = exports.BooleanKind = exports.IntegerKind = exports.NumberKind = exports.StringKind = exports.LiteralKind = exports.EnumKind = exports.ArrayKind = exports.RecordKind = exports.ObjectKind = exports.TupleKind = exports.UnionKind = exports.IntersectKind = exports.KeyOfKind = exports.BoxKind = exports.ReadonlyModifier = exports.OptionalModifier = exports.ReadonlyOptionalModifier = void 0;
30
+ exports.Type = exports.TypeBuilder = exports.VoidKind = exports.UndefinedKind = exports.PromiseKind = exports.FunctionKind = exports.ConstructorKind = exports.RefKind = exports.AnyKind = exports.UnknownKind = exports.NullKind = exports.BooleanKind = exports.IntegerKind = exports.NumberKind = exports.StringKind = exports.LiteralKind = exports.EnumKind = exports.ArrayKind = exports.RecordKind = exports.ObjectKind = exports.TupleKind = exports.UnionKind = exports.IntersectKind = exports.KeyOfKind = exports.NamespaceKind = exports.ReadonlyModifier = exports.OptionalModifier = exports.ReadonlyOptionalModifier = void 0;
31
31
  // --------------------------------------------------------------------------
32
32
  // Modifiers
33
33
  // --------------------------------------------------------------------------
@@ -37,7 +37,7 @@ exports.ReadonlyModifier = Symbol('ReadonlyModifier');
37
37
  // --------------------------------------------------------------------------
38
38
  // Schema Standard
39
39
  // --------------------------------------------------------------------------
40
- exports.BoxKind = Symbol('BoxKind');
40
+ exports.NamespaceKind = Symbol('NamespaceKind');
41
41
  exports.KeyOfKind = Symbol('KeyOfKind');
42
42
  exports.IntersectKind = Symbol('IntersectKind');
43
43
  exports.UnionKind = Symbol('UnionKind');
@@ -290,7 +290,7 @@ class TypeBuilder {
290
290
  }
291
291
  /** `Standard` Creates a namespace for a set of related types */
292
292
  Namespace($defs, options = {}) {
293
- return this.Store({ ...options, kind: exports.BoxKind, $defs });
293
+ return this.Store({ ...options, kind: exports.NamespaceKind, $defs });
294
294
  }
295
295
  Ref(...args) {
296
296
  if (args.length === 2) {