-
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
[Hub Generated] Review request for Microsoft.PolicyInsights to add version 2018-07-01-preview #5408
Merged
praries880
merged 2 commits into
Azure:master
from
j5lim:dev-policyinsights-Microsoft.PolicyInsights-2018-07-01-preview
Apr 11, 2019
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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?