wisdom-framework / wisdom

A modular and dynamic web framework
http://wisdom-framework.org
Apache License 2.0
88 stars 42 forks source link

wisdom-raml-plugin doesn't support route url described using constants #564

Closed Riduidel closed 7 years ago

Riduidel commented 7 years ago

I use to write my routes the following way (cause I'm fan of clearly separated informations)

public static interface Urls {
    public static final String MIME_MAPPINGS = "...";
}

@Route(method = HttpMethod.GET, uri = Urls.MIME_MAPPINGS)
public Result getMimeTypesMappgins() {
    //....
}

When doing so, wisdom-raml-maven-plugin generates the following RAML file

rls.MIME_MAPPING: 
    get: 
        description: |
            Get currently supported mime types (useful for page add/edit).
            The returned list may be altered depending upon supported applications

This is obviously incorrect. My understanding is that this plugin performs some source code parsing in order to get the javadoc. Unfortunatly, this parsing fails to read the constant I use in annotation. I guess it may be due to wisdom-source-model which ignore references to constants in annotations.

Riduidel commented 7 years ago

So, it seems the issue can be sourced to RouteMethodSourceVisitor#visit(NormalAnnotationExpr anno, ControllerRouteModel route). indeed, in this method, the switch statement, for "uri" value (as well as for others), uses the ExtractUtil#asString method which always consider its content to be string, even when it is a reference to another value.

cescoffier commented 7 years ago

@barjoWDYT ?

barjo commented 7 years ago

Sorry I missed that one