kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.53k stars 8.25k forks source link

OpenAPI 2/3 Validation using swagger/openapi json/yaml in ConfigMap with Ingress Attribute? #4590

Closed slecrenski closed 4 years ago

slecrenski commented 5 years ago

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.): No

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.): openapi


Is this a BUG REPORT or FEATURE REQUEST? (choose one): FEATURE REQUEST

NGINX Ingress controller version: Any

Kubernetes version (use kubectl version): 1.13

Environment:

What happened: I'm curious how I might get started in potentially helping to develop a nginx attribute which can be used for automatic api request validation using an Open API 2.0/3.0 document.

What you expected to happen: It could be interesting if I were to say create a configmap which contained a yaml file describing the OpenAPI 2.0/3.0 specification for an api. Then the ingress would contain an attribute describing the routable location of the yaml document. If an attribute is on the ingress describing the location ...something would configure nginx plugin/module (would I need to write this?) to perform the input/output validation using the schema.

How to reproduce it (as minimally and precisely as possible): N/A

Anything else we need to know: I'm interested in helping if this doesn't exist and is potentially worthwhile. I spent a day or so reviewing all potential solutions to this problem and have not come upon an elegant one as of yet. I prefer the entire interface to be defined in a single document and not forward engineered into a single document from code anyways.

Great Job on this project by the way. I am a huge fan of the ingress-nginx and have not even looked into istio as a replacement.

aledbf commented 5 years ago

@slecrenski maybe this could be implemented as a plugin (not yet available). Please check https://github.com/kubernetes/ingress-nginx/pull/3967

ElvinEfendi commented 4 years ago

@slecrenski in https://www.elvinefendi.com/2019/11/22/ingress-nginx-openidc-plugin.html I describe how one can use ingress-nginx's plugin system to extend its features. Maybe that can be useful for what you want to do.

aledbf commented 4 years ago

Closing. Please follow the plugin approach mentioned in the previous comment.

slecrenski commented 4 years ago

I have been thinking about this quite a bit lately and I'm not convinced OpenAPI 2/3, RAML or even GraphQL is the right protocol for solving the age old interface problem. Actually I'm not even sure anyone has formally defined the interface problem but since software development has been ongoing since at least the early 1950s i'm sure it is around somewhere. I know this doesn't directly apply to this issue but I'm going to design my own interface exchange language or some other means to solve this rather annoying interface problem. I feel versioning just isn't an elegant approach. I want something better than yah.. you have to update your code to use the new interface version... Some intelligent language for depicting what concepts the api supports and how to communicate with it. I dunno..