Socket
Socket
Sign inDemoInstall

schema-dts

Package Overview
Dependencies
1
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.2.0

2

package.json
{
"name": "schema-dts",
"version": "0.1.0",
"version": "0.2.0",
"displayName": "schema-dts: latest Schema.org TypeScript Declarations",

@@ -5,0 +5,0 @@ "description": "A TypeScript package with latest Schema.Org Schema Typings",

@@ -0,13 +1,17 @@

[![Build Status](https://travis-ci.org/google/schema-dts.svg?branch=master)](https://travis-ci.org/google/schema-dts)
[![schema-dts npm version](https://badge.fury.io/js/schema-dts.svg)](https://www.npmjs.com/package/schema-dts)
# schema-dts
TypeScript Typings & .tsd Generation for Schema.org
JSON-LD TypeScript types for Schema.org vocabulary.
Schema DTS provides a set of TypeScript typings for
[schema.org](https://schema.org) schema. The typings are exposed as complete
sets of discriminated type unions, allowing for easy completions and stricter
validation.
**schema-dts** provides TypeScript definitions for
[Schema.org](https://schema.org/) vocabulary in JSON-LD format. The typings are
exposed as complete sets of discriminated type unions, allowing for easy
completions and stricter validation.
This repository contains `generate-schema-dts`, the Node.js-based script that
generates the `schema-dts` package.
![Example of Code Completion using schema-dts](../../example-1.gif)
Note: This is not an officially supported Google product.
## Usage

@@ -20,21 +24,44 @@

### Manually using the Schema Typings generator
Then you can use it by importing `"schema-dts"`.
npm install schema-dts-gen
npx schema-dts-gen --schema=3.4
## Examples
## Developers
### Defining Simple Properties
Use NPM to install dependencies:
```ts
import {Person} from "schema-dts";
npm install
const inventor: Person = {
"@type": "Person",
"name": "Grace Hopper",
"disambiguatingDescription": "American computer scientist",
"birthDate": "1906-12-09",
"deathDate": "1992-01-01",
"awards": [
"Presidential Medal of Freedom",
"National Medal of Technology and Innovation",
"IEEE Emanuel R. Piore Award",
]
};
```
### Using 'Context'
Use Gulp to build the package:
JSON-LD requires a `"@context"` property to be set on the top-level JSON object,
to describe the URIs represeting the types and properties being referenced.
schema-dts provides the `WithContext<T>` type to facilitate this.
gulp generate-ts
```ts
import {Organization, Thing, WithContext} from "schema-dts";
or simply build the schema-dts generator:
export function JsonLd<T extends Thing>(json: T): string {
return `<script type="application/ld+json">
${JSON.stringify(json)}
</script>`;
}
gulp build-generator
To contribute changes, see [the CONTRIBUTING.md file](./CONTRIBUTING.md).
export const MY_ORG = JsonLd<Organization>({
"@context": "https://schema.org",
"@type": "Corporation",
"name": "Google LLC"
});
```

@@ -51,3 +51,3 @@ "use strict";

DayOfWeekEnum["Sunday"] = "http://schema.org/Sunday";
/** This stands for any day that is a public holiday; it is a placeholder for all official public holidays in some particular location. While not technically a \"day of the week\", it can be used with <a class=\"localLink\" href=\"http://schema.org/OpeningHoursSpecification\">OpeningHoursSpecification</a>. In the context of an opening hours specification it can be used to indicate opening hours on public holidays, overriding general opening hours for the day of the week on which a public holiday occurs. */
/** This stands for any day that is a public holiday; it is a placeholder for all official public holidays in some particular location. While not technically a "day of the week", it can be used with {@link http://schema.org/OpeningHoursSpecification OpeningHoursSpecification}. In the context of an opening hours specification it can be used to indicate opening hours on public holidays, overriding general opening hours for the day of the week on which a public holiday occurs. */
DayOfWeekEnum["PublicHolidays"] = "http://schema.org/PublicHolidays";

@@ -252,33 +252,33 @@ /** The day of the week between Monday and Wednesday. */

OrganizationEnum["source_DatasetClass"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_DatasetClass";
/** This class contains information contributed by <a href=\"http://wikidoc.org>WikiDoc\">http://wikidoc.org>WikiDoc</a>. */
/** This class contains information contributed by {@link http://wikidoc.org>WikiDoc http://wikidoc.org>WikiDoc}. */
OrganizationEnum["source_WikiDoc"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_WikiDoc";
/** The W3C <a href=\"http://www.w3.org/community/schemabibex/\">Schema Bib Extend</a> (BibEx) group led the work to improve schema.org for bibliographic information, including terms for periodicals, articles and multi-volume works. The design was inspired in places (e.g. <a class=\"localLink\" href=\"http://schema.org/pageStart\">pageStart</a>, <a class=\"localLink\" href=\"http://schema.org/pageEnd\">pageEnd</a>, <a class=\"localLink\" href=\"http://schema.org/pagination\">pagination</a>) by the <a href=\"http://bibliontology.com/\">Bibliographic Ontology</a>, 'bibo'. */
/** The W3C {@link http://www.w3.org/community/schemabibex/ Schema Bib Extend} (BibEx) group led the work to improve schema.org for bibliographic information, including terms for periodicals, articles and multi-volume works. The design was inspired in places (e.g. {@link http://schema.org/pageStart pageStart}, {@link http://schema.org/pageEnd pageEnd}, {@link http://schema.org/pagination pagination}) by the {@link http://bibliontology.com/ Bibliographic Ontology}, 'bibo'. */
OrganizationEnum["source_bibex"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex";
/** The schema.org Actions mechanism benefited from extensive discussions across the Web standards community around W3C, in particular from the <a href=\"http://purl.org/hydra/\">Hydra project</a>'s community group. */
/** The schema.org Actions mechanism benefited from extensive discussions across the Web standards community around W3C, in particular from the {@link http://purl.org/hydra/ Hydra project}'s community group. */
OrganizationEnum["source_ActionCollabClass"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_ActionCollabClass";
/** This element is based on the STI Accommodation Ontology, see <a href=\"http://ontologies.sti-innsbruck.at/acco/ns.html\">http://ontologies.sti-innsbruck.at/acco/ns.html</a> for details.\n Many class and property definitions are inspired by or based on abstracts from Wikipedia, the free encyclopedia. */
/** This element is based on the STI Accommodation Ontology, see {@link http://ontologies.sti-innsbruck.at/acco/ns.html http://ontologies.sti-innsbruck.at/acco/ns.html} for details. Many class and property definitions are inspired by or based on abstracts from Wikipedia, the free encyclopedia. */
OrganizationEnum["STI_Accommodation_Ontology"] = "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#STI_Accommodation_Ontology";
/** This element is based on the work of the <a href=\"https://www.w3.org/community/tourismdata\">Tourism Structured Web Data Community Group</a>. */
/** This element is based on the work of the {@link https://www.w3.org/community/tourismdata Tourism Structured Web Data Community Group}. */
OrganizationEnum["Tourism"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Tourism";
/** This element is based on the work of the Financial Industry Business Ontology project (see <a href=\"http://www.fibo.org/schema\">http://www.fibo.org/schema</a> for details), in support of the W3C Financial Industry Business Ontology Community Group (<a href=\"http://www.fibo.org/community\">http://www.fibo.org/community</a>). Many class and property definitions are inspired by or based on <a href=\"http://www.fibo.org\">http://www.fibo.org</a>. */
/** This element is based on the work of the Financial Industry Business Ontology project (see {@link http://www.fibo.org/schema http://www.fibo.org/schema} for details), in support of the W3C Financial Industry Business Ontology Community Group ({@link http://www.fibo.org/community http://www.fibo.org/community}). Many class and property definitions are inspired by or based on {@link http://www.fibo.org http://www.fibo.org}. */
OrganizationEnum["FIBO"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#FIBO";
/** This class contains derivatives of IPTC rNews properties. rNews is a data model of publishing metadata with serializations currently available for RDFa as well as HTML5 Microdata. More information about the IPTC and rNews can be found at <a href=\"http://rnews.org\">rnews.org</a>. */
/** This class contains derivatives of IPTC rNews properties. rNews is a data model of publishing metadata with serializations currently available for RDFa as well as HTML5 Microdata. More information about the IPTC and rNews can be found at {@link http://rnews.org rnews.org}. */
OrganizationEnum["source_rNews"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews";
/** This class is based on the work of the LRMI project, see lrmi.net for details. */
OrganizationEnum["source_LRMIClass"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_LRMIClass";
/** This vocabulary was improved through collaboration with the MusicBrainz project\n (<a href=\"http://www.musicbrainz.org\">www.musicbrainz.org</a>), and is partially inspired by the MusicBrainz and\n <a href=\"http://musicontology.com/docs/getting-started.html\">Music Ontology</a> schemas. */
/** This vocabulary was improved through collaboration with the MusicBrainz project ({@link http://www.musicbrainz.org www.musicbrainz.org}), and is partially inspired by the MusicBrainz and {@link http://musicontology.com/docs/getting-started.html Music Ontology} schemas. */
OrganizationEnum["MBZ"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#MBZ";
/** This term and associated definitions draws upon the work of <a href=\"http://thetrustproject.org/\">The Trust Project</a>. */
/** This term and associated definitions draws upon the work of {@link http://thetrustproject.org/ The Trust Project}. */
OrganizationEnum["TP_draws"] = "https://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#TP-draws";
/** This element is based on the work of the Automotive Ontology Working Group, see <a href=\"http://www.automotive-ontology.org\">www.automotive-ontology.org</a> for details. Many class and property definitions are inspired by or based on abstracts from Wikipedia, the free encyclopedia. */
/** This element is based on the work of the Automotive Ontology Working Group, see {@link http://www.automotive-ontology.org www.automotive-ontology.org} for details. Many class and property definitions are inspired by or based on abstracts from Wikipedia, the free encyclopedia. */
OrganizationEnum["Automotive_Ontology_Working_Group"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Automotive_Ontology_Working_Group";
/** This element is based on work by the Web Applications for the Future Internet Lab, Institute of Informatics and Telematics, Pisa, Italy. */
OrganizationEnum["IIT_CNR_it"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#IIT-CNR.it";
/** The implementation and use of Legal Entity Identifier (LEI) is supported by Global Legal Entity Identifier Foundation <a href=\"https://www.gleif.org\">https://www.gleif.org</a>. */
/** The implementation and use of Legal Entity Identifier (LEI) is supported by Global Legal Entity Identifier Foundation {@link https://www.gleif.org https://www.gleif.org}. */
OrganizationEnum["GLEIF"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#GLEIF";
/** This class is derived from the GoodRelations Vocabulary for E-Commerce, created by Martin Hepp. GoodRelations is a data model for sharing e-commerce data on the Web that can be expressed in a variety of syntaxes, including RDFa and HTML5 Microdata. More information about GoodRelations can be found at <a href=\"http://purl.org/goodrelations/\">http://purl.org/goodrelations/</a>. */
/** This class is derived from the GoodRelations Vocabulary for E-Commerce, created by Martin Hepp. GoodRelations is a data model for sharing e-commerce data on the Web that can be expressed in a variety of syntaxes, including RDFa and HTML5 Microdata. More information about GoodRelations can be found at {@link http://purl.org/goodrelations/ http://purl.org/goodrelations/}. */
OrganizationEnum["source_GoodRelationsClass"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsClass";
/** This term <a href=\"http://blog.schema.org/2012/11/good-relations-and-schemaorg.html\">uses</a> terminology from the GoodRelations Vocabulary for E-Commerce, created by Martin Hepp. GoodRelations is a data model for sharing e-commerce data on the Web. More information about GoodRelations can be found at <a href=\"http://purl.org/goodrelations/\">http://purl.org/goodrelations/</a>. */
/** This term {@link http://blog.schema.org/2012/11/good-relations-and-schemaorg.html uses} terminology from the GoodRelations Vocabulary for E-Commerce, created by Martin Hepp. GoodRelations is a data model for sharing e-commerce data on the Web. More information about GoodRelations can be found at {@link http://purl.org/goodrelations/ http://purl.org/goodrelations/}. */
OrganizationEnum["source_GoodRelationsTerms"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsTerms";
/** The Question/Answer types were <a href=\"https://www.w3.org/wiki/WebSchemas/QASchemaResearch\">based on</a> the Stack Overflow API. */
/** The Question/Answer types were {@link https://www.w3.org/wiki/WebSchemas/QASchemaResearch based on} the Stack Overflow API. */
OrganizationEnum["source_QAStackExchange"] = "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_QAStackExchange";

@@ -285,0 +285,0 @@ })(OrganizationEnum = exports.OrganizationEnum || (exports.OrganizationEnum = {}));

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc