Conversation
lib/jsonapi_parameters/default_handlers/to_many_relation_handler.rb
Outdated
Show resolved
Hide resolved
Co-authored-by: Paweł Strzałkowski <p.strzalkowski@visuality.pl>
when they should be
Co-authored-by: Patryk Ptasiński <p.ptasinski@visuality.pl>
|
Things left to do:
|
035acc5 to
e9f8b7b
Compare
|
The current version works "good enough" for us at LL, there are exactly 3 tests failing and they are just nontypical usage of |
|
@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. |
| @@ -0,0 +1,397 @@ | |||
| { | |||
| "$schema": "http://json-schema.org/draft-06/schema#", | |||
There was a problem hiding this comment.
Even now 07 is not edge: http://json-schema.org/draft/2019-09/release-notes.html
I believe we should resolve the subject of version update (and whether it can be minor upgrade) in our library and then we can think about moving on to next version of schema.
There was a problem hiding this comment.
https://json-schema.org/draft/2019-09/schema
that's right. Therefore the draft was upgraded also in article linked in repo 👍
There was a problem hiding this comment.
davishmcclurg/json_schemer#44
is supporting max draft-07 currently according to readme
There was a problem hiding this comment.
Therefore the draft was upgraded also in article linked in repo 👍
I have no clue which article or link you are talking about.
There was a problem hiding this comment.
There was a problem hiding this comment.
oh wrong link: https://polythematik.de/2020/02/17/ruby-json-schema/
| end | ||
| @jsonapi_unsafe_hash = ensure_naming(params, naming_convention) | ||
|
|
||
| JsonApi::Parameters::Validator.new(@jsonapi_unsafe_hash.deep_dup).validate! if should_prevalidate? |
There was a problem hiding this comment.
validate! has been provided by rails >= 5.0
So this solution limits the benefits for rails 4.0, which are not maintained anymore.
Michał Książek is coding solution to change that
There was a problem hiding this comment.
That should be pretty easy to overcome, as #validate is present since Rails 4.2.1: https://apidock.com/rails/v4.2.1/ActiveModel/Validations/validate
So perhaps it is worth to check whether this method is defined, and if not, then just call validate and raise on failure.
There was a problem hiding this comment.
Since we already limit ourselves to >= 4.1.8, we might as well limit ourselves to 4.2.1.
https://github.com/visualitypl/jsonapi_parameters/blob/master/jsonapi_parameters.gemspec#L25
There was a problem hiding this comment.
We spoke with Michał to drop activeModel validation at all - it does not provide big value
There was a problem hiding this comment.
Indeed from what I can see in the upcoming PR to this branch, this seems like a move in good direction. We just have to ensure this will be a solid solution, as this will be something technically "invented here" whereas up until this point we have used proven and well tested ActiveModel validations.
Unknown(s), to debate(s), discussables: