@typespec/json-schema 0.52.0-dev.1 → 0.52.0-dev.2
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 +5 -5
- package/lib/main.tsp +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,7 +194,7 @@ media type and encoding.
|
|
|
194
194
|
|
|
195
195
|
Specify a custom property to add to the emitted schema. Useful for adding custom keywords
|
|
196
196
|
and other vendor-specific extensions. The value will be converted to a schema unless the parameter
|
|
197
|
-
is wrapped in the `Json<
|
|
197
|
+
is wrapped in the `Json<Data>` template. For example, `@extension("x-schema", { x: "value" })` will
|
|
198
198
|
emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will
|
|
199
199
|
emit the raw JSON code `{x: "value"}`.
|
|
200
200
|
|
|
@@ -208,10 +208,10 @@ emit the raw JSON code `{x: "value"}`.
|
|
|
208
208
|
|
|
209
209
|
##### Parameters
|
|
210
210
|
|
|
211
|
-
| Name | Type | Description
|
|
212
|
-
| ----- | ----------------------- |
|
|
213
|
-
| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`.
|
|
214
|
-
| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json<
|
|
211
|
+
| Name | Type | Description |
|
|
212
|
+
| ----- | ----------------------- | --------------------------------------------------------------------------------------- |
|
|
213
|
+
| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. |
|
|
214
|
+
| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json<Data>`. |
|
|
215
215
|
|
|
216
216
|
#### `@id`
|
|
217
217
|
|
package/lib/main.tsp
CHANGED
|
@@ -112,12 +112,12 @@ extern dec contentSchema(target: string | Reflection.ModelProperty, value: unkno
|
|
|
112
112
|
/**
|
|
113
113
|
* Specify a custom property to add to the emitted schema. Useful for adding custom keywords
|
|
114
114
|
* and other vendor-specific extensions. The value will be converted to a schema unless the parameter
|
|
115
|
-
* is wrapped in the `Json<
|
|
115
|
+
* is wrapped in the `Json<Data>` template. For example, `@extension("x-schema", { x: "value" })` will
|
|
116
116
|
* emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will
|
|
117
117
|
* emit the raw JSON code `{x: "value"}`.
|
|
118
118
|
*
|
|
119
119
|
* @param key the name of the keyword of vendor extension, e.g. `x-custom`.
|
|
120
|
-
* @param value the value of the keyword. Will be converted to a schema unless wrapped in `Json<
|
|
120
|
+
* @param value the value of the keyword. Will be converted to a schema unless wrapped in `Json<Data>`.
|
|
121
121
|
*/
|
|
122
122
|
extern dec extension(target: unknown, key: valueof string, value: unknown);
|
|
123
123
|
|
|
@@ -152,11 +152,11 @@ enum Format {
|
|
|
152
152
|
* whereas `@extension("x-schema", Json<{x: "value"}>)` will emit the raw JSON code
|
|
153
153
|
* `{x: "value"}`.
|
|
154
154
|
*
|
|
155
|
-
* @template
|
|
155
|
+
* @template Data the type to convert to raw JSON
|
|
156
156
|
*/
|
|
157
|
-
@Private.validatesRawJson(
|
|
158
|
-
model Json<
|
|
159
|
-
value:
|
|
157
|
+
@Private.validatesRawJson(Data)
|
|
158
|
+
model Json<Data> {
|
|
159
|
+
value: Data;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
namespace Private {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/json-schema",
|
|
3
|
-
"version": "0.52.0-dev.
|
|
3
|
+
"version": "0.52.0-dev.2",
|
|
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",
|