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

Extract parameters' types from example values for api_blue_print format #475

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

khiav223577
Copy link

@khiav223577 khiav223577 commented Apr 21, 2020

Most of the type you don't need to provide this option manually. We extract types from values automatically.

- `type: [:file, :array, :object, :boolean, :integer, :number, :string]`. Will set a type for the parameter. Most of the type you don't need to provide this option manually. We extract types from values automatically.

The README says it will try to extract types from values automatically, but it doesn't seem to work with api_blue_print format. It seems to work for open_api format.

def extract_type(value)
case value
when Rack::Test::UploadedFile then :file
when Array then :array
when Hash then :object
when TrueClass, FalseClass then :boolean
when Integer then :integer
when Float then :number
else :string
end
end

This PR add this feature for api_blue_print format.

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

Successfully merging this pull request may close these issues.

None yet

1 participant