Jatel
Jatel

Reputation: 40

OpenApi 3.0 shows all af the HTTP methods

My OpenApi gone crazy... i created 2 simple rest APIs

    @RequestMapping("/inWithHibernate")
    @PutMapping
    public void inDbMobile() {
        hibernateInsert.inDB();
    }

    @RequestMapping("/outWithHibernate")
    @GetMapping
    public MobileEntity outDbMobile(@RequestParam(name = "id")Long id) {
        return hibernateInsert.fromDB(id);
    }

as i understand it it should show one Put method and one Get method...Instead of that is shows all of the methods, can you please explain what is happening ?

my dependency

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.12</version>
        </dependency>

OpenApi3.0

Upvotes: 0

Views: 565

Answers (2)

Dzeri96
Dzeri96

Reputation: 433

For anyone who migrated to a newer version of Spring/Springdoc and suddenly has this problem, take a look if Spring Data Rest is actually exposing your repositories automatically. I assume that old versions of Springdoc did not detect these endpoints, but now they are shown.

Upvotes: 0

Toni
Toni

Reputation: 5115

The @RequestMapping tells Spring that any HTTP request with the specified path should be mapped to the corresponding method. The path should be specified as an argument of the @PutMapping and @GetMapping annotations and the @RequestMapping annotation should be removed.

Upvotes: 1

Related Questions