ruby-grape / grape-swagger

Add OAPI/swagger v2.0 compliant documentation to your grape API
MIT License
1.09k stars 471 forks source link

param_type body 1xN relation not work #294

Open TangMonk opened 9 years ago

TangMonk commented 9 years ago

Please look following code (change from lib/example):

require 'grape'
require 'grape-entity'
require '../lib/grape-swagger'

module Entities
  module Some
    class Thing < Grape::Entity
      expose :text, documentation: { type: 'string', desc: 'Content of something.' }
      expose :name, documentation: { type: String, desc: 'Name of something.' }
    end
 end
end

class Api < Grape::API
  format :json
  add_swagger_documentation models: [Entities::Some::Thing]
end

I expect request /swagger_doc/thing.json, will return some useful information.But actually is return me Not Found.

I try to tun rspec with grape-swagger/spec/api_global_models_spec.rb, test passed. But I do not know why above code not works.

I search the issues, the feature created by @chebyte

dblock commented 9 years ago

Models are documented along with APIs. This API has no endpoints, I think this is by design, you need a get :thing to get swagger_doc/thing.