gofr-dev/gofr

View on GitHub
examples/http-server/static/openapi.json

Summary

Maintainability
Test Coverage
{
  "openapi": "3.0.0",
  "info": {
    "title": "Http-Server API",
    "description": "Example Http-Server with multiple endpoints. This swagger represents the requests and responses for various endpoints included in the [http-server example of gofr](https://github.com/gofr-dev/gofr/tree/development/examples/http-server).",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:9000"
    }
  ],
  "paths": {
    "/hello": {
      "get": {
        "summary": "Get a greeting message",
        "parameters": [
          {
            "in": "query",
            "name": "name",
            "schema": {
              "type": "string"
            },
            "description": "Name to include in the greeting message"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/error": {
      "get": {
        "summary": "Simulate an error response",
        "responses": {
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/redis": {
      "get": {
        "summary": "Simulate a response from Redis",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/mysql": {
      "get": {
        "summary": "Simulate a response from MySQL",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trace": {
      "get": {
        "summary": "Simulate the tracing feature for a request",
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      }
    }
  }
}