@azure/schema-registry-json 1.0.1-alpha.20250109.1 → 1.0.1-alpha.20250110.1
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 +9 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,10 +65,10 @@ const { createEventDataAdapter } = require("@azure/event-hubs");
|
|
|
65
65
|
const { SchemaRegistryClient } = require("@azure/schema-registry");
|
|
66
66
|
const { JsonSchemaSerializer } = require("@azure/schema-registry-json");
|
|
67
67
|
|
|
68
|
-
async function main(){
|
|
68
|
+
async function main() {
|
|
69
69
|
const client = new SchemaRegistryClient(
|
|
70
70
|
"<fully qualified namespace>",
|
|
71
|
-
new DefaultAzureCredential()
|
|
71
|
+
new DefaultAzureCredential(),
|
|
72
72
|
);
|
|
73
73
|
const serializer = new JsonSchemaSerializer(client, {
|
|
74
74
|
groupName: "<group>",
|
|
@@ -76,7 +76,7 @@ async function main(){
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
// Example Json schema
|
|
79
|
-
const schema = JSON.stringify({
|
|
79
|
+
const schema = JSON.stringify({
|
|
80
80
|
$schema: "http://json-schema.org/draft-04/schema#",
|
|
81
81
|
$id: "person",
|
|
82
82
|
title: "Student",
|
|
@@ -88,7 +88,7 @@ async function main(){
|
|
|
88
88
|
description: "The name of the student",
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
|
-
required: ["name"]
|
|
91
|
+
required: ["name"],
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// Example value that matches the Json schema above
|
|
@@ -104,11 +104,10 @@ async function main(){
|
|
|
104
104
|
main().catch((err) => {
|
|
105
105
|
console.error("The sample encountered an error:", err);
|
|
106
106
|
});
|
|
107
|
-
|
|
108
107
|
```
|
|
109
108
|
|
|
110
|
-
The serializer doesn't check whether the deserialized value matches the schema
|
|
111
|
-
but provides an option to implement such validation. The application can pass a
|
|
109
|
+
The serializer doesn't check whether the deserialized value matches the schema
|
|
110
|
+
but provides an option to implement such validation. The application can pass a
|
|
112
111
|
validation callback function as one of the options to the deserialize method where schema validation can be implemented.
|
|
113
112
|
To see how the validation might be implemented, please checkout the [`schemaRegistryJsonWithValidation`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/schemaregistry/schema-registry-json/samples-dev/schemaRegistryJsonWithValidation.ts)
|
|
114
113
|
sample.
|
|
@@ -165,10 +164,10 @@ learn more about how to build and test the code.
|
|
|
165
164
|
|
|
166
165
|

|
|
167
166
|
|
|
168
|
-
[azure_cli]: https://
|
|
167
|
+
[azure_cli]: https://learn.microsoft.com/cli/azure
|
|
169
168
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
170
169
|
[azure_portal]: https://portal.azure.com
|
|
171
170
|
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
|
|
172
171
|
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
|
|
173
|
-
[resterror]: https://
|
|
174
|
-
[schema_registry]: https://
|
|
172
|
+
[resterror]: https://learn.microsoft.com/javascript/api/@azure/core-rest-pipeline/resterror?view=azure-node-latest
|
|
173
|
+
[schema_registry]: https://learn.microsoft.com/javascript/api/overview/azure/schema-registry-readme?view=azure-node-latest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/schema-registry-json",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.20250110.1",
|
|
4
4
|
"description": "Schema Registry JSON Serializer Library with typescript type definitions for node.js and browser.",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|