swagger-api / swagger-api/swagger-codegen

[Haskell] Converting underscores to `'Underscore` seems unnecessary

Open
#8,846 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

swagger-codegen for Haskell converts underscores to 'Underscore, which seems unnecessary as _ is valid Haskell identifier syntax. As underscores seem to be quite commonly used this can severely negatively impact the readability of generated code / code that uses it.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

Any swagger declaration with underscores in it.

Command line used for generation

swagger-codegen generate -i <any_declaration_with_underscores> -l haskell

Steps to reproduce

Run: swagger-codegen generate -i <any_declaration_with_underscores> -l haskell

Look at generated Types.hs file and observe the large amounts of 'Underscore.

Related issues/PRs

Could not find any.

Suggest a fix/enhancement

Add specialCharReplacements.remove("_"); to https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellServantCodegen.java#L51 method.

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

Inspect HaskellServantCodegen.java around line 51, then reproduce the issue with the provided generate command and a Swagger declaration containing underscores. Check the generated Types.hs output; done means valid underscores are no longer rendered as repeated 'Underscore text.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell, java
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.