swagger-api / swagger-api/swagger-codegen

[Elm] Description conversion to function comment can be improved

Open
#8,152 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

Comments describing a function or declaration start with {-| instead of {-. They belong to the next declaration.

{-| Representation of fast immutable arrays. You can create arrays of integers
(`Array Int`) or strings (`Array String`) or any other type of value you can
dream up.
-}
type Array a = Array

https://github.com/elm-lang/core/blob/5.1.1/src/Array.elm#L39-L43

The codegen will generate this (including newlines) instead (the | character is missing):

{-
   My description
-}


and if there is no description at all, the output will be a comment with no content. Instead the comment should be omitted.

{-

-}



Swagger-codegen version

2.3.1

Suggest a fix/enhancement

The parentheses are hardcoded. There could be more occurrences.

https://github.com/swagger-api/swagger-codegen/blob/d6539ba3c83c081e95157433f2e1a7639d14dc6d/modules/swagger-codegen/src/main/resources/elm/model.mustache#L14-L16

https://github.com/swagger-api/swagger-codegen/blob/d6539ba3c83c081e95157433f2e1a7639d14dc6d/modules/swagger-codegen/src/main/resources/elm/api.mustache#L16-L18

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

Start with modules/swagger-codegen/src/main/resources/elm/model.mustache and elm/api.mustache, then compare their description output with the Elm example in the issue. Update the templates so descriptions use the function-comment marker and empty descriptions produce no comment; check both generated outputs for the unwanted blank comment.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.