Open dsanchor opened 5 months ago
Open API Spec:
openapi: 3.0.3
info:
title: Basic Calculator API
version: 1.0.0
description: A simple calculator API that provides endpoints for basic arithmetic operations.
servers:
- url: http://localhost:8080
description: Local server
paths:
/add:
get:
summary: Add two numbers
description: Returns the sum of two numbers.
parameters:
- name: num1
in: query
required: true
description: The first number to add
schema:
type: number
- name: num2
in: query
required: true
description: The second number to add
schema:
type: number
responses:
'200':
description: The result of the addition
content:
application/json:
schema:
type: object
properties:
result:
type: number
description: The sum of the two numbers
/subtract:
get:
summary: Subtract two numbers
description: Returns the result of subtracting the second number from the first number.
parameters:
- name: num1
in: query
required: true
description: The number to subtract from
schema:
type: number
- name: num2
in: query
required: true
description: The number to subtract
schema:
type: number
responses:
'200':
description: The result of the subtraction
content:
application/json:
schema:
type: object
properties:
result:
type: number
description: The result of the subtraction
/multiply:
get:
summary: Multiply two numbers
description: Returns the product of two numbers.
parameters:
- name: num1
in: query
required: true
description: The first number to multiply
schema:
type: number
- name: num2
in: query
required: true
description: The second number to multiply
schema:
type: number
responses:
'200':
description: The result of the multiplication
content:
application/json:
schema:
type: object
properties:
result:
type: number
description: The product of the two numbers
/divide:
get:
summary: Divide two numbers
description: Returns the result of dividing the first number by the second number.
parameters:
- name: num1
in: query
required: true
description: The number to be divided
schema:
type: number
- name: num2
in: query
required: true
description: The number to divide by
schema:
type: number
responses:
'200':
description: The result of the division
content:
application/json:
schema:
type: object
properties:
result:
type: number
description: The result of the division
'400':
description: Bad request, for example, division by zero
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error message
components:
schemas:
ErrorResponse:
type: object
properties:
error:
type: string
description: Error message