kubeshop / kusk-gen

Kusk Gen generates Ingress-controller configurations from your OpenAPI definition
https://kubeshop.github.io/kusk-gen
MIT License
173 stars 12 forks source link

Option/property to hide all operations by default #148

Closed olensmar closed 3 years ago

olensmar commented 3 years ago

Describe the enhancement you'd like to see I'd like to be able to hide all operations by default and only expose those that I want by specifying x-kust.enabled=true at the path or operation level. In this way I'm sure that any new operations I add to my OpenAPI definitions aren't exposed before they're ready

Scenarios

kylehodgetts commented 3 years ago

Ole and I discussed this briefly on a call and wanted to open a discussion to nail down how this should actually behave. Below I've compiled a small example that we can use as the basis for this discussion based on the different possible scenarios

---
# Global options defined but no path or operation has enabled/disabled option set 
openapi: 3.0.1
x-kusk:
  SOME_OPTIONS
paths:
  /:  
    get: {}
    post: {}
---
# Path has enabled = true but no enabled specified at operation level
openapi: 3.0.1
x-kusk:
  SOME_OPTIONS
paths:
  /:
    x-kusk:
      enabled: true
    get: {}
    post: {}
---
# Path has no enabled specified but some of the operations do
openapi: 3.0.1
x-kusk:
  SOME_OPTIONS
paths:
  /:
    get:
      x-kusk:
        enabled: true
    post: {}

# Question: Is an unspecified enabled option to be treated as an explicit enabled = false

We need to discuss what should happen in each of the scenarios above