Closed atancasis closed 3 years ago
Thanks for the kind words and the test case ❤️
This should be fixed in the upcoming release.
thank you so much @jhthorsen, much much appreciated! 🙏
It was very easy to fix when you submitted such a detailed bug report 👍
Attribute marked as
writeOnly
can't be included in therequired
list as response validation would otherwise fail with aMissing property
error.According to OAS3, the
writeOnly
attribute, as excerpted from here:However, as mentioned, response validation appears to still be expecting these
writeOnly
attributes to be returned as part of the response.Outlined below is a test suite illustrating this scenario:
This test suite illustrates 2 endpoints (
POST /base
andPOST /required
) which takes in anapp_id
and returns anid
.Note that the only difference between the
Base
and theRequired
schema is marking thewriteOnly
property,app_id
, asrequired
in the latter.Running the outlined/attached test suite with
MOJO_CLIENT_DEBUG=1
will illustrate thatPOST /required
fails with a 500 with the following response:We have been using this excellent plugin extensively for over a year now in our core API (thanks for the excellent, excellent work!) and we have been working around this issue by creating 3 schemas (1 for the request and 1 for the response, each composed from a base) but it would be really nice if
writeOnly
andrequired
can be supported from this library.Please don't hesitate to let me know if there's any additional details that I can provide. Thanks!