oxidecomputer / oxidecomputer/dropshot
bad results when using multiple Rust types with the same name
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 104
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 22
Description
In https://github.com/oxidecomputer/omicron/pull/1210 I saw a case where we had multiple Rust types with the same name (well, in different modules) -- one was used as an input type and one as an output type. Only one of these made it into the OpenAPI spec. It seems like this could result in all kinds of bad behavior. For example, suppose type A is used in the spec where type B was meant. At best, if B is an input type, and the types are totally different, then every request that used type B as input would probably fail validation and there'd be no way to call them (using a spec-generated client). At worst, if the types are similar but type B has an optional field that's not in type A, dropshot would be silently corrupting data on input (silently deleting a field from the struct). I think you could have the same thing on output.
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 examining the multiple same-named Rust types described in PR 1210 and trace how they are represented in the OpenAPI spec. Determine how input and output types can be distinguished without silently selecting the wrong type; done means both types are represented correctly and generated-client validation and data handling no longer use the wrong schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100