oxidecomputer / oxidecomputer/typify

Disabling common prefix redaction for enums

Open
#872 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
898
Forks
114
Avg merge
4h 18m
Merged PRs (30d)
14

Description

Hi! We're exploring the usage of typify to generate some Rust code that needs to process incoming JSON objects.

One of these schemas is an enum, which can be summarised as:

enum Product {
   MotorOffer(MotorOffer),
   MotorInsurance(MotorInsurance),
}

Unfortunately, the code generator in typify is eliminating the Motor prefix, which we would like to preserve because we have other kinds of products in different parts of the codebase (not represented by this enum) and losing this prefix makes the code less clear and readable for us.

Is there a way to turn off this common prefix elimination?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating typify's enum name-generation logic and the tests covering common-prefix elimination. Determine how that behavior could be disabled for the affected enum; done means generated variants preserve names such as MotorOffer and MotorInsurance, with coverage for the new behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.