Azure / Azure/azure-functions-openapi-extension

Spectral Lint - OpenApiExample resulting in error oas3-valid-schema-example "example" property type must be object when linting

Open
#563 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

I am creating example for requests and responses and within openapi doc that is generated example is shown to be serialized as a string. I believe this is why my pipeline fails on the spectral lint task.

error oas3-valid-schema-example "example" property type must be object

If I look at the specification then examples should indeed be objects but I imagine many people are generating example requests and responses from Azure functions swagger openapi v3.json/yaml and seeing the same thing whereby example is a string.

Note that the example once loaded into APIM works correctly, it must deserialize the string within 'Try It' option of developer portal

I thought it would be worth me putting together a sample solution:
https://github.com/dannythomas13/Org.Project.ExampleFuncApi

which produces the attached files and you may notice that the schema result example is a string
[example-v3.yaml.txt](https://github.com/Azure/azure-functions-openapi-extension/files/10940089/example-v3.yaml.txt)
[example-v3.json.txt](https://github.com/Azure/azure-functions-openapi-extension/files/10940090/example-v3.json.txt)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.