microsoft / microsoft/typespec

@example decorator not showing on a @path or @query components

Open
#8,049 0 comments 0 reactions 0 assignees View on GitHub
bug emitter:openapi3 triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

As seen below, you will notice only the body properties retains the `example` field in the generated spec.

[Playground Link](https://typespec.io/playground/?options=%7B%22linterRuleSet%22%3A%7B%22extends%22%3A%5B%22%40typespec%2Fhttp%2Fall%22%5D%7D%7D&c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBIdHRwOwpAc2VydmljZSgjeyB0aXRsZTogIldpZGdldCBTxhoiIH0pCm5hbWVzcGFjZSBEZW1vxxo7CgpAZXJyb3IKbW9kZWwgRcQMIHsKICBjb2RlOiBpbnQzMjsKICBtZXNzYWdlOiBzdHJpbmc7Cn0KxzPGa1JlcXVlc3TFO0BleGFtcGxlKDEpxA5kb2MoIlF1ZXJ5IFRlc3QixRVxxBAKICDFCF90ZXN0yW3MQjLKQkJvZMtBYm9k2zczyjdQYXRoy3hwYXRoCiAgxAfOP%2B8A0OUAyXllczogIsQnIsUhQHJvdXRlKCIvd8UkcyIpCkB0YWco5wFvxBBpbnRlcmbkAWbHFMVJLyoqIExpc3QgxzkgKi%2FlAI1vc3QgcmV0cmlldmUoLi4u7QFMKTrHRCB85gGY5ACE&e=%40typespec%2Fopenapi3&vs=%7B%7D)

If you take the generated spec, and paste it on the swagger site: https://editor.swagger.io/ , you can append `example` to these schema definitions and witness it render with the example.

Request to have this behavior on compile.

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.