EventGrid data spec for Microsoft.Devices/Iothub#2424
Conversation
Automation for azure-sdk-for-pythonSwagger to SDK encountered an unknown error: (azure-sdk-for-python)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github.py", line 274, in create_context_pr
base=sdk_base
File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/github_tools.py", line 137, in get_or_create_pull
base=base
File "/usr/local/lib/python3.6/dist-packages/github/Repository.py", line 994, in create_pull
return self.__create_pull_1(*args, **kwds)
File "/usr/local/lib/python3.6/dist-packages/github/Repository.py", line 1003, in __create_pull_1
return self.__create_pull(title=title, body=body, base=base, head=head)
File "/usr/local/lib/python3.6/dist-packages/github/Repository.py", line 1016, in __create_pull
input=post_parameters
File "/usr/local/lib/python3.6/dist-packages/github/Requester.py", line 172, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
File "/usr/local/lib/python3.6/dist-packages/github/Requester.py", line 180, in __check
raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 422 {'message': 'Validation Failed', 'errors': [{'resource': 'PullRequest', 'code': 'custom', 'message': 'No commits between master and restapi_auto_eventgrid/data-plane'}], 'documentation_url': 'https://developer.github.com/v3/pulls/#create-a-pull-request'}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/github_tools.py", line 29, in exception_to_github
yield context
File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github.py", line 197, in rest_handle_action
return rest_pull_close(body, github_con, restapi_repo, sdk_pr_target_repo, context_tags, sdkbase, sdk_tag)
File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github.py", line 379, in rest_pull_close
create_context_pr(sdk_pr_target_repo, context_tags, sdk_base)
File "/usr/local/lib/python3.6/dist-packages/swaggertosdk/restapi/github.py", line 283, in create_context_pr
_LOGGER.info("Unable to manage Context PR %s:\n%s", context_pr.number, response)
UnboundLocalError: local variable 'context_pr' referenced before assignment |
Swagger to SDK encountered a Subprocess error: (Azure/azure-sdk-for-go)
Command: profileBuilder -s preview -name preview /bin/sh: 1: profileBuilder: not found |
dsgouda
left a comment
There was a problem hiding this comment.
Few redundancies that can be reduced by consolidating a few definitions and creating properties objects for inline properties.
Also, definitions defined here are not being referenced anywhere, so not sure on the intentions behind this PR
| "description": | ||
| "Describes the schema of the Azure IoT Hub events published to Azure Event Grid. This corresponds to the Data property of an EventGridEvent." | ||
| }, | ||
| "paths": {}, |
There was a problem hiding this comment.
So if I understand correctly, you are simply defining models but not any paths from the service. What is the intention here?
There was a problem hiding this comment.
This is used to document the schemas of the various events published to EventGrid. A consumer who is consuming events from EventGrid (e.g. in an Azure function or in any webhook) can use the generated classes to deserialize the event appropriately. This is the same pattern used for other existing event schemas as well (e.g. the storage events in the eventgrid data plane directory).
There was a problem hiding this comment.
Thanks for the explanation.
| "type": "object", | ||
| "description": | ||
| "A portion of the properties that can be written only by the application back-end, and read by the device.", | ||
| "properties": { |
There was a problem hiding this comment.
A. We discourage use of inline definitions for complex object properties.
B. Is this odata by any chance or does your model actually have properties with special characters.
There was a problem hiding this comment.
Also, you are repeating this definition again in report, better pull it out into a different definition altogether and reference it here.
There was a problem hiding this comment.
Yes, the model has properties with "$" to signify that they are system properties.
There was a problem hiding this comment.
If these are not odata properties, we strongly recommend using x-ms-client-name (here)
You can name the property without special characters and specify its exact name with the special character as the x-ms-client-name value
| }, | ||
| "paths": {}, | ||
| "definitions": { | ||
| "IotHubDeviceCreatedEventData": { |
There was a problem hiding this comment.
Looks like you are sharing a bunch of properties with IotHubDeviceDeletedEventData, can you consolidate the common properties into a common definition here
| "type": "object", | ||
| "description": | ||
| "Information about the device twin, which is the cloud represenation of application device metadata.", | ||
| "properties": { |
There was a problem hiding this comment.
As before, please do not define inline properties like so, create a new definition
|
@dsgouda I have pushed changes based on your comments to split into smaller definitions. |
Swagger to SDK encountered a Subprocess error: (Azure/azure-sdk-for-go)
Command: profileBuilder -s preview -name preview /bin/sh: 1: profileBuilder: not found |
| "definitions": { | ||
| "IotHubDeviceCreatedEventData": { | ||
| "description": "Schema of the Data property of an EventGridEvent for an Microsoft.Devices.DeviceCreated event.", | ||
| "$ref" : "#/definitions/DeviceLifeCycleEventData" |
There was a problem hiding this comment.
The right way to do this is:
"IotHubDeviceCreatedEventData": {
"properties":{
"x-ms-client-flatten": true,
"$ref": "#/definitions/DeviceLifeCycleEventData",
"description": "device life cycle properties."
}
}There was a problem hiding this comment.
I would have to use the "x-ms-client-flatten": true, everywhere I reference is it?
| "description": "Schema of the Data property of an EventGridEvent for an Microsoft.Devices.DeviceDeleted event.", | ||
| "$ref" : "#/definitions/DeviceLifeCycleEventData" | ||
| }, | ||
| "DeviceLifeCycleEventData": { |
There was a problem hiding this comment.
A better name here is DeviceLifeCycleEventProperties
Updated definition name for DeviceLifeCycleEvent
|
@dsgouda Pushed fixes based on your comment. Please review and let me know. |
Swagger to SDK encountered a Subprocess error: (Azure/azure-sdk-for-go)
Command: profileBuilder -s preview -name preview /bin/sh: 1: profileBuilder: not found |
Swagger to SDK encountered a Subprocess error: (Azure/azure-sdk-for-go)
Command: profileBuilder -s preview -name preview /bin/sh: 1: profileBuilder: not found |
|
Hi There, I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result: File: AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback Thanks for your co-operation. |
dsgouda
left a comment
There was a problem hiding this comment.
A couple of minor comments and still recommend usage of x-ms-client-name for property names with special characters, e.g."
"lastUpdated": {
"type": "string",
"description": "The ISO8601 timestamp of the last time the properties were updated.",
"x-ms-client-name":"$lastUpdated"
}
| "paths": {}, | ||
| "definitions": { | ||
| "IotHubDeviceCreatedEventData": { | ||
| "description": "Schema of the Data property of an EventGridEvent for a Microsoft.Devices.DeviceCreated event.", |
There was a problem hiding this comment.
nit: A better description would be
"Event data for IotHubDeviceCreated event"
| } | ||
| } | ||
| }, | ||
| "DeviceTwinProperties": { |
There was a problem hiding this comment.
nit: Use a more meaningful name here, there already exists a definition for DeviceTwinInfo with some properties
something like TwinDeviceReportedProperties or DeviceReportedProperties based on the property name
There was a problem hiding this comment.
in this context reported properties has a different meaning. So using that would only confuse the reader who understands the iot hub twin concepts. DeviceTwinProperty is the right name.
Also, TwinInfo and TwinProperties were names I picked from another swagger doc that a partner team of us already uses. I would like to be consistent with those.
I will pass on this nit.
Swagger to SDK encountered a Subprocess error: (Azure/azure-sdk-for-go)
Command: profileBuilder -s preview -name preview /bin/sh: 1: profileBuilder: not found |
|
Hi There, I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result: File: AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback Thanks for your co-operation. |
Swagger to SDK encountered a Subprocess error: (Azure/azure-sdk-for-go)
Command: profileBuilder -s preview -name preview /bin/sh: 1: profileBuilder: not found |
Adding IotHub data schema for event grid specification
PR information
api-versionin the path should match theapi-versionin the spec).Quality of Swagger