You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates InputStreamResponse and corresponding tests to wrap the
NamedList produced by InputStreamResponseParser. Modifies the codegen
mustache template to use this response type for any v2 APIs that are
tagged as producing 'rawOutput', including the zk-read and fetch-index-file
endpoints.
Copy file name to clipboardexpand all lines: dev-docs/v2-api-conventions.adoc
+23-2
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
= API Design
1
2
== HTTP Paths
2
3
3
4
Where possible, each v2 API is given an HTTP path that reflects the resource type and/or name most relevant to its functionality.
@@ -69,8 +70,8 @@ For use within the v2 API, the four "popular" HTTP methods have the following se
69
70
== Errors
70
71
71
72
v2 APIs should be consistent in how they report errors. Throwing a `SolrException` will convey
72
-
1.the error code as the HTTP response status code, as `responseHeader.status` and as `error.code`, and
73
-
1.the error message as `error.msg`.
73
+
1. The error code as the HTTP response status code, as `responseHeader.status` and as `error.code`, and
74
+
2. The error message as `error.msg`.
74
75
75
76
API calls that reference a specific resource (e.g. `specificCollName`, `specificAliasName`, `specificPropertyName` and others per the above list) that do not exist should return `SolrException.ErrorCode.NOT_FOUND` (HTTP 404).
76
77
@@ -82,3 +83,23 @@ Often these operations were initially conceived of as procedural "commands" and
82
83
83
84
Solr's v2 API currently accommodates these "command" APIs by appending the command name (often a verb like "unload", "reload", or "split") onto the otherwise "resource"-based path.
84
85
For example: Solr's core "unload" command uses the API `POST /api/cores/specificCoreName/unload`.
86
+
87
+
= JAX-RS Implementation Conventions
88
+
89
+
== Streaming
90
+
91
+
Solr has a number of APIs that return binary file data or other arbitrary content, such as the "replication" APIs used to pull index files from other cores.
92
+
Please use the following conventions when implementing similar endpoints:
93
+
1. `@Operation` annotations use an "extension property" to indicate to codegen tools that the API output is "raw" or untyped. For example:
94
+
+
95
+
```
96
+
@Operation(
97
+
summary = "Return the data stored in a specified ZooKeeper node",
98
+
tags = {"zookeeper-read"},
99
+
extensions = {
100
+
@Extension(properties = {@ExtensionProperty(name = RAW_OUTPUT_PROPERTY, value = "true")})
101
+
})
102
+
```
103
+
2. Interface methods should return a type that implements the JAX-RS `StreamingOutput` interface.
104
+
105
+
See the `fetchFile()` method in `ReplicationApis.java` for a concrete example.
0 commit comments