JSON-LD TypeScript types for Schema.org vocabulary
declare type
with simply type
Diff from v1.1.0: https://www.diffchecker.com/bB0J9Iie/
Small, backwards-compatible improvements to schema-dts and schema-dts-gen
Diff from 1.0.0: https://www.diffchecker.com/RtKuuqMG
--ontology
can now be an .nt
file or a .tt
Turtle fileschema-dts
and schema-dts-gen
are both now considered stable & mature 🎉
Updates the package file layout for schema-dts
.
This should be a backwards-compatible change if you use the public API surface area (as in, import from "schema-dts"
only).
v1.0.0
is otherwise identical to v0.11.0
. The SemVer-incompatible version bump is done to reflect current maturity of this package.
import {} from "schema-dts-gen";
In addition to the above changes, v1.0.0
also brings a completely overhauled repository structure to schema-dts
.
schema-dts-gen
and schema-dts
schema-dts
is now has its own test suite using // @ts-expect-error
and tsc
.schema-dts
is built from schema-dts-gen
by running it as an NPM script, just as we expect downstream clients of schema-dts-gen to do soRole
, OrganizationRole
and others are allowed to be use in place of all properties in Schema.org. See #143 & notes in #164
This also corrects the "Role" type to be generic. A Role
type (and its sub classes) is contextual in the context of the property it is used in. E.g. Role
in an alumniOf
will have a nested alumniOf
property, for example:
import { Person, WithContext } from 'schema-dts';
const p: WithContext<Person> = {
'@context': 'https://schema.org',
'@type': 'Person',
name: 'Delia Derbyshire',
sameAs: 'http://en.wikipedia.org/wiki/Delia_Derbyshire',
alumniOf: {
'@type': 'OrganizationRole',
alumniOf: {
'@type': 'CollegeOrUniversity',
name: 'University of Cambridge',
sameAs: 'http://en.wikipedia.org/wiki/University_of_Cambridge'
},
startDate: '1959'
}
};
See http://blog.schema.org/2014/06/introducing-role.html for more details
Diffs vs previous version of schema-dts: https://www.diffchecker.com/Q5wPQvi0
Number
, Float
, and Integer
. (See #163 )Breaking Change: Requires TypeScript 4.1.0 and above
Number
, Float
, and Integer
can now be a numeric string. (See #163)
Diff from previous version: https://www.diffchecker.com/nO5AjcQh
WithContext<T>
can no longer be a Graph
. If you use a {"@context": foo, "@graph": []}
as a WithContext<T>
, import Graph
explicitly instead.WithContext<T>
can no longer be a Graph
. If you use a {"@context": foo, "@graph": []}
as a WithContext<T>
, import Graph
explicitly instead.
--file
attribute to generator, allowing the use of custom .nt
files on your local machine. See (Issue #145, PR #148).nt
files, you might see some minor differences.Base
and Leaf
types to interfaces
, rather than type literals. #138Breaking Change: Enum variables are no longer exported.
This trims down the entire ~22KB output of the exported .js, which is helpful if tree-shaking isn't enabled in your bundler.
Instead, you should use the string literals for an enum directly.
See discussion in #131. PR #137