geowave icon indicating copy to clipboard operation
geowave copied to clipboard

Explicit Main Parameters for REST

Open rfecher opened this issue 6 years ago • 0 comments

Currently, we are describing all main parameters with a convention that allows us to determine what individual expected parameters are, and if they are a list. The convention is something like <param1> <comma separated list of param2> which corresponds to something like { param1, param2[] } Alternatively, we could just use our own annotation on the List member variable for main parameters that is more explicit than using the description, and generate the appropriate description from that. For example this is an annotation we could use:

@Retention(RetentionPolicy.RUNTIME)
@Target({
	ElementType.FIELD
})
public @interface MainParameters {
	MainParameter[] value();
	
	@Retention(RetentionPolicy.RUNTIME)
	@Target({
		ElementType.FIELD
	})
	public static @interface MainParameter {
		String value();

		boolean list() default false;
	}
}

and then the main parameters could be:

	@MainParameters({
		@MainParameter("param1"),
		@MainParameter(value="param2",list=true)
	})
	private List<String> parameters = new ArrayList<String>();

which would be more explicit for interpretation by the REST services instead of:

@Parameter(description = "<param1> <comma separated list of param2>")

rfecher avatar Sep 20 '17 20:09 rfecher