Closed (fixed)
Project:
JSON:API
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Mar 2018 at 15:43 UTC
Updated:
14 Jul 2018 at 17:59 UTC
Jump to comment: Most recent
Comments
Comment #2
e0ipsoMinor IS edits.
Comment #3
wim leers#2++
Comment #4
gabesulliceLet's add the link manager to the list. It is currently
@deprecated, but should be@internal.I won't add it to the IS. So, if another maintainer agrees, please just do so :)
Comment #5
wim leers#4++
Comment #6
e0ipso#4 will
$entity->toUrl('api_json')just work for other other modules to create HATEOAS links?Comment #7
gabesullice@e0ipso
That is blocked by: #2878463: [PP-1] Define a JSON API link relation for entities
which is blocked by: #2353611: Make it possible to link to an entity by UUID
However, modules can use:
Url::fromRoute('entity.node--page.individual', ['node' => $node->uuid()]);FWIW, I completely agree that there should be a good way to get JSON API HATEOAS links, the possibilities there are really promising.
The LinkManager has been deprecated for a while now though. In fact, I think at one point you agreed with me that it should be
@internal, but it seems we only marked it@deprecatedinstead.Comment #8
gabesulliceWhile we're on the topic of "things we'd like to break"...
The latter is much more conventional and will unify our resource type names across the module. This would also make the entrypoint a little nicer.
The former continues to imply that we treat 'articles' and 'pages' as a child of 'node' rather than as siblings.
This breaks the spec recommendation to treat URLs as though they're they're part of a reference document.
I believe the current implementation is a holdover from early days of the module when we had shakier UUID support and no concept of a ResourceType.
Edit: Adding a more radical idea (because it's almost 1am and I'm feeling impulsive)
s/node--article/node:article/gsimply because it's aesthetically pleasingComment #9
e0ipso#8: I'd like to separate that one since it's incredibly disruptive to ALL existing installations without gaining us a feature or a fixing a bug. Maybe open a new issue for discussion?
#7:
Yeah. My comment was more on the lines of what to recommend instead, and not let's hold that off. However I do feel we should not recommend using route names to generate links. They are an internal implementation detail that is not guaranteed to stay as is. IMO
toUrlshould be the way to go.Comment #10
gabesulliceAh! I should have said that this could easily be handled with a BC flag. Then it wouldn't break any sites.
A few features this would buy us: conventions, less confusion, following a spec recommendation, compatibility with existing JS clients like Orbit.js which almost always template the URL by using the type name.
#2949635: Make the resource type aware of the resource path is what have me the hope that we could do this.
I'm a little surprised because JSON API Extras has been altering the path for quite some time (although not with the new method). In fact, it's probably one of it's most used features.
I don't think it's necessary to go into a separate issue, that implies a really long running discussion. Which I really don't think is necessary.
This brings up a good point though, we should try our best to make the upgrade path as smooth and painless as possible.
👍
Comment #11
wim leers#8: I like it, but it's massively disruptive of course.
#10: handling this with a BC flag is doable. But … you say that this gets us more conventions, less confusion. This is only going to be true for those that don't have this BC layer enabled. For everybody else, there's going to be confusing/conflicting documentation!
Now I'm going to contradict myself: it's actually even possible to provide BC for this without a BC flag: with a
InboundPathProcessorInterfaceimplementation, much like\Drupal\rest\PathProcessor\PathProcessorEntityResourceBC, we could just rewrite incoming URLs and have this work transparently! We can then remove it in a far future version, for example version 3. Something like this should work:Comment #12
e0ipsoI believe fiercely on no BC shenanigans, specially for no gain. I still don't see what benefit this brings. I think it's just fine as it is and should not be modified.
Comment #13
wim leersI think I agree with you, @e0ipso. The benefit seems very small. Until we hear people actually complain about this, this is probably fine.
Comment #14
wim leersWe will also be able to fix #2933895: [>=8.5] Update type hint to interface instead of concrete class in FieldResolver and #2934149: [>=8.5] JSON API routes not specifying _content_type_format route requirement, resulting in bad DX, and likely more still.
Comment #15
wim leersSo did we agree that
LinkManagershould be marked@internalin the next major?Comment #16
e0ipso#15 yes, I believe so.
Comment #17
gabesulliceJust gonna chime in and say I'm fine with not doing #8. I still think it would be nice. But it's small enough to say, "forget about it" :)
Comment #18
bojanz commentedWhy would dropping support for unmaintained Drupal core versions require a new major?
I have enforced the "current core branch" requirement on most my modules (Commerce, Address) with no problems.
Comment #19
e0ipso@bojanz we support all the supported versions, which is IIRC
>=current-1. In any case the major includes a good bunch of other stuff as well, not just the core requirements.I'm interested to hear your impressions on upgrade speed from site owners. Are they upgrading core quickly from your perception?
BTW it's awesome to see you around this issue queue.
Comment #20
gabesulliceFTR only, prior minor versions are not supported.
See: https://www.drupal.org/core/release-cycle-overview
I only know this now because I heard @xjm say this was a common misconception the other day.
IDC about whether we support only the current or the previous one too.
Comment #21
wim leersApparently the
8.x-2.xbranch was created?Comment #22
wim leersPer #2843147-51: Add JSON:API to core as a stable module, we need to do #2957271: [>=8.5] Fix RouteEnhancerInterface deprecation errors.
Comment #23
wim leers@dawehner explicitly asked in #2843147-60: Add JSON:API to core as a stable module to do #2926463: [>=8.5] Remove JSON API's "file URL" field work-around now that Drupal core 8.5 fixed it and remove the
jsonapi.entity.to_jsonapiservice before JSON API is moved into core. This further stresses the need for v2.Comment #24
wim leersAnd #2958504: Stop using jsonapi.entity.to_jsonapi service in ResourceTestBase is an issue that paves the path for
Comment #25
wim leers#2957474: Move the write functionality of config entities to a sub-module in preparation for removal was created for
Comment #26
wim leers#2958504: Stop using jsonapi.entity.to_jsonapi service in ResourceTestBase already landed :)
Comment #27
wim leersI think #2942549: Spec Compliance: JSON API allows POSTing relationship fields in 'attributes' rather than in 'relationships' is perhaps another relatively minor bug that we should only fix in 2.x, to minimize breakage (despite our clear statements in
jsonapi.api.phpabout spec compatibility).Comment #28
gabesullice#27++
Comment #29
wim leersAlright, updated #2942549: Spec Compliance: JSON API allows POSTing relationship fields in 'attributes' rather than in 'relationships''s metadata, and updated IS.
Comment #30
wim leers#2929428: [>=8.5] Convert "throw new *HttpException" into "throw new Cacheable*HttpException" where possible also requires >=8.5, so moved it to v2 and added to IS.
Comment #31
wim leers#2982210: Move EntityToJsonApi service to JSON API Extras is now the actual issue for
Comment #32
wim leersThe 2.x branch has started. The majority of the issues listed above have already been committed!
Comment #33
wim leers