-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[Hub Generated] Review request for Microsoft.PolicyInsights to add version 2018-07-01-preview #5408
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1165,11 +1165,11 @@ | |
}, | ||
"expressionValue": { | ||
"description": "Value of the expression.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you already generated any client SDKs for the existing version? This looks like a breaking change. Will your service continue to accept strings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SDKs for other languages are published but not SDK for .NET. This is part of the response not the request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, so this change in behavior from your RP may break users of these existing SDKs, as response deserialization may fail. Normally a breaking change would require an API version rev. I'll discuss with the team. Is this feature in public preview or GA? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no change in the RP behavior. The RP has been always returning "any" type for these properties, which is expected. The issue is in the client code generation since the current swagger spec has incorrect type for these properties and the user of the latest SDK may see a failure when the property has a non-string value. So the PR should be treated as a fix not a breaking change. The RP is in GA. The feature is only available in the preview API version. |
||
"type": "string" | ||
"type": "object" | ||
}, | ||
"targetValue": { | ||
"description": "Target value to be compared with the expression value.", | ||
"type": "string" | ||
"type": "object" | ||
}, | ||
"operator": { | ||
"description": "Operator to compare the expression value and the target value.", | ||
|
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.
This property is declared as an
object
in policyStates.json, so the example doesn't match.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.
A string is also valid for the property value since it is an object.
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.
See https://swagger.io/docs/specification/data-models/data-types/#object - "An object is a collection of property/value pairs".
We're using Swagger 2.0, which adheres to OpenAPI 2.0 (which takes types from JSON schema draft 4). A JSON string is not valid for a "object" type field as per the JSON schema.
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.
I see. "any" type explained in the doc is what we need. Can I use "any" type?
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.
@praries880 can you please provide guidance on how to model a value which can be any type (string, object, array)?
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.
@j5lim Ill get back to you on that shortly
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.
@j5lim
A good way to model this will be to break up the various properties into separate types and then define
targetValue
andexpressionValue
as composite types that encapsulate those properties...Having a single type overloaded to support more than one type will be impossible to support in languages like
Go
Autorest does not support the
Any
type.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.
@praries880 Does it mean we need to change the RP to return
targetValue
andexpressionValue
accordingly or can it be done by swagger changes only? Do you have some example?How about using a directive to transform to
object
type similar to what OperationalInsights spec does here? Can I do that approach?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.
@praries880 Pushed a new commit where a directive is used to transform the type of the properties to
object
for the languages that support a genericobject
type. This way at least those languages can handle the response without an error. Can you please review it?