Skip to content

Shared canonical export-name converter (camelCase to snake_case with override table) #211

Description

@razbroc

What to build

Add a shared canonical export-name converter to raster-shared that maps camelCase property keys to the snake_case column names used when writing GeoPackage export tables. It wraps change-case's snakeCase for the general case and consults a small override table for naming exceptions.

The override table's only entry today is resolutionDegree → resolution_deg (the per-part resolution field). Note the aggregate fields maxResolutionDeg/minResolutionDeg already abbreviate, so they need no override. The override table is the single, documented place where export-naming exceptions are declared.

Name the function to reflect that it is the canonical export-column-name mapping (e.g. an export-column-name converter), not a generic snake_case utility, so future consumers understand it carries overrides. This converter is intended to replace Overseer's private convertObjectKeysToSnakeCase and to be consumed by polygon-parts-worker.

No snake_case TypeScript type is produced — snake_case is derived at runtime only; the camelCase Zod schemas in raster-shared remain the source of truth for field names.

Release a new raster-shared version so downstream repos can consume it.

Acceptance criteria

  • A converter exported from raster-shared maps an object's camelCase keys to snake_case keys, using change-case for the general case.
  • Acronym/number tokens convert correctly: horizontalAccuracyCE90 -> horizontal_accuracy_ce90, imagingTimeBeginUTC -> imaging_time_begin_utc.
  • An override table is consulted before the general rule; resolutionDegree maps to resolution_deg.
  • Adding or removing an override is a single-location change.
  • Unit tests cover the general conversion, the acronym/number cases, and every override entry.
  • A new raster-shared version is released and publishable for downstream consumption.

Blocked by

  • None - can start immediately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions