Skip to content

[EventGrid] Swagger ModelValidation INVALID_TYPE #25381

Open
@mikeharder

Description

@mikeharder

Check Swagger ModelValidation is failing on EventGrid with this error:

##[error]Validating "examples" and "x-ms-examples" in  specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json:
 error : 
code: INVALID_TYPE
message: Expected type  but found type object
schemaUrl: >-
  specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
exampleUrl: >-
  specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/examples/publish.json
schemaPosition:
  line: 82
  column: 22
schemaJsonPath: !<tag:yaml.org,2002:js/undefined> ''
examplePosition:
  line: 24
  column: 16
exampleJsonPath: $response.200/body
severity: 0
source: response
operationId: PublishCloudEvents
level: error

https://github.com/Azure/azure-rest-api-specs/pull/25323/checks?check_run_id=15930723858

From @johanste:

It looks to me like validation of examples of APIs that return an empty object may be incorrect. There is (or at least was) some ambiguity between not returning anything and returning an empty object in x-ms-examples. For the longest time it didn't matter, but at some point it was decided by the REST API review board that returning nothing was bad and empty object preferred.

I believe this behavior is coded here:

https://github.com/Azure/oav/blob/760a3352a04ebfcd2e9a1d05c7ad4925f20caa2c/lib/swaggerValidator/modelValidator.ts#L744

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions