Skip to content

Swagger json file for Azure Automation accounts#950

Merged
fearthecowboy merged 13 commits intoAzure:masterfrom
AzureAutomationTeam:master
Mar 13, 2017
Merged

Swagger json file for Azure Automation accounts#950
fearthecowboy merged 13 commits intoAzure:masterfrom
AzureAutomationTeam:master

Conversation

@viveklingaiah
Copy link
Copy Markdown
Contributor

@viveklingaiah viveklingaiah commented Feb 18, 2017

Starting with these 4 resources. json files are split by each resource.
rest of resources to come subsequently.
-Linter is not accessible at the below link by the way (I already have access from aka.ms/azuregithub)

This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.

PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes.
  • Swagger files are correctly named (e.g. the api-version in the path should match the api-version in the spec).

Quality of Swagger

  • I have read the contribution guidelines.
  • My spec meets the review criteria:
    • The spec conforms to the Swagger 2.0 specification.
    • Validation errors from the Linter extension for VS Code have all been fixed for this spec. (Note: for large, previously checked in specs, there will likely be many errors shown. Please contact our team so we can set a timeframe for fixing these errors if your PR is not going to address them).
    • The spec follows the patterns described in the Swagger good patterns document unless the service API makes this impossible.

Starting with these 4 resources.  json files are split by each resource.
rest of resources to come subsequently.
@azurecla
Copy link
Copy Markdown

Hi @vivlingaiah, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!


It looks like you're working at Microsoft (vivekl). If you're full-time, we DON'T require a contribution license agreement.



If you are a vendor, DO please sign the electronic contribution license agreement. It will take 2 minutes and there's no faxing! https://cla.azure.com.

TTYL, AZPRBOT;

@viveklingaiah viveklingaiah changed the title Swagger json files for accounts, runbooks, jobs and modules Swagger json files for Azure Automation accounts, runbooks, jobs and modules Feb 21, 2017
@fearthecowboy
Copy link
Copy Markdown
Contributor

Hey @vivlingaiah

Can I get you to install node.js run the following commands:

# Install the  new autorest command line
npm install -g autorest 

# run autorest on the swagger
autorest -input arm-automation/compositeAutomation.json  -CodeGenerator Azure.CSharp -Modeler CompositeSwagger

When I do that, I'm finding a lot of issues:

WARNING: Media types other than 'application/json' has limited support
        Path: arm-automation/compositeAutomation.json#/consumes[2]
WARNING: Media types other than 'application/json' has limited support
        Path: arm-automation/compositeAutomation.json#/produces[2]
WARNING: Operation TypeFields_List must be one of: fields_listbysubscriptionid, fields_list, fields_listbyresourcegroup, fields_listbytypes
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Operation TestJobStreams_List must be one of: streams_listbysubscriptionid, streams_list, streams_listbyresourcegroup, streams_listbytestjob
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Operations API must be implemented for the service.
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/content must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/publish must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/undoEdit must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/content must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId} must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/streams must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/resume must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/stop must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: Path /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/suspend must follow the pattern Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operations
        Path: arm-automation/compositeAutomation.json#/paths
WARNING: 'GET' operation must use method name 'Get' or Method name start with 'List', 'PUT' operation must use method name 'Create', 'PATCH' operation must use method name 'Update' and 'DELETE' operation must use method name 'Delete'.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{name}/patch/operationId
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{name}/patch/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{name}/put/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/delete/parameters[4]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/get/parameters[4]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/get/parameters[3]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/activities/{activityName}/get/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/activities/get/parameters[5]
WARNING: The property 'odata.nextLink' specified by nextLinkName does not exist in the 200 response schema.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/activities/get/extensions/x-ms-pageable
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{name}/put/parameters[6]
WARNING: 'GET' operation must use method name 'Get' or Method name start with 'List', 'PUT' operation must use method name 'Create', 'PATCH' operation must use method name 'Update' and 'DELETE' operation must use method name 'Delete'.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{name}/patch/operationId
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{name}/patch/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/delete/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/get/parameters[4]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/objectDataTypes/{typeName}/fields/get/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/objectDataTypes/{typeName}/fields/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/modules/{moduleName}/types/{typeName}/fields/get/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/content/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/publish/post/parameters[5]
WARNING: An operation with x-ms-long-running-operation extension must have a valid terminal success status code. 200 or 201 for Put/Patch. 200, 201 or 204 for Post. 200 or 204 or both for Delete.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/publish/post/extensions/x-ms-long-running-operation
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/undoEdit/post/parameters[5]
WARNING: 'GET' operation must use method name 'Get' or Method name start with 'List', 'PUT' operation must use method name 'Create', 'PATCH' operation must use method name 'Update' and 'DELETE' operation must use method name 'Delete'.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/content/put/operationId
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/content/put/parameters[5]
WARNING: An operation with x-ms-long-running-operation extension must have a valid terminal success status code. 200 or 201 for Put/Patch. 200, 201 or 204 for Post. 200 or 204 or both for Delete.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/draft/content/put/extensions/x-ms-long-running-operation
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/content/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/put/parameters[6]
WARNING: 'GET' operation must use method name 'Get' or Method name start with 'List', 'PUT' operation must use method name 'Create', 'PATCH' operation must use method name 'Update' and 'DELETE' operation must use method name 'Delete'.
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/patch/operationId
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{name}/patch/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/delete/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/get/parameters[4]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}/get/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/streams/get/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/put/parameters[6]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/get/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/resume/post/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/stop/post/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccount}/runbooks/{runbookName}/draft/testJob/suspend/post/parameters[5]
WARNING: Booleans are not descriptive and make them hard to use. Instead use string enums with allowed set of values defined: 'ActivityParameter/isMandatory, ActivityParameter/isDynamic, ActivityParameter/position, ActivityParameter/valueFromPipeline, ActivityParameter/valueFromPipelineByPropertyName, ActivityParameter/valueFromRemainingArguments, ModuleProperties/isGlobal, RunbookParameter/isMandatory, RunbookDraft/inEdit, RunbookCreateOrUpdateProperties/logVerbose, RunbookCreateOrUpdateProperties/logProgress, RunbookCreateOrUpdateDraftProperties/logVerbose, RunbookCreateOrUpdateDraftProperties/logProgress, RunbookPatchProperties/logVerbose, RunbookPatchProperties/logProgress, RunbookProperties/logVerbose, RunbookProperties/logProgress'.
        Path: arm-automation/compositeAutomation.json#/definitions
WARNING: Tracked Resource failing validation is: AutomationAccount. Validation Failed: 3.
    A Tracked Resource must have:
    1. A Get Operation
    2. A ListByResourceGroup operation with x-ms-pageable extension and
    3. A ListBySubscriptionId operation with x-ms-pageable extension.
    4. Type, Location, Tags should not be used in the properties.
        Path: arm-automation/compositeAutomation.json#/definitions
WARNING: Tracked resource Resource must have patch operation that at least supports the update of tags.
        Path: arm-automation/compositeAutomation.json#/definitions

@fearthecowboy
Copy link
Copy Markdown
Contributor

