홈>
새 클래스를 만드는 대신 swagger codegen이 기존 클래스를 사용하도록하려면 어떻게해야합니까? 이것이 가능한가? 예를 들어
org.springframework.data.domain.Page
를 사용하고 싶습니다.
다른 페이지 클래스를 만드는 대신에
- 답변 # 1
- 답변 # 2
여기에 언급 된 답변 중 아무도 대답하지 않았습니다. swagger yaml 파일에 추가 할 내용, 누군가 관심이 있다면 이것은 나를 위해 일한 것입니다 :
<plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.2-SNAPSHOT</version> <executions> <execution> ... <configuration> ... <importMappings> <importMapping>Page=org.springframework.data.domain.Page</importMapping> </importMappings> </configuration> </execution> </executions> </plugin>
그런 다음 폼에 넣으십시오
<plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.2-SNAPSHOT</version> <executions> <execution> ... <configuration> ... <configOptions> <import-mappings>Page=org.springframework.data.domain.Page;Some=org.example.Some</import-mappings> </configOptions> </configuration> </execution> </executions> </plugin>
- 답변 # 3
DisplayProperty: type: object properties: name: type: string displayName: $ref: '#/components/schemas/Text' isRequired: type: boolean example: false Text: type: object
를 사용하는 것이 항상 가능한 것은 아닙니다 긴 매핑 목록이있는 경우 (적어도 Windows의 경우 명령 프롬프트에서 문자열의 크기 제한이 있습니다.) 이것이 더 좋은 방법입니다. swagger 구성 파일로 매핑을 사용하십시오. 이 옵션은 완전히 설명되어 있지 않습니다.좋아요 :
<importMappings> <importMapping>Text=com.--.--.--.--.Text</importMapping>
myconfig.json :
--import-mappings
java -jar swagger-codegen-cli-2.3.1.jar generate -i myspec.yaml -l java -c myconfig.json
트렌드
- OpenCv의 폴더에서 여러 이미지 읽기 (python)
- 파이썬 셀레늄 모든 "href"속성 가져 오기
- html - 자바 스크립트 - 클릭 후 변경 버튼 텍스트 변경
- javascript - 현재 URL에서 특정 div 만 새로 고침/새로 고침
- JSP에 대한 클래스를 컴파일 할 수 없습니다
- JavaScript 변수를 HTML div에 '출력'하는 방법
- git commit - 자식 - 로컬 커밋 된 파일에 대한 변경을 취소하는 방법
- jquery - JavaScript로 현재 세션 값을 얻으시겠습니까?
- javascript - swiperjs에서 정지, 재생 버튼 추가
- python - 화면에서 찾은 요소를 찾을 수없는 경우 셀레늄
--import-mappings
를 사용할 수 있습니다 , 여기에 설명되어 있습니다 :swagger-codegen-cli generate
--import-mappings Page=org.springframework.data.domain.Page
입니다. . 나는 그것을 maven 플러그인과 함께 사용하지 않았지만 문서 와이 코드가 작동한다고 생각하는 코드를보고 :그러나 최근에 변경되었으므로 이전 버전의 플러그인을 사용하는 경우에는 달라질 수 있습니다. 변경되기 전에 다음과 같은 것 같습니다 :
이전 커밋을 커밋한다는 의견에 따라 지원해야하지만이 중 아무것도 시도하지 않았으므로 작동하는지 알려주세요.