firely-net-sdk icon indicating copy to clipboard operation
firely-net-sdk copied to clipboard

Validation: allow warning on unknown extensions

Open cknaap opened this issue 5 years ago • 5 comments

Situation: Validate a resource with an extension whose definition cannot be retrieved in the current context of validation. Current behaviour: the validator will report an error on the missing extension and return 'error' as the validation result. Requested behaviour:

  • Create a ValidatorSetting that allows for reporting this as a warning instead.
  • If the setting is set to 'warning': return success as the validation result, with a warning in the OO stating that which definition could not be retrieved (so the same message as currently, but with level 'warning').

cknaap avatar Feb 11 '20 10:02 cknaap

Is there a plan for this particular issue, or is there a workaround? Since we have a general purpose fhir server, it is inconvenient where we must be able to resolve all extension urls for any customer. I know that in the HAPI library, you can ignore extension urls.

I had previously thought that I would parse the errors and determine if the error was of an extension url not being found and then just suppress that error in the application. But curiously, the validator will return validation errors on resources that reference the resource that failed to resolve an extension. I believe it's because since the referenced resource fails validation, then the referencing resource will also fail.

In any case this feature or even a recommended workaround would be very appreciated.

darena-mhaque avatar Aug 19 '20 05:08 darena-mhaque

This should common, and in fact is the same type of problem as mentioned in #1429. Here, @mharthoorn wants me to ignore a referenced profile (by use of Resource.meta.profile) completely. If you really wanted to ignore all extension urls, this would be the same kind of solution. However, @cknaap wants to tune the severity of the failure to resolve, which is slightly different.

Maybe we should do something like:

enum ExternalProfileReferenceHandling
{
  DontResolve,
  WarnIfMissing,
  ErrorIfMissing,
}

And add this to the settings:

public ExternalProfileReferenceHandling  MetaProfile { get; set; }
public ExternalProfileReferenceHandling  ExtensionUrl { get; set; }

@mharthoorn ? @darena-mhaque @cknaap ?

ewoutkramer avatar Sep 10 '20 14:09 ewoutkramer

Any news about this? By the way, it is strange behaviour right now: if I specify URL with "http" schema and some unknown system- it will fail, if the same with "https" - everything is OK.

MyEidos avatar Mar 16 '21 22:03 MyEidos

The use cases (and therefore the place a developer looks for answers) slightly differ too:

Use case 1: Control with which profiles resources are validated

  • Validate with no profile (except core-base)
  • Validate also with another (set of) profile(s)
  • Validate only with another profile,

Use case 2: Missing profiles references should be

  • Ignored
  • Give a warning
  • Give an error

mharthoorn avatar Mar 18 '21 08:03 mharthoorn

The messages are specifically coded, so it's pretty easy to IG ore in the outcome, then you can be as fussy or as lenient as you like. I.e. Tweak the results rather than the valiator.

brianpos avatar Mar 18 '21 08:03 brianpos