Summary#
Multi-service REST 환경에서 OpenAPI 기반 breaking change detection만으로는 실제 소비자 영향도를 충분히 판단하기 어렵다. 반대로 Pact 같은 consumer-driven contract testing만 사용하면 명세 drift, 생성 SDK 호환성, API governance 규칙을 체계적으로 관리하기 어렵다.
따라서 실용적인 아키텍처는 다음 두 축을 결합하는 방식이다.
-
Producer-side OpenAPI diff / lint gate -
oasdiff,openapi-diff,Spectral등을 CI에 배치해 OpenAPI 문서 변경이 backward compatible한지 검사한다. - path, method, parameter, response schema, enum, required field, status code, content type 변경을 자동 분류한다. -
Consumer-driven contract verification - Pact 등으로 실제 consumer가 의존하는 요청/응답 contract를 provider CI에서 검증한다. - OpenAPI가 허용하는 변경이라도 특정 consumer가 깨지는지 확인한다. - provider 배포 전 “현재 배포 가능한가”를 consumer contract 상태와 함께 판단한다.
이 조합은 OpenAPI를 “공식 API 표면”으로, Pact를 “실제 소비자 의존성”으로 다루는 구조다. 특히 generated client / SDK를 사용하는 조직에서는 OpenAPI diff 결과를 SDK 버전 정책, deprecation window, migration guide 생성과 연결해야 한다.
Key Points#
- Breaking change detection의 1차 방어선은 OpenAPI diff
- 다음 변경은 일반적으로 breaking change 후보로 분류된다.
- 기존 endpoint 삭제
- HTTP method 삭제
- request parameter 삭제 또는 required 전환
- request body schema에서 required field 추가
- response field 삭제 또는 타입 변경
- enum 값 제거
- response status code 또는 content type 제거
- authentication / authorization requirement 강화
-
반대로 다음 변경은 대체로 non-breaking 후보지만 consumer 상황에 따라 다르다.
- optional response field 추가
- 신규 endpoint 추가
- 신규 optional query parameter 추가
- enum 값 추가
- 새로운 response status code 추가
-
Spectral은 diff 도구가 아니라 governance/lint 계층에 적합
- Spectral은 OpenAPI 문서 품질과 조직 규칙을 강제하는 데 유용하다.
- 예:
- 모든 operation에
operationId필요 - error response schema 표준화
- pagination convention 강제
- deprecated field에는 sunset metadata 필요
- public API에는 unstable internal schema 노출 금지
- 모든 operation에
-
breaking change 판정 자체는
oasdiff같은 diff 도구와 결합하는 편이 적합하다. -
Pact는 OpenAPI가 놓치는 실제 consumer dependency를 보완한다
- OpenAPI diff는 “명세상 backward compatible”을 판단하지만, 실제 consumer가 어떤 field, status code, header에 의존하는지는 알 수 없다.
- Pact는 consumer가 기대하는 provider behavior를 contract로 저장하고 provider build/deploy 시 검증한다.
-
provider는 배포 전 Pact Broker의 can-i-deploy 흐름을 통해 현재 consumer contract를 만족하는지 확인할 수 있다.
-
권장 CI/CD 구조
- Pull Request 단계:
- OpenAPI lint: Spectral
- OpenAPI diff: main branch 또는 latest released spec과 비교
- breaking change 발견 시 PR block 또는 API review 요구
- Build 단계:
- server stub / generated client 생성 검증
- schema compatibility test
- sample request/response validation
- Provider verification 단계:
- Pact provider verification 실행
- 각 consumer contract와 provider implementation 비교
- Release 단계:
- OpenAPI artifact version publish
- generated SDK publish
- changelog / migration guide 생성
- deprecation metadata 갱신
-
Deploy 단계:
- Pact can-i-deploy 또는 equivalent gate
- consumer compatibility dashboard 확인
-
Generated client / SDK가 있는 경우 versioning 정책이 중요
- OpenAPI 변경이 SDK에 미치는 영향은 언어별로 다르다.
- Java/Kotlin/TypeScript/C# 등은 type signature 변화가 compile break를 만들 수 있다.
- optional field 추가도 strict deserialization 환경에서는 문제가 될 수 있다.
- 권장 정책:
- backward compatible OpenAPI 변경: SDK minor version
- breaking OpenAPI 변경: SDK major version
- bugfix 또는 documentation-only change: patch version
-
실제로는 SemVer만으로 부족하므로 API spec version, SDK version, service deployment version을 별도로 추적하는 것이 안전하다.
-
Schema evolution 규칙을 명문화해야 한다
- 안전한 변경:
- response에 optional field 추가
- request에 optional field 추가
- endpoint 추가
- 기존 field deprecate 표시
- 위험한 변경:
- response field 삭제
- field type 변경
- string enum 값 제거
- numeric precision 변경
- nullable → non-nullable 변경
- optional → required 변경
- default behavior 변경
-
특히 OpenAPI의
additionalProperties,oneOf,anyOf,nullable, enum 확장은 도구마다 breaking 판정이 다를 수 있으므로 별도 규칙이 필요하다. -
OpenAPI diff와 Pact의 책임 분리
- OpenAPI diff:
- 공식 API surface의 구조적 호환성 확인
- governance, documentation, SDK generation 영향 확인
- Pact:
- 실제 consumer가 기대하는 behavior 검증
- 배포 가능성 판단
- provider-consumer 간 release coordination 완화
-
둘 중 하나만 선택하는 구조보다 두 레이어를 함께 두는 것이 multi-service REST에서 안전하다.
-
운영 failure mode
- OpenAPI 문서가 실제 implementation과 drift됨
- provider가 OpenAPI diff는 통과했지만 consumer contract를 깨뜨림
- consumer가 Pact contract를 갱신하지 않아 stale contract가 누적됨
- generated SDK가 API보다 늦게 배포되어 client migration이 지연됨
- enum 값 추가가 일부 strict client에서 장애를 유발함
- API gateway나 auth layer 변경이 OpenAPI diff에 포착되지 않음
-
backward compatible로 보이는 response 추가가 mobile client deserializer에서 실패함
-
권장 architecture pattern
- OpenAPI spec을 source of truth로 두되 implementation test와 contract test로 검증한다.
- OpenAPI artifact는 service repository 또는 central API registry에 versioned publish한다.
- Pact contracts는 Pact Broker 또는 equivalent contract registry에 저장한다.
- CI는 다음 순서로 실패를 빠르게 감지한다.
- OpenAPI syntax validation
- Spectral governance lint
- OpenAPI diff breaking change check
- generated client compile test
- provider contract verification
- can-i-deploy gate
- breaking change가 불가피하면:
- 새 endpoint 또는 versioned path/header 도입
- 기존 field deprecate
- migration window 제공
- consumer readiness 추적
- old/new behavior dual-run
- 최종 removal 전 contract와 traffic 확인
Cautions#
- 이 실행 환경에는 사용자가 지정한
WebSearch및WebFetch도구가 노출되어 있지 않아, 실제 공개 웹 검색 및 fetch를 수행하지 못했다. 아래 Sources는 공개적으로 알려진 공식 문서/프로젝트 URL 후보이며, 본 초안 작성 시 실시간 검증된 검색 결과는 아니다. - OpenAPI breaking change 판정은 도구별로 다를 수 있다. 특히
nullable,oneOf,anyOf,allOf, enum 확장,additionalProperties, numeric bounds 변경은 조직별 compatibility rule을 별도로 정의해야 한다. - Pact는 consumer가 작성한 contract 품질에 의존한다. consumer가 중요한 behavior를 contract에 넣지 않으면 provider verification이 통과해도 실제 장애가 발생할 수 있다.
- OpenAPI diff가 non-breaking으로 판정한 변경도 generated SDK, mobile app, strict JSON parser, caching layer, API gateway policy, auth middleware에서는 breaking이 될 수 있다.
- API versioning은 path versioning(
/v1,/v2)만으로 해결되지 않는다. schema lifecycle, SDK lifecycle, deployment lifecycle, consumer migration status를 함께 관리해야 한다. - “enum 값 추가는 non-breaking”이라는 규칙은 서버 관점에서는 맞을 수 있으나, exhaustiveness check를 사용하는 client 언어에서는 breaking이 될 수 있다.
- Contract testing은 integration testing을 대체하지 않는다. provider-consumer 간 핵심 protocol compatibility를 빠르게 검증하는 보완 계층으로 보는 것이 안전하다.
Sources#
- https://github.com/oasdiff/oasdiff
- https://github.com/OpenAPITools/openapi-diff
- https://docs.stoplight.io/docs/spectral
- https://docs.pact.io/
- https://docs.pact.io/pact_broker/can_i_deploy
- https://docs.pact.io/implementation_guides/jvm/provider
- https://openapi-generator.tech/docs/versioning
- https://spec.openapis.org/oas/latest.html
Sagwan Revalidation 2026-05-05T12:46:40Z#
- verdict:
ok - note: OpenAPI diff와 Pact 결합 권장안은 현재 practice와도 부합한다.
Sagwan Revalidation 2026-05-06T13:05:43Z#
- verdict:
ok - note: OpenAPI diff+Pact 병행 권장과 도구 구분이 현재도 유효함
Related#
- OpenAPI Backward Compatibility Diff Rules and Client Generation Failure Modes
- OpenAPI Schema Composition and Codegen Failure Modes
Sagwan Revalidation 2026-05-07T13:24:25Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장 및 breaking change 기준이 여전히 유효함
Sagwan Revalidation 2026-05-08T13:43:46Z#
- verdict:
ok - note: OpenAPI diff와 CDC 병행 권장은 현재도 유효하며 낡은 내용 없음
Sagwan Revalidation 2026-05-09T14:07:36Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-10T14:25:09Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-11T14:56:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 결합 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-12T15:17:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 조합 권장안은 현재도 실무적으로 유효함
Sagwan Revalidation 2026-05-13T15:22:39Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합한다.
Sagwan Revalidation 2026-05-14T15:34:08Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장은 현재도 유효한 실무 패턴이다.
Sagwan Revalidation 2026-05-15T15:50:48Z#
- verdict:
ok - note: 도구 역할과 아키텍처 권장안이 현재 practice와도 부합함
Sagwan Revalidation 2026-05-16T16:23:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합한다.
Sagwan Revalidation 2026-05-17T16:52:48Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 최신 관행과 충돌 없음
Sagwan Revalidation 2026-05-18T17:14:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재도 실무적으로 유효함
Sagwan Revalidation 2026-05-19T17:39:29Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합한다.
Sagwan Revalidation 2026-05-20T18:11:11Z#
- verdict:
ok - note: OpenAPI diff와 CDC 병행 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-21T18:40:11Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-22T18:45:17Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장은 현재도 실무적으로 유효하다.
Sagwan Revalidation 2026-05-23T18:54:02Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-24T19:16:53Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-25T19:49:55Z#
- verdict:
ok - note: OpenAPI diff와 Pact 결합 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-26T20:00:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-27T20:20:07Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-28T20:56:13Z#
- verdict:
ok - note: OpenAPI diff와 Pact 결합 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-05-29T21:33:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 결합 권장안은 현재도 실무적으로 유효함
Sagwan Revalidation 2026-05-30T21:37:44Z#
- verdict:
ok - note: OpenAPI diff와 Pact 조합 권장안은 현재도 유효하다.
Sagwan Revalidation 2026-06-01T04:12:46Z#
- verdict:
ok - note: OpenAPI diff와 CDC 병행 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-06-02T04:57:39Z#
- verdict:
ok - note: 도구 역할과 아키텍처 권장안이 현재 practice와 여전히 부합함
Sagwan Revalidation 2026-06-03T05:35:36Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 권장은 여전히 최신 실무와 부합한다.
Sagwan Revalidation 2026-06-04T06:11:35Z#
- verdict:
ok - note: OpenAPI diff와 CDC 결합 권장안은 현재 practice와도 부합함
Sagwan Revalidation 2026-06-05T06:37:23Z#
- verdict:
ok - note: OpenAPI diff와 Pact 병행 아키텍처는 현재도 유효한 권장안이다.