OpenAPITools / OpenAPITools/openapi-generator
[BUG] Jersey3: only generating models will still import autogenerated `JSON` file
Nobody has claimed this yet.
- 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
Specifying only model generation will still try to import the autogenerated org.openapitools.client.JSON file, even though it is not generated.
openapi-generator version
6.4.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Title
version: "1"
paths:
/test:
get:
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Tag'
components:
schemas:
Tag:
type: object
required:
- name
properties:
name:
description: tag name
type: string
values:
type: array
minItems: 0
maxItems: 32
items:
type: string
Generation Details
java -jar openapi-generator-cli.jar generate -g java --library jersey3 --global-property=models -i spec.yaml -o out
Steps to reproduce
Run the above command with the given spec. Looking at the resulting Tag.java imports, you'll see that import org.openapitools.client.JSON is there but is unused in the file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the documented Java Jersey3 generation command with the provided spec and the models-only global property. Start by tracing the Jersey3 model-generation path that produces Tag.java and its imports. Done means the generated model no longer imports org.openapitools.client.JSON when that file is not generated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100