| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2026-03-23 | 5.3 kB | |
| schema-dts _ schema-dts-gen v2.0.0 source code.tar.gz | 2026-03-23 | 935.0 kB | |
| schema-dts _ schema-dts-gen v2.0.0 source code.zip | 2026-03-23 | 1.0 MB | |
| Totals: 3 Items | 2.0 MB | 0 | |
Changes in schema-dts
- Supports the latest Schema.org release from Schema.org v30 -- See https://schema.org/docs/releases.html#v30.0
-
Input and Output constraints are now supported, for example:
```ts import type {SearchAction, WebSite, WithActionConstraints} from 'schema-dts';
const potentialAction: WithActionConstraints<SearchAction> = { '@type': 'SearchAction', 'query-input': 'required name=search_term_string', // ... };
const website: WebSite = { '@type': 'WebSite', potentialAction: { '@type': 'SearchAction', 'query-input': 'required name=search_term_string', } as WithActionConstraints<SearchAction>, }; ```
-
Breaking change: Update typings for Roles so that they are not recursive, see [#205] for more details
- Breaking change: Quantity is now a core DataType, this is a change done in schema.org v30.0 and will technically make certain formerly-legal (but likely invalid) assignments no longer work
- "Leaf" types are now exported. While objects like
ThingorOrganizationrequire a type union that includes the object itself, it can also include any of its children. Now, if you want type something as aThingexactly, you can importThingLeafwhich can only be a Thing and does not allow sub-types. -
Support
MergeLeafTypes, which fixes a long-running user request (#179 [#189] [#203]), allowing a multi-typed schema object to be declared. Shout out to @mjy9088 and @cochinescu for the work to get this working. This allows declarations like this to be made:```ts import type { MergeLeafTypes,ProductLeaf, SoftwareApplicationLeaf, WithContext } from 'schema-dts';
const app: WithContext<MergeLeafTypes<[ProductLeaf, SoftwareApplicationLeaf]>> = { '@context': 'https://schema.org', '@type': ['Product', 'SoftwareApplication'], name: 'My App', offers: { '@type': 'Offer', price: 89, priceCurrency: 'USD', }, operatingSystem: 'Any', }; ```
while #189 and #179 are not completely addressed since a random
Thingcannot be a merged type, this allows some multi-type objects to exist, though they need to be explicitly declared as such by the developer. -
Technically a breaking change: Some non-schema.org types exported in schema-dts are now renamed. These are included mostly for equivalence because the Schema.org ontology defines them, but most users should not depend on them. The names for these classes are now escaped fully-qualified IRIs instead of just the "in-context" name. This is needed because new types with the same "in-context" name have been added as external references, e.g.
www.omg.org/spec/Commons/DatesAndTimes/Datewhich conflicts withschema.org/Date. Now, this is exported aswww_omg_org_spec_Commons_DatesAndTimes_Date.
Changes in schema-dts-gen
- Compatibility with Schema.org v30
- Breaking change: schema.org/Quantity is now emitted as a DataType
- Breaking change: out-of-context classes are now exported with an escaped fully-qualified IRI instead of just the hypothetical 'in-context' name. For example:
www.omg.org/spec/Commons/DatesAndTimes/Daterenders asDateif"@context": "www.omg.org/spec/Commons/DatesAndTimes/"only. Otherwise, it renders asnamespace_Dateif"@context" { "namespace": "www.omg.org/spec/Commons/DatesAndTimes/" }, andwww_omg_org_spec_Commons_DatesAndTimes_Dateif no context entry exists - Breaking change: the emitted output now depends on
https://www.npmjs.com/package/schema-dts-lib-- the first two lines from the emitted output will includeimport type {...} from 'schema-dts-lib';followed byexport type { ... };.
What's Changed
- Support Input and Output constraints by @Eptagone in https://github.com/google/schema-dts/pull/202
- prevent
Rolefrom forming malformed intersections by @HunterLarco in https://github.com/google/schema-dts/pull/205 - Make schema-dts-gen compatible with Schema.org v30 by @Eyas in https://github.com/google/schema-dts/pull/211
- Docs: add real-world usage examples for common schema types by @cochinescu in https://github.com/google/schema-dts/pull/209
- Factor out common types that don't depend on the exact schema into schema-dts-lib by @Eyas in https://github.com/google/schema-dts/pull/213
- Add
MergeLeafTypeshelper and export leaf types by @cochinescu in https://github.com/google/schema-dts/pull/210
New Contributors
- @Eptagone made their first contribution in https://github.com/google/schema-dts/pull/202
- @Fabious made their first contribution in https://github.com/google/schema-dts/pull/204
- @HunterLarco made their first contribution in https://github.com/google/schema-dts/pull/205
- @thernstig made their first contribution in https://github.com/google/schema-dts/pull/206
- @cochinescu made their first contribution in https://github.com/google/schema-dts/pull/209
- @mjy9088 opened https://github.com/google/schema-dts/issues/203 with code that helped inform [#210]
Full Changelog: https://github.com/google/schema-dts/compare/v1.1.5...v2.0.0