nerdErg / swagger4jaxrs

This is a Grails plugin that adds Swagger support to document REST APIs of any Grails projects that use the Grails JAX-RS (JSR 311) plugin.
Apache License 2.0
10 stars 10 forks source link

Some Informations abouts what to fill in ressourcePackage and basePath #22

Closed bocaralpha closed 8 years ago

bocaralpha commented 8 years ago

I'm a beginner in swagger and i use it as a Grails plugin

In order to know what to fill in ressourcePackage and basePath i have two questions:

Should i create a specific controller named ''api'' which will fetch my json file ? When i generate my json where i should stock it in my project ?

*Below the swagger configuration in my config.groovy***** swagger4jaxrs { resourcePackage = 'ppf' basePath = "http://localhost:8080/ppf/api" ?: '' version = '1' title = 'ppf' description = 'Portail de paiement de facture' contact = '' license = '' licenseUrl = '' scan = true }

aruizca commented 8 years ago

Hi @bocaralpha,

I am sorry but I don't know how to provide more info than the one is already there:

    resourcePackage = '<package with your resources>'
    basePath = "${grailsApplication.config.grails.serverURL}/api"

You don't need to create any controller. You just need to provide the context path Your "resources" refer to the JAX-RS controllers which should be under a package name: eg: com.yourcompany.app.resources

bocaralpha commented 8 years ago

is it necessary to annotate my methods to make it works ? Because i use swagger.io to edit and generate the json file and i place it in folder located in /ppf/assets/javascripts/swagger.json

When i hit this url: http://localhost:8080/ppf/showRestApi i see only the header without the body

I use asset-pipeline plugin for managing my ressources, and all my controllers except few are scaffolded. does it compatible with the requirement of the plugin?

* below my swagger config** swagger4jaxrs { resourcePackage = 'ppf' basePath = "${grailsApplication.config.grails.serverURL}/api" ?: '' version = '1' title = 'ppf' description = 'Portail de paiement de facture' contact = '' license = '' licenseUrl = '' scan = true }

aruizca commented 8 years ago

I am sorry mate, but I think this plugin is not for you. As this plugin name suggests (swagger4jaxrs), its purpose is to dynamically generate the swagger compliant json file from your JAX-RS based REST endpoints and present it using swagger ui.

bocaralpha commented 8 years ago

ok forget swagger editor , you know if the plugin can generate documentation for each method for scaffolded classes?