Forum Discussion

tamlyn's avatar
tamlyn
New Contributor
4 years ago
Solved

Callbacks and readOnly/writeOnly

I have a question about how the readOnly and writeOnly properties relate to webhook requests.   The spec says of readOnly "This means that it MAY be sent as part of a response but SHOULD NOT be sen...
  • RonRatovsky's avatar
    4 years ago

    Generally speaking, readOnly and writeOnly take effect based on the request initiator. So, readOnly means that the consumer can only receive it and writeOnly means the consumer can only write it.

     

    Callbacks (as opposed to pre-registered webhooks) are simply a way to describe delayed responses to requests. In that case, I'd expect the behavior to be the same as a regular synchronous request/response. So the callback call itself is a response rather than a request to the consumer.

     

    Please note that in the upcoming 3.1 release of OpenAPI, there are two changes. Webhooks are being introduced as a first-class citizen to the specification, and the above explanation is not necessarily true for that. However, the definition of readOnly/writeOnly changes slightly as well to conform with JSON Schema, so it's interesting to think what kind of an impact it may have on that.