Skip to content

[BUG][Go] Unused "bytes" import in v7.2.0 #17575

@dyurovskykh-tivo

Description

@dyurovskykh-tivo

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

#17267 moved import of bytes from a specific file model_simple.mustache to generator code that is applied to all files, including model_oneof.mustache that does not use bytes. And this leads to the following error:

schema/generated/some-config/model_object_model.go:14:2: "bytes" imported and not used
openapi-generator version
  • 7.2.0
  • latest
OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: Test
  version: 1.0.0
paths: {}
components:
  schemas:
    NestedObject1:
      required:
        - field1
      properties:
        field1:
          description: Specifies an action name to be used with the Android Intent class.
          type: string
    NestedObject2:
      required:
        - field2
      properties:
        field2:
          description: Specifies an action name to be used with the Android Intent class.
          type: string
    Object:
      oneOf:
        - $ref: '#/components/schemas/NestedObject1'
        - $ref: '#/components/schemas/NestedObject2'
Generation Details

docker run --rm -u 1001:1001 -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.2.0 generate -i /local/test.yaml -g go -o /local/out/go

Steps to reproduce

Run generator and try to build the generated code.

Related issues/PRs

#17267

Suggest a fix

Partial revert of #17267, in particular, code change suggested in #17267 (comment)

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