(posted from @vivlingaiah 's email )

I am getting the below error messages when running AutoRest using 4 separate json files in PR. Note that the PR does not have json files for all resources. The plan is to create json files in two batches.

  • Any suggestions on below? How do I resolve this? Any documents on how to fix these?
  • For 200, 201 or 204 for expected Post. Does it mean we will need to make the changes at service as well

I believe this message is saying that the operation group should be called "Streams" not "JobStreams" -- still checking on this--it's a new rule.

C:\Users\vivekl\Documents\GitHub\azure-rest-api-specs\arm-automation>autorest -input compositeAutomation.json  -CodeGenerator Azure.CSharp -Modeler CompositeSwagger > Log.txt
ERROR: Operation JobStreams_List must be one of: streams_listbysubscriptionid, streams_list, streams_listbyresourcegroup, streams_listbyjobs
        Path: compositeAutomation.json#/paths  
ERROR: Operation TypeFields_List must be one of: fields_listbysubscriptionid, fields_list, fields_listbyresourcegroup, fields_listbytypes
        Path: compositeAutomation.json#/paths
ERROR: Operation TestJobStreams_List must be one of: streams_listbysubscriptionid, streams_list, streams_listbyresourcegroup, streams_listbytestjob
        Path: compositeAutomation.json#/paths

This one is telling you that you have to have an "Operations API" that returns the methods for your whole API.

ERROR: Operations API must be implemented for the service.
        Path: compositeAutomation.json#/paths

It's telling you that the name of the operation must be called Update for operations that use HTTP PATCH

ERROR: 'PATCH' operation must use method name 'Update'.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{name}/patch/ope
rationId

In the object at:
https://github.com/Azure/azure-rest-api-specs/pull/950/files#diff-7acca12f27aeb9fdb1ec40bf6224b64fR392

the property odata.nextLink isn't in the properties definition of the object.

ERROR: The property 'odata.nextLink' specified by nextLinkName does not exist in the 200 response schema.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccou
nt}/modules/{moduleName}/activities/get/extensions/x-ms-pageable
ERROR: 'PATCH' operation must use method name 'Update'.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccou
nt}/modules/{name}/patch/operationId

It's telling you that you need to also supply a response that is "200 or 201 for Put/Patch. 200, 201 or 204 for Post. 200 or 204 or both for Delete." the 202 will eventually have to forward to a URL that isn't a 202.

ERROR: An operation with x-ms-long-running-operation extension must have a valid terminal success status code. 200 or 201 for Put/Patch. 200, 201 or 204 for Post. 200 or 204 or b
oth for Delete.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccou
nt}/runbooks/{name}/draft/publish/post/extensions/x-ms-long-running-operation

This is telling you that you must use the word Create for HTTP PUT operations

ERROR: 'PUT' operation must use method name 'Create'.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccou
nt}/runbooks/{name}/draft/content/put/operationId
ERROR: An operation with x-ms-long-running-operation extension must have a valid terminal success status code. 200 or 201 for Put/Patch. 200, 201 or 204 for Post. 200 or 204 or b
oth for Delete.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccou
nt}/runbooks/{name}/draft/content/put/extensions/x-ms-long-running-operation
ERROR: 'PATCH' operation must use method name 'Update'.
        Path: compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccou
nt}/runbooks/{name}/patch/operationId
ERROR: Tracked Resource failing validation is: AutomationAccount. Validation Failed: 3.
    A Tracked Resource must have:
    1. A Get Operation
    2. A ListByResourceGroup operation with x-ms-pageable extension and
    3. A ListBySubscriptionId operation with x-ms-pageable extension.
    4. Type, Location, Tags should not be used in the properties.
        Path: compositeAutomation.json#/definitions
ERROR: Errors found during Swagger validation
ERROR: Code generation failed.
ERROR: AutoRest.dll -input compositeAutomation.json -CodeGenerator Azure.CSharp -Modeler CompositeSwagger

@viveklingaiah viveklingaiah changed the title Swagger json files for Azure Automation accounts, runbooks, jobs and modules Swagger json file for Azure Automation accounts Mar 3, 2017
"tags": [
"AutomationAccounts"
],
"operationId": "AutomationAccounts_Patch",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can not have two operationIds in the same operation.

This isn't even valid JSON, and when I run it in AutoRest, it throws an error. (which isn't helpful yet, but is still a red flag!)

You can use tools like http://jsonlint.com/ to validate your JSON

Please correct it and update.

@viveklingaiah
Copy link
Copy Markdown
Contributor Author

committed the right account.json. I had the duplicate OperationId removed in my local file. I had not pushed it.

