Toromyx / schema_org_types_rs

Schema.org schemas as Rust types
https://docs.rs/schema_org_types
2 stars 0 forks source link

Handle "Intangible"/"ItemList"/... types #15

Open Toromyx opened 7 months ago

Toromyx commented 7 months ago

During deserialization of a https://schema.org/Recipe it came to my attention that https://schema.org/recipeInstructions can apparently be "an ordered list with HowToStep and/or HowToSection items", but that fact is nowhere to be seen in the structured data.

One of these things must be true:

  1. The description is wrong. (i doubt it)
  2. The structured data is missing HowToStep and HowToSection as possible types for recipeInstructions. (possible)
  3. ItemList and ListItem are actually generic types. (i fear for the worst)
Toromyx commented 7 months ago

I opened a discussion: https://github.com/schemaorg/schemaorg/discussions/3411

Toromyx commented 7 months ago

https://github.com/schemaorg/schemaorg/discussions/3411#discussioncomment-7683350

By current schema.org semantics, the typing of the objects in the ItemList can be anything like an old school Java List. But in practice, they are going to be the things in the range of the property they are used in [...].

This suggests to me that the types of this library need to be re-thought. The choice of using serde also doesn't seem ideal, maybe built-in https://github.com/timothee-haudebourg/json-ld support makes more sense.

For now I found a workaround but I might revisit this later or if someone else actually wants to use this library :)