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

Breaking Changes PR check not flagging type change as breaking #3893

Closed
mikekistler opened this issue Aug 9, 2022 · 10 comments · Fixed by Azure/openapi-diff#237
Closed

Breaking Changes PR check not flagging type change as breaking #3893

mikekistler opened this issue Aug 9, 2022 · 10 comments · Fixed by Azure/openapi-diff#237
Assignees
Labels
Spec PR Tools Tooling that runs in azure-rest-api-specs repo.

Comments

@mikekistler
Copy link
Member

The Breaking Changes PR check in the azure-rest-api-specs repo is failing to flag a type change as breaking and requiring a Breaking Change review.

REST API PR: Azure/azure-rest-api-specs#19468

The Breaking Changes-Cross Version PR check issued these two warnings for change of type:

image

Here is one of the changes:

Azure/azure-rest-api-specs@ed2c211

image

According to the Azure Versioning and Breaking Change Policy, Table 3 (Changes requiring a review with Azure’s breaking Change Review Board), this should be reported as an error and require review/approval by the Azure Breaking Changes review board before the PR can be merged.

image

cc: @JeffreyRichter @srmantha

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 9, 2022
@mikekistler mikekistler added Spec PR Tools Tooling that runs in azure-rest-api-specs repo. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Aug 9, 2022
@mikekistler
Copy link
Member Author

@akning-ms Please give this top priority as it is allowing breaking changes to evade review and impact customers.

@akning-ms
Copy link

@jianyexi to triage the issue

@jianyexi
Copy link

jianyexi commented Aug 10, 2022

I think it's because we flagged this rule as waring temporary. The background is that
currently there are a lot of schema definitions which are actually objects but don't contain the 'type:object' and autorest team want to differentiate the schema with or without 'type:object', as they have different meaning. Therefore, we added a lint rule to force the 'type:object'. But fixing it will cause a breaking change false alarm and a lot of service teams complain about it and considering the SDK breaking change already reported it, we marked this rule as warning. I think it's time to change it back to 'error' again to fix this risk

@mikekistler
Copy link
Member Author

Can we special-case adding type: object -- make that a warning -- but return to reporting a change of type to be an error?

@jianyexi
Copy link

Can we special-case adding type: object -- make that a warning -- but return to reporting a change of type to be an error?
But if we honor the autorest/OAS2 semantic, then adding 'type: object' is an 'error', so we don't need to do any change on the current implementation ,we just need to change it back to 'error' in the configuration without any code change

@mikekistler
Copy link
Member Author

Are you suggesting that autorest does something different when a schema has type: object vs when it does not? I know that technically these are different, as discussed in this issue. Maybe even more specifically -- if a schema has "properties", does autorest behavior change if type: object is added? If not then I think a warning is sufficient for this special case.

@jianyexi
Copy link

if a schema has "properties", does autorest behavior change if type: object is added?

yes, actually it's motivation that autorest want to add the linting rule , after adding 'type:object' , the model would be a object, but if without 'type:object' it would be an any type

@mikekistler
Copy link
Member Author

@jianyexi But I really don't think the code generated by autorest changes when type: object is added.

I just tested this with the appconfiguration service in the dotnet mgmt SDK (link to test branch). In my test, I removed type: object from many of the schemas that also have properties (commit b1f253d). Then I updated the autorest.md to point to this version and regenerated the client library. The regeneration threw a bunch of warning messages like:

      - https://github.com/mikekistler/azure-rest-api-specs/blob/b1f253d70547f975650612226919c73da808b015/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/preview/2021-10-01-preview/appconfiguration.json:1203:5
  warning | PreCheck/SchemaMissingType | The schema 'ConfigurationStoreProperties' with an undefined type and declared properties is a bit ambiguous. This has been auto-corrected to 'type:object'
      - https://github.com/mikekistler/azure-rest-api-specs/blob/b1f253d70547f975650612226919c73da808b015/specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/preview/2021-10-01-preview/appconfiguration.json:1251:5
  warning | PreCheck/SchemaMissingType | The schema 'ConfigurationStoreUpdateParameters' with an undefined type and declared properties is a bit ambiguous. This has been auto-corrected to 'type:object'

but there was no change to the actual generated code (see the branch I pushed here).

Is there some other language or perhaps dotnet dataplane that does generate different code based on whether type: object is present or absent in a schema that has defined properties?

@jianyexi
Copy link

I think it has no change today is because of below flag in the M4 ,https://github.com/Azure/autorest/tree/main/packages/extensions/modelerfour
image

@mikekistler
Copy link
Member Author

Perfect. So please treat this as a special case -- adding type: object next to properties is only a warning -- and all other additions or changes of type are error. We need this fix ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Spec PR Tools Tooling that runs in azure-rest-api-specs repo.
Projects
Status: 🎊 Closed
Development

Successfully merging a pull request may close this issue.

3 participants