You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Rails 4.2, and attempting to implement swagger-docs into my api. When I run rake swagger:docs, I get the application docs but none of the controller ones. Here's my controller:
class Api::V2::UsersController < ApplicationController
before_action :authenticate_with_token!, only: [:update]
respond_to :json
swagger_controller :users, "User Management"
swagger_api :create do
summary "Creates a new User"
param :form, :email, :string, :required, "Email address"
param :form, :password, :string, :required, "Password"
param :form, :password_confirmation, :string, :required, "Password confirmation"
response :created
response :unprocessable_entity
end
swagger_api :update do
summary "Updates an existing User"
param :path, :id, :integer, :required, "User Id"
param :form, :email, :string, :optional, "Email address"
param :form, :password, :string, :optional, "Password"
param :form, :password_confirmation, :string, :optional, "Password confirmation"
response :ok, "Success", :User
response :unauthorized
response :not_found
response :unprocessable_entity
end
def create
user = User.new(user_params)
if user.save
render json: user, status: 201, location: [:api, user]
else
render json: { errors: user.errors }, status: 422
end
end
def update
user = current_user
if user.update(user_params)
render json: user, status: 200, location: [:api, user]
else
render json: { errors: user.errors }, status: 422
end
end
private
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
end
We will also be using Azure's API management option, which allows you to point to a url to download a Swagger file, but I don't know where that would be or what the routing would look like.
The text was updated successfully, but these errors were encountered:
I'm using Rails 4.2, and attempting to implement swagger-docs into my api. When I run rake swagger:docs, I get the application docs but none of the controller ones. Here's my controller:
We will also be using Azure's API management option, which allows you to point to a url to download a Swagger file, but I don't know where that would be or what the routing would look like.
The text was updated successfully, but these errors were encountered: