oxidecomputer / oxidecomputer/typify
default on enum can causes TypeError(InvalidValue)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 898
- Forks
- 114
- Avg merge
- 4h 18m
- Merged PRs (30d)
- 14
Description
I have a failing input OAS being emitted from a https://github.com/tiangolo/fastapi service, which I've trimmed down to this sample
openapi: 3.0.2
info:
title: FastAPI
version: 0.1.0
paths: {}
components:
schemas:
A:
properties:
version:
title: Version
enum:
- foo
type: string
B:
properties:
version:
title: Version
enum:
- bar
type: string
default: bar
This fails in progenitor with
gen fail: TypeError(InvalidValue)
Error: generation experienced errors
This fails at https://github.com/oxidecomputer/typify/blob/d579a52/typify-impl/src/defaults.rs#L82
Remove the default: bar and the error goes away.
Part of the cause is the title: Version being common on two different enums.
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
Run progenitor generation with the trimmed OpenAPI sample and then inspect typify-impl/src/defaults.rs at line 82. Compare the result with the sample after removing default: bar; done means the schemas with distinct enum values and the shared title no longer produce TypeError(InvalidValue).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100