Skip to content

[BUG] Error when using generateUnmarshalJSON=false #24053

Closed

Description

@patrick-menoti-azion

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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?
Description

When using the flag generateUnmarshalJSON=false with golang generator, a bug happens.
For one-of schemas, the generator is removing the import:
"gopkg.in/validator.v2"
But it still keeps the usage of this import:
if err = validator.Validate(dst.ConnectorHTTP); err != nil {
If it is still using the validator, it should not remove the import

openapi-generator version

Latest

Generation Details

npx @openapitools/openapi-generator-cli generate -i "$file" -g go -o "./${output}" --package-name "${pkg_name}" --additional-properties=generateUnmarshalJSON=false

Steps to reproduce

Generate a golang SDK with one-of schema.

Suggest a fix

We should not remove the import, due to still using the validator method.

Activity

  1. added a commit that references this issue on Jul 2, 2026
    77c2e46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to 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