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 new rule: 1050 - ParameterLocationHasChanged; Change behavior of ChangedParameterOrder rule with regards to x-ms-parameter-location #334

Merged
merged 26 commits into from
Jun 21, 2024

Conversation

@konrad-jamrozik konrad-jamrozik changed the title Change behavior of ParameterOrderChanged Change behavior of ParameterOrderChanged with regards to x-ms-parameter-location Jun 12, 2024
@konrad-jamrozik konrad-jamrozik changed the title Change behavior of ParameterOrderChanged with regards to x-ms-parameter-location Change behavior of ChangedParameterOrder rule with regards to x-ms-parameter-location Jun 12, 2024
@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/param_order branch from fe0aeaa to 6914784 Compare June 19, 2024 23:53
{
var curOriginalParameter = Parameters.ElementAt(i);
var curParameter = currentOperationParameters.ElementAt(i);
curParameter.Extensions.TryGetValue("x-ms-long-running-operation", out var curParameterLocation);
Copy link
Author

@konrad-jamrozik konrad-jamrozik Jun 20, 2024

Choose a reason for hiding this comment

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

FYI @mikekistler @mikekistler there was a bug here for over 2 years (#218) where this:

curParameter.Extensions.TryGetValue("x-ms-long-running-operation", out var curParameterLocation);

should have been:

curParameter.Extensions.TryGetValue("x-ms-parameter-location", out var curParameterLocation);

But that is not all. There also was a bug where parameters whose order doesn't matter would cause false positives on parameters whose order matters but didn't actually change. That latter bug was just hidden by the former bug. I fixed all of that in this PR

@konrad-jamrozik
Copy link
Author

konrad-jamrozik commented Jun 20, 2024

@konrad-jamrozik konrad-jamrozik changed the title Change behavior of ChangedParameterOrder rule with regards to x-ms-parameter-location Add new rule: 1050 - ParameterLocationHasChanged; Change behavior of ChangedParameterOrder rule with regards to x-ms-parameter-location Jun 21, 2024
Konrad Jamrozik added 2 commits June 20, 2024 19:59
@konrad-jamrozik
Copy link
Author

konrad-jamrozik commented Jun 21, 2024

@mikekistler I applied the changes per our chat. Please see the diff for all the changes. Notably:

"produces": [
"text/plain"
],
"parameters": [
Copy link
Author

@konrad-jamrozik konrad-jamrozik Jun 21, 2024

Choose a reason for hiding this comment

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

@mikekistler per the ParameterRemoved test I added, here the removal of the params named "path_param", "path_param_req", "query_param_req", "body_param_req" will result in RemovedRequiredParameter breaking change each, while removal of "body_param", "query_param" will result in RemovedOptionalParameter breaking change.

Notably:

  • no ChangedParameterOrder breaking change will be reported.
  • path_param is considered required even though the param itself is not marked as such.

Copy link
Member

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@konrad-jamrozik konrad-jamrozik merged commit bc910ec into main Jun 21, 2024
5 checks passed
@konrad-jamrozik konrad-jamrozik deleted the users/kojamroz/param_order branch June 21, 2024 16:53
@konrad-jamrozik
Copy link
Author

Pull Request 559774: Update @azure/oad to 0.10.11 + rush update

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