OpenAPITools / OpenAPITools/openapi-generator

[BUG] [haskell] oneOF is not handled correctly

Open
#2,426 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug Server: Haskell
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

Trying to create server stubs in haskell for 5G core functions.
When the yaml file uses oneOf for a object property, the created haskell code in the corresponding Types.hs file cannot be parsed by GHC.
For example for yaml file https://github.com/jdegre/5GC_APIs/blob/master/TS29509_Nausf_UEAuthentication.yaml line 170 results in:
, uEAuthenticationCtx5gAuthData :: OneOf<Av5gAka,string> -- ^

openapi-generator version

$ docker run --rm openapitools/openapi-generator-cli version
4.0.0-SNAPSHOT

OpenAPI declaration file content or url

https://github.com/jdegre/5GC_APIs/blob/master/TS29509_Nausf_UEAuthentication.yaml

Command line used for generation

docker run --rm -v $PWD:/local openapitools/openapi-generator-cli generate -i /local/5GC_APIs/TS29509_Nausf_UEAuthentication.yaml -g haskell -o /local/haskell/genapi/ausf_auth/

Steps to reproduce

$ grep -rni oneof haskell/genapi/ausf_auth/
haskell/genapi/ausf_auth/lib/AUSF/Types.hs:279: , uEAuthenticationCtx5gAuthData :: OneOf<Av5gAka,string> -- ^

Related issues/PRs

#15 ???

Suggest a fix

Contributor guide

Open the contributing guide

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

Reproduce the issue with the linked TS29509_Nausf_UEAuthentication.yaml using the Docker generation command, then inspect haskell/genapi/ausf_auth/lib/AUSF/Types.hs around line 279. Confirm that the oneOf property is emitted as valid Haskell and that the generated Types.hs parses successfully with GHC.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, haskell, openapi
Domain
tooling
Issue type
Bug
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.