Exporting specification
You can export the resulting documentation (OpenAPI 3.1.0) using the scramble:export
command:
This will create an api.json
file containing the specification of the default
API in the application’s root folder. You can customize the file path by providing the --path
option. For example, to save the file in public/api.json
:
If you have registered an API other than default
, you can specify the API using the --api
option:
Using the exported specification for docs UI
By default, Scramble generates the specification file every time you access the documentation.
You can opt out of this behavior by creating your own documentation UI route and passing the exported specification file to it.
If the file exists, this will render the documentation using the specification from that file. If the file does not exist, an error will be thrown.