Skip to content

Add default display views for the Lovdata object types #11

Description

Running a Lovdata command in a terminal prints every property of every object, so a list of legal sources or search hits scrolls off the screen and the useful columns are buried. PowerShell's default display gives no weight to what matters, and the first impression of the module is a wall of text.

Request

Desired capability

Default table and list views for the module's object types, so that running a command interactively shows the few fields a person actually reads, and Format-List still shows everything when more detail is needed.

Acceptance criteria

  • Listing legal sources shows the identifier and description as a compact table
  • A stored context displays its name, API base URI, and when it was connected, and never anything resembling the API key
  • Search results and documents display the identifier and title rather than every field
  • Format-List * still reaches every property
  • The views load automatically with the module, without the user configuring anything

References


Technical decisions

Code placement: src/formats/<TypeName>.Format.ps1xml, one file per type, which is where the framework picks them up. Display views only; no behaviour and no computed business logic in the format files.

Coverage: Start with the types that exist when this is picked up — LovdataLegalSource, LovdataContext, and LovdataConfig — and add a view alongside each new public type rather than in a later sweep.

Secret safety: The context view is the one that matters most. It must select properties explicitly rather than defaulting to all, so a future property holding sensitive material cannot appear in the default view by accident. There is already a test asserting that the key does not appear in a context's string form; extend it to cover the formatted views.

Type extensions: Anything computed, such as an age or a display name, belongs in src/types/<TypeName>.Types.ps1xml rather than being calculated inside a format view.

Test approach: Tests assert on the output of Format-Table and Format-List for each type, including that the API key never appears.

Depends on: the load-bearing core in #2. The pull request targets build-lovdata-module.


Implementation plan

Core changes

  • Add src/formats/LovdataLegalSource.Format.ps1xml
  • Add src/formats/LovdataContext.Format.ps1xml with an explicit property list
  • Add src/formats/LovdataConfig.Format.ps1xml

Tests

  • Add tests asserting the default table columns for each type
  • Extend the context test to assert the API key never appears in any formatted view

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew featureminorNew feature or enhancement, version 0.x.0 increase

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions