toromyx / schema_org_types_rs Goto Github PK
View Code? Open in Web Editor NEWSchema.org schemas as Rust types
Home Page: https://docs.rs/schema_org_types
Schema.org schemas as Rust types
Home Page: https://docs.rs/schema_org_types
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:
HowToStep
and HowToSection
as possible types for recipeInstructions
. (possible)ItemList
and ListItem
are actually generic types. (i fear for the worst)This libarary takes minutes to compile with serde
enabled.
Most class schema properties are inherited from other class schemas. Implementing common functionalities would be easier if this crate would provide a trait for each class schema and implement that trait for every struct that inherits properties from that class schema.
For example, the corresponding code for Thing would look like this:
trait ThingTrait {
fn get_additional_type(&self) -> &[AdditionalTypeProperty];
fn take_additional_type(&mut self) -> VecAdditionalTypeProperty>;
fn get_alternate_name(&self) -> &[AlternateNameProperty];
fn take_alternate_name(&mut self) -> Vec<AlternateNameProperty>;
// ...
}
impl ThingTrait for Thing {
fn get_additional_type(&self) -> &[AdditionalTypeProperty] {
self.additional_type.as_slice()
}
fn take_additional_type(&mut self) -> VecAdditionalTypeProperty> {
std::mem::take(&mut self.additional_type)
}
fn get_alternate_name(&self) -> &[AlternateNameProperty] {
self.alternate_name.as_slice()
}
fn take_alternate_name(&mut self) -> Vec<AlternateNameProperty> {
std::mem::take(&mut self.alternate_name)
}
// ...
}
Sometimes data providers provide data which does not adhere 100% to the schema.
Currently serde completely fails to deserialize such data, even if the majority is usable. Think of and implement a way to work around this:
There a between 2k and 3k source files containing the schemas. Shoul they be versioned or always generated?
If a property can be an URL and a string, the current ordering causes serde to try to deserialize the data into a string first. This is successful even if it is a valid URL.
Look what https://serde.rs/container-attrs.html#deny_unknown_fields does and replicate it.
Allowing unknown fields leads to false deserialization.
https://github.com/obi1kenobi/cargo-semver-checks
This should happen in a GitHub action.
https://github.com/schemaorg/schemaorg regurlary releases new versions. This repository should have an action which:
There are schemas in the attic and there are schemas which have been superseded. Both of these should probably lead to a rust type/field/variant being deprecated.
Some logic for schema sections was removed in fad59e1 for reference.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.