Exemplo n.º 1
0
        private bool ContentMatchesResourceSchema(string content, string resourceType, JsonResourceCollection resources, out ValidationError[] schemaErrors)
        {
            List <ValidationError> errors = new List <Error.ValidationError>();
            var resourceTypeSchema        = resources.GetJsonSchema(resourceType, errors, null);

            ValidationError[] validationErrors;
            if (!resources.ValidateJsonCompilesWithSchema(resourceTypeSchema, new JsonExample(content)
            {
                Annotation = new CodeBlockAnnotation {
                    TruncatedResult = true
                }
            }, out validationErrors))
            {
                errors.AddRange(validationErrors);
            }

            schemaErrors = errors.ToArray();
            return(errors.WereErrors());
        }
Exemplo n.º 2
0
        private bool ContentMatchesResourceSchema(string content, string resourceType, JsonResourceCollection resources, IssueLogger issues)
        {
            List <ValidationError> errors = new List <Error.ValidationError>();
            var resourceTypeSchema        = resources.GetJsonSchema(resourceType, issues, null);

            resources.ValidateJsonCompilesWithSchema(resourceTypeSchema, new JsonExample(content)
            {
                Annotation = new CodeBlockAnnotation {
                    TruncatedResult = true
                }
            }, issues);
            return(issues.Issues.WereErrors());
        }