Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
18372ff
feat: adding swagger
maxquinones Aug 15, 2025
70432aa
updating swagger configuration
maxquinones Aug 27, 2025
2c3296b
swagger annotations
maxquinones Sep 3, 2025
fb7d5de
adding swagger annotations
maxquinones Sep 3, 2025
dc71ac2
adding annotations for Name server
maxquinones Sep 3, 2025
7ac2150
updates to name server
maxquinones Sep 3, 2025
02bab7e
update swagger documentation for API and Scheduler
maxquinones Sep 3, 2025
706c146
add Swagger annotations for Authorization and NameServer APIs
maxquinones Sep 3, 2025
d41e9b8
update Swagger annotations for NameServer API
maxquinones Sep 3, 2025
7525e16
update Swagger documentation for API and Authorization endpoints
maxquinones Sep 3, 2025
7bc244e
add Swagger annotations and tags for AI Models, Session, and Authenti…
maxquinones Sep 3, 2025
000e8d4
update Swagger documentation for LegacyAppResource and related APIs
maxquinones Sep 3, 2025
d1f9033
Enhance AdminProjectAuthorizationResource with OpenAPI Annotations
maxquinones Sep 3, 2025
ff89954
Enhance API documentation and improve response handling
maxquinones Sep 3, 2025
7fe983a
Update Swagger documentation for API endpoints and improve descriptions
maxquinones Sep 3, 2025
921116e
Update Swagger documentation for Engine Route and Database Engine APIs
maxquinones Sep 4, 2025
ac103c5
Update Swagger documentation for MCP and related APIs
maxquinones Sep 4, 2025
5979ccd
Update Swagger documentation for MCP and related APIs
maxquinones Sep 4, 2025
7112a7f
Update Swagger documentation for MCP and Model Engine APIs
maxquinones Sep 4, 2025
92bc00b
Update Swagger documentation for API endpoints and improve descriptions
maxquinones Sep 4, 2025
803fb29
Update Swagger documentation for Project endpoints, adding descriptio…
maxquinones Sep 4, 2025
44a9720
Update Swagger documentation for Project endpoints, adding descriptio…
maxquinones Sep 4, 2025
ab14612
Merge branch 'dev' of github.com-semoss:SEMOSS/Monolith into swagger-…
maxquinones Sep 12, 2025
31c5585
feat: pass logging context to MCPReaper for enhanced logging capabili…
maxquinones Sep 12, 2025
ee18ed9
chore: update swagger documentation for consistency and clarity
maxquinones Sep 12, 2025
eda68c2
refactor: update API title from SEMOSS to AI-Core in swagger configur…
maxquinones Sep 16, 2025
f88e5a3
Merge branch 'dev' of github.com-semoss:SEMOSS/Monolith into swagger-…
maxquinones Sep 16, 2025
444d539
chore: update project dependencies and configuration
maxquinones Sep 16, 2025
87a9b10
chore: update API title in swagger configuration files
maxquinones Sep 16, 2025
f28a05f
fix: update RDF map path to use forward slashes for compatibility
maxquinones Sep 29, 2025
d67dbc2
Merge branch 'dev' of github.com-semoss:SEMOSS/Monolith into swagger-…
maxquinones Sep 29, 2025
d2f2e56
chore: update swagger configuration files for consistency
maxquinones Sep 29, 2025
6a646e2
Merge branch 'dev' of github.com-semoss:SEMOSS/Monolith into swagger-…
maxquinones Sep 29, 2025
d55ea74
Merge branch 'dev' of github.com-semoss:SEMOSS/Monolith into swagger-…
maxquinones Sep 29, 2025
1b37133
Merge branch 'dev' of github.com-semoss:SEMOSS/Monolith into swagger-…
maxquinones Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,48 @@
</warSourceIncludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<groupId>io.openapitools.swagger</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<configuration>
<resourcePackages>
<resourcePackage>prerna.semoss.web.services.local</resourcePackage>
<resourcePackage>prerna.semoss.web.services.local.auth</resourcePackage>
</resourcePackages>
<outputDirectory>${basedir}/swagger-ui</outputDirectory>
<outputFilename>swagger</outputFilename>
<outputFormats>JSON,YAML</outputFormats>
<prettyPrint>true</prettyPrint>
<swaggerConfig>
<servers>
<server>
<url>https://workshop.cfg.deloitte.com/cfg-ai-demo/Monolith/api</url>
<description>Demo Endpoint URL</description>
</server>
<server>
<url>http://localhost:8080/Monolith/api</url>
<description>Local Development</description>
</server>
</servers>
<info>
<title>AI Core</title>
<version>${project.version}</version>
</info>
</swaggerConfig>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
Expand Down Expand Up @@ -352,6 +394,13 @@
</exclusion>
</exclusions>
</dependency>
<!-- OpenAPI Specification dependency -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.2.21</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
<!-- this is the primary tomcat specific jar -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package prerna.semoss.web.services.config;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;

import java.io.IOException;
import java.util.HashMap;
Expand Down Expand Up @@ -31,6 +32,7 @@
import prerna.web.conf.AdminStartupFilter;
import prerna.web.services.util.WebUtility;

