1

I'm using springdoc-openapi-maven-plugin to generate a contract in YAML format and somehow it generates an example at null (example: null) for each path/request parameter. Is there a way to avoid that ?

Here is an example of the generated YAML

openapi: 3.0.1
paths:
  /myapi/v1/resource/{id}:
    get:
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            example: null
        - name: param1
          in: query
          required: true
          schema:
            type: string
            example: null

And the plugin (pom.xml)

<plugin>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-maven-plugin</artifactId>
  <version>1.4</version>
  <configuration>
    <apiDocsUrl>http://localhost:8080/v3/api-docs.yaml</apiDocsUrl>
    <outputFileName>myYamlFile.yaml</outputFileName>
    <outputDir>/home/</outputDir>
  </configuration>
  <executions>
    <execution>
      <id>integration-test</id>
      <goals>
        <goal>generate</goal>
      </goals>
    </execution>
  </executions>
</plugin>

The ResourceController (very basic) :

@RestController
@RequestMapping("/myapi/v1/resource")
public class ResourceController {
  @GetMapping("/{id}")
  public ResourceDTO getResourceInfo(@PathVariable("id") String resourceId, @RequestParam(value="param1") String param1) {
    [...]
  }
}

EDIT - The apparition of the example: null started with the upgrade of the jackson-databind dependency to 2.14.0

Fred
  • 741
  • 2
  • 10
  • 22

1 Answers1

0

For me it was using an older version of springdoc-openapu-webflux-ui. Changed it to version 1.6.11 from 1.6.5 and it fixed it.

saamrez
  • 1
  • 1