tony tam writes:
> I think you re describing that a value can be null or an object , forgetting
> specification semantics. That would be done with the required flag unless I m
> misunderstanding something thing.
I'm talking about response objects, a returned object may be:
{
"id": 12345,
"name": "John Doe",
"foo": {...a complex object...}
}
Think RDB where column foo is a reference to another table and
nullable. I always want to return "foo" to the clients, so its either
null or the complex object (the serialization of the row from the
other table).
And because a Foo is a complex object I want to create a definition of
it and reference it, keeping my spec DRY:
{
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"foo": {
"$ref": "#/definitions/Foo"
}
},
type: "object"
}
With oneOf, I can make foo:
"foo": {
oneOf: [
{"$ref": "#/definitions/Foo"},
{"type": "null"}
]
}
How can I do this now?
--
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.