public NumberSchema numberSchema() { return new NumberSchema(); }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (!(obj instanceof NumberSchema)) return false; return _equals((NumberSchema) obj); }
NumberSchema numberSchema = new NumberSchema(); numberSchema.setTitle(name); if (property.getMin() != null) { numberSchema.setMinimum(Double.parseDouble(property.getMin())); numberSchema.setMaximum(Double.parseDouble(property.getMax()));
protected JsonSchema addValidationConstraints(JsonSchema schema, BeanProperty prop) { { Boolean required = constraintResolver.getRequired(prop); if (required != null) { schema.setRequired(required); } } if (schema.isArraySchema()) { ArraySchema arraySchema = schema.asArraySchema(); arraySchema.setMaxItems(constraintResolver.getArrayMaxItems(prop)); arraySchema.setMinItems(constraintResolver.getArrayMinItems(prop)); } else if (schema.isNumberSchema()) { NumberSchema numberSchema = schema.asNumberSchema(); numberSchema.setMaximum(constraintResolver.getNumberMaximum(prop)); numberSchema.setMinimum(constraintResolver.getNumberMinimum(prop)); } else if (schema.isStringSchema()) { StringSchema stringSchema = schema.asStringSchema(); stringSchema.setMaxLength(constraintResolver.getStringMaxLength(prop)); stringSchema.setMinLength(constraintResolver.getStringMinLength(prop)); stringSchema.setPattern(constraintResolver.getStringPattern(prop)); } return schema; }
NumberSchema numberSchema = new NumberSchema(); numberSchema.setTitle(name); if (property.getMin() != null) { numberSchema.setMinimum(Double.parseDouble(property.getMin())); numberSchema.setMaximum(Double.parseDouble(property.getMax()));
protected JsonSchema addValidationConstraints(JsonSchema schema, BeanProperty prop) { { Boolean required = constraintResolver.getRequired(prop); if (required != null) { schema.setRequired(required); } } if (schema.isArraySchema()) { ArraySchema arraySchema = schema.asArraySchema(); arraySchema.setMaxItems(constraintResolver.getArrayMaxItems(prop)); arraySchema.setMinItems(constraintResolver.getArrayMinItems(prop)); } else if (schema.isNumberSchema()) { NumberSchema numberSchema = schema.asNumberSchema(); numberSchema.setMaximum(constraintResolver.getNumberMaximum(prop)); numberSchema.setMinimum(constraintResolver.getNumberMinimum(prop)); } else if (schema.isStringSchema()) { StringSchema stringSchema = schema.asStringSchema(); stringSchema.setMaxLength(constraintResolver.getStringMaxLength(prop)); stringSchema.setMinLength(constraintResolver.getStringMinLength(prop)); stringSchema.setPattern(constraintResolver.getStringPattern(prop)); } return schema; }
NumberSchema numberSchema = new NumberSchema(); numberSchema.setTitle(name); if (property.getMin() != null) { numberSchema.setMinimum(Double.parseDouble(property.getMin())); numberSchema.setMaximum(Double.parseDouble(property.getMax()));
public NumberSchema numberSchema() { return new NumberSchema(); }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (!(obj instanceof NumberSchema)) return false; return _equals((NumberSchema) obj); }
NumberSchema numberSchema = new NumberSchema(); numberSchema.setTitle(name); if (property.getMin() != null) { numberSchema.setMinimum(Double.parseDouble(property.getMin())); numberSchema.setMaximum(Double.parseDouble(property.getMax()));
/** * Create a schema which verifies only that an object is of the given format. * @param format the format to expect * @return the schema verifying the given format */ public static JsonSchema minimalForFormat(JsonFormatTypes format) { if (format != null) { switch (format) { case ARRAY: return new ArraySchema(); case OBJECT: return new ObjectSchema(); case BOOLEAN: return new BooleanSchema(); case INTEGER: return new IntegerSchema(); case NUMBER: return new NumberSchema(); case STRING: return new StringSchema(); case NULL: return new NullSchema(); case ANY: default: } } return new AnySchema(); }
NumberSchema numberSchema = new NumberSchema(); numberSchema.setTitle(name); if (property.getMin() != null) { numberSchema.setMinimum(Double.parseDouble(property.getMin())); numberSchema.setMaximum(Double.parseDouble(property.getMax()));
/** * Create a schema which verifies only that an object is of the given format. * @param format the format to expect * @return the schema verifying the given format */ public static JsonSchema minimalForFormat(JsonFormatTypes format) { if (format != null) { switch (format) { case ARRAY: return new ArraySchema(); case OBJECT: return new ObjectSchema(); case BOOLEAN: return new BooleanSchema(); case INTEGER: return new IntegerSchema(); case NUMBER: return new NumberSchema(); case STRING: return new StringSchema(); case NULL: return new NullSchema(); case ANY: default: } } return new AnySchema(); }
public SalesforceMetadataRetrievalTest() { final Map<String, JsonSchema> objectProperties = new HashMap<>(); objectProperties.put("simpleProperty", new StringSchema()); objectProperties.put("anotherProperty", new NumberSchema()); final StringSchema uniqueProperty1 = new StringSchema(); uniqueProperty1.setDescription("idLookup,autoNumber"); uniqueProperty1.setTitle("Unique property 1"); final StringSchema uniqueProperty2 = new StringSchema(); uniqueProperty2.setDescription("calculated,idLookup"); uniqueProperty2.setTitle("Unique property 2"); objectProperties.put("uniqueProperty1", uniqueProperty1); objectProperties.put("uniqueProperty2", uniqueProperty2); final ObjectSchema objectSchema = new ObjectSchema(); objectSchema.setId("urn:jsonschema:org:apache:camel:component:salesforce:dto:SimpleObject"); objectSchema.setProperties(objectProperties); payload = new ObjectSchema(); payload.setOneOf(Collections.singleton(objectSchema)); }