cancel
Showing results for 
Search instead for 
Did you mean: 

how we can document for the same api which is having two diffrent ussage .

Occasional Visitor

how we can document for the same api which is having two diffrent ussage .

Hi SwaggerHub team,

 

i have an api to login, i am using same api to get login using OTP .

           same api i am using to get login using MPIN by changing parameters with same URL.

when i create a document i am unable to access that api  in UI part and getting  an warning as "definition was declared but never used in document' in editor section

 

screen shot is attached below 

can you guide me how can i document it .

as below mentioned i am passing values with same Post method using same URL :  

      http://ip/path/login

Login_with_OTP_Request:
title: Login_with_OTP_Request
example:
mobileNum: '8888888888'
otp: '123456'
type: object
properties:
mobileNum:
type: string
otp:
type: string
required:
- mobileNum
- otp
Login_with_MPIN_Request:
title: Login_with_MPIN_Request
example:
mobileNum : '8888888888'
mpin : '1234'
type: object
properties:
mobileNum:
type: string
mpin:
type: string
required:
- mobileNum
- mpin

 

 

1 REPLY 1
Community Manager

Re: how we can document for the same api which is having two diffrent ussage .

Hi @Dharma_Teja,

 

If you are using OpenAPI 3.x, you can look at using oneOf. Here is an example:

paths:
  /login:
    post:
      #...
      responses:
        201:
          application/json:
            content:
              schema:
                oneOf:
                - '#/components/schemas/one'
                - '#/components/schemas/two'

If this doesn't help, could you please share the entire definitions?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements