Use the required array:
http://json-schema.org/example2.html <http://json-schema.org/example2.html>
for your example you would say:
required:
- attributeA
- attributeB
properties:
attributeA:
type: string
# etc.
> On Jan 13, 2017, at 6:53 AM, [email protected] wrote:
>
> How do i specify optional and variable object properties in swagger?
>
> For example, let's say my JSON is structured like this:
>
> {
> "name": "Test object 1",
> "attributeA": "Some kind of text",
> "attributeB": "Another kind of text"
> },
> {
> "name": "Test object 2",
> "attributeC": "A different kind of text"
> }
>
> Now, let's assume that there could be dozens of optional keys associated with
> a given object. And these keys might be added to or changed over time
> arbitrarily.
>
> How do i specify these without having to enumerate all of them in the API
> response documentation?
>
> Thanks for your help!
>
> nick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.