@fearthecowboy
Copy link
Copy Markdown
Contributor

There are still a few things left that should be fixed -- descriptions for certain.

> autorest -input https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json -CodeGenerator none -Modeler CompositeSwagger

Ignore these two

WARNING: Media types other than 'application/json' has limited support
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/consumes[2]
WARNING: Media types other than 'application/json' has limited support
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/produces[2]

For certain, fix the descriptions:

WARNING: Consider adding a 'description' element, essential for maintaining reference documentation.
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/providers/Microsoft.Automation/operations/get
automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts/get/parameters[2]

WARNING: Consider adding a 'description' element, essential for maintaining reference documentation.
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts/get

WARNING: This definition lacks the property 'description', which is required for model types
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/definitions/OperationListResult
WARNING: This definition lacks the property 'description', which is required for model types
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/definitions/Operation/properties/display
WARNING: This definition lacks the property 'description', which is required for model types
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/definitions/ErrorResponse

These are false-positives. Don't worry about these.

WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/patch/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/put/parameters[5]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/delete/parameters[4]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/get/parameters[4]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/get/parameters[3]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/paths/providers/Microsoft.Automation/operations/get/parameters[1]
WARNING: Parameters "subscriptionId" and "api-version" are not allowed in the operations section
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-

ERROR: Top level property names should not be repeated inside the properties bag for ARM resource "Resource". Properties [id, name, type, location, tags] conflict with ARM top level properties. Please rename these.
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/definitions

ERROR: Top level property names should not be repeated inside the properties bag for ARM resource "AutomationAccount". Properties [properties, etag] conflict with ARM top level properties. Please rename these.
        Path: https://github.com/AzureAutomationTeam/azure-rest-api-specs/blob/ac72df3b75765089756673c3bff43a2e5cafc044/arm-automation/compositeAutomation.json#/definitions

ERROR: Errors found during Swagger validation

@viveklingaiah
Copy link
Copy Markdown
Contributor Author

viveklingaiah commented Mar 4, 2017

Garrett, qq. what version of Autorest are you using ? You seem to get more warnings and errors. I'm using AutoRest 1.0.1.0 . Installed from https://github.com/Azure/autorest/#installing-autorest

{
"swagger": "2.0",
"info": {
"title": "AutomationManagementClient",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't put the word Client in the title anymore, since this describes the service not the client

],
"consumes": [
"application/json",
"text/json"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 'consumes' it's not really valuable to add text/json -- application/json is sufficient.

"application/json",
"text/json"
],
"produces": [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in produces it's not really valuable to add text/json -- application/json is sufficient.

Plus, do you actually ever produce text/json ? This is an advertisement of what your service will output.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be at resource level? We have only one resource that will output test/json

"operationId": "AutomationAccounts_Update",
"description": "Patch an automation account.",
"externalDocs": {
"url": "http://aka.ms/azureautomationsdk/automationaccountoperations"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The url http://aka.ms/azureautomationsdk/automationaccountoperations isn't currently valid -- are you expecting this to be created later?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, our doc team will point to the destination documentation home page

"x-ms-client-flatten": true,
"description": "Gets or sets account update properties."
},
"name": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't name and/or location be read-only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are not read-only. They are used to delete accounts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are not read-only. They are used to update accounts

Copy link
Copy Markdown
Contributor

@fearthecowboy fearthecowboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a few comments, but they apply all over the doc.

things like gets or sets.. should not be there -- instead document what the property does or how it affects things.

You should have some validations (size, range, regexes) on properties and parameters when they are coming from the user.

You should mark things as read only or required as necessary.

"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every operation MUST have a default status code in the responses section. The default corresponds to the error returned by the operation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added default response

"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every operation MUST have a default status code in the responses section. The default corresponds to the error returned by the operation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added default response

"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every operation MUST have a default status code in the responses section. The default corresponds to the error returned by the operation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added default response

"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every operation MUST have a default status code in the responses section. The default corresponds to the error returned by the operation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... for all operations ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added default response

},
"description": "The parameters supplied to the patch account properties."
},
"AutomationAccountUpdateParameters": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation of model properties MUST NOT start with the phrase Gets or sets .., Gets .., Sets ..

(for all properties).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change from Hyak? For Hyak it was requirement to have Gets or Sets in description so that user knows if it is only gettable and settable property. Here is the MSDN documentation for released SDK

https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.automation.models.automationaccountcreateorupdateproperties

Since this swagger is generation from Hyak we have gets or sets in description.

},
"description": "The parameters supplied to the create or update account properties."
},
"AutomationAccountCreateOrUpdateParameters": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are any of these required fields?

they should be marked with "required" : true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automationAccountName and AutomationAccountCreateOrUpdateParameters both have required true. those are the only 2 candidates in this file

"description": "Gets or sets the name of the resource."
},
"location": {
"type": "string",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any validation rules that should be applied on these parameters?
things like :

"maxLength": 256,
"minLength": 1,
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"

Worth reading: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-object-examples

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of our parameter validations are done in b/e web service. The reason for this is, at times we have requirements from customer to increase Max length of parameter etc., for such cases its easy to fix and deploy b/e is production. Customer needs not update the SDK for changes. For this particular case ARM validates location and return appropriate localized error if location is incorrect.

},
"description": "The response model for the list account operation."
},
"Resource": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have inconsistent spacing in this file-- please ensure that it is properly formatted at 2 space indents.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to autocorrect the indentation ?

Copy link
Copy Markdown
Contributor

@fearthecowboy fearthecowboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just some pretty weak descriptions, and please run the code thru a formatter to get 2-space indentation on your JSON.

"$ref": "#/definitions/AutomationAccount"
}
},
"default": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've still got indentation problems. (hint: paste it into http://jsonprettyprint.com/ and copy the output )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsonprettyprint adds escape backslashes. I do not think that's the right thing to do. could you confirm ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsonprettyprint adds escape backslashes. I do not think that's the right thing to do. could you confirm ?

"minLength": 6,
"maxLength": 50,
"pattern": "^[A-Za-z][-A-Za-z0-9]{4,48}[A-Za-z0-9]$",
"description": "Parameters supplied to the create or update automation account."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"description": "Parameters supplied to the create or update automation account." -- this should be something about the automationAccountName

},
"family": {
"type": "string",
"description": "sku family."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize SKU

"capacity": {
"type": "integer",
"format": "int32",
"description": "sku capcity."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize SKU

"properties": {
"sku": {
"$ref": "#/definitions/Sku",
"description": "account sku."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember, these documentation strings are used to generated the online API documentation and the inline code documentation that end users will consume.

You might want to make the content at least a readable sentence (ie, The account SKU )

"description": "account sku."
}
},
"description": "The parameters supplied to the update account properties."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the word properties -- ie, The parameters supplied to the update account.

"properties": {
"$ref": "#/definitions/AutomationAccountUpdateProperties",
"x-ms-client-flatten": true,
"description": "account update properties."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalization of sentence.

},
"description": {
"type": "string",
"description": "description."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description is not a sufficient description of the description field. I suggest a description that better articulates what the description field is describing.

"type": "string"
}
},
"description": "display properties"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description is a little brief.

"type": "string",
"minLength": 6,
"maxLength": 50,
"pattern": "^[A-Za-z][-A-Za-z0-9]{4,48}[A-Za-z0-9]$",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not add it here

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of our parameter validations are done in b/e web service. The reason for this is, at times we have requirements from customer to increase Max length of parameter etc., for such cases its easy to fix and deploy b/e is production. Customer needs not update the SDK for changes. For this particular case ARM validates location and return appropriate localized error if location is incorrect.

"type": "string",
"minLength": 6,
"maxLength": 50,
"pattern": "^[A-Za-z][-A-Za-z0-9]{4,48}[A-Za-z0-9]$",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants