Render dataclass @property members in generated API reference#183
Merged
Conversation
The generator routed every dataclass to render_dataclass, which emitted only the field table. Computed @Property members were dropped, so ActivityDetail.allocation_percent, is_allocated, inputs, outputs and the same on eight other data types were documented nowhere. Reuse _public_members to append a Properties section, matching how render_class already renders non-dataclass types. README regenerated in the same commit so the drift check stays green.
render_class and render_dataclass both emitted the identical Properties block byte-for-byte; a change to heading level or the no-docstring placeholder would have to land twice. Extract _render_properties and call it from both. Pure refactor — generated README is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Python API-reference generator sent every dataclass through
render_dataclass, which emits only the field table. Computed@propertymembers were silently dropped, so nine data types had properties documented nowhere — most visiblyActivityDetail.allocation_percentandis_allocated, plusinputs/outputs/technosphere_inputsand theis_input/is_reference/coverage_pct/has_more/delta/page_sizeproperties on the exchange, mapping, result and search types.Final state
render_dataclassnow reuses_public_membersto append a Properties section after the field table, exactly asrender_classalready does for non-dataclass types. Only properties are added; construction plumbing (from_json) stays hidden. The README is regenerated in the same commit and the drift check (gen_api_md.py --check) passes.