Azure / Azure/azure-rest-api-specs

[Automation] Correct the provided x-ms-examples

Open
#1,133 1 comment 0 reactions 0 assignees View on GitHub
Automation P1 Service Attention Service-team
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 37m
Merged PRs (30d)
446

Description

Here is the sample issues for "account.json"

```json5
$ node cli.js validate-example /Users/vishrut/git-repos/azure-rest-api-specs/arm-automation/2015-10-31/swagger/account.json
error: Found errors in validating the response with statusCode "200" for x-ms-example "Update an automation account" in operation "AutomationAccount_Update".:

{ code: 'RESPONSE_VALIDATION_ERROR',
message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Update an automation account" in operation "AutomationAccount_Update".',
innerErrors:
[ { code: 'INVALID_RESPONSE_BODY',
errors:
[ { code: 'INVALID_TYPE',
params: [ 'integer', 'null' ],
message: 'Expected type integer but found type null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_FORMAT',
params: [ 'int32', null ],
message: 'Object didn\'t pass validation for format int32: null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'properties', 'sku', 'family' ],
description: 'Gets or sets the SKU family.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'etag' ],
description: 'Gets or sets the etag of the resource.' } ],
message: 'Invalid body: Value failed JSON Schema validation',
path: [] } ] }
error: Found errors in validating the response with statusCode "200" for x-ms-example "Create or update automation account" in operation "AutomationAccount_CreateOrUpdate".:

{ code: 'RESPONSE_VALIDATION_ERROR',
message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Create or update automation account" in operation "AutomationAccount_CreateOrUpdate".',
innerErrors:
[ { code: 'INVALID_RESPONSE_BODY',
errors:
[ { code: 'INVALID_TYPE',
params: [ 'integer', 'null' ],
message: 'Expected type integer but found type null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_FORMAT',
params: [ 'int32', null ],
message: 'Object didn\'t pass validation for format int32: null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'properties', 'sku', 'family' ],
description: 'Gets or sets the SKU family.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'etag' ],
description: 'Gets or sets the etag of the resource.' } ],
message: 'Invalid body: Value failed JSON Schema validation',
path: [] } ] }
error: Found errors in validating the response with statusCode "201" for x-ms-example "Create or update automation account" in operation "AutomationAccount_CreateOrUpdate".:

{ code: 'RESPONSE_VALIDATION_ERROR',
message: 'Found errors in validating the response with statusCode "201" for x-ms-example "Create or update automation account" in operation "AutomationAccount_CreateOrUpdate".',
innerErrors:
[ { code: 'INVALID_RESPONSE_BODY',
errors:
[ { code: 'INVALID_TYPE',
params: [ 'integer', 'null' ],
message: 'Expected type integer but found type null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_FORMAT',
params: [ 'int32', null ],
message: 'Object didn\'t pass validation for format int32: null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'properties', 'sku', 'family' ],
description: 'Gets or sets the SKU family.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'etag' ],
description: 'Gets or sets the etag of the resource.' } ],
message: 'Invalid body: Value failed JSON Schema validation',
path: [] } ] }
error: Found errors in validating the response with statusCode "200" for x-ms-example "Get automation account" in operation "AutomationAccount_Get".:

{ code: 'RESPONSE_VALIDATION_ERROR',
message: 'Found errors in validating the response with statusCode "200" for x-ms-example "Get automation account" in operation "AutomationAccount_Get".',
innerErrors:
[ { code: 'INVALID_RESPONSE_BODY',
errors:
[ { code: 'INVALID_TYPE',
params: [ 'integer', 'null' ],
message: 'Expected type integer but found type null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_FORMAT',
params: [ 'int32', null ],
message: 'Object didn\'t pass validation for format int32: null',
path: [ 'properties', 'sku', 'capacity' ],
description: 'Gets or sets the SKU capacity.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'properties', 'sku', 'family' ],
description: 'Gets or sets the SKU family.' },
{ code: 'INVALID_TYPE',
params: [ 'string', 'null' ],
message: 'Expected type string but found type null',
path: [ 'etag' ],
description: 'Gets or sets the etag of the resource.' } ],
message: 'Invalid body: Value failed JSON Schema validation',
path: [] } ] }

```

Please run this against all the swagger spec and correct the examples. Thanks

Reference PR https://github.com/Azure/azure-rest-api-specs/pull/1045 with the travis build https://travis-ci.org/Azure/azure-rest-api-specs/jobs/219461491

Contributor guide

Open the contributing guide

Research direction

Start with arm-automation/2015-10-31/swagger/account.json and run `node cli.js validate-example` as shown in the issue. Inspect each reported x-ms-example response, correct values that fail schema validation, then repeat the validation across the swagger specs until all examples pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, openapi
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.