Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint does not appear correctly. #32

Open
CassioFerreiraRod opened this issue Jun 18, 2024 · 1 comment
Open

Endpoint does not appear correctly. #32

CassioFerreiraRod opened this issue Jun 18, 2024 · 1 comment

Comments

@CassioFerreiraRod
Copy link

Hello, our endpoints that have parameters are not being recognized by the plugin.
ex
My controller:
@apidoc(tag = {
description "Test API"
})
class TesteController {
static responseFormats = ['json', 'xml']

@ApiDoc(operation = {
    summary "Test"
    description "Teste de swagger"
    parameters([{
                    name "s"
                    description "Texto qualquer"
                    inType "path"
                    schema { "string" }
                }])
    responses "200": {
        content "application/json": {
            description "success response"
            schema {
                name "Resposta"
                type "string"
                description "Texto digitado"
            }
        }
    }
})
def teste(String s) {
    render([text: s]as JSON)
}

}

My url mappings:
class UrlMappings {

static mappings = {
    delete "/$controller/$id(.$format)?"(action: "delete")
    get "/$controller(.$format)?"(action: "index")
    get "/$controller/$id(.$format)?"(action: "show")
    post "/$controller(.$format)?"(action: "save")
    put "/$controller/$id(.$format)?"(action: "update")
    patch "/$controller/$id(.$format)?"(action: "patch")

    get "/test/$s"(controller: "teste", action: "teste")
    
    "500"(view: '/error')
    "404"(view: '/notFound')
}

}

@yangbo
Copy link
Owner

yangbo commented Jun 25, 2024

Hi, thanks for report, I have tried to reproduce the issue but have not your issue.

Maybe you can try these:

  1. reboot your app and see if the issue resolved.
  2. change the typo of
@apidoc(tag = {
description "Test API"
})
class TesteController

to

@Apidoc(tag = {
description "Test API"
})
class TesteController
  1. You can move your controller and url-mapping to 'swagger-grails4-samples' project and see if there is the issue.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants