From 687d31d3f1ea0d4527aea41a52fb4005a20f3940 Mon Sep 17 00:00:00 2001 From: akhdanre Date: Fri, 21 Mar 2025 00:54:44 +0700 Subject: [PATCH] feat: setup swagger for documentation --- docs/rest_api_docs.yaml | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 docs/rest_api_docs.yaml diff --git a/docs/rest_api_docs.yaml b/docs/rest_api_docs.yaml new file mode 100644 index 0000000..93e5fb1 --- /dev/null +++ b/docs/rest_api_docs.yaml @@ -0,0 +1,95 @@ +openapi: 3.0.4 +info: + title: Quiz Maker API + description: API documentation for Quiz App + version: 1.0.0 + +servers: + - url: http://api.example.com/v1 + description: Optional server description, e.g. Main (production) server + - url: http://127.0.0.1:5000/api + description: local server + +paths: + /login: + post: + summary: Login + description: Login to the application + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "oukenzeumasio@gmail.com" + password: + type: string + example: "rahasia" + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + token: + type: string + example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6Im91a2VuemV1bWFzaW9AZ21haWwuY29tIiwiZXhwIjoxNjIwNzQwNjY3LCJlbWFpbCI6Im91a2VuemV1bWFzaW9AZ21haWwuY29tIn0.7" + "400": + description: Bad Request + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Invalid email or password" + /register: + post: + summary: Register + description: Register to the application + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "oukenzeumasio@gmail.com" + password: + type: string + example: "rahasia" + name: + type: string + example: "Oukenze" + birth_date: + type: string + example: "09-09-1999" + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "User created successfully" + "409": + description: Bad Request + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Email already registered"