feat: API 스펙을 파일로 고정해 프런트와의 어긋남을 잡는다 - #127
Merged
Merged
Conversation
프런트와 서버가 어긋나 조용히 깨지는 일이 반복됐다. 서버에서 지운 경로를 프런트가 계속 부르고, 서버가 보내지 않는 필드를 프런트가 필수로 요구했다. 둘 다 배포 후 화면에서야 드러났다. - docs/api/openapi.json: 현재 API 스펙(경로 236, 스키마 132). 프런트가 서버를 띄우지 않고 대조한다. - OpenApiSpecLockTest: 스펙을 갱신하지 않고 API 를 바꾸면 테스트가 실패한다. 경로·필드 변경이 이 파일 diff 로 리뷰에 드러난다. 갱신: ./gradlew test --tests '*OpenApiSpecLockTest' -Popenapi.lock.update=true - springdoc 은 실행마다 키 순서가 달라 객체 키를 재귀 정렬하고 태그는 이름순으로 고정했다. (그대로 두면 파일이 매번 바뀌어 diff 가 쓸모없다. 연속 실행 2회로 확인) - build.gradle: 갱신 스위치를 Gradle 속성으로 받아 테스트 JVM 까지 넘긴다.
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.
Closes #126
프런트: 대조 테스트를 CareCode_FE 에서 이어 올린다 (이 PR 이 먼저 머지돼야 스펙을 가져갈 수 있다)
무엇
docs/api/openapi.json— 현재 스펙(경로 236, 스키마 132)OpenApiSpecLockTest— 스펙을 갱신하지 않고 API 를 바꾸면 실패. 갱신은-Popenapi.lock.update=true왜 파일로 두는가
프런트가 서버를 띄우지 않고 자기 호출을 대조할 수 있고, 경로·필드 변경이 diff 로 리뷰에 드러난다. 지금까지는 서버 PR 에 프런트 호출이 안 보이고 프런트 PR 에 서버 변경이 안 보여, 어긋남이 배포 후 화면에서야 나타났다.
순서 고정
springdoc 은 실행마다 키 순서를 다르게 낸다(빈 스캔 순서). 그대로 두면 파일이 매번 바뀌어 diff 가 쓸모없어진다.
ORDER_MAP_ENTRIES_BY_KEYS는 JsonNode 에 적용되지 않는다)localhost:8082)연속 실행 2회가 모두 통과하는 것으로 확인했다.
테스트
/auth/login,/notifications/stream)가 담기는지