Skip to content

v5.0.0-alpha.91

Pre-release
Pre-release
Compare
Choose a tag to compare
@swagger-bot swagger-bot released this 29 Mar 08:27
· 137 commits to next since this release

5.0.0-alpha.91 (2024-03-29)

Breaking changes

AsyncAPI preview plugin

AsyncAPI preview plugin now uses @asyncapi/parser v3 instead of v1. The way, how we pass options to the AsyncAPI parser changed.

editorPreviewAsyncAPI.actions.parse FSA creator now accepts options objects in a shape of { parserOptions, parseOptions } as a second argument. parserOptions are passed to the parser constructor during the parser creation and parseOptions are passed to parse function during the parsing.

Here is an example how to override how AsyncAPI parser resolves HTTP(S) URLs:

const AsyncAPIParseOptionsPlugin = () => ({
  statePlugins: {
    editorPreviewAsyncAPI: {
      wrapActions: {
        parse:
          (oriAction) =>
          (content, options = {}) => {
            const httpsFetchResolver = {
              schema: 'https',
              canRead: true,
              async read(uri) {
                const response = await fetch(uri.toString());
                return response.text();
              },
            };
            const httpFetchResolver = {
              schema: 'http',
              canRead: true,
              async read(uri) {
                const response = await fetch(uri.toString());
                return response.text();
              },
            };

            const parserOptions = {
              ...options.parserOptions,
              __unstable: {
                resolver: {
                  resolvers: [httpsFetchResolver, httpFetchResolver],
                },
              },
            };
            const parseOptions = options.parseOptions ?? {};

            return oriAction(content, { parserOptions, parseOptions });
          },
      },
    },
  },
});

Webpack configuration changes

Important

Instructions for building SwaggerEditor@5 with webpack@5 have changed.

Handling process with imports-loader it no longer necessary.

To avoid runtime errors, alias for @stoplight/ordered-object-literal needs to introduced. Please consult the amended Usage section of the main README file for more details.

Features

Performance Improvements

  • language-apidom: fix perf regression in reference validation (#4885) (99af87f)