Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller docs not being generated #151

Open
PAMulligan opened this issue Sep 28, 2016 · 2 comments
Open

Controller docs not being generated #151

PAMulligan opened this issue Sep 28, 2016 · 2 comments

Comments

@PAMulligan
Copy link

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.

@PAMulligan
Copy link
Author

Is this product still supported?

@toshitapandey
Copy link

@PAMulligan Try running SD_LOG_LEVEL=1 rake swagger:docs, you'll get the reason of same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants