Skip to content

Prototype enum wire-name transform and per-enumerator rename hook #101

Done

Description

@clockblocker

Question

How should reflect-cpp support wire-name transforms (e.g., '_' -> '-' kebab-case) and per-enumerator renames (e.g., auto_guess -> "auto") on C++ enum class types across JSON/CLI/Schema without forcing users to duplicate enumerators as rfl::Literal<...>?

Evidence & Context

  • Parent map: Map (Lane 4): Schema & Contract Fidelity
  • ccache#2: CompilerType and ResponseFileFormat had to duplicate enumerators as rfl::Literal<...> solely for '_' -> '-' formatting and auto_guess -> "auto".
  • solidity: Enum wire-name mismatches between C++ identifiers and JSON contract strings.

Prototype & Measurement Plan

  • Prototype on: showcase/all-lanes — prototype a trait/processor hook for enum wire-name transforms and per-enumerator overrides that applies consistently across serialization, deserialization, CLI, and JSON Schema.
  • Measure against real Showcase Migration: Validate in ccache#2 by replacing the duplicated rfl::Literal<...> wrappers on CompilerType and ResponseFileFormat with native enums and verifying full test + schema parity.
  • Judges & landing: Run Judges (gemini-4-neon + claude-opus-5-5 high via antigravity delegates) on the prototype diff and measurements; if green, hand to coordinator to land on showcase/all-lanes.

Activity

  1. added
    wayfinder:prototype
    on Nov 27, 2026
  2. clockblocker commented on Nov 27, 2026

    @clockblocker
    OwnerAuthor

    Upstream & Showcase Deltas (solidity#3):

    • Upstream signal: Add ability to rename enum values — maintainer's first instinct is a processor (worth evaluating alongside per-enum trait/rename hooks so both whole-enum wire transforms and per-enumerator exceptions fit cleanly).
    • solidity#3 requirement: Support generating or binding rfl::Literal wire values from constexpr tables (avoiding manual duplication between enum/wire-string tables and rfl::Literal<...>).
  3. clockblocker commented on Nov 27, 2026

    @clockblocker
    OwnerAuthor

    Landed on showcase/all-lanes at b73c8aea (dual-Judge approved by claude-opus-5-5 high + gemini-4-neon high; 467/467 targets 0 warnings, 1,129/1,129 CTests).

    • Added include/rfl/EnumNames.hpp with rfl::EnumNames<E> (overrides + transform enum/callback, borrowed-range static_assert), rfl::TransformEnumNames<...> processors (EnumSnakeCaseToKebabCase, EnumSnakeCaseToCamelCase, EnumSnakeCaseToPascalCase, EnumToLowerCase, EnumToUpperCase), and rfl::literal_from_table_t<Table>.
    • Wired consistently across rfl::enum_to_string, rfl::string_to_enum, rfl::get_enum_wire_names (including out-of-range overrides with deduplication), rfl::parse_enum_icase & rfl::cli::parse_enum_icase (with flag-enum support), ParserEnum (JSON/XML/YAML/Generic/Schema including enum_descriptions), and CLI read/usage.
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

    wayfinder:prototype

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions