Kong / insomnia

The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
https://insomnia.rest
Apache License 2.0
34.49k stars 1.95k forks source link

[Bug] openapi-2-kong ignoring verbose_response property of request validation plugin when generating config #2867

Closed GigaPrimatus closed 3 years ago

GigaPrimatus commented 3 years ago

Describe the bug It appears that inso / openapi-2-kong is ignoring verbose_response property of request validation plugin when generating config for Kong.

To Reproduce

$ inso generate config spec.yaml --output generated.yaml

Expected behavior

As verbose_response property of request validation plugin is included in the OAS, it should appear in the generated Kong YAML.

Desktop (please complete the following information):

Additional context Please see the attachment for OAS, expected and actual outputs.

00019330.zip

Tieske commented 3 years ago

Essentially if the plugin is specified, but the actual “config” entry is not given, only then it will generate the configuration from the OAS spec (as per the docs). So in this case the “config” is not missing because they added that flag, so the generator passes it as is. And then a number of fields are missing that the plugin actually requires, so the plugin throws a schema error when you try and upload the Kong-specs.

So long story short; works as advertised.

That said, the request is fair, that if the flag is specified, that we actually take it along in the generated config.

Tieske commented 3 years ago

scrap that ^^^^

code is here: https://github.com/Kong/insomnia/blob/27320ad04a6a711e575b4b4b4470c4a9b9d315fe/packages/openapi-2-kong/src/declarative-config/plugins.js#L37-L40

it just creates a new config table, without taking in any of the existing properties.

It should take in config.verbose_response if given, possibly also config.allowed_content_types.