Fixes some things on the APICollection (#17704)

This commit is contained in:
IceS2 2024-09-05 11:04:50 +02:00 committed by GitHub
parent aec3e70875
commit d1bc19fbf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -23,7 +23,7 @@ import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.Include; import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.Relationship; import org.openmetadata.schema.type.Relationship;
import org.openmetadata.service.Entity; import org.openmetadata.service.Entity;
import org.openmetadata.service.resources.databases.DatabaseResource; import org.openmetadata.service.resources.apis.APICollectionResource;
import org.openmetadata.service.util.EntityUtil.Fields; import org.openmetadata.service.util.EntityUtil.Fields;
import org.openmetadata.service.util.FullyQualifiedName; import org.openmetadata.service.util.FullyQualifiedName;
@ -32,7 +32,7 @@ public class APICollectionRepository extends EntityRepository<APICollection> {
public APICollectionRepository() { public APICollectionRepository() {
super( super(
DatabaseResource.COLLECTION_PATH, APICollectionResource.COLLECTION_PATH,
Entity.API_COLLCECTION, Entity.API_COLLCECTION,
APICollection.class, APICollection.class,
Entity.getCollectionDAO().apiCollectionDAO(), Entity.getCollectionDAO().apiCollectionDAO(),

View File

@ -50,7 +50,6 @@ import org.openmetadata.schema.api.VoteRequest;
import org.openmetadata.schema.api.data.CreateAPICollection; import org.openmetadata.schema.api.data.CreateAPICollection;
import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.api.data.RestoreEntity;
import org.openmetadata.schema.entity.data.APICollection; import org.openmetadata.schema.entity.data.APICollection;
import org.openmetadata.schema.entity.data.Database;
import org.openmetadata.schema.type.ChangeEvent; import org.openmetadata.schema.type.ChangeEvent;
import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include; import org.openmetadata.schema.type.Include;
@ -268,7 +267,7 @@ public class APICollectionResource extends EntityResource<APICollection, APIColl
responses = { responses = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "database", description = "APICollection",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
@ -303,7 +302,7 @@ public class APICollectionResource extends EntityResource<APICollection, APIColl
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Database.class))), schema = @Schema(implementation = APICollection.class))),
@ApiResponse(responseCode = "400", description = "Bad request") @ApiResponse(responseCode = "400", description = "Bad request")
}) })
public Response create( public Response create(
@ -422,7 +421,7 @@ public class APICollectionResource extends EntityResource<APICollection, APIColl
@QueryParam("hardDelete") @QueryParam("hardDelete")
@DefaultValue("false") @DefaultValue("false")
boolean hardDelete, boolean hardDelete,
@Parameter(description = "Id of the database", schema = @Schema(type = "UUID")) @Parameter(description = "Id of the APICollection", schema = @Schema(type = "UUID"))
@PathParam("id") @PathParam("id")
UUID id) { UUID id) {
return delete(uriInfo, securityContext, id, recursive, hardDelete); return delete(uriInfo, securityContext, id, recursive, hardDelete);
@ -466,7 +465,9 @@ public class APICollectionResource extends EntityResource<APICollection, APIColl
"Delete a API Collection by `fullyQualifiedName`. API Collection can only be deleted if it has no API Endpoints.", "Delete a API Collection by `fullyQualifiedName`. API Collection can only be deleted if it has no API Endpoints.",
responses = { responses = {
@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Database for instance {fqn} is not found") @ApiResponse(
responseCode = "404",
description = "APIColletion for instance {fqn} is not found")
}) })
public Response delete( public Response delete(
@Context UriInfo uriInfo, @Context UriInfo uriInfo,
@ -481,7 +482,7 @@ public class APICollectionResource extends EntityResource<APICollection, APIColl
@DefaultValue("false") @DefaultValue("false")
boolean recursive, boolean recursive,
@Parameter( @Parameter(
description = "Fully qualified name of the database", description = "Fully qualified name of the APICollection",
schema = @Schema(type = "string")) schema = @Schema(type = "string"))
@PathParam("fqn") @PathParam("fqn")
String fqn) { String fqn) {
@ -503,7 +504,7 @@ public class APICollectionResource extends EntityResource<APICollection, APIColl
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = APICollection.class))) schema = @Schema(implementation = APICollection.class)))
}) })
public Response restoreDatabase( public Response restore(
@Context UriInfo uriInfo, @Context UriInfo uriInfo,
@Context SecurityContext securityContext, @Context SecurityContext securityContext,
@Valid RestoreEntity restore) { @Valid RestoreEntity restore) {