Skip to content

Commit

Permalink
🔧 Remove content_id need data field (#1242)
Browse files Browse the repository at this point in the history
The `content_id` field is unnecessary, since it is always the same as
the need's `id`.
  • Loading branch information
chrisjsewell authored Aug 27, 2024
1 parent 5f706dc commit bb49a01
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 244 deletions.
3 changes: 0 additions & 3 deletions sphinx_needs/api/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def run():
"target_id": need_id,
"content": "\n".join(content) if isinstance(content, StringList) else content,
"content_node": None,
"content_id": None,
"type": need_type,
"type_name": type_name,
"type_prefix": type_prefix,
Expand Down Expand Up @@ -580,8 +579,6 @@ def _create_need_node(
need_parts = find_parts(node_need)
update_need_with_parts(env, data, need_parts)

data["content_id"] = node_need["ids"][0]

# Create a copy of the content
data["content_node"] = node_need.deepcopy()

Expand Down
6 changes: 0 additions & 6 deletions sphinx_needs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ class CoreFieldParameters(TypedDict):
"description": "Post-content of the need.",
"schema": {"type": "string", "default": ""},
},
"content_id": {
"description": "ID of the content node.",
"schema": {"type": ["string", "null"], "default": None},
},
"content_node": {
"description": "Deep copy of the content node.",
"schema": {},
Expand Down Expand Up @@ -378,8 +374,6 @@ class NeedsInfoType(TypedDict, total=False):
content: Required[str]
pre_content: str
post_content: str
content_id: Required[None | str]
"""ID of the content node."""
content_node: Required[None | Element]
"""Deep copy of the content node."""

Expand Down
1 change: 0 additions & 1 deletion sphinx_needs/functions/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def resolve_dynamic_values(needs: dict[str, NeedsInfoType], app: Sphinx) -> None
"lineno",
"content",
"content_node",
"content_id",
]:
# dynamic values in this data are not allowed.
continue
Expand Down
11 changes: 0 additions & 11 deletions tests/__snapshots__/test_basic_doc.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'ST_001',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -85,7 +84,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'US_38823',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -209,15 +207,6 @@
'field_type': 'core',
'type': 'object',
}),
'content_id': dict({
'default': None,
'description': 'ID of the content node.',
'field_type': 'core',
'type': list([
'string',
'null',
]),
}),
'created_at': dict({
'default': '',
'description': 'Added by service github-issues',
Expand Down
17 changes: 0 additions & 17 deletions tests/__snapshots__/test_export_id.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'REQ_001',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -156,7 +155,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'REQ_002',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -228,7 +226,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'REQ_003',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -300,7 +297,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'REQ_004',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -373,7 +369,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'REQ_005',
'created_at': '',
'delete': None,
'description': '''
Expand Down Expand Up @@ -474,7 +469,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'TEST_001',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -548,7 +542,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'TEST_002',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -622,7 +615,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'TEST_003',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -762,15 +754,6 @@
'field_type': 'core',
'type': 'object',
}),
'content_id': dict({
'default': None,
'description': 'ID of the content node.',
'field_type': 'core',
'type': list([
'string',
'null',
]),
}),
'created_at': dict({
'default': '',
'description': 'Added by service github-issues',
Expand Down
24 changes: 0 additions & 24 deletions tests/__snapshots__/test_external.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
'type_name': 'Requirement',
}),
'IMP_REQ_01': dict({
'content_id': 'IMP_REQ_01',
'delete': False,
'description': '',
'docname': 'index',
Expand Down Expand Up @@ -109,15 +108,6 @@
'field_type': 'core',
'type': 'object',
}),
'content_id': dict({
'default': None,
'description': 'ID of the content node.',
'field_type': 'core',
'type': list([
'string',
'null',
]),
}),
'created_at': dict({
'default': '',
'description': 'Added by service github-issues',
Expand Down Expand Up @@ -486,7 +476,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': None,
'created_at': '',
'delete': False,
'description': 'EXT_TEST_01',
Expand Down Expand Up @@ -553,7 +542,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': None,
'created_at': '',
'delete': False,
'description': 'EXT_TEST_02',
Expand Down Expand Up @@ -623,7 +611,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'REQ_1',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -690,7 +677,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'SPEC_1',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -759,7 +745,6 @@
'constraints_passed': True,
'constraints_results': dict({
}),
'content_id': 'SUB_002',
'created_at': '',
'delete': None,
'description': '',
Expand Down Expand Up @@ -883,15 +868,6 @@
'field_type': 'core',
'type': 'object',
}),
'content_id': dict({
'default': None,
'description': 'ID of the content node.',
'field_type': 'core',
'type': list([
'string',
'null',
]),
}),
'created_at': dict({
'default': '',
'description': 'Added by service github-issues',
Expand Down
Loading

0 comments on commit bb49a01

Please sign in to comment.