OpenAPITools / OpenAPITools/openapi-generator
[BUG][Elm] enum inside an object generates wrong encoder/decoder
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Elm generator doesn't render decoder/encoder for an enum inside an object.
openapi-generator version
5.0.0 branch, 4th Feb 2020
OpenAPI declaration file content or url
Defining the following in an object type:
state:
type: string
enum: [Trial, Subscribed, Overdue, Canceled, Archived, NoSubscription]
Command line used for generation
Steps to reproduce
Will result to |> decode "state"
The output is has no decoder, I've narrowed it down to dataType in modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache.
Note: if I reference schema definition with $ref it works as expected.
Contributor guide
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 with modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache and compare the inline enum case with the working $ref case. Reproduce generation from the inline enum schema and inspect the generated decoder and encoder. Done means the enum inside an object receives the expected generated handling instead of an empty decoder expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elm
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100