Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: serialization type remains string even if the shape is different #5961

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ public abstract class AbstractJsonSchema<T, B> {
new KubernetesSerialization(mapper, false);
GENERATOR = new JsonSchemaGenerator(mapper);

JSON_FORMAT_SHAPE_MAPPING.put(JsonFormat.Shape.BOOLEAN, Types.typeDefFrom(Boolean.class).toReference());
JSON_FORMAT_SHAPE_MAPPING.put(JsonFormat.Shape.NUMBER, Types.typeDefFrom(Double.class).toReference());
JSON_FORMAT_SHAPE_MAPPING.put(JsonFormat.Shape.NUMBER_FLOAT, Types.typeDefFrom(Double.class).toReference());
JSON_FORMAT_SHAPE_MAPPING.put(JsonFormat.Shape.NUMBER_INT, Types.typeDefFrom(Long.class).toReference());
JSON_FORMAT_SHAPE_MAPPING.put(JsonFormat.Shape.STRING, Types.typeDefFrom(String.class).toReference());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ void shouldAugmentPropertiesSchemaFromAnnotations() throws JsonProcessingExcepti
assertEquals(type.apply("string").withDefault(TextNode.valueOf("my-value")).build(), spec.get("defaultValue"));
assertEquals(type.apply("string").withDefault(TextNode.valueOf("my-value2")).build(), spec.get("defaultValue2"));
assertEquals(type.apply("string").withEnum(TextNode.valueOf("non"), TextNode.valueOf("oui")).build(), spec.get("anEnum"));
assertEquals(type.apply("boolean").build(), spec.get("bool"));
assertEquals(type.apply("number").build(), spec.get("num"));
assertEquals(type.apply("number").build(), spec.get("numFloat"));
assertEquals(type.apply("integer").build(), spec.get("numInt"));
assertEquals(type.apply("string").build(), spec.get("bool"));
assertEquals(type.apply("string").build(), spec.get("num"));
assertEquals(type.apply("string").build(), spec.get("numFloat"));
assertEquals(type.apply("string").build(), spec.get("numInt"));
assertEquals(type.apply("string").build(), spec.get("issuedAt"));

// check required list, should register properties with their modified name if needed
Expand Down