Stream: conformance
Topic: Discriminator min and max
Eric Haas (Apr 16 2019 at 06:43):
This topic may have been covered before so hope is an easy answer. I am generating a pretty summary of a differential from the structure definition
Eric Haas (Apr 16 2019 at 06:46):
And “backfilling” data form using the generated snapshot from ig publisher. The summary text for discriminator element was generated which I did not anticipate
Eric Haas (Apr 16 2019 at 06:49):
But it alerted me to the fact that I had defined the min to 0. The first slice’s min is 1. So my question is twofold. Should I be assigning a min max on the discriminator element
Eric Haas (Apr 16 2019 at 06:51):
because it does not render in the ig pub possibly Intentionally.
Eric Haas (Apr 16 2019 at 06:52):
Secondly which min takes precedence the slice or the discriminatir’s
Michel Rutten (Apr 16 2019 at 09:14):
The validator verifies all specified cardinality constraints, both on the sliced elements as well as on the individual named slices. If some constraints are in conflict (e.g. sliced element specifies max < 1 and named slice specifies min > 2), than no instance will ever match (solution space is the empty set).
Eric Haas (Apr 16 2019 at 12:12):
So if the discriminator slice is 0..* and slice 1 is 1..1 then is slice 1 “required”. Will a validation error occur if slice1 is absent.?
Eric Haas (Apr 16 2019 at 12:13):
I mean discriminator element
Eric Haas (Apr 16 2019 at 12:14):
To me thAt says if you have a slice you at least have to slice1.
Eric Haas (Apr 16 2019 at 12:15):
Vs 1..* for discriminator and 1..1 for slice1.
Michel Rutten (Apr 16 2019 at 12:18):
Yes, instances must conform to both constraints.
Example:
- discriminator slice : 0...1
- named slice A: 2...3
Here, the profile requires at least 2 occurrences of slice A, but the slice group may contain at most 1 element => no solution is possible.
Example 2:
- discriminator slice: 1...2
- named slice A: 0...1
Here named slice A is optional, but the slice group requires at least a single element.
Eric Haas (Apr 16 2019 at 14:38):
thanks for your Patience Michel. so are these two equivalent?
Example 1:
- discriminator slice : 0...*
- named slice A: 1..1
Example 2:
- discriminator slice : 1...*
- named slice A: 1..1
Eric Haas (Apr 16 2019 at 14:39):
Both require at least slice A?
Lloyd McKenzie (Apr 16 2019 at 14:48):
Correct. Form #2 is preferred as it's less likely to confuse implementers.
Eric Haas (Apr 16 2019 at 15:06):
So how to say...."if you have sliced element "Foo" you need to at least have slice A"
Eric Haas (Apr 16 2019 at 15:07):
...not my use case but am curious...
Lloyd McKenzie (Apr 16 2019 at 15:15):
Invariant, I guess.
Michel Rutten (Apr 18 2019 at 07:16):
Interesting example... do you think this is a frequent use case?
Eric Haas (Apr 18 2019 at 16:31):
I don't have one in mind but that is what I originally thought example one meant.
Last updated: Apr 12 2022 at 19:14 UTC