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

Remove 4xx responses and change schema to file #3363

Merged
merged 2 commits into from
Jul 12, 2018
Merged

Remove 4xx responses and change schema to file #3363

merged 2 commits into from
Jul 12, 2018

Conversation

vrdmr
Copy link
Member

@vrdmr vrdmr commented Jul 5, 2018

Removing the 4xx response codes and changing the schema from string to file to unblock the SDK serialization issue.
FYI: @najams @shahabhijeet


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

@AutorestCI
Copy link

AutorestCI commented Jul 5, 2018

Automation for azure-sdk-for-python

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

@AutorestCI
Copy link

AutorestCI commented Jul 5, 2018

Automation for azure-sdk-for-java

Nothing to generate for azure-sdk-for-java

@AutorestCI
Copy link

AutorestCI commented Jul 5, 2018

Automation for azure-sdk-for-ruby

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

@AutorestCI
Copy link

AutorestCI commented Jul 5, 2018

Automation for azure-sdk-for-node

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

@AutorestCI
Copy link

AutorestCI commented Jul 5, 2018

Automation for azure-sdk-for-go

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

@hovsepm
Copy link
Contributor

hovsepm commented Jul 6, 2018

@vrdmr could you provide some context on what does it mean "unblock the SDK serialization issue."? As for current status of your PR - you are introducing breaking changes to stable API version.

@jhendrixMSFT
Copy link
Member

@AutorestCI regenerate azure-sdk-for-go

@vrdmr
Copy link
Member Author

vrdmr commented Jul 9, 2018

@hovsepm The serialization issue in dotnet 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 a serialization issues and is breaking out current SDK users (our SDK is still in the preview though).

Thus, for runbooks resource, I am reverting it to be back to where it was, before #2466. After discussing with @shahabhijeet, he and I thought it would be best to get the spec back to its original shape.

@hovsepm
Copy link
Contributor

hovsepm commented Jul 9, 2018

@vrdmr the issue you pointed out in Slack channel is about "2017-05-15-preview" version - why do you have breaking changes in version 2015-10-31 which is marked as stable and I assume was shipped?

@vrdmr
Copy link
Member Author

vrdmr commented Jul 9, 2018

@hovsepm The #2466 PR made the changes in bot 2015-10-31 (Runbooks) and 2017-05-15-preview (Jobs) resources. For the GetContent call in the runbooks.json resource, the change was added in #2466 (Link to Blame).

@vrdmr
Copy link
Member Author

vrdmr commented Jul 11, 2018

Ping @hovsepm.

@hovsepm
Copy link
Contributor

hovsepm commented Jul 11, 2018

@vrdmr I'm asking about service response changes - in many places your change removes 409 return codes. These are new breaking changes in the existing stable API version.

@vrdmr
Copy link
Member Author

vrdmr commented Jul 11, 2018

@hovsepm Yes, we are removing 409 here and other places as in the SDKs, they are being returned as successful and not generating exceptions, which they should. This was caught by @dsgouda in the AzureSDK PR. We do want exceptions being thrown for an error case, whereas currently, it would not raise for any.

@hovsepm
Copy link
Contributor

hovsepm commented Jul 11, 2018

@vrdmr you do realize that there are many applications that are already shipped using API version 2015-10-31 that do use 409 as return code and have some logic to handle that return codes. Changing it to throw an exception will cause breaks for any patch in the code that will use latest generated SDK. I'd strongly suggest to change return types to exception only in the new/preview API version.

@vrdmr
Copy link
Member Author

vrdmr commented Jul 11, 2018

@hovsepm Updated the Spec. Could you please review and merge this PR.

Thanks,
Varad

@hovsepm
Copy link
Contributor

hovsepm commented Jul 12, 2018

@vrdmr please fix model validation errors:

