@@ -2032,9 +2032,6 @@ public Schema getSchema(ObjectNode node, String location, ParseResult result){
2032
2032
ArrayNode allOfArray = getArray ("allOf" , node , false , location , result );
2033
2033
ArrayNode anyOfArray = getArray ("anyOf" , node , false , location , result );
2034
2034
ObjectNode itemsNode = getObject ("items" , node , false , location , result );
2035
- ObjectNode additionalPropertiesNode = getObject ("additionalProperties" , node , false , location , result );
2036
- Boolean additionalPropertiesBoolean = getBoolean ("additionalProperties" , node , false , location , result );
2037
-
2038
2035
2039
2036
if ((allOfArray != null )||(anyOfArray != null )|| (oneOfArray != null )) {
2040
2037
ComposedSchema composedSchema = new ComposedSchema ();
@@ -2085,31 +2082,25 @@ public Schema getSchema(ObjectNode node, String location, ParseResult result){
2085
2082
schema = items ;
2086
2083
}
2087
2084
2088
- if (additionalPropertiesNode != null ) {
2089
- MapSchema mapSchema = new MapSchema ();
2090
- if (additionalPropertiesNode .getNodeType ().equals (JsonNodeType .OBJECT )) {
2091
- ObjectNode additionalPropertiesObj = getObject ("additionalProperties" , node , false , location , result );
2092
- if (additionalPropertiesObj != null ) {
2093
- Schema additionalProperties = getSchema (additionalPropertiesObj , location , result );
2094
- if (additionalProperties != null ) {
2095
- mapSchema .setAdditionalProperties (additionalProperties );
2096
- schema = mapSchema ;
2097
- }
2098
- }
2099
- }
2100
- } else if (additionalPropertiesBoolean != null ){
2101
- MapSchema mapSchema = new MapSchema ();
2102
- if (additionalPropertiesBoolean ) {
2103
- mapSchema .setAdditionalProperties (additionalPropertiesBoolean );
2104
- schema = mapSchema ;
2105
- }else {
2106
- ObjectSchema objectSchema = new ObjectSchema ();
2107
- objectSchema .setAdditionalProperties (additionalPropertiesBoolean );
2108
- schema = objectSchema ;
2109
- }
2110
- }
2085
+ Boolean additionalPropertiesBoolean = getBoolean ("additionalProperties" , node , false , location , result );
2111
2086
2087
+ ObjectNode additionalPropertiesObject =
2088
+ additionalPropertiesBoolean == null
2089
+ ? getObject ("additionalProperties" , node , false , location , result )
2090
+ : null ;
2112
2091
2092
+ Object additionalProperties =
2093
+ additionalPropertiesObject != null
2094
+ ? getSchema (additionalPropertiesObject , location , result )
2095
+ : additionalPropertiesBoolean ;
2096
+
2097
+ if (additionalProperties != null ) {
2098
+ schema =
2099
+ additionalProperties .equals ( Boolean .FALSE )
2100
+ ? new ObjectSchema ()
2101
+ : new MapSchema ();
2102
+ schema .setAdditionalProperties ( additionalProperties );
2103
+ }
2113
2104
2114
2105
if (schema == null ){
2115
2106
schema = SchemaTypeUtil .createSchemaByType (node );
0 commit comments