diff --git a/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java b/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java index 1122d25f..d4c77fa3 100644 --- a/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java +++ b/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java @@ -77,34 +77,32 @@ protected Iterable getRegistries() { ) @CrossOrigin @Operation(summary = "Provides metadata of a namespace") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The namespace metadata are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified namespace could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The namespace metadata are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified namespace could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getNamespace( @PathVariable @Parameter(description = "Namespace name", example = "redhat") String namespace @@ -128,39 +126,37 @@ public ResponseEntity getNamespace( ) @CrossOrigin @Operation(summary = "Check if a personal access token is valid and is allowed to publish in a namespace") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The provided PAT is valid and is allowed to publish extensions in the namespace" - ), - @ApiResponse( - responseCode = "400", - description = "The token has no publishing permission in the namespace or is not valid", - content = @Content() - ), - @ApiResponse( - responseCode = "404", - description = "The specified namespace could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The provided PAT is valid and is allowed to publish extensions in the namespace" + ) + @ApiResponse( + responseCode = "400", + description = "The token has no publishing permission in the namespace or is not valid", + content = @Content() + ) + @ApiResponse( + responseCode = "404", + description = "The specified namespace could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity verifyToken( @PathVariable @Parameter(description = "Namespace", example = "redhat") String namespace, @@ -182,7 +178,32 @@ public ResponseEntity verifyToken( ) @CrossOrigin @Operation() - @ApiResponses({}) + @ApiResponse( + responseCode = "200", + description = "The namespace details are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified namespace could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getNamespaceDetails( @PathVariable @Parameter(description = "Namespace name", example = "redhat") String namespace @@ -206,16 +227,31 @@ public ResponseEntity getNamespaceDetails( ) @CrossOrigin @Operation(summary = "Provides logo of a namespace") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The namespace details are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified namespace could not be found" - ) - }) + @ApiResponse( + responseCode = "200", + description = "The namespace details are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified namespace could not be found" + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getNamespaceLogo( @PathVariable @Parameter(description = "Namespace name", example = "redhat") String namespace, @@ -239,34 +275,32 @@ public ResponseEntity getNamespaceLogo( ) @CrossOrigin @Operation(summary = "Provides metadata of the latest version of an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension metadata are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension metadata are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getExtension( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -292,34 +326,32 @@ public ResponseEntity getExtension( ) @CrossOrigin @Operation(summary = "Provides metadata of the latest version of an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension metadata are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension metadata are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getExtension( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -358,34 +390,32 @@ public ResponseEntity getExtension( ) @CrossOrigin @Operation(summary = "Provides metadata of a specific version of an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension metadata are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension metadata are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getExtension( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -413,34 +443,32 @@ public ResponseEntity getExtension( ) @CrossOrigin @Operation(summary = "Provides metadata of a specific version of an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension metadata are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension metadata are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getExtension( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -481,34 +509,32 @@ public ResponseEntity getExtension( ) @CrossOrigin @Operation(summary = "Provides a map of versions matching an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension versions are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() + @ApiResponse( + responseCode = "200", + description = "The extension versions are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") ) - }) + } + ) public ResponseEntity getVersions( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -530,34 +556,32 @@ public ResponseEntity getVersions( ) @CrossOrigin @Operation(summary = "Provides a map of versions matching an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension versions are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension versions are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getVersions( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -614,34 +638,32 @@ private ResponseEntity handleGetVersions(String namespace, String ) @CrossOrigin @Operation(summary = "Provides a list of version references matching an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension version references are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension version references are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getVersionReferences( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -663,34 +685,32 @@ public ResponseEntity getVersionReferences( ) @CrossOrigin @Operation(summary = "Provides a list of version references matching an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The extension version references are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The extension version references are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getVersionReferences( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -744,44 +764,42 @@ private ResponseEntity handleGetVersionReferences(String @GetMapping("/api/{namespace}/{extension}/{version:" + VERSION_PATH_PARAM_REGEX + "}/file/**") @CrossOrigin @Operation(summary = "Access a file packaged by an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The file content is returned" - ), - @ApiResponse( - responseCode = "302", - description = "The file is found at the specified location", - content = @Content(), - headers = @Header( - name = "Location", - description = "The actual URL where the file can be accessed", - schema = @Schema(type = "string") - ) - ), - @ApiResponse( - responseCode = "404", - description = "The specified file could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @ApiResponse( + responseCode = "200", + description = "The file content is returned" + ) + @ApiResponse( + responseCode = "302", + description = "The file is found at the specified location", + content = @Content(), + headers = @Header( + name = "Location", + description = "The actual URL where the file can be accessed", + schema = @Schema(type = "string") ) - }) + ) + @ApiResponse( + responseCode = "404", + description = "The specified file could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getFile( HttpServletRequest request, @PathVariable @Parameter(description = "Extension namespace", example = "redhat") @@ -805,44 +823,42 @@ public ResponseEntity getFile( @GetMapping("/api/{namespace}/{extension}/{targetPlatform:" + TargetPlatform.NAMES_PATH_PARAM_REGEX + "}/{version:" + VERSION_PATH_PARAM_REGEX + "}/file/**") @CrossOrigin @Operation(summary = "Access a file packaged by an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The file content is returned" - ), - @ApiResponse( - responseCode = "302", - description = "The file is found at the specified location", - content = @Content(), - headers = @Header( - name = "Location", - description = "The actual URL where the file can be accessed", - schema = @Schema(type = "string") - ) - ), - @ApiResponse( - responseCode = "404", - description = "The specified file could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @ApiResponse( + responseCode = "200", + description = "The file content is returned" + ) + @ApiResponse( + responseCode = "302", + description = "The file is found at the specified location", + content = @Content(), + headers = @Header( + name = "Location", + description = "The actual URL where the file can be accessed", + schema = @Schema(type = "string") ) - }) + ) + @ApiResponse( + responseCode = "404", + description = "The specified file could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getFile( HttpServletRequest request, @PathVariable @Parameter(description = "Extension namespace", example = "redhat") @@ -882,17 +898,15 @@ public ResponseEntity getFile( ) @CrossOrigin @Operation(summary = "Returns the list of reviews of an extension") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The reviews are returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The specified extension could not be found", - content = @Content() - ) - }) + @ApiResponse( + responseCode = "200", + description = "The reviews are returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The specified extension could not be found", + content = @Content() + ) public ResponseEntity getReviews( @PathVariable @Parameter(description = "Extension namespace", example = "redhat") String namespace, @@ -918,37 +932,35 @@ public ResponseEntity getReviews( ) @CrossOrigin @Operation(summary = "Search extensions via text entered by a user") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The search results are returned in JSON format" - ), - @ApiResponse( - responseCode = "400", - description = "The request contains an invalid parameter value", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value = "{\"error\": \"The parameter 'size' must not be negative.\"}") - ) - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @ApiResponse( + responseCode = "200", + description = "The search results are returned in JSON format" + ) + @ApiResponse( + responseCode = "400", + description = "The request contains an invalid parameter value", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value = "{\"error\": \"The parameter 'size' must not be negative.\"}") ) - }) + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity search( @RequestParam(required = false) @Parameter(description = "Query text for searching", example = "javascript") @@ -1049,16 +1061,14 @@ private int mergeSearchResults(List extensions, List getQueryV2( @RequestParam(required = false) @Parameter(description = "Name of a namespace", example = "foo") @@ -1167,37 +1177,35 @@ public ResponseEntity getQueryV2( ) @CrossOrigin @Operation(summary = "Provides metadata of extensions matching the given parameters") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "Returns the (possibly empty) query results" - ), - @ApiResponse( - responseCode = "400", - description = "The request contains an invalid parameter value", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value = "{\"error\":\"The 'extensionId' parameter must have the format 'namespace.extension'.\"}") - ) - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @ApiResponse( + responseCode = "200", + description = "Returns the (possibly empty) query results" + ) + @ApiResponse( + responseCode = "400", + description = "The request contains an invalid parameter value", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value = "{\"error\":\"The 'extensionId' parameter must have the format 'namespace.extension'.\"}") ) - }) + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getQuery( @RequestParam(required = false) @Parameter(description = "Name of a namespace", example = "foo") @@ -1314,29 +1322,27 @@ private int mergeQueryResults(List extensions, List postQuery( @RequestBody @Parameter(description = "Parameters of the metadata query") QueryParamJson param @@ -1355,46 +1361,44 @@ public ResponseEntity postQuery( produces = MediaType.APPLICATION_JSON_VALUE ) @Operation(summary = "Create a namespace") - @ApiResponses({ - @ApiResponse( - responseCode = "201", - description = "Successfully created the namespace", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value = "{ \"success\": \"Created namespace foobar\" }") - ), - headers = @Header( - name = "Location", - description = "The URL of the namespace metadata", - schema = @Schema(type = "string") - ) + @ApiResponse( + responseCode = "201", + description = "Successfully created the namespace", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value = "{ \"success\": \"Created namespace foobar\" }") ), - @ApiResponse( - responseCode = "400", - description = "The namespace could not be created", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value = "{ \"error\": \"Invalid access token.\" }") - ) - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + headers = @Header( + name = "Location", + description = "The URL of the namespace metadata", + schema = @Schema(type = "string") + ) + ) + @ApiResponse( + responseCode = "400", + description = "The namespace could not be created", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value = "{ \"error\": \"Invalid access token.\" }") ) - }) + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity createNamespace( @RequestBody @Parameter(description = "Describes the namespace to create") NamespaceJson namespace, @@ -1432,50 +1436,48 @@ public ResponseEntity createNamespace( required = true ) ) - @ApiResponses({ - @ApiResponse( - responseCode = "201", - description = "Successfully created the namespace", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value="{ \"success\": \"Created namespace foobar\" }") - ), - headers = @Header( - name = "Location", - description = "The URL of the namespace metadata", - schema = @Schema(type = "string") - ) - ), - @ApiResponse( - responseCode = "400", - description = "The namespace could not be created", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value="{ \"error\": \"Invalid access token.\" }") - ) + @ApiResponse( + responseCode = "201", + description = "Successfully created the namespace", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value="{ \"success\": \"Created namespace foobar\" }") ), - @ApiResponse( - responseCode = "403", - description = "User is not logged in" - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + headers = @Header( + name = "Location", + description = "The URL of the namespace metadata", + schema = @Schema(type = "string") ) - }) + ) + @ApiResponse( + responseCode = "400", + description = "The namespace could not be created", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value="{ \"error\": \"Invalid access token.\" }") + ) + ) + @ApiResponse( + responseCode = "403", + description = "User is not logged in" + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity createNamespace( @RequestBody NamespaceJson namespace ) { @@ -1515,42 +1517,40 @@ public ResponseEntity createNamespace( required = true ) ) - @ApiResponses({ - @ApiResponse( - responseCode = "201", - description = "Successfully published the extension", - headers = @Header( - name = "Location", - description = "The URL of the extension metadata", - schema = @Schema(type = "string") - ) - ), - @ApiResponse( - responseCode = "400", - description = "The extension could not be published", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value = "{ \"error\": \"Invalid access token.\" }") - ) - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @ApiResponse( + responseCode = "201", + description = "Successfully published the extension", + headers = @Header( + name = "Location", + description = "The URL of the extension metadata", + schema = @Schema(type = "string") + ) + ) + @ApiResponse( + responseCode = "400", + description = "The extension could not be published", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value = "{ \"error\": \"Invalid access token.\" }") ) - }) + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity publish( InputStream content, @RequestParam @Parameter(description = "A personal access token") String token @@ -1581,46 +1581,44 @@ public ResponseEntity publish( required = true ) ) - @ApiResponses({ - @ApiResponse( - responseCode = "201", - description = "Successfully published the extension", - headers = @Header( - name = "Location", - description = "The URL of the extension metadata", - schema = @Schema(type = "string") - ) - ), - @ApiResponse( - responseCode = "400", - description = "The extension could not be published", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - examples = @ExampleObject(value="{ \"error\": \"Unknown publisher: foobar\" }") - ) - ), - @ApiResponse( - responseCode = "403", - description = "User is not logged in" - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } + @ApiResponse( + responseCode = "201", + description = "Successfully published the extension", + headers = @Header( + name = "Location", + description = "The URL of the extension metadata", + schema = @Schema(type = "string") + ) + ) + @ApiResponse( + responseCode = "400", + description = "The extension could not be published", + content = @Content( + mediaType = MediaType.APPLICATION_JSON_VALUE, + examples = @ExampleObject(value="{ \"error\": \"Unknown publisher: foobar\" }") ) - }) + ) + @ApiResponse( + responseCode = "403", + description = "User is not logged in" + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity publish(InputStream content) { try { var user = users.findLoggedInUser(); @@ -1695,34 +1693,32 @@ public ResponseEntity deleteReview(@PathVariable String namespace, @ ) @CrossOrigin @Operation(summary = "Access a public key file") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The file content is returned" - ), - @ApiResponse( - responseCode = "404", - description = "The specified public key file could not be found", - content = @Content() - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - content = @Content(), - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The file content is returned" + ) + @ApiResponse( + responseCode = "404", + description = "The specified public key file could not be found", + content = @Content() + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + content = @Content(), + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getPublicKey( @PathVariable @Parameter(description = "Public ID of a public key file", example = "92dea4de-80b5-4577-b27d-44cdcda82c63") String publicId @@ -1744,32 +1740,30 @@ public ResponseEntity getPublicKey( @GetMapping(path = "/api/version", produces = MediaType.APPLICATION_JSON_VALUE) @CrossOrigin @Operation(summary = "Return the registry version") - @ApiResponses({ - @ApiResponse( - responseCode = "200", - description = "The registry version is returned in JSON format" - ), - @ApiResponse( - responseCode = "404", - description = "The registry version could not be determined" - ), - @ApiResponse( - responseCode = "429", - description = "A client has sent too many requests in a given amount of time", - headers = { - @Header( - name = "X-Rate-Limit-Retry-After-Seconds", - description = "Number of seconds to wait after receiving a 429 response", - schema = @Schema(type = "integer", format = "int32") - ), - @Header( - name = "X-Rate-Limit-Remaining", - description = "Remaining number of requests left", - schema = @Schema(type = "integer", format = "int32") - ) - } - ) - }) + @ApiResponse( + responseCode = "200", + description = "The registry version is returned in JSON format" + ) + @ApiResponse( + responseCode = "404", + description = "The registry version could not be determined" + ) + @ApiResponse( + responseCode = "429", + description = "A client has sent too many requests in a given amount of time", + headers = { + @Header( + name = "X-Rate-Limit-Retry-After-Seconds", + description = "Number of seconds to wait after receiving a 429 response", + schema = @Schema(type = "integer", format = "int32") + ), + @Header( + name = "X-Rate-Limit-Remaining", + description = "Remaining number of requests left", + schema = @Schema(type = "integer", format = "int32") + ) + } + ) public ResponseEntity getServerVersion() { try { return ResponseEntity.ok() diff --git a/server/src/main/java/org/eclipse/openvsx/entities/ExtensionVersion.java b/server/src/main/java/org/eclipse/openvsx/entities/ExtensionVersion.java index e9827715..fa63dbe9 100644 --- a/server/src/main/java/org/eclipse/openvsx/entities/ExtensionVersion.java +++ b/server/src/main/java/org/eclipse/openvsx/entities/ExtensionVersion.java @@ -54,14 +54,12 @@ public enum Type { boolean universalTargetPlatform; @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "major", column = @Column(name = "semver_major")), - @AttributeOverride(name = "minor", column = @Column(name = "semver_minor")), - @AttributeOverride(name = "patch", column = @Column(name = "semver_patch")), - @AttributeOverride(name = "preRelease", column = @Column(name = "semver_pre_release")), - @AttributeOverride(name = "isPreRelease", column = @Column(name = "semver_is_pre_release")), - @AttributeOverride(name = "buildMetadata", column = @Column(name = "semver_build_metadata")) - }) + @AttributeOverride(name = "major", column = @Column(name = "semver_major")) + @AttributeOverride(name = "minor", column = @Column(name = "semver_minor")) + @AttributeOverride(name = "patch", column = @Column(name = "semver_patch")) + @AttributeOverride(name = "preRelease", column = @Column(name = "semver_pre_release")) + @AttributeOverride(name = "isPreRelease", column = @Column(name = "semver_is_pre_release")) + @AttributeOverride(name = "buildMetadata", column = @Column(name = "semver_build_metadata")) SemanticVersion semver; boolean preRelease;