Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Typed data is a) very important b) not well understood
Proposed resolution
Write more docs until is understood.
Remaining tasks
Check with a lot of developers whether this is understandable
Beta: unfrozen, it's docs.
Comment | File | Size | Author |
---|---|---|---|
#24 | 2548279_24.patch | 9.27 KB | chx |
#24 | interdiff.txt | 3.88 KB | chx |
Comments
Comment #2
benjy CreditAttribution: benjy commentedSeems like a great improvement.
couple "of" data types
implementation
This is a great example :)
Should it be @endcode at the start and end?
Comment #3
fagothanks chx for sitting down with me, going through all the details and putting this down. It really helps to have an outside view for coming up with docs like this!
Here a few remarks:
I'd keep that as short overview what it is, before going into the motivation.
implementation
data. Would be good to list the interface here also.
first sentence has no end?
I'd say primitive data has no get() and set()
Also, language could be improved a bit in general, but I guess it makes sense to gather more feedback before. Would be good to fix the incomplete sentences for that though -> setting nw.
Comment #4
nevergone CreditAttribution: nevergone commentedSome typo fixed.
-* defining classes but if you use classes then you depend on implemntation
+ * defining classes but if you use classes then you depend on implementation
- * There are three kinds of typed daa: primitive, complex and list.
+ * There are three kinds of typed data: primitive, complex and list.
Comment #5
chx CreditAttribution: chx commented> The Typed Data API was created to provide developers with a consistent interface for interacting with data
I raised an issue with this IRL as well: every API is interacting with data (except Reflection and code generation). I also think that Typed Data really needs to have a Why? leader because it's not obvious by far.
> Would be good to list the interface here also.
In their section each has its own interface. Isn't that enough?
Comment #6
jibranI'm so happy to see this in writing @larowlan and I spent a lot of time figuring this out for DER.
These are more then couple.
OMG I spent 3 months learning that.
I didn't know this at all.
This kept me spinning for a while for DER.
Comment #7
andypost@todo with link?!
typo
Comment #8
jhodgdonI reviewed part of this patch before I ran out of time/energy for the day... I think it's mostly an improvement but it needs a little rewriting. I will try to find some time to do some copy editing tomorrow (someone, please leave me an IRC tell? :) ). Meanwhile, here's a review of what I had time to look at today:
Um... Can we not change the @defgroup ID? Also this is garbled because the new @defgroup line seems to be within the old one, and the file is going to look like:
This is wrong...
I'm not sure why the topic name should change from "Typed Data API" ot "Typed data plugins" either.
This sentence is really really long with no punctuation and a lot of "so" and "but" clauses. Separate into multiple sentences?
Don't put "Drupal 8" in docs. We'll almost certainly be using them for later versions, and it would be annoying to have to go back and find everywhere it says "Drupal 8" and change it to 8.1 or 9 or 10 or whatever.
Drupal::typedDataManager() is a method. I wouldn't say that is the manager. I would cite the service... something like:
... with the manager provided by the foo.bar service.
Needs "and" before "provides validation".
Comment #9
chx CreditAttribution: chx commentedDon't have time for more, but:
> I'm not sure why the topic name should change from "Typed Data API" ot "Typed data plugins" either.
because i started writing an entirely new topic before merging it in. The two @defgroups are also merging errors.
Comment #10
jhodgdonOK, I'm making a patch to copy edit...
Comment #11
jhodgdonSo....
I did some copy editing, and also some culling. Some of the stuff in the previous patch, I think belongs in the drupal.org pages under
https://www.drupal.org/node/1794140 (typed data API)
instead of in the api.drupal.org topic (which should just provide the bare minimum).
Comment #12
chx CreditAttribution: chx commentedThis is fantastic but I put in a few important things back.
Comment #13
jhodgdonInterdiff looks fine except for two nitpicks:
nitpick: "class, this" should be "class; this" (comma splice otherwise).
nitpick: id => ID and ids => IDs (unless you are a psychologist). ;)
Comment #14
chx CreditAttribution: chx commentedFixed those and added back some words on how create the suckers.
Comment #15
markdorisonThe documentation in #14 looks (and reads) great.
Comment #16
jhodgdonInterdiff looks good.
I went back and looked at the patch. Most likely my fault, but I noticed two problems, at the top and bottom of the topic:
a) The first line after
needs to be a one-line description of the topic, followed by a blank line. Previous to this patch, we had:
We should probably put that back in.
b) At the end somehow we did:
Need to put that */ back in, oops!
Other than that I think it's good to go. We should get typed data managers to review though? That would be ... no idea who, it is not in MAINTAINERS that I can see.
Comment #17
chx CreditAttribution: chx commented@fago is the typed data maintainer.
Comment #18
larowlanThanks @chx and @fago, these docs look great.
Only one minor observation
Is it worth putting the class for the manager service here so api.drupal.org links to it - or does api.drupal.org link using service IDs automagically?
Other than that +1
Comment #19
hussainwebI am fixing for comments in #16. I am not very sure about using the class name as suggested in #18. I am thinking it makes more sense to keep the service name in documentation. But I don't have any strong opinions.
Comment #20
jhodgdonWe don't want people to be using the service class directly. They should use the service name. So I think the docs are good.
Thanks for fixing up the patch. Looks like @fago reviewed it above for a fact check. Let's get it in!
Comment #21
fagoGreat improvement, thanks!
Ideally, api.drupal.org would be making the connection and make it possible to click on service ids. But if that's not feasible in the rather shot term, maybe just having the service id plus (Default class: ...) for the link would be useful?
I check the patch once again and made a few smaller fixes, and improved the paragraph about definition classes a bit. Changes attached, please review.
Comment #22
fagoAgreed, opened #2551929: Add Typed data to the maintainers txt.
Comment #23
jhodgdonLooking good! I took a careful look through the latest patch, and I have a few suggestions (mostly nitpicks). I think @fago is right about mentioning the class/interface for the manager, and I suggested below where I think it should be done too.
Could mention the class/interface of the data manager service here? Preferably interface.
nitpick: the line wrapping here needs a bit of attention.
This first sentence sort of implies that the primitive types cannot be used alone... I think/suppose that they can be?
Can these lines be rewrapped? Maybe not... not sure if ListInterface fits on the previous line?
Punctuation should be:
... base plugin ID; however, some types...
end this line in :
We don't normally line up Drupal code like this...
We could definitely mention the class/interface of the manager here too. Wouldn't hurt.
Comment #24
chx CreditAttribution: chx commentedI added the class, the interface is not yet there #2488568: Add a TypedDataManagerInterface and use it for typed parameters
> We could definitely mention the class/interface of the manager here too. Wouldn't hurt.
No need; \Drupal::typedDataManager will be crosslinked and it has a @return doxygen.
Comment #25
jhodgdonLooks great, thanks!
Comment #26
webchickReally great work on this. This is one of the gnarliest topics to come to grips with for people new to Drupal 8 (heck, even people old to Drupal 8 ;)).
Committed and pushed to 8.0.x. Thanks!