-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
R4 Validation -- Move the shared Validation code to Core (#522)
* Move Validation classes to Core from shared, using ResourceElement * Remove dependency on HL7.Model from the validator code * Use ResourceElement instead of ITypedElement * Use known constants in place of text literals * Use generic ToPoco, fix recurse param * Update to ToResourceElement extension method * Change KnownFhirPath back to text.div, keep filter for DomainResources * Change NarrativeValidator.ValidateResource to use ITypedElement
- Loading branch information
Showing
25 changed files
with
173 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/Microsoft.Health.Fhir.Core/Features/Validation/IModelAttributeValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using Microsoft.Health.Fhir.Core.Models; | ||
|
||
namespace Microsoft.Health.Fhir.Core.Features.Validation | ||
{ | ||
public interface IModelAttributeValidator | ||
{ | ||
bool TryValidate(ResourceElement value, ICollection<ValidationResult> validationResults = null, bool recurse = false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Health.Fhir.Core.Models | ||
{ | ||
public static class KnownFhirPaths | ||
{ | ||
public const string BundleEntries = "Resource.entry.resource"; | ||
|
||
public const string BundleNextLink = "Resource.link.where(relation = 'next').url"; | ||
|
||
public const string BundleSelfLink = "Resource.link.where(relation = 'self').url"; | ||
|
||
public const string ResourceNarrative = "text.div"; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Microsoft.Health.Fhir.Core/Models/KnownResourceTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Health.Fhir.Core.Models | ||
{ | ||
public static class KnownResourceTypes | ||
{ | ||
public const string Bundle = "Bundle"; | ||
|
||
public const string Device = "Device"; | ||
|
||
public const string DocumentReference = "DocumentReference"; | ||
|
||
public const string Encounter = "Encounter"; | ||
|
||
public const string Immunization = "Immunization"; | ||
|
||
public const string Observation = "Observation"; | ||
|
||
public const string OperationOutcome = "OperationOutcome"; | ||
|
||
public const string Organization = "Organization"; | ||
|
||
public const string RiskAssessment = "RiskAssessment"; | ||
|
||
public const string Patient = "Patient"; | ||
|
||
public const string ValueSet = "ValueSet"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.