sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Allow extra options to define their value type

Open danwos opened this issue 4 years ago • 1 comments

Currently all extra_options for needs support string fields only. It would be good, if at least list types like for tags and links are supported.

Maybe other fields can be supported as well. E.g. numbers and dates

Drawbacks:

  • Filtering gets more complex, as the user needs to know the exact option type for filter strings. amount == 2 and name == "Max Maier"
  • The options must get the needed directives.type (e.g. unchanged) or a specific, internal type transformation must be performed. This may be needed, if the format (e.g. date) of a string must also be checked, which is not a feature of docutils.

Tech. concept

tbd

danwos avatar Sep 24 '21 14:09 danwos

To note, I think this would be nice and possible for simple "JSON supported" types (int, float, etc), but would be problematic for other types like dates (you would also need to define serialization/deserialization strategies for the needs.json or other storage formats)

Additionally, these types should be output properly in https://github.com/useblocks/sphinx-needs/blob/4120c18edd9bc63ac071250fa9b6ae22d9f4b25a/sphinx_needs/needsfile.py#L40-L46

chrisjsewell avatar Oct 08 '24 12:10 chrisjsewell