Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple specs error with latest autorest due tag config multiple defination #13147

Open
chamons opened this issue Feb 24, 2021 · 12 comments
Open

Comments

@chamons
Copy link
Contributor

chamons commented Feb 24, 2021

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 24, 2021
@chamons
Copy link
Contributor Author

chamons commented Feb 24, 2021

cc @datr93 and @njuCZ who are the latest people who's touched those files.

@timotheeguerin
Copy link
Member

timotheeguerin commented Feb 24, 2021

The issue in those specs is that the tag config is being defined twice globally in the file. This used to not be a problem as the later ones would get ignored but now the later one will override the first one.

In those specs this result in having multiple tags config being read and so including multiple version specs together.

See for example in this readme specification/softwareplan/resource-manager/readme.md

``` yaml
openapi-type: arm
tag: package-2019-06-01-preview
```

### Tag: package-2019-06-01-preview

These settings apply only when `--tag=package-2019-06-01-preview` is specified on the command line.

``` yaml $(tag) == 'package-2019-06-01-preview'
input-file:
  - Microsoft.SoftwarePlan/preview/2019-06-01-preview/softwareplan.json
```

``` yaml
openapi-type: arm
tag: package-2019-12-01
```

### Tag: package-2019-12-01

These settings apply only when `--tag=package-2019-12-01` is specified on the command line.

``` yaml $(tag) == 'package-2019-12-01'
input-file:
  - Microsoft.SoftwarePlan/stable/2019-12-01/softwareplan.json
```

It does the following:

  1. Set tag: package-2019-06-01-preview
  2. Condition match so it include 2019-06-01-preview/softwareplan.json
  3. Set tag: package-2019-12-01
  4. Condition match so it include 2019-12-01/softwareplan.json

Solution

Remove the 2nd tag override. It shouldn't be here. Not sure if it something was trying to be achieved with this or this is some copy paste leftover

@chamons
Copy link
Contributor Author

chamons commented Mar 1, 2021

Adding /specification/iotcentral/resource-manager/readme.md and cc @leni-msft

@chamons chamons changed the title softwareplan/resource-manager and desktopvirtualization/resource-manager error with latest autorest Multiple specs error with latest autorest due tag config multiple defination Mar 1, 2021
@chamons
Copy link
Contributor Author

chamons commented Mar 1, 2021

Adding specification/hybriddatamanager/resource-manager/readme.md and cc @prtank and @ t-prta

@prtank
Copy link
Contributor

prtank commented Mar 2, 2021

Hey, could you point me to some documentation about how these tags should be defined?

@timotheeguerin
Copy link
Member

@prtank I explained in this reply the problem and solution. The issue is always the same. The tag gets redefined twice and the 2nd (for the same behavior as before) needs to be removed

#13147 (comment)

@prtank
Copy link
Contributor

prtank commented Mar 2, 2021

Hi Timothee, I did see your comment on having only a single tag in the file. I should've been clearer, could you tell me how the tags work and what they're meant to signify?

@timotheeguerin
Copy link
Member

timotheeguerin commented Mar 2, 2021

tag is not something that autorest really cares about. It is just a convention used that applies to this file. They act like any other configuration properties and here it is used to configure which input-files to include. Some yaml block have a condition on a specific tag (yaml $(tag) == 'package-2019-12-01') and specify for that tag to load the swagger specs for that version(Microsoft.SoftwarePlan/stable/2019-12-01/softwareplan.json).

Or was your question more on how does the configuration in autorest works?

@prtank
Copy link
Contributor

prtank commented Mar 4, 2021

If the tags are used to specify which file to pick how should multiple API versions be handled? I remember adding the second tag while adding the second API version.

@timotheeguerin
Copy link
Member

So before the way it used to read the config the second tag assignment was just being ignore the first one had priority. so it was just like if it was not there.

The config file can be seen as just executing some code and assigning variables. with block condition being if statement.

Not exactly sure what you wanted to do for multi api. You can still have multiple tag condition to load the correct input-file depending on the --tag passed via the cli or default to the one on top if not provided.

So the markdown would look like this

``` yaml
openapi-type: arm
tag: package-2019-06-01-preview
```

### Tag: package-2019-06-01-preview

These settings apply only when `--tag=package-2019-06-01-preview` is specified on the command line.

