Bug: 627
[controller.git] / opendaylight / md-sal / sal-rest-docgen / src / test / resources / sample-swagger-spec.json
diff --git a/opendaylight/md-sal/sal-rest-docgen/src/test/resources/sample-swagger-spec.json b/opendaylight/md-sal/sal-rest-docgen/src/test/resources/sample-swagger-spec.json
new file mode 100644 (file)
index 0000000..2d1b09a
--- /dev/null
@@ -0,0 +1,440 @@
+{
+    "apiVersion": "1.0.0",
+    "swaggerVersion": "1.2",
+    "basePath": "/api",
+    "resourcePath": "/pet",
+    "produces": [
+        "application/json",
+        "application/xml",
+        "text/plain",
+        "text/html"
+    ],
+    "authorizations": {
+        "oauth2": [
+            {
+                "scope": "write:pets",
+                "description": "modify pets in your account"
+            },
+            {
+                "scope": "read:pets",
+                "description": "read your pets"
+            }
+        ]
+    },
+    "apis": [
+        {
+            "path": "/pet",
+            "operations": [
+                {
+                    "method": "POST",
+                    "summary": "Add a new pet to the store",
+                    "notes": "",
+                    "type": "void",
+                    "nickname": "addPet",
+                    "consumes": [
+                        "application/json",
+                        "application/xml"
+                    ],
+                    "authorizations": {
+                        "oauth2": [
+                            {
+                                "scope": "write:pets",
+                                "description": "modify pets in your account"
+                            }
+                        ]
+                    },
+                    "parameters": [
+                        {
+                            "name": "body",
+                            "description": "Pet object that needs to be added to the store",
+                            "required": true,
+                            "type": "Pet",
+                            "paramType": "body"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 405,
+                            "message": "Invalid input"
+                        }
+                    ]
+                },
+                {
+                    "method": "PUT",
+                    "summary": "Update an existing pet",
+                    "notes": "",
+                    "type": "void",
+                    "nickname": "updatePet",
+                    "authorizations": {},
+                    "parameters": [
+                        {
+                            "name": "body",
+                            "description": "Pet object that needs to be updated in the store",
+                            "required": true,
+                            "type": "Pet",
+                            "paramType": "body"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 400,
+                            "message": "Invalid ID supplied"
+                        },
+                        {
+                            "code": 404,
+                            "message": "Pet not found"
+                        },
+                        {
+                            "code": 405,
+                            "message": "Validation exception"
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "/pet/findByStatus",
+            "operations": [
+                {
+                    "method": "GET",
+                    "summary": "Finds Pets by status",
+                    "notes": "<strong>Multiple status values can be provided with comma seperated strings</strong>",
+                    "type": "array",
+                    "items": {
+                        "$ref": "Pet"
+                    },
+                    "nickname": "testNodeType",
+                    "authorizations": {},
+                    "parameters": [
+                        {
+                            "name": "nodeTypez",
+                            "description": "Status values that need to be considered for filter",
+                            "defaultValue": "available",
+                            "required": true,
+                            "type": "string",
+                            "paramType": "query",
+                            "enum": [
+                                "available",
+                                "pending",
+                                "sold"
+                            ]
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 400,
+                            "message": "Invalid status value"
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "/pet/findByTags",
+            "operations": [
+                {
+                    "method": "GET",
+                    "summary": "Finds Pets by tags",
+                    "notes": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
+                    "type": "array",
+                    "items": {
+                        "$ref": "Pet"
+                    },
+                    "nickname": "findPetsByTags",
+                    "authorizations": {},
+                    "parameters": [
+                        {
+                            "name": "tags",
+                            "description": "Tags to filter by",
+                            "required": true,
+                            "type": "string",
+                            "paramType": "query"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 400,
+                            "message": "Invalid tag value"
+                        }
+                    ],
+                    "deprecated": "true"
+                }
+            ]
+        },
+        {
+            "path": "/pet/{petId}",
+            "operations": [
+                {
+                    "method": "PATCH",
+                    "summary": "partial updates to a pet",
+                    "notes": "",
+                    "type": "array",
+                    "items": {
+                        "$ref": "Pet"
+                    },
+                    "nickname": "partialUpdate",
+                    "produces": [
+                        "application/json",
+                        "application/xml"
+                    ],
+                    "consumes": [
+                        "application/json",
+                        "application/xml"
+                    ],
+                    "authorizations": {
+                        "oauth2": [
+                            {
+                                "scope": "write:pets",
+                                "description": "modify pets in your account"
+                            }
+                        ]
+                    },
+                    "parameters": [
+                        {
+                            "name": "petId",
+                            "description": "ID of pet that needs to be fetched",
+                            "required": true,
+                            "type": "string",
+                            "paramType": "path"
+                        },
+                        {
+                            "name": "body",
+                            "description": "Pet object that needs to be added to the store",
+                            "required": true,
+                            "type": "Pet",
+                            "paramType": "body"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 400,
+                            "message": "Invalid tag value"
+                        }
+                    ]
+                },
+                {
+                    "method": "POST",
+                    "summary": "Updates a pet in the store with form data",
+                    "notes": "",
+                    "type": "void",
+                    "nickname": "updatePetWithForm",
+                    "consumes": [
+                        "application/x-www-form-urlencoded"
+                    ],
+                    "authorizations": {
+                        "oauth2": [
+                            {
+                                "scope": "write:pets",
+                                "description": "modify pets in your account"
+                            }
+                        ]
+                    },
+                    "parameters": [
+                        {
+                            "name": "petId",
+                            "description": "ID of pet that needs to be updated",
+                            "required": true,
+                            "type": "string",
+                            "paramType": "path"
+                        },
+                        {
+                            "name": "name",
+                            "description": "Updated name of the pet",
+                            "required": false,
+                            "type": "string",
+                            "paramType": "form"
+                        },
+                        {
+                            "name": "status",
+                            "description": "Updated status of the pet",
+                            "required": false,
+                            "type": "string",
+                            "paramType": "form"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 405,
+                            "message": "Invalid input"
+                        }
+                    ]
+                },
+                {
+                    "method": "DELETE",
+                    "summary": "Deletes a pet",
+                    "notes": "",
+                    "type": "void",
+                    "nickname": "deletePet",
+                    "authorizations": {
+                        "oauth2": [
+                            {
+                                "scope": "write:pets",
+                                "description": "modify pets in your account"
+                            }
+                        ]
+                    },
+                    "parameters": [
+                        {
+                            "name": "petId",
+                            "description": "Pet id to delete",
+                            "required": true,
+                            "type": "string",
+                            "paramType": "path"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 400,
+                            "message": "Invalid pet value"
+                        }
+                    ]
+                },
+                {
+                    "method": "GET",
+                    "summary": "Find pet by ID",
+                    "notes": "Returns a pet based on ID",
+                    "type": "Pet",
+                    "nickname": "getPetById",
+                    "authorizations": {},
+                    "parameters": [
+                        {
+                            "name": "petId",
+                            "description": "ID of pet that needs to be fetched",
+                            "required": true,
+                            "type": "integer",
+                            "format": "int64",
+                            "paramType": "path",
+                            "minimum": "1.0",
+                            "maximum": "100000.0"
+                        }
+                    ],
+                    "responseMessages": [
+                        {
+                            "code": 400,
+                            "message": "Invalid ID supplied"
+                        },
+                        {
+                            "code": 404,
+                            "message": "Pet not found"
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "/pet/uploadImage",
+            "operations": [
+                {
+                    "method": "POST",
+                    "summary": "uploads an image",
+                    "notes": "",
+                    "type": "void",
+                    "nickname": "uploadFile",
+                    "consumes": [
+                        "multipart/form-data"
+                    ],
+                    "authorizations": {
+                        "oauth2": [
+                            {
+                                "scope": "write:pets",
+                                "description": "modify pets in your account"
+                            },
+                            {
+                                "scope": "read:pets",
+                                "description": "read your pets"
+                            }
+                        ]
+                    },
+                    "parameters": [
+                        {
+                            "name": "additionalMetadata",
+                            "description": "Additional data to pass to server",
+                            "required": false,
+                            "type": "string",
+                            "paramType": "form"
+                        },
+                        {
+                            "name": "file",
+                            "description": "file to upload",
+                            "required": false,
+                            "type": "File",
+                            "paramType": "body"
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "models": {
+        "Tag": {
+            "id": "Tag",
+            "properties": {
+                "id": {
+                    "type": "integer",
+                    "format": "int64"
+                },
+                "name": {
+                    "type": "string"
+                }
+            }
+        },
+        "Pet": {
+            "id": "Pet",
+            "required": [
+                "id",
+                "name"
+            ],
+            "properties": {
+                "id": {
+                    "type": "integer",
+                    "format": "int64",
+                    "description": "unique identifier for the pet",
+                    "minimum": "0.0",
+                    "maximum": "100.0"
+                },
+                "category": {
+                    "$ref": "Category"
+                },
+                "name": {
+                    "type": "string"
+                },
+                "photoUrls": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "tags": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "Tag"
+                    }
+                },
+                "status": {
+                    "type": "string",
+                    "description": "pet status in the store",
+                    "enum": [
+                        "available",
+                        "pending",
+                        "sold"
+                    ]
+                }
+            }
+        },
+        "Category": {
+            "id": "Category",
+            "properties": {
+                "id": {
+                    "type": "integer",
+                    "format": "int64"
+                },
+                "name": {
+                    "type": "string"
+                },
+                "pet": {
+                    "$ref": "Pet"
+                }
+            }
+        }
+    }
+}