Hinweis
- Copilot-Promptdateien befinden sich in der öffentliche Vorschau. Änderungen sind vorbehalten. Promptdateien sind nur in VS Code, Visual Studio und JetBrains-IDEs verfügbar. Siehe Informationen zum Anpassen der GitHub Copilot-Antworten.
- Beispiele für von der Community bereitgestellte Promptdateien für bestimmte Sprachen und Szenarios findest du im Repository Großartige GitHub Copilot-Anpassungen.
Diese Promptdatei generiert durch die Analyse deines API-Codes und das Erstellen einer standardisierten, maschinenlesbaren Dokumentation OpenAPI 3.0-Spezifikationen für REST-API-Endpunkte.
Prompt für die OpenAPI-Spezifikation
---
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.
Anleitung zur Verwendung dieser Promptdatei
- Speichern Sie den obigen Inhalt als
document-api.prompt.mdim Ordner.github/prompts. - Zeige in Visual Studio Code die Copilot-Chat-Ansicht an, und gib
/document-apiein. Optional kannst du ebenfalls angeben, für welchen bestimmten Endpunkt du die Dokumentation benötigst, indem du z. B.endpoint_focus=GET /activitieseingibst.
Weitere Informationen
-
[Verwenden von Promptdateien in Visual Studio Code](https://code.visualstudio.com/docs/copilot/customization/prompt-files) in der Visual Studio Code-Dokumentation: Informationen zum Erstellen und Verwenden von Promptdateien -
[AUTOTITLE](/copilot/concepts/response-customization): Übersicht über die Anpassung von Antworten in GitHub Copilot -
[Großartige GitHub Copilot-Anpassungen](https://github.com/github/awesome-copilot/blob/main/docs/README.prompts.md): Repository der durch die Community bereitgestellten benutzerdefinierten Promptdateien und weiterer Anpassungen für bestimmte Sprachen und Szenarios