Rest-api-doc icon indicating copy to clipboard operation
Rest-api-doc copied to clipboard

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

Open lorrainp opened this issue 10 years ago • 7 comments

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

lorrainp avatar Jul 09 '14 20:07 lorrainp

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

loic911 avatar Jul 10 '14 04:07 loic911

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!

lorrainp avatar Jul 10 '14 14:07 lorrainp

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

loic911 avatar Jul 13 '14 07:07 loic911

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.

lorrainp avatar Jul 14 '14 12:07 lorrainp

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?

mgeis avatar Aug 07 '14 20:08 mgeis

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

dbk138 avatar Sep 18 '14 19:09 dbk138

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

nishparikh avatar Oct 14 '15 21:10 nishparikh