From b22870f257a60b410e8579491f820bafd494b77a Mon Sep 17 00:00:00 2001 From: sonikashah Date: Sat, 28 Sep 2024 22:47:14 +0530 Subject: [PATCH] Fix #18039 - Fix incorrect @Schema implementations in Swagger annotations --- .../resources/apis/APIEndpointResource.java | 7 +++---- .../resources/databases/DatabaseResource.java | 11 +++++------ .../databases/StoredProcedureResource.java | 11 +++++------ .../glossary/GlossaryTermResource.java | 18 +++++++++++------- .../resources/pipelines/PipelineResource.java | 3 +-- .../dashboard/DashboardServiceResource.java | 3 +-- .../messaging/MessagingServiceResource.java | 3 +-- .../metadata/MetadataServiceResource.java | 10 ++++------ .../mlmodel/MlModelServiceResource.java | 3 +-- .../pipeline/PipelineServiceResource.java | 3 +-- 10 files changed, 33 insertions(+), 39 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apis/APIEndpointResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apis/APIEndpointResource.java index e61f3a8d01f1..5060606c2a2a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apis/APIEndpointResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apis/APIEndpointResource.java @@ -47,7 +47,6 @@ import org.openmetadata.schema.api.data.CreateAPIEndpoint; import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.entity.data.APIEndpoint; -import org.openmetadata.schema.entity.data.Topic; import org.openmetadata.schema.type.ChangeEvent; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; @@ -370,17 +369,17 @@ public Response updateAPIEndpoint( @PUT @Operation( operationId = "createOrUpdateAPIEndpoint", - summary = "Update topic", + summary = "Update API Endpoint", description = "Create a API Endpoint, it it does not exist or update an existing API Endpoint.", responses = { @ApiResponse( responseCode = "200", - description = "The updated topic ", + description = "The updated api endpoint ", content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Topic.class))) + schema = @Schema(implementation = APIEndpoint.class))) }) public Response createOrUpdate( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java index 867fd5ef4e0e..63d890e63265 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseResource.java @@ -51,7 +51,6 @@ import org.openmetadata.schema.api.data.CreateDatabase; import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.entity.data.Database; -import org.openmetadata.schema.entity.data.Table; import org.openmetadata.schema.type.ChangeEvent; import org.openmetadata.schema.type.DatabaseProfilerConfig; import org.openmetadata.schema.type.EntityHistory; @@ -566,7 +565,7 @@ public Response restoreDatabase( @Operation( operationId = "addDataProfilerConfig", summary = "Add database profile config", - description = "Add database profile config to the table.", + description = "Add database profile config to the database.", responses = { @ApiResponse( responseCode = "200", @@ -574,7 +573,7 @@ public Response restoreDatabase( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Table.class))) + schema = @Schema(implementation = Database.class))) }) public Database addDataProfilerConfig( @Context UriInfo uriInfo, @@ -595,7 +594,7 @@ public Database addDataProfilerConfig( @Operation( operationId = "getDataProfilerConfig", summary = "Get database profile config", - description = "Get database profile config to the table.", + description = "Get database profile config to the database.", responses = { @ApiResponse( responseCode = "200", @@ -603,7 +602,7 @@ public Database addDataProfilerConfig( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Table.class))) + schema = @Schema(implementation = Database.class))) }) public Database getDataProfilerConfig( @Context UriInfo uriInfo, @@ -633,7 +632,7 @@ public Database getDataProfilerConfig( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Table.class))) + schema = @Schema(implementation = Database.class))) }) public Database deleteDataProfilerConfig( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java index 704433d8d4da..e5b1b8e7ef19 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java @@ -19,7 +19,6 @@ import org.openmetadata.schema.api.VoteRequest; import org.openmetadata.schema.api.data.CreateStoredProcedure; import org.openmetadata.schema.api.data.RestoreEntity; -import org.openmetadata.schema.entity.data.DatabaseSchema; import org.openmetadata.schema.entity.data.StoredProcedure; import org.openmetadata.schema.type.ChangeEvent; import org.openmetadata.schema.type.EntityHistory; @@ -511,18 +510,18 @@ public Response delete( @Path("/restore") @Operation( operationId = "restore", - summary = "Restore a soft deleted database schema.", - description = "Restore a soft deleted database schema.", + summary = "Restore a soft deleted stored procedure.", + description = "Restore a soft deleted stored procedure.", responses = { @ApiResponse( responseCode = "200", - description = "Successfully restored the DatabaseSchema ", + description = "Successfully restored the StoredProcedure ", content = @Content( mediaType = "application/json", - schema = @Schema(implementation = DatabaseSchema.class))) + schema = @Schema(implementation = StoredProcedure.class))) }) - public Response restoreDatabaseSchema( + public Response restoreStoredProcedure( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Valid RestoreEntity restore) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java index 84e6ca374d8f..e7673154bc39 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java @@ -271,8 +271,10 @@ public ResultList list( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Glossary.class))), - @ApiResponse(responseCode = "404", description = "Glossary for instance {id} is not found") + schema = @Schema(implementation = GlossaryTerm.class))), + @ApiResponse( + responseCode = "404", + description = "Glossary term for instance {id} is not found") }) public GlossaryTerm get( @Context UriInfo uriInfo, @@ -307,8 +309,10 @@ public GlossaryTerm get( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Glossary.class))), - @ApiResponse(responseCode = "404", description = "Glossary for instance {fqn} is not found") + schema = @Schema(implementation = GlossaryTerm.class))), + @ApiResponse( + responseCode = "404", + description = "Glossary term for instance {fqn} is not found") }) public GlossaryTerm getByName( @Context UriInfo uriInfo, @@ -365,14 +369,14 @@ public EntityHistory listVersions( responses = { @ApiResponse( responseCode = "200", - description = "glossaries", + description = "The glossary term", content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Glossary.class))), + schema = @Schema(implementation = GlossaryTerm.class))), @ApiResponse( responseCode = "404", - description = "Glossary for instance {id} and version {version} is not found") + description = "Glossary term for instance {id} and version {version} is not found") }) public GlossaryTerm getVersion( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java index 6c88f5e4ce74..ee9228690c63 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java @@ -62,7 +62,6 @@ import org.openmetadata.service.limits.Limits; import org.openmetadata.service.resources.Collection; import org.openmetadata.service.resources.EntityResource; -import org.openmetadata.service.resources.dqtests.TestCaseResource; import org.openmetadata.service.security.Authorizer; import org.openmetadata.service.security.policyevaluator.OperationContext; import org.openmetadata.service.util.ResultList; @@ -444,7 +443,7 @@ public Response addPipelineStatus( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = TestCaseResource.TestCaseList.class))) + schema = @Schema(implementation = PipelineResource.PipelineStatusList.class))) }) public ResultList list( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java index 3fc0ef552665..fa72220f3ede 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/dashboard/DashboardServiceResource.java @@ -48,7 +48,6 @@ import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.api.services.CreateDashboardService; import org.openmetadata.schema.entity.services.DashboardService; -import org.openmetadata.schema.entity.services.DatabaseService; import org.openmetadata.schema.entity.services.ServiceType; import org.openmetadata.schema.entity.services.connections.TestConnectionResult; import org.openmetadata.schema.type.DashboardConnection; @@ -226,7 +225,7 @@ public DashboardService getByName( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = DatabaseService.class))) + schema = @Schema(implementation = DashboardService.class))) }) public DashboardService addTestConnectionResult( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java index a673b288989e..139861ecf301 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/messaging/MessagingServiceResource.java @@ -47,7 +47,6 @@ import javax.ws.rs.core.UriInfo; import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.api.services.CreateMessagingService; -import org.openmetadata.schema.entity.services.DatabaseService; import org.openmetadata.schema.entity.services.MessagingService; import org.openmetadata.schema.entity.services.ServiceType; import org.openmetadata.schema.entity.services.connections.TestConnectionResult; @@ -232,7 +231,7 @@ public MessagingService getByName( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = DatabaseService.class))) + schema = @Schema(implementation = MessagingService.class))) }) public MessagingService addTestConnectionResult( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java index e7765b0f7607..dc0ca583ad43 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/metadata/MetadataServiceResource.java @@ -40,8 +40,6 @@ import lombok.extern.slf4j.Slf4j; import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.api.services.CreateMetadataService; -import org.openmetadata.schema.entity.data.Table; -import org.openmetadata.schema.entity.services.DatabaseService; import org.openmetadata.schema.entity.services.MetadataConnection; import org.openmetadata.schema.entity.services.MetadataService; import org.openmetadata.schema.entity.services.ServiceType; @@ -272,7 +270,7 @@ public MetadataService getByName( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = DatabaseService.class))) + schema = @Schema(implementation = MetadataService.class))) }) public MetadataService addTestConnectionResult( @Context UriInfo uriInfo, @@ -541,13 +539,13 @@ public Response delete( responses = { @ApiResponse( responseCode = "200", - description = "Successfully restored the Table ", + description = "Successfully restored the MetadataService ", content = @Content( mediaType = "application/json", - schema = @Schema(implementation = Table.class))) + schema = @Schema(implementation = MetadataService.class))) }) - public Response restoreTable( + public Response restoreMetadataService( @Context UriInfo uriInfo, @Context SecurityContext securityContext, @Valid RestoreEntity restore) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java index 08f93c3b4f89..5b70603806ed 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/mlmodel/MlModelServiceResource.java @@ -49,7 +49,6 @@ import javax.ws.rs.core.UriInfo; import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.api.services.CreateMlModelService; -import org.openmetadata.schema.entity.services.DatabaseService; import org.openmetadata.schema.entity.services.MlModelService; import org.openmetadata.schema.entity.services.ServiceType; import org.openmetadata.schema.entity.services.connections.TestConnectionResult; @@ -245,7 +244,7 @@ public MlModelService getByName( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = DatabaseService.class))) + schema = @Schema(implementation = MlModelService.class))) }) public MlModelService addTestConnectionResult( @Context UriInfo uriInfo, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java index d387685f5313..b6b5406ce008 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/pipeline/PipelineServiceResource.java @@ -47,7 +47,6 @@ import javax.ws.rs.core.UriInfo; import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.api.services.CreatePipelineService; -import org.openmetadata.schema.entity.services.DatabaseService; import org.openmetadata.schema.entity.services.PipelineService; import org.openmetadata.schema.entity.services.ServiceType; import org.openmetadata.schema.entity.services.connections.TestConnectionResult; @@ -246,7 +245,7 @@ public PipelineService getByName( content = @Content( mediaType = "application/json", - schema = @Schema(implementation = DatabaseService.class))) + schema = @Schema(implementation = PipelineService.class))) }) public PipelineService addTestConnectionResult( @Context UriInfo uriInfo,