Package com.bazaarvoice.commons.data.model.json.schema.types

Examples of com.bazaarvoice.commons.data.model.json.schema.types.JSONSchemaObjectType


                        putOpt("maxLength", stringType.getMaximumLength()).
                        putOpt("pattern", stringType.getPattern()).
                        putOpt("format", convertSchemaTextFormatToJSONValue(stringType.getFormat(), stringType.getCustomFormat()));

            } else if (type instanceof JSONSchemaObjectType) {
                JSONSchemaObjectType objectType = (JSONSchemaObjectType) type;

                jsonObject.put("properties", _namedPropertyMarshaller.toMappedJSONObject(objectType.getNamedProperties()));

                if (!objectType.getPatternProperties().isEmpty()) {
                    jsonObject.put("patternProperties", _patternPropertyMarshaller.toMappedJSONObject(objectType.getPatternProperties()));
                }

                JSONSchema additionalPropertiesSchema = objectType.getAdditionalPropertiesSchema();
                if (additionalPropertiesSchema == null) {
                    jsonObject.put("additionalProperties", false);
                } else if (!additionalPropertiesSchema.isEmpty()) {
                    jsonObject.put("additionalProperties", toJSONObject(additionalPropertiesSchema, false));
                }
View Full Code Here


                    public String apply(@Nullable Object input) {
                        return input instanceof String ? (String) input : null;
                    }
                }), Predicates.notNull()));
            } else if (type instanceof JSONSchemaObjectType) {
                JSONSchemaObjectType objectType = (JSONSchemaObjectType) type;

                JSONObject propertiesJSONObject = jsonObject.optJSONObject("properties");
                if (propertiesJSONObject != null) {
                    objectType.setNamedProperties(_namedPropertyMarshaller.fromMappedJSONObject(propertiesJSONObject, null));
                }

                JSONObject patternPropertiesJSONObject = jsonObject.optJSONObject("patternProperties");
                if (patternPropertiesJSONObject != null) {
                    objectType.setPatternProperties(_patternPropertyMarshaller.fromMappedJSONObject(patternPropertiesJSONObject, null));
                }

                Object additionalProperties = jsonObject.opt("additionalProperties");
                if (additionalProperties instanceof JSONObject) {
                    objectType.setAdditionalPropertiesSchema(fromJSONObject((JSONObject) additionalProperties));
                } else if (additionalProperties instanceof Boolean && !((Boolean) additionalProperties)) {
                    objectType.setAdditionalPropertiesSchema(null);
                } else if (additionalProperties != null && additionalProperties != JSONObject.NULL) {
                    throw new IllegalArgumentException("Unsupported additional properties: " + additionalProperties);
                }
            } else if (type instanceof JSONSchemaArrayType) {
                JSONSchemaArrayType arrayType = (JSONSchemaArrayType) type;
View Full Code Here

    public static JSONSchema newSimpleSchema(JSONSchemaType<?> type) {
        return new JSONSchema().addType(type);
    }

    public static JSONSchema newObjectSchema(JSONSchemaProperty... properties) {
        return newSimpleSchema(new JSONSchemaObjectType().allProperties(properties));
    }
View Full Code Here

    public static JSONSchema newObjectSchema(JSONSchemaProperty... properties) {
        return newSimpleSchema(new JSONSchemaObjectType().allProperties(properties));
    }

    public static JSONSchema newStrictObjectSchema(JSONSchemaProperty... properties) {
        return newSimpleSchema(new JSONSchemaObjectType().allProperties(properties).disallowAdditionalProperties());
    }
View Full Code Here

    public static JSONSchema newStrictObjectSchema(JSONSchemaProperty... properties) {
        return newSimpleSchema(new JSONSchemaObjectType().allProperties(properties).disallowAdditionalProperties());
    }

    public static JSONSchema newUniformObjectSchema(JSONSchema additionalProperties) {
        return newSimpleSchema(new JSONSchemaObjectType().additionalPropertiesSchema(additionalProperties));
    }
View Full Code Here

                        putOpt("maxLength", stringType.getMaximumLength()).
                        putOpt("pattern", stringType.getPattern()).
                        putOpt("format", convertSchemaTextFormatToJSONValue(stringType.getFormat(), stringType.getCustomFormat()));

            } else if (type instanceof JSONSchemaObjectType) {
                JSONSchemaObjectType objectType = (JSONSchemaObjectType) type;

                jsonObject.put("properties", _namedPropertyMarshaller.toMappedJSONObject(objectType.getNamedProperties()));

                if (!objectType.getPatternProperties().isEmpty()) {
                    jsonObject.put("patternProperties", _patternPropertyMarshaller.toMappedJSONObject(objectType.getPatternProperties()));
                }

                JSONSchema additionalPropertiesSchema = objectType.getAdditionalPropertiesSchema();
                if (additionalPropertiesSchema == null) {
                    jsonObject.put("additionalProperties", false);
                } else if (!additionalPropertiesSchema.isEmpty()) {
                    jsonObject.put("additionalProperties", toJSONObject(additionalPropertiesSchema, false));
                }
View Full Code Here

                    public String apply(@Nullable Object input) {
                        return input instanceof String ? (String) input : null;
                    }
                }), Predicates.notNull()));
            } else if (type instanceof JSONSchemaObjectType) {
                JSONSchemaObjectType objectType = (JSONSchemaObjectType) type;

                JSONObject propertiesJSONObject = jsonObject.optJSONObject("properties");
                if (propertiesJSONObject != null) {
                    objectType.setNamedProperties(_namedPropertyMarshaller.fromMappedJSONObject(propertiesJSONObject, null));
                }

                JSONObject patternPropertiesJSONObject = jsonObject.optJSONObject("patternProperties");
                if (patternPropertiesJSONObject != null) {
                    objectType.setPatternProperties(_patternPropertyMarshaller.fromMappedJSONObject(patternPropertiesJSONObject, null));
                }

                Object additionalProperties = jsonObject.opt("additionalProperties");
                if (additionalProperties instanceof JSONObject) {
                    objectType.setAdditionalPropertiesSchema(fromJSONObject((JSONObject) additionalProperties));
                } else if (additionalProperties instanceof Boolean && !((Boolean) additionalProperties)) {
                    objectType.setAdditionalPropertiesSchema(null);
                } else if (additionalProperties != null && additionalProperties != JSONObject.NULL) {
                    throw new IllegalArgumentException("Unsupported additional properties: " + additionalProperties);
                }
            } else if (type instanceof JSONSchemaArrayType) {
                JSONSchemaArrayType arrayType = (JSONSchemaArrayType) type;
View Full Code Here

TOP

Related Classes of com.bazaarvoice.commons.data.model.json.schema.types.JSONSchemaObjectType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.