Skip to content

[Bug]: Wrong schema for nullable object #5158

@T3rm1

Description

@T3rm1

Description of the problem/issue

Wrong schema generation of properties of type Object that are nullable.

Affected Version

2.2.47

Worked in:
2.2.28

Steps to Reproduce

public class MyDto {

	@Nullable
	private Object nullableObject;

	public Object getNullableObject() {
		return nullableObject;
	}

	public void setNullableObject(Object nullableObject) {
		this.nullableObject = nullableObject;
	}
}

Expected Behavior

"components": {
    "schemas": {
      "MyDto": {
        "type": "object",
        "properties": {
          "nullableObject": {
          }
        }
      }
    }
  }

Actual Behavior

"components": {
    "schemas": {
      "MyDto": {
        "type": "object",
        "properties": {
          "nullableObject": {
            "type": "null"
          }
        }
      }
    }
  }

Additional Context

Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided sufficient information for maintainers to reproduce the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions