Kong / docs.konghq.com

🦍 Source code for docs.konghq.com website.
https://docs.konghq.com
MIT License
195 stars 591 forks source link

Correct the Kubernetes example for Response Transformer Kong plugin #4512

Open saravanan-periyasamy03 opened 1 year ago

saravanan-periyasamy03 commented 1 year ago

Where is the problem?

https://docs.konghq.com/hub/kong-inc/response-transformer

What happened?

The Example plugin configuration given for Kubernetes in Response Transformer plugin under service, route, consumer and global is partially incorrect.

Docs link - https://docs.konghq.com/hub/kong-inc/response-transformer

Parameters like config.remove and config.add shouldn't repeat multiple times to host headers, json and json_types as child elements.

Current Example:

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: response-transformer-example
config: 
  remove:
    headers:
    - x-toremove
    - x-another-one
  remove:
    json:
    - json-key-toremove
    - another-json-key
  add:
    headers:
    - x-new-header:value
    - x-another-header:something
  add:
    json:
    - new-json-key:some_value
    - another-json-key:some_value
  add:
    json_types:
    - new-json-key:string
    - another-json-key:boolean
    - another-json-key:number
  append:
    headers:
    - x-existing-header:some_value
    - x-another-header:some_value
plugin: response-transformer

Expected Example:

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: response-transformer-example
config: 
  remove:
    headers:
    - x-toremove
    - x-another-one
    json:
    - json-key-toremove
    - another-json-key
  add:
    headers:
    - x-new-header:value
    - x-another-header:something
    json:
    - new-json-key:some_value
    - another-json-key:some_value
    json_types:
    - new-json-key:string
    - another-json-key:boolean
    - another-json-key:number
  append:
    headers:
    - x-existing-header:some_value
    - x-another-header:some_value
plugin: response-transformer

Please let me know where can I update this change. I am not able to find it as these are picked from value_in_examples field under config.

What did you expect to happen?

The Kubernetes example for service, route, consumer and global needs to be corrected for this plugin.

Code of Conduct and Community Expectations

Guaris commented 1 year ago

Hey, the ability to do this was added in this PR https://github.com/Kong/docs.konghq.com/pull/4493/files

I can provide an example of what the syntax would look like tomorrow if you still want to tackle this task.