Example #1
0
        public FhirResponse ValidateOperation(IKey key, Resource resource)
        {
            if (resource == null)
            {
                throw Error.BadRequest("Validate needs a Resource in the body payload");
            }
            Validate.ResourceType(key, resource);

            // DSTU2: validation
            var outcome = Validate.AgainstSchema(resource);

            if (outcome == null)
            {
                return(Respond.WithCode(HttpStatusCode.OK));
            }
            else
            {
                return(Respond.WithResource(422, outcome));
            }
        }