Skip to content

Releases: google/schema-dts

schema-dts & schema-dts-gen v2.0.0

23 Mar 22:18
a6aad64

Choose a tag to compare

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:

    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 Thing or Organization require a type union that includes the object itself, it can also include any of its children. Now, if you want type something as a Thing exactly, you can import ThingLeaf which 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:

    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 Thing cannot 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/Date which conflicts with schema.org/Date. Now, this is exported as www_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/Date renders as Date if "@context": "www.omg.org/spec/Commons/DatesAndTimes/" only. Otherwise, it renders as namespace_Date if "@context" { "namespace": "www.omg.org/spec/Commons/DatesAndTimes/" }, and www_omg_org_spec_Commons_DatesAndTimes_Date if 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 include import type {...} from 'schema-dts-lib'; followed by export type { ... };.

What's Changed

  • Support Input and Output constraints by @Eptagone in #202
  • prevent Role from forming malformed intersections by @HunterLarco in #205
  • Make schema-dts-gen compatible with Schema.org v30 by @Eyas in #211
  • Docs: add real-world usage examples for common schema types by @cochinescu in #209
  • Factor out common types that don't depend on the exact schema into schema-dts-lib by @Eyas in #213
  • Add MergeLeafTypes helper and export leaf types by @cochinescu in #210

New Contributors

Full Changelog: v1.1.5...v2.0.0

schema-dts & schema-dts-gen v1.1.5

01 Mar 21:05
d362f8b

Choose a tag to compare

Changes in schema-dts

  • Includes the latest schema from Schema.org v28
  • TypeScript is no longer a peer-dependency of schema-dts, this helps users that install schema-dts as a regular "dependency" (instead of "devDependency")

Diff from v1.1.2: https://www.diffchecker.com/JDk6fuVP/

Changes in schema-dts-gen

  • Updates dependencies

schema-dts & schema-dts-gen v1.1.2

24 Feb 18:42
f83949b

Choose a tag to compare

Changes in schema-dts

  • Includes the latest schema from Schema.org v15
  • Switch back to include the "all layers" schema (including the "Pending" layer) (this was the case in earlier versions and regressed accidentally in the last few releases)
  • Clearer TypeScript outputs, substituting unnecessary declare type with simply type

Diff from v1.1.0: https://www.diffchecker.com/bB0J9Iie/

Changes in schema-dts-gen

  • Update to the latest TypeScript APIs
  • Switch default ontology from "current" layer to "all" layers
  • Updates to various dependencies

schema-dts & schema-dts-gen v1.1.0

24 Feb 22:00

Choose a tag to compare

Small, backwards-compatible improvements to schema-dts and schema-dts-gen

Changes in schema-dts

  • Improved comment quality by properly including unicode and unescaped characters. (thanks to #174)
  • Includes latest Schema.org additions of Healthcare Businesses

Diff from 1.0.0: https://www.diffchecker.com/RtKuuqMG

Changes in schema-dts-gen

  • Uses N3.js to parse N-Triple files instead of a custom regex, this has a number of benefits:
    • --ontology can now be an .nt file or a .tt Turtle file
    • Improved output comment quality by properly including unicode and unescaped characters
    • Can parse string literals of length 0 or 1 (previously the shortest string that could be parsed in input was 2 characters long)
  • Can use rdfs:domain and rdfs:range instead of schema:domainIncludes and schema:rangeIncludes -- See #172
  • Parser does not choke when seeing OWL properties (though it doesn't explicitly support them) - See #172
  • Accept "unnamed" IRIs, such as "https://schema.org" (as opposed to "https://schema.org/Thing"), and handle them properly
  • Less special-handling of meta-schema (isPartOf, meta comments, etc.) -- The converter is more comfortable with entities it doesn't know about

schema-dts & schema-dts-gen v1.0.0

30 Aug 14:14
f349415

Choose a tag to compare

schema-dts and schema-dts-gen are both now considered stable & mature 🎉

Changes in schema-dts

  • 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.

Changes in schema-dts-gen

  • Breaking: schema-dts-gen is now upgraded to ESM.
    • If importing it directly, you must use ES6 imports, e.g. import {} from "schema-dts-gen";
    • The minimum Node.js supported version is now 14.x.

Infrastructure Changes

In addition to the above changes, v1.0.0 also brings a completely overhauled repository structure to schema-dts.

  • Now using NPM workspaces and adopting a more traditional monorepo structure for both packages
  • Simplifies build dependency between schema-dts-gen and schema-dts
  • Migrate from Travis-CI.org (deprecated) to GitHub Actions.
    • Also start running tests for Node.js 14 and 16 to catch issues.
  • 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 so

schema-dts & schema-dts-gen v0.11.0

17 Aug 19:00

Choose a tag to compare

Changes in schema-dts & schema-dts-gen

  • Role, 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

schema-dts & schema-dts-gen v0.10.0

02 Aug 18:18
37d5584

Choose a tag to compare

Changes in schema-dts-gen

  • Breaking Change: Requires TypeScript 4.1.0 and above
  • Emitted Schema now allows number strings for Number, Float, and Integer. (See #163 )

Changes in schema-dts

schema-dts & schema-dts-gen v0.9.0

13 Jul 19:21
f5fda5d

Choose a tag to compare

Changes in schema-dts-gen

  • Breaking Change: WithContext<T> can no longer be a Graph. If you use a {"@context": foo, "@graph": []} as a WithContext<T>, import Graph explicitly instead.

Changes in schema-dts

  • Breaking Change: WithContext<T> can no longer be a Graph. If you use a {"@context": foo, "@graph": []} as a WithContext<T>, import Graph explicitly instead.
  • Picks up Schema.org v13
  • Diff from previous version: https://www.diffchecker.com/udGGpUpP

schema-dts & schema-dts-gen v0.8.3

02 Jun 18:38
3e91037

Choose a tag to compare

Changes in schema-dts-gen

  • Adds a --file attribute to generator, allowing the use of custom .nt files on your local machine. See (Issue #145, PR #148)

Changes in schema-dts

schema-dts & schema-dts-gen v0.8.2

03 Dec 21:09
f861c19

Choose a tag to compare

Changes in schema-dts and schema-dts-gen

  • Changes how JSDoc comments are handled and generated. For existing .nt files, you might see some minor differences.
  • Supports purely-markdown RDFa comments, consistent with Schema.org v11.

Changes in schema-dts