-
Notifications
You must be signed in to change notification settings - Fork 741
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
AutoRest azure-validator + client generation erroneously fails on core version ~2.0.4413 but not ^3.2.0 #4262
Comments
Has far as I can tell this is a design issue with autorest v2 and can't be fixed easily. It is due to how autorest v2 merged swagger models with the same names and the logic for including external models is a bit complex(one rule that applies here is if a model is referenced via allOf it will be included - explain why removing that link fixes it) and changing it would introduce a great chance for breaking existing specs. Autorest V2 not being actively maintained anymore this will most likely not get changed. There is another solution than updating the types.json(which I agree is not a solution): Rename the |
This reverts commit 9fe04ab.
Unfortunately, this did not seem to solve the issue. Let me know if I implemented the fix incorrectly (zhaomuzhi/azure-rest-api-specs@ced11a7 + zhaomuzhi/azure-rest-api-specs@7d80193) I'm now getting R4005 error, as well |
Yeah that looks good to me, but I guess it does fail for that other type. So after digging more into the code base the reason this gets included is autorest v2 will include any models that reference via I tried changing the Sku reference from types.json and using a copied version and this resolve the issue(Shouldn't even need that 1st fix). There is still some issue in mfe.json where Sku is defined manually as well. I don't know if the azure-specs-rest-api teams has some docs on how to use types.json but it kinda seems like we either want all or nothing with v2(and all their tooling...) |
ok... so the solution is to copy the The reason being that since we reference the common-type |
yeah basically... |
This reverts commit ced11a7.
Lol... so azure-rest-api-specs can't update to AutoRest v3 "because the autorest v3 has many breaking changes against v2" Azure/azure-rest-api-specs#15654 (comment) And the AutoRest v2 can't be updated because v2 isn't being maintained anymore Wonderful 🤦♂️ My grumblings aside, your solution worked and has unblocked the code gen gates (.NET gate, for example). Thanks :) |
Before filling a bug
Describe the bug
This issue was originally posted at Azure/azure-rest-api-specs#15654, but I was advised to post the issue here.
PR in question: Azure/azure-rest-api-specs#15439
LintDiff Logs in question: https://github.com/Azure/azure-rest-api-specs/pull/15439/checks?check_run_id=3333578400
Fails with:
"Text": "Error: '$.definitions.Identity.properties.type.enum' has incompatible values (---\n- SystemAssigned\n- 'SystemAssigned,UserAssigned'\n- UserAssigned\n- None\n, ---\n- SystemAssigned\n)."
The issue lies in machineLearningServices' ResourceIdentityType enum sharing the same name as common-types' ResourceIdentityType enum. However, common-types' Identity definition is not referenced (neither directly nor indirectly) anywhere in any of the specs defined in the readme.md. Interestingly, removing the reference to Identity from ResourceModelWithAllowedPropertySet resolves this issue. ResourceModelWithAllowedPropertySet is not referenced in any of the specs.
Running the validation command with
--v3
(which uses AutoRest core version^3.2.0
, as opposed to AutoRest core version~2.0.4413
) does not produce this failure.Because of these reasons, I think this might be an issue with autorest core version
~2.0.4413
.~2.0.4413
is used in the LintDiff pipeline. The client generation gates also does not seem to use a 3.x version, as they are failing with the same issue.Expected behavior
Validation/client generation to succeed, as it would with the 3.x version.
Additional context
To temporarily alleviate this issue in Azure/azure-rest-api-specs#15439, I have removed the reference to Identity from ResourceModelWithAllowedPropertySet. If you're planning on reproducing this issue, make sure to add that back in.
THIS IS NOT AN ACCEPTABLE SOLUTION; common-types definitions are used across practically every modern spec in the repo. Making changes to side-step this bug would have unintended consequences to other, already-merged specs.
The text was updated successfully, but these errors were encountered: