Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

JsonFormat not supported?

Open
#133 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java

Research direction

Reproduce the schema generation with the Wound entity, ObjectMapper, JavaTimeModule, and JsonSchemaGenerator shown in the issue. Compare the generated LocalDateTime array or object with the expected string schema, then trace how JsonFormat annotations and JavaTimeModule types are handled. Done means the documented pattern produces the expected date-time schema without Java member properties.

Written by the indexing model from the issue text.

Description

Entity:

public class Wound {

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
    @JsonProperty("createdAt")
    @JsonPropertyDescription("A date time object w/o timezone.")
    @NotNull
    private LocalDateTime createdAt;

}

When I generate with JavaTimeModule(), I get an array of integer in the json schema:

        ObjectMapper objectMapper = new ObjectMapper();
                .registerModule(new JavaTimeModule());

        JsonSchemaGenerator jsonSchemaGenerator = new JsonSchemaGenerator(objectMapper);
        JsonNode jsonSchema = jsonSchemaGenerator.generateJsonSchema(Wound.class);
        String jsonSchemaAsString = objectMapper.writeValueAsString(jsonSchema);
        "createdAt": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "A date time object w/o timezone."
        }

When I omit the JavaTimeModule, I a get a LocalDateTimeObject with Java members:

    "LocalDateTime": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "dayOfYear": {
          "type": "integer"
        },
        "dayOfWeek": {
          "type": "string",
          "enum": [
            "MONDAY",
            "TUESDAY",
            "WEDNESDAY",
            "THURSDAY",
            "FRIDAY",
            "SATURDAY",
            "SUNDAY"
          ]
        },
        "year": {
          "type": "integer"
        },
...

EXPECTED RESULT:

    "dateTime": {
      "description": "A date time object w/o timezone.",
      "type": "string",
      "format": "date-time",
      "javaType": "java.time.LocalDateTime",
      "customDateTimePattern" : "yyyy-MM-dd'T'HH:mm:ss"
    }
Dominant language
Java
Stars
387
Forks
138
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from FasterXML/jackson-module-jsonSchema

All issues in FasterXML/jackson-module-jsonSchema

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.