OpenAPITools / OpenAPITools/openapi-generator
[BUG][GO] "reflect" imported and not used
Open
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?
Getting compilation error"reflect" imported and not usedfor generated file. - [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Generated code for part of the 3GPP spec not compile.
openapi-generator version
7.10.0-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: '1.0.0'
title: '-'
paths:
/req:
get:
summary: Request
operationId: Request
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Req'
encoding:
prop:
contentType: application/json
responses:
'200':
description: OK
components:
schemas:
Req:
type: object
properties:
prop:
type: array
items:
type: integer
Generation Details
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate \
--input-spec /local/fail_schema.yaml \
--generator-name go \
--additional-properties "withGoMod=false" \
--package-name gen \
--output /local/gen_fail
Steps to reproduce
You can use this gist.
Related issues/PRs
Suggest a fix
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
Start by running the provided Docker generation command with the minimal OpenAPI schema or linked gist, then inspect the generated Go files for the unused reflect import. Check the related pull request before starting; done means the generated package compiles without the unused-import error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100