Skip to content

Enable UrlTemplating #2236

Closed
Closed
@marccollin

Description

@marccollin

If you ❤️ this project consider becoming a sponsor.
If you already use the springdoc-openapi, please do not forget adding a github star to this repository.

Actually with springfox it's possible to use url templating

@bean
public Docket categoryApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("category-api")
.apiInfo(apiInfo())
.select()
.paths(categoryPaths())
.build()
.ignoredParameterTypes(ApiIgnore.class)
.enableUrlTemplating(true);
}

Actually with springdoc when we have theses both endpoint

@GetMapping(value = "/{id}", params = "name")
@Operation(description = "check duplicate")
public ResponseEntity<List<DuplicatePerson>> findDuplicatePerson(@PathVariable Long id, @RequestParam String name) {
    return new ResponseEntity<>(personService.findDuplicatePerson(id, nom), HttpStatus.OK);
}

@GetMapping("/{id}")
@Operation(description = "Get person by its id")
public ResponseEntity<PersonDto> findPersonById(@PathVariable
                                                  @NotNull
                                                  Long id) {
    return new ResponseEntity<>(personService.findPersonById(id), HttpStatus.OK);
}

Only the first is displayed underswagger.

With sprindoc, when we enable url templating, both are displayed

Spring doc should have a similar option to support that

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions