Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add async validation #330

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

almostchristian
Copy link

addresses #329

Added new API

public class Validator
{
   Task<OperationOutcome> ValidateAsync(ElementNode instance, string? profile, CancellationToken cancellationToken);

   Task<OperationOutcome> ValidateAsync(Resource instance, string? profile, CancellationToken cancellationToken);
}

public interface IElementSchemaResolver
{
   ValueTask<ElementSchema?> GetSchemaAsync(Canonical schemaUri)
      => new(GetSchema(schemaUri));
}


public interface IValidatable
{
   ValueTask<ResultReport?> ValidateAsync(IScopedNode input, ValidationSettings vc, ValidationState state, CancellationToken cancellationToken)
      => new(Validate(input, vc, state));
}


public interface IGroupValidatable
{
   ValueTask<ResultReport?> ValidateAsync(IEnumerable<IScopedNode> input, ValidationSettings vc, ValidationState state, CancellationToken cancellationToken)
      => new(Validate(input, vc, state));
}

Tests Added

  • Firely.Fhir.Validation.Tests.ValidationDemoTests.RunValidateAsyncTestSuite
  • Firely.Fhir.Validation.Tests.ValidatorHighLevelApiTests.NoReferenceResolutionAsync
  • Firely.Fhir.Validation.Tests.ValidatorHighLevelApiTests.SkipConstraintValidationAsync
  • Firely.Fhir.Validation.Tests.ValidatorHighLevelApiTests.ValidatesAsyncAndReportsError
  • Firely.Fhir.Validation.Tests.ResourceSchemaValidationTests.AvoidsRedoingProfileValidationAsync
  • Firely.Fhir.Validation.Tests.ResourceSchemaValidationTests.DoesValidateBasedOnActualTypeAsync
  • Firely.Fhir.Validation.Tests.ExtensionSchemaValidationTests.UnresolvableExztensionAreJustWarningsAsync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants