|
|
|
@ -22,6 +22,7 @@ import static org.springframework.data.mongodb.core.schema.JsonSchemaObject.of; |
|
|
|
import static org.springframework.data.mongodb.test.util.Assertions.*; |
|
|
|
import static org.springframework.data.mongodb.test.util.Assertions.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
|
|
|
|
import org.bson.Document; |
|
|
|
import org.bson.Document; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
@ -33,6 +34,7 @@ import org.springframework.data.domain.Range.*; |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Christoph Strobl |
|
|
|
* @author Christoph Strobl |
|
|
|
* @author Mark Paluch |
|
|
|
* @author Mark Paluch |
|
|
|
|
|
|
|
* @author Michał Kurcius |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class JsonSchemaObjectUnitTests { |
|
|
|
public class JsonSchemaObjectUnitTests { |
|
|
|
|
|
|
|
|
|
|
|
@ -209,6 +211,13 @@ public class JsonSchemaObjectUnitTests { |
|
|
|
.append("items", Arrays.asList(new Document("type", "string"), new Document("type", "boolean")))); |
|
|
|
.append("items", Arrays.asList(new Document("type", "string"), new Document("type", "boolean")))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // DATAMONGO-2613
|
|
|
|
|
|
|
|
public void arrayObjectShouldRenderItemsCorrectlyAsObjectIfContainsOnlyOneElement() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(array().items(Collections.singletonList(string())).toDocument()).isEqualTo(new Document("type", "array") |
|
|
|
|
|
|
|
.append("items", new Document("type", "string"))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test // DATAMONGO-1835
|
|
|
|
@Test // DATAMONGO-1835
|
|
|
|
public void arrayObjectShouldRenderMaxItemsCorrectly() { |
|
|
|
public void arrayObjectShouldRenderMaxItemsCorrectly() { |
|
|
|
|
|
|
|
|
|
|
|
|