Skip to content

[BUG][GO] "reflect" imported and not used #19968

@perhallgren

Description

@perhallgren

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 used for 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions