swagger-api / swagger-api/swagger-codegen

[JAVA - Spring boot] Generated Spring boot project gives 404's with Java 11

Open
#9,494 0 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

I created an API in Swaggerhub and wanted to generate a server stub. It let's me download a broken Spring boot project that doesn't work with Java 11 (boots perfectly but gives 404's on all requests).

Full description of the problem here:
https://stackoverflow.com/questions/56504768/swaggerhubs-generated-spring-boot-server-stub-gives-404s-when-ran

Swagger-codegen version

I don't know, Swaggerhub generated it for me. I contacted their support and they told me to file a bug here.

Swagger declaration file content or url

See here: https://app.swaggerhub.com/apis/Leejjon/Example/1.0.0

Command line used for generation

Don't know, it happens on the backend of swaggerhub.

Steps to reproduce
  • Go to https://app.swaggerhub.com/apis/Leejjon/Example/1.0.0
  • Click export -> server stub -> spring
  • Add Jaxb dependencies because it's no longer available in Java 11
  • Run the project via mvn clean install spring-boot:run -Dserver.port=8080
  • Go to localhost:8080/examples
Related issues/PRs
Suggest a fix/enhancement

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 linked SwaggerHub API definition and reproduce the generated Spring Boot project using Java 11 and the stated Maven command. Check the generated server stub and its routing for the /examples request, then compare the result with the expected endpoint behavior. Done means the generated project starts successfully and no longer returns 404 for the documented request.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.