#441 [Fix] 광고 스웨거 기본 서버를 문서를 연 주소로 바꿈 - #449
Merged
Merged
Conversation
- Swagger UI 는 서버 목록의 첫 번째를 골라 두기 때문에, dev 주소로 문서를 열어도 광고 Try it out 이 운영으로 나갔다. 운영에는 광고 경로가 아직 없어 401 이 떨어졌고, 배포된 뒤에는 소재 등록·삭제가 운영 데이터를 건드린다. - 광고 그룹에만 dev 를 앞에 둔다. 다른 그룹의 순서는 건드리지 않는다. - 서버 정의가 두 곳에서 필요해져 메서드로 뽑았다. 값은 그대로다. - 서버 순서를 고정하는 테스트를 추가한다. 되돌리면 실패하는 것을 확인했다.
- dev 를 앞에 두면 운영 스웨거에서도 dev 로 나간다. 상대 경로를 첫 번째에 두어 운영에서 연 문서는 운영으로, dev 에서 연 문서는 dev 로 가게 한다. - 프로파일로 가르지 않는다. dev 서버도 prod 프로파일로 돌기 때문에 구분되지 않는다. - 다른 환경을 일부러 고르는 것은 목록에서 그대로 가능하다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
dev 스웨거에서 광고 API 를 Try it out 하면 401 이 떨어집니다.
요청이 dev 가 아니라 운영으로 나가고 있었습니다. Swagger UI 는 서버 목록의 첫 번째를 기본으로 골라 두는데, 공통 목록이 운영을 맨 앞에 두고 있습니다.
운영에는 광고 경로가 아직 배포되지 않아 JwtFilter 화이트리스트에 없고, 그래서 401 입니다.
dev.picke.store/api/v1/ads?slot=HOME_FEED{"statusCode":200,"data":[]}picke.store/api/v1/ads?slot=HOME_FEEDAUTH_401지금은 401 로 막히지만, 광고가 운영에 배포되면 같은 실수가 조용히 통과합니다. 광고 그룹에는 소재 등록·수정·삭제가 함께 묶여 있어 운영 데이터가 바뀝니다.
왜 프로파일로 가르지 않는가
prod프로파일이면 운영, 아니면 dev 로 나누는 방법을 먼저 검토했습니다. 쓸 수 없습니다.dev 서버도
prod프로파일로 돕니다. 부팅 로그에 그대로 남아 있습니다.application-prod.yml에도 호스트를 가르는 설정이 없습니다. 프로파일로 나누면 dev 스웨거가 운영을 가리키는 지금 상태가 그대로 유지됩니다.변경
/)를 둔다. Swagger UI 가 이를 현재 origin 으로 풀어 주므로, 운영에서 연 문서는 운영으로, dev 에서 연 문서는 dev 로 나간다.검증
./gradlew test --tests "com.swyp.picke.domain.ad.*" --tests "com.swyp.picke.global.config.*" --rerun-tasks→ BUILD SUCCESSFULSwaggerAdGroupTest4건 통과 (failures 0, errors 0)남은 것
이 PR 범위 밖이라 손대지 않았습니다. 별도로 다룰지 판단이 필요합니다.
slot파라미터를 빼면 400 이 아니라 500 이 납니다. 스웨거에서 파라미터를 채우지 않고 Execute 하면 이 응답을 보게 됩니다.MissingServletRequestParameterException이 전역 핸들러에 잡히지 않는 것으로 보입니다.