public interface MongoJsonSchema
builder(), for
example:
MongoJsonSchema schema = MongoJsonSchema.builder().required("firstname", "lastname")
.properties(string("firstname").possibleValues("luke", "han"),
object("address").properties(string("postCode").minLength(4).maxLength(5))
).build();
resulting in the following schema:
{
"type": "object",
"required": [ "firstname", "lastname" ],
"properties": {
"firstname": {
"type": "string", "enum": [ "luke", "han" ],
},
"address": {
"type": "object",
"properties": {
"postCode": { "type": "string", "minLength": 4, "maxLength": 5 }
}
}
}
}
UntypedJsonSchemaObject,
TypedJsonSchemaObject| Modifier and Type | Interface and Description |
|---|---|
static interface |
MongoJsonSchema.ConflictResolutionFunction
A resolution function that is called on conflicting paths when trying to merge properties with different values
into a single value.
|
static class |
MongoJsonSchema.MongoJsonSchemaBuilder
MongoJsonSchema.MongoJsonSchemaBuilder provides a fluent API for defining a MongoJsonSchema. |
| Modifier and Type | Method and Description |
|---|---|
static MongoJsonSchema.MongoJsonSchemaBuilder |
builder()
Obtain a new
MongoJsonSchema.MongoJsonSchemaBuilder to fluently define the schema. |
static MongoJsonSchema |
merge(MongoJsonSchema... sources)
Create a new
MongoJsonSchema merging properties from the given sources. |
static MongoJsonSchema |
merge(MongoJsonSchema.ConflictResolutionFunction mergeFunction,
MongoJsonSchema... sources)
Create a new
MongoJsonSchema merging properties from the given sources. |
default MongoJsonSchema |
mergeWith(Collection<MongoJsonSchema> sources)
Create a new
MongoJsonSchema merging properties from the given sources. |
default MongoJsonSchema |
mergeWith(Collection<MongoJsonSchema> sources,
MongoJsonSchema.ConflictResolutionFunction conflictResolutionFunction)
Create a new
MongoJsonSchema merging properties from the given sources. |
default MongoJsonSchema |
mergeWith(MongoJsonSchema... sources)
Create a new
MongoJsonSchema merging properties from the given sources. |
static MongoJsonSchema |
of(org.bson.Document document)
Create a new
MongoJsonSchema for a given root Document containing the schema definition. |
static MongoJsonSchema |
of(JsonSchemaObject root)
Create a new
MongoJsonSchema for a given root object. |
org.bson.Document |
schemaDocument()
Create the
Document defining the schema. |
default org.bson.Document |
toDocument()
|
default org.bson.Document toDocument()
$jsonSchema Document containing the specified schemaDocument(). Document through a
JsonSchemaMapper to apply field name customization.org.bson.Document schemaDocument()
Document defining the schema. Document through a
JsonSchemaMapper to apply field name customization.static MongoJsonSchema of(JsonSchemaObject root)
MongoJsonSchema for a given root object.root - must not be null.MongoJsonSchema.static MongoJsonSchema of(org.bson.Document document)
MongoJsonSchema for a given root Document containing the schema definition.document - must not be null.MongoJsonSchema.static MongoJsonSchema merge(MongoJsonSchema... sources)
MongoJsonSchema merging properties from the given sources.sources - must not be null.MongoJsonSchema.static MongoJsonSchema merge(MongoJsonSchema.ConflictResolutionFunction mergeFunction, MongoJsonSchema... sources)
MongoJsonSchema merging properties from the given sources.sources - must not be null.MongoJsonSchema.default MongoJsonSchema mergeWith(MongoJsonSchema... sources)
MongoJsonSchema merging properties from the given sources.sources - must not be null.MongoJsonSchema.default MongoJsonSchema mergeWith(Collection<MongoJsonSchema> sources)
MongoJsonSchema merging properties from the given sources.sources - must not be null.MongoJsonSchema.default MongoJsonSchema mergeWith(Collection<MongoJsonSchema> sources, MongoJsonSchema.ConflictResolutionFunction conflictResolutionFunction)
MongoJsonSchema merging properties from the given sources.sources - must not be null.MongoJsonSchema.static MongoJsonSchema.MongoJsonSchemaBuilder builder()
MongoJsonSchema.MongoJsonSchemaBuilder to fluently define the schema.MongoJsonSchema.MongoJsonSchemaBuilder.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.