Skip to content

jackson: v3 generating wrong jackson annotation import statements #481

Description

@ophalsp

When running the openapi-processor-spring with mapping jackson: v3,

openapi-processor-spring: v1
options:
  spring:
    annotations: exchange
  package-name: some.packagename
  jackson: v3
  javadoc: true

Creating an enum like this

    DummyEnum:
      type: string
      enum:
        - A
        - B
        - C

results in generated codes that looks like this:

package some.packagename.model;

import some.packagename.support.Generated;
import tools.jackson.annotation.JsonCreator;
import tools.jackson.annotation.JsonValue;

@Generated(
    value = "openapi-processor-spring",
    version = "2026.3",
    date = "2026-07-09T09:58:18.081946317Z")
public enum DummyEnum {
  A("A"),
  B("B"),
  C("C");

  private final String value;

  DummyEnum(String value) {
    this.value = value;
  }

  @JsonValue
  public String getValue() {
    return this.value;
  }

  @JsonCreator
  public static DummyEnum fromValue(String value) {
    for (DummyEnum val : DummyEnum.values()) {
      if (val.value.equals(value)) {
        return val;
      }
    }
    throw new IllegalArgumentException(value);
  }

}

You will notice the tools.jackson.annotation.JsonCreator import statement which is incorrect, it should be com.fasterxml.jackson.annotation.JsonCreator.
To my knowledge the Jackson annotations, and only the annotations, have kept the old package name structure in the Jackson v3 version.
See the jackson release notes, under the Major changes section

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions