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

Support overriding keys inline #135

Open
Evilbits opened this issue Apr 23, 2020 · 1 comment
Open

Support overriding keys inline #135

Evilbits opened this issue Apr 23, 2020 · 1 comment

Comments

@Evilbits
Copy link

In order to clean up my documentation I have used parameter referencing as much as possible.
However it seems that there's no easy way of overriding attributes that are set in the parameter when it's defined.

An example is that I create the following id parameter and reference it throughout my documentation - but I would like to be more specific in the description.
This however seems to go for all keys and not just description.

# Swagger definition
swagger_root do
  # ...
  parameter :id do
    key :in, :path
    key :name, :id
    key :description, 'ID of resource to fetch.'
    key :required, true
    key :type, :integer
  end
  # ...
end

# In controller
swagger_path '/cats/{id}' do
  operation :get do
    # ...
    parameter :id do
      key :description, 'ID of Cat record to fetch'
    end
  end
end

Is there any way to achieve the desired effect?

@ptarud
Copy link

ptarud commented Jun 5, 2020

Same issue here

  # I want to reference this schema in Country, but the id in Country schema is not shown
  swagger_schema :CountryBase do
      property :type do
        key :type, :string
      end
      property :attributes do
        property :code do
          key :type, :string
        end
        property :name do
          key :type, :string
        end
        property :phone do
          key :type, :string
        end
        property :deleted do
          key :type, :boolean
        end
      end
    end

  # Country does not show id
    swagger_schema :Country do
      property :id do
        key :type, :integer
        key :format, :int64
      end
      key :'$ref', :CountryBase
    end

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