-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from moonbitlang/docs-json-schema
docs(zh): JSON schema
- Loading branch information
Showing
9 changed files
with
581 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Config JSON Schema | ||
|
||
## moon.mod.json | ||
<iframe src="source/mod_json_schema.html" width="100%" height="500px" frameborder="0"></iframe> | ||
|
||
## moon.pkg.json | ||
<iframe src="source/pkg_json_schema.html" width="100%" height="500px" frameborder="0"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.9.2/jsoneditor.min.css" rel="stylesheet" | ||
type="text/css"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.9.2/jsoneditor.min.js"></script> | ||
|
||
<title>moon.mod.json schema viewer</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 20px; | ||
background-color: #f0f0f0; | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
} | ||
|
||
#schema-container { | ||
max-width: 800px; | ||
margin: 20px auto; | ||
background-color: white; | ||
padding: 20px; | ||
border-radius: 5px; | ||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="schema-container"></div> | ||
|
||
<script> | ||
const schema = { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "JSON schema for MoonBit moon.mod.json files", | ||
"description": "A module of MoonBit lang", | ||
"type": "object", | ||
"required": [ | ||
"name" | ||
], | ||
"properties": { | ||
"alert-list": { | ||
"description": "Alert list setting of the module", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"deps": { | ||
"description": "third-party dependencies of the module", | ||
"type": [ | ||
"object", | ||
"null" | ||
], | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
"description": { | ||
"description": "description of this module", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"keywords": { | ||
"description": "keywords of this module", | ||
"type": [ | ||
"array", | ||
"null" | ||
], | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"license": { | ||
"description": "license of this module", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"name": { | ||
"description": "name of the module", | ||
"type": "string" | ||
}, | ||
"readme": { | ||
"description": "path to module's README file", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"repository": { | ||
"description": "url to module's repository", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"source": { | ||
"description": "source code directory of this module", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"version": { | ||
"description": "version of the module", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"warn-list": { | ||
"description": "Warn list setting of the module", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
} | ||
} | ||
} | ||
const container = document.getElementById('schema-container'); | ||
const options = { | ||
language: 'en', | ||
mode: 'view', | ||
modes: ['code', 'form', 'text', 'tree', 'view'], | ||
onError: function (err) { | ||
console.error(err); | ||
} | ||
}; | ||
const editor = new JSONEditor(container, options, schema); | ||
</script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.