OpenAPITools / OpenAPITools/openapi-generator

[BUG] How to disable generating the **_service.go code

Open
#13,808 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

I am using docker to generate the go api code but how do I pass the -Dnoservice to the docker container

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
    -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
    -g go-server \
    -o /local/out/go

referring to https://openapi-generator.tech/docs/generators/go-server where it says

Generates a Go server library using OpenAPI-Generator. By default, it will also generate service classes -- which you can disable with the -Dnoservice environment variable.

I have raised the same issue in https://stackoverflow.com/questions/74139854/openapitools-openapi-generator-how-to-disable-generating-the-service-go-code?noredirect=1#comment130899440_74139854

I have tried
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate ....-Dnoservice

However, I have got [error] Found unexpected parameters: [-Dnoservice]

I have also tried
docker run --rm -e noservice -v "${PWD}:/local" openapitools/openapi-generator-cli generate ....-Dnoservice, still generates *service.go code.

Can anyone shed some light how is the proper way to disable service generation?

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 the go-server generator documentation and the Docker command shown in the issue, including its -Dnoservice and -e noservice variants. Determine the supported way to disable service.go generation in the container, then verify that the generated output no longer contains that file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
api, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.