Forum Discussion
mhiggins
Staff
examples: foo: summary: A foo example value: {"foo": "bar"} bar: summary: A bar example value: {"bar": "baz"} 'application/xml': examples: xmlExample: summary: This is an example in XML externalValue: 'http://example.org/examples/address-example.xml'
andreiclara
3 years agoNew Contributor
Thank you for your answer, but I don't understand where I can add this example. I was trying to add example in external file "examples.json". The code above should be added in "examples.json" or in swagger.yaml? And what section should I add it? In the responses or schema examples?
Thank you
- chichepo3 years agoChampion Level 1
Hi andreiclara
the examples are defined under the components clause as shown herelook here for further examples.
Another solution is to save your examples collection within a domain.
In such case, your Domain is defining all your "reusable" definitions, under the components clause.For example:
In the API file:
In the Domain file:
Let us know if it is enough clear
Related Content
- 10 months ago
Recent Discussions
- 16 days ago
- 2 months ago