Generating types | schema-org-rust | Spatie       

 SPATIE  

schema-org-rust
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Schema-org-rust](https://spatie.be/docs/schema-org-rust/v1)  Generating types

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/schema-org-rust/v1) 

  Generating types    
- [ Introduction ](https://spatie.be/docs/schema-org-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/schema-org-rust/v1/support-us)
- [ Installation ](https://spatie.be/docs/schema-org-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/schema-org-rust/v1/usage)
- [ Graphs ](https://spatie.be/docs/schema-org-rust/v1/graphs)
- [ Multi-typed entities ](https://spatie.be/docs/schema-org-rust/v1/multi-typed-entities)
- [ Generating types ](https://spatie.be/docs/schema-org-rust/v1/generating-types)
- [ Testing ](https://spatie.be/docs/schema-org-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/schema-org-rust/v1/changelog)

 Generating types
================

The Python standard-library generator reads the same [Schema.org 30.0 JSON-LD definitions](https://raw.githubusercontent.com/schemaorg/schemaorg/main/data/releases/30.0/schemaorg-all-https.jsonld) as the PHP package. A copy is committed under `generator/`, so normal regeneration is offline and needs only Python 3 and `rustfmt`.

```
python3 generator/generate.py
```

This writes `src/generated.rs` and `tests/vocabulary.rs`. It generates all Schema.org classes except primitive data types, every property setter, enumeration constants, and type accessors on `Schema`, `Graph`, and `MultiTypedEntity`. Inherited properties work on every builder. Unknown extension properties can still be assigned using `set_property`.

Names use Rust conventions: `localBusiness` becomes `local_business`; enumeration values become `SCREAMING_SNAKE_CASE`; keywords gain a trailing underscore. Like the PHP package, `3DModel` is exposed as `ThreeDimensionalModel`.

To download the pinned upstream source again:

```
python3 generator/generate.py --refresh
```

To adopt a newer vocabulary, change the pinned source URL and version in the generator, refresh, regenerate, and review the diff. Run the quality checks in [testing](testing). The generated coverage tests exercise every factory, property mapping, enumeration URL, and collection accessor. CI also regenerates the files and rejects drift.

The vendored vocabulary is from the Schema.org project under its Apache 2.0 license, included at `generator/LICENSE-schemaorg`. The Rust implementation is MIT licensed.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
