Skip to content

Commit 93cd86f

Browse files
committed
Add @operation annotations for major endpoints
1 parent bcc1b4d commit 93cd86f

File tree

6 files changed

+210
-0
lines changed

6 files changed

+210
-0
lines changed

src/main/java/org/phoebus/channelfinder/ChannelManager.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.swagger.v3.oas.annotations.media.Schema;
88
import io.swagger.v3.oas.annotations.responses.ApiResponse;
99
import io.swagger.v3.oas.annotations.responses.ApiResponses;
10+
import io.swagger.v3.oas.annotations.Operation;
1011
import org.phoebus.channelfinder.AuthorizationService.ROLES;
1112
import org.phoebus.channelfinder.entity.Channel;
1213
import org.phoebus.channelfinder.entity.Property;
@@ -77,6 +78,12 @@ public class ChannelManager {
7778
* @param allRequestParams query parameters
7879
* @return list of all channels
7980
*/
81+
@Operation(
82+
summary = "Query channels",
83+
description = "Query a collection of Channel instances based on tags, property values, and channel names.",
84+
operationId = "queryChannels",
85+
tags = {"Channel"}
86+
)
8087
@ApiResponses(
8188
value = {
8289
@ApiResponse(
@@ -106,6 +113,12 @@ public List<Channel> query(@RequestParam MultiValueMap<String, String> allReques
106113
* @param allRequestParams query parameters
107114
* @return SearchResult a count to the total number of matches and the first 10k hits
108115
*/
116+
@Operation(
117+
summary = "Combined query for channels",
118+
description = "Query for a collection of Channel instances and get a count and the first 10k hits.",
119+
operationId = "combinedQueryChannels",
120+
tags = {"Channel"}
121+
)
109122
@ApiResponses(
110123
value = {
111124
@ApiResponse(
@@ -134,6 +147,12 @@ public SearchResult combinedQuery(@RequestParam MultiValueMap<String, String> al
134147
* @param allRequestParams query parameters
135148
* @return a total number of channels that match the query parameters
136149
*/
150+
@Operation(
151+
summary = "Count channels matching query",
152+
description = "Get the number of channels matching the given query parameters.",
153+
operationId = "countChannels",
154+
tags = {"Channel"}
155+
)
137156
@ApiResponses(
138157
value = {
139158
@ApiResponse(
@@ -157,6 +176,12 @@ public long queryCount(@RequestParam MultiValueMap<String, String> allRequestPar
157176
* @param channelName - channel name to search for
158177
* @return found channel
159178
*/
179+
@Operation(
180+
summary = "Get channel by name",
181+
description = "Retrieve a Channel instance by its name.",
182+
operationId = "getChannelByName",
183+
tags = {"Channel"}
184+
)
160185
@ApiResponses(
161186
value = {
162187
@ApiResponse(
@@ -191,6 +216,12 @@ public Channel read(@PathVariable("channelName") String channelName) {
191216
* @param channel - new data (properties/tags) for channel <code>chan</code>
192217
* @return the created channel
193218
*/
219+
@Operation(
220+
summary = "Create or replace a channel",
221+
description = "Create or replace a channel instance identified by the payload.",
222+
operationId = "createOrReplaceChannel",
223+
tags = {"Channel"}
224+
)
194225
@ApiResponses(
195226
value = {
196227
@ApiResponse(
@@ -254,6 +285,12 @@ public Channel create(@PathVariable("channelName") String channelName, @RequestB
254285
* @param channels - XmlChannels to be created
255286
* @return the list of channels created
256287
*/
288+
@Operation(
289+
summary = "Create or replace multiple channels",
290+
description = "Create or replace multiple channel instances.",
291+
operationId = "createOrReplaceChannels",
292+
tags = {"Channel"}
293+
)
257294
@ApiResponses(
258295
value = {
259296
@ApiResponse(
@@ -355,6 +392,12 @@ private void resetOwnersToExisting(Iterable<Channel> channels) {
355392
* @param channel - new Channel data (properties/tags) to be merged into channel <code>channelName</code>
356393
* @return the updated channel
357394
*/
395+
@Operation(
396+
summary = "Update a channel",
397+
description = "Merge properties and tags of the channel identified by the payload into an existing channel.",
398+
operationId = "updateChannel",
399+
tags = {"Channel"}
400+
)
358401
@ApiResponses(
359402
value = {
360403
@ApiResponse(
@@ -434,6 +477,12 @@ public Channel update(@PathVariable("channelName") String channelName, @RequestB
434477
* @param channels - XmlChannels to be updated
435478
* @return the updated channels
436479
*/
480+
@Operation(
481+
summary = "Update multiple channels",
482+
description = "Merge properties and tags of the channels identified by the payload into existing channels.",
483+
operationId = "updateChannels",
484+
tags = {"Channel"}
485+
)
437486
@ApiResponses(
438487
value = {
439488
@ApiResponse(
@@ -503,6 +552,12 @@ public Iterable<Channel> update(@RequestBody Iterable<Channel> channels) {
503552
*
504553
* @param channelName - name of channel to remove
505554
*/
555+
@Operation(
556+
summary = "Delete a channel",
557+
description = "Delete a channel instance identified by its name.",
558+
operationId = "deleteChannel",
559+
tags = {"Channel"}
560+
)
506561
@ApiResponses(
507562
value = {
508563
@ApiResponse(

src/main/java/org/phoebus/channelfinder/ChannelScroll.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io.swagger.v3.oas.annotations.media.Schema;
77
import io.swagger.v3.oas.annotations.responses.ApiResponse;
88
import io.swagger.v3.oas.annotations.responses.ApiResponses;
9+
import io.swagger.v3.oas.annotations.Operation;
910
import java.text.MessageFormat;
1011
import java.util.Comparator;
1112
import java.util.List;
@@ -62,6 +63,12 @@ public class ChannelScroll {
6263
* @param allRequestParams search parameters
6364
* @return list of all channels
6465
*/
66+
@Operation(
67+
summary = "Scroll query for channels",
68+
description = "Retrieve a collection of Channel instances based on multi-parameter search.",
69+
operationId = "scrollQueryChannels",
70+
tags = {"ChannelScroll"}
71+
)
6572
@ApiResponses(
6673
value = {
6774
@ApiResponse(
@@ -86,6 +93,12 @@ public Scroll query(@RequestParam MultiValueMap<String, String> allRequestParams
8693
* @param scrollId scroll Id
8794
* @return list of all channels
8895
*/
96+
@Operation(
97+
summary = "Scroll query by scrollId",
98+
description = "Retrieve a collection of Channel instances using a scrollId and search parameters.",
99+
operationId = "scrollQueryById",
100+
tags = {"ChannelScroll"}
101+
)
89102
@ApiResponses(
90103
value = {
91104
@ApiResponse(

src/main/java/org/phoebus/channelfinder/InfoManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io.swagger.v3.oas.annotations.media.Schema;
77
import io.swagger.v3.oas.annotations.responses.ApiResponse;
88
import io.swagger.v3.oas.annotations.responses.ApiResponses;
9+
import io.swagger.v3.oas.annotations.Operation;
910
import java.io.IOException;
1011
import java.util.LinkedHashMap;
1112
import java.util.Map;
@@ -45,6 +46,12 @@ public class InfoManager {
4546
*
4647
* @return Information about the ChannelFinder service
4748
*/
49+
@Operation(
50+
summary = "Get ChannelFinder service info",
51+
description = "Returns information about the ChannelFinder service and its Elasticsearch backend.",
52+
operationId = "getServiceInfo",
53+
tags = {"Info"}
54+
)
4855
@ApiResponses(
4956
value = {
5057
@ApiResponse(

src/main/java/org/phoebus/channelfinder/PropertyManager.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.swagger.v3.oas.annotations.media.Schema;
88
import io.swagger.v3.oas.annotations.responses.ApiResponse;
99
import io.swagger.v3.oas.annotations.responses.ApiResponses;
10+
import io.swagger.v3.oas.annotations.Operation;
1011
import java.text.MessageFormat;
1112
import java.util.ArrayList;
1213
import java.util.Arrays;
@@ -64,6 +65,12 @@ public class PropertyManager {
6465
*
6566
* @return list of all properties
6667
*/
68+
@Operation(
69+
summary = "List all properties",
70+
description = "Retrieve the list of all properties in the database.",
71+
operationId = "listProperties",
72+
tags = {"Property"}
73+
)
6774
@ApiResponses(
6875
value = {
6976
@ApiResponse(
@@ -91,6 +98,12 @@ public Iterable<Property> list() {
9198
* @param withChannels - get the channels with the property
9299
* @return found property
93100
*/
101+
@Operation(
102+
summary = "Get property by name",
103+
description = "Retrieve a property by its name. Optionally include its channels.",
104+
operationId = "getPropertyByName",
105+
tags = {"Property"}
106+
)
94107
@ApiResponses(
95108
value = {
96109
@ApiResponse(
@@ -134,6 +147,12 @@ public Property read(@PathVariable("propertyName") String propertyName,
134147
* @param property - an Property instance with the list of channels to add the property <code>propertyName</code> to
135148
* @return the created property
136149
*/
150+
@Operation(
151+
summary = "Create or update a property",
152+
description = "Create and exclusively update the property identified by the path parameter.",
153+
operationId = "createOrUpdateProperty",
154+
tags = {"Property"}
155+
)
137156
@ApiResponses(
138157
value = {
139158
@ApiResponse(
@@ -203,6 +222,12 @@ public Property create(@PathVariable("propertyName") String propertyName, @Reque
203222
* @param properties - XmlProperties to be created
204223
* @return the list of properties created
205224
*/
225+
@Operation(
226+
summary = "Create multiple properties",
227+
description = "Create multiple properties in a single request.",
228+
operationId = "createMultipleProperties",
229+
tags = {"Property"}
230+
)
206231
@ApiResponses(
207232
value = {
208233
@ApiResponse(
@@ -279,6 +304,12 @@ public Iterable<Property> create(@RequestBody Iterable<Property> properties) {
279304
* @param property - property payload with value
280305
* @return added property
281306
*/
307+
@Operation(
308+
summary = "Add property to a single channel",
309+
description = "Add the property identified by propertyName to the channel identified by channelName.",
310+
operationId = "addPropertyToChannel",
311+
tags = {"Property"}
312+
)
282313
@ApiResponses(
283314
value = {
284315
@ApiResponse(
@@ -353,6 +384,12 @@ public Property addSingle(@PathVariable("propertyName") String propertyName, @Pa
353384
* @param property - a Property instance with the list of channels to add the property <code>propertyName</code> to
354385
* @return the updated property
355386
*/
387+
@Operation(
388+
summary = "Update a property",
389+
description = "Update the property identified by the path parameter, adding it to all channels in the payload.",
390+
operationId = "updateProperty",
391+
tags = {"Property"}
392+
)
356393
@ApiResponses(
357394
value = {
358395
@ApiResponse(
@@ -473,6 +510,12 @@ public Property update(@PathVariable("propertyName") String propertyName, @Reque
473510
* @param properties - XmlProperties to be updated
474511
* @return the updated properties
475512
*/
513+
@Operation(
514+
summary = "Update multiple properties",
515+
description = "Update multiple properties and all appropriate channels.",
516+
operationId = "updateMultipleProperties",
517+
tags = {"Property"}
518+
)
476519
@ApiResponses(
477520
value = {
478521
@ApiResponse(
@@ -584,6 +627,12 @@ private void checkPropertyAuthorization(Optional<Property> existingProperty) {
584627
*
585628
* @param propertyName - name of property to remove
586629
*/
630+
@Operation(
631+
summary = "Delete a property",
632+
description = "Delete the property identified by the path parameter from all channels.",
633+
operationId = "deleteProperty",
634+
tags = {"Property"}
635+
)
587636
@ApiResponses(
588637
value = {
589638
@ApiResponse(
@@ -636,6 +685,12 @@ public void remove(@PathVariable("propertyName") String propertyName) {
636685
* @param propertyName - name of property to remove
637686
* @param channelName - channel to remove <code>propertyName</code> from
638687
*/
688+
@Operation(
689+
summary = "Delete property from a channel",
690+
description = "Delete the property identified by propertyName from the channel identified by channelName.",
691+
operationId = "deletePropertyFromChannel",
692+
tags = {"Property"}
693+
)
639694
@ApiResponses(
640695
value = {
641696
@ApiResponse(

0 commit comments

Comments
 (0)