I am using Swagger Editor locally in my machine.
When I start the Swagger Editor, it shows the spec for petstore by default at startup.
I want to remove that and show a blank editor. Is there a way to do that at startup.
You can disable OpenAPI docs by setting openapi_url to an empty string.
title: Swagger Petstore - OpenAPI 3.0. description: |- This is a sample Pet Store Server based on. the OpenAPI 3.0 specification.
To set up Swagger with Spring, we define it in a configuration bean. By default, this configuration bean is always injected into our Spring context. Thus, Swagger becomes available for all environments. To disable Swagger in production, let's toggle whether this configuration bean is injected.
The generated document describing the endpoints appears as shown in OpenAPI specification (openapi. json). The Swagger UI can be found at https://localhost:<port>/swagger .
A simple workaround is to run the editor with the ?url=
parameter where the URL points to an empty page (no HTTP response body), such as http://httpbin.org/status/200.
http://editor.swagger.io/?url=http://httpbin.org/status/200
This will open a blank editor.
Alternatively, you can modify the editor's source code and build your own version. You will need Node.js 6.x and npm 3.x (as of time of this writing).
The default editor contents seems to be set here: https://github.com/swagger-api/swagger-editor/blob/master/src/plugins/local-storage/index.js#L29
In src\plugins\local-storage\index.js
, replace
import PetstoreYaml from "./petstore"
with
const PetstoreYaml = ""
Rebuild the editor:
npm run build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With