Skip to content

Instantly share code, notes, and snippets.

@wrpinheiro
Last active March 28, 2017 12:36
Show Gist options
  • Save wrpinheiro/0a47042dd6c98a6bb5155c969375fa8b to your computer and use it in GitHub Desktop.
Save wrpinheiro/0a47042dd6c98a6bb5155c969375fa8b to your computer and use it in GitHub Desktop.
{"swagger":"2.1","info":{"version":"v1","title":"Dead Code Detection Service","contact":{"name":"Wellington Pinheiro"}},"basePath":"/api","tags":[{"name":"Repository controller"}],"schemes":["http","https"],"paths":{"/repository":{"get":{"tags":["Repository controller"],"summary":"List all repositories analyzed. This is a simplified view of repository without the code smells.","description":"","operationId":"getRepositories","consumes":["application/json"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Zero or more repositories found"}}},"post":{"tags":["Repository controller"],"summary":"Create a repository.","description":"","operationId":"addRepository","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","description":"Repository to be added and analyzed. The supported languages are:JAVA, ADA, CPP and FORTRAN","required":false,"schema":{"$ref":"#/definitions/RepositoryRequest"}}],"responses":{"200":{"description":"The repository created"},"409":{"description":"A repository with the URL already exists. If you want to check the dead code execute a POST to the endpoint repository/{repository.name}/analyze"},"412":{"description":"NAME and URL are required fields"}}}},"/repository/{repositoryName}":{"get":{"tags":["Repository controller"],"summary":"List the dead code issues found in the repository.","description":"","operationId":"getRepositoryIssues","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"repositoryName","in":"path","description":"the repository name to search","required":true,"type":"string"}],"responses":{"200":{"description":"The repository created"},"404":{"description":"Repository with the requested name could not found"}}},"delete":{"tags":["Repository controller"],"operationId":"removeRepository","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"repositoryName","in":"path","description":"The repository name to find dead code issues","required":true,"type":"string"}],"responses":{"200":{"description":"The repository was deleted"},"404":{"description":"The repository could not be found"},"412":{"description":"Trying to remove a repository while being analyzed"}}}},"/repository/{repositoryName}/analyze":{"post":{"tags":["Repository controller"],"summary":"Analyze a repository to find dead code.","description":"","operationId":"analyzeRepository","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"repositoryName","in":"path","description":"The repository name to be analyzed","required":true,"type":"string"}],"responses":{"200":{"description":"The repository is going to be analyzed (search for dead code"},"404":{"description":"A repository with the requested name could not be found"},"412":{"description":"Can't analyze a repository already being analyzed"}}}}},"definitions":{"AnalysisInformation":{"type":"object","properties":{"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"stage":{"type":"string","enum":["STARTED","CLONING_REPO","CREATING_UDB_FILE","CHECKING_DEAD_CODE","CREATING_DEAD_CODE_ISSUES","DONE"]},"errorMessage":{"type":"string"},"deadCodeIssues":{"type":"array","items":{"$ref":"#/definitions/DeadCodeIssue"}}}},"DeadCodeIssue":{"type":"object","properties":{"kind":{"type":"string"},"ref":{"type":"string"},"filename":{"type":"string"},"fromLine":{"type":"integer","format":"int32"},"toLine":{"type":"integer","format":"int32"}}},"GithubRepository":{"type":"object","properties":{"url":{"type":"string"},"language":{"type":"string","enum":["ADA","CPP","FORTRAN","JAVA"]},"branch":{"type":"string"},"name":{"type":"string"},"owner":{"type":"string"}}},"Repository":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"status":{"type":"string","enum":["ADDED","PROCESSING","COMPLETED","FAILED"]},"createdAt":{"type":"string","format":"date-time"},"lastAnalysisRequested":{"type":"string","format":"date-time"},"githubRepository":{"$ref":"#/definitions/GithubRepository"},"lastAnalysisInformation":{"$ref":"#/definitions/AnalysisInformation"}}},"SimpleAnalysisInformationResponse":{"type":"object","properties":{"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"stage":{"type":"string","enum":["STARTED","CLONING_REPO","CREATING_UDB_FILE","CHECKING_DEAD_CODE","CREATING_DEAD_CODE_ISSUES","DONE"]},"errorMessage":{"type":"string"}}},"SimpleRepositoryResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"githubRepository":{"$ref":"#/definitions/GithubRepository"},"status":{"type":"string","enum":["ADDED","PROCESSING","COMPLETED","FAILED"]},"createdAt":{"type":"string","format":"date-time"},"lastAnalysisRequested":{"type":"string","format":"date-time"},"lastAnalysisInformation":{"$ref":"#/definitions/SimpleAnalysisInformationResponse"}}},"RepositoryRequest":{"type":"object","required":["name","url"],"properties":{"name":{"type":"string","description":"A name for this repository. Must be unique!"},"url":{"type":"string","enum":["https://github.com/<owner>/<repository>.git"]},"language":{"type":"string","description":"The language used to analyze the repository","enum":["JAVA","ADA","CPP","FORTRAN"]},"branch":{"type":"string","description":"The branch that will be used to clone the repository"}}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment