Coder Social home page Coder Social logo

pjfanning / swagger-pekko-http-sample Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 208 KB

Sample demonstrating use of swagger-pekko-http

License: Apache License 2.0

Scala 100.00%
enumeratum openapi pekko pekko-http scala swagger swagger-pekko-http

swagger-pekko-http-sample's Introduction

swagger-pekko-http-sample

Check out this git repo and use sbt run to start the Akka Http server.

Uses swagger-pekko-http which is built using swagger.io libs.

Test using the Swagger UI at http://localhost:12345/api-docs. You can view the swagger doc itself at http://localhost:12345/api-docs/swagger.json and http://localhost:12345/api-docs/swagger.yaml.

The Swagger UI can be used to send sample requests.

http://localhost:12345/api-docs redirects to https://petstore.swagger.io/ but provides a 'url' parameter that causes this sample's swagger.json to be loaded.

Current swagger.json

{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "",
    "description" : "",
    "termsOfService" : "",
    "version" : "1.0"
  },
  "externalDocs" : {
    "description" : "Core Docs",
    "url" : "http://acme.com/docs"
  },
  "servers" : [ {
    "url" : "http://localhost:12345"
  } ],
  "security" : [ ],
  "paths" : {
    "/add" : {
      "post" : {
        "summary" : "Add integers",
        "description" : "Add integers",
        "operationId" : "add",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AddRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Add response",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/AddResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error"
          }
        }
      }
    },
    "/addOption" : {
      "post" : {
        "summary" : "Add integers",
        "description" : "Add integers",
        "operationId" : "addOption",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AddOptionRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Add response",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/AddOptionResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error"
          }
        }
      }
    },
    "/echoenum" : {
      "post" : {
        "summary" : "Echo Enum",
        "description" : "Echo Enum",
        "operationId" : "echo",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/EchoEnum"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Echo Enum",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/EchoEnum"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad Request"
          }
        }
      }
    },
    "/echoenumeratum" : {
      "post" : {
        "summary" : "Echo Enumeratum",
        "description" : "Echo Enumeratum",
        "operationId" : "echo_1",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/EchoEnumeratum"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Echo Enumeratum",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/EchoEnumeratum"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad Request"
          }
        }
      }
    },
    "/echolist" : {
      "post" : {
        "summary" : "Echo List",
        "description" : "Echo List",
        "operationId" : "echo_2",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/EchoList"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Echo List",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/EchoList"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad Request"
          }
        }
      }
    },
    "/hello" : {
      "get" : {
        "summary" : "Return Hello greeting (anonymous)",
        "description" : "Return Hello greeting for anonymous request",
        "operationId" : "getHello",
        "responses" : {
          "200" : {
            "description" : "Hello response",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Greeting"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error"
          }
        }
      }
    },
    "/hello/{name}" : {
      "get" : {
        "summary" : "Return Hello greeting",
        "description" : "Return Hello greeting for named user",
        "operationId" : "getHelloSegment",
        "parameters" : [ {
          "name" : "name",
          "in" : "path",
          "description" : "user name",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Hello response",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Greeting"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error"
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "AddRequest" : {
        "required" : [ "numbers" ],
        "type" : "object",
        "properties" : {
          "numbers" : {
            "type" : "array",
            "items" : {
              "type" : "integer",
              "format" : "int32"
            }
          }
        }
      },
      "SeqString" : {
        "type" : "array",
        "items" : {
          "type" : "string"
        }
      },
      "Greeting" : {
        "required" : [ "greeting" ],
        "type" : "object",
        "properties" : {
          "greeting" : {
            "type" : "string"
          }
        }
      },
      "EchoList" : {
        "required" : [ "listName", "values" ],
        "type" : "object",
        "properties" : {
          "listName" : {
            "type" : "string"
          },
          "values" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          }
        }
      },
      "AddOptionResponse" : {
        "required" : [ "sum" ],
        "type" : "object",
        "properties" : {
          "sum" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "AddOptionRequest" : {
        "required" : [ "number" ],
        "type" : "object",
        "properties" : {
          "number" : {
            "type" : "integer",
            "format" : "int32"
          },
          "number2" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "EchoEnumeratum" : {
        "required" : [ "enumValue" ],
        "type" : "object",
        "properties" : {
          "enumValue" : {
            "type" : "string",
            "enum" : [ "TALL", "GRANDE", "VENTI" ]
          }
        }
      },
      "EchoEnum" : {
        "required" : [ "enumValue" ],
        "type" : "object",
        "properties" : {
          "enumValue" : {
            "type" : "string",
            "enum" : [ "TALL", "GRANDE", "VENTI" ]
          }
        }
      },
      "AddResponse" : {
        "required" : [ "sum" ],
        "type" : "object",
        "properties" : {
          "sum" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      }
    }
  }
}

swagger-pekko-http-sample's People

Contributors

dschmitz avatar gerbrand avatar pjfanning avatar willemjiang avatar yiksanchan avatar

Watchers

 avatar  avatar

swagger-pekko-http-sample's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.