-
Notifications
You must be signed in to change notification settings - Fork 347
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
2550 parser error ignore customization #2730
Conversation
…tion engine factory
…extends a new interface to reflect it
# Conflicts: # src/Hl7.Fhir.Base/Serialization/engine/FhirSerializationEngineFactory.cs # src/Hl7.Fhir.Base/Serialization/engine/PocoSerializationEngine.cs # src/Hl7.Fhir.Support.Poco.Tests/NewPocoSerializers/FhirJsonDeserializationTests.cs
…rter, expanded serialization engine with extra methods to parse standalone objects and elements
# Conflicts: # src/Hl7.Fhir.Support.Poco.Tests/NewPocoSerializers/FhirJsonDeserializationTests.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No fundamental issues, just some remarks ;-)
src/Hl7.Fhir.Base/Serialization/JsonSerializerOptionsExtensions.cs
Outdated
Show resolved
Hide resolved
src/Hl7.Fhir.Base/Serialization/engine/FhirSerializationEngineFactory.cs
Outdated
Show resolved
Hide resolved
src/Hl7.Fhir.Base/Serialization/engine/PocoSerializationEngine.cs
Outdated
Show resolved
Hide resolved
src/Hl7.Fhir.Support.Poco.Tests/NewPocoSerializers/FhirJsonDeserializationTests.cs
Outdated
Show resolved
Hide resolved
src/Hl7.Fhir.Support.Poco.Tests/NewPocoSerializers/FhirJsonDeserializationTests.cs
Outdated
Show resolved
Hide resolved
src/Hl7.Fhir.Support.Poco.Tests/NewPocoSerializers/FhirJsonDeserializationTests.cs
Outdated
Show resolved
Hide resolved
Predicate<CodedException>? ignoreFilter = null) | ||
internal void SetEnforcedErrors(IEnumerable<string> toEnforce) | ||
{ | ||
Engine ??= (FhirSerializationEngineFactory.Strict(inspector, serializerSettings, deserializerSettings) as PocoSerializationEngine)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(x as Y)!
suggests you really want ((Y)x)
here, which will never return null (and throw if the cast does not work).
|
||
internal void SetIgnoredErrors(IEnumerable<string> toIgnore) | ||
{ | ||
Engine ??= (FhirSerializationEngineFactory.Strict(inspector, serializerSettings, deserializerSettings) as PocoSerializationEngine)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this factory code should be in a small private function, instead of repeating it.
DisallowSchemaLocation = mode is Mode.Strict, | ||
PermissiveParsing = mode is Mode.Permissive or Mode.Ostrich, | ||
ValidateFhirXhtml = mode is Mode.Strict | ||
DisallowSchemaLocation = mode is Mode.Strict, PermissiveParsing = mode is Mode.Permissive or Mode.Ostrich, ValidateFhirXhtml = mode is Mode.Strict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird reformat?
namespace Hl7.Fhir.Serialization; | ||
|
||
public interface IFhirExtendedSerializationEngine : IFhirSerializationEngine | ||
internal interface IFhirExtendedSerializationEngine : IFhirSerializationEngine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this interface anymore?
Description
Related issues
Closes [#2550].
Testing
Added tests to assert correct behaviour of the error-filtering predicates and their prevalence according to where in the chain they are called