-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Reflect the service nullability behavior of Error and endTime #10262
Reflect the service nullability behavior of Error and endTime #10262
Conversation
Azure Pipelines successfully started running 1 pipeline(s). |
Azure CLI Extension Generation - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
azure-sdk-for-go - Release
|
azure-sdk-for-java - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
azure-sdk-for-js - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
azure-sdk-for-net - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
azure-sdk-for-python - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
Trenton Generation - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'd rather the service team sign-off on the changes.
@@ -67,7 +67,8 @@ | |||
"$ref": "#/definitions/Error" | |||
} | |||
}, | |||
"description": "The key vault server error." | |||
"description": "The key vault server error.", | |||
"x-nullable": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johanste is this correct? I thought x-nullable
would be applied where this type is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the service actually return null
here? If so, why? The property is optional. And we really don't want to have semantically meaningful null
values for content-type application/json payloads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing the service returns null for properties of the Error
model, including innererror
, which is of type Error
.
Lines 64 to 68 in 625a416
"innererror": { | |
"x-ms-client-name": "innerError", | |
"readOnly": true, | |
"$ref": "#/definitions/Error" | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention is to indicate that fields of the Error
type can be null then you want to apply x-nullable
to the applicable fields (like you did in backuprestore.json).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error value itself is returned as null. I think the service should clarify which of the types and properties are expected to be nullable before finalizing on the correct swagger change.
Currently, marking just the Error properties results in a null ref exception in generated code, but marking the whole Error type does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check with @pakrym - or even just try it with local swaggers - if setting x-nullable: true
on the model itself even works as intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to both :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Managed HSM usage of Error is that when there is no error in a correct case we are returning null to indicate the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service should not return a null
value on the wire. You should omit the key/value pair altogether. Is there a reason that the service is sending null on the wire?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In speaking with @vasanthrajams previously, this is consistent with existing Key Vault api behavior, so changing it now could be breaking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to keep unblocked since I'm going OOF soon, but please make sure that marking a model as nullable even works as intended. It's ideal if it does since any operation can return it, so hopefully you don't have to mark all refs as nullable.
azure-resource-manager-schemas - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
azure-sdk-for-python-track2 - Release
No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured
|
This PR includes regenerated code from the stable 7.2 swagger. Up until now it was in preview, but now that it's stable we're regenerating (and expected no meaningful changes). But there were meaningful changes! Recently our code generator started emitting `null` based on the x-nullable spec which unfortunately expanded CertificateOperation.error and ErrorModel.innerError to be `ErrorModel | undefined | **null**` Since this data is going from server to client we can only narrow it, we can't expand it without a breaking change. This is made worse because we re-exported ErrorModel as-is in 4.1. I looked into it and realized that this is done for historical reasons and not semantically meaningful see: Azure/azure-rest-api-specs#10262 (comment). So I am deprecating `ErrorModel` since we should use the `CertificateOperationError` type anyway, ensuring that the existing ErrorModel does not change, and applying the transformation from null to undefined in the convenience layer to keep the API the same.
This PR includes regenerated code from the stable 7.2 swagger. Up until now it was in preview, but now that it's stable we're regenerating (and expected no meaningful changes). But there were meaningful changes! Recently our code generator started emitting `null` based on the x-nullable spec which unfortunately expanded CertificateOperation.error and ErrorModel.innerError to be `ErrorModel | undefined | **null**` Since this data is going from server to client we can only narrow it, we can't expand it without a breaking change. This is made worse because we re-exported ErrorModel as-is in 4.1. I looked into it and realized that this is done for historical reasons and not semantically meaningful see: Azure/azure-rest-api-specs#10262 (comment). So I am deprecating `ErrorModel` since we should use the `CertificateOperationError` type anyway, ensuring that the existing ErrorModel does not change, and applying the transformation from null to undefined in the convenience layer to keep the API the same.
MSFT employees can try out our new experience at OpenAPI Hub - one location for using our validation tools and finding your workflow.
Contribution checklist:
Please follow the link to find more details on PR review process.