abderrahim commented on issue #1685:
URL: https://github.com/apache/buildstream/issues/1685#issuecomment-1197341593
> Maybe it's worth documenting that the plugin restrict it's ref value to
occupying only a single _key_ in the _node_ passed to `Source.set_ref(ref,
node)`, and that _that key's value_ is what is expected to be returned by
`Source.get_ref()`, the recommended key name for this is _"ref"_.
Sounds good. I think this is what we found out was best while investigating
#1642. (@nanonyme correct me if I'm wrong).
> The actual type of the _value_ of the ref is only expected to be a simple
python data structure, using only `dict`, `list` and normal scalar values such
as `str` and `int`. Python _typing_ syntax does not allow us to strongly
specify this constraint on our `SourceRef` definition (I believe the possibly
recursive nature of the type definition is what prevents this), but we should
ensure this is documented.
While this sounds good, it doesn't really answer my question. In particular,
the problem I had is that "_that key's value_ is what is expected to be
returned by `Source.get_ref()`" implies that it's type is a `Node` subclass, or
more likely a list/dict whose values are `Node`s.
Either way, with #1704 the cargo plugin as currently written works fine. So
I'd say what you wrote above is fine as a guideline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]