-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:icyleaf/swagger
Showing
47 changed files
with
219 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,23 +11,23 @@ builder = Swagger::Builder.new( | |
) | ||
|
||
builder.add(Swagger::Object.new("User", "object", [ | ||
Swagger::Property.new("id", "integer", "int32", example: 1), | ||
Swagger::Property.new("nickname", example: "icyleaf wang"), | ||
Swagger::Property.new("username", example: "icyleaf"), | ||
Swagger::Property.new("email", example: "[email protected]"), | ||
Swagger::Property.new("bio", "Personal bio"), | ||
Swagger::Property.new("id", "integer", "int32", example: 1), | ||
Swagger::Property.new("nickname", example: "icyleaf wang"), | ||
Swagger::Property.new("username", example: "icyleaf"), | ||
Swagger::Property.new("email", example: "[email protected]"), | ||
Swagger::Property.new("bio", "Personal bio"), | ||
])) | ||
|
||
builder.add(Swagger::Controller.new("Users", "User Resources", [ | ||
Swagger::Action.new("get", "/users", "List users", parameters: [ | ||
Swagger::Action.new("get", "/users", [Swagger::Response.new("200", "Success response")], "List users", parameters: [ | ||
Swagger::Parameter.new("page", "query", "integer", "Current page", default_value: 1, format: "int32"), | ||
Swagger::Parameter.new("limit", "query", "integer", "How many items to return at one time (max 100)", default_value: 50, format: "int32"), | ||
]), | ||
Swagger::Action.new("get", "/users/{id}", "Get user by id", parameters: [Swagger::Parameter.new("id", "path")], responses: [ | ||
Swagger::Action.new("get", "/users/{id}", description: "Get user by id", parameters: [Swagger::Parameter.new("id", "path")], responses: [ | ||
Swagger::Response.new("200", "Success response"), | ||
Swagger::Response.new("404", "Not found user") | ||
Swagger::Response.new("404", "Not found user"), | ||
], request: Swagger::Request.new("User")), | ||
Swagger::Action.new("post", "/users", "Create user", | ||
Swagger::Action.new("post", "/users", description: "Create user", | ||
request: Swagger::Request.new([ | ||
Swagger::Property.new("username", required: true, description: "The name of user"), | ||
Swagger::Property.new("email", "string", required: true, description: "Email"), | ||
|
@@ -37,13 +37,13 @@ builder.add(Swagger::Controller.new("Users", "User Resources", [ | |
], "Form data", "application/x-www-form-urlencoded"), | ||
responses: [ | ||
Swagger::Response.new("200", "Success response", "User"), | ||
Swagger::Response.new("404", "Not found user") | ||
Swagger::Response.new("404", "Not found user"), | ||
] | ||
), | ||
Swagger::Action.new("get", "/user/{id}", "Get user by id", parameters: [Swagger::Parameter.new("id", "path")], responses: [ | ||
Swagger::Action.new("get", "/user/{id}", description: "Get user by id", parameters: [Swagger::Parameter.new("id", "path")], responses: [ | ||
Swagger::Response.new("200", "Success response"), | ||
Swagger::Response.new("404", "Not found user") | ||
], deprecated: true) | ||
Swagger::Response.new("404", "Not found user"), | ||
], deprecated: true), | ||
])) | ||
|
||
builder.add(Swagger::Server.new("http://swagger.dev:{port}/{version}/api", "Development", [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: swagger | ||
version: 0.1.1 | ||
version: 0.2.0 | ||
|
||
authors: | ||
- icyleaf <[email protected]> | ||
|
||
crystal: 0.32.0 | ||
crystal: 0.33.0 | ||
|
||
license: MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require "spec" | ||
require "../../src/swagger/response" | ||
|
||
OK_RESPONSE = [Swagger::Response.new "200", "OK"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.