netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Micronaut should suggest micronaut-http-validation if http-related annotations are used

Open sdedic opened this issue 2 years ago • 0 comments

Description

If a project uses annotations like io.micronaut.http.annotation.Get and does not include io.micronaut:micronaut-http-validation annotation processor dependency, the following code can still compile:

    @Get("/{idx}")
    public Optional<Genre> show(Long id) {
        return genreService.findById(id);
    }

the error will be discovered at runtime:

{"message":"Bad Request","_links":{"self":{"href":"/genres/1","templated":false}},"_embedded":{"errors":[{"message":"Required argument [Long id] not specified","path":"/id"}]}}

NBLS should detect the situation and suggest the dependency is added to the project.

Use case/motivation

Better user assistance with Micronaut project development

Related issues

No response

Are you willing to submit a pull request?

Yes

sdedic avatar Oct 23 '23 13:10 sdedic