question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade swagger 2 library to 1.6.x

See original GitHub issue

https://springfox.github.io/springfox/docs/snapshot/

I have installed springfox for spring-boot following the above url but generated json data(/v2/ap-docs) have errors . I don’k know why springfox generate unkown KEYWORD originalRef: If I remove all originalRef: lines, the generated json works fine in swagger-editor.

  • originalRef KEYWORD make error as following :: Structural error at definitions.LneQuest.properties.quizList.items should NOT have additional properties additionalProperty: originalRef

My Project dependency version springboot_version=2.3.1.RELEASE springfox_version=3.0.0-SNAPSHOT swagger_version=1.6.2

{
   "swagger":"2.0",
   "info":{
   },
   "host":"localhost:8080",
   "basePath":"/",
   "tags":[
      {
         "name":"clients-controller",
         "description":"Clients Controller"
      },
      {
         "name":"error-controller",
         "description":"코빗 error api"
      },
      {
         "name":"hello-controller",
         "description":"Hello Controller"
      },
      {
         "name":"lne-quest-controller",
         "description":"코빗 quest api"
      },
      {
         "name":"lne-quiz-controller",
         "description":"Lne Quiz Controller"
      },
      {
         "name":"lne-user-reward-controller",
         "description":"Lne User Reward Controller"
      },
      {
         "name":"user-controller",
         "description":"User Controller"
      },
      {
         "name":"white-lists-controller",
         "description":"White Lists Controller"
      }
   ],
   "paths":{
      "/error":{
         "get":{
            "tags":[
               "error-controller"
            ],
            "summary":"Interceptor Level Error 발생시 호출되는 401 에러 처리",
            "operationId":"addLneQuest",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"map",
                  "in":"query",
                  "description":"map",
                  "required":false,
                  "type":"object"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     **"originalRef":"Response"**
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/client":{
         "get":{
            "tags":[
               "clients-controller"
            ],
            "summary":"getClientsByKey",
            "operationId":"getClientsByKeyUsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"key",
                  "in":"query",
                  "description":"key",
                  "required":true,
                  "type":"string"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Clients",
                     **"originalRef":"Clients"**
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/hello":{
         "get":{
            "tags":[
               "hello-controller"
            ],
            "summary":"hello",
            "operationId":"helloUsingGET",
            "produces":[
               "*/*"
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "type":"string"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/quest":{
         "get":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"quest 정보 가져오기",
            "description":"quest 정보를 id(primary key)로 가져오기",
            "operationId":"getLneQuest: quest 정보를 id(primary key)로 가져오기",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"id",
                  "in":"query",
                  "description":"lne_quest.id 고유 키 아이디 값",
                  "required":true,
                  "type":"integer",
                  "format":"int64",
                  "x-example":1
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     **"originalRef":"Response"**
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         },
         "post":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"신규 quest 정보를 테이블에 추가하기",
            "description":"신규 quest 정보를 테이블에 추가하기",
            "operationId":"addLneQuest_1",
            "consumes":[
               "application/json"
            ],
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "in":"body",
                  "name":"quest",
                  "description":"quest",
                  "required":true,
                  "schema":{
                     "$ref":"#/definitions/LneQuest",
                     "originalRef":"LneQuest"
                  }
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     **"originalRef":"Response"**
                  }
               },
               "201":{
                  "description":"Created"
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         },
         "put":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"quest 정보를 수정(update)한다",
            "description":"quest 정보를 수정(update)한다",
            "operationId":"getLneQuest",
            "consumes":[
               "application/json"
            ],
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "in":"body",
                  "name":"quest",
                  "description":"quest",
                  "required":true,
                  "schema":{
                     "$ref":"#/definitions/LneQuest",
                     **"originalRef":"LneQuest"**
                  }
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     "originalRef":"Response"
                  }
               },
               "201":{
                  "description":"Created"
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/quest/list":{
         "get":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"요청기간(from ~ to) 동안의 quest 리스트를 가져오기 (Pageable)",
            "description":"요청기간(from ~ to) 동안의 quest 리스트를 가져오기 (Pageable)",
            "operationId":"getLneQuestList",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"from",
                  "in":"query",
                  "description":"검색기간 필터 시작 시각",
                  "required":false,
                  "type":"string",
                  "format":"date-time",
                  "x-example":"2019-01-01T00:00:00.000"
               },
               {
                  "name":"offset",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int64"
               },
               {
                  "name":"paged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"pageNumber",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"pageSize",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"sort.sorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"sort.unsorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"to",
                  "in":"query",
                  "description":"검색기간 필터 종료 시각",
                  "required":false,
                  "type":"string",
                  "format":"date-time",
                  "x-example":"2020-12-31T00:00:00.000"
               },
               {
                  "name":"type",
                  "in":"query",
                  "description":"퀘스트 타입",
                  "required":false,
                  "type":"string",
                  "x-example":"quiz"
               },
               {
                  "name":"unpaged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     "originalRef":"Response"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/quest/list2":{
         "get":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"getLneQuestList2",
            "operationId":"getLneQuestList2UsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"from",
                  "in":"query",
                  "description":"from",
                  "required":false,
                  "type":"string",
                  "format":"date-time"
               },
               {
                  "name":"offset",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int64"
               },
               {
                  "name":"paged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"pageNumber",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"pageSize",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"sort.sorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"sort.unsorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"to",
                  "in":"query",
                  "description":"to",
                  "required":false,
                  "type":"string",
                  "format":"date-time"
               },
               {
                  "name":"type",
                  "in":"query",
                  "description":"type",
                  "required":false,
                  "type":"string"
               },
               {
                  "name":"unpaged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     "originalRef":"Response"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/quest/list3":{
         "get":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"getLneQuestList3",
            "operationId":"getLneQuestList3UsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"from",
                  "in":"query",
                  "description":"from",
                  "required":false,
                  "type":"string",
                  "format":"date-time"
               },
               {
                  "name":"offset",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int64"
               },
               {
                  "name":"paged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"pageNumber",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"pageSize",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"sort.sorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"sort.unsorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"to",
                  "in":"query",
                  "description":"to",
                  "required":false,
                  "type":"string",
                  "format":"date-time"
               },
               {
                  "name":"type",
                  "in":"query",
                  "description":"type",
                  "required":false,
                  "type":"string"
               },
               {
                  "name":"unpaged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     "originalRef":"Response"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/quest/list4":{
         "get":{
            "tags":[
               "lne-quest-controller"
            ],
            "summary":"getLneQuestList4",
            "operationId":"getLneQuestList4UsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"from",
                  "in":"query",
                  "description":"from",
                  "required":false,
                  "type":"string",
                  "format":"date-time"
               },
               {
                  "name":"offset",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int64"
               },
               {
                  "name":"paged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"pageNumber",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"pageSize",
                  "in":"query",
                  "required":false,
                  "type":"integer",
                  "format":"int32"
               },
               {
                  "name":"sort.sorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"sort.unsorted",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               },
               {
                  "name":"to",
                  "in":"query",
                  "description":"to",
                  "required":false,
                  "type":"string",
                  "format":"date-time"
               },
               {
                  "name":"type",
                  "in":"query",
                  "description":"type",
                  "required":false,
                  "type":"string"
               },
               {
                  "name":"unpaged",
                  "in":"query",
                  "required":false,
                  "type":"boolean"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/Response",
                     "originalRef":"Response"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/quiz":{
         "get":{
            "tags":[
               "lne-quiz-controller"
            ],
            "summary":"getLneQuiz",
            "operationId":"getLneQuizUsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"id",
                  "in":"query",
                  "description":"id",
                  "required":true,
                  "type":"integer",
                  "format":"int64"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "type":"object"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/user":{
         "get":{
            "tags":[
               "user-controller"
            ],
            "summary":"getUser",
            "operationId":"getUserUsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"id",
                  "in":"query",
                  "description":"id",
                  "required":true,
                  "type":"integer",
                  "format":"int64"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "type":"object"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/user_reward":{
         "get":{
            "tags":[
               "lne-user-reward-controller"
            ],
            "summary":"getLneQuiz",
            "operationId":"getLneQuizUsingGET_1",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"id",
                  "in":"query",
                  "description":"id",
                  "required":true,
                  "type":"integer",
                  "format":"int64"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "type":"object"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      },
      "/internal/v1/white_lists":{
         "get":{
            "tags":[
               "white-lists-controller"
            ],
            "summary":"getWhiteListsByIp",
            "operationId":"getWhiteListsByIpUsingGET",
            "produces":[
               "*/*"
            ],
            "parameters":[
               {
                  "name":"ip",
                  "in":"query",
                  "description":"ip",
                  "required":true,
                  "type":"string"
               }
            ],
            "responses":{
               "200":{
                  "description":"OK",
                  "schema":{
                     "$ref":"#/definitions/WhiteLists",
                     "originalRef":"WhiteLists"
                  }
               },
               "401":{
                  "description":"Unauthorized"
               },
               "403":{
                  "description":"Forbidden"
               },
               "404":{
                  "description":"Not Found"
               }
            }
         }
      }
   },
   "definitions":{
      "Clients":{
         "type":"object",
         "properties":{
            "_renew_refresh_token":{
               "type":"boolean"
            },
            "_trusted_app":{
               "type":"boolean"
            },
            "alias":{
               "type":"string"
            },
            "created_at":{
               "type":"string",
               "format":"date-time"
            },
            "deleted_at":{
               "type":"string",
               "format":"date-time"
            },
            "encrypted_secret":{
               "type":"string"
            },
            "key":{
               "type":"string"
            },
            "memo":{
               "type":"string"
            },
            "permission_code":{
               "type":"integer",
               "format":"int32"
            },
            "redirect_uri":{
               "type":"string"
            },
            "scope":{
               "type":"string"
            },
            "updated_at":{
               "type":"string",
               "format":"date-time"
            },
            "user_id":{
               "type":"integer",
               "format":"int32"
            }
         },
         "title":"Clients"
      },
      "LneQuest":{
         "type":"object",
         "properties":{
            "createdAt":{
               "type":"string",
               "format":"date-time"
            },
            "deletedAt":{
               "type":"string",
               "format":"date-time"
            },
            "description":{
               "type":"string"
            },
            "endAt":{
               "type":"string",
               "format":"date-time"
            },
            "id":{
               "type":"integer",
               "format":"int64"
            },
            "quizList":{
               "type":"array",
               "items":{
                  "$ref":"#/definitions/LneQuiz",
                  "originalRef":"LneQuiz"
               }
            },
            "rewardAmount":{
               "type":"number",
               "format":"double"
            },
            "rewardCurrency":{
               "type":"string"
            },
            "rewardRemain":{
               "type":"number",
               "format":"double"
            },
            "rewardTotal":{
               "type":"number",
               "format":"double"
            },
            "startAt":{
               "type":"string",
               "format":"date-time"
            },
            "thumbnailUrl":{
               "type":"string"
            },
            "title":{
               "type":"string"
            },
            "type":{
               "type":"string"
            },
            "updatedAt":{
               "type":"string",
               "format":"date-time"
            },
            "userConstraints":{
               "type":"string"
            }
         },
         "title":"LneQuest"
      },
      "LneQuiz":{
         "type":"object",
         "properties":{
            "answers":{
               "type":"string"
            },
            "correctAnswer":{
               "type":"string"
            },
            "createdAt":{
               "type":"string",
               "format":"date-time"
            },
            "deletedAt":{
               "type":"string",
               "format":"date-time"
            },
            "description":{
               "type":"string"
            },
            "id":{
               "type":"integer",
               "format":"int64"
            },
            "title":{
               "type":"string"
            },
            "type":{
               "type":"string"
            },
            "updatedAt":{
               "type":"string",
               "format":"date-time"
            }
         },
         "title":"LneQuiz"
      },
      "Response":{
         "type":"object",
         "properties":{
            "body":{
               "type":"object"
            },
            "method":{
               "type":"string"
            },
            "requestId":{
               "type":"string"
            },
            "requestUri":{
               "type":"string"
            },
            "success":{
               "type":"boolean"
            }
         },
         "title":"Response"
      },
      "WhiteLists":{
         "type":"object",
         "properties":{
            "client_key":{
               "type":"string"
            },
            "ip":{
               "type":"string"
            }
         },
         "title":"WhiteLists"
      }
   }
}

스크린샷 2020-07-09 오후 7 19 55

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dilipkrishcommented, Jul 13, 2020

@Bajzathd yes it would, but it brings in a concept I dont know much about (originalRef) that’s why Im pushing it to the next release

0reactions
stale[bot]commented, Oct 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger Codegen Documentation
All versions of the Swagger Codegen project can be found on Maven Central. Visit this folder on Maven, and choose the appropriate version...
Read more >
Guide - 7.10.12.2 Migrating to OpenApi 3.0 and Swagger 2.X ...
Guide - 7.10.18.0 Security Update of Libraries ... This document shows major differences between swagger-annotations 1.5.x and 2.x. ... 1.5.x, 2.x, Notes.
Read more >
Springfox Reference Documentation - GitHub Pages
Migrating from existing 2.x version. Spring Boot Applications. Remove library inclusions of earlier releases. Specifically remove springfox- ...
Read more >
Migrating from SpringFox - Springdoc-openapi
Migrating from SpringFox. Remove springfox and swagger 2 dependencies. Add springdoc-openapi-ui dependency instead.
Read more >
Documenting a Spring REST API Using OpenAPI 3.0 - Baeldung
x and 2.x applications. Further reading: Generate Spring Boot REST Client with Swagger. Learn how you can generate a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found