Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aSemy opened this issue Apr 21, 2022 · 0 comments · May be fixed by #114
Open

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

aSemy opened this issue Apr 21, 2022 · 0 comments · May be fixed by #114
Labels
Bug Something isn't working

Comments

@aSemy
Copy link

aSemy commented Apr 21, 2022

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> {
        //...
    }
}
@aSemy aSemy added the Bug Something isn't working label Apr 21, 2022
aSemy added a commit to aSemy/hikaku that referenced this issue Apr 28, 2022
fetch paths from patternsCondition and pathPatternsCondition
@aSemy aSemy linked a pull request Apr 28, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant