"`host` field in JSON is invalid" when host field is missing.
Opened this issue · 0 comments
philipcristiano commented
When loading a Swagger 2.0 spec without a host
field Svelte raises the error 'host' field in JSON is invalid (Svelte::JSONError)
.
The Swagger spec does not list this field as required and specifically If the host is not included, the host serving the documentation is to be used (including the port).
Leading to a full trace of
Traceback (most recent call last):
5: from example.rb:2:in `<main>'
4: from /nix/store/1kvsc2mpg8pck3bpbn0d2i7z1nwvw0w2-ruby-env/lib/ruby/gems/2.7.0/gems/svelte-0.3.0/lib/svelte/service.rb:30:in `create'
3: from /nix/store/1kvsc2mpg8pck3bpbn0d2i7z1nwvw0w2-ruby-env/lib/ruby/gems/2.7.0/gems/svelte-0.3.0/lib/svelte/service.rb:30:in `new'
2: from /nix/store/1kvsc2mpg8pck3bpbn0d2i7z1nwvw0w2-ruby-env/lib/ruby/gems/2.7.0/gems/svelte-0.3.0/lib/svelte/swagger_builder.rb:19:in `initialize'
1: from /nix/store/1kvsc2mpg8pck3bpbn0d2i7z1nwvw0w2-ruby-env/lib/ruby/gems/2.7.0/gems/svelte-0.3.0/lib/svelte/swagger_builder.rb:71:in `validate'
/nix/store/1kvsc2mpg8pck3bpbn0d2i7z1nwvw0w2-ruby-env/lib/ruby/gems/2.7.0/gems/svelte-0.3.0/lib/svelte/swagger_builder.rb:87:in `validate_host': `host` field in JSON is invalid (Svelte::JSONError)
The spec is from a packaged application that is hard to change / set correctly in the configuration for what the host is. It would be wonderful if Svelte could set this instead of having user logic to pass in the host as an option separately.