Skip to content

Commit 71b42a1

Browse files
authored
[SchemaRegistry] swagger updates + run black (Azure#21631)
* regen josh's swagger updates + run black * rerecord * changelog
1 parent ea55ac6 commit 71b42a1

20 files changed

+118
-158
lines changed

sdk/schemaregistry/azure-schemaregistry/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.0.0 (Unreleased)
3+
## 1.0.0 (2021-11-09)
44

55
**Note:** This is the first stable release of our efforts to create a user-friendly and Pythonic client library for Azure Schema Registry.
66

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_common/_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class SchemaFormat(str, Enum):
3434
AVRO = "avro"
3535
"""Represents the Apache Avro schema format."""
3636

37+
3738
class ApiVersion(str, Enum):
3839
"""
3940
Represents the Schema Registry API version to use for requests.

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_common/_response_handlers.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,21 @@
2727

2828

2929
def _parse_schema_properties_dict(response):
30-
return {
31-
'id': response.headers.get('schema-id')
32-
}
30+
return {"id": response.headers.get("schema-id")}
3331

3432

3533
def _parse_response_schema_properties(response, format):
3634
# pylint:disable=redefined-builtin
3735
properties_dict = _parse_schema_properties_dict(response)
38-
properties_dict['format'] = format
39-
return SchemaProperties(
40-
**properties_dict
41-
)
36+
properties_dict["format"] = format
37+
return SchemaProperties(**properties_dict)
4238

4339

4440
def _parse_response_schema(response):
4541
# pylint:disable=redefined-builtin
4642
schema_props_dict = _parse_schema_properties_dict(response)
47-
format = response.headers.get('content-type').split('serialization=')[1]
48-
schema_props_dict['format'] = format
43+
format = response.headers.get("content-type").split("serialization=")[1]
44+
schema_props_dict["format"] = format
4945
return Schema(
50-
definition=response.text(),
51-
properties=SchemaProperties(**schema_props_dict)
46+
definition=response.text(), properties=SchemaProperties(**schema_props_dict)
5247
)

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_common/_schema.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ def __init__(self, **kwargs):
4242
self.format = kwargs.pop("format")
4343

4444
def __repr__(self):
45-
return "SchemaProperties(id={}, format={})".format(
46-
self.id, self.format
47-
)[:1024]
45+
return "SchemaProperties(id={}, format={})".format(self.id, self.format)[:1024]
4846

4947

5048
class Schema(object):

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_generated/rest/schema/_request_builders.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
if TYPE_CHECKING:
1616
# pylint: disable=unused-import,ungrouped-imports
17-
from typing import Any, Optional, TypeVar
17+
from typing import Any, IO, Optional, TypeVar
1818
T = TypeVar('T')
1919
JSONType = Any
2020

@@ -49,7 +49,7 @@ def build_get_by_id_request(
4949

5050
api_version = kwargs.pop('api_version', "2021-10") # type: str
5151

52-
accept = "application/json; serialization=avro"
52+
accept = "application/json; serialization=Avro"
5353
# Construct URL
5454
url = kwargs.pop("template_url", '/$schemaGroups/$schemas/{id}')
5555
path_format_arguments = {
@@ -163,22 +163,13 @@ def build_query_id_by_content_request(
163163
:keyword api_version: Api Version. The default value is "2021-10". Note that overriding this
164164
default value may result in unsupported behavior.
165165
:paramtype api_version: str
166-
:keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in
167-
our example to find the input shape. String representation (UTF-8) of the registered schema.
168-
:paramtype json: JSONType
169166
:keyword content: Pass in binary content you want in the body of the request (typically bytes,
170167
a byte iterator, or stream input). String representation (UTF-8) of the registered schema.
171168
:paramtype content: any
172169
:return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's
173170
`send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to
174171
incorporate this response into your code flow.
175172
:rtype: ~azure.core.rest.HttpRequest
176-
177-
Example:
178-
.. code-block:: python
179-
180-
# JSON input template you can fill out and use as your body input.
181-
json = "str" # Optional.
182173
"""
183174

184175
api_version = kwargs.pop('api_version', "2021-10") # type: str
@@ -236,10 +227,6 @@ def build_register_request(
236227
:keyword api_version: Api Version. The default value is "2021-10". Note that overriding this
237228
default value may result in unsupported behavior.
238229
:paramtype api_version: str
239-
:keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in
240-
our example to find the input shape. String representation (UTF-8) of the schema being
241-
registered.
242-
:paramtype json: JSONType
243230
:keyword content: Pass in binary content you want in the body of the request (typically bytes,
244231
a byte iterator, or stream input). String representation (UTF-8) of the schema being
245232
registered.
@@ -248,12 +235,6 @@ def build_register_request(
248235
`send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to
249236
incorporate this response into your code flow.
250237
:rtype: ~azure.core.rest.HttpRequest
251-
252-
Example:
253-
.. code-block:: python
254-
255-
# JSON input template you can fill out and use as your body input.
256-
json = "str" # Optional.
257238
"""
258239

259240
api_version = kwargs.pop('api_version', "2021-10") # type: str

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_generated/rest/schema/_request_builders_py3.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8-
from typing import Any, Optional, TypeVar
8+
from typing import Any, IO, Optional, TypeVar
99

1010
from azure.core.rest import HttpRequest
1111
from msrest import Serializer
@@ -43,7 +43,7 @@ def build_get_by_id_request(
4343

4444
api_version = kwargs.pop('api_version', "2021-10") # type: str
4545

46-
accept = "application/json; serialization=avro"
46+
accept = "application/json; serialization=Avro"
4747
# Construct URL
4848
url = kwargs.pop("template_url", '/$schemaGroups/$schemas/{id}')
4949
path_format_arguments = {
@@ -138,8 +138,7 @@ def build_query_id_by_content_request(
138138
group_name: str,
139139
schema_name: str,
140140
*,
141-
json: JSONType = None,
142-
content: Any = None,
141+
content: Any,
143142
**kwargs: Any
144143
) -> HttpRequest:
145144
"""Get ID for existing schema.
@@ -158,22 +157,13 @@ def build_query_id_by_content_request(
158157
:keyword api_version: Api Version. The default value is "2021-10". Note that overriding this
159158
default value may result in unsupported behavior.
160159
:paramtype api_version: str
161-
:keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in
162-
our example to find the input shape. String representation (UTF-8) of the registered schema.
163-
:paramtype json: JSONType
164160
:keyword content: Pass in binary content you want in the body of the request (typically bytes,
165161
a byte iterator, or stream input). String representation (UTF-8) of the registered schema.
166162
:paramtype content: any
167163
:return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's
168164
`send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to
169165
incorporate this response into your code flow.
170166
:rtype: ~azure.core.rest.HttpRequest
171-
172-
Example:
173-
.. code-block:: python
174-
175-
# JSON input template you can fill out and use as your body input.
176-
json = "str" # Optional.
177167
"""
178168

179169
api_version = kwargs.pop('api_version', "2021-10") # type: str
@@ -204,7 +194,6 @@ def build_query_id_by_content_request(
204194
url=url,
205195
params=query_parameters,
206196
headers=header_parameters,
207-
json=json,
208197
content=content,
209198
**kwargs
210199
)
@@ -214,8 +203,7 @@ def build_register_request(
214203
group_name: str,
215204
schema_name: str,
216205
*,
217-
json: JSONType = None,
218-
content: Any = None,
206+
content: Any,
219207
**kwargs: Any
220208
) -> HttpRequest:
221209
"""Register new schema.
@@ -235,10 +223,6 @@ def build_register_request(
235223
:keyword api_version: Api Version. The default value is "2021-10". Note that overriding this
236224
default value may result in unsupported behavior.
237225
:paramtype api_version: str
238-
:keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in
239-
our example to find the input shape. String representation (UTF-8) of the schema being
240-
registered.
241-
:paramtype json: JSONType
242226
:keyword content: Pass in binary content you want in the body of the request (typically bytes,
243227
a byte iterator, or stream input). String representation (UTF-8) of the schema being
244228
registered.
@@ -247,12 +231,6 @@ def build_register_request(
247231
`send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to
248232
incorporate this response into your code flow.
249233
:rtype: ~azure.core.rest.HttpRequest
250-
251-
Example:
252-
.. code-block:: python
253-
254-
# JSON input template you can fill out and use as your body input.
255-
json = "str" # Optional.
256234
"""
257235

258236
api_version = kwargs.pop('api_version', "2021-10") # type: str
@@ -283,7 +261,6 @@ def build_register_request(
283261
url=url,
284262
params=query_parameters,
285263
headers=header_parameters,
286-
json=json,
287264
content=content,
288265
**kwargs
289266
)

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_generated/rest/schema_groups/_request_builders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
if TYPE_CHECKING:
1616
# pylint: disable=unused-import,ungrouped-imports
17-
from typing import Any, Optional, TypeVar
17+
from typing import Any, IO, Optional, TypeVar
1818
T = TypeVar('T')
1919
JSONType = Any
2020

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_generated/rest/schema_groups/_request_builders_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8-
from typing import Any, Optional, TypeVar
8+
from typing import Any, IO, Optional, TypeVar
99

1010
from azure.core.rest import HttpRequest
1111
from msrest import Serializer

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_schema_registry_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ def register_schema(
132132
group_name=group_name,
133133
schema_name=schema_name,
134134
content=schema_definition,
135-
content_type=kwargs.pop("content_type", "application/json; serialization={}".format(format)),
135+
content_type=kwargs.pop(
136+
"content_type", "application/json; serialization={}".format(format)
137+
),
136138
**http_request_kwargs
137139
)
138140

@@ -210,7 +212,9 @@ def get_schema_properties(
210212
group_name=group_name,
211213
schema_name=schema_name,
212214
content=schema_definition,
213-
content_type=kwargs.pop("content_type", "application/json; serialization={}".format(format)),
215+
content_type=kwargs.pop(
216+
"content_type", "application/json; serialization={}".format(format)
217+
),
214218
**http_request_kwargs
215219
)
216220

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6+
67
def get_http_request_kwargs(kwargs):
78
http_request_keywords = ["params", "headers", "json", "data", "files"]
8-
http_request_kwargs = {key: kwargs.pop(key, None) for key in http_request_keywords if key in kwargs}
9+
http_request_kwargs = {
10+
key: kwargs.pop(key, None) for key in http_request_keywords if key in kwargs
11+
}
912
return http_request_kwargs

0 commit comments

Comments
 (0)