Open omus opened 1 year ago
We could maybe make these docstrings autogenerated if we use inline docstrings in the @version
invocation, like
@version AnnotationV1 begin
"The UUID identifying the recording with which the annotation is
associated."
recording::UUID = UUID(recording)
"The UUID identifying the annotation."
id::UUID = UUID(id)
"The annotation's time span within the recording."
span::TimeSpan = TimeSpan(span)
end
Also, is "required fields" the right heading? Since all fields are required now I think
We could maybe make these docstrings autogenerated if we use inline docstrings in the
@version
invocation
I like this idea. I think there is still a use case however for adding a description in a docstring. Maybe we can generate a default docstring and if a description is needed one could do:
"""
AnnotationV1
My amazing description.
$(required_fields_docs(AnnotationV1))
"""
@version AnnotationV1 begin
"The UUID identifying the recording with which the annotation is associated."
recording::UUID = UUID(recording)
"The UUID identifying the annotation."
id::UUID = UUID(id)
"The annotation's time span within the recording."
span::TimeSpan = TimeSpan(span)
end
Also, is "required fields" the right heading? Since all fields are required now I think
Possibly it isn't the right heading as any field accepting missing
would be considered optional during construction.
Update: DocStringExtensions.jl pretty much does exactly what we want. I can see some issues with how Legolas handles parameterization and possibly wanting to see the expression used to convert the value to the field.
this could be updated against https://github.com/beacon-biosignals/Legolas.jl/pull/74 now :)
While updating some other Julia packages to use Legolas 0.5 I noticed a pattern where documentation for Legolas schema versions ended up just copying the schema version definition into the docstring. That style of docstring isn't very human friendly so I decided to try out some of the concepts we've been playing with in a private package here for consideration.
Changes made:
@version
definitions. This still attaches the docstring to the struct and matches the typical Julia docstring being placed above the definition (Legolas 0.5 doesn't allow you to attach the docstring directly to the@version
macro ATM)