Skip to main content

Auto-Fixing an API Workspace

Auto-fixing, as the name suggests, can help facilitate you by resolving some common issues in your API definition automatically. For example, OpenAPI and other popular API specification formats aren't inherently designed for code generation and therefore it is quite common to see inline schemas in API definitions. Inline schemas negatively impact the output quality of the generated SDKs/Developer Experience Portals. However, most users aren't familiar with them and may have trouble tackling them efficiently. This is where auto-fixing can help as it can easily convert such schemas into global schemas by intelligently assigning unique but meaningful names to them. After auto-fixing has completed, users will have full control to refine the names as they wish. Similarly, auto-fixing can help resolve other common issues as well.

Auto-Fix

By default, the auto-fix process runs for the whole API workspace and tries to resolve as many supported issues as possible. Support for auto-fixing specific issues based on user preference will be added in the future.

Pre-Requisites

Auto-fixing requires the following:

  • The API definition has been validated at least once.

  • None of your API definition files contain basic JSON/YAML syntax errors. If errors are found, the auto-fix may not proceed further or quit with the following message pop-up:

    Auto-Fix Fail

Auto-Fixing Your API Workspace

To begin auto-fixing your API workspace, you need to click the (💡) icon from the left side of the status bar:

Auto-Fix Button

The auto-fix process will start in the background after verifying that the validation process has occurred. While the auto-fixing is running, you should see a Auto-fixing... message in the status bar:

Auto-Fix Running

If your API definition contains issues that can't be auto-fixed or the auto-fixing fails, you will see the following message pop-up:

Auto-Fix Not Done

If the auto-fixing proceeds successfully, you should shortly start seeing live logs for the changes being made to the files including information of what was added/removed/updated and where:

Auto-Fix Logs

Once the auto-fix process completes, you will have the option to either save or undo all the changes made:

Auto-Fix Completed

At this point you can review the logs to make your decision and proceed accordingly. If you choose to save all changes, the workspace will be re-validated and issues fixed will be removed from the validation list.

Rules Supported for Auto-Fixing

Depending upon the use-cases, auto-fixing may support automatically resolving issues associated with the following rules only:

This list will be updated as more and more rules are supported for auto-fixing.