More templates and refactoring

main
Tom Peltonen 2025-07-04 21:53:56 +10:00
parent 1392d22e8b
commit b9e101126a
9 changed files with 259 additions and 1 deletions

View File

@ -0,0 +1,28 @@
{
"name": "error-501",
"guide": "{{.SelfFolder}}/error-501.md",
"description": "503 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/{{.TemplateName}",
"file_name": "error-nnn.tmpl",
"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":"name","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":"501"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,6 @@
# 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

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

View File

@ -0,0 +1,28 @@
{
"name": "error-503",
"guide": "{{.SelfFolder}}/error-503.md",
"description": "503 error response",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/{{.TemplateName}",
"file_name": "error-nnn.tmpl",
"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":"name","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":"503"},
{"label": "OpenAPI","source" :"","default":"","name":"ref","type":"string","value":""},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"}
]
}

View File

@ -0,0 +1,6 @@
# 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 service is unavailable"
}

View File

@ -18,7 +18,7 @@
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path"},
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-responses"},
{"label": "OpenAPI","source" :"","default":"","name":"name","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,503"},

View File

@ -0,0 +1,27 @@
{
"name": "health-patch",
"guide": "{{.SelfFolder}}/health-patch.md",
"description": "Health service patch",
"templates": [
{
"engine": "",
"folder": "{{.SelfFolder}}/{{.TemplateName}}",
"file_name": "health-patch.json",
"output_folder": "",
"output_name": "",
"section": "",
"model": {
"activity": {
"category": "OTHER"
}
}
}
],
"variables": [
{"label": "OpenAPI","source" :"","default":"","name":"openapi.type","type":"string","value":"path-method"},
{"label": "OpenAPI","source" :"","default":"","name":"name","type":"string","value":"^/health.*$"},
{"label": "OpenAPI","source" :"","default":"","name":"method","type":"string","value":"PATCH"},
{"label": "OpenAPI","source" :"","default":"","name":"value","type":"string","value":"*CONTENT"},
{"label": "OpenAPI","source" :"","default":"","name":"tag","type":"string","value":"ManageService"}
]
}

View File

@ -0,0 +1,143 @@
{
"tags": [
"Draft",
"ManageService"
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/health-model"
},
"examples": {
"Simple-health": {
"value": {
"status": "PASS",
"version": "some text",
"notes": [
"some text",
"some text"
],
"output": "some text",
"description": "some text",
"checks": {},
"release_id": "some text",
"service_id": "some text",
"links": [
{
"href": "some text",
"rel": "some text",
"operation": "PUT",
"caption": "some text",
"media_type": "some text"
},
{
"href": "some text",
"rel": "some text",
"operation": "POST",
"caption": "some text",
"media_type": "some text"
}
]
}
}
}
}
},
"description": "The service is healthy"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "Request is not valid"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
}
}
},
"description": "Unauthorised request"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error-model"
},
"examples": {
"health500error": {
"value": {
"status": "some text",
"message": "some text",
"resolution": "some text",
"technical": "some text"
}
}
}
}
},
"description": "Internal error with service, with minimal\ninformation available"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/health-model"
},
"examples": {
"ealth503error": {
"value": {
"status": "FAIL",
"version": "some text",
"notes": [
"some text",
"some text"
],
"output": "some text",
"description": "some text",
"checks": {},
"release_id": "some text",
"service_id": "some text",
"links": [
{
"href": "some text",
"rel": "some text",
"operation": "GET",
"caption": "some text",
"media_type": "some text"
},
{
"href": "some text",
"rel": "some text",
"operation": "DELETE",
"caption": "some text",
"media_type": "some text"
}
]
}
}
}
}
},
"description": "The service is unavailable"
}
},
"security": [
{
"oauth": [],
"apikey": []
}
],
"operationId": "gethealth",
"summary": "Patches the health of the service",
"description": "Simple patch for the service"
}