is-coursework/exdns/openapi.json
2026-02-08 23:11:59 +03:00

245 lines
6.0 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "Exdns HTTP API",
"version": "0.1.0"
},
"servers": [
{
"url": "http://localhost:8080"
}
],
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"schemas": {
"Zone": {
"type": "object",
"required": ["name", "version", "records"],
"properties": {
"name": { "type": "string" },
"version": { "type": "integer" },
"records": {
"type": "array",
"items": { "$ref": "#/components/schemas/Record" }
}
}
},
"Record": {
"type": "object",
"required": ["name", "type", "ttl", "data"],
"properties": {
"name": { "type": "string" },
"type": {
"type": "string",
"enum": ["A", "AAAA", "NS", "PTR", "MX", "TXT", "SOA", "CNAME"]
},
"ttl": { "type": "integer" },
"data": {}
}
},
"Error": {
"type": "object",
"properties": {
"error": { "type": "string" }
}
}
}
},
"security": [
{
"bearerAuth": []
}
],
"paths": {
"/zones/{domain}": {
"get": {
"summary": "Get zone",
"parameters": [
{
"name": "domain",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"responses": {
"200": {
"description": "Zone data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Zone" }
}
}
},
"404": {
"description": "Zone not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"post": {
"summary": "Create zone",
"parameters": [
{
"name": "domain",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Zone" }
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": { "status": { "type": "string" } }
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update zone",
"parameters": [
{
"name": "domain",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Zone" }
}
}
},
"responses": {
"200": {
"description": "Updated",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": { "status": { "type": "string" } }
}
}
}
},
"404": {
"description": "Zone not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete zone",
"parameters": [
{
"name": "domain",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"responses": {
"200": {
"description": "Deleted",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": { "status": { "type": "string" } }
}
}
}
},
"404": {
"description": "Zone not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
}
}
}