OpenAPITools / OpenAPITools/openapi-generator
[bug][finch] Infrastructure classes are output to /scala folder
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Types are written to the scala folder rather than a standard package folder structure (as defined by packageName).
For example, defining:
- packageName=org.openapitools.finchy
- apiPackage=org.openapitools.finchy.apis
- modelPackage=org.openapitools.finchy.models
openapi-generator version
4.0.0, possibly affects earlier versions
OpenAPI declaration file content or url
https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/json/api-with-examples.json
Command line used for generation
OPENAPI_GENERATOR_VERSION=4.0.0 openapi-generator generate \
-g scala-finch \
-i https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/api-with-examples.json \
-o finchy \
--additional-properties=packageName=org.openapitools.finchy,apiPackage=org.openapitools.finchy.apis,modelPackage=org.openapitools.finchy.models
where openapi-generator is our launcher script (https://github.com/OpenAPITools/openapi-generator/blob/master/bin/utils/openapi-generator-cli.sh)
Steps to reproduce
Generate using command above, inspect output:
[main] WARN o.o.c.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.
[main] INFO o.o.codegen.DefaultGenerator - OpenAPI Generator: scala-finch (server)
[main] INFO o.o.codegen.DefaultGenerator - Generator 'scala-finch' is considered stable.
[main] WARN o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] WARN o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] WARN o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/src/main/scala/org/openapitools/finchy/apis/DefaultApi.scala
[main] WARN o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/README.md
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/build.sbt
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/src/main/scala/Server.scala
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/src/main/scala/DataAccessor.scala
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/project/build.properties
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/project/plugins.sbt
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/sbt
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/src/main/scala/endpoint.scala
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/src/main/scala/errors.scala
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/.openapi-generator-ignore
[main] INFO o.o.codegen.AbstractGenerator - writing file /Users/jim/projects/openapi-generator/.bak/finchy/.openapi-generator/VERSION
Suggest a fix
Set the target folder for infrastructural types to the package output path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the documented scala-finch command with the linked OpenAPI example and inspect the generated src/main/scala paths. Compare the packaged API and model outputs with infrastructure files such as Server.scala, DataAccessor.scala, endpoint.scala, and errors.scala. Done means infrastructure types are emitted under the configured package output path rather than directly in the scala folder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, scala
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100