JSON:API uses this library to validate its responses for compliance with the JSON:API specification: https://github.com/justinrainbow/json-schema
#2843147: Add JSON:API to core as a stable module would add this dependency, but this issue breaks it out so this change can receive a separate review and sign-off.
This would be a dev dependency only. It is not a hard dependency of JSON:API, it's used only to verify that our responses comply with the JSON:API spec (https://jsonapi.org/format/).
justinrainbow/json-schema-
- Code quality: documented, comprehensive tests
- Maintainership of the package: recent releases (latest release was in Jan. 2019); apparently actively maintained.
- Security policies of the package: yes, best effort: https://github.com/justinrainbow/json-schema/issues/569#issuecomment-469...
- Expected release and support cycles: yes: https://github.com/justinrainbow/json-schema/issues/569#issuecomment-469...
- Other dependencies it'd add, if any:
"require": { "php": ">=5.3.3", "marc-mabe/php-enum": "2.3.1", "icecave/parity": "1.0.0" }
marc-mabe/php-enum-
- Code quality: documented, comprehensive tests
- Maintainership of the package: recent releases (latest release was in Feb. 2019); apparently actively maintained, however, the 2.x branch which
justinrainbow/json-schemauses has not seen releases since Dec. 2016. - Security policies of the package: unknown, asked in https://github.com/marc-mabe/php-enum/issues/112
- Expected release and support cycles: undocumented; sporadic releases, asked in https://github.com/marc-mabe/php-enum/issues/112
- Other dependencies it'd add, if any:
"require": { "php": ">=5.6", "ext-reflection": "*" },
icecave/parity-
- Code quality: documented, comprehensive tests
- Maintainership of the package: recent releases (latest release was in Nov. 2018); apparently actively maintained, however, the 1.x branch which
justinrainbow/json-schemauses has not seen releases since 2014. (It seems that the 2.x branch's creation was triggered by the PHP 5 EOL.) - Security policies of the package: unknown, asked in https://github.com/IcecaveStudios/parity/issues/15
- Expected release and support cycles: undocumented; sporadic releases, asked in https://github.com/IcecaveStudios/parity/issues/15
- Other dependencies it'd add, if any:
"require": { "php": "^7", "icecave/repr": "^1" },
icecave/repr- Looking at the depending library
icecave/parity, theicecave/reprlibrary is used only for generating an exception message: https://github.com/IcecaveStudios/parity/search?q=repr&unscoped_q=repr. -
- Code quality: documented, comprehensive tests
- Maintainership of the package: no recent releases (latest release was in Jul. 2014), but it's such a tiny library that it simply appears "done"
- Security policies of the package: unknown, asked in https://github.com/IcecaveStudios/repr/issues/4
- Expected release and support cycles: undocumented; sporadic releases, asked in https://github.com/IcecaveStudios/repr/issues/4
- Other dependencies it'd add, if any:
"require": { "php": ">=5.3" },
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | 3036210-32.patch | 3.2 KB | wim leers |
| #11 | 3036210-11.patch | 3.23 KB | wim leers |
| #3 | json-schema.patch | 3.54 KB | effulgentsia |
Comments
Comment #2
gabesulliceUpdated the IS.
Comment #3
effulgentsia commentedHere's a patch I created with the following commands:
The
--sort-packagesputs it in the correct place by alphabet, but also causes a re-ordering of a couple other libraries that aren't currently alphabetized. Do we need to spin that other re-ordering to a separate issue, or is this patch small and simple enough to just do it all in one shot here?Comment #4
effulgentsia commentedThe IS says:
I don't see those being added in #3's composer.lock nor referenced in https://github.com/justinrainbow/json-schema/blob/master/composer.json. Were those dependencies of earlier versions but no longer? If so, then we can remove them from the IS?
Comment #5
gabesulliceHm, I see them here: https://github.com/justinrainbow/json-schema/blob/master/composer.json#L29
Comment #6
gabesulliceAh, they're in
master, but not in the latest release of the library: https://github.com/justinrainbow/json-schema/blob/dcb6e1006bb5fd1e392b4d...Comment #7
effulgentsia commentedI see. Yeah, that was committed to Master, but not to the 5.x.x branch, in https://github.com/justinrainbow/json-schema/commit/9d290a580a2149ac41fa....
Comment #8
effulgentsia commentedIt was explicitly rejected for backport in https://github.com/justinrainbow/json-schema/pull/558 as:
Comment #9
gabesulliceCool. #3 looks good to me.
Comment #11
wim leersRebased.
Comment #12
xjmThe lack of info for a lot of our checks for adding a library is a bit worrying; however, since it is only a dev dependency, I'm comfortable being fairly forgiving. E.g., we've had issues in the past with dev dependencies having security policies incompatible with ours, and this resulted directly in a change to Drupal.org to no longer packaging dev dependencies and a PSA warning site owners that they should also not include dev dependencies on public-facing sites. So the risk there has been mitigated somewhat.
For maintainership:
It does make me a little nervous as it looks like the recent activity is fairly low and it seems to be just the one person making releases. It worries me when we depend on projects much smaller than ours that have a high bus factor. Given what I see there, I would ask: If the package were removed, or had an unresolved security issue, or stopped being maintained, would we be comfortable forking it and maintaining it ourselves, or removing it? What would the impact be if it were not available as a dev dependency?
Or, put another way, how hard would it be to remove the dependency in an emergency situation? (E.g. leftpad or a security issue or whatever.) What would break?
Finally, for things like security policies which we're not able to locate, a simple thing we can do is reach out to the maintainers in their github queue and simply ask what their security, release, and BC policies are. Is anyone able to do that? (I wish we had a template for inquiries about it but I don't have a past example handy.)
Depending on the answers to point 3, getting this feedback could be a "should-have" that doesn't need to block commit.
Thanks!
Comment #13
gabesullice1. 👍
2. Will do. Actually, maybe can we leave that for now and do it when/if we update to version 6 (when it's released)?
3. Very little would happen if we removed it. This library simply acts as a check to make sure we're not doing anything in a spec-incompatible way. Removing it would have no impact on the public API. We have many tests that we already know are spec-compliant, so multiple things would have to go wrong for us to really miss having this dependency.
4. I'll post that issue, but per #3, I don't think we need to worry about this. Update: Done! https://github.com/justinrainbow/json-schema/issues/569
Comment #14
xjmThanks @gabesullice!
I do think we should look into it now, because this affects the upgrade path for D9 and etc. However, we can just do a quick high-level pass for the three packages given the answer to #13.3; it sounds like any risks are well-contained.
Comment #15
effulgentsia commentedIn terms of jsonapi, I agree. If we had to suddenly remove the vendor library, we could just remove the tests that make use of it. However, is there any concern that if it's a
require-devdependency of core, then contrib modules might start relying on it too? E.g., some JSON related module (not necessarily related to JSON:API, just something json related) that writes a test that uses the library? Then if we remove the library, those modules' tests start breaking.Probably the "correct" thing would be that any non-core modules that write tests that rely on some vendor package should specify that dev dependency in their own composer.json file, and not implicitly rely on core providing it. But I don't know how we can ensure that, and it's not like we require or expect contrib modules to explicitly list
phpunitin their composer.json files, so there's already precedent for contrib modules to implicitly rely on what core provides.Comment #16
xjmI would still treat removing the dependency as a disruption and internal BC break. Just saying that, given how the package is used, removing it would be a manageable contingency plan if something with the package maintenance goes sideways, in a way that wouldn't be feasible for a core runtime dependency or something essential like PHPUnit. And that makes me reasonably comfortable with adding the dependency despite the risks of it being a smaller package without formal release policies.
Comment #17
wim leersResponse from the maintainer an hour ago:
Comment #18
wim leers@gabesullice and I assessed https://github.com/marc-mabe/php-enum and https://github.com/marc-mabe/icecave/parity. Neither have security or BC policies, @gabesullice opened similar issues for those: https://github.com/marc-mabe/php-enum/issues/112 + https://github.com/IcecaveStudios/parity/issues/15 + https://github.com/IcecaveStudios/repr/issues/4.
The issue summary has been updated accordingly.
There are two things worth calling out:
justinrainbow/json-schemadepends onmarc-mabe/php-enum2.x, but it seems only 3.x is actively maintained. Fortunately, there is https://github.com/justinrainbow/json-schema/pull/464#issuecomment-46934... to makejustinrainbow/json-schemasupport for both 2.x and 3.x. We also askedmac-mabe/php-enumwhether 2.x still gets security releases at https://github.com/marc-mabe/php-enum/issues/112#issuecomment-469350913. Note that the 3.x branch requires PHP >=5.6.justinrainbow/json-schemadepends onicecave/parity1.0.0, but as of November 2018, a 2.0.0 was released, which requires PHP >=7.1. So here too, I asked whether they'd be open to do security releases against 1.0.0: https://github.com/IcecaveStudios/parity/issues/15#issuecomment-469356962.Comment #19
xjmThanks @Wim Leers! The prompt response from the
json-schemamaintainers is heartening. I posted a followup question asking about coordinated disclosure.Adding a couple links to the IS for the other packages.
Comment #20
xjmBased on https://github.com/IcecaveStudios/parity/issues/15 I do not think we should add the Icecave dependencies to our dependency tree. The current patch doesn't (see above WRT how these are dependencies in the master branch that were not backported); however, we could run into trouble in the future. Maybe we should report the above in the
json-schemaissue queue and suggest they consider an alternate approach?Comment #21
effulgentsia commented+1
Right, because in:
The
^keeps us on 5.x, so even when 6.x has a release, we won't update to it until we explicitly change this line.Per #17, the json-schema maintainer says he'll make a best effort to security patch 5.x even when 6.x is out. That might turn out to not be true, or not be true forever, but it's something. Therefore, I think it makes sense to for now:
Comment #22
effulgentsia commentedMeanwhile, in looking more closely at how we're using this library, I stumbled on #3037852: ResourceResponseValidator::validateResponse() never gets called.
Comment #23
wim leers#20 + #2: Given the concerns/risks around the dependencies that
justinrainbow/json-schemahas, I think it may be better to consider adding this in an issue after8.7.0-alpha1. I don't think it makes sense to stress out over these things shortly before that deadline, for a non-essential dev dependency.Comment #24
xjmI'm asking for an issue to simply filed in their github queue, not resolved. That way we've done our due dilligence to the library we're adding as a dependency -- and shared some information they may want to know.
Comment #25
wim leersCreated: https://github.com/justinrainbow/json-schema/issues/570
Comment #26
xjmThanks @Wim Leers! That satisfies my concerns.
Up to the framework managers now. :)
Comment #28
xjmI posted #3039275: phpunit-mock-objects is marked as "abandoned" when composer.lock is rebuilt for the out-of-scope issue with the lock file.
Comment #29
effulgentsia commentedSigning off as FM on adding this library.
However, there may be cases where people have dev dependencies installed on production (I actually suspect it's quite common). For those people, we should not be executing this library's code outside of tests. Therefore, I opened #3040451: ResourceResponseValidator::validateResponse() is executed on PHP 7, even when assertions aren't active. I'm ok with that being a follow-up to #2843147: Add JSON:API to core as a stable module if it doesn't get resolved before that's committed.
Comment #30
wim leers@effulgentsia's #3040451: ResourceResponseValidator::validateResponse() is executed on PHP 7, even when assertions aren't active was addressed — see #3040451-3: ResourceResponseValidator::validateResponse() is executed on PHP 7, even when assertions aren't active and #3040451-4: ResourceResponseValidator::validateResponse() is executed on PHP 7, even when assertions aren't active 🙂
Comment #31
catch#11 no longer applies.
Comment #32
wim leersRerolled.
Comment #33
effulgentsia commentedCommitted this as part of #2843147: Add JSON:API to core as a stable module.