oxidecomputer / oxidecomputer/typify
Want a mechanism to avoid automatically applied derive macros
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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