feat: add JSON Schema (#1681)

This commit is contained in:
typicode
2026-01-22 00:02:59 +01:00
committed by GitHub
parent f4e3c92b7c
commit c21fa06c6a
3 changed files with 13 additions and 1 deletions

View File

@@ -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 }

View File

@@ -14,7 +14,8 @@
},
"files": [
"lib",
"views"
"views",
"schema.json"
],
"type": "module",
"scripts": {

10
schema.json Normal file
View File

@@ -0,0 +1,10 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"additionalProperties": {
"oneOf": [
{ "type": "array" },
{ "type": "object" }
]
}
}