본문으로 건너뛰기

API 참조

<OasDocument /> — 속성​

속성타입기본값설명
inputOpenApiInput | OpenApiDocument | null필수OpenAPI/Swagger 문서(객체, JSON 문자열 또는 YAML 문자열)
autoUpgradebooleantrue@powerduck/openapi-parser로 검증하고 OAS 3.2로 업그레이드
defaultOperationIdstring—첫 렌더링에서 선택할 작업 ID
onOperationChange(operation) => void—사용자가 선택을 변경할 때 실행되는 콜백
classNamestring—루트 요소에 추가할 CSS 클래스
styleReact.CSSProperties—루트 요소의 인라인 스타일
theme"light" | "dark""light"초기 테마. localStorage에 저장됩니다.
headerOasDocumentHeaderConfig—헤더 설정(로고, 제목, 탐색 링크)
showTreebooleantrue사이드바 트리 표시
treeWidthnumber340사이드바 너비(픽셀, 범위 240–480)

헤더 설정​

필드타입기본값
logostring | ReactNode—
titlestring"API Documentation"
navItemsArray<{ label, href?, onClick? }>[]
showThemeTogglebooleantrue

useOasDocument(input, options?)​

const {
document, // Oas32Document | null
loading, // boolean
error, // Error | null
operations, // OasOperation[]
navigationGroups, // OasNavigationGroup[]
tree, // TreeNode[]
selectedOperation, // OasOperation | undefined
setSelectedOperation,
theme, // "light" | "dark"
setTheme,
} = useOasDocument(spec, { autoUpgrade: true });

코어 함수​

함수설명
loadOasDocument(input, options?)문서를 불러와 업그레이드하고 { document, operations, navigationGroups, tree, warnings, error } 반환
parseOperations(document)OAS 문서에서 작업 추출
buildNavigationGroups(document)그룹화된 탐색 구조 생성