Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are a few steps to follow in order to remove API schemas from Swagger UI and save them as JSON in a separate file:

  1. Open the swagger.json file in a text editor or Swagger Editor.

  2. Identify the schemas that you want to remove from Swagger UI and save as a separate file.

  3. Copy the schema object and its properties to a new JSON file.

  4. Save the new file with a descriptive name, such as "schema-file.json".

  5. In the original swagger.json file, replace the schema object with a $ref to the new file. For example, if the schema object was originally defined as:

    "MySchema": { "type": "object", "properties": { "name": { "type": "string" } } }

    You would replace it with:

    "MySchema": { "$ref": "schema-file.json#/MySchema" }

  6. Save the modified swagger.json file.

  7. Test the API to ensure that the changes do not affect its functionality.

By following these steps, you can remove API schemas from Swagger UI and save them as JSON in a separate file for better organization and easier management.