ArgumentError: missing keywords: json, options
yigitozkavci opened this issue · 1 comments
yigitozkavci commented
I am getting an error everytime I try to create service:
Failure/Error: service = Svelte::Service.create(url: "http://localhost:10000/api/v1/swagger_doc.json", module_name: 'PDFConverter')
ArgumentError:
missing keywords: json, options
Versions:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
svelte (0.1.2)
rails (4.2.4)
And I solved it by applying default values to arguments Svelte::Service.create()
like this:
def create(url:, json: "", module_name:, options: Hash.new)
json = get_json(url: url) if url
SwaggerBuilder.new(raw_hash: JSON.parse(json.to_s),
module_name: module_name,
options: options).make_resource
end
If you can confirm it as a bug, I can send a pull request.
brafales commented
Hi @yigitozkavci, feel free to send a PR and we will update the gem.
As for the arguments, I'd suggest you make url and json nil
and options just {}
. We could use some validation, i.e. throw a proper exception if neither url
or json
are passed.
Many thanks!