Skip to content

Instantly share code, notes, and snippets.

@vbauer
Created December 9, 2012 04:40
Show Gist options
  • Save vbauer/4243345 to your computer and use it in GitHub Desktop.
Save vbauer/4243345 to your computer and use it in GitHub Desktop.
swagger examples
{"apiVersion":"0.1","swaggerVersion":"1.1.0","basePath":"http://localhost:8080/rest","apis":[{"path":"/api-docs/auth","description":""},{"path":"/api-docs/tags","description":""},{"path":"/api-docs/users","description":""},{"path":"/api-docs/permissions","description":""},{"path":"/api-docs/directories","description":""},{"path":"/api-docs/files","description":""},{"path":"/api-docs/likes","description":""},{"path":"/api-docs/links","description":""},{"path":"/api-docs/roles","description":""},{"path":"/api-docs/resources","description":""},{"path":"/api-docs/avatars","description":""},{"path":"/api-docs/images","description":""},{"path":"/api-docs/indexer","description":""},{"path":"/api-docs/comments","description":""}]}
{"apiVersion":"0.1","swaggerVersion":"1.1.0","basePath":"http://localhost:8080/rest","resourcePath":"/auth","models":{"AuthInformationDTO":{"id":"AuthInformationDTO","properties":{"rememberMe":{"type":"boolean"},"login":{"required":true,"type":"string"},"password":{"required":true,"type":"string"}}}},"apis":[{"path":"/auth","description":"Authentication operations","operations":[{"httpMethod":"DELETE","summary":"Logout from system","responseClass":"void","nickname":"logout"},{"httpMethod":"POST","summary":"Login into system","responseClass":"void","nickname":"login","parameters":[{"description":"User auth information","paramType":"body","required":true,"allowMultiple":false,"dataType":"AuthInformationDTO"}]}]}]}
{"apiVersion":"0.1","swaggerVersion":"1.1.0","basePath":"http://localhost:8080/rest","resourcePath":"/comments","models":{"CommentContentDTO":{"id":"CommentContentDTO","properties":{"text":{"type":"string"}}}},"apis":[{"path":"/comments/files/{resourceFileId}","description":"Comment operations","operations":[{"httpMethod":"POST","summary":"Create comment","responseClass":"void","nickname":"create","parameters":[{"name":"resourceFileId","description":"Resource file identifier","paramType":"path","required":true,"allowMultiple":false,"dataType":"int"},{"description":"Comment information","paramType":"body","required":true,"allowMultiple":false,"dataType":"CommentContentDTO"}]},{"httpMethod":"GET","summary":"Find resource file comments","responseClass":"void","nickname":"findByFile","parameters":[{"name":"resourceFileId","description":"Resource file identifier","paramType":"path","required":true,"allowMultiple":false,"dataType":"int"},{"name":"page","description":"Start page","paramType":"query","required":false,"allowMultiple":false,"dataType":"int"},{"name":"count","description":"Items count","paramType":"query","required":false,"allowMultiple":false,"dataType":"int"}]}]},{"path":"/comments/{commentId}","description":"Comment operations","operations":[{"httpMethod":"PUT","summary":"Update comment","responseClass":"void","nickname":"update","parameters":[{"name":"commentId","description":"Comment identifier","paramType":"path","required":true,"allowMultiple":false,"dataType":"int"},{"description":"Comment information","paramType":"body","required":true,"allowMultiple":false,"dataType":"CommentContentDTO"}]}]},{"path":"/comments/recent","description":"Comment operations","operations":[{"httpMethod":"GET","summary":"Find recent resource file comments","responseClass":"void","nickname":"findRecent","parameters":[{"name":"page","description":"Start page","paramType":"query","required":false,"allowMultiple":false,"dataType":"int"},{"name":"count","description":"Items count","paramType":"query","required":false,"allowMultiple":false,"dataType":"int"}]}]},{"path":"/comments/{commentIds}","description":"Comment operations","operations":[{"httpMethod":"DELETE","summary":"Delete all specified comments","responseClass":"void","nickname":"deleteAll","parameters":[{"name":"commentIds","description":"Comment identifiers","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}]}]}]}
@fehguy
Copy link

fehguy commented Dec 9, 2012

api-docs

{
  "apiVersion":"0.1",
  "swaggerVersion":"1.1.0",
  "basePath":"http://localhost:8000/rest",
  "apis":[
    {
      "path":"/api-docs/auth",
      "description":""
    },
    {
      "path":"/api-docs/comments",
      "description":""
    }
  ]
}

auth

{
  "apiVersion":"0.1",
  "swaggerVersion":"1.1.0",
  "basePath":"http://localhost:8000/rest",
  "resourcePath":"/auth",
  "models":{
    "AuthInformationDTO":{
      "id":"AuthInformationDTO",
      "properties":{
        "rememberMe":{
          "type":"boolean"
        },
        "login":{
          "required":true,
          "type":"string"
        },
        "password":{
          "required":true,
          "type":"string"
        }
      }
    }
  },
  "apis":[
    {
      "path":"/auth",
      "description":"Authentication operations",
      "operations":[
        {
          "httpMethod":"DELETE",
          "summary":"Logout from system",
          "responseClass":"void",
          "nickname":"logout"
        },
        {
          "httpMethod":"POST",
          "summary":"Login into system",
          "responseClass":"void",
          "nickname":"login",
          "parameters":[
            {
              "description":"User auth information",
              "paramType":"body",
              "required":true,
              "allowMultiple":false,
              "dataType":"AuthInformationDTO"
            }
          ]
        }
      ]
    }
  ]
}

comments

{
  "apiVersion":"0.1",
  "swaggerVersion":"1.1.0",
  "basePath":"http://localhost:8080/rest",
  "resourcePath":"/comments",
  "models":{
    "CommentContentDTO":{
      "id":"CommentContentDTO",
      "properties":{
        "text":{
          "type":"string"
        }
      }
    }
  },
  "apis":[
    {
      "path":"/comments/files/{resourceFileId}",
      "description":"Comment operations",
      "operations":[
        {
          "httpMethod":"POST",
          "summary":"Create comment",
          "responseClass":"void",
          "nickname":"create",
          "parameters":[
            {
              "name":"resourceFileId",
              "description":"Resource file identifier",
              "paramType":"path",
              "required":true,
              "allowMultiple":false,
              "dataType":"int"
            },
            {
              "description":"Comment information",
              "paramType":"body",
              "required":true,
              "allowMultiple":false,
              "dataType":"CommentContentDTO"
            }
          ]
        },
        {
          "httpMethod":"GET",
          "summary":"Find resource file comments",
          "responseClass":"void",
          "nickname":"findByFile",
          "parameters":[
            {
              "name":"resourceFileId",
              "description":"Resource file identifier",
              "paramType":"path",
              "required":true,
              "allowMultiple":false,
              "dataType":"int"
            },
            {
              "name":"page",
              "description":"Start page",
              "paramType":"query",
              "required":false,
              "allowMultiple":false,
              "dataType":"int"
            },
            {
              "name":"count",
              "description":"Items count",
              "paramType":"query",
              "required":false,
              "allowMultiple":false,
              "dataType":"int"
            }
          ]
        }
      ]
    },
    {
      "path":"/comments/{commentId}",
      "description":"Comment operations",
      "operations":[
        {
          "httpMethod":"PUT",
          "summary":"Update comment",
          "responseClass":"void",
          "nickname":"update",
          "parameters":[
            {
              "name":"commentId",
              "description":"Comment identifier",
              "paramType":"path",
              "required":true,
              "allowMultiple":false,
              "dataType":"int"
            },
            {
              "description":"Comment information",
              "paramType":"body",
              "required":true,
              "allowMultiple":false,
              "dataType":"CommentContentDTO"
            }
          ]
        }
      ]
    },
    {
      "path":"/comments/recent",
      "description":"Comment operations",
      "operations":[
        {
          "httpMethod":"GET",
          "summary":"Find recent resource file comments",
          "responseClass":"void",
          "nickname":"findRecent",
          "parameters":[
            {
              "name":"page",
              "description":"Start page",
              "paramType":"query",
              "required":false,
              "allowMultiple":false,
              "dataType":"int"
            },
            {
              "name":"count",
              "description":"Items count",
              "paramType":"query",
              "required":false,
              "allowMultiple":false,
              "dataType":"int"
            }
          ]
        }
      ]
    },
    {
      "path":"/comments/{commentIds}",
      "description":"Comment operations",
      "operations":[
        {
          "httpMethod":"DELETE",
          "summary":"Delete all specified comments",
          "responseClass":"void",
          "nickname":"deleteAll",
          "parameters":[
            {
              "name":"commentIds",
              "description":"Comment identifiers",
              "paramType":"path",
              "required":true,
              "allowMultiple":false,
              "dataType":"string"
            }
          ]
        }
      ]
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment