Slide 25
Slide 25 text
1SPUPDPM#V⒎FSTʹΑΔ3&45"1*ཧ
w QSPUPDHFOTXBHHFS
w εΩʔϚఆٛʹै͍ɺTXBHHFS 0QFO"1*
ͷ+40/Λग़ྗ͢Δπʔϧ
w ಉҰͷఆ͔ٛΒ3&45"1*ཧɺ4XBHHFS$PEFHFOʹΑΔίʔυੜͱ࿈ܞ
// Service for handling books.
service BookService {
// Get book
rpc GetBook (GetBookRequest) returns (Book) {
option (google.api.http) = {
get: "/books/{id}"
};
};
}
// Request for get book
message GetBookRequest {
string id = 1;
}
// Book data
message Book {
string id = 1;
string name = 2;
}
{
"swagger": "2.0",
"info": {…},
"schemes": […],
"consumes": […],
"produces": […],
"paths": {
"/books/{id}": {
"get": {
"summary": "Get book",
"operationId": "GetBook",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": “#/definitions/exampleBook"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": […]
}
}
},
"definitions": {
"exampleCreateBookRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"title": "Request for get book"
},
“exampleBook": {…}
}
}
}