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

Add tests to account for tenant level APIs for all RPC rule for PUT operations #632

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

rkmanda
Copy link
Member

@rkmanda rkmanda commented Dec 6, 2023

This PR is to ensure coverage of all the RC rules for PUT operations for tenant level APIs. No changes to the rules were necessary and a bunch of tests were added to test for coverage wherever relevant.

Information in the URI should not be repeated in the request body (i.e. subscription ID, resource group name, resource name).

## CreatedAt
The '{property name}' already appears in the URI, please don't repeat it in the request body. Information in the URI must not be repeated in the request body (i.e. subscription ID, resource group name, resource name).
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The '{property name}' already appears in the URI, please don't repeat it in the request body. Information in the URI must not be repeated in the request body (i.e. subscription ID, resource group name, resource name).
The '{property name}' property is in the URI, so it must not be in the request body. Information in the URI must not be repeated in the request body (i.e., subscription ID, resource group name, resource name).
``` #Resolved



## Why the rule is important
A PUT or Patch request must always have a request body defined. This rule applies to all ARM resources (Tracked and proxy). PUT and patch operations using an empty payload is not allowed in ARM.
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A PUT or Patch request must always have a request body defined. This rule applies to all ARM resources (Tracked and proxy). PUT and patch operations using an empty payload is not allowed in ARM.
A PUT or PATCH request must always have a request body defined. This rule applies to all ARM resources (Tracked and Proxy). PUT and PATCH operations using an empty payload are not allowed in ARM.
``` #Resolved


## How to fix the violation
Add a request body for every PUT or Patch operation defined in your swagger. This request body must also match the response body of the PUT or Patch operation.
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Add a request body for every PUT or Patch operation defined in your swagger. This request body must also match the response body of the PUT or Patch operation.
Add a request body for every PUT or PATCH operation defined in your swagger. This request body must also match the response body of the PUT or PATCH operation.
``` #Resolved

## Bad example 2

Put without a request body
Another Put operation without a request body
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Another Put operation without a request body
Another PUT operation without a request body:
``` #Resolved

## Bad example 1

Put without a request body
PUT without a request body
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PUT without a request body
PUT without a request body:
``` #Resolved


## Bad examples

```json
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this in some other file, maybe it would remove the syntax error highlighting?

Suggested change
```json
```json5
``` #Resolved

## Output Message

The tracked resource {resourceName} is beyond third level of nesting.

## Description

Tracked resources must not be used beyond the third level of nesting.
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be beyond the second level of nesting? Meaning tracked is ok for first (parent) and second level (child) resources, but not third level (grandchild). Make sure this is consistent with line 21.

Suggested change
Tracked resources must not be used beyond the third level of nesting.
Tracked resources must not be used beyond the second level of nesting.
``` #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the description is inconsistent with the how to fix section. I will fix it.


Avoid the third level nested tracked resource, you should try to decrease the nested levels.
Avoid the third level nested tracked resource. You may model such resources as proxy resources instead. Having a tracked resource beyond the third level may lead to a loss of functionality in ARM.
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third level is "beyond the second level".

Suggested change
Avoid the third level nested tracked resource. You may model such resources as proxy resources instead. Having a tracked resource beyond the third level may lead to a loss of functionality in ARM.
Avoid the third level nested tracked resource. You may model such resources as proxy resources instead. Having a tracked resource beyond the second level may lead to a loss of functionality in ARM.
``` #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats correct and thats the reason the third level must be avoided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the description is inconsistent with the how to fix section. I will fix it.

## Why the rule is important

ARM requires all tracked resources to support taggability.
Every tracked resource MUST support tags as an optional property. The specified tracked resource either does not have tags mentioned as a property or it is mentioned but marked as required.
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Every tracked resource MUST support tags as an optional property. The specified tracked resource either does not have tags mentioned as a property or it is mentioned but marked as required.
Every tracked resource **must** support `tags` as an **optional** property. The specified tracked resource either does not have `tags` as a property or has `tags` marked as required.
``` #Resolved


Adding the put operation for tracked resource, or remove the resource definition if it's useless.
Add the PUT operation for a tracked resource or make the resource proxy if it cannot be created by the end user.
Copy link
Member

@bdefoy bdefoy Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Add the PUT operation for a tracked resource or make the resource proxy if it cannot be created by the end user.
Add a PUT operation for the tracked resource or make the resource's routing type proxy if it cannot be created by the end user.
``` #Resolved

@rkmanda rkmanda merged commit dd441d3 into main Jan 8, 2024
2 of 4 checks passed
@rkmanda rkmanda deleted the rkmanda/tenantLevelCoverageForPut branch January 8, 2024 20:44
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

Successfully merging this pull request may close these issues.

2 participants