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

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

Closed
Riduidel opened this issue Nov 16, 2016 · 3 comments
Closed

Comments

@Riduidel
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Member

@barjoWDYT ?

Riduidel added a commit to Riduidel/wisdom that referenced this issue Nov 16, 2016
Riduidel added a commit to Riduidel/wisdom that referenced this issue Nov 16, 2016
… be referenced in annotation.

The following are supported :
 - direct field access
 - access to field declared in an inner class or interface
The following are not supported
 - access to field declared in another class, even if in the same package
 - access to a class defined from an expression (which can't happen, but is nevertheless considered as valid by javaparser)
@barjo
Copy link
Member

barjo commented Nov 27, 2016

Sorry I missed that one

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

3 participants