0

we have a back-end system written in Django rest framework we used swagger docs by writing YAML files in separated files for each part, know we are migrating to postman and due the YAML files are separated I cant import them to postman.

    swagger: "2.0"
info:
  description: "this is the swagger documentation for Petemoon project's APIs"
  version: "1.0.0"
  title: "Petemoon API"
host: "api.petemoon.com"
basePath: "/"
schemes:
  - "http"
  - "https"
  
paths:
  /accounts/otp:
    $ref: "./accounts/send_otp.yaml"
  /accounts/otp/verify:
    $ref: "./accounts/verify_otp.yaml"
  /accounts/refresh:
    $ref: "./accounts/refresh.yaml"
  /accounts/register:
    $ref: "./accounts/register.yaml"
  /accounts/register/petshop:
    $ref: "./accounts/register_petshop.yaml"
  /accounts/logout:
    $ref: "./accounts/logout.yaml"

we have one schema file like this and the api's are like this in files

post:
  tags:
    - "accounts"
  summary: "Send OTP to user's phone number"
  description: ""
  operationId: "send_otp"
  consumes:
    - "application/json"
  produces:
    - "application/json"
  parameters:
    - in: "body"
      name: "body"
      description: "Phone number to send OTP to"
      required: true
      schema:
        $ref: "#/definitions/Request"
  responses:
    200:
      description: "OTP sent successfully"
      schema:
        $ref: "#/definitions/Success"
    400:
      description: "Invalid phone number"
      schema:
        $ref: "#/definitions/InvalidPhoneNumber"

1 Answers1

0

I found a solution that work

npm install speccy -g

speccy resolve schema.yaml -o spec-output.yaml