diff --git a/sphinx_needs/data.py b/sphinx_needs/data.py index 2f8b099da..e44f3d94e 100644 --- a/sphinx_needs/data.py +++ b/sphinx_needs/data.py @@ -228,7 +228,6 @@ class CoreFieldParameters(TypedDict): "content": { "description": "Content of the need.", "schema": {"type": "string", "default": ""}, - "exclude_json": True, }, "pre_content": { "description": "Pre-content of the need.", diff --git a/sphinx_needs/directives/needimport.py b/sphinx_needs/directives/needimport.py index 435239ff7..863b1d463 100644 --- a/sphinx_needs/directives/needimport.py +++ b/sphinx_needs/directives/needimport.py @@ -171,9 +171,9 @@ def run(self) -> Sequence[nodes.Node]: else: filter_context = need.copy() - # Support both ways of addressing the description, as "description" is used in json file, but - # "content" is the sphinx internal name for this kind of information - filter_context["content"] = need["description"] # type: ignore[typeddict-item] + if "description" in need and not need.get("content"): + # legacy versions of sphinx-needs changed "description" to "content" when outputting to json + filter_context["content"] = need["description"] # type: ignore[typeddict-item] try: if filter_single_need(filter_context, needs_config, filter_string): needs_list_filtered[key] = need @@ -243,7 +243,10 @@ def run(self) -> Sequence[nodes.Node]: # Replace id, to get unique ids need_params["id"] = id_prefix + need_params["id"] - need_params["content"] = need_params["description"] # type: ignore[typeddict-item] + if "description" in need_params and not need_params.get("content"): + # legacy versions of sphinx-needs changed "description" to "content" when outputting to json + need_params["content"] = need_params["description"] # type: ignore[typeddict-item] + del need_params["description"] # type: ignore[typeddict-item] # Remove unknown options, as they may be defined in source system, but not in this sphinx project for option in list(need_params): diff --git a/sphinx_needs/external_needs.py b/sphinx_needs/external_needs.py index 7a596ac1a..c04afe379 100644 --- a/sphinx_needs/external_needs.py +++ b/sphinx_needs/external_needs.py @@ -157,7 +157,10 @@ def load_external_needs(app: Sphinx, env: BuildEnvironment, docname: str) -> Non f'{source["base_url"]}/{need.get("docname", "__error__")}.html#{need["id"]}' ) - need_params["content"] = need["description"] + if "description" in need_params and not need_params.get("content"): + # legacy versions of sphinx-needs changed "description" to "content" when outputting to json + need_params["content"] = need_params["description"] + del need_params["description"] # Remove unknown options, as they may be defined in source system, but not in this sphinx project for option in list(need_params): diff --git a/sphinx_needs/needsfile.json b/sphinx_needs/needsfile.json index 512c5026c..72ec0de84 100644 --- a/sphinx_needs/needsfile.json +++ b/sphinx_needs/needsfile.json @@ -22,7 +22,7 @@ "properties": { "title": {"type": "string"}, "id": {"type": "string"}, - "description": {"type": "string"} + "content": {"type": "string"} } } } diff --git a/sphinx_needs/needsfile.py b/sphinx_needs/needsfile.py index c3e65f986..c8889ef37 100644 --- a/sphinx_needs/needsfile.py +++ b/sphinx_needs/needsfile.py @@ -168,7 +168,6 @@ def add_need(self, version: str, need_info: NeedsInfoType) -> None: key in self._need_defaults and value == self._need_defaults[key] ) } - writable_needs["description"] = need_info["content"] # TODO why this? self.needs_list["versions"][version]["needs"][need_info["id"]] = writable_needs self.needs_list["versions"][version]["needs_amount"] = len( self.needs_list["versions"][version]["needs"] diff --git a/sphinx_needs/utils.py b/sphinx_needs/utils.py index 63ae9db88..ad90b3146 100644 --- a/sphinx_needs/utils.py +++ b/sphinx_needs/utils.py @@ -252,9 +252,9 @@ def import_prefix_link_edit( need[extra_link["option"]][n] = f"{id_prefix}{id}" # Manipulate descriptions # ToDo: Use regex for better matches. - need["description"] = need["description"].replace( - id, "".join([id_prefix, id]) - ) + for key in ("content", "description"): + if key in need: + need[key] = need[key].replace(id, "".join([id_prefix, id])) FuncT = TypeVar("FuncT") diff --git a/tests/__snapshots__/test_add_sections_sigs.ambr b/tests/__snapshots__/test_add_sections_sigs.ambr index de53bc76e..9089cb29e 100644 --- a/tests/__snapshots__/test_add_sections_sigs.ambr +++ b/tests/__snapshots__/test_add_sections_sigs.ambr @@ -1,7 +1,7 @@ # name: test_section_is_usable_in_filters[test_app0] dict({ 'R_12345': dict({ - 'description': 'The Tool **shall** have a command line interface.', + 'content': 'The Tool **shall** have a command line interface.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Command line interface', @@ -25,7 +25,7 @@ 'updated': '1.5.1', }), 'R_12346': dict({ - 'description': 'The Tool **shall** have a command line interface.', + 'content': 'The Tool **shall** have a command line interface.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Another Requirement', @@ -49,7 +49,6 @@ 'updated': '1.4.0', }), 'T_001': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'test method', diff --git a/tests/__snapshots__/test_basic_doc.ambr b/tests/__snapshots__/test_basic_doc.ambr index 48b1eefa1..bdf01be14 100644 --- a/tests/__snapshots__/test_basic_doc.ambr +++ b/tests/__snapshots__/test_basic_doc.ambr @@ -15,9 +15,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -85,9 +85,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -209,6 +209,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', diff --git a/tests/__snapshots__/test_external.ambr b/tests/__snapshots__/test_external.ambr index 5a0034cec..d6ea4319b 100644 --- a/tests/__snapshots__/test_external.ambr +++ b/tests/__snapshots__/test_external.ambr @@ -5,7 +5,6 @@ '1.3': dict({ 'needs': dict({ 'EXT_REQ_01': dict({ - 'description': '', 'doctype': '', 'external_css': 'external_link', 'external_url': 'http://my_company.com/docs/v1/index.html#REQ_01', @@ -22,7 +21,6 @@ 'type_name': 'Requirement', }), 'IMP_REQ_01': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'REQ_01', @@ -103,6 +101,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', @@ -482,9 +486,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': 'EXT_TEST_01', 'created_at': '', 'delete': False, - 'description': 'EXT_TEST_01', 'docname': None, 'doctype': '', 'duration': '', @@ -555,9 +559,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': 'EXT_TEST_02', 'created_at': '', 'delete': False, - 'description': 'EXT_TEST_02', 'docname': None, 'doctype': '', 'duration': '', @@ -631,9 +635,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -703,9 +707,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -776,9 +780,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'subfolder_a/subfolder_b/subpage', 'doctype': '.rst', 'duration': '', @@ -900,6 +904,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', diff --git a/tests/__snapshots__/test_need_constraints.ambr b/tests/__snapshots__/test_need_constraints.ambr index 05ea8d5bb..4c6e8feaf 100644 --- a/tests/__snapshots__/test_need_constraints.ambr +++ b/tests/__snapshots__/test_need_constraints.ambr @@ -15,9 +15,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': 'This is a requirement describing OPSEC processes.', 'created_at': '', 'delete': False, - 'description': 'This is a requirement describing OPSEC processes.', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -91,9 +91,9 @@ 'check_0': True, }), }), + 'content': 'Example of a successful constraint.', 'created_at': '', 'delete': False, - 'description': 'Example of a successful constraint.', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -168,9 +168,9 @@ 'check_0': False, }), }), + 'content': 'Example of a failed constraint.', 'created_at': '', 'delete': False, - 'description': 'Example of a failed constraint.', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -243,9 +243,9 @@ 'check_0': False, }), }), + 'content': 'Example of a failed constraint with medium severity. Note the style from :ref:`needs_constraint_failed_options`', 'created_at': '', 'delete': False, - 'description': 'Example of a failed constraint with medium severity. Note the style from :ref:`needs_constraint_failed_options`', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -313,9 +313,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': 'The Tool awesome shall have a command line interface.', 'created_at': '', 'delete': False, - 'description': 'The Tool awesome shall have a command line interface.', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -390,9 +390,9 @@ 'check_0': False, }), }), + 'content': 'asdf', 'created_at': '', 'delete': False, - 'description': 'asdf', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -467,9 +467,9 @@ 'check_0': False, }), }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'style_test', 'doctype': '.rst', 'duration': '', @@ -541,9 +541,9 @@ 'check_0': False, }), }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'style_test', 'doctype': '.rst', 'duration': '', @@ -665,6 +665,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', diff --git a/tests/__snapshots__/test_need_parts.ambr b/tests/__snapshots__/test_need_parts.ambr index 2c31cab95..216ccbfb3 100644 --- a/tests/__snapshots__/test_need_parts.ambr +++ b/tests/__snapshots__/test_need_parts.ambr @@ -1,7 +1,7 @@ # name: test_doc_need_parts[test_app0] dict({ 'SP_TOO_001': dict({ - 'description': ''' + 'content': ''' The Tool awesome shall have a command line interface with following commands: * :need_part:`(1)exit()` @@ -95,7 +95,7 @@ 'type_name': 'Specification', }), 'TEST_2': dict({ - 'description': 'Part in nested need: :need_part:`(nested_id)something`', + 'content': 'Part in nested need: :need_part:`(nested_id)something`', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'TEST_2', diff --git a/tests/__snapshots__/test_needextend.ambr b/tests/__snapshots__/test_needextend.ambr index 86924f063..14c69b16d 100644 --- a/tests/__snapshots__/test_needextend.ambr +++ b/tests/__snapshots__/test_needextend.ambr @@ -15,9 +15,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -88,9 +88,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -159,9 +159,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -230,9 +230,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -300,9 +300,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -425,6 +425,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', @@ -804,12 +810,12 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '', - 'delete': False, - 'description': ''' + 'content': ''' Had no outgoing links. Got an outgoing link ``extend_test_004``. ''', + 'created_at': '', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -880,12 +886,12 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '', - 'delete': False, - 'description': ''' + 'content': ''' Had no links. Got an incoming links ``extend_test_003`` and ``extend_test_006``. ''', + 'created_at': '', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -956,12 +962,12 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '', - 'delete': False, - 'description': ''' + 'content': ''' Had the two links: ``extend_test_003`` and ``extend_test_004``. Both got deleted. ''', + 'created_at': '', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -1030,9 +1036,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': 'Had the link ``extend_test_003``, got another one ``extend_test_004``.', 'created_at': '', 'delete': False, - 'description': 'Had the link ``extend_test_003``, got another one ``extend_test_004``.', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -1102,9 +1108,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -1175,9 +1181,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'page_1', 'doctype': '.rst', 'duration': '', @@ -1302,6 +1308,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', diff --git a/tests/__snapshots__/test_needimport.ambr b/tests/__snapshots__/test_needimport.ambr index 5a94e8b8e..1b705a8f0 100644 --- a/tests/__snapshots__/test_needimport.ambr +++ b/tests/__snapshots__/test_needimport.ambr @@ -5,7 +5,7 @@ '1.0': dict({ 'needs': dict({ 'IMPL_01': dict({ - 'description': 'Incoming links of this spec: :need_incoming:`IMPL_01`.', + 'content': 'Incoming links of this spec: :need_incoming:`IMPL_01`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Implementation for specification', @@ -26,7 +26,7 @@ 'type_name': 'Implementation', }), 'OWN_ID_123': dict({ - 'description': 'Outgoing links of this spec: :need_outgoing:`OWN_ID_123`.', + 'content': 'Outgoing links of this spec: :need_outgoing:`OWN_ID_123`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification of a requirement', @@ -49,7 +49,7 @@ 'type_name': 'Specification', }), 'REQ_001': dict({ - 'description': ''' + 'content': ''' This is an awesome requirement and it includes a nice title, a given id, a tag and this text as description. ''', @@ -73,7 +73,6 @@ 'type_name': 'Requirement', }), 'REQ_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test requirement 1', @@ -90,7 +89,6 @@ 'type_name': 'Requirement', }), 'ROLES_REQ_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Sliced Bread', @@ -108,7 +106,6 @@ 'type_name': 'Requirement', }), 'ROLES_REQ_2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Butter on Bread', @@ -126,7 +123,6 @@ 'type_name': 'Requirement', }), 'R_22EB2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement B', @@ -146,7 +142,6 @@ 'type_name': 'Requirement', }), 'R_2A9D0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement A', @@ -166,7 +161,7 @@ 'type_name': 'Requirement', }), 'R_F4722': dict({ - 'description': ''' + 'content': ''' This is my **first** requirement!! .. note:: You can use any rst code inside it :) @@ -194,7 +189,6 @@ 'type_name': 'Requirement', }), 'SPEC_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test specification 1', @@ -211,7 +205,6 @@ 'type_name': 'Specification', }), 'S_01A67': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification B', @@ -231,7 +224,7 @@ 'type_name': 'Specification', }), 'S_503A1': dict({ - 'description': ''' + 'content': ''' We haven't set an **ID** here, so sphinxcontrib-needs will generated one for us. @@ -260,7 +253,6 @@ 'type_name': 'Specification', }), 'S_D70B0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification A', @@ -280,7 +272,7 @@ 'type_name': 'Specification', }), 'TEST_01': dict({ - 'description': 'TEST IMPORT TITLE', + 'content': 'TEST IMPORT TITLE', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'TEST IMPORT DESCRIPTION', @@ -295,7 +287,6 @@ 'type_name': 'Implementation', }), 'T_5CCAA': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test 1', @@ -317,7 +308,7 @@ 'type_name': 'Test Case', }), 'T_C3893': dict({ - 'description': ''' + 'content': ''' This test checks :need:`impl_01` for :need:`OWN_ID_123` inside a Python 2.7 environment. ''', @@ -349,7 +340,7 @@ 'type_name': 'Test Case', }), 'collapsed_IMPL_01': dict({ - 'description': 'Incoming links of this spec: :need_incoming:`collapsed_IMPL_01`.', + 'content': 'Incoming links of this spec: :need_incoming:`collapsed_IMPL_01`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Implementation for specification', @@ -376,7 +367,7 @@ 'type_name': 'Implementation', }), 'collapsed_OWN_ID_123': dict({ - 'description': 'Outgoing links of this spec: :need_outgoing:`collapsed_OWN_ID_123`.', + 'content': 'Outgoing links of this spec: :need_outgoing:`collapsed_OWN_ID_123`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification of a requirement', @@ -404,7 +395,7 @@ 'type_name': 'Specification', }), 'collapsed_REQ_001': dict({ - 'description': ''' + 'content': ''' This is an awesome requirement and it includes a nice title, a given id, a tag and this text as description. ''', @@ -432,7 +423,6 @@ 'type_name': 'Requirement', }), 'collapsed_ROLES_REQ_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Sliced Bread', @@ -456,7 +446,6 @@ 'type_name': 'Requirement', }), 'collapsed_ROLES_REQ_2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Butter on Bread', @@ -480,7 +469,6 @@ 'type_name': 'Requirement', }), 'collapsed_R_22EB2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement B', @@ -504,7 +492,6 @@ 'type_name': 'Requirement', }), 'collapsed_R_2A9D0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement A', @@ -528,7 +515,7 @@ 'type_name': 'Requirement', }), 'collapsed_R_F4722': dict({ - 'description': ''' + 'content': ''' This is my **first** requirement!! .. note:: You can use any rst code inside it :) @@ -560,7 +547,6 @@ 'type_name': 'Requirement', }), 'collapsed_S_01A67': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification B', @@ -584,7 +570,7 @@ 'type_name': 'Specification', }), 'collapsed_S_503A1': dict({ - 'description': ''' + 'content': ''' We haven't set an **ID** here, so sphinxcontrib-needs will generated one for us. @@ -617,7 +603,6 @@ 'type_name': 'Specification', }), 'collapsed_S_D70B0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification A', @@ -641,7 +626,7 @@ 'type_name': 'Specification', }), 'collapsed_TEST_01': dict({ - 'description': 'TEST IMPORT TITLE', + 'content': 'TEST IMPORT TITLE', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'TEST IMPORT DESCRIPTION', @@ -662,7 +647,6 @@ 'type_name': 'Implementation', }), 'collapsed_T_5CCAA': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test 1', @@ -688,7 +672,7 @@ 'type_name': 'Test Case', }), 'collapsed_T_C3893': dict({ - 'description': ''' + 'content': ''' This test checks :need:`impl_01` for :need:`collapsed_OWN_ID_123` inside a Python 2.7 environment. ''', @@ -724,7 +708,7 @@ 'type_name': 'Test Case', }), 'filter_IMPL_01': dict({ - 'description': 'Incoming links of this spec: :need_incoming:`filter_IMPL_01`.', + 'content': 'Incoming links of this spec: :need_incoming:`filter_IMPL_01`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Implementation for specification', @@ -746,7 +730,7 @@ 'type_name': 'Implementation', }), 'hidden_IMPL_01': dict({ - 'description': 'Incoming links of this spec: :need_incoming:`hidden_IMPL_01`.', + 'content': 'Incoming links of this spec: :need_incoming:`hidden_IMPL_01`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Implementation for specification', @@ -778,7 +762,7 @@ 'type_name': 'Implementation', }), 'hidden_OWN_ID_123': dict({ - 'description': 'Outgoing links of this spec: :need_outgoing:`hidden_OWN_ID_123`.', + 'content': 'Outgoing links of this spec: :need_outgoing:`hidden_OWN_ID_123`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification of a requirement', @@ -811,7 +795,7 @@ 'type_name': 'Specification', }), 'hidden_REQ_001': dict({ - 'description': ''' + 'content': ''' This is an awesome requirement and it includes a nice title, a given id, a tag and this text as description. ''', @@ -844,7 +828,6 @@ 'type_name': 'Requirement', }), 'hidden_ROLES_REQ_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Sliced Bread', @@ -873,7 +856,6 @@ 'type_name': 'Requirement', }), 'hidden_ROLES_REQ_2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Butter on Bread', @@ -902,7 +884,6 @@ 'type_name': 'Requirement', }), 'hidden_R_22EB2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement B', @@ -931,7 +912,6 @@ 'type_name': 'Requirement', }), 'hidden_R_2A9D0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement A', @@ -960,7 +940,7 @@ 'type_name': 'Requirement', }), 'hidden_R_F4722': dict({ - 'description': ''' + 'content': ''' This is my **first** requirement!! .. note:: You can use any rst code inside it :) @@ -997,7 +977,6 @@ 'type_name': 'Requirement', }), 'hidden_S_01A67': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification B', @@ -1026,7 +1005,7 @@ 'type_name': 'Specification', }), 'hidden_S_503A1': dict({ - 'description': ''' + 'content': ''' We haven't set an **ID** here, so sphinxcontrib-needs will generated one for us. @@ -1064,7 +1043,6 @@ 'type_name': 'Specification', }), 'hidden_S_D70B0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification A', @@ -1093,7 +1071,7 @@ 'type_name': 'Specification', }), 'hidden_TEST_01': dict({ - 'description': 'TEST IMPORT TITLE', + 'content': 'TEST IMPORT TITLE', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'TEST IMPORT DESCRIPTION', @@ -1115,7 +1093,6 @@ 'type_name': 'Implementation', }), 'hidden_T_5CCAA': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test 1', @@ -1143,7 +1120,7 @@ 'type_name': 'Test Case', }), 'hidden_T_C3893': dict({ - 'description': ''' + 'content': ''' This test checks :need:`impl_01` for :need:`hidden_OWN_ID_123` inside a Python 2.7 environment. ''', @@ -1177,7 +1154,6 @@ 'type_name': 'Test Case', }), 'ids_ROLES_REQ_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Sliced Bread', @@ -1199,7 +1175,6 @@ 'type_name': 'Requirement', }), 'ids_ROLES_REQ_2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Butter on Bread', @@ -1221,7 +1196,7 @@ 'type_name': 'Requirement', }), 'small2_TEST_03': dict({ - 'description': 'AAA', + 'content': 'AAA', 'docname': 'subdoc/filter', 'external_css': 'external_link', 'full_title': 'AAA', @@ -1237,7 +1212,7 @@ 'type_name': 'Requirement', }), 'small_TEST_02': dict({ - 'description': 'small_TEST_02', + 'content': 'small_TEST_02', 'docname': 'subdoc/filter', 'external_css': 'external_link', 'full_title': 'TEST_02 DESCRIPTION', @@ -1257,7 +1232,7 @@ 'type_name': 'Requirement', }), 'small_abs_path_TEST_02': dict({ - 'description': 'small_abs_path_TEST_02', + 'content': 'small_abs_path_TEST_02', 'docname': 'subdoc/abs_path_import', 'external_css': 'external_link', 'full_title': 'TEST_02 DESCRIPTION', @@ -1277,7 +1252,7 @@ 'type_name': 'Requirement', }), 'small_depr_rel_path_TEST_01': dict({ - 'description': 'small_depr_rel_path_TEST_01', + 'content': 'small_depr_rel_path_TEST_01', 'docname': 'subdoc/deprecated_rel_path_import', 'external_css': 'external_link', 'full_title': 'TEST_01 DESCRIPTION', @@ -1292,7 +1267,7 @@ 'type_name': 'Implementation', }), 'small_rel_path_TEST_01': dict({ - 'description': 'small_rel_path_TEST_01', + 'content': 'small_rel_path_TEST_01', 'docname': 'subdoc/rel_path_import', 'external_css': 'external_link', 'full_title': 'TEST_01 DESCRIPTION', @@ -1307,7 +1282,7 @@ 'type_name': 'Implementation', }), 'test_IMPL_01': dict({ - 'description': 'Incoming links of this spec: :need_incoming:`test_IMPL_01`.', + 'content': 'Incoming links of this spec: :need_incoming:`test_IMPL_01`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Implementation for specification', @@ -1333,7 +1308,7 @@ 'type_name': 'Implementation', }), 'test_OWN_ID_123': dict({ - 'description': 'Outgoing links of this spec: :need_outgoing:`test_OWN_ID_123`.', + 'content': 'Outgoing links of this spec: :need_outgoing:`test_OWN_ID_123`.', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification of a requirement', @@ -1360,7 +1335,7 @@ 'type_name': 'Specification', }), 'test_REQ_001': dict({ - 'description': ''' + 'content': ''' This is an awesome requirement and it includes a nice title, a given id, a tag and this text as description. ''', @@ -1387,7 +1362,6 @@ 'type_name': 'Requirement', }), 'test_ROLES_REQ_1': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Sliced Bread', @@ -1410,7 +1384,6 @@ 'type_name': 'Requirement', }), 'test_ROLES_REQ_2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Butter on Bread', @@ -1433,7 +1406,6 @@ 'type_name': 'Requirement', }), 'test_R_22EB2': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement B', @@ -1456,7 +1428,6 @@ 'type_name': 'Requirement', }), 'test_R_2A9D0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Requirement A', @@ -1479,7 +1450,7 @@ 'type_name': 'Requirement', }), 'test_R_F4722': dict({ - 'description': ''' + 'content': ''' This is my **first** requirement!! .. note:: You can use any rst code inside it :) @@ -1510,7 +1481,6 @@ 'type_name': 'Requirement', }), 'test_S_01A67': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification B', @@ -1533,7 +1503,7 @@ 'type_name': 'Specification', }), 'test_S_503A1': dict({ - 'description': ''' + 'content': ''' We haven't set an **ID** here, so sphinxcontrib-needs will generated one for us. @@ -1565,7 +1535,6 @@ 'type_name': 'Specification', }), 'test_S_D70B0': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Specification A', @@ -1588,7 +1557,7 @@ 'type_name': 'Specification', }), 'test_TEST_01': dict({ - 'description': 'TEST IMPORT TITLE', + 'content': 'TEST IMPORT TITLE', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'TEST IMPORT DESCRIPTION', @@ -1608,7 +1577,6 @@ 'type_name': 'Implementation', }), 'test_T_5CCAA': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test 1', @@ -1633,7 +1601,7 @@ 'type_name': 'Test Case', }), 'test_T_C3893': dict({ - 'description': ''' + 'content': ''' This test checks :need:`impl_01` for :need:`test_OWN_ID_123` inside a Python 2.7 environment. ''', @@ -1733,6 +1701,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', diff --git a/tests/__snapshots__/test_needs_builder.ambr b/tests/__snapshots__/test_needs_builder.ambr index 1adc9d5b0..9e702dbaa 100644 --- a/tests/__snapshots__/test_needs_builder.ambr +++ b/tests/__snapshots__/test_needs_builder.ambr @@ -15,9 +15,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -85,9 +85,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -155,9 +155,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -280,6 +280,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', @@ -815,7 +821,6 @@ '1.0': dict({ 'needs': dict({ 'TC_001': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Test example', @@ -832,7 +837,6 @@ 'type_name': 'Test Case', }), 'TC_NEG_001': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'Negative test example', @@ -849,7 +853,6 @@ 'type_name': 'Test Case', }), 'US_63252': dict({ - 'description': '', 'docname': 'index', 'external_css': 'external_link', 'full_title': 'A story', @@ -934,6 +937,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', @@ -1479,9 +1488,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -1549,9 +1558,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -1619,9 +1628,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -1744,6 +1753,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues', diff --git a/tests/__snapshots__/test_needs_id_builder.ambr b/tests/__snapshots__/test_needs_id_builder.ambr index 4e339064e..50df501ee 100644 --- a/tests/__snapshots__/test_needs_id_builder.ambr +++ b/tests/__snapshots__/test_needs_id_builder.ambr @@ -16,9 +16,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -96,9 +96,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -176,9 +176,9 @@ 'constraints_passed': True, 'constraints_results': dict({ }), + 'content': '', 'created_at': '', 'delete': False, - 'description': '', 'docname': 'index', 'doctype': '.rst', 'duration': '', diff --git a/tests/__snapshots__/test_service_github.ambr b/tests/__snapshots__/test_service_github.ambr index 6ec204420..5be6e3cb5 100644 --- a/tests/__snapshots__/test_service_github.ambr +++ b/tests/__snapshots__/test_service_github.ambr @@ -14,13 +14,13 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '2024-02-15T14:04:06Z', - 'delete': False, - 'description': ''' + 'content': ''' Bump actions/cache from 3 to 4 (#1092) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ''', + 'created_at': '2024-02-15T14:04:06Z', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -87,9 +87,7 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '2024-02-15T12:19:11Z', - 'delete': False, - 'description': ''' + 'content': ''' .. code-block:: text I've also just realised there is a bug in this directive: @@ -98,6 +96,8 @@ [...] ''', + 'created_at': '2024-02-15T12:19:11Z', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -165,9 +165,7 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '2024-02-15T20:45:12Z', - 'delete': False, - 'description': ''' + 'content': ''' .. code-block:: text @David-Le-Nir and @danwos, as I explained in @@ -198,6 +196,8 @@ closes #1103 ''', + 'created_at': '2024-02-15T20:45:12Z', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -264,9 +264,7 @@ 'constraints_passed': True, 'constraints_results': dict({ }), - 'created_at': '2024-02-12T08:36:07.000Z', - 'delete': False, - 'description': ''' + 'content': ''' 🧪 Add test for `needreport` directive (#1105) Currently there is no test for this directive, this PR adds one. @@ -282,6 +280,8 @@ `needs_render_context = {"report_directive": "admonition"}` (I left the default as `dropdown`, so as not to introduce a breaking change) ''', + 'created_at': '2024-02-12T08:36:07.000Z', + 'delete': False, 'docname': 'index', 'doctype': '.rst', 'duration': '', @@ -397,6 +397,12 @@ 'field_type': 'core', 'type': 'object', }), + 'content': dict({ + 'default': '', + 'description': 'Content of the need.', + 'field_type': 'core', + 'type': 'string', + }), 'created_at': dict({ 'default': '', 'description': 'Added by service github-issues',