Skip to content

Install SwaggerEditor@5 with Vue3 #5152

@marcodarko

Description

@marcodarko

Is it possible to install SwaggerEditor@5 with Vue3?
I see the library exports a React Component, and I can't find any more information on the subject other than the github page.

We currently use v4 running it like this:

<script>
import SwaggerEditorBundle from 'swagger-editor';

export default {
  name: 'Editor',
  data: function () {
    return {
      apiID: '',
      smartStyle: true,
      context: {}
    };
  },
  methods: {
    loadSwaggerEditor: function (myUrl) {
      /* global SwaggerEditorStandalonePreset*/

      const editor = SwaggerEditorBundle({
        url: myUrl,
        dom_id: '#swagger-editor',
        layout: 'StandaloneLayout',
        deeplinking: true,
        presets: [SwaggerEditorStandalonePreset]
      });

      window.editor = editor;

      document
        .querySelector(".topbar a[href$='#']")
        .setAttribute('href', 'https://smart-api.info/registry');
    }
  },
....

</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions