Open danwos opened 3 years ago
I vote for this. It would be great to have a type-specific need definition, which is also self-contained.
Maybe the complete model could be defined by a json schema ? Benefit would be:
Maybe, part of the already existing (very generic) needsfile.json schema could be used.
I tried an initial implementation of this using pydantic in https://github.com/useblocks/sphinx-needs/pull/676. The docs are still missing, but I already at this early stage I think the solution checks all the boxes:
needs_types
, needs_extra_options
and needs_extra_links
in future (this needs some thoughts how to configure it completely as e.g. link arrow style does not belong to modeling)Here is a Sphinx project example.
Would be nice if needs_global_options
could be supported on a per-needs-type basis as well, for defaults that only make sense for a certain needs type
Would be nice if
needs_global_options
could be supported on a per-needs-type basis as well, for defaults that only make sense for a certain needs type
@danwos: I was about to request exactly that as a new issue, to have a per-directive default value for options 😆 . E.g. a requirement has default status "draft", but a test has a default status "implemented" (just an example, not sure if it makes sense).
This (sub) feature should be easy to implement, as we already have the same functionality via needextend
(when you set an option for all needs of a certain type to a default value only if the option value is not '').
@mason3k: This what we requested is actually already possible, see https://sphinx-needs.readthedocs.io/en/latest/configuration.html#filter-based-global-options
Set a filter based global option, and use type="req"
(for example) as filter.
Currently needs_types, needs_extra_links/options, needs_warnings are not related to each other.
But there are a lot of use cases, where e.g. only specific options for a specific need-types shall be possible.
Therefore there shall be a new option
needs_model
, which takes a dictionary as value, which includes the configs for needs_extra_links and co.I have to check if the usage of
needs_model
prohibits the usage of some other, already existing options.Model defintiion needs tbd...