Coder Social home page Coder Social logo

jbretsch / openapi-route-definition-locator Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 5.0 607 KB

A RouteDefinitionLocator for Spring Cloud Gateway which creates route definitions dynamically based on OpenAPI (aka Swagger) definitions served by backend (micro)services.

License: MIT License

Java 53.11% Groovy 46.89%
api-gateway java microservices openapi spring spring-boot spring-cloud spring-cloud-gateway swagger

openapi-route-definition-locator's People

Contributors

jbretsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

openapi-route-definition-locator's Issues

UI for browsing registered OpenAPI definitions

Provide a UI to browse all OpenAPI definitions retrieved by the OpenAPI Route Definition Locator.

https://piotrminkowski.com/2020/02/20/microservices-api-documentation-with-springdoc-openapi/ demonstrates how this can be achieved with the grouping mechanism of springdoc-openapi when backend services are discovered via Eureka. This can probably be adjusted to the service "discovery" of the OpenAPI Route Definition Locator via the service list in the application.yml file.

The x-gateway-route-settings in the OpenAPI definitions expose information which people may like to keep private. Those settings should be removed from the rendered OpenAPI definitions. Perhaps a generic configuration setting to exclude user-defined aspects from the OpenAPI definitions would be nice, like a list of JSONPath expressions that should be excluded. And per default this list excludes the x-gateway-route-settings.

People may already have some UI set up in their API Gateways for browsing OpenAPI definitions. They may only want to get access to the OpenAPI definitions retrieved by the OpenAPI Route Definitions Locator (with sensitive information removed). So, there should be an easy way to get these OpenAPI definitions without getting a new UI.

Read attributes for route definitions from even more places

Attributes for the routes definitions created by the OpenAPI Route Definition Locator can already be set at various places:

  1. Globally within each OpenAPI definition.
  2. For each operation within an OpenAPI definition.
  3. Via OpenApiRouteDefinitionCustomizer beans.
  4. Via Spring Cloud Gateway default-filters.

But people may like to configure those attributes also

  1. For each service within the openapi-route-definition-locator object, i.e.
    openapi-route-definition-locator:
      services:
        - id: service1
          uri: http://service1:8080
          # Here.
  2. Globally for all routes created by the OpenAPI Route Definition Locator but no other registered RouteDefinitionLocator.
    openapi-route-definition-locator:
      # Here.
      services:
        - id: service1
          uri: http://service1:8080

Allow pull requests

Hi,

Can we suggest new additionnals fonctionnalities by submitting Pull Requests ? Any convention should be respected ?

I would like to add new capabilities like:

  • Support service discovery with the provided service id only (without supply a URI).
  • Allow to create a gateway OpenAPI auto generated by the merge of all microservice routes.

Thanks

Unable to build gradle project

Hi,

Thanks for this project :)

I'm trying to install it but I'm running to the following issue when I add the dependency to my gradle projet:

Problems reading data from Binary store in [...path]\.gradle\.tmp\gradle18085399495289804999.bin offset 87035 exists? true
Problems loading the resolution results (0.001 secs). Read 451 values, last was: 5
Corrupt serialized resolution result. Cannot find selected component (4811) for runtime -> com.netflix.archaius:archaius-core:0.3.3

Corresponding file:

plugins {
	id 'org.springframework.boot' version '3.2.3'
	id 'io.spring.dependency-management' version '1.1.4'
}

java {
	sourceCompatibility = '17'
}

repositories {
	mavenCentral()
}

ext {
	set('springCloudVersion', "2023.0.0")
	set('openApiRouteDefLocatorVersion', "0.6.7-sc-2023.0")
}

dependencies {

	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'

	/* Spring gateway */
	implementation 'org.springframework.cloud:spring-cloud-starter-gateway'

	/* Eureka client dependencies */
	implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
	implementation 'com.netflix.eureka:eureka-client-jersey3'

       /* Open API Documentaiton */
	implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.4.0'
	implementation 'net.bretti.openapi-route-definition-locator:openapi-route-definition-locator-spring-cloud-starter'

}

dependencyManagement {
	imports {
		mavenBom "net.bretti.openapi-route-definition-locator:openapi-route-definition-locator-bom:${openApiRouteDefLocatorVersion}"
		mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
	}
}

Have you any idea why this issue occurs ? :)

Thanks !

Compatibility with Spring Boot 3.0.x and Spring Cloud 2022.0.x

Issue

The last released version (v0.6.1) is compatible with Spring Boot 2.7.x and Spring Cloud 2021.0.x but not Spring Boot 3.0.x and Spring Cloud 2022.0.x.

Desired resolution

  1. Release a version which is compatible with Spring Boot 3.0.x and Spring Cloud 2022.0.x.
  2. Create a versioning scheme to support both Spring Boot 2.7.x / Spring Cloud 2021.0.x and Spring Boot 3.0.x / Spring Cloud 2022.0.x.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.