Skip to content

[bug][finch] Infrastructure classes are output to /scala folder #3120

Open
@jimschubert

Description

@jimschubert

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

image

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions