question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to NOT generate localAddress.*, remoteAddress.*, and sslInfo.*

See original GitHub issue

I have a Spring Boot WebFlux 2.3.2.RELEASE application that uses Gradle 6.5.1. I’m using implementation("io.springfox:springfox-boot-starter:3.0.0") in order to generate the Swagger documentation for the RESTful API, along with this configuration:

@Configuration
@Import(BeanValidatorPluginsConfiguration.class)
class SwaggerConfig {
  @Bean
  public Docket docket() {
    return new Docket(DocumentationType.OAS_30)
        .apiInfo(apiInfo())
        .select()
        .apis(RequestHandlerSelectors.basePackage("tld.domain"))
        .paths(PathSelectors.regex("/endpoint.*"))
        .build();
  }

  private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
        .contact(new Contact("Team", null, "identifier@domain.tld"))
        .description("RESTful API Reference for Developers")
        .title("RESTful API")
        .version("1.0")
        .build();
  }
}

The problem is that Swagger is generating an enormous amount of parameters that aren’t used (first hand): localAddress.address.MCGlobal, localAddress.address.MCLinkLocal, localAddress.address.MCNodeLocal, localAddress.address.MCOrgLocal, localAddress.address.canonicalHostName, remoteAddress.address.MCGlobal…and so on.

enter image description here

Is there a way to filter those, minimize the amount, or just don’t generate them as part of the documentation (read: the final HTML). I don’t fully understand why Swagger is generating those query parameters. It looks like it generates everything pretty well, expect for that detail: the extra (useless for me) parameters.

I’m not using any other annotation(s) in the code, nor any other setting(s) in the application.[properties|yml] file.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
dilipkrishcommented, Aug 3, 2020

Sounds like you need to add ServerHttpRequest to the ignorable types

docket.ignoredParameterTypes(ServerHttpRequest.class) should do the trick

2reactions
dilipkrishcommented, Aug 3, 2020

Seems like if you prefer (Im not sure what type localAddress is), but if you dont need those parameters, Im guessing its one of these scenarios

  1. If those are optional, that dont expect to get passed in, but still do expect certain properties on that object. 1a. if you own the type for localAddress then you could annotate it with @ApiModeProperty(hidden=true) 1b. if you dont own it you could create an alternate type rule to substitute the type with another type that is more in like with the parameters you’re looking for.
  2. or are you not expecting properties at all … for e.g. URL is a type that can be used as a parameter, but dont expect properties like host, port, scheme etc. but rather treat it as a string, just use alternate type rules
Read more comments on GitHub >

github_iconTop Results From Across the Web

MockServerHttpRequest.BaseBuilder (Spring Framework 6.0 ...
Request builder exposing properties not related to the body. ... localAddress(InetSocketAddress localAddress). Set the ... Set the remote address to return.
Read more >
Documentation: 15: F.42. sslinfo - PostgreSQL
Returns true if current client has presented a valid SSL client certificate to the server, and false otherwise. (The server might or might...
Read more >
Client did not trust this server's certificate, closing connection ...
We are not looking for SSL connectivity between transport client, we want to connect it via HTTP communication with userid and password.
Read more >
Received plaintext http traffic on an https channel, closing ...
If anyone comes across this problem in the future, make sure your ingress is properly configured. The error message suggests that its a ......
Read more >
Configuring TLS from Edge to the backend (Cloud and Private ...
You make outgoing requests with the tls module the same way you would ... the HTTPS protocol, the UI does not automatically insert...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found