#Best way to annotate Secret type with a
1 messages · Page 1 of 1 (latest)
I used these docs which seemed a little at odds with each other?
https://docs.dagger.io/developer-guide/python/640201/documentation
https://docs.dagger.io/developer-guide/python/753720/functions#optional-arguments
What do you find is at odds?
In the functions doc, I didn't want to do str | None without a default, but the defaults are introduced after. I think it's better to switch places and start showing defaults, then do optionals afterwards. Or even better, merge them into one. As for annotations, that's introduced in the next page, but I can make sure there's an example of an optional there.
To answer your question, the annotation should wrap the whole type:
-Annotated[<type>, <metadata>] | None = None
+Annotated[<type> | None, <metadata>] = None
Ah, thanks for that example. Examples help more than anything.
When there are too few it can be hard to generalize.