File size: 6,457 Bytes
acd8e16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
cases:
  - id: "openapi_spec"
    question: "Create OpenAPI 3.0 specification for a user management API"
    reference_doc: |
      openapi: 3.0.0
      info:
        title: User Management API
        version: 1.0.0
        description: API for managing users
      servers:
        - url: https://api.example.com/v1
      paths:
        /users:
          get:
            summary: List all users
            responses:
              '200':
                description: List of users
                content:
                  application/json:
                    schema:
                      type: array
                      items:
                        $ref: '#/components/schemas/User'
          post:
            summary: Create a new user
            requestBody:
              required: true
              content:
                application/json:
                  schema:
                    $ref: '#/components/schemas/UserInput'
            responses:
              '201':
                description: User created
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/User'
        /users/{id}:
          get:
            summary: Get user by ID
            parameters:
              - name: id
                in: path
                required: true
                schema:
                  type: integer
            responses:
              '200':
                description: User details
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/User'
      components:
        schemas:
          User:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
              email:
                type: string
                format: email
          UserInput:
            type: object
            required:
              - name
              - email
            properties:
              name:
                type: string
              email:
                type: string
                format: email
    difficulty: "hard"
    description: "OpenAPI specification"
    
  - id: "graphql_schema"
    question: "Create GraphQL schema for a blog system with posts and comments"
    reference_doc: |
      type Query {
        posts: [Post!]!
        post(id: ID!): Post
        comments(postId: ID!): [Comment!]!
      }
      
      type Mutation {
        createPost(input: PostInput!): Post!
        createComment(input: CommentInput!): Comment!
        updatePost(id: ID!, input: PostInput!): Post!
        deletePost(id: ID!): Boolean!
      }
      
      type Post {
        id: ID!
        title: String!
        content: String!
        author: User!
        comments: [Comment!]!
        createdAt: String!
        updatedAt: String!
      }
      
      type Comment {
        id: ID!
        content: String!
        author: User!
        post: Post!
        createdAt: String!
      }
      
      type User {
        id: ID!
        name: String!
        email: String!
        posts: [Post!]!
        comments: [Comment!]!
      }
      
      input PostInput {
        title: String!
        content: String!
        authorId: ID!
      }
      
      input CommentInput {
        content: String!
        authorId: ID!
        postId: ID!
      }
    difficulty: "medium"
    description: "GraphQL schema definition"
    
  - id: "rest_endpoints"
    question: "Document REST API endpoints for an e-commerce product catalog"
    reference_doc: |
      # Product Catalog API
      
      ## Base URL
      `https://api.store.com/v1`
      
      ## Authentication
      All endpoints require authentication via Bearer token:
      ```
      Authorization: Bearer <your-token>
      ```
      
      ## Endpoints
      
      ### GET /products
      Retrieve a list of products with optional filtering and pagination.
      
      **Query Parameters:**
      - `category` (string, optional): Filter by product category
      - `min_price` (number, optional): Minimum price filter
      - `max_price` (number, optional): Maximum price filter
      - `page` (integer, optional): Page number (default: 1)
      - `limit` (integer, optional): Items per page (default: 20, max: 100)
      
      **Response:**
      ```json
      {
        "products": [
          {
            "id": "prod_123",
            "name": "Wireless Headphones",
            "description": "High-quality wireless headphones",
            "price": 99.99,
            "category": "Electronics",
            "in_stock": true,
            "images": ["https://example.com/img1.jpg"]
          }
        ],
        "pagination": {
          "page": 1,
          "limit": 20,
          "total": 150,
          "pages": 8
        }
      }
      ```
      
      ### GET /products/{id}
      Retrieve a specific product by ID.
      
      **Path Parameters:**
      - `id` (string, required): Product ID
      
      **Response:**
      ```json
      {
        "id": "prod_123",
        "name": "Wireless Headphones",
        "description": "High-quality wireless headphones with noise cancellation",
        "price": 99.99,
        "category": "Electronics",
        "in_stock": true,
        "stock_quantity": 50,
        "images": ["https://example.com/img1.jpg", "https://example.com/img2.jpg"],
        "specifications": {
          "battery_life": "20 hours",
          "connectivity": "Bluetooth 5.0",
          "weight": "250g"
        }
      }
      ```
      
      ### POST /products
      Create a new product (Admin only).
      
      **Request Body:**
      ```json
      {
        "name": "New Product",
        "description": "Product description",
        "price": 49.99,
        "category": "Electronics",
        "stock_quantity": 100,
        "images": ["https://example.com/img.jpg"]
      }
      ```
      
      **Response:** `201 Created`
      ```json
      {
        "id": "prod_456",
        "name": "New Product",
        "description": "Product description",
        "price": 49.99,
        "category": "Electronics",
        "in_stock": true,
        "stock_quantity": 100,
        "images": ["https://example.com/img.jpg"],
        "created_at": "2023-12-01T10:00:00Z"
      }
      ```
    difficulty: "hard"
    description: "Comprehensive REST API documentation"