Skip to content

Instantly share code, notes, and snippets.

@fjunior87
Last active February 24, 2018 15:52
Show Gist options
  • Save fjunior87/8d3dcd653694f5b9a6353f5841dac2f4 to your computer and use it in GitHub Desktop.
Save fjunior87/8d3dcd653694f5b9a6353f5841dac2f4 to your computer and use it in GitHub Desktop.
Swagger definition file used in the blog post
{
"swagger": "2.0",
"info" : {
"title": "ScoresAPI",
"description": "API to manage Test Scores",
"version": "v1",
"basePath": "/scores"
},
"paths": {
"/scores/{testId}": {
"get": {
"description": "Returns the scores for given testId",
"produces": [
"application/json"
],
"parameters": [
{
"name": "testId",
"in": "path",
"description": "The id of the test that the score will be retrieved",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "A Score resource",
"schema": {
"$ref": "#/definitions/Score"
}
}
}
}
},
"/scores/user/{username}": {
"get": {
"description": "Returns the scores for the given userId",
"produces": [
"application/json"
],
"parameters": [
{
"name": "username",
"in": "path",
"description": "The username of the user",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "The list of Score resources",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Score"
}
}
}
}
}
}
},
"definitions": {
"Score": {
"type": "object",
"properties": {
"testId": {
"type": "integer"
},
"score": {
"type": "number",
"format": "double"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment