# ChatGPT의 Structured Output 기능으로 소스코드로부터 Swagger 문서 생성하기

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

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=21955](https://news.hada.io/topic?id=21955)
- GeekNews Markdown: [https://news.hada.io/topic/21955.md](https://news.hada.io/topic/21955.md)
- Type: news
- Author: [letaem77a](https://news.hada.io/@letaem77a)
- Published: 2025-07-13T21:07:01+09:00
- Updated: 2025-07-13T21:07:01+09:00
- Original source: [gist.github.com/atjsh](https://gist.github.com/atjsh/4a2a6ebd45e6d14afe712ddb7fed9241)
- Points: 12
- Comments: 0

## Summary

**ChatGPT API의 Structured Output 기능**을 활용해 **일반 소스코드로부터 Swagger 기반 API 정의서(JSON)**를 자동으로 생성하는 방법을 다룹니다. 명확한 **JSON Schema 제공**과 스펙 준수를 통해 매뉴얼 작성 부담을 줄일 수 있으며, **AI를 활용한 소프트웨어 문서화**에 관심 있는 개발자에게 실질적인 해결책을 제시합니다. 다만, **할루시네이션 이슈**에 대한 주의가 필요하며, Google Gemini, Ollama 등 **다른 LLM**에서도 유사 기능이 지원된다는 점을 언급합니다.

## Topic Body

- ChatGPT API의 **[Structured Output 기능](https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses)** 을 활용하여, [Swagger](https://swagger.io/) 기반 API 정의서 JSON 파일을 **일반 소스코드로부터 생성**하는 방법 공유  
- Swagger 스펙에 벗어나지 않는 JSON을 생성한 방법 및 [JSON Schema](https://gist.github.com/atjsh/4a2a6ebd45e6d14afe712ddb7fed9241#file-2_structured_output_json_schema-json) 공유. [OpenAI Playground](https://platform.openai.com/playground)에서 직접 재현해볼 수 있음  
  - 주의: 할루시네이션 위험성에 대해 유의할 것  
- Swagger를 수동으로 작성해야 하는 코드베이스에서는 이 방법을 통한 **AI 소프트웨어 문서화**가 유용할 수 있음  
- [Google Gemini](https://ai.google.dev/gemini-api/docs/structured-output), [ollama](https://ollama.com/blog/structured-outputs) 등 다른 LLM 프로바이더에서도 Structured Output 기능을 지원

## Comments



_No public comments on this page._
