OpenAPITools / OpenAPITools/openapi-generator

[BUG] IndentedLambda not working across different OS

Open
#5,087 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Intendtion is not working when generator is build on Unix OS (New Lines are LF) and Generator executed on Windows (New Lines are CRLF)

openapi-generator version

4.2.2

Steps to reproduce
  1. use {{#lambda.indented}} somewhere
  2. build and store jar of a customized generator on Unix OS
  3. run codegeneration on Windows OS
  4. {{#lambda.indented}} is not doing indention
Suggest a fix

Change line in org.openapitools.codegen.templating.mustache.IndentedLambda
String[] lines = text.split(System.lineSeparator());
to
String[] lines = text.split("\\r\\n|\\n|\\r");

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

Read org.openapitools.codegen.templating.mustache.IndentedLambda and reproduce the generator on Unix and Windows with an indented-lambda template. Check the handling of LF, CRLF, and CR line endings; done means indentation works consistently across those operating systems.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.