loic911 / Rest-api-doc

MIT License
21 stars 32 forks source link

Display of rest Api Doc fails; pops up an Alert Box #8

Open lorrainp opened 10 years ago

lorrainp commented 10 years ago

In my browser: http://localhost:8080/MyApp/restApiDoc/index

The REST API Doc page appears.

In the entry field for the API URL: http://localhost:8080/MyApp/restApiDoc/api#

Press the Get Documentation Button

I get an Alert box with the following text:

The Page at localhost: Error [object Object] OK

loic911 commented 10 years ago

Have you launch the grails rest-api-doc command? Do you have a "restapidoc.json" file in your grails project directory?

What does this link show in your brower? A valid JSON? http://localhost:8080/MyApp/restApiDoc/api

lorrainp commented 10 years ago

Yes, I have launched the grails rest-api-doc command. The file restapidoc.json was created in my grails project directory.

JSON shown in my browser: { "basePath": "Fill with basePath config", "apis": [{ "methods": [{ "headers": [], "bodyobject": null, "jsondocId": "9f501107-197d-446d-a2c3-12f131292caa", "consumes": [], "response": { "mapKeyObject": "", "jsondocId": "eef0992c-7bdb-421f-9330-3bafc7ab8f12", "mapValueObject": "", "object": "sam cloud", "multiple": "Unknow" }, "pathparameters": [{ "jsondocId": "e8daf4bb-ce3e-45db-9d1d-933021a6e98b", "description": "The virtual simulator VM id", "name": "vmId", "allowedvalues": [], "format": "", "required": "true", "type": "string" }], "apierrors": [], "verb": "GET", "description": "Create a virtual simulator.", "queryparameters": [], "path": "/v1/{controller}/{id}?", "produces": ["application/json"], "methodName": "save" }], "jsondocId": "3d3d9728-1152-419c-97f1-fb39f64725ce", "description": "Methods to manage virtual simulators on DHCP server.", "name": "SimCtlServer API" }], "objects": [], "version": "0.1.1" }

Thanks!

loic911 commented 10 years ago

I try with your json and it works well.

May be an issue with external JS Lib (jqueyr,...) or security restriction (spring security,...).

Could you copy the browser console content? And check the browser network tab if a lib failed to be loaded.

Thanks

lorrainp commented 10 years ago

Hi. Unfortunately, I do not have the time to spend on solving this for now. I used an HTML editor to document my API. Tight schedule. Sorry.

mgeis commented 10 years ago

I got the same error. Opening the console, I see a lot of 404 errors for jsondoc javascript files. I do not see that these were created and added to my web-app directory. (also, those urls were for "localhost:8080/js/jsondoc..." -- note that this does not include the context name of the web app).

I figured out that the plugin does not generate documentation that's compatible with "named" applications. Once I set the context to "/", everything worked. Unfortunately, that's not a viable solution for me right now (I have multiple RESTful Grails apps running on one server).

Is there something I'm missing in configuring the application, or is this a bug?

dbk138 commented 9 years ago

I'm almost positive this issue and #12 are related/the same thing. Please see my comment in #12.

nishparikh commented 8 years ago

I see the same problem. http://localhost:8080/MyApp/restApiDoc/api shows the json, but http://localhost:8080/MyApp/restApiDoc/?doc_url=http://localhost:8080/MyApp/restApiDoc/api# gives an error box. In the grails log, I see that it is not able to create resource files ../target/work/tomcat/work/Tomcat/localhost/../grails-resources/css/jsondoc so I manually create those directories. Now I don't get an error box, but the RestAPIDoc web app doesn't appear. No errors in the grails log