@SecurityRequirement(name = "basicAuth")
@Path("/")
@PermitAll
public class AdminConfigService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package prerna.semoss.web.services.config;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -39,6 +40,7 @@

@Path("/config")
@PermitAll
@SecurityRequirement(name = "basicAuth")
public class ServerConfigurationResource {

private static final Logger logger = LogManager.getLogger(ServerConfigurationResource.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package prerna.semoss.web.services.config;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;

import java.io.IOException;
import java.util.HashMap;
Expand Down Expand Up @@ -33,6 +34,7 @@

@Path("/")
@PermitAll
@SecurityRequirement(name = "basicAuth")
public class TrustedTokenService {

private static final Logger logger = LogManager.getLogger(TrustedTokenService.class);
Expand Down Expand Up @@ -70,6 +72,7 @@ public Response getTokenGet(@Context HttpServletRequest request, @Context HttpSe
return WebUtility.getResponse(retMap, 200);
}

@SecurityRequirement(name = "basicAuth")
@POST
@Path("/getToken")
public Response getTokenPost(@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException {
Expand Down
7 changes: 7 additions & 0 deletions src/prerna/semoss/web/services/local/APIResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
import org.apache.logging.log4j.Logger;
import org.json.JSONObject;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import prerna.om.Insight;
import prerna.om.InsightStore;
import prerna.util.Constants;
Expand All @@ -58,6 +62,9 @@
import prerna.web.services.util.WebUtility;

@Path("/")
@Tag(name = "API", description = "API for querying insights")
@SecurityRequirement(name = "basicAuth")
@SecurityScheme(name = "basicAuth", type = SecuritySchemeType.HTTP, scheme = "basic")
public class APIResource {

private static final Logger logger = LogManager.getLogger(APIResource.class);
Expand Down
23 changes: 23 additions & 0 deletions src/prerna/semoss/web/services/local/AuthorizationResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import prerna.auth.utils.SecurityQueryUtils;
import prerna.web.services.util.WebUtility;

@Path("/authorization")
@Tag(name = "Authorization", description = "Authorization and user search APIs")
@SecurityRequirement(name = "basicAuth")
@SecurityScheme(name = "basicAuth", type = SecuritySchemeType.HTTP, scheme = "basic")
public class AuthorizationResource {

private static final Logger classLogger = LogManager.getLogger(AuthorizationResource.class);
Expand All @@ -55,6 +66,18 @@ public class AuthorizationResource {
@GET
@Produces("application/json")
@Path("searchForUser")
@Operation(
summary = "Search for users",
description = "Searches for users by a case-insensitive search term.",
parameters = {
@Parameter(name = "searchTerm", description = "Search term to match against user attributes", required = true)
},
responses = {
@ApiResponse(responseCode = "200", description = "List of matched users", content = @Content(mediaType = "application/json")),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "Server error")
}
)
public StreamingOutput searchForUser(@Context HttpServletRequest request, @QueryParam("searchTerm") String searchTerm) {
List<Map<String, Object>> ret = SecurityQueryUtils.searchForUser(WebUtility.inputSQLSanitizer(searchTerm.trim()));
return WebUtility.getSO(ret);
Expand Down
22 changes: 22 additions & 0 deletions src/prerna/semoss/web/services/local/EngineRouteResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.logging.log4j.LogManager;
Expand All @@ -49,6 +56,7 @@

@Path("/e-{engineId}")
@PermitAll
@Tag(name = "Engine Route", description = "Per-engine endpoints for SMSS configuration updates and image download.")
public class EngineRouteResource {

private static final Logger classLogger = LogManager.getLogger(ModelEngineResource.class);
Expand All @@ -73,6 +81,12 @@ private boolean canAccessOrDiscoverableEngine(User user, String engineId) throws
@POST
@Path("/updateSmssFile")
@Produces("application/json;charset=utf-8")
@Operation(summary = "Update engine SMSS file", description = "Updates the engine's SMSS configuration file with new content, preserving concealed sensitive values and validating immutable fields (engine id, name, type). Requires admin or engine owner.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "SMSS updated", content = @Content(schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "400", description = "Validation or processing error", content = @Content(schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "401", description = "Unauthorized or insufficient permissions", content = @Content(schema = @Schema(implementation = Map.class)))
})
public Response updateSmssFile(@Context HttpServletRequest request, @PathParam("engineId") String engineId) {
engineId = WebUtility.inputSanitizer(engineId);

Expand Down Expand Up @@ -197,6 +211,13 @@ public Response updateSmssFile(@Context HttpServletRequest request, @PathParam("
@GET
@Path("/image/download")
@Produces({MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_SVG_XML})
@Operation(summary = "Download engine image", description = "Returns the engine image (PNG/JPEG/GIF/SVG). Supports ETag-based client caching. Falls back to generated default if none found.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Image file returned"),
@ApiResponse(responseCode = "304", description = "Not modified (ETag match)"),
@ApiResponse(responseCode = "400", description = "Invalid engine or retrieval error", content = @Content(schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "401", description = "Unauthorized or no access", content = @Content(schema = @Schema(implementation = Map.class)))
})
public Response imageDownload(@Context final Request coreRequest, @Context HttpServletRequest request, @PathParam("engineId") String engineId) {
engineId=WebUtility.inputSanitizer(engineId);

Expand Down Expand Up @@ -313,6 +334,7 @@ private File findImageFile(String folderDirectory) {
extensions.add("image.jpg");
extensions.add("image.gif");
extensions.add("image.svg");
@SuppressWarnings("deprecation")
FileFilter imageExtensionFilter = new WildcardFileFilter(extensions);
File baseFolder = new File(WebUtility.normalizePath(folderDirectory));
File[] imageFiles = baseFolder.listFiles(imageExtensionFilter);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package prerna.semoss.web.services.local;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;

import java.util.HashMap;
import java.util.List;
Expand All @@ -23,6 +24,7 @@
import prerna.web.services.util.WebUtility;

@Path("exec")
@SecurityRequirement(name = "basicAuth")
public class ExecuteInsightResource {

@Path("/test")
Expand Down
53 changes: 53 additions & 0 deletions src/prerna/semoss/web/services/local/LegacyAppResource.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
package prerna.semoss.web.services.local;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;

import java.io.File;
import java.io.FileFilter;
Expand Down Expand Up @@ -52,6 +60,8 @@
@Path("/app-{databaseId}")
@PermitAll
@Deprecated
@SecurityRequirement(name = "basicAuth")
@Tag(name = "Database Engine", description = "LEGACY endpoints for database operations. Deprecated: use /e-{engineId} or /database-{databaseId} endpoints instead.")
// replaced by DatabaseResource
public class LegacyAppResource {

Expand All @@ -76,6 +86,23 @@ private boolean canViewDatabase(User user, String databaseId) throws IllegalAcce
@POST
@Path("/updateSmssFile")
@Produces("application/json;charset=utf-8")
@Operation(
summary = "Update database SMSS file (legacy)",
description = "Updates the SMSS configuration file for the specified database. Deprecated: use /database-{databaseId} or /e-{engineId} equivalent.",
deprecated = true,
parameters = {
@Parameter(name = "databaseId", in = ParameterIn.PATH, required = true, description = "Database identifier")
},
responses = {
@ApiResponse(responseCode = "200", description = "SMSS file updated",
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = LegacyUpdateResponse.class))),
@ApiResponse(responseCode = "400", description = "Bad request",
content = @Content(mediaType = "application/json")),
@ApiResponse(responseCode = "401", description = "Unauthorized",
content = @Content(mediaType = "application/json"))
}
)
public Response updateSmssFile(@Context HttpServletRequest request, @PathParam("databaseId") String databaseId) {
logger.warn("CALLING LEGACY ENDPOINT - NEED TO UPDATE TO DATABASE SPECIFIC ENDPOINT /database-{databaseId} OR GENERIC ENGINE ENDPOINT /e-{engineid}");
logger.warn("CALLING LEGACY ENDPOINT - NEED TO UPDATE TO DATABASE SPECIFIC ENDPOINT /database-{databaseId} OR GENERIC ENGINE ENDPOINT /e-{engineid}");
Expand Down Expand Up @@ -187,6 +214,26 @@ public Response updateSmssFile(@Context HttpServletRequest request, @PathParam("
@GET
@Path("/appImage/download")
@Produces({MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_SVG_XML})
@Operation(
summary = "Download database image (legacy)",
description = "Downloads the database image for the specified database. Deprecated: use /e-{engineId}/image/download.",
deprecated = true,
parameters = {
@Parameter(name = "databaseId", in = ParameterIn.PATH, required = true, description = "Database identifier")
},
responses = {
@ApiResponse(responseCode = "200", description = "Image downloaded",
content = {
@Content(mediaType = "application/octet-stream", schema = @Schema(type = "string", format = "binary")),
@Content(mediaType = MediaType.APPLICATION_SVG_XML, schema = @Schema(type = "string", format = "binary"))
}
),
@ApiResponse(responseCode = "400", description = "Bad request",
content = @Content(mediaType = "application/json")),
@ApiResponse(responseCode = "401", description = "Unauthorized",
content = @Content(mediaType = "application/json"))
}
)
public Response imageDownload(@Context final Request coreRequest, @Context HttpServletRequest request, @PathParam("databaseId") String databaseId) {
logger.warn("CALLING LEGACY ENDPOINT - NEED TO UPDATE TO ENGINE ENDPOINT /e-{engineid}");
logger.warn("CALLING LEGACY ENDPOINT - NEED TO UPDATE TO ENGINE ENDPOINT /e-{engineid}");
Expand Down Expand Up @@ -341,3 +388,9 @@ protected void closeStream(FileInputStream fis) {
}
}
}

// DTOs for OpenAPI documentation of legacy responses
class LegacyUpdateResponse {
@Schema(description = "Whether the operation succeeded")
public Boolean success;
}
Loading