Search in sources :

Example 11 with RestLiDataValidator

use of com.linkedin.restli.common.validation.RestLiDataValidator in project parseq by linkedin.

the class AutoValidationDemosCreateAndGetBuilder method validateInput.

public static ValidationResult validateInput(ValidationDemo input) {
    Map<String, List<String>> annotations = new HashMap<String, List<String>>();
    annotations.put("createOnly", Arrays.asList("stringB", "intB", "UnionFieldWithInlineRecord/com.linkedin.restli.examples.greetings.api.myRecord/foo2", "MapWithTyperefs/*/id"));
    annotations.put("readOnly", Arrays.asList("stringA", "intA", "UnionFieldWithInlineRecord/com.linkedin.restli.examples.greetings.api.myRecord/foo1", "ArrayWithInlineRecord/*/bar1", "validationDemoNext/stringB", "validationDemoNext/UnionFieldWithInlineRecord"));
    RestLiDataValidator validator = new RestLiDataValidator(annotations, ValidationDemo.class, ResourceMethod.CREATE);
    return validator.validateInput(input);
}
Also used : HashMap(java.util.HashMap) RestLiDataValidator(com.linkedin.restli.common.validation.RestLiDataValidator) List(java.util.List)

Example 12 with RestLiDataValidator

use of com.linkedin.restli.common.validation.RestLiDataValidator in project parseq by linkedin.

the class AutoValidationDemosPartialUpdateBuilder method validateInput.

public static ValidationResult validateInput(PatchRequest<ValidationDemo> patch) {
    Map<String, List<String>> annotations = new HashMap<String, List<String>>();
    annotations.put("createOnly", Arrays.asList("stringB", "intB", "UnionFieldWithInlineRecord/com.linkedin.restli.examples.greetings.api.myRecord/foo2", "MapWithTyperefs/*/id"));
    annotations.put("readOnly", Arrays.asList("stringA", "intA", "UnionFieldWithInlineRecord/com.linkedin.restli.examples.greetings.api.myRecord/foo1", "ArrayWithInlineRecord/*/bar1", "validationDemoNext/stringB", "validationDemoNext/UnionFieldWithInlineRecord"));
    RestLiDataValidator validator = new RestLiDataValidator(annotations, ValidationDemo.class, ResourceMethod.PARTIAL_UPDATE);
    return validator.validateInput(patch);
}
Also used : HashMap(java.util.HashMap) RestLiDataValidator(com.linkedin.restli.common.validation.RestLiDataValidator) List(java.util.List)

Example 13 with RestLiDataValidator

use of com.linkedin.restli.common.validation.RestLiDataValidator in project parseq by linkedin.

the class AutoValidationDemosUpdateBuilder method validateInput.

public static ValidationResult validateInput(ValidationDemo input) {
    Map<String, List<String>> annotations = new HashMap<String, List<String>>();
    annotations.put("createOnly", Arrays.asList("stringB", "intB", "UnionFieldWithInlineRecord/com.linkedin.restli.examples.greetings.api.myRecord/foo2", "MapWithTyperefs/*/id"));
    annotations.put("readOnly", Arrays.asList("stringA", "intA", "UnionFieldWithInlineRecord/com.linkedin.restli.examples.greetings.api.myRecord/foo1", "ArrayWithInlineRecord/*/bar1", "validationDemoNext/stringB", "validationDemoNext/UnionFieldWithInlineRecord"));
    RestLiDataValidator validator = new RestLiDataValidator(annotations, ValidationDemo.class, ResourceMethod.UPDATE);
    return validator.validateInput(input);
}
Also used : HashMap(java.util.HashMap) RestLiDataValidator(com.linkedin.restli.common.validation.RestLiDataValidator) List(java.util.List)

Example 14 with RestLiDataValidator

use of com.linkedin.restli.common.validation.RestLiDataValidator in project parseq by linkedin.

the class ChainedTyperefsBatchUpdateRequestBuilder method validateInput.

public static ValidationResult validateInput(Greeting input) {
    Map<String, List<String>> annotations = new HashMap<String, List<String>>();
    RestLiDataValidator validator = new RestLiDataValidator(annotations, Greeting.class, ResourceMethod.BATCH_UPDATE);
    return validator.validateInput(input);
}
Also used : HashMap(java.util.HashMap) RestLiDataValidator(com.linkedin.restli.common.validation.RestLiDataValidator) List(java.util.List)

Example 15 with RestLiDataValidator

use of com.linkedin.restli.common.validation.RestLiDataValidator in project parseq by linkedin.

the class ComplexKeysBatchCreateBuilder method validateInput.

public static ValidationResult validateInput(Message input) {
    Map<String, List<String>> annotations = new HashMap<String, List<String>>();
    RestLiDataValidator validator = new RestLiDataValidator(annotations, Message.class, ResourceMethod.BATCH_CREATE);
    return validator.validateInput(input);
}
Also used : HashMap(java.util.HashMap) RestLiDataValidator(com.linkedin.restli.common.validation.RestLiDataValidator) List(java.util.List)

Aggregations

RestLiDataValidator (com.linkedin.restli.common.validation.RestLiDataValidator)229 HashMap (java.util.HashMap)224 List (java.util.List)223 DataMap (com.linkedin.data.DataMap)4 TemplateRuntimeException (com.linkedin.data.template.TemplateRuntimeException)3 ValidationDemo (com.linkedin.restli.examples.greetings.api.ValidationDemo)3 RestLiServiceException (com.linkedin.restli.server.RestLiServiceException)3 Test (org.testng.annotations.Test)3 ValidationResult (com.linkedin.data.schema.validation.ValidationResult)2 ResourceMethod (com.linkedin.restli.common.ResourceMethod)2 QueryParamsDataMap (com.linkedin.restli.internal.common.QueryParamsDataMap)2 Parameter (com.linkedin.restli.internal.server.model.Parameter)2 PagingContext (com.linkedin.restli.server.PagingContext)2 ResourceConfigException (com.linkedin.restli.server.ResourceConfigException)2 RoutingException (com.linkedin.restli.server.RoutingException)2 HeaderParam (com.linkedin.restli.server.annotations.HeaderParam)2 ByteString (com.linkedin.data.ByteString)1 Message (com.linkedin.data.message.Message)1 DataSchema (com.linkedin.data.schema.DataSchema)1 AbstractValidator (com.linkedin.data.schema.validator.AbstractValidator)1