mirror of
https://github.com/typicode/json-server.git
synced 2026-03-13 09:35:37 +08:00
feat: add JSON Schema (#1681)
This commit is contained in:
@@ -20,6 +20,7 @@ Create a `db.json` or `db.json5` file
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "./node_modules/json-server/schema.json",
|
||||
"posts": [
|
||||
{ "id": "1", "title": "a title", "views": 100 },
|
||||
{ "id": "2", "title": "another title", "views": 200 }
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"views"
|
||||
"views",
|
||||
"schema.json"
|
||||
],
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
10
schema.json
Normal file
10
schema.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{ "type": "array" },
|
||||
{ "type": "object" }
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user