0

When using the openapi 3 documentation (swagger) in a spring boot 3 application, swagger documents controllers and methods unknown to me, what could be the problem?

@OpenAPIDefinition(
        info = @Info(
                title = "Billing System Api",
                description = "Billing System", version = "1.0.0",
                contact = @Contact(
                        name = "Protchenko Kirill",
                        email = "kirill.protchenko@mail.ru",
                        url = "https://github.com/kirlozavr/BillingSystem"
                )
        )
)
public class OpenApiConfig {
}

Here is an example controller:

@RestController
@RequestMapping("\*/tariff")
@Tag(name = "Тариф", description = "Контроллер отвечает за crud операции с тарифами")
public class TariffController {
private final TariffService service;
private final TariffMapper mapper = new TariffMapper();

    public TariffController(TariffService service) {
        this.service = service;
    }
    
    @GetMapping("/all/")
    @ResponseStatus(HttpStatus.OK)
    @Operation(summary = "Получить все тарифы")
    public List<TariffDto> getAll() {
        return service.gelAll()
                .stream()
                .map(mapper::getEntityToDto)
                .toList();
    }

Dependence:

<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.1.0</version>
        </dependency>

Result:

enter image description here

There is a controller that I documented, and then controllers with arbitrary names and methods begin.

Kirill
  • 1
  • 1
  • Just a guess, but have you tried to remove this "wildcard thing" from `@RequestMapping("\*/tariff")` and set it to something static like `@RequestMapping("/tariff")`? – burki Jun 27 '23 at 14:44

0 Answers0