Fix for Adding API Version 2022-06-01 for PriceSheets and Operations#21560
Fix for Adding API Version 2022-06-01 for PriceSheets and Operations#21560prchalla1 wants to merge 30 commits intoAzure:mainfrom
Conversation
|
Hi, @prchalla1 Thanks for your PR. I am workflow bot for review process. Here are some small tips. Any feedback about review process or workflow bot, pls contact swagger and tools team. vscswagger@microsoft.com |
Swagger Validation Report
|
| Rule | Message |
|---|---|
| The default tag contains multiple API versions swaggers. readme: specification/consumption/resource-manager/readme.md tag: specification/consumption/resource-manager/readme.md#tag-package-2022-06 |
️🔄ApiReadinessCheck inProgress [Detail]
️🔄~[Staging] ServiceAPIReadinessTest inProgress [Detail]
️🔄~[Staging] SwaggerAPIView inProgress [Detail]
️️✔️ModelValidation succeeded [Detail] [Expand]
Validation passes for ModelValidation.
️️✔️SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️⌛PoliCheck pending [Detail]
️🔄PrettierCheck inProgress [Detail]
️️✔️SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️🔄Lint(RPaaS) inProgress [Detail]
️🔄CadlValidation inProgress [Detail]
️⌛PR Summary pending [Detail]
Swagger Generation Artifacts
|
|
Swagger pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
|
Hi, @prchalla1, For review efficiency consideration, when creating a new api version, it is required to place API specs of the base version in the first commit, and push new version updates into successive commits. You can use OpenAPIHub to initialize the PR for adding a new version. For more details refer to the wiki. Or you could onboard API spec pipeline |
|
Hi @prchalla1, Your PR has some issues. Please fix the CI sequentially by following the order of
|
|
Hi @prchalla1, one or multiple breaking change(s) is detected in your PR. Please check out the breaking change(s), and provide business justification in the PR comment and @ PR assignee why you must have these change(s), and how external customer impact can be mitigated. Please ensure to follow breaking change policy to request breaking change review and approval before proceeding swagger PR review. |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Regarding the GUID usage, We receive MeterId in guid format from downstreams. The type is string but it’s a GUID and we are returning as is in response. Discussed with @zizw123 offline |
| "200": { | ||
| "description": "OK. The request has succeeded.", | ||
| "schema": { | ||
| "$ref": "#/definitions/PriceSheetResult" |
There was a problem hiding this comment.
Good point. When you implement a LIST api, ARM expects you to return an object with a 'value' property that holds the actual array of resources/objects.
There was a problem hiding this comment.
But... this isn't actually a LIST api, in the resource sense - in terms of the request path, its just a singleton get, i.e. fetching ONE pricesheet named default.
There was a problem hiding this comment.
And that resource just happens to contain a list....
There was a problem hiding this comment.
I am unclear why its this way and its not a normal ARM LIST api, actually.
There was a problem hiding this comment.
Agreed. I can take it up with my team to understand more on this, but we cannot change a response model without letting clients know right? They will have dependency on existing model. What do you suggest?
This response model is same for all other versions of this API
There was a problem hiding this comment.
@TimLovellSmith Can you please help on how should we proceed forward with this?
There was a problem hiding this comment.
@jayati-tehri The answers to this depends on how you want to model this API overall :
For example the API
GET /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default
Currently this is modelled as a single point GET of a subscription level pricesheet resource called default. Which means it should return only one resource and should not have nextlink. If you want to model this as a list instead to list all the individual pricesheets in the subscription then the call needs to be like this :
GET /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/
and this returns the list of various pricesheets in the subscription in the array format with next link.
Also there is an issue with how you have created the response for a list operation , the nextlink should not be inside properties , check the output of the operationsList.json where you have modelled this correctly. This is explained in the microsoft REST guidelines here : https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#collections
You should also go over that document in entirety to model these apis correctly.
Please fix these APIs and let us know , if you need any further clarifications , please feel free to send me and the apireviews an email
|
@prchalla1 - I don't see a response to this comment: #21560 (comment). This is important: please let us know. I'll summarize the issue here: Currently you are using a singleton "default" instance of the pricesheets resource type to return all pricesheets. Since you are wrapping the array into an object, it doesn't technically break the RPC, but it basically says that a pricesheet is a list of pricesheets, which is not a good model. Plus, if you want to stick with that model, you still need to add the list endpoint for listing all pricesheets in order to follow the RPC. This would be on this endpoint: /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets, and would return a list of one item (named "default"). I agree with @TimLovellSmith and @raosuhas that this should be modeled as a list API. |
@jayati-tehri Can you look over this and reply on this comment. |
Swagger Validation Report
|
| Rule | Message |
|---|---|
| "details":"Attention: There are some existing APIs currently documented in a new spec file. The validation may not be able to report breaking changes with these APIs. It is recommended not to rename swagger file or move public APIs to a new file when creating a new API version.The existing APIs being moved are:Operations_List;", "location":"https://github.com/Azure/azure-rest-api-specs/blob/main/specification/consumption/resource-manager/Microsoft.Consumption/stable/2022-06-01/consumption.operations.pricesheet.json" |
️️✔️CredScan succeeded [Detail] [Expand]
There is no credential detected.
️❌LintDiff: 2 Errors, 0 Warnings failed [Detail]
| compared tags (via openapi-validator v2.0.0) | new version | base version |
|---|---|---|
| package-2022-06 | package-2022-06(d82db1d) | default(main) |
[must fix]The following errors/warnings are introduced by current PR:
| Rule | Message | Related RPC [For API reviewers] |
|---|---|---|
TopLevelResourcesListBySubscription |
The top-level resource 'PriceSheetResult' does not have list by subscription operation, please add it. Location: Microsoft.Consumption/stable/2022-06-01/consumption.operations.pricesheet.json#L207 |
RPC-Get-V1-05 |
GuidUsage |
Usage of Guid is not recommended. If GUIDs are absolutely required in your service, please get sign off from the Azure API review board. Location: Microsoft.Consumption/stable/2022-06-01/consumption.operations.pricesheet.json#L280 |
️⚠️Avocado: 1 Warnings warning [Detail]
| Rule | Message |
|---|---|
| The default tag contains multiple API versions swaggers. readme: specification/consumption/resource-manager/readme.md tag: specification/consumption/resource-manager/readme.md#tag-package-2022-06 |
️️✔️ApiReadinessCheck succeeded [Detail] [Expand]
️⚠️~[Staging] ServiceAPIReadinessTest: 0 Warnings warning [Detail]
API Test is not triggered due to precheck failure. Check pipeline log for details.
️️✔️~[Staging] SwaggerAPIView succeeded [Detail] [Expand]
️️✔️ModelValidation succeeded [Detail] [Expand]
Validation passes for ModelValidation.
️️✔️SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️️✔️PoliCheck succeeded [Detail] [Expand]
Validation passed for PoliCheck.
️️✔️PrettierCheck succeeded [Detail] [Expand]
Validation passes for PrettierCheck.
️️✔️SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️️✔️Lint(RPaaS) succeeded [Detail] [Expand]
Validation passes for Lint(RPaaS).
️️✔️CadlValidation succeeded [Detail] [Expand]
Validation passes for CadlValidation.
️️✔️PR Summary succeeded [Detail] [Expand]
Validation passes for Summary.
In the previous versions(refer : In this PR, we are just adding a new version for pricesheets and operations API. |
|
@jayati-tehri, @prchalla1 - This is one reason it is critical that new API PRs follow this format: Adding a new API version I don't know the full history of this PR/review, but it looks like previous reviewers didn't realize that this was not a newly added path. We put the above requirement on new API PRs so reviewers don't waste time re-reviewing APIs that have already shipped (among other reasons). As it stands now, it looks like there was also refactoring done in the middle, so I'm finding it really hard to determine what's new and what's previously shipped, even when I go back and compare with what's checked in under 2021-10-01. Can you make a new PR that follows the above requirement, so we can see what's getting changed? Copy everything from 2021-10-01 [unchanged] to the new version folder, make a commit, then apply changes for the new API version. If you want to refactor, it's best to do that in a separate PR afterward that doesn't change the APIs. The current feedback thread won't apply any more if the API in question isn't being added in the new API version. Note: improve the API doesn't require breaking customers: you can add the new correct list API without changing the existing one, then deprecate the old one according to the Azure retirement requirements (if you want). |
|
@mentat9 The reason we didn’t copy the previous folder into the new version 2022-06-01 is because we are introducing 2022-06-01 only for pricesheets and operations and rest other APIs route to 2021-10-01. We have done this for other APIs in the past when we wanted to introduce a version only for specific set of APIs. Please let me know if this doesn’t look correct. |
Thanks Jayati. The problem is that reviewers can't tell if it's correct (or what you are changing). The new file in the PR implies to reviewers that those are new APIs, but they aren't (or some aren't) as we just discovered. Since they moved to a new file, it's hard to tell how (or whether) they're different in the new API version, or that they aren't being added. It would help if you did the refactoring separately from the API changes. IOW, if you need to refactor to enable your release strategy, make those changes first (without any API changes), and add the new API version changes afterward. Something more like this:
This allows reviewers to see what's changing in the commit history. It's not perfect but combined with explanatory comments we can see/diff what is being modified w.r.t. the current API version and what is being added. |

ARM API Information (Control Plane)
MSFT employees can try out our new experience at OpenAPI Hub - one location for using our validation tools and finding your workflow.
Azure 1st Party Service can try out the Shift Left experience to initiate API design review from ADO code repo. If you are interested, may request engineering support by filling in with the form https://aka.ms/ShiftLeftSupportForm.
Changelog
Add a changelog entry for this PR by answering the following questions:
Contribution checklist (MS Employees Only):
If any further question about AME onboarding or validation tools, please view the FAQ.
ARM API Review Checklist
Otherwise your PR may be subject to ARM review requirements. Complete the following:
Check this box if any of the following apply to the PR so that the label "ARMReview" and "WaitForARMFeedback" will be added by bot to kick off ARM API Review. Missing to check this box in the following scenario may result in delays to the ARM manifest review and deployment.
-[ ] To review changes efficiently, ensure you copy the existing version into the new directory structure for first commit and then push new changes, including version updates, in separate commits. You can use OpenAPIHub to initialize the PR for adding a new version. For more details refer to the wiki.
Ensure you've reviewed following guidelines including ARM resource provider contract and REST guidelines. Estimated time (4 hours). This is required before you can request review from ARM API Review board.
If you are blocked on ARM review and want to get the PR merged with urgency, please get the ARM oncall for reviews (RP Manifest Approvers team under Azure Resource Manager service) from IcM and reach out to them.
Breaking Change Review Checklist
If you have any breaking changes as defined in the Breaking Change Policy, request approval from the Breaking Change Review Board.
Action: to initiate an evaluation of the breaking change, create a new intake using the template for breaking changes. Additional details on the process and office hours are on the Breaking Change Wiki.
NOTE: To update API(s) in public preview for over 1 year (refer to Retirement of Previews)
Please follow the link to find more details on PR review process.