[]
  id: 'OAV108',
  message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Get Job Output" in operation "Job_GetOutput".:\n',
  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: [] } ],
  level: '\u001b[31merror\u001b[39m',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: 
   [ { code: 'RESPONSE_VALIDATION_ERROR',
       id: 'OAV108',
       message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Get Job Output" in operation "Job_GetOutput".',
       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: [] } ] } ],
  [Symbol(message)]: '{"code":"RESPONSE_VALIDATION_ERROR","id":"OAV108","message":"Found errors in validating the response with statusCode \\"200\\" for x-ms-example \\"Get Job Output\\" in operation \\"Job_GetOutput\\".:\\n","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":[]}],"level":"error"}' }
{ code: 'RESPONSE_VALIDATION_ERROR',
  id: 'OAV108',
  message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Get Job Runbook Content" in operation "Job_GetRunbookContent".:\n',
  innerErrors: 
   [ { code: 'INVALID_CONTENT_TYPE',
       message: 'Invalid Content-Type (text/powershell).  These are supported: application/json',
       path: [] },
     { 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: [] } ],
  level: '\u001b[31merror\u001b[39m',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: 
   [ { code: 'RESPONSE_VALIDATION_ERROR',
       id: 'OAV108',
       message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Get Job Runbook Content" in operation "Job_GetRunbookContent".',
       innerErrors: 
        [ { code: 'INVALID_CONTENT_TYPE',
            message: 'Invalid Content-Type (text/powershell).  These are supported: application/json',
            path: [] },
          { 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: [] } ] } ],
  [Symbol(message)]: '{"code":"RESPONSE_VALIDATION_ERROR","id":"OAV108","message":"Found errors in validating the response with statusCode \\"200\\" for x-ms-example \\"Get Job Runbook Content\\" in operation \\"Job_GetRunbookContent\\".:\\n","innerErrors":[{"code":"INVALID_CONTENT_TYPE","message":"Invalid Content-Type (text/powershell).  These are supported: application/json","path":[]},{"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":[]}],"level":"error"}' }
{ AssertionError [ERR_ASSERTION]: swagger "specification/automation/resource-manager/Microsoft.Automation/preview/2017-05-15-preview/job.json" contains model validation errors.
    at Context.<anonymous> (/home/travis/build/Azure/azure-rest-api-specs/test/model.js:20:16)
    at <anonymous>
  generatedMessage: false,
  name: 'AssertionError [ERR_ASSERTION]',
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '==' }
{ 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".:\n',
  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: [] } ],
  level: '\u001b[31merror\u001b[39m',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: 
   [ { 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: [] } ] } ],
  [Symbol(message)]: '{"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\\".:\\n","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":[]}],"level":"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.',
  innerErrors: undefined,
  level: '\u001b[31merror\u001b[39m',
  [Symbol(level)]: 'error',
  [Symbol(message)]: '{"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.","level":"error"}' }
{ 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".:\n',
  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.',
       innerErrors: undefined,
       level: 'error',
       [Symbol(level)]: 'error',
       [Symbol(message)]: '{"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.","level":"error"}' } ],
  level: '\u001b[31merror\u001b[39m',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: 
   [ { 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.',
            innerErrors: undefined,
            level: 'error',
            [Symbol(level)]: 'error',
            [Symbol(message)]: '{"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.","level":"error"}' } ] } ],
  [Symbol(message)]: '{"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\\".:\\n","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.","level":"error"}],"level":"error"}' }
{ 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".:\n',
  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: [] } ],
  level: '\u001b[31merror\u001b[39m',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: 
   [ { 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: [] } ] } ],
  [Symbol(message)]: '{"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\\".:\\n","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":[]}],"level":"error"}' }

@hovsepm
Copy link
Contributor

hovsepm commented Jul 12, 2018

@vrdmr ignore the error.

@hovsepm hovsepm merged commit 8f83ec5 into Azure:master Jul 12, 2018
@vrdmr vrdmr deleted the vameru-minorfixes-automationspec branch July 16, 2018 18:22
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.

4 participants