Skip to main content
appkiro.com

JSON例からJSON Schemaを生成

観測したpayloadからJSON Schemaの下書きを作り、validatorやAPIツールが対応するdialectを選びます。 1つの例を完全な契約として扱わないでください。

直接回答

JSON SchemaはJSON文書で許される構造、型、制約を記述します。 AppKiroは例から推論し複数draftを提供しますが、optional、union、format、業務ルールは手動補完が必要です。

dialectを選び、schemaの土台を作って対象validatorで検証してください。

1

入力 JSON

サンプル JSON を読み込みました。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2

出力 JSON Schema

1{2  "$schema": "http://json-schema.org/draft-07/schema#",3  "type": "object",4  "properties": {5    "user": {6      "type": "object",7      "properties": {8        "id": {9          "type": "integer",10          "examples": [11            112          ],13          "description": "Id field."14        },15        "name": {16          "type": "string",17          "examples": [18            "John"19          ],20          "description": "Name field."21        },22        "email": {23          "type": "string",24          "format": "email",25          "examples": [26            "[email protected]"27          ],28          "description": "Email field."29        },30        "isActive": {31          "type": "boolean",32          "examples": [33            true34          ],35          "description": "IsActive field."36        },37        "roles": {38          "type": "array",39          "items": {40            "anyOf": [41              {42                "type": "string",43                "examples": [44                  "admin"45                ]46              },47              {48                "type": "string",49                "examples": [50                  "editor"51                ]52              }53            ]54          },55          "examples": [56            [57              "admin",58              "editor"59            ]60          ],61          "description": "Roles field."62        },63        "profile": {64          "type": "object",65          "properties": {66            "age": {67              "type": "integer",68              "examples": [69                3070              ],71              "description": "Age field."72            },73            "address": {74              "type": "object",75              "properties": {76                "city": {77                  "type": "string",78                  "examples": [79                    "New York"80                  ],81                  "description": "City field."82                },83                "zip": {84                  "type": "string",85                  "examples": [86                    "10001"87                  ],88                  "description": "Zip field."89                }90              },91              "required": [92                "city",93                "zip"94              ],95              "description": "Address field."96            }97          },98          "required": [99            "age",100            "address"101          ],102          "description": "Profile field."103        },104        "lastLogin": {105          "type": "string",106          "format": "date-time",107          "examples": [108            "2024-03-18T10:24:00Z"109          ],110          "description": "LastLogin field."111        },112        "homepage": {113          "type": "string",114          "format": "uri",115          "examples": [116            "https://example.com"117          ],118          "description": "Homepage field."119        }120      },121      "required": [122        "id",123        "name",124        "email",125        "isActive",126        "roles",127        "profile",128        "lastLogin",129        "homepage"130      ],131      "description": "User field."132    }133  },134  "required": [135    "user"136  ]137}

使い方

  1. JSONを貼り付け/アップロードし、対応する公開例を開くこともできます。
  2. Draft 4、6、7、2019-09、2020-12を選び、type mapping、required、description、examples、const、null、順序を設定します。
  3. 対象validatorでraw/tree出力を確認し、実例に合わせて修正します。

主な機能と設定

  • 現在のUIでDraft 4〜2020-12を選択。
  • type mapping、description、examplesの設定。
  • required、const、nullの制御。
  • raw/treeプレビュー、コピー、ダウンロード。

対応する入力と出力

入力: JSONテキストまたはファイル, 対応する公開URL. 出力: JSON Schemaテキストまたはファイル.

利用例

  • APIペイロード向けschemaの初版を作る。
  • 設定ファイルやイベント構造を文書化する。
  • validator導入前にdialectを比較する。

どのワークフローを選ぶべきか

JSON Schema生成ツール:現在のUIでDraft 4〜2020-12を選択。 Function Calling Schema生成ツール:現在のUI対象はOpenAI、Claude、Gemini。

プライバシーとデータ経路

現在の実装では貼り付け/アップロード内容はブラウザで処理されますが、「Extract from URL」はサーバー側proxyで取得します。

制限とトラブル対処

  • OpenAPI 3.1はJSON Schema Draft 2020-12の意味体系を使用します。 利用先toolchainが対応するdialectを選んでください。
  • 単一例ではoptional property、全union、format、値制約を把握できません。
  • 現在のUIは入力上限 5 MB を表示します。 大きな入力はブラウザメモリと端末性能にも左右されます。

FAQ

どのJSON Schema draftを選べばよいですか?

validator、OpenAPIツール、schema利用側が明示的に対応するdialectを選びます。 新規独立案件では2020-12を優先検討できますが互換性確認が必要です。

データはサーバーへアップロードされますか?

現在の実装では貼り付け/アップロード内容はブラウザで処理されますが、「Extract from URL」はサーバー側proxyで取得します。

ファイルやデータの上限はありますか?

現在のUIは入力上限 5 MB を表示します。 大きな入力はブラウザメモリと端末性能にも左右されます。

スマートフォンでも使えますか?

Webツールのため最新のモバイルブラウザで動く可能性はありますが、ファイル選択、メモリ、端末ごとの互換性は全環境で確認されていません。 大きい・複雑な入力にはデスクトップブラウザを推奨します。

どのワークフローを選ぶべきか

JSON Schema生成ツール:現在のUIでDraft 4〜2020-12を選択。 Function Calling Schema生成ツール:現在のUI対象はOpenAI、Claude、Gemini。

関連ツール

dialectを選び、schemaの土台を作って対象validatorで検証してください。