#OpenAPI & Swagger in springboot issue
1 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @crimson otter! Please use
/closeor theClose Postbutton 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.
Here is my pom.xml
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.14</version>
</dependency>
this shows when i got to http://localhost:8080/v3/api-docs
on swagger ui this error shows
and this is my error stacktrace inside intellije :
I am completely stuck on this for 2 hours and i cannot find anything similar to this error anywhere online
make sure that... the value attribute of the @@RequestParam annotation is set to a non-empty string!
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
something is wrong with your config cant say by looking your </>
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>
i have no config package or any classes annotated with @configuration
still cant say.....
i can share with you the github if you want
step through the code in a debugger or add logging statements to see what is happening at each stage of the request handling process!
the thing is i dont even know where it starts from, the error shows locations from outside my code
take a look in trackback!
how do i do that
share screen!
i mean live sharing!
go in a vc or something i can share my screen
alright!
come talk #1
hit me Dms!
goodluck!
bump