connexion
connexion copied to clipboard
Validate required fields based on readOnly & writeOnly
Fixes https://github.com/spec-first/connexion/issues/1907.
Changes proposed in this pull request:
- Add
requiredandreadOnlyvalidators to theDraft4ResponseValidatorandDraft4RequestValidatorobjects
Let me know if anything else needs adjustments.
This regresses #942. readOnly should not result in a HTTP 400 when the field is present, since OpenAPI only says that the field "SHOULD NOT be sent as part of the request", not "MUST NOT".
Arguably the same should apply for writeOnly, but the user can at least control the responses they sent back, yet they cannot control what API clients will do.
(To fix #942 here, all one needs to do is make validate_readOnly a no-op. It cannot be removed from the validator map, however, without changing how validate_required detects it.)