ruby-grape / ruby-grape/grape-swagger

param_type body 1xN relation not work

Open
#294 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question swagger-1.2
Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example from lib/example and requesting /swagger_doc/thing.json. Compare its setup with grape-swagger/spec/api_global_models_spec.rb, which currently passes, to locate why the global model is not exposed. Done means the example endpoint returns useful Swagger information instead of Not Found.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.