The source_provider and minimum_schema_version are two important but optional properties for source plugins and they need documentation so people know how to use them. This also means refactoring a bit the way source requirements are handled.
| Task | Novice task? | Contributor instructions | Complete? |
|---|---|---|---|
| Add properties | Yes | add source_provider and minimum_schema_version with TRUE defaults to the MigrateSource annotation class | Yes |
| Document each property | Yes | Document as generically as possible since these are not Drupal specific. | Yes |
Original Description
It seems that source_provider was left out of being documented in any annotations. Currently it provides requirement checking functionality for source modules in DrupalSqlBase. The question this raises, is this intended to be functionality of the migrate module or is it specific to Drupal in the migrate_drupal module?
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 2559345-15.patch | 1.34 KB | phenaproxima |
| #13 | interdiff.txt | 1.12 KB | lostkangaroo |
| #13 | document-2559345-13.patch | 774 bytes | lostkangaroo |
Comments
Comment #2
lostkangaroo commentedDiscussion in IRC is leaning towards adding the annotation in the most generic form into MigrateSource as an optional property. This still allows for overriding by migrate_drupal if needed.
Another property was identified "minimum_schema_version" that should be included in this. This would be renamed to minimum_version to make it more generic.
Comment #3
benjy commentedYeah, it's interesting that these fields are on the plugin definition because these keys are only used in DrupalSqlBase and therefore only sources that extend that.
So I think the proposal is to:
a) Document the properties on the annotation.
b) Implement RequirementsInterface from SourcePluginBase?
c) Provide a default implementation on SourcePluginBase that returns TRUE and then let DrupalSqlBase override it.
Alternatively, we could move the source_provider stuff out of the source annotation and into an interface/method that can be implemented by sources that require such requirement checks.
Comment #4
lostkangaroo commentedComment #5
lostkangaroo commentedI like the second option but don't see the need for such an interface when the annotation itself would be sufficient and already is being used everywhere.
a) yes
b) is pretty much what I was thinking.
c) I am thinking of leaving it as an abstract method to be implemented by source plugins. It might become a bit of an annoyance but most migrations should provide its own base that would handle source dependencies.
Comment #6
neclimdulb) c) I'm confused about how these help clarify things. Returning true won't actually help document the property will it?
Comment #7
lostkangaroo commentedJust adding the annotation portion until the b) c) parts can be addressed.
Comment #8
lostkangaroo commentedComment #10
lostkangaroo commentedJust noticed a small mistake in the patch left over from some experimentation earlier that didn't match the docblock text. No interdiff since this is just too small to need one.
Comment #11
benjy commentedRegarding #6, as mentioned on IRC, it's for consistency, so that the only implementation isn't in a Drupal specific source. It will be needed once the base class implements RequirementsInterface
Comment #12
phenaproximaI talked to @lostkangaroo on IRC and I think that source_provider should not be any specific type. I think its type, meaning, and applicability to a given set of source data should be for the source plugin to decide, in order to keep this annotation property as generic as possible. Same goes for minimum_version.
Comment #13
lostkangaroo commentedRemoved the default empty arrays and modified the doc text to accommodate. I think we should spin off #3 b)c) into a separate issue at this point.
Comment #14
phenaproximaI like it, but I'd like to get @benjy and @mikeryan's opinions before RTBCing.
Comment #15
phenaproximaAdded more detail to the comments after discussing with @benjy on IRC.
Comment #16
benjy commentedGreat, this looks good now. Thanks!
Comment #17
lostkangaroo commented+1 RTBC lets do this
Comment #18
webchickThis is just docs so is totally rc eligible.
Cleaned up the first sentences of both on commit so they fit on one line, per coding standards https://www.drupal.org/coding-standards/docs.
Committed and pushed to 8.0.x. Thanks!