Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Update contract for anomaly detector #12487
Update contract for anomaly detector #12487
Changes from 6 commits
df9d08d
696a311
6913db3
a7fc832
9d71cd0
37f0a8c
ea9e4a6
2b8023e
bc8261b
98e62a3
d61813c
687a6fb
b86618a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 this is a value returned by your service, consider marking it as readOnly: 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.
Should other fileds also be marked as readOnly as well?
In reply to: 560688590 [](ancestors = 560688590)
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, if they are set by your service, see here
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.
According to the following rule, I changed the property of our output model object to readOnly and removed the 'required' property.
R2056 RequiredReadOnlyProperties
Category : SDK Error
Applies to : ARM and Data plane OpenAPI(swagger) specs
Output Message: Property '{0}' is a required property. It should not be marked as 'readonly'.
Description: A model property cannot be both readOnly and required. A readOnly property is something that the server sets when returning the model object while required is a property to be set when sending it as a part of the request body.
Why the rule is important: SDK generation fails when this rule is violated.
How to fix the violation: Ensure that the given property is either marked as readonly: true or required but not 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.
Correct, if a customer sets the value, then it cannot be readonly (you can enforce setting the value by specifying required but nothing else), readonly: true is set on properties that your service sets an example is ProvisioningState, this value is set by your service (Running, Provisioning, Succeeded | Failed, etc.) so just add readonly: true to those properties that your service sets.
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.
Thanks just updated the PR.
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.
Your service is in preview, but consider marking properties as readOnly where needed, follow this doc.
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.
Actually our service is going to GA. We just have another PR to change 'preview' to 'stable' #12472.