OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAVA][PLAY] An Override annotation is generated even though there is no super method.

Open
#9,228 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When you try to generate a client using configuration specified later, you will get uncompilable code because of overriding methods that do not exist in implemented interface.

openapi-generator version

it happens in the most recent master version

OpenAPI declaration file content or url

any api declaration file

{
    "openapi": "3.0.2",
    "info": {
        "title": "New API",
        "version": "1.0.0",
        "description": "A brand new API with no content.  Go nuts!"
    },
    "paths": {}
}
Generation Details
Steps to reproduce

config.yaml

generatorName: java
library: retrofit2
inputSpec: api-spec.json
minimalUpdate: true
additionalProperties:
  usePlayWS: true
  enableBuilderSupport: true
  useBeanValidation: true
  playVersion: play26

java -jar generator.jar batch -- config.yaml

Related issues/PRs
Suggest a fix

class Play26CallFactory implements okhttp3.Call.Factory @Overrides a method timeout() that does not exist in the interface

I believe it can be removed along with the AsyncTimeout instance from the mustache files.

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 config.yaml and api-spec.json reproduction, then inspect the Java Play26 mustache templates used by the batch command. Check where Play26CallFactory implements okhttp3.Call.Factory and generates the timeout() override and AsyncTimeout instance. Done means the generated Play26 client no longer contains an override for a nonexistent interface method and compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
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.