Skip to content

[Java] Missing dependency on generated project on build.sbt #1605

@deigote

Description

@deigote
Description

When generating code for my spec using Java and no other option, the SBT build file is missing a dependency.

The dependency seems to be present in gradle and pom build files. Adding it manually to build.sbt ("org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1") fixes the issue.

openapi-generator version

I'm using docker image openapitools/openapi-generator-cli:v3.3.4 .

OpenAPI declaration file content or url

I think any spec will do. Here one I quickly compiled for testing the issue:

openapi: "3.0.0"

info:
  title: Test
  version: v1
  contact:
    name: deigote
    email: [email protected]
  description: |-
    Test API

externalDocs:
  url: http://localhost:9000/docs
  description: documentation

servers:
- url: http://localhost:9000

security:
- basicAuth: []

paths:
  /users:
    get:
      operationId: listUsers
      summary: List users.
      responses:
        '200':
          description: |-
            The users were correctly retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
      tags:
      - users

components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    User:
      required:
      - id
      properties:
        id:
          description: an unique identifier of this user
          type: string
          example: "2142082683"           
Command line used for generation
docker run --rm -v (pwd):/local openapitools/openapi-generator-cli:v3.3.4 generate \
                  -i /local/spec.yml \
                  -g java \
                  -o /local/openApiCode
Steps to reproduce
docker run --rm -v (pwd):/local openapitools/openapi-generator-cli:v3.3.4 generate \
                  -i /local/spec.yml \
                  -g java \
                  -o /local/openApiCode
cd openApiCode
sbt test
Suggest a fix/enhancement

I guess it's a matter of including the missing dependency in the build.sbt file. I'm surprised the dependency is there for pom and gradle, I would have assumed that each build file is generated from a common set of data, including the dependencies. So maybe it's something else.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions