Skip to content

Spring endpoints not discovered, RequestMappingInfo.patternsCondition returns null #113

Open
@aSemy

Description

@aSemy

Setup information

hikaku version: 3.3.0
specification converter: OpenAPI
implementation converter: Spring
build tool and version: Gradle 7.4.2
test framework: JUnit 5.8

Spring Boot 2.6.6, Spring WebMVC: 5.3.18

Describe the bug

I've copied the test from the README, but I get this error

👀 Expected, but unable to find:
<list of all endpoints>

internal fun RequestMappingInfo.paths(): Set<String> {
return this.patternsCondition?.patterns ?: emptySet()
}

I've stepped through the code and I can see that patternsCondition returns null. In the Javadoc I see:

This is mutually exclusive with {@link #getPathPatternsCondition()}
such that when one returns {@code null} the other one returns an instance.

I can see pathPatternsCondition seems to return the endpoint correctly.

Expected behavior

Hikaku can discover the endpoints defined in Spring

Code samples

The rest controllers are defined like this

import org.springframework.http.MediaType.APPLICATION_JSON_VALUE
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/my-api")
class MyRestController {

    @GetMapping(
        value = ["/some/endpoint"],
        produces = [APPLICATION_JSON_VALUE]
    )
    fun getDetails(
        id: String
    ): ResponseEntity<ResponseModel> {
        //...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions