Skip to content

Commit a31ffec

Browse files
Add GetSchemaByVersion API Route (#20115)
* Add path for getting schema by version * Update examples * Fix parameter reference * Add format for int types
1 parent d7c9be2 commit a31ffec

File tree

5 files changed

+124
-6
lines changed

5 files changed

+124
-6
lines changed

specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/examples/OperationSchema_GetById.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"responses": {
88
"200": {
99
"headers": {
10-
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/3?api-version=2021-11",
10+
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/3?api-version=2021-10",
1111
"Content-Type": "application/json;serialization=avro",
1212
"Schema-Id": "a489dc4916744e3db72dda8f9693f342",
13-
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2021-11&schema-id=a489dc4916744e3db72dda8f9693f342",
13+
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2021-10&schema-id=a489dc4916744e3db72dda8f9693f342",
1414
"Schema-Group-Name": "sample-sr-group",
1515
"Schema-Name": "sample-schema-name",
1616
"Schema-Version": 3
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"parameters": {
3+
"endpoint": "mynamespace.servicebus.windows.net",
4+
"groupName": "sample-sr-group",
5+
"schemaName": "sample-schema-name",
6+
"schemaVersion": 25,
7+
"api-version": "2021-10"
8+
},
9+
"responses": {
10+
"200": {
11+
"headers": {
12+
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/25?api-version=2021-10",
13+
"Content-Type": "application/json;serialization=avro",
14+
"Schema-Id": "a489dc4916744e3db72dda8f9693f392",
15+
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2021-10&schema-id=a489dc4916744e3db72dda8f9693f342",
16+
"Schema-Group-Name": "sample-sr-group",
17+
"Schema-Name": "sample-schema-name",
18+
"Schema-Version": 25,
19+
"Schema-Version-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/?api-version=2021-10"
20+
},
21+
"body": "{\"type\":\"record\",\"name\":\"AvroUser\",\"namespace\":\"com.azure.schemaregistry.samples\",\"fields\":[{\"name\":\"name_25\",\"type\":\"string\"},{\"name\":\"favoriteNumber\",\"type\":\"int\"}]}"
22+
}
23+
}
24+
}

specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/examples/OperationSchema_QueryIdByContent.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"responses": {
1010
"204": {
1111
"headers": {
12-
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/3?api-version=2021-11",
12+
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/3?api-version=2021-10",
1313
"Schema-Id": "a489dc4916744e3db72dda8f9693f342",
14-
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2021-11&schema-id=a489dc4916744e3db72dda8f9693f342",
14+
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2021-10&schema-id=a489dc4916744e3db72dda8f9693f342",
1515
"Schema-Group-Name": "sample-sr-group",
1616
"Schema-Name": "sample-schema-name",
1717
"Schema-Version": 3

specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/examples/OperationSchema_Register.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"responses": {
1010
"204": {
1111
"headers": {
12-
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/3?api-version=2021-11",
12+
"Location": "https://sample-namespace.servicebus.windows.net/$schemagroups/sample-sr-group/schemas/sample-schema-name/versions/3?api-version=2021-10",
1313
"Schema-Id": "a489dc4916744e3db72dda8f9693f342",
14-
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2021-11&schema-id=a489dc4916744e3db72dda8f9693f342",
14+
"Schema-Id-Location": "https://sample-namespace.servicebus.windows.net/$schemagroups?api-version=2020-11&schema-id=a489dc4916744e3db72dda8f9693f342",
1515
"Schema-Group-Name": "sample-sr-group",
1616
"Schema-Name": "sample-schema-name",
1717
"Schema-Version": 3

specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/schemaregistry.json

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,91 @@
197197
}
198198
}
199199
},
200+
"/$schemaGroups/{groupName}/schemas/{schemaName}/versions/{schemaVersion}": {
201+
"get": {
202+
"summary": "Get specific schema versions.",
203+
"description": "Gets one specific version of one schema.",
204+
"x-ms-examples": {
205+
"Get schema by ID": {
206+
"$ref": "./examples/OperationSchema_GetByVersion.json"
207+
}
208+
},
209+
"operationId": "Schema_GetSchemaVersion",
210+
"produces": [
211+
"application/json"
212+
],
213+
"parameters": [
214+
{
215+
"name": "groupName",
216+
"in": "path",
217+
"description": "Schema group under which schema is registered. Group's serialization type should match the serialization type specified in the request.",
218+
"required": true,
219+
"type": "string"
220+
},
221+
{
222+
"$ref": "#/parameters/SchemaName"
223+
},
224+
{
225+
"$ref": "#/parameters/SchemaVersion"
226+
},
227+
{
228+
"$ref": "#/parameters/ApiVersionParameter"
229+
}
230+
],
231+
"responses": {
232+
"200": {
233+
"description": "OK",
234+
"headers": {
235+
"Location": {
236+
"type": "string",
237+
"description": "URL location of schema, identified by schema group, schema name, and version."
238+
},
239+
"Content-Type": {
240+
"description": "The content type for given schema. Each schema type has an associated content-type.",
241+
"type": "string"
242+
},
243+
"Schema-Id": {
244+
"type": "string",
245+
"description": "References specific schema in registry namespace."
246+
},
247+
"Schema-Id-Location": {
248+
"type": "string",
249+
"description": "URL location of schema, identified by schema ID."
250+
},
251+
"Schema-Group-Name": {
252+
"type": "string",
253+
"description": "References schema group."
254+
},
255+
"Schema-Name": {
256+
"type": "string",
257+
"description": "References schema name."
258+
},
259+
"Schema-Version": {
260+
"type": "integer",
261+
"format": "int32",
262+
"description": "Version of the returned schema."
263+
}
264+
},
265+
"schema": {
266+
"description": "Binary representation of the registered schema.",
267+
"type": "file"
268+
}
269+
},
270+
"default": {
271+
"description": "An error response received from the Azure Schema Registry service.",
272+
"headers": {
273+
"x-ms-error-code": {
274+
"type": "string",
275+
"description": "Error code for specific error that occurred."
276+
}
277+
},
278+
"schema": {
279+
"$ref": "#/definitions/Error"
280+
}
281+
}
282+
}
283+
}
284+
},
200285
"/$schemaGroups/{groupName}/schemas/{schemaName}:get-id": {
201286
"post": {
202287
"summary": "Get ID for existing schema.",
@@ -504,6 +589,15 @@
504589
"maxLength": 50,
505590
"pattern": "^[A-Za-z0-9][^\\\\/$:]*$",
506591
"x-ms-parameter-location": "method"
592+
},
593+
"SchemaVersion": {
594+
"name": "schemaVersion",
595+
"in": "path",
596+
"description": "Version number of specific schema.",
597+
"required": true,
598+
"type": "integer",
599+
"format": "int32",
600+
"x-ms-parameter-location": "method"
507601
}
508602
}
509603
}

0 commit comments

Comments
 (0)