Code Monkey home page Code Monkey logo

springdoc.github.io's Issues

Clarify compatibility matrix

As I read it was ambigious to me what you mean with the versions you mention. Are the mentioned Spring Boot versions the minimal required version or did you only test the mentioned springdoc version against the mentioned spring Boot version.
For example, is Spring 2.6.x the minimal requirement for springdoc 1.6.x? ...or is it possible to use it with 2.5.x as well (but you didn't test it)?

favicon same a Spring project.

I have noticed that your favicon is the same as Spring project. I would suggest you use the nice icon you are using on the documentation page.

@ParameterObject: there are no parameters if there are no get methods in the model.

Version: org.springdoc:springdoc-openapi-ui:1.6.6

There are no parameters in swagger

  • If ParameterObject without get methods
    image
  • If ParameterObject has a fluent chain get methods (without get prefix)
    image

The only working option. If there is a getter and only prefixed with 'get'.

image

The problem lies in the fact that the DelegatingMethodParameter.customize() method calls inside MethodParameterPojoExtractor.extractFrom(paramClass) which operates on methods, but in fact it would be worth working directly with annotated fields.

Secondly, POJO, unlike JavaBean, does not require getters and setters. I can work with POJO fields directly if they are declared as public/package-privat/protected.

But the main problem is that this behavior is not documented ANYWHERE. Wasted a lot of time on trivia.
Add at least information about this nuance to https://springdoc.org/faq.html

image

Travis CI build is broken

$ script/bootstrap
/home/travis/.travis/functions: line 109: script/bootstrap: Permission denied
The command "script/bootstrap" failed and exited with 126 during .

.travis.yml is missing the bash command before the scripts it's trying to invoke.

Remove code duplication with AsciiDoc's Include Directive

As can be seen here, the documentation is duplicated across src/docs/asciidoc and src/docs/asciidoc/v1, which is not only a burden to maintain, but also runs a high risk of them going out of sync, as shown here.

The solution is to create folder src/docs/asciidoc/common and use AsciiDoc's include directive:

An include directive imports content from a separate file or URL into the content of the current document. When the current document is processed, the include directive syntax is replaced by the contents of the include file. Think of the include directive like a file expander. [Source]

/docs
├── common
├── v1
└── v2

Misleading docs - web UI url's

Describe the bug

The docs here explicitly direct user to expect the web UI under the endpoints http://server:port/context-path/swagger-ui.html and http://server:port/context-path/v3/api-docs and as such to configure Spring security against those url's.

In reality, though, the following security config works:

				.and().authorizeRequests().antMatchers("/api-docs/**").permitAll()
				.and().authorizeRequests().antMatchers("/swagger-ui.html").permitAll()
				.and().authorizeRequests().antMatchers("/swagger-ui/**").permitAll()

Note the lack of 'v3' before api-docs.

Additionally, swagger-ui.html is redundant as it's simply redirecting to swagger-ui/index.html. It will not work unless user allows the swagger-ui/** path and swagger-ui/index.html will work already with just that path without the separate rule for swagger-ui.html.

I expect that most real-life spring projects use spring security so omitting this config step is adding headache for every new user.

Wrong springboot version for reverse proxy faq

In the docs/faq.html file, line 582, you mentione "Spring Boot 3.2".
I think this is an error because server.forward-headers-strategy configuration is available since Spring Boot 2.0.

I don't know how I can create pull request but you should fix that.

Sincerely

Removing webjars-locator-core broke using a provided spec.

Describe the bug

It appears that attempting to use a provided spec as documented here is broken since webjars-locator-core was removed in springdoc/springdoc-openapi#2173

setting springdoc.api-docs.enabled=false disables autoconfiguration which results in the new SpringDocsUIConfiguration not being configured - which causes a 404 when attempting to resolve the webjar.

I believe the instructions likely need updated to include defining a bean like:

@Bean
SpringDocsUIConfiguration springDocsUiConfiguration(Optional<SwaggerUiConfigProperties> optionalSwaggerUiConfigProperties){
    return new SpringDocsUIConfiguration(optionalSwaggerUiConfigProperties);
}

To Reproduce

  • Boot 2.7.12
  • spring-doc 1.7.0
  • Follow configuration steps here

Expected behavior

swagger-ui loads

Invalid path for api-docs.yaml in full documentation

Hello, I noticed a small inconsistency in the documentation.

The full documentation found at https://springdoc.org/ mentions /v3/api-docs.yml in several places for accessing the API documentation in yaml format. However, the actual path should be /v3/api-docs.yaml as stated in the README. Trying to access /v3/api-docs.yml returns the Whitelabel Error page, while /v3/api-docs.yaml actually downloads the expected API documentation in yaml format.

For SpringDoc OpenAPI 1.6, Swagger UI unable to render definition

Describe the bug

Swagger UI page complains about rendering the definition, shows error on page saying:
http://localhost:8080/swagger-ui/index.html

Unable to render this definition
The provided definition does not specify a valid version field.

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).

