# Stop using Swagger-UI and MSW, but SDK instead

> Clean Markdown view of GeekNews topic #10076. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=10076](https://news.hada.io/topic?id=10076)
- GeekNews Markdown: [https://news.hada.io/topic/10076.md](https://news.hada.io/topic/10076.md)
- Type: news
- Author: [samchon](https://news.hada.io/@samchon)
- Published: 2023-07-30T13:08:10+09:00
- Updated: 2023-07-30T13:08:10+09:00
- Original source: [dev.to](https://dev.to/samchon/stop-using-swagger-ui-and-msw-but-sdk-instead-412b)
- Points: 14
- Comments: 6

## Topic Body

Swagger.json 파일로부터의 TypeScript SDK 및 목업 시뮬레이터 제작 도구  
  
여기서의 SDK (Software Development Kit) 는 다음 기능들을 내포함  
  
  - collection of fetch functions  
  - DTO structures  
  - Mockup Simulator  
  
SDK를 빌드하여 사용시 프론트 (클라이언트) 개발자가 swagger 문서를 읽으며 fetch 함수 및 DTO 타입을 옮겨적는 것보다 훨씬 간편하고 안전하며, msw로 백엔드 서버를 모킹하는 일 또한 자동으로 해 주어, 생산성이 증대된다.

## Comments



### Comment 17922

- Author: roxie
- Created: 2023-08-05T20:18:05+09:00
- Points: 1

좋은 글, 재밌는 어프로치 감사합니다. 제 개인적인 선호일수도 있겠으나, 위 본문 파트에 "이러이러한 코드를 넣으면, 기존에는 이렇게 되던게, 이렇게 된다" 하는 식으로 예시가 나와있었으면 좋았을 것 같습니다. 지금의 본문은 거의 눈이 가질 않아요.

### Comment 17777

- Author: kuber
- Created: 2023-07-30T22:13:30+09:00
- Points: 1

TS 생태계는 문서보고 수동으로 관련 타입및 함수를 정의하는게 일반적인건가요?

### Comment 17795

- Author: hyeonss0417
- Created: 2023-07-31T10:52:38+09:00
- Points: 2
- Parent comment: 17777
- Depth: 1

관련하여 TypeScript 타입을 기반으로 OpenAPI Spec을 자동으로 뽑아주는 Tspec이라는 라이브러리가 있습니다ㅎㅎ  
  
https://github.com/ts-spec/tspec

### Comment 17779

- Author: samchon
- Created: 2023-07-31T04:11:08+09:00
- Points: 1
- Parent comment: 17777
- Depth: 1

TS는 openapi-generator가 만들어주는 코드가 쓸만하지 못합니다

### Comment 17772

- Author: kunggom
- Created: 2023-07-30T13:50:53+09:00
- Points: 2

아무래도 이 글을 올리신 samchon님이 직접 만드신 도구의 사용법 같은데, 그러면 Show GN 쪽으로 가야 하는 게 아닌가 싶기도 합니다.  
  
어쨌든 `swagger.json` 파일을 가지고 TypeScript 클라이언트에서 자동완성을 하게끔 해주는 건 좋은 아이디어 같습니다. 혹시 NestJS가 아닌 다른 백엔드 스택에서도 사용할 수 있는 건가요?

### Comment 17773

- Author: samchon
- Created: 2023-07-30T13:53:32+09:00
- Points: 2
- Parent comment: 17772
- Depth: 1

언어나 프레임워크 상관없이 openapi v3.0 스펙의 swagger.json만 빌드할 수 있으면 됩니다.   
  
이전에도 블로그 글을 show GN 달고 올린 적 있는데, 그 때는 관리자님께서 show GN에는 깃헙이나 프로젝트 링크만 올리는 곳이라 하셨고, 일반 글로 이동해주셨습니다.
