Dynamic OpenAPIs with Spring Cloud Gateway by Iván López @ Spring I/O 2023

preview_player
Показать описание
Spring I/O 2023 - Barcelona, 18-19 May

Imagine this scenario. You follow an OpenAPI-first approach when designing your services. You have a distributed architecture with multiple services and all of them expose a RESTful API and have their OpenAPI Specification. Now you use Spring Cloud Gateway in front of them so you can route the requests to the appropriate service and apply cross-cutting concerns. But, what happens with the OpenAPI of every service? It would be great if you could generate a unique OpenAPI for the whole system in the Gateway. You could also expose and transform only selected endpoints when defining them as public. And what about the routes? You would like to reconfigure them dynamically and on-the-fly in the Gateway when there is a change in a service, right?

Stop imagining. In this talk, I will show you how we have done that in our product and how we are leveraging the programmatic Spring Cloud Gateway API to reconfigure the routes on the fly. You will also see it in action during the demo!
Рекомендации по теме
Комментарии
Автор

Could you share an example of your code snippet, because it's always more interesting to experiment with your solution yourself?

xhuwins
Автор

Good presentation.

AWS Gateway can be setup with OpenAPI documentation and I always wanted to have this with Spring apps too. This presentation is not that I was looking for, but this is another good approach.

Writing the OpenAPI YAML can be really controversial, but for API first developments I think this is the way.

Congrats. 🎉

nandorholozsnyak
Автор

I did not understand how the openApi spec was combined and created on gateway side, i understood that the routes are configured on the fly. Could someone answer my question?

MrVitalirapalis
Автор

How about scalling the scg? There's not much content on this in the web, but it is necessary in real world.

giulianabezerra
Автор

Swagger codegen is not an argument for OpenAPI. It is an absolutely horrible piece of software that only supports a subset of OpenAPI even though it is the official codegen. Bugs open for years and lousy compatibility between versions and languages.

andynn