Added and simplified error code templates

main
Tom Peltonen 2025-07-06 16:06:58 +10:00
parent e16e01d623
commit 23fe8a5bc6
25 changed files with 341 additions and 38 deletions

View File

@ -0,0 +1,28 @@
{
"name": "error-400",
"guide": "{{.SelfFolder}}/error-4nn.md",
"description": "400 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-400.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"path","type":"string","value":"^/.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"GET, POST, DELETE, PUT, PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"httpCode","type":"string","value":"400"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,28 @@
{
"name": "error-401",
"guide": "{{.SelfFolder}}/error-4nn.md",
"description": "401 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-401.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"path","type":"string","value":"^/.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"GET, POST, DELETE, PUT, PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"httpCode","type":"string","value":"401"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,28 @@
{
"name": "error-403",
"guide": "{{.SelfFolder}}/error-4nn.md",
"description": "403 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-403.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"path","type":"string","value":"^/.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"GET, POST, DELETE, PUT, PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"httpCode","type":"string","value":"403"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,28 @@
{
"name": "error-404",
"guide": "{{.SelfFolder}}/error-4nn.md",
"description": "404 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-404.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"path","type":"string","value":"^/.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"GET, POST, DELETE, PUT, PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"httpCode","type":"string","value":"404"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,28 @@
{
"name": "error-405",
"guide": "{{.SelfFolder}}/error-4nn.md",
"description": "405 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-405.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"path","type":"string","value":"^/.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"GET, POST, DELETE, PUT, PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"httpCode","type":"string","value":"405"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,35 @@
# 4nn Client errors
## 400 Bad request
The HTTP code 400 indicates that the server could not understand the request due to incorrect syntax.
The client should NOT repeat the request without modifications.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/400)
## 401 Unauthorized
The HTTP code 401 indicates that the request requires user authentication information.
The client MAY repeat the request with a suitable Authorization header field
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/401)
## 403 Forbidden
The HTTP code 403 indicates that the client does not have access rights to the content.
Unlike 401, the clients identity is known to the server.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403)
## 404 Not Found
The HTTP code 404 indicates that the server can not find the requested resource.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/404)
## 405 Method Not Allowed
The HTTP code 405 indicates that the server could not understand the request due to incorrect syntax.
The client should NOT repeat the request without modifications.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/405)

View File

@ -0,0 +1,28 @@
{
"name": "error-500",
"guide": "{{.SelfFolder}}/error-5nn.md",
"description": "500 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-500.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"path","type":"string","value":"^/.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"GET, POST, DELETE, PUT, PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"httpCode","type":"string","value":"500"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -1,12 +1,12 @@
{ {
"name": "error-501", "name": "error-501",
"guide": "{{.SelfFolder}}/error-501.md", "guide": "{{.SelfFolder}}/error-5nn.md",
"description": "503 error response", "description": "503 error response",
"templates": [ "templates": [
{ {
"engine": "", "engine": "",
"folder": "{{.SelfFolder}}/{{.TemplateName}", "folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-nnn.tmpl", "file_name": "error-501.json",
"output_folder": "", "output_folder": "",
"output_name": "", "output_name": "",
"section": "", "section": "",

View File

@ -1,6 +0,0 @@
# 501 Not Implemented
The HTTP code 501 indicates that the server has not implemented this service at
this path and for this method.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)

View File

@ -1,10 +0,0 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The service is not implemented"
}

View File

@ -1,12 +1,12 @@
{ {
"name": "error-503", "name": "error-503",
"guide": "{{.SelfFolder}}/error-503.md", "guide": "{{.SelfFolder}}/error-5nn.md",
"description": "503 error response", "description": "503 error response",
"templates": [ "templates": [
{ {
"engine": "", "engine": "",
"folder": "{{.SelfFolder}}/{{.TemplateName}", "folder": "{{.SelfFolder}}/error-nnn",
"file_name": "error-nnn.tmpl", "file_name": "error-503.json",
"output_folder": "", "output_folder": "",
"output_name": "", "output_name": "",
"section": "", "section": "",

View File

@ -1,6 +0,0 @@
# 503 Service Unavailable
The HTTP code 503 indicates that the server is not ready to handle the request. This could be a temporary
or longer term issue.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/503)

View File

@ -1,10 +0,0 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The service is unavailable"
}

View File

@ -0,0 +1,22 @@
# 5nn Server errors
## 500 Not Implemented
The HTTP code 501 indicates that the server encountered an unexpected
condition that prevented it from fulfilling the request.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/500)
## 501 Not Implemented
The HTTP code 501 indicates that the server has not implemented this service at
this path and for this method.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)
## 503 Service Unavailable
The HTTP code 503 indicates that the server is not ready to handle the request. This could be a temporary
or longer term issue.
For more information see [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/503)

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The server could not understand the request due to incorrect syntax. The client should NOT repeat the request without modifications."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "Indicates that the request requires user authentication information. The client MAY repeat the request with a suitable Authorization header field"
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "Unauthorized request. The client does not have access rights to the content. Unlike 401, the clients identity is known to the server."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The server can not find the requested resource."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The server knows the request HTTP method, but it has been disabled and cannot be used for that resource."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The requested resource is no longer available on the server."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "Client error"
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The server encountered an unexpected condition that prevented it from fulfilling the request."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The HTTP method is not supported by the server and cannot be handled."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "The server is not ready to handle the request."
}

View File

@ -0,0 +1,10 @@
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "Server error"
}