#OpenAPI & Swagger in springboot issue

1 messages · Page 1 of 1 (latest)

crimson otter
#

I am trying to use open api in my application but no matter what i do it always throw this error.
I cannot find anything similar to this error anywhere, anyone could help please.

gray spruceBOT
#

This post has been reserved for your question.

Hey @crimson otter! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

crimson otter
#

Here is my pom.xml

#
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.14</version>
        </dependency>    
crimson otter
#

on swagger ui this error shows

#

I am completely stuck on this for 2 hours and i cannot find anything similar to this error anywhere online

copper kite
#

make sure that... the value attribute of the @@RequestParam annotation is set to a non-empty string!

crimson otter
#

the thing is i dont have @param

#

i have @RequestParam

#

and i did it and its still giving me the same error

#
@RestController
public class CarController {
    @Autowired
    CarService carService;

    @GetMapping(value="/cars")
    public ResponseEntity<List<CarDTO>> findAvailableByTypeAndTransmission(@RequestParam @NotEmpty String type, @RequestParam @NotEmpty String transmission){
        try {
            return new ResponseEntity<>
                    (CarMapper.INSTANCE.toCarDTOs
                                    (carService.findAvailableByTypeAndTransmission(type, transmission))
                    ,HttpStatus.OK);
        }catch (EmptyResultDataAccessException e){
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }
    }



    @GetMapping(value="/cars/all")
    @ResponseStatus(HttpStatus.ACCEPTED)
    public List<CarDTO> findAll(){
        List<Car> cars=carService.findAll();
        return CarMapper.INSTANCE.toCarDTOs(cars);
    }

    @GetMapping(value="/cars/unavailable")
    public ResponseEntity<List<CarDTO>> findAllRented(){
        try {
            return new ResponseEntity<>
                    (CarMapper.INSTANCE.toCarDTOs
                            (carService.findAllRented())
                            ,HttpStatus.OK);
        }catch (EmptyResultDataAccessException e){
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }
    }

}```
#

Even if i remove all methods it still show the error, i dont know where the issue starts from

copper kite
#

something is wrong with your config cant say by looking your </>

crimson otter
#

you mean pom.xml?

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.SaeedAndEmre</groupId>
    <artifactId>CarRental</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>CarRental</name>
    <description>CS393Project</description>
    <properties>
        <java.version>17</java.version>
        <org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.14</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>
#
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>```
#
<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source> <!-- depending on your project -->
                    <target>1.8</target> <!-- depending on your project -->
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${org.mapstruct.version}</version>
                        </path>
                        <!-- other annotation processors -->
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>
crimson otter
crimson otter
#

i can share with you the github if you want

copper kite
#

step through the code in a debugger or add logging statements to see what is happening at each stage of the request handling process!

crimson otter
#

the thing is i dont even know where it starts from, the error shows locations from outside my code

crimson otter
#

how do i do that

copper kite
crimson otter
#

wanna go voice?

copper kite
#

i mean live sharing!

crimson otter
#

go in a vc or something i can share my screen

copper kite
#

alright!

crimson otter
#

come talk #1

copper kite
crimson otter
#

okay

#

What a waste of time my dude

copper kite
#

goodluck!

crimson otter
#

bump