Skip to content

Chore(client): Swagger 인증 적용에 따른 openapi-typescript 타입 생성 스크립트 수정#260

Open
jogpfls wants to merge 2 commits into
developfrom
chore/script-openapi/259
Open

Chore(client): Swagger 인증 적용에 따른 openapi-typescript 타입 생성 스크립트 수정#260
jogpfls wants to merge 2 commits into
developfrom
chore/script-openapi/259

Conversation

@jogpfls

@jogpfls jogpfls commented Jul 5, 2026

Copy link
Copy Markdown
Member

📌 Summary

Swagger 인증 적용에 따른 openapi-typescript 타입 생성 스크립트 수정

📚 Tasks

  • scripts/generate-types/sh 파일 설정
  • package.json에 스크립트 반영
  • .env.example에 Swagger 자격증명 키 추가
  • swagger type 업데이트

🔍 Describe

배경

데모데이 직전에 백엔드 측에서 Swagger에 Basic Auth 인증을 적용했던거 기억나시나요,,?
openapi-typescript는 Swagger의 /v3/api-docs 스펙을 그대로 가져와 타입을 생성하는 구조인데 Swagger 접근이 인증으로 막히면서 기존 generate:types 스크립트도 401로 실패하게 되길래 이에 맞춰 스크립트를 업데이트했어용

접근 방식

openapi-typescript CLI는 원격 URL에 대한 인증 옵션을 지원하지 않아요 (v6의 --auth 플래그가 v7에서 제거됨).
공식 권장 방향에 따라 인증된 curl로 스펙을 임시 파일에 내려받은 뒤 파일 경로를 넘기는 2단계 방식으로 변경했습니다.

사용 방법

.envSWAGGER_USERNAME, SWAGGER_PASSWORD를 추가한 뒤 기존과 동일하게 pnpm generate:types를 실행하면 됩니다. env 값은 노션에 업데이트 해놨어요 !

👀 To Reviewer

  • 스크립트 위주로 봐주시면 감사하겠습니당

📸 Screenshot

image

@jogpfls
jogpfls requested a review from a team as a code owner July 5, 2026 13:52
@jogpfls
jogpfls requested review from jm8468, jyeon03 and twossu and removed request for a team July 5, 2026 13:52
@github-actions github-actions Bot added 📄 Docs 문서 수정 🧹 Chore 설정 / 잡무 / 환경 🐧 조혜린 웹 37기 조혜린 labels Jul 5, 2026
@jogpfls jogpfls removed the 📄 Docs 문서 수정 label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

🎨 Storybook 배포 완료

PR 작성자: @jogpfls

🔗 배포된 Storybook 보기

@jm8468 jm8468 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿굿입니다 저도 스크립트 파일을 잘 작성하고 이해하고 싶어요
혹시 팁 같은게 있을까용??

: "${VITE_API_BASE_URL:?VITE_API_BASE_URL이 .env에 필요합니다}"

DOCS_URL="${VITE_API_BASE_URL%/}/v3/api-docs"
OUTPUT="src/shared/apis/schema.d.ts"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 스크립트를 실행하면 schema.d.ts 파일이 위의 경로에 설치되는데,
develop 브랜치에서는 schema.d.ts의 경로가 apps/client/src/shared/types/schema.d.ts에 있어요.

기존 apis/types에서는 모두 apps/client/src/shared/types/schema.d.ts 이 경로를 참조하고 있어서
import 경로를 다시 수정해주면 좋아보이네요 :D

@jm8468 jm8468 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested -> Comment 로 변경함니다... 🙏

@jm8468 jm8468 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변경이 안되네요 ㅎㅎ
천천히 반영하고 머지해주세용

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐧 조혜린 웹 37기 조혜린 🧹 Chore 설정 / 잡무 / 환경

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore] Swagger 인증 적용에 따른 openapi-typescript 타입 생성 스크립트 수정

2 participants