데이터 재사용가능.copilot.프롬프트-파일-미리보기-노트 %}
이 프롬프트 파일은 API 코드를 분석해 머신에서 쉽게 읽을 수 있는 표준화된 문서를 만들어 REST API 엔드포인트의 OpenAPI 3.0 사양을 생성합니다.
OpenAPI 사양 프롬프트
---
agent: 'agent'
description: 'Generate OpenAPI 3.0 specification for API endpoints'
---
## Task
Analyze the API endpoint code and generate a valid OpenAPI 3.0 specification in YAML format.
## OpenAPI Structure
Generate a complete OpenAPI spec including:
1. **OpenAPI Header**
- OpenAPI version (3.0.3)
- API info (title, description, version)
- Server configuration
2. **Path Definitions**
- HTTP method and path
- Operation summary and description
- Tags for organization
3. **Parameters Schema**
- Path parameters with type validation
- Query parameters with constraints and defaults
- Request body schema using proper JSON Schema
- Required vs optional parameters
4. **Response Schemas**
- Success responses (200, 201, etc.) with schema definitions
- Error responses (400, 401, 404, 500) with error schema
- Content-Type specifications
- Realistic example values
5. **Components Section**
- Reusable schemas for request/response models
- Security schemes (Bearer token, API key, etc.)
- Common parameter definitions
## Requirements
- Generate valid OpenAPI 3.0.3 YAML that passes validation
- Use proper JSON Schema for all data models
- Include realistic example values, not placeholders
- Define reusable components to avoid duplication
- Add appropriate data validation (required fields, formats, constraints)
- Include security requirements where applicable
Focus on: ${input:endpoint_focus:Which specific endpoint or endpoints should be documented?}
Generate production-ready OpenAPI specification that can be used with Swagger UI, Postman, and code generators.
---
agent: 'agent'
description: 'Generate OpenAPI 3.0 specification for API endpoints'
---
## Task
Analyze the API endpoint code and generate a valid OpenAPI 3.0 specification in YAML format.
## OpenAPI Structure
Generate a complete OpenAPI spec including:
1. **OpenAPI Header**
- OpenAPI version (3.0.3)
- API info (title, description, version)
- Server configuration
2. **Path Definitions**
- HTTP method and path
- Operation summary and description
- Tags for organization
3. **Parameters Schema**
- Path parameters with type validation
- Query parameters with constraints and defaults
- Request body schema using proper JSON Schema
- Required vs optional parameters
4. **Response Schemas**
- Success responses (200, 201, etc.) with schema definitions
- Error responses (400, 401, 404, 500) with error schema
- Content-Type specifications
- Realistic example values
5. **Components Section**
- Reusable schemas for request/response models
- Security schemes (Bearer token, API key, etc.)
- Common parameter definitions
## Requirements
- Generate valid OpenAPI 3.0.3 YAML that passes validation
- Use proper JSON Schema for all data models
- Include realistic example values, not placeholders
- Define reusable components to avoid duplication
- Add appropriate data validation (required fields, formats, constraints)
- Include security requirements where applicable
Focus on: ${input:endpoint_focus:Which specific endpoint or endpoints should be documented?}
Generate production-ready OpenAPI specification that can be used with Swagger UI, Postman, and code generators.
이 프롬프트 파일을 사용하는 방법
- 위의 콘텐츠를
.github/prompts폴더에document-api.prompt.md로 저장합니다. - Visual Studio Code에서 Copilot 채팅 보기를 표시하고
/document-api를 입력합니다. 선택적으로, 예를 들어endpoint_focus=GET /activities를 입력하여 어떤 특정 엔드포인트에 대한 문서를 원하는지 지정할 수도 있습니다.
데이터 재사용 가능한.copilot.프롬프트-파일-추가-읽기 %}