Examples referencing other examples #3902
mcrobbj
started this conversation in
Enhancements
Replies: 2 comments 3 replies
|
@mcrobbj I hope you don't mind I formatted your examples with syntax highlighting :-) Unfortunately this is not supported, because the example value is a literal value. In some cases, you will want a literal property The way to work around this is to use the Example Object's |
2 replies
|
Perhaps, I would have to see some concrete examples, seems like a simple
ask for the main spec?
…On Fri, 6 Jun 2025 at 18:03, Henry Andrews ***@***.***> wrote:
@mcrobbj <https://github.com/mcrobbj> I wonder if overlays
<https://github.com/OAI/Overlay-Specification> could help here? As noted,
the problem is that we can't support $ref inside examples because then
you couldn't have examples that used properties named "$ref". But overlays
modify things from outside of the main specification document, so you could
use that to build up more complex examples. I think.
—
Reply to this email directly, view it on GitHub
<#3902 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQL2EE5ZGYKLEL7PBMFO2T3CHCXZAVCNFSM6AAAAAB6YRJZWOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMZZGI2TKNY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
So for example I have an example address which I want to refrence in an example customer:
This is accepted, however in Swagger Editor it appears as
{ "total": 1, "page": 1, "pageSize": 1, "customers": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "phone": "+1234567890", "address": { "$ref": "#/components/examples/address" } } ] }Is this supported and if so what am I doing wrong?
{ "total": 1, "page": 1, "pageSize": 1, "customers": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "phone": "+1234567890", "address": { "address1": "41 Main Street", "address2": "Morningside", "address3": "Edinburgh", "address4": "Lothian", "postCode": "EH21 8TF" } } ] }Is the desired result
All reactions