``` yaml $(tag) == 'package-2019-06-01-preview'
input-file:
  - Microsoft.SoftwarePlan/preview/2019-06-01-preview/softwareplan.json
```

### Tag: package-2019-12-01

These settings apply only when `--tag=package-2019-12-01` is specified on the command line.

``` yaml $(tag) == 'package-2019-12-01'
input-file:
  - Microsoft.SoftwarePlan/stable/2019-12-01/softwareplan.json
```

prtank added a commit to azurehybriddatamanager/azure-rest-api-specs that referenced this issue Mar 5, 2021
@prtank
Copy link
Contributor

prtank commented Mar 5, 2021

Thanks for the details Timothee. I have raised PR Fix issue 13147 for HybridDataManager#13296 with the change

PhoenixHe-NV pushed a commit that referenced this issue Mar 8, 2021
* Create hybriddata.json

Added updated swagger file for Microsoft.HybridData

* Create readme.md

* Updated readme files

* Update readme.md

* Removed unused API endpoints

* Updated example files and swagger

* Fixed error in path to example files

* Fixed Go and Ruby Readme Files

* Added suppression for OperationIdNounVerb

* Added DataManagers_Update and examples

* Added suppression for ARM Violation and updated swagger and example files

* Updated swagger to sdk script for ruby

* Added Python swagger to sdk

* Added PartiallySucceeded status

* Added swagger and examples for API Version 2019-06-01

Added swagger and examples for API version 2019-06-01
Adding PartiallySucceeded job status

* Removed partially succeeded status from 2016-06-01 swagger

* Updating body of 202 response

* After running prettier

Ran npm install; npm run prettier -- --write "specification/hybriddatamanager/**/*.json"

* Updated readme files to include 2019-06 api version

* Updated descriptions as per PR comments

* Committing Prettier check change

* Updated HybridDataManager to fix issue 13147

Fix issue #13147 in hybriddatamanager

Co-authored-by: t-prta <46665688+prerna-tank-ms@users.noreply.github.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-resource-manager-schemas that referenced this issue Mar 8, 2021
Fix issue 13147 for HybridDataManager (#13296)

* Create hybriddata.json

Added updated swagger file for Microsoft.HybridData

* Create readme.md

* Updated readme files

* Update readme.md

* Removed unused API endpoints

* Updated example files and swagger

* Fixed error in path to example files

* Fixed Go and Ruby Readme Files

* Added suppression for OperationIdNounVerb

* Added DataManagers_Update and examples

* Added suppression for ARM Violation and updated swagger and example files

* Updated swagger to sdk script for ruby

* Added Python swagger to sdk

* Added PartiallySucceeded status

* Added swagger and examples for API Version 2019-06-01

Added swagger and examples for API version 2019-06-01
Adding PartiallySucceeded job status

* Removed partially succeeded status from 2016-06-01 swagger

* Updating body of 202 response

* After running prettier

Ran npm install; npm run prettier -- --write "specification/hybriddatamanager/**/*.json"

* Updated readme files to include 2019-06 api version

* Updated descriptions as per PR comments

* Committing Prettier check change

* Updated HybridDataManager to fix issue 13147

Fix issue Azure/azure-rest-api-specs#13147 in hybriddatamanager

Co-authored-by: t-prta <46665688+prerna-tank-ms@users.noreply.github.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Mar 8, 2021
Fix issue 13147 for HybridDataManager (Azure#13296)

* Create hybriddata.json

Added updated swagger file for Microsoft.HybridData

* Create readme.md

* Updated readme files

* Update readme.md

* Removed unused API endpoints

* Updated example files and swagger

* Fixed error in path to example files

* Fixed Go and Ruby Readme Files

* Added suppression for OperationIdNounVerb

* Added DataManagers_Update and examples

* Added suppression for ARM Violation and updated swagger and example files

* Updated swagger to sdk script for ruby

* Added Python swagger to sdk

* Added PartiallySucceeded status

* Added swagger and examples for API Version 2019-06-01

Added swagger and examples for API version 2019-06-01
Adding PartiallySucceeded job status

* Removed partially succeeded status from 2016-06-01 swagger

* Updating body of 202 response

* After running prettier

Ran npm install; npm run prettier -- --write "specification/hybriddatamanager/**/*.json"

* Updated readme files to include 2019-06 api version

* Updated descriptions as per PR comments

* Committing Prettier check change

* Updated HybridDataManager to fix issue 13147

Fix issue Azure/azure-rest-api-specs#13147 in hybriddatamanager

Co-authored-by: t-prta <46665688+prerna-tank-ms@users.noreply.github.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-net that referenced this issue Mar 8, 2021
Fix issue 13147 for HybridDataManager (Azure#13296)

* Create hybriddata.json

Added updated swagger file for Microsoft.HybridData

* Create readme.md

* Updated readme files

* Update readme.md

* Removed unused API endpoints

* Updated example files and swagger

* Fixed error in path to example files

* Fixed Go and Ruby Readme Files

* Added suppression for OperationIdNounVerb

* Added DataManagers_Update and examples

* Added suppression for ARM Violation and updated swagger and example files

* Updated swagger to sdk script for ruby

* Added Python swagger to sdk

* Added PartiallySucceeded status

* Added swagger and examples for API Version 2019-06-01

Added swagger and examples for API version 2019-06-01
Adding PartiallySucceeded job status

* Removed partially succeeded status from 2016-06-01 swagger

* Updating body of 202 response

* After running prettier

Ran npm install; npm run prettier -- --write "specification/hybriddatamanager/**/*.json"

* Updated readme files to include 2019-06 api version

* Updated descriptions as per PR comments

* Committing Prettier check change

* Updated HybridDataManager to fix issue 13147

Fix issue Azure/azure-rest-api-specs#13147 in hybriddatamanager

Co-authored-by: t-prta <46665688+prerna-tank-ms@users.noreply.github.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-java that referenced this issue Mar 8, 2021
Fix issue 13147 for HybridDataManager (#13296)

* Create hybriddata.json

Added updated swagger file for Microsoft.HybridData

* Create readme.md

* Updated readme files

* Update readme.md

* Removed unused API endpoints

* Updated example files and swagger

* Fixed error in path to example files

* Fixed Go and Ruby Readme Files

* Added suppression for OperationIdNounVerb

* Added DataManagers_Update and examples

* Added suppression for ARM Violation and updated swagger and example files

* Updated swagger to sdk script for ruby

* Added Python swagger to sdk

* Added PartiallySucceeded status

* Added swagger and examples for API Version 2019-06-01

Added swagger and examples for API version 2019-06-01
Adding PartiallySucceeded job status

* Removed partially succeeded status from 2016-06-01 swagger

* Updating body of 202 response

* After running prettier

Ran npm install; npm run prettier -- --write "specification/hybriddatamanager/**/*.json"

* Updated readme files to include 2019-06 api version

* Updated descriptions as per PR comments

* Committing Prettier check change

* Updated HybridDataManager to fix issue 13147

Fix issue Azure/azure-rest-api-specs#13147 in hybriddatamanager

Co-authored-by: t-prta <46665688+prerna-tank-ms@users.noreply.github.com>
@prtank
Copy link
Contributor

prtank commented Mar 8, 2021

Hey Timothee, I see that the PR has been merged. Can i consider this issue closed for HybridDataManager?

@leni-msft leni-msft removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 24, 2021
mkarmark pushed a commit to mkarmark/azure-rest-api-specs that referenced this issue Jul 21, 2021
* Create hybriddata.json

Added updated swagger file for Microsoft.HybridData

* Create readme.md

* Updated readme files

* Update readme.md

* Removed unused API endpoints

* Updated example files and swagger

* Fixed error in path to example files

* Fixed Go and Ruby Readme Files

* Added suppression for OperationIdNounVerb

* Added DataManagers_Update and examples

* Added suppression for ARM Violation and updated swagger and example files

* Updated swagger to sdk script for ruby

* Added Python swagger to sdk

* Added PartiallySucceeded status

* Added swagger and examples for API Version 2019-06-01

Added swagger and examples for API version 2019-06-01
Adding PartiallySucceeded job status

* Removed partially succeeded status from 2016-06-01 swagger

* Updating body of 202 response

* After running prettier

Ran npm install; npm run prettier -- --write "specification/hybriddatamanager/**/*.json"

* Updated readme files to include 2019-06 api version

* Updated descriptions as per PR comments

* Committing Prettier check change

* Updated HybridDataManager to fix issue 13147

Fix issue Azure#13147 in hybriddatamanager

Co-authored-by: t-prta <46665688+prerna-tank-ms@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants