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

"host field in JSON is invalid" when host field is missing. #30

Open
philipcristiano opened this issue May 22, 2020 · 0 comments
Open

Comments

@philipcristiano
Copy link

philipcristiano commented May 22, 2020

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.

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

1 participant