Skip to content

Why is everything OneOrMany<T>, even things that would logically only have 1 value? #205

Answered by Turnerj
hansmbakker asked this question in Q&A
Discussion options

You must be logged in to vote

Each of the schema types are generated by a tool, which takes a JSON file from schema.org. The JSON file doesn't specify whether some properties are logically only ever a single value or not.

You will find a lot of properties like this though there are also many properties where multiples could exist (eg. author). Without some kind of mapping to determine what makes logical sense or not, defaulting to the idea that anything could be multiple values makes life a lot easier.

When dealing with OneOrMany though, you don't have to worry too much about it being a single value or many values. It has implicit conversions from a singular T to a OneOrMany<T>. It has these implicit conversions the o…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Turnerj
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #205 on December 15, 2020 15:08.