Skip to content

converter: fromObject silently drops invalid closed-enum strings (verify/fromObject disagree) #12

Description

@JavaGT

Lane: reflection/parse (sweep 2, finding 6)
fromObject({e:"BOGUS"}) on a CLOSED enum silently leaves the field unset (src/converter.js:30-45, generated switch default: only assigns for OPEN enums) while verify({e:"BOGUS"}) returns "e: enum value expected" — verify/fromObject disagree and fromObject fabricates a message with dropped data. Contrast: bad message payloads throw TypeError (converter.js:47-48).

Repro (executed): fromObject → {}, verify → error string.

Verdicts: both Confirm, Worth exploring (fromObject has always been the lenient path).

Upstream: no direct match; ProtoJSON errors on unknown closed-enum names (philosophy precedent).

Decision question: Adopt (throw TypeError for unrepresentable enum inputs, matching the message-field precedent) or Reject as intended leniency?

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions