Skip to content

Switch diagram-model & audit-export calls to Accept-header content negotiation #760

Description

@ericfitz

Summary

The TMI server is replacing the ?format= query-parameter content-negotiation pattern with standard Accept-header content negotiation, and modernizing the media types. tmi-ux currently passes ?format= for the diagram-model fetch and the system-audit export; both must switch to setting the Accept request header.

This is a coordinated breaking change (no backwards compatibility); land it in sync with the server change on tmi dev/1.4.0.

Affected call sites

  • src/app/pages/admin/audit/admin-audit.service.tsexportSystem(filter, format) builds ?format=csv|ndjson. Switch to sending Accept: text/csv or Accept: application/x-ndjson (and drop format from the query params).
  • src/app/pages/tm/services/tm-diagram-crud.service.ts / threat-model.service.tsgetDiagramModel(..., format: 'json'|'yaml'|'graphml') sends ?format=. Switch to Accept:
    • jsonapplication/json (default)
    • yamlapplication/yaml
    • graphmlapplication/graphml+xml

What to do

  • Update exportSystem to set the Accept header instead of the format query param.
  • Update getDiagramModel to map the requested representation to the Accept header (modern media types above).
  • Regenerate src/app/generated/api-types.d.ts from the updated tmi-openapi.json (the format query param is gone).
  • Update the related unit tests/specs (e.g. admin-audit.service.spec.ts, tm-diagram-crud.service.spec.ts, system-audit-view.component.spec.ts) to assert the Accept header rather than the format query param.
  • Handle 406 Not Acceptable (now documented) for an unsupported Accept.

Notes

Media types modernized server-side: application/x-yamlapplication/yaml (RFC 9512), application/xmlapplication/graphml+xml. The legacy synonym media types are no longer accepted — send the canonical types above. The server change lands on tmi dev/1.4.0; the OpenAPI spec is the source of truth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions