athrainsky 1 year ago
parent
commit
38b7f98f6e

+ 2 - 2
src/main/kotlin/com/swagger/rest/controllers/ProjectController.kt

@@ -17,14 +17,14 @@ class ProjectController(
 ) {
 ) {
 
 
     @GetMapping("/projects")
     @GetMapping("/projects")
-    fun getProject(@RequestParam(required = false) name: String?): ResponseEntity<List<Project>?> {
+    fun getProject(@RequestParam(required = false) name: String?): Any {
         return try {
         return try {
             val projects: List<Project> =
             val projects: List<Project> =
                 if (name == null) projectRepository.findAll() as List<Project> else projectRepository.findByNameContaining(
                 if (name == null) projectRepository.findAll() as List<Project> else projectRepository.findByNameContaining(
                     name
                     name
                 ) as List<Project>
                 ) as List<Project>
             if (projects.isEmpty()) {
             if (projects.isEmpty()) {
-                ResponseEntity<List<Project>?>(HttpStatus.NO_CONTENT)
+                arrayOf<String>()
             } else ResponseEntity<List<Project>?>(projects, HttpStatus.OK)
             } else ResponseEntity<List<Project>?>(projects, HttpStatus.OK)
         } catch (e: Exception) {
         } catch (e: Exception) {
             ResponseEntity<List<Project>?>(null, HttpStatus.INTERNAL_SERVER_ERROR)
             ResponseEntity<List<Project>?>(null, HttpStatus.INTERNAL_SERVER_ERROR)

+ 0 - 4
swagger3 project.yml

@@ -21,8 +21,6 @@ paths:
       responses:
       responses:
         200:
         200:
           $ref: '#/components/responses/200AP'
           $ref: '#/components/responses/200AP'
-        204:
-          $ref: '#/components/responses/204'
     post:
     post:
       tags:
       tags:
       - projects
       - projects
@@ -291,8 +289,6 @@ components:
         application/json:
         application/json:
           schema:
           schema:
             $ref: '#/components/schemas/Project'
             $ref: '#/components/schemas/Project'
-    204:
-      description: empty data
     400:
     400:
       description: invalid data
       description: invalid data
     404:
     404: