FHIR Chat · Not agreeing with an error message · shorthand

Stream: shorthand

Topic: Not agreeing with an error message


view this post on Zulip David Pyke (Oct 19 2021 at 14:35):

I would disagree with this statement: Cardinality constraints cannot widen the cardinality. 0..0 is wider than 1..*.

view this post on Zulip David Pyke (Oct 19 2021 at 14:35):

It's an error, because I'm trying to lock out a required element but it's not wider... 0..* would be...

view this post on Zulip Chris Moesel (Oct 19 2021 at 14:49):

Yeah, I agree that the message seems a little off. It's "widening" it on the min side (if you think of it as a range on a number line), but narrowing it on the max side. Another way of saying it would be that "Cardinality constraints cannot decrease an existing min or increase an existing max" -- but I wonder if there is a still a more succinct way of saying that. Any ideas?

view this post on Zulip David Pyke (Oct 19 2021 at 15:13):

I think that would be best, it's not succinct but it explains the problem well.

view this post on Zulip Elliot Silver (Oct 19 2021 at 16:05):

"Cardinality constraints must match or be tighter than existing constraints."

view this post on Zulip David Pyke (Oct 19 2021 at 16:05):

0..0 is tighter than 1..*

view this post on Zulip Elliot Silver (Oct 19 2021 at 16:05):

"must match or be within"

view this post on Zulip Chris Moesel (Oct 19 2021 at 16:08):

So... "Cardinality constraints must match or be within the existing cardinality. 0..0 is not fully within the cardinality 1..*" ?

view this post on Zulip David Pyke (Oct 19 2021 at 16:09):

That works!

view this post on Zulip Elliot Silver (Oct 19 2021 at 16:09):

Yup.

view this post on Zulip Elliot Silver (Oct 19 2021 at 16:10):

Although now that I read the whole thing, you could shorten it to "Cardinality 0..0 is not fully within the cardinality 1..*"

view this post on Zulip Elliot Silver (Oct 19 2021 at 16:11):

(And I suppose if I wanted to get nit picky, 1..1 is not fully within 1..* -- proper subsets and all.)

view this post on Zulip Gino Canessa (Oct 19 2021 at 16:11):

If you're adding a specific case for 0..0 when the base is 1.., you could also go with something along the lines of 'Cannot prohibit required element...'

view this post on Zulip Chris Moesel (Oct 19 2021 at 16:33):

@Gino Canessa - If we can find one general phrase that works across the board, I'd prefer that over special-casing this message. While using terms like "prohibited" and "required" reads well in English, it would mean that authors would need to know that by "prohibited" we're referring to 0..0 and by "required" we're referring to 1... By just using the cards directly, I think it's easier to see the relation to the actual FSH statement.

@Elliot Silver - I was using "fully within" because it is actually partially within but partially within is not good enough. BUT... I agree that it might be misunderstood by nerdy math types -- so let's drop it.

How about "Cannot constrain cardinality to 0..0, as it does not fit within the original 1..* cardinality"?

view this post on Zulip Gino Canessa (Oct 19 2021 at 17:01):

Chris: fair =) If there is additional documentation around the error I think adding some of that kind of text may be useful. E.g., that the error is commonly caused by trying to prohibit a required element or require a prohibited one, etc.

view this post on Zulip Chris Moesel (Oct 21 2021 at 11:25):

For those who wish to track this change, it is SUSHI#938.

view this post on Zulip Chris Moesel (Nov 12 2021 at 20:50):

We've improved the error message in SUSHI 2.2.0.


Last updated: Apr 12 2022 at 19:14 UTC