Commit 5c50d00b authored by Aleksandr Ivanov's avatar Aleksandr Ivanov

implemented

parent 08e18288
Pipeline #158 failed with stages
......@@ -95,9 +95,9 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
......@@ -173,35 +173,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.5</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<info>
<title>RIHA-Browser API</title>
<version>1.0</version>
<description>RIHA-Browser API documentation</description>
<license>
<name>MIT</name>
</license>
</info>
<schemes>
<scheme>http</scheme>
</schemes>
<basePath>/</basePath>
<locations>
<location>ee.ria.riha.web</location>
</locations>
<swaggerDirectory>${basedir}/src/main/resources/static</swaggerDirectory>
<outputFormats>yaml</outputFormats>
</apiSource>
</apiSources>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
......
......@@ -3,9 +3,11 @@ package ee.ria.riha.conf;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.github.fge.jackson.JsonLoader;
import ee.ria.riha.domain.model.NationalHolidays;
import ee.ria.riha.service.JsonValidationService;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.task.TaskExecutorBuilder;
import org.springframework.boot.web.client.RestTemplateBuilder;
......@@ -51,4 +53,11 @@ public class ApplicationConfiguration {
File holidaysFile = new File(getClass().getClassLoader().getResource(applicationProperties.getNationalHolidaysFile()).toURI());
return mapper.readValue(holidaysFile, NationalHolidays.class);
}
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.components(new Components())
.info(new Info().title("RIHA API").description("API description generated by springdoc-openapi plugin"));
}
}
......@@ -28,11 +28,11 @@ public class FileController {
@Autowired
private FileService fileService;
@PostMapping(API_V1_PREFIX + "/systems/{reference}/files")
@PostMapping(value = API_V1_PREFIX + "/systems/{reference}/files", consumes = "multipart/form-data")
@PreAuthorizeInfoSystemOwnerOrReviewer
@ApiOperation("Upload file")
public ResponseEntity upload(@PathVariable("reference") String reference,
@RequestParam("file") MultipartFile file) throws IOException {
@RequestPart("file") MultipartFile file) throws IOException {
log.info("Receiving info system '{}' file '{}' [{}] with size {}b",
reference, file.getOriginalFilename(), file.getContentType(), file.getSize());
......
# RIHA-Browser configuration
#OpenAPI v3 location
springdoc.api-docs.path=/api-docs
## Force HTTP Encoding
spring.http.encoding.charset=UTF-8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment