firecamp-io / firecamp

VSCode for APIs, Postman Alternative.
https://firecamp.dev
317 stars 22 forks source link

[Request] create collection from asyncapi / openapi specification #200

Open pavlikm opened 2 years ago

pavlikm commented 2 years ago

I have many big projects, with many endpoints. Some are webscockets, some are REST, and I can generate openapi / asyncapi documentation for them. Problemm is, when I change something (changed payload, new endpoint), I need to update it in firecamp collection manually. It would be great, if I could import openapi yml file directly to firecamp

Nishchit14 commented 2 years ago

@pavlikm Here I can see a huge opportunity with this intelligence feature. but It'll come up with more complexity too. Should we discuss the one simple end-to-end use case here to get started? I really appreciate your contribution :)

pavlikm commented 2 years ago

@Nishchit14 just upload yml file in upload dialog, take examples from given openapi yml file (if provided, or generate custom payloads by properties types) and build collections with endpoints from this openapi. Possibly use URL to swagger in import dialog. image

You can inspire with postman where this feature works:

postman-openpapi
Nishchit14 commented 2 years ago

I think this feature is already available in Firecamp @pavlikm. please review the below GIF. You can import Firecamp, Postman, Insomnia, OpenAPI), and HAR format there. please try it and let me know your experience with it :), I am sure we need to improve it with higher DX.

import-openapi-spec

pavlikm commented 2 years ago

@Nishchit14 for swagger example petshop openapi it works perfectly. But for my asyncapi it creates only empty collection. Here is example asyncApi for test:

---
asyncapi: 2.1.0
info:
  title: test
  description: Some description for test api
  version: '1.0'
  contact: {}
servers:
  test:
    url: https://test.com/
    protocol: socket.io
    protocolVersion: '4'
    description: test description
    bindings: {}
components:
  schemas:
    getTestRequest:
      type: object
      properties:
        limit:
          type: number
    getTestResponse:
      type: object
      properties:
        status:
          type: boolean
defaultContentType: application/json
channels:
  getTest:
    publish:
      summary: request to getTest
      message:
        name: getTest
        payload:
          "$ref": "#/components/schemas/getTestRequest"
    subscribe:
      summary: response of test
      message:
        name: getTest
        payload:
          "$ref": "#/components/schemas/getTestResponse"
Nishchit14 commented 2 years ago

Thank you for sharing this snippet @pavlikm, I think you're trying to import AsyncAPI format. The latest version of it is yet to support in Firecamp. This snippet would help me to review the latest AsyncAPI format support in Firecamp :)