Skip to content

feat: Better align with Jackson annotations #180

@kpavlov

Description

@kpavlov

Note

To refine the task

Description

If the Jackson annotations are available, make use of them more. See #204

Example

There is one use case that could be improved:

import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.annotation.JsonValue

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes(
    JsonSubTypes.Type(value = SealedExample.ExampleA::class, name = "exampleA"),
    JsonSubTypes.Type(
        value = SealedExample.ExampleB::class,
        name = "exampleB",
    ),
)
sealed class SealedExample {
    data object ExampleA : SealedExample()

    data object ExampleB : SealedExample()
}

It would be nice if schema generated could read this and have enforce mapping:

"type": {
  "type": "string",
  "const": "exampleA"
}

Currently it would be:

"type": {
  "type": "string",
  "const": "SealedExample.ExampleA"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    internal-usersIssues and PRs raised by internal users

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions