@autorest/python 5.12.5 → 5.14.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/ChangeLog.md +185 -118
- package/autorest/black/__init__.py +3 -0
- package/autorest/codegen/__init__.py +34 -2
- package/autorest/codegen/models/__init__.py +2 -1
- package/autorest/codegen/models/client.py +6 -5
- package/autorest/codegen/models/code_model.py +3 -0
- package/autorest/codegen/models/constant_schema.py +0 -4
- package/autorest/codegen/models/lro_operation.py +6 -2
- package/autorest/codegen/models/operation.py +20 -11
- package/autorest/codegen/models/operation_group.py +0 -9
- package/autorest/codegen/models/paging_operation.py +3 -3
- package/autorest/codegen/models/parameter.py +35 -9
- package/autorest/codegen/models/parameter_list.py +11 -4
- package/autorest/codegen/models/request_builder.py +3 -2
- package/autorest/codegen/models/request_builder_parameter.py +5 -0
- package/autorest/codegen/models/request_builder_parameter_list.py +1 -0
- package/autorest/codegen/serializers/__init__.py +147 -74
- package/autorest/codegen/serializers/builder_serializer.py +68 -37
- package/autorest/codegen/serializers/client_serializer.py +14 -3
- package/autorest/codegen/serializers/general_serializer.py +4 -1
- package/autorest/codegen/serializers/utils.py +5 -1
- package/autorest/codegen/templates/CHANGELOG.md.jinja2 +6 -0
- package/autorest/codegen/templates/LICENSE.jinja2 +21 -0
- package/autorest/codegen/templates/MANIFEST.in.jinja2 +7 -0
- package/autorest/codegen/templates/README.md.jinja2 +105 -0
- package/autorest/codegen/templates/config.py.jinja2 +2 -7
- package/autorest/codegen/templates/dev_requirements.txt.jinja2 +10 -0
- package/autorest/codegen/templates/lro_operation.py.jinja2 +3 -1
- package/autorest/codegen/templates/lro_paging_operation.py.jinja2 +2 -0
- package/autorest/codegen/templates/operation.py.jinja2 +6 -2
- package/autorest/codegen/templates/operation_group.py.jinja2 +15 -18
- package/autorest/codegen/templates/operation_groups_container.py.jinja2 +1 -0
- package/autorest/codegen/templates/operation_tools.jinja2 +3 -2
- package/autorest/codegen/templates/paging_operation.py.jinja2 +2 -2
- package/autorest/codegen/templates/request_builder.py.jinja2 +2 -7
- package/autorest/codegen/templates/service_client.py.jinja2 +1 -1
- package/autorest/codegen/templates/setup.py.jinja2 +79 -20
- package/autorest/namer/name_converter.py +1 -1
- package/package.json +2 -2
- package/run-python3.js +1 -7
- package/venvtools.py +2 -2
package/ChangeLog.md
CHANGED
|
@@ -1,58 +1,121 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
### 2022-03-08 - 5.14.0
|
|
4
|
+
|
|
5
|
+
| Library | Min Version |
|
|
6
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
7
|
+
| `@autorest/core` | `3.6.2` |
|
|
8
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
9
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
10
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
11
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
12
|
+
|
|
13
|
+
**New Features**
|
|
14
|
+
|
|
15
|
+
- Add flag `--package-mode=mgmtplane|dataplane|<custom package template folder>` to generate necessary files for package #1154
|
|
16
|
+
|
|
17
|
+
**Bug Fixes**
|
|
18
|
+
|
|
19
|
+
- Improve operation group documentation to prevent users from initializing operation groups themselves #1179
|
|
20
|
+
|
|
21
|
+
### 2022-03-03 - 5.13.0
|
|
22
|
+
|
|
23
|
+
| Library | Min Version |
|
|
24
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
25
|
+
| `@autorest/core` | `3.6.2` |
|
|
26
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
27
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
28
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
29
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
30
|
+
|
|
31
|
+
**Breaking Changes in Version Tolerant Generation**
|
|
32
|
+
|
|
33
|
+
- We now generate with optional constant parameters as None by defaulting `--default-optional-constants-to-none` to True #1171
|
|
34
|
+
- Version tolerant paging does not reformat initial query parameters into the next link #1168
|
|
35
|
+
|
|
36
|
+
**New Features**
|
|
37
|
+
|
|
38
|
+
- Add flag `--default-optional-constants-to-none` with which optional constant parameters is default to None #1171
|
|
39
|
+
- Add flag `--reformat-next-link`, determines whether we reformat initial query parameters into the next link. Defaults to `True` for the GA generator, forced to `False` for `--version-tolerant`.
|
|
40
|
+
|
|
41
|
+
**Bug Fixes**
|
|
42
|
+
|
|
43
|
+
- Add default value consistently for parameters #1164
|
|
44
|
+
- Make `content_type` param keyword-only if there are multiple content types #1167
|
|
45
|
+
|
|
46
|
+
**Other Changes**
|
|
47
|
+
|
|
48
|
+
- Drop testing support for 2.7 packages #1175
|
|
49
|
+
|
|
50
|
+
### 2022-02-09 - 5.12.6
|
|
51
|
+
|
|
52
|
+
| Library | Min Version |
|
|
53
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
54
|
+
| `@autorest/core` | `3.6.2` |
|
|
55
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
56
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
57
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
58
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
59
|
+
|
|
60
|
+
**Bug Fixes**
|
|
61
|
+
|
|
62
|
+
- Remove unused `metadata` value for paging and long running operations with `version-tolerant` generations #1131
|
|
63
|
+
- Remove name conflicts with parameters called `url`, `header_parameters`, and `query_parameters` #1143
|
|
64
|
+
- Make `--version-tolerant` generated code pylint compatible in the `azure-sdk-for-python` repo when generated with the `--black` flag #1147, #1144, #1130
|
|
65
|
+
|
|
3
66
|
### 2022-01-26 - 5.12.5
|
|
4
67
|
|
|
5
|
-
| Library
|
|
6
|
-
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
68
|
+
| Library | Min Version |
|
|
69
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
70
|
+
| `@autorest/core` | `3.6.2` |
|
|
71
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
72
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
73
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
74
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
12
75
|
|
|
13
76
|
**Bug Fixes**
|
|
14
77
|
|
|
15
|
-
- Fix usage of `--black` flag outside of repo
|
|
16
|
-
- Remove unused `metadata` value for `version-tolerant` generations
|
|
78
|
+
- Fix usage of `--black` flag outside of repo #1126
|
|
79
|
+
- Remove unused `metadata` value for `version-tolerant` generations #1127
|
|
17
80
|
|
|
18
81
|
### 2022-01-14 - 5.12.4
|
|
19
82
|
|
|
20
|
-
| Library
|
|
21
|
-
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
83
|
+
| Library | Min Version |
|
|
84
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
85
|
+
| `@autorest/core` | `3.6.2` |
|
|
86
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
87
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
88
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
89
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
27
90
|
|
|
28
91
|
**Bug Fixes**
|
|
29
92
|
|
|
30
|
-
- Remove duplicate generation of properties in classes that inherit from multiple classes
|
|
93
|
+
- Remove duplicate generation of properties in classes that inherit from multiple classes #1120
|
|
31
94
|
|
|
32
95
|
### 2022-01-13 - 5.12.3
|
|
33
96
|
|
|
34
|
-
| Library
|
|
35
|
-
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
97
|
+
| Library | Min Version |
|
|
98
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
99
|
+
| `@autorest/core` | `3.6.2` |
|
|
100
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
101
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
102
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
103
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
41
104
|
|
|
42
105
|
**Bug Fixes**
|
|
43
106
|
|
|
44
|
-
- Unify multiapi constant behavior with single API version
|
|
45
|
-
- Clean up docstrings by removing descriptions for client constants on methods and request builders
|
|
107
|
+
- Unify multiapi constant behavior with single API version #1119
|
|
108
|
+
- Clean up docstrings by removing descriptions for client constants on methods and request builders #1119
|
|
46
109
|
|
|
47
110
|
### 2022-01-11 - 5.12.2
|
|
48
111
|
|
|
49
|
-
| Library
|
|
50
|
-
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
112
|
+
| Library | Min Version |
|
|
113
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
114
|
+
| `@autorest/core` | `3.6.2` |
|
|
115
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
116
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
117
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
118
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
56
119
|
|
|
57
120
|
**Bug Fixes**
|
|
58
121
|
|
|
@@ -60,81 +123,81 @@
|
|
|
60
123
|
|
|
61
124
|
### 2022-01-10 - 5.12.1
|
|
62
125
|
|
|
63
|
-
| Library
|
|
64
|
-
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
126
|
+
| Library | Min Version |
|
|
127
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
128
|
+
| `@autorest/core` | `3.6.2` |
|
|
129
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
130
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
131
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
132
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
70
133
|
|
|
71
134
|
**Bug Fixes**
|
|
72
135
|
|
|
73
|
-
- Fix support for json merge patch
|
|
136
|
+
- Fix support for json merge patch #1117
|
|
74
137
|
|
|
75
138
|
### 2021-12-06 - 5.12.0
|
|
76
139
|
|
|
77
|
-
| Library
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
140
|
+
| Library | Min Version |
|
|
141
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
142
|
+
| `@autorest/core` | `3.6.2` |
|
|
143
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
144
|
+
| `azure-core` dep of generated code | `1.20.1` |
|
|
145
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
146
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
84
147
|
|
|
85
148
|
**Breaking Changes in Version Tolerant Generation**
|
|
86
149
|
|
|
87
150
|
- Remove metadata property for version tolerant and low level client generations #1090
|
|
88
|
-
- Generate SDKs with `--python3-only` defaulting to `True` for version tolerant and low level client
|
|
151
|
+
- Generate SDKs with `--python3-only` defaulting to `True` for version tolerant and low level client #1087
|
|
89
152
|
|
|
90
153
|
**New Features**
|
|
91
154
|
|
|
92
|
-
- Generate a `_patch.py` file if one does not exist. These files are used to customize the generated code
|
|
155
|
+
- Generate a `_patch.py` file if one does not exist. These files are used to customize the generated code #1092
|
|
93
156
|
|
|
94
157
|
**Bug Fixes**
|
|
95
158
|
|
|
96
159
|
- Can now handle body params with names `json`, `content`, `data`, and `files` #1081
|
|
97
|
-
- Improve generated templates for `data` and `files` input body params by adding quotes around the keys
|
|
98
|
-
- Using flag `--python3-only` will get you typed sync client and config files
|
|
99
|
-
- Pin `mistune` dependency to less than `2.x.x` so autorest can be successfully installed
|
|
160
|
+
- Improve generated templates for `data` and `files` input body params by adding quotes around the keys #1082
|
|
161
|
+
- Using flag `--python3-only` will get you typed sync client and config files #1085
|
|
162
|
+
- Pin `mistune` dependency to less than `2.x.x` so autorest can be successfully installed #1106
|
|
100
163
|
|
|
101
164
|
### 2021-11-05 - 5.11.2
|
|
102
165
|
|
|
103
|
-
| Library
|
|
104
|
-
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
166
|
+
| Library | Min Version |
|
|
167
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
168
|
+
| `@autorest/core` | `3.6.2` |
|
|
169
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
170
|
+
| `azure-core` dep of generated code | `1.20.0` |
|
|
171
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
172
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
110
173
|
|
|
111
174
|
**Bug Fixes**
|
|
112
175
|
|
|
113
|
-
- Respect no client side validation for low level client generations
|
|
176
|
+
- Respect no client side validation for low level client generations #1080
|
|
114
177
|
|
|
115
178
|
### 2021-11-05 - 5.11.1
|
|
116
179
|
|
|
117
|
-
| Library
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
180
|
+
| Library | Min Version |
|
|
181
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
182
|
+
| `@autorest/core` | `3.6.2` |
|
|
183
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
184
|
+
| `azure-core` dep of generated code | `1.20.0` |
|
|
185
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
186
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
124
187
|
|
|
125
188
|
**Bug Fixes**
|
|
126
189
|
|
|
127
|
-
- Hide mixin operations for version tolerant generation
|
|
190
|
+
- Hide mixin operations for version tolerant generation #1071
|
|
128
191
|
|
|
129
192
|
### 2021-11-04 - 5.11.0
|
|
130
193
|
|
|
131
|
-
| Library
|
|
132
|
-
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
194
|
+
| Library | Min Version |
|
|
195
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
196
|
+
| `@autorest/core` | `3.6.2` |
|
|
197
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
198
|
+
| `azure-core` dep of generated code | `1.20.0` |
|
|
199
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
200
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
138
201
|
|
|
139
202
|
**New Features**
|
|
140
203
|
|
|
@@ -148,68 +211,69 @@
|
|
|
148
211
|
|
|
149
212
|
### 2021-11-01 - 5.10.0
|
|
150
213
|
|
|
151
|
-
| Library
|
|
152
|
-
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
214
|
+
| Library | Min Version |
|
|
215
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
216
|
+
| `@autorest/core` | `3.6.2` |
|
|
217
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
218
|
+
| `azure-core` dep of generated code | `1.19.1` |
|
|
219
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
220
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
158
221
|
|
|
159
222
|
**New Features**
|
|
160
223
|
|
|
161
|
-
- Allow users to override constant swagger params with kwarg input
|
|
224
|
+
- Allow users to override constant swagger params with kwarg input #1060
|
|
162
225
|
|
|
163
226
|
### 2021-10-15 - 5.9.3
|
|
164
227
|
|
|
165
|
-
| Library
|
|
166
|
-
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
228
|
+
| Library | Min Version |
|
|
229
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
230
|
+
| `@autorest/core` | `3.6.2` |
|
|
231
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
232
|
+
| `azure-core` dep of generated code | `1.19.0` |
|
|
233
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
234
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
172
235
|
|
|
173
236
|
**Bug Fixes**
|
|
174
237
|
|
|
175
|
-
- Fix generation of form-data inputs
|
|
238
|
+
- Fix generation of form-data inputs #1061
|
|
176
239
|
|
|
177
240
|
### 2021-10-05 - 5.9.2
|
|
178
241
|
|
|
179
|
-
| Library
|
|
180
|
-
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
242
|
+
| Library | Min Version |
|
|
243
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
244
|
+
| `@autorest/core` | `3.6.2` |
|
|
245
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
246
|
+
| `azure-core` dep of generated code | `1.19.0` |
|
|
247
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
248
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
186
249
|
|
|
187
250
|
**New Features**
|
|
251
|
+
|
|
188
252
|
- Updating generated code for `azure-core` release `1.19.0`.
|
|
189
253
|
|
|
190
254
|
### 2021-09-27 - 5.9.1
|
|
191
255
|
|
|
192
|
-
| Library
|
|
193
|
-
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
256
|
+
| Library | Min Version |
|
|
257
|
+
| ----------------------------------------------------------------------- | ----------- |
|
|
258
|
+
| `@autorest/core` | `3.6.2` |
|
|
259
|
+
| `@autorest/modelerfour` | `4.19.1` |
|
|
260
|
+
| `azure-core` dep of generated code | `1.18.0` |
|
|
261
|
+
| `msrest` dep of generated code | `0.6.21` |
|
|
262
|
+
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |
|
|
199
263
|
|
|
200
264
|
**New Features**
|
|
201
265
|
|
|
202
266
|
- We have added a **provisional** `rest` layer to our generated code. We have also added the following **provisional** flags listed [here](https://github.com/Azure/autorest.python/wiki/Generating-Low-Level-Client#generate-a-low-level-client). #875
|
|
203
|
-
- With this new release, we are also dropping support for Python 3.5 + async.
|
|
267
|
+
- With this new release, we are also dropping support for Python 3.5 + async. #875
|
|
204
268
|
- For mgmt plan SDK, default policy changes from `BearerTokenCredentialPolicy` to `ARMChallengeAuthenticationPolicy`.
|
|
205
269
|
- We now add tracing by default, the flag `--trace` now defaults to `True` if you have operations.
|
|
206
|
-
- Added flag `--python3-only` for users looking to generate SDKs that only support Python 3
|
|
270
|
+
- Added flag `--python3-only` for users looking to generate SDKs that only support Python 3 #1044
|
|
207
271
|
|
|
208
272
|
**Bug Fixes**
|
|
209
273
|
|
|
210
|
-
- Correctly pad operation groups with reserved names with `Operations`
|
|
211
|
-
- Fix the generated docstrings for input kwargs of models
|
|
212
|
-
- Pass pipeline context to `msrest` in `failsafe_deserialize` so `msrest` has access to the context
|
|
274
|
+
- Correctly pad operation groups with reserved names with `Operations` #1005
|
|
275
|
+
- Fix the generated docstrings for input kwargs of models #1026
|
|
276
|
+
- Pass pipeline context to `msrest` in `failsafe_deserialize` so `msrest` has access to the context #1030
|
|
213
277
|
|
|
214
278
|
### 2021-09-27 - 5.9.0
|
|
215
279
|
|
|
@@ -244,7 +308,7 @@ min Modelerfour version: 4.19.1
|
|
|
244
308
|
|
|
245
309
|
**Bug Fixes**
|
|
246
310
|
|
|
247
|
-
- We are now more lenient with our checks for the content type parameter
|
|
311
|
+
- We are now more lenient with our checks for the content type parameter #956
|
|
248
312
|
|
|
249
313
|
### 2021-06-16 - 5.8.1
|
|
250
314
|
|
|
@@ -255,7 +319,7 @@ min Modelerfour version: 4.19.1
|
|
|
255
319
|
**Bug Fixes**
|
|
256
320
|
|
|
257
321
|
- Fix optional properties with constant schemas. Now, properties that have constant schemas but are optional will not have the hardcoded constant value,
|
|
258
|
-
but will default to its `x-ms-client-default` or `None`
|
|
322
|
+
but will default to its `x-ms-client-default` or `None` #952
|
|
259
323
|
|
|
260
324
|
### 2021-05-17 - 5.8.0
|
|
261
325
|
|
|
@@ -265,7 +329,7 @@ min Modelerfour version: 4.19.1
|
|
|
265
329
|
|
|
266
330
|
**New Features**
|
|
267
331
|
|
|
268
|
-
- Add support for parameters and properties that can be of type "Anything".
|
|
332
|
+
- Add support for parameters and properties that can be of type "Anything". #946
|
|
269
333
|
|
|
270
334
|
### 2021-04-20 - 5.7.0
|
|
271
335
|
|
|
@@ -285,7 +349,7 @@ min Modelerfour version: 4.15.456
|
|
|
285
349
|
|
|
286
350
|
**Bug Fixes**
|
|
287
351
|
|
|
288
|
-
- Fix docstrings so they don't get split on hyphens
|
|
352
|
+
- Fix docstrings so they don't get split on hyphens #931
|
|
289
353
|
|
|
290
354
|
### 2021-04-07 - 5.6.5
|
|
291
355
|
|
|
@@ -295,7 +359,7 @@ min Modelerfour version: 4.15.456
|
|
|
295
359
|
|
|
296
360
|
**Bug Fixes**
|
|
297
361
|
|
|
298
|
-
- Fix regression in multiapi generation for multiapi versions without mixin operations
|
|
362
|
+
- Fix regression in multiapi generation for multiapi versions without mixin operations #928
|
|
299
363
|
|
|
300
364
|
### 2021-03-01 - 5.6.4
|
|
301
365
|
|
|
@@ -304,6 +368,7 @@ min Autorest core version: 3.1.0
|
|
|
304
368
|
min Modelerfour version: 4.15.456
|
|
305
369
|
|
|
306
370
|
**Bug Fixes**
|
|
371
|
+
|
|
307
372
|
- Bump `Autorest core` minimum version to be able to deal with indented `python` blocks in config files
|
|
308
373
|
|
|
309
374
|
### 2021-02-10 - 5.6.3
|
|
@@ -313,7 +378,8 @@ min Autorest core version: 3.0.6372
|
|
|
313
378
|
min Modelerfour version: 4.15.456
|
|
314
379
|
|
|
315
380
|
**Bug Fixes**
|
|
316
|
-
|
|
381
|
+
|
|
382
|
+
- Bump `Autorest core` minimum version to [correctly deal with](https://github.com/Azure/autorest/pull/3860) overriding configs. Fixes submodule-specific code in our multiapi client #880
|
|
317
383
|
|
|
318
384
|
### 2021-02-04 - 5.6.2
|
|
319
385
|
|
|
@@ -322,7 +388,8 @@ Autorest core version: 3.0.6318
|
|
|
322
388
|
Modelerfour version: 4.15.456
|
|
323
389
|
|
|
324
390
|
**Bug Fixes**
|
|
325
|
-
|
|
391
|
+
|
|
392
|
+
- Bump `Modelerfour` minimum version to [correctly deal with](https://github.com/Azure/autorest.modelerfour/pull/385) parameters specified as `'required': false` in swagger #877
|
|
326
393
|
|
|
327
394
|
### 2021-01-27 - 5.6.1
|
|
328
395
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import logging
|
|
7
7
|
from pathlib import Path
|
|
8
|
+
import os
|
|
8
9
|
import black
|
|
9
10
|
|
|
10
11
|
from .. import Plugin
|
|
@@ -21,6 +22,8 @@ class BlackScriptPlugin(Plugin):
|
|
|
21
22
|
output_folder_uri = self._autorestapi.get_value("outputFolderUri")
|
|
22
23
|
if output_folder_uri.startswith("file:"):
|
|
23
24
|
output_folder_uri = output_folder_uri[5:]
|
|
25
|
+
if os.name == 'nt' and output_folder_uri.startswith("///"):
|
|
26
|
+
output_folder_uri = output_folder_uri[3:]
|
|
24
27
|
self.output_folder = Path(output_folder_uri)
|
|
25
28
|
|
|
26
29
|
def process(self) -> bool:
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import logging
|
|
7
7
|
import sys
|
|
8
8
|
from typing import Dict, Any, Set, Union, List, Type
|
|
9
|
+
from pathlib import Path
|
|
9
10
|
import yaml
|
|
10
11
|
|
|
11
12
|
from .. import Plugin
|
|
@@ -70,12 +71,27 @@ def _validate_code_model_options(options: Dict[str, Any]) -> None:
|
|
|
70
71
|
if options["basic_setup_py"] and not options["package_version"]:
|
|
71
72
|
raise ValueError("--basic-setup-py must be used with --package-version")
|
|
72
73
|
|
|
74
|
+
if options["package_mode"] and not options["package_version"]:
|
|
75
|
+
raise ValueError("--package-mode must be used with --package-version")
|
|
76
|
+
|
|
73
77
|
if not options["show_operations"] and options["combine_operation_files"]:
|
|
74
78
|
raise ValueError(
|
|
75
79
|
"Can not combine operation files if you are not showing operations. "
|
|
76
80
|
"If you want operation files, pass in flag --show-operations"
|
|
77
81
|
)
|
|
78
82
|
|
|
83
|
+
if options["package_mode"]:
|
|
84
|
+
if options["package_mode"] not in ("mgmtplane", "dataplane") and not Path(options["package_mode"]).exists():
|
|
85
|
+
raise ValueError(
|
|
86
|
+
"--package-mode can only be 'mgmtplane' or 'dataplane' or directory which contains template files"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
if options["reformat_next_link"] and options["version_tolerant"]:
|
|
90
|
+
raise ValueError(
|
|
91
|
+
"--reformat-next-link can not be true for version tolerant generations. "
|
|
92
|
+
"Please remove --reformat-next-link from your call for version tolerant generations."
|
|
93
|
+
)
|
|
94
|
+
|
|
79
95
|
_LOGGER = logging.getLogger(__name__)
|
|
80
96
|
class CodeGenerator(Plugin):
|
|
81
97
|
@staticmethod
|
|
@@ -111,6 +127,14 @@ class CodeGenerator(Plugin):
|
|
|
111
127
|
exceptions_set.add(id(exception["schema"]))
|
|
112
128
|
return exceptions_set
|
|
113
129
|
|
|
130
|
+
@staticmethod
|
|
131
|
+
def _build_package_dependency() -> Dict[str, str]:
|
|
132
|
+
return {
|
|
133
|
+
"dependency_azure_mgmt_core": "azure-mgmt-core<2.0.0,>=1.3.0",
|
|
134
|
+
"dependency_azure_core": "azure-core<2.0.0,>=1.20.1",
|
|
135
|
+
"dependency_msrest": "msrest>=0.6.21",
|
|
136
|
+
}
|
|
137
|
+
|
|
114
138
|
def _create_code_model(self, yaml_data: Dict[str, Any], options: Dict[str, Union[str, bool]]) -> CodeModel:
|
|
115
139
|
# Create a code model
|
|
116
140
|
|
|
@@ -155,6 +179,7 @@ class CodeGenerator(Plugin):
|
|
|
155
179
|
if options["credential"]:
|
|
156
180
|
code_model.global_parameters.add_credential_global_parameter()
|
|
157
181
|
|
|
182
|
+
code_model.package_dependency = self._build_package_dependency()
|
|
158
183
|
return code_model
|
|
159
184
|
|
|
160
185
|
def _get_credential_scopes(self, credential):
|
|
@@ -289,6 +314,13 @@ class CodeGenerator(Plugin):
|
|
|
289
314
|
"low_level_client": low_level_client,
|
|
290
315
|
"combine_operation_files": self._autorestapi.get_boolean_value("combine-operation-files", version_tolerant),
|
|
291
316
|
"python3_only": python3_only,
|
|
317
|
+
"package_mode": self._autorestapi.get_value("package-mode"),
|
|
318
|
+
"package_pprint_name": self._autorestapi.get_value("package-pprint-name"),
|
|
319
|
+
"package_configuration": self._autorestapi.get_value("package-configuration"),
|
|
320
|
+
"default_optional_constants_to_none": self._autorestapi.get_boolean_value(
|
|
321
|
+
"default-optional-constants-to-none", low_level_client or version_tolerant
|
|
322
|
+
),
|
|
323
|
+
"reformat_next_link": self._autorestapi.get_boolean_value("reformat-next-link", not version_tolerant)
|
|
292
324
|
}
|
|
293
325
|
|
|
294
326
|
if options["builders_visibility"] is None:
|
|
@@ -327,8 +359,8 @@ class CodeGenerator(Plugin):
|
|
|
327
359
|
|
|
328
360
|
code_model = self._create_code_model(yaml_data=yaml_data, options=options)
|
|
329
361
|
|
|
330
|
-
serializer = JinjaSerializer(self._autorestapi)
|
|
331
|
-
serializer.serialize(
|
|
362
|
+
serializer = JinjaSerializer(self._autorestapi, code_model)
|
|
363
|
+
serializer.serialize()
|
|
332
364
|
|
|
333
365
|
return True
|
|
334
366
|
|
|
@@ -17,7 +17,7 @@ from .constant_schema import ConstantSchema
|
|
|
17
17
|
from .imports import FileImport, ImportType, TypingSection
|
|
18
18
|
from .lro_operation import LROOperation
|
|
19
19
|
from .paging_operation import PagingOperation
|
|
20
|
-
from .parameter import Parameter, ParameterStyle
|
|
20
|
+
from .parameter import Parameter, ParameterStyle, ParameterLocation
|
|
21
21
|
from .operation import Operation
|
|
22
22
|
from .property import Property
|
|
23
23
|
from .operation_group import OperationGroup
|
|
@@ -50,6 +50,7 @@ __all__ = [
|
|
|
50
50
|
"PagingOperation",
|
|
51
51
|
"Parameter",
|
|
52
52
|
"ParameterList",
|
|
53
|
+
"ParameterLocation",
|
|
53
54
|
"OperationGroup",
|
|
54
55
|
"Property",
|
|
55
56
|
"RequestBuilder",
|
|
@@ -33,13 +33,14 @@ class Client:
|
|
|
33
33
|
def _imports_shared(self, async_mode: bool) -> FileImport:
|
|
34
34
|
file_import = FileImport()
|
|
35
35
|
|
|
36
|
-
file_import.add_submodule_import("msrest", "Serializer", ImportType.
|
|
37
|
-
file_import.add_submodule_import("msrest", "Deserializer", ImportType.
|
|
36
|
+
file_import.add_submodule_import("msrest", "Serializer", ImportType.THIRDPARTY)
|
|
37
|
+
file_import.add_submodule_import("msrest", "Deserializer", ImportType.THIRDPARTY)
|
|
38
38
|
file_import.add_submodule_import("typing", "Any", ImportType.STDLIB, TypingSection.CONDITIONAL)
|
|
39
39
|
|
|
40
40
|
any_optional_gp = any(not gp.required for gp in self.parameters)
|
|
41
41
|
|
|
42
|
-
if
|
|
42
|
+
legacy = not any(g for g in ["low_level_client", "version_tolerant"] if g in self.code_model.options)
|
|
43
|
+
if any_optional_gp or (legacy and self.code_model.service_client.parameters.host):
|
|
43
44
|
file_import.add_submodule_import("typing", "Optional", ImportType.STDLIB, TypingSection.CONDITIONAL)
|
|
44
45
|
|
|
45
46
|
if self.code_model.options["azure_arm"]:
|
|
@@ -98,6 +99,6 @@ class Client:
|
|
|
98
99
|
pass
|
|
99
100
|
return file_import
|
|
100
101
|
|
|
101
|
-
def send_request_signature(self,
|
|
102
|
-
request_signature = ["request: HttpRequest," if
|
|
102
|
+
def send_request_signature(self, is_python3_file: bool) -> List[str]:
|
|
103
|
+
request_signature = ["request: HttpRequest," if is_python3_file else "request, # type: HttpRequest"]
|
|
103
104
|
return request_signature + self.parameters.method_signature_kwargs(is_python3_file)
|
|
@@ -51,6 +51,8 @@ class CodeModel: # pylint: disable=too-many-instance-attributes, too-many-publi
|
|
|
51
51
|
:type primitives: Dict[int, ~autorest.models.BaseSchema]
|
|
52
52
|
:param operation_groups: The operation groups we are going to serialize
|
|
53
53
|
:type operation_groups: list[~autorest.models.OperationGroup]
|
|
54
|
+
:param package_dependency: All the dependencies needed in setup.py
|
|
55
|
+
:type package_dependency: Dict[str, str]
|
|
54
56
|
"""
|
|
55
57
|
|
|
56
58
|
def __init__(
|
|
@@ -76,6 +78,7 @@ class CodeModel: # pylint: disable=too-many-instance-attributes, too-many-publi
|
|
|
76
78
|
self._rest: Optional[Rest] = None
|
|
77
79
|
self.request_builder_ids: Dict[int, RequestBuilder] = {}
|
|
78
80
|
self._credential_schema_policy: Optional[CredentialSchemaPolicy] = None
|
|
81
|
+
self.package_dependency: Dict[str, str] = {}
|
|
79
82
|
|
|
80
83
|
@property
|
|
81
84
|
def global_parameters(self) -> GlobalParameterList:
|
|
@@ -39,10 +39,6 @@ class ConstantSchema(BaseSchema):
|
|
|
39
39
|
return "None"
|
|
40
40
|
return self.schema.get_declaration(self.value)
|
|
41
41
|
|
|
42
|
-
@property
|
|
43
|
-
def extra_description_information(self) -> str:
|
|
44
|
-
return f"The default value is {self.get_declaration(self.value)}."
|
|
45
|
-
|
|
46
42
|
@property
|
|
47
43
|
def serialization_type(self) -> str:
|
|
48
44
|
"""Returns the serialization value for msrest.
|
|
@@ -175,6 +175,10 @@ class LROOperation(Operation):
|
|
|
175
175
|
|
|
176
176
|
if async_mode:
|
|
177
177
|
file_import.add_submodule_import("typing", "Optional", ImportType.STDLIB, TypingSection.CONDITIONAL)
|
|
178
|
-
if self.
|
|
179
|
-
file_import.add_submodule_import(
|
|
178
|
+
if self.code_model.options["tracing"] and self.want_tracing:
|
|
179
|
+
file_import.add_submodule_import(
|
|
180
|
+
f"azure.core.tracing.decorator{'_async' if async_mode else ''}",
|
|
181
|
+
f"distributed_trace{'_async' if async_mode else ''}",
|
|
182
|
+
ImportType.AZURECORE,
|
|
183
|
+
)
|
|
180
184
|
return file_import
|