File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
src/main/java/com/fasterxml/jackson/module/jsonSchema/factories Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 5
5
import com .fasterxml .jackson .databind .SerializerProvider ;
6
6
import com .fasterxml .jackson .databind .jsonFormatVisitors .JsonFormatVisitable ;
7
7
import com .fasterxml .jackson .databind .jsonFormatVisitors .JsonMapFormatVisitor ;
8
+ import com .fasterxml .jackson .module .jsonSchema .JsonSchema ;
8
9
import com .fasterxml .jackson .module .jsonSchema .types .ObjectSchema ;
9
10
10
11
/**
@@ -58,10 +59,21 @@ public void keyFormat(JsonFormatVisitable handler, JavaType keyType)
58
59
// JSON Schema only allows String types so let's not bother too much
59
60
}
60
61
61
- @ Override
62
+ @ Override
62
63
public void valueFormat (JsonFormatVisitable handler , JavaType valueType )
63
64
throws JsonMappingException {
64
- /* Also... not sure what to do with value type either.
65
- */
65
+
66
+ // ISSUE #24: https://github.com/FasterXML/jackson-module-jsonSchema/issues/24
67
+
68
+ JsonSchema valueSchema = propertySchema (handler , valueType );
69
+ ObjectSchema .AdditionalProperties ap = new ObjectSchema .SchemaAdditionalProperties (valueSchema .asSimpleTypeSchema ());
70
+ this .schema .setAdditionalProperties (ap );
71
+ }
72
+
73
+ protected JsonSchema propertySchema (JsonFormatVisitable handler , JavaType propertyTypeHint )
74
+ throws JsonMappingException {
75
+ SchemaFactoryWrapper visitor = wrapperFactory .getWrapper (getProvider ());
76
+ handler .acceptJsonFormatVisitor (visitor , propertyTypeHint );
77
+ return visitor .finalSchema ();
66
78
}
67
79
}
You can’t perform that action at this time.
0 commit comments