Explorar el Código

Add http responses to docs

Lee Morgan hace 1 mes
padre
commit
7d3fa4682a

+ 14 - 0
docs/components/responses/400.yaml

@@ -0,0 +1,14 @@
+description: Bad Request
+content:
+  application/json:
+    schema:
+      type: object
+      properties:
+        code:
+          type: number
+          description: HTTP response code
+          example: 400
+        message:
+          type: string
+          description: Message describing the error
+          example: "Json deserialize error: invalid type: map, expected a string at line 3 column 13"

+ 14 - 0
docs/components/responses/401.yaml

@@ -0,0 +1,14 @@
+description: Unauthorized
+content:
+  application/json:
+    schema:
+      type: object
+      properties:
+        code:
+          type: number
+          description: HTTP response code
+          example: 401
+        message:
+          type: string
+          description: Message describing the error
+          example: Unauthorized user

+ 14 - 0
docs/components/responses/403.yaml

@@ -0,0 +1,14 @@
+description: Forbidden
+content:
+  application/json:
+    schema:
+      type: object
+      properties:
+        code:
+          type: number
+          description: HTTP response code
+          example: 403
+        message:
+          type: string
+          description: Message describing the error
+          example: Unauthorized access

+ 14 - 0
docs/components/responses/404.yaml

@@ -0,0 +1,14 @@
+description: Not Found
+content:
+  application/json:
+    schema:
+      type: object
+      properties:
+        code:
+          type: number
+          description: HTTP response code
+          example: 404
+        message:
+          type: string
+          description: Message describing the error
+          example: User with this ID not found

+ 14 - 0
docs/components/responses/500.yaml

@@ -0,0 +1,14 @@
+description: Internal Server Error
+content:
+  application/json:
+    schema:
+      type: object
+      properties:
+        code:
+          type: number
+          description: HTTP response code
+          example: 500
+        message:
+          type: string
+          description: Message describing the error
+          example: Internal server error

+ 11 - 0
docs/openapi.yaml

@@ -15,3 +15,14 @@ components:
   schemas:
     User:
       $ref: "./components/schemas/user.yaml"
+  responses:
+    "400":
+      $ref: "./components/responses/400.yaml"
+    "401":
+      $ref: "./components/responses/401.yaml"
+    "403":
+      $ref: "./components/responses/403.yaml"
+    "404":
+      $ref: "./components/responses/404.yaml"
+    "500":
+      $ref: "./components/responses/500.yaml"