Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Infers JSON Schemas and Type Definitions from example JSON

License

NotificationsYou must be signed in to change notification settings

triggerdotdev/schema-infer

Repository files navigation

Infers JSON Schemas and Type Definitions from example JSON

Features

  • 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

Usage

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"]}

Examples

Roadmap

  • 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

Stars

Watchers

Forks

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp