2015-01-13 229 views
1

我是新來的招搖。在本地運行的Swagger編輯器顯示空白頁面

我已經在django-rest-framework中創建了API。我想記錄它們。因此閱讀關於招搖。

我試過django-rest-swagger,但由於缺少文檔,我無法讓我的代碼適合文檔。 因此,我正在嘗試swagger編輯器,它將允許我從頭開始設計API結構。我已經在本地安裝了它,但它在「127.0.0.1:9000」顯示空白頁面。我現在應該怎麼做 ?

我想編寫YAML或JSON文件,這個文件將被本地安裝的swagger-editor使用。我怎樣才能做到這一點?

這是在控制檯上的錯誤,當我加載127.0.0.1:9000

Warn: could not find module util 
http://127.0.0.1:9000/bower_components/angular-schema-form/dist/schema-form.js Failed to load resource: the server responded with a status of 404 (Not Found) 
angular.js:80 Uncaught Error: [$injector:nomod] Module 'schemaForm' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
http://errors.angularjs.org/1.3.2/$injector/nomod?p0=schemaForm 
angular.js:80 Uncaught Error: [$injector:modulerr] Failed to instantiate module PhonicsApp due to: 
Error: [$injector:modulerr] Failed to instantiate module schemaForm due to: 
Error: [$injector:nomod] Module 'schemaForm' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
+2

一些評論:Swagger編輯器不會消耗YAML/JSON,它會產生它。另外,如果您對編輯器有任何問題,最好直接在存儲庫上打開問題。最後,你現在可以在http://editor.swagger.io上使用在線編輯器。 – Ron

+0

是的,在線編輯器是一種解決方案,但有什麼辦法,以便我可以在我的登臺服務器上做文檔,因爲我需要將其暴露給第三方..任何建議? – Pranav

+0

即使您在本地使用編輯器,您也需要導出JSON並將其託管到某處,因此這兩者不相關。 – Ron

回答

0

我並不完全相信這是問題。作爲一般說明,您可以始終清理npm和Bower模塊,並再次從乾淨狀態啓動。

npm cache clean 
rm -rf node_modules 
npm install 
bower cache clean 
rm -rf app/bower_components 
bower install 
npm start 
+0

感謝您的時間,目前不能測試此代碼,但是肯定我會嘗試。 – Pranav

+0

這裏仍然是空白頁面。空白和白色。試過你的解決方案,但仍然是空白。有任何想法嗎?並且涼亭安裝說「涼亭ENOENT沒有bower.json禮物」 – momokjaaaaa

0

我遇到了同樣的問題。
以前我的節點版本是最新的V6
我重新安裝了一切,然後安裝v4.4.4

node --v 

確保它的v4.4.4

npm install -g http-server 

wget https://github.com/swagger-api/swagger-editor/releases/download/v2.10.1/swagger-editor.zip 

unzip swagger-editor.zip 

http-server 

不使用HTTP服務器swagger-編輯