- Notifications
You must be signed in to change notification settings - Fork11
Infers JSON Schemas and Type Definitions from example JSON
License
NotificationsYou must be signed in to change notification settings
triggerdotdev/schema-infer
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Infers JSON Schemas and Type Definitions from example JSON
- Written in typescript
- Inspired byjtd-infer
- Generate JSON schema documents from example data
- Supports most string formats throughjson-infer-types
- Date and times
- URIs
- Email Addresses
- Hostnames
- IP Addresses
- uuids
- Available as a CLI and a library
- Supports snapshotting and restoring inference sessions
import{inferSchema}from"@jsonhero/schema-infer";inferSchema({id:"abeb8b52-e960-44dc-9e09-57bb00d6b441",name:"Eric",emailAddress:"eric@example.com",website:"https://github.com/ericallam",joined:"2022-01-01",})toJSONSchema();
Infers the following JSON schema:
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties": {"id": {"type":"string","format":"uuid" },"name": {"type":"string" },"emailAddress": {"type":"string","format":"email" },"website": {"type":"string","format":"uri" },"joined": {"type":"string","format":"date" } },"required": ["id","name","emailAddress","website","joined"]}- Add support for hints for discriminators (tagged unions), value-only schemas, and enums
- Add support forJSON Typedefs
- Add "verbose" mode to include
$id,examples, etc.
About
Infers JSON Schemas and Type Definitions from example JSON
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.