swagger-api / swagger-api/swagger-codegen

[JAVA-Spring-server] missing dependency; missing import

Open
#8,632 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The autogenerated pom.xml is missing a dependency. The autogenerated Java files miss an import.

Swagger-codegen version

swagger-codegen-cli-3.0.0-20180717.153005-90

Swagger declaration file content
openapi: 3.0.0
info:
  version: 0.0.0
  title: Example
paths:
  /randomPet:
    get:
      responses:
        '200':
          description: Random pet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      type: object
      required:
        - petType
      properties:
        petType:
          type: string
Command line used for generation

java -jar swagger-codegen-cli-3.0.0-20180717.153005-90.jar generate -DhideGenerationTimestamp=true -l spring -i openapi.yaml

pom.xml problem

The following entry is missing from the pom:

         <!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations -->
         <dependency>
             <groupId>io.swagger.core.v3</groupId>
             <artifactId>swagger-annotations</artifactId>
             <version>2.0.3</version>
         </dependency>
Generated .java files problem

The following import is missing from the file src/main/java/io/swagger/model/Pet.java:

import io.swagger.annotations.ApiModelProperty;

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

Reproduce the report with the supplied OpenAPI YAML and generation command, then inspect the generated pom.xml and src/main/java/io/swagger/model/Pet.java. Trace the generator templates responsible for these outputs; the work is done when the generated project includes the swagger-annotations dependency, Pet.java imports ApiModelProperty, and the generated project builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, backend, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.