when running the Spring Boot Maven plugin:

$ mvn clean spring-boot:run

To Reproduce

Steps to reproduce the behavior:

  • What version of spring-boot you are using?

Using Spring Boot 2.6:

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.14</version>
    <!-- # lookup parent from repository -->
    <relativePath />
  </parent>
  • What modules and versions of springdoc-openapi are you using?

Using SpringDoc 1.6:

    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-ui</artifactId>
      <version>1.6.15</version>
    </dependency>
    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-security</artifactId>
      <version>1.6.15</version>
    </dependency>
  • How are you running the application?

Run using the Spring Boot Maven plugin:

$ mvn clean spring-boot:run

Expected behavior

Swagger UI does not throw error

Additional context

Config:

springdoc:
  writer-with-default-pretty-printer: true
  api-docs:
    enabled: true
    version: "openapi_3_0"
  swagger-ui:
    enabled: true
    operations-sorter: "method"
    tags-sorter: "alpha"
    display-request-duration: true

Using custom HTTP message converters:

  @Override
  public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new MappingJackson2HttpMessageConverter(JsonUtils.createObjectMapper()));
  }

Unable to see JSON spec at:
http://localhost:8080/v3/api-docs
only shows some kind of Base64 output (not JSON)

document which regex dialect use use/support with sprindoc-openapi

I put a lot of energy in evolving a regex but when I put it into the @pattern annotation I got the message: Conditionals are not supported in this regex dialect.
It would be helpful to document the used regex dialect that developers can code against.
Which dialect is the proper one to use with sprimgdoc-openapi?

Customizing swagger static resources

See issue.

OpenAPI Configuration

@Configuration
public class OpenApiConfig {
  @Bean
  public SwaggerIndexTransformer swaggerIndexTransformer(SwaggerUiConfigProperties sUiConfig,
                                                         SwaggerUiOAuthProperties sUiOAuthProperties,
                                                         SwaggerUiConfigParameters sUiConfigParameters,
                                                         SwaggerWelcomeCommon sWelcomeCommon) {
      return new SwaggerCodeBlockTransformer(sUiConfig, sUiOAuthProperties, sUiConfigParameters, sWelcomeCommon);
  }
}

Transformer

public class SwaggerCodeBlockTransformer extends SwaggerIndexPageTransformer {

    private static final String OLD = ".renderedMarkdown code{" +
                                      "background:rgba(0,0,0,.05);" +
                                      "border-radius:4px;" +
                                      "color:#9012fe;" +
                                      "font-family:monospace;" +
                                      "font-size:14px;font-weight:600;" +
                                      "padding:5px 7px}";
    private static final String NEW = ".renderedMarkdown code{" +
                                      "color:#9012fe;" +
                                      "font-family:monospace;" +
                                      "font-size:14px;font-weight:600}";

    public SwaggerCodeBlockTransformer(SwaggerUiConfigProperties swaggerUiConfig,
                                       SwaggerUiOAuthProperties swaggerUiOAuthProperties,
                                       SwaggerUiConfigParameters swaggerUiConfigParameters,
                                       SwaggerWelcomeCommon swaggerWelcomeCommon) {
        super(swaggerUiConfig, swaggerUiOAuthProperties, swaggerUiConfigParameters, swaggerWelcomeCommon);
    }

    @Override
    public Resource transform(HttpServletRequest request,
                              Resource resource,
                              ResourceTransformerChain transformerChain) throws IOException {
        if (resource.toString().contains("swagger-ui.css")) {
            try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream()))) {
                final String css = reader.lines().collect(Collectors.joining());
                final byte[] transformedContent = css.replace(OLD, NEW).getBytes();
                return  new TransformedResource(resource, transformedContent);
            }
        }
        return super.transform(request, resource, transformerChain);
    }

}

FAQ links to wrong file for OpenApiCustomiser example

Is your feature request related to a problem? Please describe.

  • A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I'm always frustrated when I click on a link from documentation and it's an empty test file.

  • What is the actual result using OpenAPI Description (yml or json)?

image

Describe the solution you'd like

  • A clear and concise description of what you want to happen.
  • What is the expected result using OpenAPI Description (yml or json)?

Update link to https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-webflux-core/src/test/java/test/org/springdoc/api/app39/SpringDocTestApp.java

Describe alternatives you've considered

  • A clear and concise description of any alternative solutions or features you've considered.

None

Additional context

  • Add any other context or screenshots about the feature request here.

None

"Deep Linking documentation" - broken link

https://springdoc.org/#swagger-ui-properties

springdoc.swagger-ui.deepLinking | false | Boolean. If set to true, enables deep linking for tags and operations. See the [Deep Linking documentation](/docs/usage/deep-linking.md) for more information

The link is literally rendered as [Deep Linking documentation](/docs/usage/deep-linking.md).
And I can see no such document in repo.

The corresponding link is actually also broken at https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/ . Leads to 404.

Kotlin module for v2?

In v2.0.0 there seems to be no Kotlin module, yet the doc mentions otherwise. Latest on Maven Central is 1.6.13.

swagger-ui is not showing "select a definition" instead shows Explore option with text box

Issue
I have spring mvc project without spring boot that integrated springdoc-openapi as mentioned in the document. Everything works fine. but one issue seen in UI where I could not see "select a definition" with list of groups instead it was showing Text box with Explore option.

springdoc-openapi-ui - 1.6.4
spring-boot & spring-boot-autoconfigure - 2.6.2

Screen shot taken from non spring boot app
image

If i specify api-docs path manually, it works fine. I tried with simple spring boot project where I could see the select a definition option. Is something am i missing in non spring boot integration.

Screen shot taken from spring boot app

image

Fix documentation for programmatic RouterFunctions

Edit:
This is just a documentation fix. On the main springdoc page for the programmatic openapi feature, you should point out that the route() method in your example is not the normal route() method from functional spring webflux routing. Looking more closely at the example code and javadocs, I see you have a SpringdocRouteBuilder.route() that is completely different than the normal spring RouterFunctions.route() method that people are used to calling.

The fact these are different methods isn't mentioned in your documentation, and since you do a static import in the example code, it was really easy to miss.

Original:

Describe the bug
You can't create a RouterFunction with programmatic openapi details

@Bean RouterFunction<ServerResponse> myroute() {
  return route().GET("/foo", HANDLER_FUNCTION, ops -> ops.operationId("hello")).build()
}

like the documentation says here.

To Reproduce
Steps to reproduce the behavior:

  • SpringBoot 2.7.4
  • Spring WebFlux 5.3.23
  • SpringDoc 1.6.11
  • Using springdoc-openapi-common, springdoc-openapi-webflux-core, springdoc-openapi-webflux-ui
  • Expecting the application to compile and generate openapi document
  • It doesn't compile because there is no method signature in RouterFunction.Builder for GET() that takes that combination of parameters.

Expected behavior

  • This spring commit shows the expected behavior that should compile
  • The expected result is to compile and generate any openapi output at all

Additional context

A bit more Gradle plugin docs, please?

It is not very clear what kind of dependencies need to be:

  • Implementation?
  • developerOnly?
  • runtimeOnly?

I am currently going with this:

dependencies {
   ...
    //SpringDoc OpenAPI
    def springDocVersion = '1.6.11'
    implementation "org.springdoc:springdoc-openapi-ui:${springDocVersion}"
    implementation "org.springdoc:springdoc-openapi-webmvc-core:${springDocVersion}"
    implementation "org.springdoc:springdoc-openapi-webflux-ui:${springDocVersion}"
    implementation "org.springdoc:springdoc-openapi-hateoas:${springDocVersion}"
    implementation "org.springdoc:springdoc-openapi-data-rest:${springDocVersion}"
}

but would prefer not include in the final jar things that are not needed at runtime.

Choose a new favicon for the docs page

The existing favicon does not have quadratic dimensions and it's not really usable to recognize it in a browser. Would be great if you could create a modern one just with the logo and maybe a transparent background.

screenshot-20240305-183058

Documentation issue: "OpenAPICustomiser"

In the full documentation section 11.27. How can I customise the OpenAPI object?, there's a code example that does not compile.

@Bean
public OpenAPICustomiser consumerTypeHeaderOpenAPICustomiser() {
return openApi -> openApi.getPaths().values().stream().flatMap(pathItem -> pathItem.readOperations().stream())
    .forEach(operation -> operation.addParametersItem(new HeaderParameter().$ref("#/components/parameters/myConsumerTypeHeader")));
}

The issue is that there is no class named OpenAPICustomiser. Instead, it is called OpenApiCustomiser.

Non-existing class in documentation

Hello,
as metioned in issue: springdoc/springdoc-openapi#2321
I am supposed to register this Bean:

@Bean
    fun springDocsUiConfiguration(optionalSwaggerUiConfigProperties: Optional<SwaggerUiConfigProperties?>?): SpringDocsUIConfiguration? {
        return SpringDocsUIConfiguration(optionalSwaggerUiConfigProperties)
    }

But this class doesn't exist.

sprindoc show actuator setting in app yaml does not refer to management port value

show-actuator: true
The above setting for sprindoc in app yaml does not refer to management port value that is set to -Dmanagement.server.port=
show actuator always look in the same port where app is running.

If actuator is using differ mgmt server port then it fails. We have to remove this show actuator setting to make it work.

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.