jsonapi_parameters icon indicating copy to clipboard operation
jsonapi_parameters copied to clipboard

[OS-17] JSON Schema validation

Open Marahin opened this issue 5 years ago • 3 comments

Unknown(s), to debate(s), discussables:

  • Where should we raise JsonApi::Parameters translator errors? In which cases? This is important, because if we do not raise an error, then in the default behaviour - no validation will happen.
  • How to handle JSON Schema invalidation / updates?

Marahin avatar Aug 25 '20 15:08 Marahin

Things left to do:

  • make the schema more liberal for root path keys OR handle removal of action, controller and other Rails-specific middleware parameters that are added during the request cycle to the ActionController::Parameters object instance (right now they are validated as well and the schema makes a note about it that these are not recognized or expected keys),
  • find out how to handle this as a major or minor (non-breaking) version

Marahin avatar Oct 01 '20 12:10 Marahin

The current version works "good enough" for us at LL, there are exactly 3 tests failing and they are just nontypical usage of jsonapi-parameters . Our recommendation is for the current version to be merged but with at least the "MINOR" version increase

ipepe avatar Oct 28 '20 15:10 ipepe

@ipepe I'm wondering whether other users may see a breaking change while updating. If I understand correctly, you are experiencing this, so this would imply a breaking change version bump.

Could you share (perhaps in a confidential environment) what are the non-typical usages? Specific code lines where you execute jsonapi_parameters translation?

Maybe this way we could provide an interface that would not enforce the change so the existing users would be able to take control over the update.

Marahin avatar Oct 29 '20 09:10 Marahin