FHIR Chat · JSON Schema: status is not required in JSON schema · conformance

Stream: conformance

Topic: JSON Schema: status is not required in JSON schema


view this post on Zulip Julius Severin (Nov 03 2020 at 17:06):

Now I'm pretty sure to have found a bug.
In the JSON Schema for R4 Observations the status field is not in the required array.
Therefore our validation does not fail when the status field is missing.

view this post on Zulip Lloyd McKenzie (Nov 03 2020 at 19:29):

That's not a bug - because you could have status or _status. The requirement is for one or the other (or both), but it's legal to omit status if there's an extension.

view this post on Zulip Grahame Grieve (Nov 03 2020 at 20:14):

json schema has no way to say "you must have at least one of status or _status"

view this post on Zulip Morten Ernebjerg (Nov 04 2020 at 07:52):

Maybe I'm getting this wrong, but I thought the JSON schema oneOf keyword would allow this. I.e. it seems one could specify one subschema with status required and one with _status required, and then combine the two in a schema that says the instance must fit exactly one of them (which , for several required fields, would of course mean having to multiply out all possible combinations...). Did I misunderstand that or are there obstacles to using that?

view this post on Zulip Lloyd McKenzie (Nov 04 2020 at 16:06):

The problem is that you'd need to do that for every simple type that was mandatory, so it becomes unreasonable pretty quickly

view this post on Zulip Grahame Grieve (Nov 04 2020 at 23:39):

maybe that would work. I think that I didn't do that because.... some reason. I can't remember.

view this post on Zulip Grahame Grieve (Nov 04 2020 at 23:39):

I

view this post on Zulip Grahame Grieve (Nov 04 2020 at 23:39):

I'll add it to my todo list

view this post on Zulip Morten Ernebjerg (Nov 05 2020 at 08:39):

Thanks, @Grahame Grieve this would definitely help catch some nasty errors! Just let us know if we can support in some way.


Last updated: Apr 12 2022 at 19:14 UTC