The following is in the 3.1 dev spec:
{
"description": "A simple string response",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
The intention is that the response body contains an arbitrary string, e.g.:
However, this would be invalid given the above JSON schema. A correct response would be:
It seems like the spec ignores this inconsistency and somehow implicitly turns JSON schema off in cases where the type is primitive (or just for strings?). The same is true here:
content:
image/png:
schema:
type: string
contentEncoding: base64
A valid body would be:
But that is again not the intention here.
In summary, I'm missing some language in the spec that describes this behavior explicitly.
Slightly unrelated, there's another example which confuses me:
{
"description": "user to add to the system",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
Is this supposed to be for example ["Hello", "world!"]? If so, why is the content type text/plain instead of application/json?
The following is in the 3.1 dev spec:
{ "description": "A simple string response", "content": { "text/plain": { "schema": { "type": "string" } } } }The intention is that the response body contains an arbitrary string, e.g.:
However, this would be invalid given the above JSON schema. A correct response would be:
"Hello world!"It seems like the spec ignores this inconsistency and somehow implicitly turns JSON schema off in cases where the type is primitive (or just for strings?). The same is true here:
A valid body would be:
"SGVsbG8gd29ybGQh"But that is again not the intention here.
In summary, I'm missing some language in the spec that describes this behavior explicitly.
Slightly unrelated, there's another example which confuses me:
{ "description": "user to add to the system", "content": { "text/plain": { "schema": { "type": "array", "items": { "type": "string" } } } } }Is this supposed to be for example
["Hello", "world!"]? If so, why is the content typetext/plaininstead ofapplication/json?