oxidecomputer / oxidecomputer/typify

Want a mechanism to avoid automatically applied derive macros

Open
#277 1 comment 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

I have an OpenAPI document with a type PortId. That is an enum, but represented in the schema as a strictly-formatted string, as "prefixN", where the prefix is defined by the enum variant and N is a u8 limited to some range. For example, "qsfp4" or "rear0". Typify derives the ordering traits PartialOrd and Ord for this type, which delegate to the implementations for String. I would like to implement these traits myself, because (1) I'd like numeric sorting based on N rather than lexicographic, and (2) I'd like to put all values "rearM" before any `"qsfpN".

It would be nice to have escape hatches to ask typify not to generate certain derivable traits, ideally for specific types. Something like a mapping from type names to traits that should not be derived seems pretty flexible.

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 tracing how Typify applies automatically derived traits to generated enum types, focusing on where per-type configuration could be introduced. Check the existing generation and configuration tests, then define coverage for suppressing selected traits on selected types while preserving current defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.