Skip to content
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

Fixing the spec for DSCConfigurations. #3749

Merged
merged 2 commits into from
Aug 28, 2018
Merged

Fixing the spec for DSCConfigurations. #3749

merged 2 commits into from
Aug 28, 2018

Conversation

vrdmr
Copy link
Member

@vrdmr vrdmr commented Aug 28, 2018

Description

The correct type was not being returned. This is in line with the fixes done in #3363.

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

@AutorestCI
Copy link

AutorestCI commented Aug 28, 2018

Automation for azure-sdk-for-java

Nothing to generate for azure-sdk-for-java

@AutorestCI
Copy link

AutorestCI commented Aug 28, 2018

Automation for azure-sdk-for-python

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-python#3125

@AutorestCI
Copy link

AutorestCI commented Aug 28, 2018

Automation for azure-sdk-for-ruby

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-ruby#1579

@vrdmr
Copy link
Member Author

vrdmr commented Aug 28, 2018

The serialization issue in dotnet/Go SDK is mentioned in details here (slack link), but tl;dr is that Autorest generates code which expects the output schema to be json and we return file. This causes serialization issues and is breaking out current SDK users (our SDK is still in the preview though).

FYI @vladbarosan @jhendrixMSFT

@AutorestCI
Copy link

AutorestCI commented Aug 28, 2018

Automation for azure-sdk-for-go

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-go#2565

@AutorestCI
Copy link

AutorestCI commented Aug 28, 2018

Automation for azure-sdk-for-node

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-node#3290

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

Copy link
Member

@jhendrixMSFT jhendrixMSFT left a comment

Choose a reason for hiding this comment

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

This is causing the linter to fail on the example. See the log. I think the body needs to be tweaked slightly, see https://github.com/Azure/azure-rest-api-specs/blob/master/specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/getRunbookDraftContent.json which is very similar.

@jhendrixMSFT jhendrixMSFT requested review from jhendrixMSFT and removed request for anuchandy August 28, 2018 19:48
@vrdmr
Copy link
Member Author

vrdmr commented Aug 28, 2018

@jhendrixMSFT I'll take a look and send the fix asap.

@vrdmr
Copy link
Member Author

vrdmr commented Aug 28, 2018

@jhendrixMSFT The problem is with Autorest as well as our spec. We could have done better design and returned a JSON response. Also, autorest does not understand schema of type:file well.

When I run oav validate-example Microsoft.Automation/stable/2015-10-31/runbook.json, I get the same issue with runbook as well.

error: Found errors in validating the response with statusCode "200" for x-ms-example "Get runbook draft content" in operation "RunbookDraft_GetContent".:

{ code: 'RESPONSE_VALIDATION_ERROR',
  id: 'OAV108',
  message:
   'Found errors in validating the response with statusCode "200" for x-ms-example "Get runbook draft content" in operation "RunbookDraft_GetContent".',
  innerErrors:
   [ { code: 'INVALID_RESPONSE_BODY',
       errors:
        [ { code: 'INVALID_TYPE',
            params: [ 'file', 'string' ],
            message: 'Expected type file but found type string',
            path: [] } ],
       message: 'Invalid body: Expected type file but found type string',
       path: [] } ] }
error:
{ code: 'RESPONSE_STATUS_CODE_NOT_IN_EXAMPLE',
  id: 'OAV111',
  message:
   'Following response status codes "200" for operation "RunbookDraft_ReplaceContent" were present in the swagger spec, however they were not present in x-ms-examples. Please provide them.' }
error: Found errors in validating the response with statusCode "200" for x-ms-example "Create or update runbook draft" in operation "RunbookDraft_ReplaceContent".:

{ code: 'RESPONSE_VALIDATION_ERROR',
  id: 'OAV108',
  message:
   'Found errors in validating the response with statusCode "200" for x-ms-example "Create or update runbook draft" in operation "RunbookDraft_ReplaceContent".',
  innerErrors:
   [ { code: 'RESPONSE_STATUS_CODE_NOT_IN_EXAMPLE',
       id: 'OAV111',
       message:
        'Following response status codes "200" for operation "RunbookDraft_ReplaceContent" were present in the swagger spec, however they were not present in x-ms-examples. Please provide them.' } ] }
error: Found errors in validating the response with statusCode "200" for x-ms-example "Get runbook content" in operation "Runbook_GetContent".:

{ code: 'RESPONSE_VALIDATION_ERROR',
  id: 'OAV108',
  message:
   'Found errors in validating the response with statusCode "200" for x-ms-example "Get runbook content" in operation "Runbook_GetContent".',
  innerErrors:
   [ { code: 'INVALID_RESPONSE_BODY',
       errors:
        [ { code: 'INVALID_TYPE',
            params: [ 'file', 'string' ],
            message: 'Expected type file but found type string',
            path: [] } ],
       message: 'Invalid body: Expected type file but found type string',
       path: [] } ] }

For DSCConfiguration

$ oav validate-example Microsoft.Automation/stable/2015-10-31/dscConfiguration.json
error: Found errors in validating the response with statusCode "200" for x-ms-example "Get DSC Configuration content" in operation "DscConfiguration_GetContent".:

{ code: 'RESPONSE_VALIDATION_ERROR',
  id: 'OAV108',
  message:
   'Found errors in validating the response with statusCode "200" for x-ms-example "Get DSC Configuration content" in operation "DscConfiguration_GetContent".',
  innerErrors:
   [ { code: 'INVALID_RESPONSE_BODY',
       errors:
        [ { code: 'INVALID_TYPE',
            params: [ 'file', 'string' ],
            message: 'Expected type file but found type string',
            path: [] } ],
       message: 'Invalid body: Expected type file but found type string',
       path: [] } ] }

@jhendrixMSFT jhendrixMSFT merged commit f70ed14 into Azure:master Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants