1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
# Text Analytics for Python
To generate this file, simply type
```
autorest --use=@autorest/python@5.19.0 swagger/README.md --python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>
```
> Note that we pin autorest version 5.19.0 because this is the latest version to support multiapi generation.
We automatically hardcode in that this is `python` and `multiapi`.
## Basic
```yaml
license-header: MICROSOFT_MIT_NO_VERSION
add-credential: true
payload-flattening-threshold: 2
package-name: azure-ai-textanalytics
clear-output-folder: true
credential-scopes: https://cognitiveservices.azure.com/.default
no-namespace-folders: true
python: true
multiapi: true
python3-only: true
```
## Multiapi Batch Execution
```yaml $(multiapi)
batch:
- tag: release_3_0
- tag: release_3_1
- tag: release_2022_05_01
- tag: release_2023_04_01
- multiapiscript: true
```
## Multiapiscript
```yaml $(multiapiscript)
output-folder: $(python-sdks-folder)/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/
default-api: v3.1
clear-output-folder: true
perform-load: false
```
## Release 3.0
These settings apply only when `--tag=release_3_0` is specified on the command line.
```yaml $(tag) == 'release_3_0'
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/0de25e2a040e1257b3a90faea868ad93c3435e48/specification/cognitiveservices/data-plane/TextAnalytics/stable/v3.0/TextAnalytics.json
namespace: azure.ai.textanalytics.v3_0
output-folder: $(python-sdks-folder)/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_0
```
## Release 3.1
These settings apply only when `--tag=release_3_1` is specified on the command line.
```yaml $(tag) == 'release_3_1'
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1646226d874de6e8d36ebd3ad088c6c5f6cc6ed0/specification/cognitiveservices/data-plane/TextAnalytics/stable/v3.1/TextAnalytics.json
namespace: azure.ai.textanalytics.v3_1
output-folder: $(python-sdks-folder)/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_1
```
## Release v2022_05_01
These settings apply only when `--tag=release_2022_05_01` is specified on the command line.
```yaml $(tag) == 'release_2022_05_01'
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/1646226d874de6e8d36ebd3ad088c6c5f6cc6ed0/specification/cognitiveservices/data-plane/Language/stable/2022-05-01/analyzetext.json
namespace: azure.ai.textanalytics.v2022_05_01
output-folder: $(python-sdks-folder)/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v2022_05_01
```
## Release v2023_04_01
These settings apply only when `--tag=release_2023_04_01` is specified on the command line.
```yaml $(tag) == 'release_2023_04_01'
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/53240ebc58b3c4e99de723194032064db1d97e63/specification/cognitiveservices/data-plane/Language/stable/2023-04-01/analyzetext.json
namespace: azure.ai.textanalytics.v2023_04_01
output-folder: $(python-sdks-folder)/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v2023_04_01
```
### Override Analyze's pager poller for v3.1
```yaml
directive:
- from: swagger-document
where: '$.paths["/analyze"].post'
transform: >
$["responses"]["200"] = {"description": "dummy schema", "schema": {"$ref": "#/definitions/AnalyzeJobState"}};
$["x-python-custom-poller-sync"] = "...._lro.AnalyzeActionsLROPoller";
$["x-python-custom-poller-async"] = ".....aio._lro_async.AsyncAnalyzeActionsLROPoller";
$["x-python-custom-default-polling-method-sync"] = "...._lro.AnalyzeActionsLROPollingMethod";
$["x-python-custom-default-polling-method-async"] = ".....aio._lro_async.AsyncAnalyzeActionsLROPollingMethod";
```
### Override Healthcare's poller for v3.1
```yaml
directive:
- from: swagger-document
where: '$.paths["/entities/health/jobs"].post'
transform: >
$["responses"]["200"] = {"description": "dummy schema", "schema": {"$ref": "#/definitions/HealthcareJobState"}};
$["x-python-custom-poller-sync"] = "...._lro.AnalyzeHealthcareEntitiesLROPoller";
$["x-python-custom-poller-async"] = ".....aio._lro_async.AsyncAnalyzeHealthcareEntitiesLROPoller";
$["x-python-custom-default-polling-method-sync"] = "...._lro.AnalyzeHealthcareEntitiesLROPollingMethod";
$["x-python-custom-default-polling-method-async"] = ".....aio._lro_async.AsyncAnalyzeHealthcareEntitiesLROPollingMethod";
```
### Override Analyze's pager poller for 2022_05_01 and 2023_04_01
```yaml
directive:
- from: swagger-document
where: '$.paths["/analyze-text/jobs"].post'
transform: >
$["responses"]["200"] = {"description": "dummy schema", "schema": {"$ref": "#/definitions/AnalyzeTextJobState"}};
$["x-python-custom-poller-sync"] = "...._lro.AnalyzeActionsLROPoller";
$["x-python-custom-poller-async"] = ".....aio._lro_async.AsyncAnalyzeActionsLROPoller";
$["x-python-custom-default-polling-method-sync"] = "...._lro.AnalyzeActionsLROPollingMethod";
$["x-python-custom-default-polling-method-async"] = ".....aio._lro_async.AsyncAnalyzeActionsLROPollingMethod";
```
### Override parameterizing the ApiVersion v3.1
```yaml $(tag) == 'release_3_1'
directive:
- from: swagger-document
where: '$["x-ms-parameterized-host"]'
transform: >
$["hostTemplate"] = "{Endpoint}/text/analytics/v3.1";
$["parameters"] = [{"$ref": "#/parameters/Endpoint"}];
```
### Fix naming clash with analyze_text method
```yaml
directive:
- from: swagger-document
where: '$["paths"]["/analyze-text/jobs"]["post"]'
transform: >
$["operationId"] = "AnalyzeTextSubmitJob";
```
### Fix naming clash with analyze_text method
```yaml
directive:
- from: swagger-document
where: '$["paths"]["/analyze-text/jobs/{jobId}"]["get"]'
transform: >
$["operationId"] = "AnalyzeTextJobStatus";
```
### Fix naming clash with analyze_text method
```yaml
directive:
- from: swagger-document
where: '$["paths"]["/analyze-text/jobs/{jobId}:cancel"]["post"]'
transform: >
$["operationId"] = "AnalyzeTextCancelJob";
```
### Fix generation of operation class name
```yaml
directive:
- from: swagger-document
where: '$["info"]'
transform: >
$["title"] = "Text Analytics Client";
```
### Rename changed JobState property
```yaml
directive:
- from: swagger-document
where: $.definitions.JobState
transform: $.properties.lastUpdatedDateTime["x-ms-client-name"] = "lastUpdateDateTime";
```
### Rename enums so we can expose generated types
```yaml $(tag) != 'release_3_1'
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["HealthcareAssertion"]["properties"]["association"]["x-ms-enum"]["name"] = "entityAssociation";
- from: swagger-document
where: $["definitions"]
transform: >
$["HealthcareAssertion"]["properties"]["certainty"]["x-ms-enum"]["name"] = "entityCertainty";
- from: swagger-document
where: $["definitions"]
transform: >
$["HealthcareAssertion"]["properties"]["conditionality"]["x-ms-enum"]["name"] = "entityConditionality";
- from: swagger-document
where: $["definitions"]
transform: >
$["HealthcareAssertion"]["properties"]["conditionality"]["x-ms-enum"]["name"] = "entityConditionality";
- from: swagger-document
where: $["definitions"]
transform: >
$["HealthcareRelation"]["properties"]["relationType"]["x-ms-enum"]["name"] = "healthcareEntityRelation";
- from: swagger-document
where: $["definitions"]
transform: >
$["PiiCategories"]["items"]["x-ms-enum"]["name"] = "piiEntityCategory";
```
|