Problem/Motivation
We want to enforce that custom added parameters (maybe through extensions) will conform to the specification names: http://jsonapi.org/format/upcoming/#document-member-names
Proposed resolution
Add a validation step in the JsonApiParamEnhancer to validate the parameter names. The official parameters needn't be validated.
Invalid parameter names will not trigger an error, but they will not be added to the _json_api_params. This is to allow external parameters like XDEBUG_SESSION_START.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2745537--param-validation--12.patch | 6.44 KB | e0ipso |
| #8 | interdiff.txt | 2.23 KB | dawehner |
| #8 | 2745537-8.patch | 6.4 KB | dawehner |
| #5 | 2745537-5.patch | 6.05 KB | dawehner |
| #3 | 2745537-3-test.patch | 1.99 KB | dawehner |
Comments
Comment #2
e0ipsoComment #3
dawehnerThis is just a list of tests we should have. Whether this belongs onto the
\Drupal\jsonapi\Routing\JsonApiParamEnhancerI'm not sure. We could have an access checker, which does that kind of validation. Seems to be a bit of a better semantic place to do so.Comment #4
e0ipso+1
Comment #5
dawehnerComment #6
e0ipsoOne step closer to full compliance with the standard! Thanks @dawehner. This is almost done. I added a couple of minor suggestions.
Let's have a docblock with {@inheritdoc}'s.
Let's have a docblock with {@inheritdoc}'s.
Is there any reason not to use Drupal's base UnitTestCase?
Please add the
@covers ::accessannotationMaybe
|?Not sure if you can check those into a text file in git. Let's leave them out.
Comment #7
e0ipsoComment #8
dawehnerComment #11
e0ipsoThis looks perfect to me. We just need a re-roll.
Comment #12
e0ipsoRe-roll.
Comment #14
e0ipsoFixed and merged.
Comment #15
e0ipsoComment #16
dawehnerThank you @e0ipso!