Skip to content

Commit

Permalink
#1650 don't generate neutral string default value based on "minLength"
Browse files Browse the repository at this point in the history
  • Loading branch information
thjaeckle committed Aug 1, 2024
1 parent 208fa97 commit 7aadc82
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import org.eclipse.ditto.wot.model.Properties;
import org.eclipse.ditto.wot.model.Property;
import org.eclipse.ditto.wot.model.SingleDataSchema;
import org.eclipse.ditto.wot.model.StringSchema;
import org.eclipse.ditto.wot.model.ThingDefinitionInvalidException;
import org.eclipse.ditto.wot.model.ThingModel;
import org.eclipse.ditto.wot.model.TmOptional;
Expand Down Expand Up @@ -493,9 +492,7 @@ private static Optional<JsonValue> provideNeutralElementForDataSchema(final Sing
numberSchema.getExclusiveMaximum().orElse(null));
return Optional.of(JsonValue.of(neutralDouble));
case STRING:
final StringSchema stringSchema = (StringSchema) dataSchema;
final String neutralString = provideNeutralStringElement(stringSchema.getMinLength().orElse(null));
return Optional.of(JsonValue.of(neutralString));
return Optional.of(JsonValue.of(provideNeutralStringElement()));
case OBJECT:
return Optional.of(JsonObject.empty());
case ARRAY:
Expand Down Expand Up @@ -550,10 +547,7 @@ private static double provideNeutralDoubleElement(@Nullable final Double minimum
return result;
}

private static String provideNeutralStringElement(@Nullable final Integer minLength) {
if (null != minLength && minLength > 0) {
return "_".repeat(minLength);
}
private static String provideNeutralStringElement() {
return "";
}

Expand Down

0 comments on commit 7aadc82

Please sign in to comment.