Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit fa38c8c

Browse files
authored
fix: use id field for Attributes instead of name (#179)
* fix: use `id` instead of `name` for Attributes * test: update unit test and testdata
1 parent bac78be commit fa38c8c

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

docfx_yaml/extension.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def _parse_docstring_summary(summary):
448448
keyword = ""
449449
if name and description and var_type:
450450
attributes.append({
451-
"name": name,
451+
"id": name,
452452
"description": description,
453453
"var_type": var_type
454454
})
@@ -1447,9 +1447,9 @@ def search_cross_references(obj, current_name: str, entry_names: List[str]):
14471447
entry_names
14481448
)
14491449

1450-
if attribute.get("name"):
1451-
attribute["name"] = convert_cross_references(
1452-
attribute["name"],
1450+
if attribute.get("id"):
1451+
attribute["id"] = convert_cross_references(
1452+
attribute["id"],
14531453
current_name,
14541454
entry_names
14551455
)

tests/cross_references_post.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ items:
77
\ \"date_field = CAST('2014-9-27' as\n DATE)\" \"nullable_field is not NULL\"\
88
\ \"st_equals(geo_field,\n st_geofromtext(\"POINT(2, 2)\"))\" \"numeric_field\
99
\ BETWEEN 1.0\n AND 5.0\"\n \n Restricted to a maximum length for 1 MB."
10-
name: <xref uid="google.cloud.bigquery_storage_v1.types.StreamStats">google.cloud.bigquery_storage_v1.types.StreamStats</xref>
10+
id: <xref uid="google.cloud.bigquery_storage_v1.types.StreamStats">google.cloud.bigquery_storage_v1.types.StreamStats</xref>
1111
var_type: str
1212
- description: "Optional. Options specific to the Apache\n Arrow output format."
13-
name: arrow_serialization_options
13+
id: arrow_serialization_options
1414
var_type: <xref uid="google.cloud.bigquery_storage_v1.types.ArrowSerializationOptions">google.cloud.bigquery_storage_v1.types.ArrowSerializationOptions</xref>
1515
children: []
1616
class: google.cloud.bigquery_storage_v1.types.ReadSession.TableReadOptions

tests/cross_references_pre.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ items:
77
\ \"date_field = CAST('2014-9-27' as\n DATE)\" \"nullable_field is not NULL\"\
88
\ \"st_equals(geo_field,\n st_geofromtext(\"POINT(2, 2)\"))\" \"numeric_field\
99
\ BETWEEN 1.0\n AND 5.0\"\n \n Restricted to a maximum length for 1 MB."
10-
name: google.cloud.bigquery_storage_v1.types.StreamStats
10+
id: google.cloud.bigquery_storage_v1.types.StreamStats
1111
var_type: str
1212
- description: "Optional. Options specific to the Apache\n Arrow output format."
13-
name: arrow_serialization_options
13+
id: arrow_serialization_options
1414
var_type: <xref uid="google.cloud.bigquery_storage_v1.types.ArrowSerializationOptions">google.cloud.bigquery_storage_v1.types.ArrowSerializationOptions</xref>
1515
children: []
1616
class: google.cloud.bigquery_storage_v1.types.ReadSession.TableReadOptions

tests/test_unit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ def test_parse_docstring_summary_attributes(self):
815815
# Test parsing docstring with attributes.
816816
attributes_want = [
817817
{
818-
"name": "simple name",
818+
"id": "simple name",
819819
"description": "simple description",
820820
"var_type": 'str'
821821
}
@@ -837,12 +837,12 @@ def test_parse_docstring_summary_attributes(self):
837837
# Check multiple attributes are parsed.
838838
attributes_want = [
839839
{
840-
"name": "simple name",
840+
"id": "simple name",
841841
"description": "simple description",
842842
"var_type": "str"
843843
},
844844
{
845-
"name": "table_insert_request",
845+
"id": "table_insert_request",
846846
"description": "Table insert request.",
847847
"var_type": "google.cloud.bigquery_logging_v1.types.TableInsertRequest"
848848
}
@@ -874,7 +874,7 @@ def test_parse_docstring_summary_attributes(self):
874874
# Check only attributes in valid format gets parsed.
875875
attributes_want = [
876876
{
877-
"name": "proper name",
877+
"id": "proper name",
878878
"description": "proper description.",
879879
"var_type": "str"
880880
}

0 commit comments

Comments
 (0)