diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java b/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java index 9b14e3aae53..82386f48c0f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java @@ -28,6 +28,7 @@ public class ResourceRegistry { MetadataOperation.CREATE, MetadataOperation.DELETE, MetadataOperation.VIEW_ALL, + MetadataOperation.VIEW_BASIC, MetadataOperation.EDIT_ALL, MetadataOperation.EDIT_DESCRIPTION, MetadataOperation.EDIT_DISPLAY_NAME)); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java index 4799bd639a6..135dec139f1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java @@ -2,10 +2,15 @@ package org.openmetadata.service.resources; import static org.openmetadata.common.utils.CommonUtil.listOrEmpty; import static org.openmetadata.schema.type.MetadataOperation.CREATE; +import static org.openmetadata.schema.type.MetadataOperation.VIEW_BASIC; import static org.openmetadata.service.util.EntityUtil.createOrUpdateOperation; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import java.util.UUID; import javax.json.JsonPatch; import javax.ws.rs.core.Response; @@ -22,6 +27,7 @@ import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.schema.type.csv.CsvImportResult; import org.openmetadata.service.Entity; import org.openmetadata.service.OpenMetadataApplicationConfig; +import org.openmetadata.service.exception.CatalogExceptionMessage; import org.openmetadata.service.jdbi3.EntityRepository; import org.openmetadata.service.jdbi3.ListFilter; import org.openmetadata.service.security.Authorizer; @@ -44,6 +50,7 @@ public abstract class EntityResource allowedFields; @Getter protected final K repository; protected final Authorizer authorizer; + protected final Map fieldsToViewOperations = new HashMap<>(); protected EntityResource(Class entityClass, K repository, Authorizer authorizer) { this.entityClass = entityClass; @@ -51,6 +58,7 @@ public abstract class EntityResource viewOperations = new TreeSet<>(); + for (String field : fields.getFieldList()) { + MetadataOperation operation = fieldsToViewOperations.get(field); + if (operation == null) { + return VIEW_ALL_OPERATIONS; + } + viewOperations.add(operation); + } + return viewOperations.toArray(new MetadataOperation[0]); } protected EntityReference getEntityReference(String entityType, String fqn) { @@ -317,4 +337,16 @@ public abstract class EntityResource getEntityReferences(String entityType, List fqns) { return EntityUtil.getEntityReferences(entityType, fqns); } + + protected void addViewOperation(String fieldsParam, MetadataOperation operation) { + String[] fields = fieldsParam.replace(" ", "").split(","); + for (String field : fields) { + if (allowedFields.contains(field)) { + fieldsToViewOperations.put(field, operation); + } else if (!"owner,followers,tags,extension".contains(field)) { + // Some common fields for all the entities might be missing. Ignore it. + throw new IllegalArgumentException(CatalogExceptionMessage.invalidField(field)); + } + } + } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java index 22f01da59eb..1cab124cf67 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java @@ -80,7 +80,6 @@ import org.openmetadata.service.util.ResultList; @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "Workflow") public class WorkflowResource extends EntityResource { - public static final String COLLECTION_PATH = "/v1/automations/workflows"; static final String FIELDS = "owner"; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java index 0c956a8cc6e..01d21945a5c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java @@ -73,6 +73,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "charts") public class ChartResource extends EntityResource { public static final String COLLECTION_PATH = "v1/charts/"; + static final String FIELDS = "owner,followers,tags"; @Override public Chart addHref(UriInfo uriInfo, Chart chart) { @@ -89,6 +90,7 @@ public class ChartResource extends EntityResource { @Override protected List getEntitySpecificOperations() { + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_LINEAGE); } @@ -96,8 +98,6 @@ public class ChartResource extends EntityResource { /* Required for serde */ } - static final String FIELDS = "owner,followers,tags"; - @GET @Operation( operationId = "listCharts", diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java index 99ce7ed7425..0b9725a2d49 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java @@ -73,7 +73,6 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "dashboards") public class DashboardResource extends EntityResource { public static final String COLLECTION_PATH = "v1/dashboards/"; - protected static final String FIELDS = "owner,charts,followers,tags,usageSummary,extension,dataModels"; @Override @@ -92,6 +91,8 @@ public class DashboardResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("charts,dataModels", MetadataOperation.VIEW_BASIC); + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_LINEAGE); } 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 f5f782bc622..89cb924f54f 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 @@ -13,6 +13,8 @@ package org.openmetadata.service.resources.databases; +import static org.openmetadata.common.utils.CommonUtil.listOf; + import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -49,6 +52,7 @@ import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.entity.data.Database; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.DatabaseRepository; @@ -67,6 +71,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "databases") public class DatabaseResource extends EntityResource { public static final String COLLECTION_PATH = "v1/databases/"; + static final String FIELDS = "owner,databaseSchemas,usageSummary,location,tags,extension"; @Override public Database addHref(UriInfo uriInfo, Database db) { @@ -77,6 +82,13 @@ public class DatabaseResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("databaseSchemas,location", MetadataOperation.VIEW_BASIC); + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); + return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE); + } + public DatabaseResource(CollectionDAO dao, Authorizer authorizer) { super(Database.class, new DatabaseRepository(dao), authorizer); } @@ -85,8 +97,6 @@ public class DatabaseResource extends EntityResource { public static final String COLLECTION_PATH = "v1/databaseSchemas/"; + static final String FIELDS = "owner,tables,usageSummary,tags,extension"; @Override public DatabaseSchema addHref(UriInfo uriInfo, DatabaseSchema schema) { @@ -81,12 +86,17 @@ public class DatabaseSchemaResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("tables", MetadataOperation.VIEW_BASIC); + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); + return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE); + } + public static class DatabaseSchemaList extends ResultList { /* Required for serde */ } - static final String FIELDS = "owner,tables,usageSummary,tags,extension"; - @GET @Operation( operationId = "listDBSchemas", diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java index 0d3646de1e0..cb1d45056fd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java @@ -96,13 +96,17 @@ public class TableResource extends EntityResource { public TableResource(CollectionDAO dao, Authorizer authorizer) { super(Table.class, new TableRepository(dao), authorizer); - allowedFields.add("customMetrics"); } @Override protected List getEntitySpecificOperations() { + allowedFields.add("customMetrics"); + addViewOperation( + "columns,tableConstraints,tablePartition,joins,viewDefinition,dataModel", MetadataOperation.VIEW_BASIC); + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); + addViewOperation("customMetrics", MetadataOperation.VIEW_TESTS); + addViewOperation("testSuite", MetadataOperation.VIEW_TESTS); return listOf( - MetadataOperation.VIEW_BASIC, MetadataOperation.VIEW_TESTS, MetadataOperation.VIEW_QUERIES, MetadataOperation.VIEW_DATA_PROFILE, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java index 071ad1d1412..bb94aebd50d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java @@ -13,8 +13,6 @@ package org.openmetadata.service.resources.datamodels; -import static org.openmetadata.common.utils.CommonUtil.listOf; - import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -25,7 +23,6 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; -import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -52,7 +49,6 @@ import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.entity.data.DashboardDataModel; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; -import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.DashboardDataModelRepository; @@ -89,11 +85,6 @@ public class DashboardDataModelResource extends EntityResource getEntitySpecificOperations() { - return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_LINEAGE); - } - public static class DashboardDataModelList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java index 6a7c10b7b05..b8e8fa31d67 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java @@ -89,6 +89,12 @@ public class TestCaseResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("testSuite,testDefinition", MetadataOperation.VIEW_BASIC); + return null; + } + public static class TestCaseList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java index 9e81476d503..6d9149832cd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java @@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -39,6 +40,7 @@ import org.openmetadata.schema.tests.TestSuite; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.EntityReference; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.ListFilter; @@ -57,7 +59,6 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "TestSuites") public class TestSuiteResource extends EntityResource { public static final String COLLECTION_PATH = "/v1/dataQuality/testSuites"; - static final String FIELDS = "owner,tests"; @Override @@ -71,6 +72,12 @@ public class TestSuiteResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("tests", MetadataOperation.VIEW_BASIC); + return null; + } + public static class TestSuiteList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java index 457330449e0..a2834839ecc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java @@ -59,6 +59,7 @@ import org.openmetadata.schema.entity.events.SubscriptionStatus; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Function; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.schema.type.SubscriptionResourceDescriptor; import org.openmetadata.service.Entity; import org.openmetadata.service.OpenMetadataApplicationConfig; @@ -104,6 +105,12 @@ public class EventSubscriptionResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("filteringRules", MetadataOperation.VIEW_BASIC); + return null; + } + public static class EventSubscriptionList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java index 30df002546f..87f70582135 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java @@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -49,6 +50,7 @@ import org.openmetadata.schema.api.data.RestoreEntity; import org.openmetadata.schema.entity.data.Glossary; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.schema.type.csv.CsvImportResult; import org.openmetadata.service.Entity; import org.openmetadata.service.jdbi3.CollectionDAO; @@ -70,6 +72,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "glossaries", order = 6) // Initialize before GlossaryTerm and after Classification and Tags public class GlossaryResource extends EntityResource { public static final String COLLECTION_PATH = "v1/glossaries/"; + static final String FIELDS = "owner,tags,reviewers,usageCount,termCount"; @Override public Glossary addHref(UriInfo uriInfo, Glossary glossary) { @@ -83,12 +86,16 @@ public class GlossaryResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("reviewers,usageCount,termCount", MetadataOperation.VIEW_BASIC); + return null; + } + public static class GlossaryList extends ResultList { /* Required for serde */ } - static final String FIELDS = "owner,tags,reviewers,usageCount,termCount"; - @GET @Valid @Operation( 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 aeacdf4bbd2..3dcba4a440d 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 @@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -51,6 +52,7 @@ import org.openmetadata.schema.entity.data.GlossaryTerm; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.EntityReference; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.OpenMetadataApplicationConfig; import org.openmetadata.service.exception.CatalogExceptionMessage; @@ -72,6 +74,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "glossaryTerms", order = 7) // Initialized after Glossary, Classification, and Tags public class GlossaryTermResource extends EntityResource { public static final String COLLECTION_PATH = "v1/glossaryTerms/"; + static final String FIELDS = "children,relatedTerms,reviewers,owner,tags,usageCount"; @Override public GlossaryTerm addHref(UriInfo uriInfo, GlossaryTerm term) { @@ -94,12 +97,16 @@ public class GlossaryTermResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("children,relatedTerms,reviewers,usageCount", MetadataOperation.VIEW_BASIC); + return null; + } + public static class GlossaryTermList extends ResultList { /* Required for serde */ } - static final String FIELDS = "children,relatedTerms,reviewers,owner,tags,usageCount"; - @GET @Valid @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java index 24730c8bdf8..68e5fe63aac 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/kpi/KpiResource.java @@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -40,6 +41,7 @@ import org.openmetadata.schema.dataInsight.kpi.Kpi; import org.openmetadata.schema.dataInsight.type.KpiResult; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.exception.EntityNotFoundException; import org.openmetadata.service.jdbi3.CollectionDAO; @@ -60,7 +62,6 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "kpi") public class KpiResource extends EntityResource { public static final String COLLECTION_PATH = "/v1/kpi"; - static final String FIELDS = "owner,dataInsightChart,kpiResult"; @Override @@ -75,6 +76,12 @@ public class KpiResource extends EntityResource { super(Kpi.class, new KpiRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("dataInsightChart,kpiResult", MetadataOperation.VIEW_BASIC); + return null; + } + public static class KpiList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/metrics/MetricsResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/metrics/MetricsResource.java index 21446faa149..1af3484ec86 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/metrics/MetricsResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/metrics/MetricsResource.java @@ -13,6 +13,8 @@ package org.openmetadata.service.resources.metrics; +import static org.openmetadata.common.utils.CommonUtil.listOf; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -20,6 +22,7 @@ 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.IOException; +import java.util.List; import java.util.UUID; import javax.validation.Valid; import javax.validation.constraints.Max; @@ -40,6 +43,7 @@ import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.UriInfo; import org.openmetadata.schema.entity.data.Metrics; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.ListFilter; import org.openmetadata.service.jdbi3.MetricsRepository; @@ -59,11 +63,18 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "metrics") public class MetricsResource extends EntityResource { public static final String COLLECTION_PATH = "/v1/metrics/"; + static final String FIELDS = "owner,usageSummary"; public MetricsResource(CollectionDAO dao, Authorizer authorizer) { super(Metrics.class, new MetricsRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); + return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE); + } + @Override public Metrics addHref(UriInfo uriInfo, Metrics entity) { return entity; @@ -73,8 +84,6 @@ public class MetricsResource extends EntityResource /* Required for serde */ } - static final String FIELDS = "owner,usageSummary"; - @GET @Operation( operationId = "listMetrics", diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java index 910dd485c0b..fd701d24373 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java @@ -13,6 +13,8 @@ package org.openmetadata.service.resources.mlmodels; +import static org.openmetadata.common.utils.CommonUtil.listOf; + import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -50,6 +53,7 @@ import org.openmetadata.schema.entity.data.MlModel; import org.openmetadata.schema.type.ChangeEvent; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.ListFilter; @@ -69,6 +73,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "mlmodels") public class MlModelResource extends EntityResource { public static final String COLLECTION_PATH = "v1/mlmodels/"; + static final String FIELDS = "owner,dashboard,followers,tags,usageSummary,extension"; @Override public MlModel addHref(UriInfo uriInfo, MlModel mlmodel) { @@ -84,12 +89,17 @@ public class MlModelResource extends EntityResource super(MlModel.class, new MlModelRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("dashboard", MetadataOperation.VIEW_BASIC); + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); + return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE); + } + public static class MlModelList extends ResultList { /* Required for serde */ } - static final String FIELDS = "owner,dashboard,followers,tags,usageSummary,extension"; - @GET @Valid @Operation( 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 daeb4095de8..a0d1520d7f4 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 @@ -78,6 +78,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "pipelines") public class PipelineResource extends EntityResource { public static final String COLLECTION_PATH = "v1/pipelines/"; + static final String FIELDS = "owner,tasks,pipelineStatus,followers,tags,extension"; @Override public Pipeline addHref(UriInfo uriInfo, Pipeline pipeline) { @@ -94,6 +95,7 @@ public class PipelineResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("tasks,pipelineStatus", MetadataOperation.VIEW_BASIC); return listOf(MetadataOperation.EDIT_LINEAGE, MetadataOperation.EDIT_STATUS); } @@ -105,8 +107,6 @@ public class PipelineResource extends EntityResource { public static final String COLLECTION_PATH = "v1/policies/"; + public static final String FIELDS = "owner,location,teams,roles"; @Override public Policy addHref(UriInfo uriInfo, Policy policy) { @@ -95,6 +96,12 @@ public class PolicyResource extends EntityResource { super(Policy.class, new PolicyRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("location,teams,roles", MetadataOperation.VIEW_BASIC); + return null; + } + @Override public void initialize(OpenMetadataApplicationConfig config) throws IOException { // Load any existing rules from database, before loading seed data. @@ -126,8 +133,6 @@ public class PolicyResource extends EntityResource { /* Required for serde */ } - public static final String FIELDS = "owner,location,teams,roles"; - @GET @Valid @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java index c1fe94b34a5..7fcd3232aea 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java @@ -64,13 +64,19 @@ import org.openmetadata.service.util.ResultList; @Consumes(MediaType.APPLICATION_JSON) @Collection(name = "queries") public class QueryResource extends EntityResource { - public static final String COLLECTION_PATH = "v1/queries/"; + static final String FIELDS = "owner,followers,users,votes,tags,queryUsedIn"; public QueryResource(CollectionDAO dao, Authorizer authorizer) { super(Query.class, new QueryRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("users,votes,queryUsedIn", MetadataOperation.VIEW_BASIC); + return null; + } + @Override public Query addHref(UriInfo uriInfo, Query entity) { Entity.withHref(uriInfo, entity.getOwner()); @@ -84,8 +90,6 @@ public class QueryResource extends EntityResource { /* Required for serde */ } - static final String FIELDS = "owner,followers,users,votes,tags,queryUsedIn"; - @GET @Operation( operationId = "listQueries", diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/reports/ReportResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/reports/ReportResource.java index 1c236e7f911..fa8d23f53ce 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/reports/ReportResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/reports/ReportResource.java @@ -13,6 +13,8 @@ package org.openmetadata.service.resources.reports; +import static org.openmetadata.common.utils.CommonUtil.listOf; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -20,6 +22,7 @@ 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.IOException; +import java.util.List; import java.util.UUID; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -38,6 +41,7 @@ import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.UriInfo; import org.openmetadata.schema.entity.data.Report; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.ListFilter; import org.openmetadata.service.jdbi3.ReportRepository; @@ -58,11 +62,18 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "reports") public class ReportResource extends EntityResource { public static final String COLLECTION_PATH = "/v1/reports/"; + static final String FIELDS = "owner,usageSummary"; public ReportResource(CollectionDAO dao, Authorizer authorizer) { super(Report.class, new ReportRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE); + return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE); + } + @Override public Report addHref(UriInfo uriInfo, Report entity) { return entity; @@ -72,8 +83,6 @@ public class ReportResource extends EntityResource { /* Required for serde */ } - static final String FIELDS = "owner,usageSummary"; - @GET @Operation( operationId = "listReports", diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java index cec154107ef..512e154abc1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/database/DatabaseServiceResource.java @@ -92,6 +92,12 @@ public class DatabaseServiceResource return service; } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("pipelines", MetadataOperation.VIEW_BASIC); + return null; + } + public DatabaseServiceResource(CollectionDAO dao, Authorizer authorizer) { super(DatabaseService.class, new DatabaseServiceRepository(dao), authorizer, ServiceType.DATABASE); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java index 2afa8ae44a1..da5f5f845fa 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/ingestionpipelines/IngestionPipelineResource.java @@ -106,6 +106,7 @@ public class IngestionPipelineResource extends EntityResource { public static final String COLLECTION_PATH = "v1/services/messagingServices/"; - public static final String FIELDS = FIELD_OWNER; @Override 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 c8f750ad6af..bdace02fca3 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 @@ -129,6 +129,12 @@ public class MetadataServiceResource super(MetadataService.class, new MetadataServiceRepository(dao), authorizer, ServiceType.METADATA); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("pipelines", MetadataOperation.VIEW_BASIC); + return null; + } + public static class MetadataServiceList extends ResultList { /* Required for serde */ } 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 a92b1246511..fdea179d7ff 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 @@ -13,6 +13,8 @@ package org.openmetadata.service.resources.services.mlmodel; +import static org.openmetadata.common.utils.CommonUtil.listOf; + import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -76,7 +78,6 @@ import org.openmetadata.service.util.ResultList; public class MlModelServiceResource extends ServiceEntityResource { public static final String COLLECTION_PATH = "v1/services/mlmodelServices/"; - public static final String FIELDS = "pipelines,owner,tags"; @Override @@ -91,6 +92,12 @@ public class MlModelServiceResource super(MlModelService.class, new MlModelServiceRepository(dao), authorizer, ServiceType.ML_MODEL); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("pipelines", MetadataOperation.VIEW_BASIC); + return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE); + } + public static class MlModelServiceList extends ResultList { /* Required for serde */ } 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 d27e0281d68..e81084f7196 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 @@ -90,6 +90,12 @@ public class PipelineServiceResource super(PipelineService.class, new PipelineServiceRepository(dao), authorizer, ServiceType.PIPELINE); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("pipelines", MetadataOperation.VIEW_BASIC); + return null; + } + public static class PipelineServiceList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java index be8f7bbc9b4..1bb9a877f91 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/services/storage/StorageServiceResource.java @@ -67,7 +67,6 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "storageServices") public class StorageServiceResource extends ServiceEntityResource { - public static final String COLLECTION_PATH = "v1/services/storageServices/"; static final String FIELDS = "pipelines,owner,tags"; @@ -83,6 +82,12 @@ public class StorageServiceResource super(StorageService.class, new StorageServiceRepository(dao), authorizer, ServiceType.STORAGE); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("pipelines", MetadataOperation.VIEW_BASIC); + return null; + } + public static class StorageServiceList extends ResultList { /* Required for serde */ } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java index b56311a2372..1700db66d5b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java @@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -37,6 +38,7 @@ import org.openmetadata.schema.entity.data.Container; import org.openmetadata.schema.type.ChangeEvent; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.ContainerRepository; @@ -59,6 +61,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "containers") public class ContainerResource extends EntityResource { public static final String COLLECTION_PATH = "v1/containers/"; + static final String FIELDS = "parent,children,dataModel,owner,tags,followers,extension"; @Override public Container addHref(UriInfo uriInfo, Container container) { @@ -75,15 +78,16 @@ public class ContainerResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("parent,children,dataModel", MetadataOperation.VIEW_BASIC); + return null; + } + public static class ContainerList extends ResultList { /* Required for serde */ } - /* List of fields that are not stored as a property in the json document. - These are typically relationships or properties that could have a lot of data. - */ - static final String FIELDS = "parent,children,dataModel,owner,tags,followers,extension"; - @GET @Valid @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java index c51c3a4bb73..fddc9398833 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/ClassificationResource.java @@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.Objects; import java.util.UUID; import javax.json.JsonPatch; @@ -52,6 +53,7 @@ import org.openmetadata.schema.entity.classification.Classification; import org.openmetadata.schema.entity.data.Table; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.jdbi3.ClassificationRepository; import org.openmetadata.service.jdbi3.CollectionDAO; import org.openmetadata.service.jdbi3.ListFilter; @@ -75,6 +77,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "classifications", order = 4) // Initialize before TagResource, Glossary, and GlossaryTerms public class ClassificationResource extends EntityResource { public static final String TAG_COLLECTION_PATH = "/v1/classifications/"; + static final String FIELDS = "usageCount,termCount"; static class ClassificationList extends ResultList { /* Required for serde */ @@ -85,8 +88,11 @@ public class ClassificationResource extends EntityResource getEntitySpecificOperations() { + addViewOperation("usageCount,termCount", MetadataOperation.VIEW_BASIC); + return null; + } @GET @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java index ba478df501b..8de2dd38d21 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java @@ -59,6 +59,7 @@ import org.openmetadata.schema.entity.classification.Tag; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.EntityReference; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.schema.type.Relationship; import org.openmetadata.service.Entity; import org.openmetadata.service.OpenMetadataApplicationConfig; @@ -92,6 +93,7 @@ import org.openmetadata.service.util.ResultList; public class TagResource extends EntityResource { private final CollectionDAO daoCollection; public static final String TAG_COLLECTION_PATH = "/v1/tags/"; + static final String FIELDS = "children, usageCount"; static class TagList extends ResultList { /* Required for serde */ @@ -103,6 +105,12 @@ public class TagResource extends EntityResource { daoCollection = collectionDAO; } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("children,usageCount", MetadataOperation.VIEW_BASIC); + return null; + } + private void migrateTags() { // Just want to run it when upgrading to version above 0.13.1 where tag relationship are not there , once we have // any entries we don't need to run it @@ -188,8 +196,6 @@ public class TagResource extends EntityResource { } } - static final String FIELDS = "children, usageCount"; - @GET @Valid @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java index 5d3ed97a241..0ad2bec2e3b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/RoleResource.java @@ -54,6 +54,7 @@ import org.openmetadata.schema.entity.teams.Role; import org.openmetadata.schema.type.EntityHistory; import org.openmetadata.schema.type.EntityReference; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.service.Entity; import org.openmetadata.service.OpenMetadataApplicationConfig; import org.openmetadata.service.jdbi3.CollectionDAO; @@ -79,6 +80,7 @@ import org.openmetadata.service.util.ResultList; @Slf4j public class RoleResource extends EntityResource { public static final String COLLECTION_PATH = "/v1/roles/"; + public static final String FIELDS = "policies,teams,users"; @Override public Role addHref(UriInfo uriInfo, Role role) { @@ -92,6 +94,12 @@ public class RoleResource extends EntityResource { super(Role.class, new RoleRepository(collectionDAO), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("policies,teams,users", MetadataOperation.VIEW_BASIC); + return null; + } + @Override public void initialize(OpenMetadataApplicationConfig config) throws IOException { List roles = repository.getEntitiesFromSeedData(); @@ -111,8 +119,6 @@ public class RoleResource extends EntityResource { /* Required for serde */ } - public static final String FIELDS = "policies,teams,users"; - @GET @Valid @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java index 7c10b158179..b42f8860046 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java @@ -103,6 +103,8 @@ public class TeamResource extends EntityResource { @Override protected List getEntitySpecificOperations() { + addViewOperation( + "profile,owns,defaultRoles,parents,children,policies,userCount,childrenCount", MetadataOperation.VIEW_BASIC); return listOf(MetadataOperation.EDIT_POLICY, MetadataOperation.EDIT_USERS); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index 4d70cf9bfec..fe5034a4298 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -158,6 +158,7 @@ public class UserResource extends EntityResource { private boolean isEmailServiceEnabled; private AuthenticationConfiguration authenticationConfiguration; private final AuthenticatorHandler authHandler; + static final String FIELDS = "profile,roles,teams,follows,owns"; @Override public User addHref(UriInfo uriInfo, User user) { @@ -180,6 +181,7 @@ public class UserResource extends EntityResource { @Override protected List getEntitySpecificOperations() { + addViewOperation("profile,roles,teams,follows,owns", MetadataOperation.VIEW_BASIC); return listOf(MetadataOperation.EDIT_TEAMS); } @@ -201,8 +203,6 @@ public class UserResource extends EntityResource { /* Required for serde */ } - static final String FIELDS = "profile,roles,teams,follows,owns"; - @GET @Valid @Operation( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java index 17e276a7471..2d86649f465 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java @@ -13,6 +13,8 @@ package org.openmetadata.service.resources.topics; +import static org.openmetadata.common.utils.CommonUtil.listOf; + import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.json.JsonPatch; import javax.validation.Valid; @@ -73,6 +76,7 @@ import org.openmetadata.service.util.ResultList; @Collection(name = "topics") public class TopicResource extends EntityResource { public static final String COLLECTION_PATH = "v1/topics/"; + static final String FIELDS = "owner,followers,tags,sampleData,extension"; @Override public Topic addHref(UriInfo uriInfo, Topic topic) { @@ -86,12 +90,16 @@ public class TopicResource extends EntityResource { super(Topic.class, new TopicRepository(dao), authorizer); } + @Override + protected List getEntitySpecificOperations() { + addViewOperation("sampleData", MetadataOperation.VIEW_SAMPLE_DATA); + return listOf(MetadataOperation.VIEW_SAMPLE_DATA, MetadataOperation.EDIT_SAMPLE_DATA); + } + public static class TopicList extends ResultList { /* Required for serde */ } - static final String FIELDS = "owner,followers,tags,sampleData,extension"; - @GET @Operation( operationId = "listTopics", diff --git a/openmetadata-spec/src/main/resources/json/schema/entity/data/chart.json b/openmetadata-spec/src/main/resources/json/schema/entity/data/chart.json index 729a37572ca..5f93b1b3ba5 100644 --- a/openmetadata-spec/src/main/resources/json/schema/entity/data/chart.json +++ b/openmetadata-spec/src/main/resources/json/schema/entity/data/chart.json @@ -126,7 +126,7 @@ "$ref": "../services/dashboardService.json#/definitions/dashboardServiceType" }, "usageSummary": { - "description": "Latest usage information for this database.", + "description": "Latest usage information for this chart.", "$ref": "../../type/usageDetails.json", "default": null }, diff --git a/openmetadata-spec/src/main/resources/json/schema/entity/data/dashboard.json b/openmetadata-spec/src/main/resources/json/schema/entity/data/dashboard.json index ebc574d4da0..a35d454c9f9 100644 --- a/openmetadata-spec/src/main/resources/json/schema/entity/data/dashboard.json +++ b/openmetadata-spec/src/main/resources/json/schema/entity/data/dashboard.json @@ -83,7 +83,7 @@ "$ref": "../services/dashboardService.json#/definitions/dashboardServiceType" }, "usageSummary": { - "description": "Latest usage information for this database.", + "description": "Latest usage information for this dashboard.", "$ref": "../../type/usageDetails.json", "default": null },