Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4207
Closed
Open
Issue created Oct 21, 2019 by Administrator@rootContributor0 of 5 checklist items completed0/5 checklist items

[BUG] JavaSpring: Class in OpenAPI2SpringBoot.java does not fully implement interface

Created by: keithchong

Bug Report Checklist

See 'secondary' bug from https://github.com/OpenAPITools/openapi-generator/issues/1164

  • Have you provided a full/minimal spec to reproduce the issue? No. Simply generate using the spring server generator to see the issue
  • Have you validated the input using an OpenAPI validator (example)? No. I used the standard petstore example
  • What's the version of OpenAPI Generator used? 4.0.3 (but, the master code of that template still shows the problem)
  • Have you search for related issues/PRs? Originally reported in https://github.com/OpenAPITools/openapi-generator/issues/1164 See description starting with:

Note: In addition to the above problem and unrelated to this there is a generated code in the generated OpenAPI2SpringBoot.java

  • What's the actual output vs expected output? When you generate the code, you will immediately see Java compile errors (I was using Eclipse and VS Code with the Java extension)
Description

The spring server generated code has compilation errors because the class does not fully implement an interface:

@bean public WebMvcConfigurer webConfigurer() { return new WebMvcConfigurer() { /* @override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("") .allowedMethods("") .allowedHeaders("Content-Type"); } */ }; }

openapi-generator version

4.0.1. The template in the master branch does not have the entire method commented out, as this was the proposed solution.

OpenAPI declaration file content or url

Use the petstore.yaml sample

Command line used for generation

generate -g spring -i petstore.yaml -o

Steps to reproduce

Simply generate and import the project into your favourite IDE (I can reproduce in Eclipse as well as VS Code with the Java extension added)

Related issues/PRs

See 'secondary' bug from https://github.com/OpenAPITools/openapi-generator/issues/1164

Suggest a fix

As described in the related issue, you can simply comment out the entire method (or implement the interface properly).

Assignee
Assign to
Time tracking