You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Noble Paul (Jira)" <ji...@apache.org> on 2019/10/06 22:50:00 UTC

[jira] [Resolved] (SOLR-13787) An annotation based system to write v2 only APIs

     [ https://issues.apache.org/jira/browse/SOLR-13787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Noble Paul resolved SOLR-13787.
-------------------------------
    Fix Version/s: 8.3
                   master (9.0)
       Resolution: Fixed

> An annotation based system to write v2 only APIs
> ------------------------------------------------
>
>                 Key: SOLR-13787
>                 URL: https://issues.apache.org/jira/browse/SOLR-13787
>             Project: Solr
>          Issue Type: Sub-task
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Noble Paul
>            Assignee: Noble Paul
>            Priority: Major
>             Fix For: master (9.0), 8.3
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> example v2 API may look as follows
> {code:java}
> @V2EndPoint(method = POST, path = "/cluster/package", permission = PermissionNameProvider.Name.ALL)
> public static class ApiTest {
>   @Command(name = "add")
>   public void add(SolrQueryRequest req, SolrQueryResponse rsp, AddVersion addVersion) {
>   }
>   @Command(name = "delete")
>   public void del(SolrQueryRequest req, SolrQueryResponse rsp, List<String> names) {
>   }
> }
> public static class AddVersion {
>   @JsonProperty(value = "package", required = true)
>   public String pkg;
>   @JsonProperty(value = "version", required = true)
>   public String version;
>   @JsonProperty(value = "files", required = true)
>   public List<String> files;
> }
> {code}
> This expects you to already hava a POJO annotated with jackson annotations
>  
> The annotations are:
>  
> {code:java}
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ElementType.TYPE})
> public @interface EndPoint {
> /**The suoported http methods*/
>   SolrRequest.METHOD[] method();
> /**supported paths*/
>   String[] path();
>   PermissionNameProvider.Name permission();
> }
> {code}
> {code:java}
> @Retention(RetentionPolicy.RUNTIME)
> @Target(ElementType.METHOD)
> public @interface Command {
>    /**if this is not a json command , leave it empty.
>    * Keep in mind that you cannot have duplicates.
>    * Only one method per name
>    *
>    */
>   String name() default "";
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org