{"meta":{"title":"문제 생성","intro":"공동 파일럿 채팅는 모든 필드를 수동으로 채우지 않고도 신속하게 문제를 만들 수 있습니다.","product":"GitHub Copilot","breadcrumbs":[{"href":"/ko/copilot","title":"GitHub Copilot"},{"href":"/ko/copilot/tutorials","title":"자습서"},{"href":"/ko/copilot/tutorials/copilot-chat-cookbook","title":"GitHub Copilot Chat 매뉴얼"},{"href":"/ko/copilot/tutorials/copilot-chat-cookbook/document-code","title":"문서 코드"},{"href":"/ko/copilot/tutorials/copilot-chat-cookbook/document-code/creating-issues","title":"문제 만들기"}],"documentType":"article"},"body":"# 문제 생성\n\n공동 파일럿 채팅는 모든 필드를 수동으로 채우지 않고도 신속하게 문제를 만들 수 있습니다.\n\n수동으로 문제를 만드는 데는 시간이 오래 걸릴 수 있습니다. 공동 파일럿 채팅를 사용하면 자연어에서 문제를 만들 수 있으며 프롬프트에 따라 제목, 본문, 레이블 및 기타 메타데이터를 자동으로 채웁니다.\n\n## 예제 시나리오\n\nAPI 서비스에서 작업 중이며 엔드포인트에 서버 쪽 유효성 `createUser` 검사를 추가해야 합니다. 문제를 수동으로 작성하는 대신 공동 파일럿 채팅를 사용하여 유효성 검사 미들웨어의 예제 구현을 포함하는 자세한 문제 설명을 생성합니다.\n\n다음 코드 조각은 유효성 검사가 추가되기 전에 경로의 `createUser` 현재 구현을 보여줍니다.\n\n```javascript\n// Route\napp.post('/users', validateCreateUser, (req, res) => {\n  const { username, email } = req.body;\n  // Simulate user creation\n  res.status(201).json({ message: 'User created', user: { username, email } });\n});\n```\n\n## 예시 프롬프트\n\n`In octo-org/octo-repo, create an issue to add server-side validation for the createUser API endpoint. Include an example of how to validate the request body using an existing middleware pattern. Label it with \"backend\" and \"enhancement\".`\n\n## 응답 예제\n\n> [!NOTE] 다음 응답이 예제입니다. 공동 파일럿 채팅 응답은 비결정적이므로 여기에 표시된 응답과 다른 응답을 얻을 수 있습니다.\n\n> [!NOTE] 다음 응답이 예제입니다. 공동 파일럿 채팅 응답은 비결정적이므로 여기에 표시된 응답과 다른 응답을 얻을 수 있습니다.\n프롬프트를 제출하면 공동 파일럿 채팅에서 설명에 따라 초안 문제를 만들고, 코드 스니펫을 포함합니다.\n\n```markdown\n## Problem\nThe `createUser` API endpoint currently lacks robust server-side validation for incoming requests. To ensure data integrity and security, we should validate the request body before proceeding with user creation.\n\n**Current API endpoint:**\n// Route\napp.post('/users', validateCreateUser, (req, res) => {\n  const { username, email } = req.body;\n  // Simulate user creation\n  res.status(201).json({ message: 'User created', user: { username, email } });\n});\n\n## Proposal\n- Add server-side validation for the request body using the existing middleware pattern.\n- Ensure required fields (`username`, `email`) are present and valid.\n- Return a 400 Bad Request response if validation fails.\n\n**Example (middleware pattern):**\nfunction validateCreateUser(req, res, next) {\n  const { username, email } = req.body;\n  if (!username || !email) {\n    return res.status(400).json({ error: 'Username and email are required.' });\n  }\n  // Additional validation logic here\n  next();\n}\n\napp.post('/users', validateCreateUser, (req, res) => {\n  // ...\n});\n\n## Acceptance Criteria\n- Server-side validation middleware is added to the `createUser` endpoint.\n- Request body is properly validated.\n- Appropriate error responses are returned for invalid requests.\n```"}