Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Dockerfile for Bash language not populated correctly #10589

Open
4 of 5 tasks
jeeftor opened this issue Oct 13, 2021 · 2 comments
Open
4 of 5 tasks

[BUG] Dockerfile for Bash language not populated correctly #10589

jeeftor opened this issue Oct 13, 2021 · 2 comments

Comments

@jeeftor
Copy link
Contributor

jeeftor commented Oct 13, 2021

Bug Report Checklist

  • [x ] Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When using what I think is valid commands with the bash generator I'm getting an invalid Dockerfile

openapi-generator version

5.2.1

OpenAPI declaration file content or url

I'm using the sample pet store api: https://petstore.swagger.io/v2/swagger.json

Generation Details

I run the following:

#!/bin/bash
LANG=bash
mkdir -p out/$LANG

curl https://petstore.swagger.io/v2/swagger.json >pet.json

openapi-generator generate \
    -i pet.json \
    -o out/$LANG \
    -g $LANG

Resultant Dockerfile looks like this:

image

this implies to me the template https://github.com/OpenAPITools/openapi-generator/blob/0204bf4ae284d936e4f7cb1ffad314c04d5df9db/modules/openapi-generator/src/main/resources/bash/Dockerfile.mustache is not filling out the variable {{scriptName}} correctly

image

Related issues/PRs

Active PR to fix this issue
#10594

Suggest a fix

I'll try to track down the code somehow - but obviously the SCRIPT_NAME variable isn't being populated correctly for some reason

@jeeftor
Copy link
Contributor Author

jeeftor commented Oct 13, 2021

image

I've downloaded the code and started digging around ... it does look like the template is asking for `scriptName` which doesn't appear to be a valid value in the `templateData` fed into the Dockerfile template....

image

@jeeftor
Copy link
Contributor Author

jeeftor commented Oct 13, 2021

So x-codegen-script-name is getting set...

image

And here is a potential (maybe) fix:

In BashClientCodegen.java if we add scriptName as something set it DOES show up successfully in the Dockerfile

image

Additionally - we then get this working code block in docker:

image

I'm not sure what the correct fix is - however - whether the DockerTemplate should be updated or this is a specific Bash issue and the scriptName variable isn't being set...

I may put together a PullRequest anyways and we'll see what happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant