Last active
August 1, 2019 23:27
-
-
Save hpjaj/2d0d332d39e77aed6bdb993268d01078 to your computer and use it in GitHub Desktop.
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
# vets-api/app/swagger/requests/profile.rb | |
module Swagger | |
module Requests | |
class Profile | |
include Swagger::Blocks | |
swagger_path '/v0/profile/email' do | |
operation :get do | |
extend Swagger::Responses::AuthenticationError | |
key :description, 'Gets a users email address information' | |
key :operationId, 'getEmailAddress' | |
key :tags, %w[ | |
profile | |
] | |
parameter :authorization | |
response 200 do | |
key :description, 'Response is OK' | |
schema do | |
key :'$ref', :Email | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
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
# vets-api/app/swagger/schemas/email.rb | |
module Swagger | |
module Schemas | |
class Email | |
include Swagger::Blocks | |
swagger_schema :Email do | |
key :required, [:data] | |
property :data, type: :object do | |
key :required, [:attributes] | |
property :attributes, type: :object do | |
property :email, type: :string, example: 'john@example.com' | |
property :effective_at, type: :string, example: '2018-02-27T14:41:32.283Z' | |
end | |
end | |
end | |
end | |
end | |
end |
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
# vets-api/app/controllers/v0/apidocs_controller.rb | |
... | |
# A list of all classes that have swagger_* declarations. | |
SWAGGERED_CLASSES = [ | |
... | |
Swagger::Requests::Profile, | |
Swagger::Schemas::Email, | |
... | |
].freeze | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment