Django REST Swagger在哪里生成模式文件?

时间:2022-10-16 19:35:03

I want to modify the Swagger documentation generated by Django REST Swagger. I'd like to find the API definition or schema file(s) that Django REST Swagger generates. I haven't been able to find those files.

我想修改Django REST Swagger生成的Swagger文档。我想找到Django REST Swagger生成的API定义或模式文件。我一直无法找到这些文件。

Is there something like a YAML or JSON file generated when Django REST Swagger creates API documentation?

当Django REST Swagger创建API文档时,是否会生成类似YAML或JSON文件的内容?

Where can I find that file on the server?

我在哪里可以在服务器上找到该文件?

Thanks!

谢谢!

1 个解决方案

#1


0  

There is no static files on the server.

服务器上没有静态文件。

Swagger generates the documentation based on rest-framework internal schema representation.

Swagger基于rest-framework内部模式表示生成文档。

So if you want to change the representation, you should replace swagger templates or js files. If you want to change the content of the documentation(some kind of string replacements etc.) you should preprocess schemas object before render in your schema_view.

因此,如果要更改表示,则应替换swagger模板或js文件。如果要更改文档的内容(某种字符串替换等),则应在schema_view中进行渲染之前预处理模式对象。

#1


0  

There is no static files on the server.

服务器上没有静态文件。

Swagger generates the documentation based on rest-framework internal schema representation.

Swagger基于rest-framework内部模式表示生成文档。

So if you want to change the representation, you should replace swagger templates or js files. If you want to change the content of the documentation(some kind of string replacements etc.) you should preprocess schemas object before render in your schema_view.

因此,如果要更改表示,则应替换swagger模板或js文件。如果要更改文档的内容(某种字符串替换等),则应在schema_view中进行渲染之前预处理模式对象。