JsonFormat not supported?
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
- Domain
- backend-api-design
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FasterXML/jackson-module-jsonSchema
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
FasterXML/jackson-module-jsonSchema#160 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
pr-needed
Difficulty 3/5 1-2 days Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#136 · 10 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#135 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
FasterXML/jackson-module-jsonSchema#134 · 2 comments · 1 reaction ·
All issues in FasterXML/jackson-module-jsonSchema
Similar issues
-
dev/release: verify-release-candidate.sh runs 0 Java tests with Debian's MavenPossibly taken @kou claimed this today. OpenType: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/arrow-adbc#4947 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lysine-dev/okhttp#9814 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
checkstyle/checkstyle#22153 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day