Skip to content

Commit

Permalink
docs: fix schemas (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
morremeyer authored Sep 1, 2024
1 parent 28222da commit abb328f
Show file tree
Hide file tree
Showing 16 changed files with 168 additions and 14 deletions.
7 changes: 7 additions & 0 deletions static/schemas/v3/error.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/error.schema.json",
"title": "Error",
"description": "A human readable error message",
"oneOf": [{ "type": "string" }, { "type": "null" }]
}
28 changes: 28 additions & 0 deletions static/schemas/v3/get-collection.response.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/get-collection.response.schema.json",
"title": "HTTP GET - Collection Endpoints",
"description": "The HTTP response body for GET collection endpoints",
"type": "object",
"required": ["data", "error", "pagination"],
"properties": {
"data": {
"description": "List of resources",
"oneOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{ "type": "null" }
]
},
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
},
"pagination": {
"$ref": "https://envelope-zero.org/schemas/v3/pagination.schema.json"
}
}
}
17 changes: 17 additions & 0 deletions static/schemas/v3/get-patch-resource.response.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/get-patch-resource.response.schema.json",
"title": "HTTP GET/PATCH - Resource Endpoint",
"description": "The HTTP response body for GET/PATCH resource endpoints",
"type": "object",
"required": ["data", "error"],
"properties": {
"data": {
"description": "The resource",
"oneOf": [{ "type": "object" }, { "type": "null" }]
},
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
}
}
}
13 changes: 13 additions & 0 deletions static/schemas/v3/options.response.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/options.response.schema.json",
"title": "HTTP OPTIONS",
"description": "The HTTP response body for OPTIONS requests that are not successful",
"type": "object",
"required": ["error"],
"properties": {
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
}
}
}
36 changes: 36 additions & 0 deletions static/schemas/v3/pagination.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/pagination.schema.json",
"title": "Pagination",
"description": "The pagination information",
"type": "object",
"oneOf": [
{
"type": "object",
"required": ["count", "limit", "offset", "total"],
"properties": {
"count": {
"description": "The number of results in this response",
"type": "integer",
"minimum": 0
},
"limit": {
"description": "The limit for the number of results used for this response",
"type": "integer",
"minimum": -1
},
"offset": {
"description": "The offset of the first resource returned",
"type": "integer",
"minimum": 0
},
"total": {
"description": "Total number of records matching the query",
"type": "integer",
"minimum": 0
}
}
},
{ "type": "null" }
]
}
7 changes: 7 additions & 0 deletions static/schemas/v3/patch.request.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/patch.request.schema.json",
"title": "HTTP PATCH request",
"description": "The HTTP request body for PATCH requests",
"type": "object"
}
11 changes: 11 additions & 0 deletions static/schemas/v3/post.request.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/post.request.schema.json",
"title": "HTTP POST request",
"description": "The HTTP request body for POST requests",
"type": "array",
"minLength": 1,
"items": {
"type": "object"
}
}
35 changes: 35 additions & 0 deletions static/schemas/v3/post.response.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/post.response.schema.json",
"title": "HTTP POST response",
"description": "The HTTP response body for POST requests",
"type": "object",
"required": ["data", "error"],
"properties": {
"data": {
"description": "List of resources",
"oneOf": [
{
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
},
"data": {
"description": "A single resource",
"type": "object"
}
}
}
},
{ "type": "null" }
]
},
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
}
}
}
2 changes: 1 addition & 1 deletion static/schemas/v4/error.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/error.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/error.schema.json",
"title": "Error",
"description": "A human readable error message",
"oneOf": [{ "type": "string" }, { "type": "null" }]
Expand Down
6 changes: 3 additions & 3 deletions static/schemas/v4/get-collection.response.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/get-collection.response.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/get-collection.response.schema.json",
"title": "HTTP GET - Collection Endpoints",
"description": "The HTTP response body for GET collection endpoints",
"type": "object",
Expand All @@ -19,10 +19,10 @@
]
},
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
"$ref": "https://envelope-zero.org/schemas/v4/error.schema.json"
},
"pagination": {
"$ref": "https://envelope-zero.org/schemas/v3/pagination.schema.json"
"$ref": "https://envelope-zero.org/schemas/v4/pagination.schema.json"
}
}
}
4 changes: 2 additions & 2 deletions static/schemas/v4/get-patch-resource.response.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/get-patch-resource.response.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/get-patch-resource.response.schema.json",
"title": "HTTP GET/PATCH - Resource Endpoint",
"description": "The HTTP response body for GET/PATCH resource endpoints",
"type": "object",
Expand All @@ -11,7 +11,7 @@
"oneOf": [{ "type": "object" }, { "type": "null" }]
},
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
"$ref": "https://envelope-zero.org/schemas/v4/error.schema.json"
}
}
}
4 changes: 2 additions & 2 deletions static/schemas/v4/options.response.schema.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/options.response.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/options.response.schema.json",
"title": "HTTP OPTIONS",
"description": "The HTTP response body for OPTIONS requests that are not successful",
"type": "object",
"required": ["error"],
"properties": {
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
"$ref": "https://envelope-zero.org/schemas/v4/error.schema.json"
}
}
}
2 changes: 1 addition & 1 deletion static/schemas/v4/pagination.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/pagination.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/pagination.schema.json",
"title": "Pagination",
"description": "The pagination information",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion static/schemas/v4/patch.request.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/patch.request.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/patch.request.schema.json",
"title": "HTTP PATCH request",
"description": "The HTTP request body for PATCH requests",
"type": "object"
Expand Down
2 changes: 1 addition & 1 deletion static/schemas/v4/post.request.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/post.request.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/post.request.schema.json",
"title": "HTTP POST request",
"description": "The HTTP request body for POST requests",
"type": "array",
Expand Down
6 changes: 3 additions & 3 deletions static/schemas/v4/post.response.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://envelope-zero.org/schemas/v3/post.response.schema.json",
"$id": "https://envelope-zero.org/schemas/v4/post.response.schema.json",
"title": "HTTP POST response",
"description": "The HTTP response body for POST requests",
"type": "object",
Expand All @@ -16,7 +16,7 @@
"type": "object",
"properties": {
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
"$ref": "https://envelope-zero.org/schemas/v4/error.schema.json"
},
"data": {
"description": "A single resource",
Expand All @@ -29,7 +29,7 @@
]
},
"error": {
"$ref": "https://envelope-zero.org/schemas/v3/error.schema.json"
"$ref": "https://envelope-zero.org/schemas/v4/error.schema.json"
}
}
}

0 comments on commit abb328f

Please sign in to comment.