@typespec/json-schema 0.55.0-dev.1 → 0.55.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/generated-defs/TypeSpec.JsonSchema.Private.d.ts +3 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.Private.d.ts.map +1 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.Private.js +2 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.Private.js.map +1 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.d.ts +108 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.d.ts.map +1 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.js +2 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.js.map +1 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.ts-test.d.ts +2 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.ts-test.d.ts.map +1 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.ts-test.js +21 -0
- package/dist/generated-defs/TypeSpec.JsonSchema.ts-test.js.map +1 -0
- package/dist/src/index.d.ts +19 -20
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +34 -34
- package/dist/src/index.js.map +1 -1
- package/package.json +15 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.JsonSchema.Private.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.JsonSchema.Private.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,MAAM,yBAAyB,GAAG,CACtC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,KAAK,EAAE,IAAI,KACR,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.JsonSchema.Private.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.JsonSchema.Private.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { DecoratorContext, ModelProperty, Namespace, Scalar, Type } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* Add to namespaces to emit models within that namespace to JSON schema.
|
|
4
|
+
* Add to another declaration to emit that declaration to JSON schema.
|
|
5
|
+
*
|
|
6
|
+
* Optionally, for namespaces, you can provide a baseUri, and for other declarations,
|
|
7
|
+
* you can provide the id.
|
|
8
|
+
*
|
|
9
|
+
* @param baseUri Schema IDs are interpreted as relative to this URI.
|
|
10
|
+
*/
|
|
11
|
+
export type JsonSchemaDecorator = (context: DecoratorContext, target: Type, baseUri?: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Set the base URI for any schemas emitted from types within this namespace.
|
|
14
|
+
*
|
|
15
|
+
* @param baseUri the base URI. Schema IDs inside this namespace are relative to this URI.
|
|
16
|
+
*/
|
|
17
|
+
export type BaseUriDecorator = (context: DecoratorContext, target: Namespace, baseUri: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Specify the JSON Schema id. If this model or a parent namespace has a base URI,
|
|
20
|
+
* the provided ID will be relative to that base URI.
|
|
21
|
+
*
|
|
22
|
+
* By default, the id will be constructed based on the declaration's name.
|
|
23
|
+
*
|
|
24
|
+
* @param id the id of the JSON schema for this declaration.
|
|
25
|
+
*/
|
|
26
|
+
export type IdDecorator = (context: DecoratorContext, target: Type, id: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Specify that the numeric type must be a multiple of some numeric value.
|
|
29
|
+
*
|
|
30
|
+
* @param value The numeric type must be a multiple of this value.
|
|
31
|
+
*/
|
|
32
|
+
export type MultipleOfDecorator = (context: DecoratorContext, target: Scalar | ModelProperty, value: number) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Specify that the array must contain at least one instance of the provided type.
|
|
35
|
+
* Use `@minContains` and `@maxContains` to customize how many instances to expect.
|
|
36
|
+
*
|
|
37
|
+
* @param value The type the array must contain.
|
|
38
|
+
*/
|
|
39
|
+
export type ContainsDecorator = (context: DecoratorContext, target: Type | ModelProperty, value: Type) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Specify that the array must contain at least some number of the types provided
|
|
42
|
+
* by the contains decorator.
|
|
43
|
+
*
|
|
44
|
+
* @param value The minimum number of instances the array must contain
|
|
45
|
+
*/
|
|
46
|
+
export type MinContainsDecorator = (context: DecoratorContext, target: Type | ModelProperty, value: number) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Specify that the array must contain at most some number of the types provided
|
|
49
|
+
* by the contains decorator.
|
|
50
|
+
*
|
|
51
|
+
* @param value The maximum number of instances the array must contain
|
|
52
|
+
*/
|
|
53
|
+
export type MaxContainsDecorator = (context: DecoratorContext, target: Type | ModelProperty, value: number) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Specify that every item in the array must be unique.
|
|
56
|
+
*/
|
|
57
|
+
export type UniqueItemsDecorator = (context: DecoratorContext, target: Type | ModelProperty) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Specify the minimum number of properties this object can have.
|
|
60
|
+
*
|
|
61
|
+
* @param value The minimum number of properties this object can have.
|
|
62
|
+
*/
|
|
63
|
+
export type MinPropertiesDecorator = (context: DecoratorContext, target: Type | ModelProperty, value: number) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Specify the maximum number of properties this object can have.
|
|
66
|
+
*
|
|
67
|
+
* @param value The maximum number of properties this object can have.
|
|
68
|
+
*/
|
|
69
|
+
export type MaxPropertiesDecorator = (context: DecoratorContext, target: Type | ModelProperty, value: number) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Specify the encoding used for the contents of a string.
|
|
72
|
+
*
|
|
73
|
+
* @param value
|
|
74
|
+
*
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export type ContentEncodingDecorator = (context: DecoratorContext, target: Scalar | ModelProperty, value: string) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Specify that the target array must begin with the provided types.
|
|
80
|
+
*
|
|
81
|
+
* @param value a tuple containing the types that must be present at the start of the array
|
|
82
|
+
*/
|
|
83
|
+
export type PrefixItemsDecorator = (context: DecoratorContext, target: Type | ModelProperty, value: Type) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Specify the content type of content stored in a string.
|
|
86
|
+
*
|
|
87
|
+
* @param value the media type of the string contents
|
|
88
|
+
*/
|
|
89
|
+
export type ContentMediaTypeDecorator = (context: DecoratorContext, target: Scalar | ModelProperty, value: string) => void;
|
|
90
|
+
/**
|
|
91
|
+
* Specify the schema for the contents of a string when interpreted according to the content's
|
|
92
|
+
* media type and encoding.
|
|
93
|
+
*
|
|
94
|
+
* @param value the schema of the string contents
|
|
95
|
+
*/
|
|
96
|
+
export type ContentSchemaDecorator = (context: DecoratorContext, target: Scalar | ModelProperty, value: Type) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Specify a custom property to add to the emitted schema. Useful for adding custom keywords
|
|
99
|
+
* and other vendor-specific extensions. The value will be converted to a schema unless the parameter
|
|
100
|
+
* is wrapped in the `Json<Data>` template. For example, `@extension("x-schema", { x: "value" })` will
|
|
101
|
+
* emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will
|
|
102
|
+
* emit the raw JSON code `{x: "value"}`.
|
|
103
|
+
*
|
|
104
|
+
* @param key the name of the keyword of vendor extension, e.g. `x-custom`.
|
|
105
|
+
* @param value the value of the keyword. Will be converted to a schema unless wrapped in `Json<Data>`.
|
|
106
|
+
*/
|
|
107
|
+
export type ExtensionDecorator = (context: DecoratorContext, target: Type, key: string, value: Type) => void;
|
|
108
|
+
//# sourceMappingURL=TypeSpec.JsonSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.JsonSchema.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.JsonSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM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"file":"TypeSpec.JsonSchema.ts-test.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.JsonSchema.ts-test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** An error here would mean that the decorator is not exported or doesn't have the right name. */
|
|
2
|
+
import { $baseUri, $contains, $contentEncoding, $contentMediaType, $contentSchema, $extension, $id, $jsonSchema, $maxContains, $maxProperties, $minContains, $minProperties, $multipleOf, $prefixItems, $uniqueItems, } from "@typespec/json-schema";
|
|
3
|
+
/** An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ... */
|
|
4
|
+
const _ = {
|
|
5
|
+
$jsonSchema,
|
|
6
|
+
$baseUri,
|
|
7
|
+
$id,
|
|
8
|
+
$multipleOf,
|
|
9
|
+
$contains,
|
|
10
|
+
$minContains,
|
|
11
|
+
$maxContains,
|
|
12
|
+
$uniqueItems,
|
|
13
|
+
$minProperties,
|
|
14
|
+
$maxProperties,
|
|
15
|
+
$contentEncoding,
|
|
16
|
+
$prefixItems,
|
|
17
|
+
$contentMediaType,
|
|
18
|
+
$contentSchema,
|
|
19
|
+
$extension,
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=TypeSpec.JsonSchema.ts-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.JsonSchema.ts-test.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.JsonSchema.ts-test.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,OAAO,EACL,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,GAAG,EACH,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,GACb,MAAM,uBAAuB,CAAC;AAqC/B,qKAAqK;AACrK,MAAM,CAAC,GAAe;IACpB,WAAW;IACX,QAAQ;IACR,GAAG;IACH,WAAW;IACX,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,YAAY;IACZ,iBAAiB;IACjB,cAAc;IACd,UAAU;CACX,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmitContext, Enum, Model, Namespace, Program, Scalar, Tuple, Type, Union } from "@typespec/compiler";
|
|
2
|
+
import { ValidatesRawJsonDecorator } from "../generated-defs/TypeSpec.JsonSchema.Private.js";
|
|
3
|
+
import { BaseUriDecorator, ContainsDecorator, ContentEncodingDecorator, ContentMediaTypeDecorator, ContentSchemaDecorator, ExtensionDecorator, IdDecorator, JsonSchemaDecorator, MaxContainsDecorator, MaxPropertiesDecorator, MinContainsDecorator, MinPropertiesDecorator, MultipleOfDecorator, PrefixItemsDecorator, UniqueItemsDecorator } from "../generated-defs/TypeSpec.JsonSchema.js";
|
|
2
4
|
import { JSONSchemaEmitterOptions } from "./lib.js";
|
|
3
5
|
export { JsonSchemaEmitter } from "./json-schema-emitter.js";
|
|
4
6
|
export { $lib, EmitterOptionsSchema, JSONSchemaEmitterOptions } from "./lib.js";
|
|
5
7
|
export declare const namespace = "TypeSpec.JsonSchema";
|
|
6
8
|
export type JsonSchemaDeclaration = Model | Union | Enum | Scalar;
|
|
7
9
|
export declare function $onEmit(context: EmitContext<JSONSchemaEmitterOptions>): Promise<void>;
|
|
8
|
-
export declare
|
|
9
|
-
export declare
|
|
10
|
+
export declare const $jsonSchema: JsonSchemaDecorator;
|
|
11
|
+
export declare const $baseUri: BaseUriDecorator;
|
|
10
12
|
export declare function getBaseUri(program: Program, target: Type): any;
|
|
11
13
|
export declare function findBaseUri(program: Program, target: JsonSchemaDeclaration | Namespace): string | undefined;
|
|
12
14
|
export declare function isJsonSchemaDeclaration(program: Program, target: JsonSchemaDeclaration): boolean;
|
|
13
15
|
export declare function getJsonSchemaTypes(program: Program): (Namespace | Model)[];
|
|
14
16
|
export declare function getJsonSchema(program: Program, target: Type): boolean;
|
|
15
|
-
export declare
|
|
17
|
+
export declare const $multipleOf: MultipleOfDecorator;
|
|
16
18
|
export declare function getMultipleOf(program: Program, target: Type): any;
|
|
17
|
-
export declare
|
|
19
|
+
export declare const $id: IdDecorator;
|
|
18
20
|
export declare function getId(program: Program, target: Type): any;
|
|
19
|
-
export declare
|
|
21
|
+
export declare const $contains: ContainsDecorator;
|
|
20
22
|
export declare function getContains(program: Program, target: Type): any;
|
|
21
|
-
export declare
|
|
23
|
+
export declare const $minContains: MinContainsDecorator;
|
|
22
24
|
export declare function getMinContains(program: Program, target: Type): any;
|
|
23
|
-
export declare
|
|
25
|
+
export declare const $maxContains: MaxContainsDecorator;
|
|
24
26
|
export declare function getMaxContains(program: Program, target: Type): any;
|
|
25
|
-
export declare
|
|
27
|
+
export declare const $uniqueItems: UniqueItemsDecorator;
|
|
26
28
|
export declare function getUniqueItems(program: Program, target: Type): any;
|
|
27
|
-
export declare
|
|
29
|
+
export declare const $minProperties: MinPropertiesDecorator;
|
|
28
30
|
export declare function getMinProperties(program: Program, target: Type): any;
|
|
29
|
-
export declare
|
|
31
|
+
export declare const $maxProperties: MaxPropertiesDecorator;
|
|
30
32
|
export declare function getMaxProperties(program: Program, target: Type): any;
|
|
31
|
-
export declare
|
|
33
|
+
export declare const $contentEncoding: ContentEncodingDecorator;
|
|
32
34
|
export declare function getContentEncoding(program: Program, target: Type): string;
|
|
33
|
-
export declare
|
|
35
|
+
export declare const $contentMediaType: ContentMediaTypeDecorator;
|
|
34
36
|
export declare function getContentMediaType(program: Program, target: Type): string;
|
|
35
|
-
export declare
|
|
37
|
+
export declare const $contentSchema: ContentSchemaDecorator;
|
|
36
38
|
export declare function getContentSchema(program: Program, target: Type): any;
|
|
37
|
-
export declare
|
|
39
|
+
export declare const $prefixItems: PrefixItemsDecorator;
|
|
38
40
|
export declare function getPrefixItems(program: Program, target: Type): Tuple | undefined;
|
|
39
41
|
export interface ExtensionRecord {
|
|
40
42
|
key: string;
|
|
41
43
|
value: Type;
|
|
42
44
|
}
|
|
43
|
-
export declare
|
|
45
|
+
export declare const $extension: ExtensionDecorator;
|
|
44
46
|
export declare function getExtensions(program: Program, target: Type): ExtensionRecord[];
|
|
45
|
-
export declare
|
|
46
|
-
export declare namespace $validatesRawJson {
|
|
47
|
-
var namespace: string;
|
|
48
|
-
}
|
|
47
|
+
export declare const $validatesRawJson: ValidatesRawJsonDecorator;
|
|
49
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,IAAI,EACJ,KAAK,EAEL,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,KAAK,EAGN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,wBAAwB,EAAqB,MAAM,UAAU,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEhF,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C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/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { typespecTypeToJson, } from "@typespec/compiler";
|
|
1
|
+
import { setTypeSpecNamespace, typespecTypeToJson, } from "@typespec/compiler";
|
|
2
2
|
import { JsonSchemaEmitter } from "./json-schema-emitter.js";
|
|
3
3
|
import { createStateSymbol } from "./lib.js";
|
|
4
4
|
export { JsonSchemaEmitter } from "./json-schema-emitter.js";
|
|
@@ -17,7 +17,7 @@ export async function $onEmit(context) {
|
|
|
17
17
|
}
|
|
18
18
|
await emitter.writeOutput();
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export const $jsonSchema = (context, target, baseUriOrId) => {
|
|
21
21
|
context.program.stateSet(jsonSchemaKey).add(target);
|
|
22
22
|
if (baseUriOrId) {
|
|
23
23
|
if (target.kind === "Namespace") {
|
|
@@ -27,11 +27,11 @@ export function $jsonSchema(context, target, baseUriOrId) {
|
|
|
27
27
|
context.call($id, target, baseUriOrId);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
const baseUriKey = createStateSymbol("JsonSchema.baseURI");
|
|
32
|
-
export
|
|
32
|
+
export const $baseUri = (context, target, baseUri) => {
|
|
33
33
|
context.program.stateMap(baseUriKey).set(target, baseUri);
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
export function getBaseUri(program, target) {
|
|
36
36
|
return program.stateMap(baseUriKey).get(target);
|
|
37
37
|
}
|
|
@@ -61,106 +61,106 @@ export function getJsonSchema(program, target) {
|
|
|
61
61
|
return program.stateSet(jsonSchemaKey).has(target);
|
|
62
62
|
}
|
|
63
63
|
const multipleOfKey = createStateSymbol("JsonSchema.multipleOf");
|
|
64
|
-
export
|
|
64
|
+
export const $multipleOf = (context, target, value) => {
|
|
65
65
|
context.program.stateMap(multipleOfKey).set(target, value);
|
|
66
|
-
}
|
|
66
|
+
};
|
|
67
67
|
export function getMultipleOf(program, target) {
|
|
68
68
|
return program.stateMap(multipleOfKey).get(target);
|
|
69
69
|
}
|
|
70
70
|
const idKey = createStateSymbol("JsonSchema.id");
|
|
71
|
-
export
|
|
71
|
+
export const $id = (context, target, value) => {
|
|
72
72
|
context.program.stateMap(idKey).set(target, value);
|
|
73
|
-
}
|
|
73
|
+
};
|
|
74
74
|
export function getId(program, target) {
|
|
75
75
|
return program.stateMap(idKey).get(target);
|
|
76
76
|
}
|
|
77
77
|
const containsKey = createStateSymbol("JsonSchema.contains");
|
|
78
|
-
export
|
|
78
|
+
export const $contains = (context, target, value) => {
|
|
79
79
|
context.program.stateMap(containsKey).set(target, value);
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
81
|
export function getContains(program, target) {
|
|
82
82
|
return program.stateMap(containsKey).get(target);
|
|
83
83
|
}
|
|
84
84
|
const minContainsKey = createStateSymbol("JsonSchema.minContains");
|
|
85
|
-
export
|
|
85
|
+
export const $minContains = (context, target, value) => {
|
|
86
86
|
context.program.stateMap(minContainsKey).set(target, value);
|
|
87
|
-
}
|
|
87
|
+
};
|
|
88
88
|
export function getMinContains(program, target) {
|
|
89
89
|
return program.stateMap(minContainsKey).get(target);
|
|
90
90
|
}
|
|
91
91
|
const maxContainsKey = createStateSymbol("JsonSchema.maxContains");
|
|
92
|
-
export
|
|
92
|
+
export const $maxContains = (context, target, value) => {
|
|
93
93
|
context.program.stateMap(maxContainsKey).set(target, value);
|
|
94
|
-
}
|
|
94
|
+
};
|
|
95
95
|
export function getMaxContains(program, target) {
|
|
96
96
|
return program.stateMap(maxContainsKey).get(target);
|
|
97
97
|
}
|
|
98
98
|
const uniqueItemsKey = createStateSymbol("JsonSchema.uniqueItems");
|
|
99
|
-
export
|
|
99
|
+
export const $uniqueItems = (context, target) => {
|
|
100
100
|
context.program.stateMap(uniqueItemsKey).set(target, true);
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
export function getUniqueItems(program, target) {
|
|
103
103
|
return program.stateMap(uniqueItemsKey).get(target);
|
|
104
104
|
}
|
|
105
105
|
const minPropertiesKey = createStateSymbol("JsonSchema.minProperties");
|
|
106
|
-
export
|
|
106
|
+
export const $minProperties = (context, target, value) => {
|
|
107
107
|
context.program.stateMap(minPropertiesKey).set(target, value);
|
|
108
|
-
}
|
|
108
|
+
};
|
|
109
109
|
export function getMinProperties(program, target) {
|
|
110
110
|
return program.stateMap(minPropertiesKey).get(target);
|
|
111
111
|
}
|
|
112
112
|
const maxPropertiesKey = createStateSymbol("JsonSchema.maxProperties");
|
|
113
|
-
export
|
|
113
|
+
export const $maxProperties = (context, target, value) => {
|
|
114
114
|
context.program.stateMap(maxPropertiesKey).set(target, value);
|
|
115
|
-
}
|
|
115
|
+
};
|
|
116
116
|
export function getMaxProperties(program, target) {
|
|
117
117
|
return program.stateMap(maxPropertiesKey).get(target);
|
|
118
118
|
}
|
|
119
119
|
const contentEncodingKey = createStateSymbol("JsonSchema.contentEncoding");
|
|
120
|
-
export
|
|
120
|
+
export const $contentEncoding = (context, target, value) => {
|
|
121
121
|
context.program.stateMap(contentEncodingKey).set(target, value);
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
export function getContentEncoding(program, target) {
|
|
124
124
|
return program.stateMap(contentEncodingKey).get(target);
|
|
125
125
|
}
|
|
126
126
|
const contentMediaType = createStateSymbol("JsonSchema.contentMediaType");
|
|
127
|
-
export
|
|
127
|
+
export const $contentMediaType = (context, target, value) => {
|
|
128
128
|
context.program.stateMap(contentMediaType).set(target, value);
|
|
129
|
-
}
|
|
129
|
+
};
|
|
130
130
|
export function getContentMediaType(program, target) {
|
|
131
131
|
return program.stateMap(contentMediaType).get(target);
|
|
132
132
|
}
|
|
133
133
|
const contentSchemaKey = createStateSymbol("JsonSchema.contentSchema");
|
|
134
|
-
export
|
|
134
|
+
export const $contentSchema = (context, target, value) => {
|
|
135
135
|
context.program.stateMap(contentSchemaKey).set(target, value);
|
|
136
|
-
}
|
|
136
|
+
};
|
|
137
137
|
export function getContentSchema(program, target) {
|
|
138
138
|
return program.stateMap(contentSchemaKey).get(target);
|
|
139
139
|
}
|
|
140
140
|
const prefixItemsKey = createStateSymbol("JsonSchema.prefixItems");
|
|
141
|
-
export
|
|
141
|
+
export const $prefixItems = (context, target, value) => {
|
|
142
142
|
context.program.stateMap(prefixItemsKey).set(target, value);
|
|
143
|
-
}
|
|
143
|
+
};
|
|
144
144
|
export function getPrefixItems(program, target) {
|
|
145
145
|
return program.stateMap(prefixItemsKey).get(target);
|
|
146
146
|
}
|
|
147
147
|
const extensionsKey = createStateSymbol("JsonSchema.extension");
|
|
148
|
-
export
|
|
148
|
+
export const $extension = (context, target, key, value) => {
|
|
149
149
|
const stateMap = context.program.stateMap(extensionsKey);
|
|
150
150
|
const extensions = stateMap.has(target)
|
|
151
151
|
? stateMap.get(target)
|
|
152
152
|
: stateMap.set(target, []).get(target);
|
|
153
153
|
extensions.push({ key, value });
|
|
154
|
-
}
|
|
154
|
+
};
|
|
155
155
|
export function getExtensions(program, target) {
|
|
156
156
|
var _a;
|
|
157
157
|
return (_a = program.stateMap(extensionsKey).get(target)) !== null && _a !== void 0 ? _a : [];
|
|
158
158
|
}
|
|
159
|
-
export
|
|
159
|
+
export const $validatesRawJson = (context, target, value) => {
|
|
160
160
|
const [_, diagnostics] = typespecTypeToJson(value, target);
|
|
161
161
|
if (diagnostics.length > 0) {
|
|
162
162
|
context.program.reportDiagnostics(diagnostics);
|
|
163
163
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
164
|
+
};
|
|
165
|
+
setTypeSpecNamespace("Private", $validatesRawJson);
|
|
166
166
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,oBAAoB,EACpB,kBAAkB,GACnB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AAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC;AACF,oBAAoB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/json-schema",
|
|
3
|
-
"version": "0.55.0
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec library for emitting TypeSpec to JSON Schema and converting JSON Schema to TypeSpec",
|
|
6
6
|
"homepage": "https://github.com/microsoft/typespec",
|
|
@@ -39,33 +39,34 @@
|
|
|
39
39
|
"!dist/test/**"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@typespec/compiler": "~0.
|
|
42
|
+
"@typespec/compiler": "~0.55.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "~18.11.19",
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@typespec/eslint-plugin": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
49
|
-
"@typespec/internal-build-utils": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
50
|
-
"@typespec/library-linter": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
51
|
-
"@vitest/coverage-v8": "^1.2.2",
|
|
52
|
-
"@vitest/ui": "^1.2.2",
|
|
46
|
+
"@vitest/coverage-v8": "^1.4.0",
|
|
47
|
+
"@vitest/ui": "^1.4.0",
|
|
53
48
|
"ajv": "~8.12.0",
|
|
54
49
|
"ajv-formats": "~2.1.1",
|
|
55
50
|
"c8": "^9.1.0",
|
|
56
|
-
"eslint": "^8.
|
|
51
|
+
"eslint": "^8.57.0",
|
|
57
52
|
"rimraf": "~5.0.5",
|
|
58
|
-
"typescript": "~5.
|
|
59
|
-
"vitest": "^1.
|
|
53
|
+
"typescript": "~5.4.3",
|
|
54
|
+
"vitest": "^1.4.0",
|
|
55
|
+
"@typespec/compiler": "~0.55.0",
|
|
56
|
+
"@typespec/eslint-config-typespec": "~0.55.0",
|
|
57
|
+
"@typespec/eslint-plugin": "~0.55.0",
|
|
58
|
+
"@typespec/internal-build-utils": "~0.55.0",
|
|
59
|
+
"@typespec/library-linter": "~0.55.0",
|
|
60
60
|
"@typespec/tspd": "~0.46.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"yaml": "~2.
|
|
63
|
+
"yaml": "~2.4.1"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"clean": "rimraf ./dist ./temp",
|
|
67
|
-
"build": "tsc -p . && npm run lint-typespec-library",
|
|
67
|
+
"build": "npm run gen-extern-signature && tsc -p . && npm run lint-typespec-library",
|
|
68
68
|
"watch": "tsc -p . --watch",
|
|
69
|
+
"gen-extern-signature": "tspd --enable-experimental gen-extern-signature .",
|
|
69
70
|
"lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
|
|
70
71
|
"test": "vitest run",
|
|
71
72
|
"test:ui": "vitest --ui",
|