Skip to content

Commit

Permalink
Update CognitiveService ComputerVision API to V2 (#3236)
Browse files Browse the repository at this point in the history
* Copy v1 to v2; not other change

* Bump version to v2

* Update arguments for new RecognizeText

* Change versions inside scripts to v2

* Reverse argument order for /recognizeText

* Add post-processing directive to swap argument order for RecognizeText to position the url argument ahead of the mode argument.

autorest does not generate the intended order, so we add a post-processing directive,
for each target language,

* Fix validation errors

* Add Spanish support for ServiceLanguage

This is for parity with V1.
  • Loading branch information
cthrash authored and jhendrixMSFT committed Jun 15, 2018
1 parent 26ca3e6 commit 64b5c7e
Show file tree
Hide file tree
Showing 20 changed files with 2,573 additions and 17 deletions.
42 changes: 31 additions & 11 deletions specification/cognitiveservices/data-plane/ComputerVision/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
Configuration for generating Computer Vision SDK.

The current release is `release_1_0`.
The current release is `release_2_0`.

``` yaml

tag: release_1_0
tag: release_2_0
add-credentials: true
openapi-type: data-plane
```
# Releases
### Release 1.0
These settings apply only when `--tag=release_1_0` is specified on the command line.
### Release 2.0
These settings apply only when `--tag=release_2_0` is specified on the command line.

``` yaml $(tag) == 'release_1_0'
input-file: stable/v1.0/ComputerVision.json
``` yaml $(tag) == 'release_2_0'
input-file: stable/v2.0/ComputerVision.json
```

## Swagger to SDK
Expand Down Expand Up @@ -48,6 +48,13 @@ csharp:
namespace: Microsoft.Azure.CognitiveServices.Vision.ComputerVision
output-folder: $(csharp-sdks-folder)/CognitiveServices/dataPlane/Vision/ComputerVision/ComputerVision/Generated
clear-output-folder: true
directive:
from: source-file-csharp
where: $
transform: >
$ = $.replace( /TextRecognitionMode mode, string url,/g, "string url, TextRecognitionMode mode," );
$ = $.replace( /mode, url,/g, "url, mode," );
```

## Python
Expand All @@ -65,6 +72,12 @@ python:
namespace: azure.cognitiveservices.vision.computervision
package-name: azure-cognitiveservices-vision-computervision
clear-output-folder: true
directive:
from: source-file-python
where: $
transform: >
$ = $.replace( /self, mode, url,/g, "self, url, mode," );
```
``` yaml $(python) && $(python-mode) == 'update'
python:
Expand Down Expand Up @@ -92,16 +105,16 @@ go:

``` yaml $(go) && $(multiapi)
batch:
- tag: release_1_0
- tag: release_2_0
```

### Tag: release_1_0 and go
### Tag: release_2_0 and go

These settings apply only when `--tag=release_1_0 --go` is specified on the command line.
These settings apply only when `--tag=release_2_0 --go` is specified on the command line.
Please also specify `--go-sdk-folder=<path to the root directory of your azure-sdk-for-go clone>`.

``` yaml $(tag) == 'release_1_0' && $(go)
output-folder: $(go-sdk-folder)/services/cognitiveservices/v1.0/computervision
``` yaml $(tag) == 'release_2_0' && $(go)
output-folder: $(go-sdk-folder)/services/cognitiveservices/v2.0/computervision
```


Expand All @@ -119,4 +132,11 @@ java:
output-folder: $(azure-libraries-for-java-folder)/azure-cognitiveservices/vision/computervision
with-optional-parameters: true
with-single-async-method: true
directive:
from: source-file-java
where: $
transform: >
$ = $.replace( /TextRecognitionMode mode, String url/g, "String url, TextRecognitionMode mode" );
$ = $.replace( /recognizeTextWithServiceResponseAsync\(mode, url\)/g, "recognizeTextWithServiceResponseAsync(url, mode)" )
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ Please also specify `--node-sdks-folder=<path to root folder of your azure-sdk-f
``` yaml $(nodejs)
nodejs:
package-name: azure-cognitiveservices-computervision
package-version: 1.0.0-preview
package-version: 2.0.0-preview
output-folder: $(node-sdks-folder)/lib/services/computerVision
override-client-name: ComputerVisionAPIClient
azure-arm: false
generate-license-txt: true
generate-package-json: true
generate-readme-md: false

directive:
from: source-file-nodejs
where: $
transform: >
$ = $.replace( /mode: string, url: string/g, "url: string, mode: string" );
$ = $.replace( /mode, url/g, "url, mode" );
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@ ruby:
package-name: azure_cognitiveservices_computervision
package-version: "0.16.0"
azure-arm: true

directive:
from: source-file-ruby
where: $
transform: >
$ = $.replace( /mode, url/g, "url, mode" );
```
### Ruby multi-api
``` yaml $(ruby) && $(multiapi)
batch:
- tag: release_1_0
- tag: release_2_0
```
### Tag: release_1_0 and ruby
### Tag: release_2_0 and ruby
These settings apply only when `--tag=release_1_0 --ruby` is specified on the command line.
These settings apply only when `--tag=release_2_0 --ruby` is specified on the command line.
Please also specify `--ruby-sdks-folder=<path to the root directory of your azure-sdk-for-ruby clone>`.

``` yaml $(tag) == 'release_1_0' && $(ruby)
namespace: "Azure::CognitiveServices::ComputerVision::V1_0"
``` yaml $(tag) == 'release_2_0' && $(ruby)
namespace: "Azure::CognitiveServices::ComputerVision::V2_0"
output-folder: $(ruby-sdks-folder)/data/azure_cognitiveservices_computervision/lib
title: "ComputerVisionClient"
```
Loading

0 comments on commit 64b5c7e

Please sign in to comment.