-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2730 from FirelyTeam/2550-parser-error-ignore-cus…
…tomization 2550 parser error ignore customization
- Loading branch information
Showing
16 changed files
with
651 additions
and
168 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
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
33 changes: 33 additions & 0 deletions
33
src/Hl7.Fhir.Base/Serialization/FilterPredicateExtensions.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,33 @@ | ||
#nullable enable | ||
|
||
using Hl7.Fhir.Serialization; | ||
using Hl7.Fhir.Utility; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Hl7.Fhir.Serialization; | ||
|
||
internal static class FilterPredicateExtensions | ||
{ | ||
internal static Predicate<CodedException> IsRecoverableIssue => | ||
FhirXmlException.RecoverableIssues.Concat(FhirJsonException.RecoverableIssues).ToPredicate(); | ||
|
||
internal static Predicate<CodedException> IsBackwardsCompatibilityIssue => | ||
FhirXmlException.BackwardsCompatibilityAllowedIssues.Concat(FhirJsonException.BackwardsCompatibilityAllowedIssues).ToPredicate(); | ||
|
||
internal static Predicate<CodedException> ToPredicate(this IEnumerable<string> ignoreList) => | ||
ce => ignoreList.Contains(ce.ErrorCode); | ||
|
||
internal static Predicate<CodedException> And(this Predicate<CodedException> a, Predicate<CodedException>? b) => | ||
b is not null ? ce => a(ce) && b(ce) : a; | ||
|
||
internal static Predicate<CodedException> Or(this Predicate<CodedException> a, Predicate<CodedException>? b) => | ||
b is not null ? ce => a(ce) || b(ce) : a; | ||
|
||
internal static Predicate<CodedException> Negate(this Predicate<CodedException> a) => | ||
ce => !a(ce); | ||
|
||
} | ||
|
||
#nullable restore |
Oops, something went wrong.