diff --git a/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java index ff16facbac..1e73a7e181 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java @@ -62,7 +62,7 @@ public class SearchResourceImpl implements SearchResource { @Authorized(style = AuthorizedStyle.None, level = AuthorizedLevel.Read) public ArtifactSearchResults searchArtifacts(String name, BigInteger offset, BigInteger limit, SortOrder order, ArtifactSortBy orderby, List labels, String description, String groupId, - Long globalId, Long contentId, String artifactId) { + Long globalId, Long contentId, String artifactId, String artifactType) { if (orderby == null) { orderby = ArtifactSortBy.name; } @@ -90,6 +90,9 @@ public ArtifactSearchResults searchArtifacts(String name, BigInteger offset, Big if (!StringUtil.isEmpty(artifactId)) { filters.add(SearchFilter.ofArtifactId(artifactId)); } + if (!StringUtil.isEmpty(artifactType)) { + filters.add(SearchFilter.ofArtifactType(artifactType)); + } if (labels != null && !labels.isEmpty()) { labels.stream().map(prop -> { @@ -234,7 +237,8 @@ public GroupSearchResults searchGroups(BigInteger offset, BigInteger limit, Sort @Authorized(style = AuthorizedStyle.None, level = AuthorizedLevel.Read) public VersionSearchResults searchVersions(String version, BigInteger offset, BigInteger limit, SortOrder order, VersionSortBy orderby, List labels, String description, String groupId, - Long globalId, Long contentId, String artifactId, String name, VersionState state) { + Long globalId, Long contentId, String artifactId, String name, VersionState state, + String artifactType) { if (orderby == null) { orderby = VersionSortBy.globalId; } @@ -265,6 +269,9 @@ public VersionSearchResults searchVersions(String version, BigInteger offset, Bi if (!StringUtil.isEmpty(description)) { filters.add(SearchFilter.ofDescription(description)); } + if (!StringUtil.isEmpty(artifactType)) { + filters.add(SearchFilter.ofArtifactType(artifactType)); + } if (labels != null && !labels.isEmpty()) { labels.stream().map(prop -> { int delimiterIndex = prop.indexOf(":"); diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java index 12eddc836b..87df0482cc 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java @@ -62,6 +62,10 @@ public static SearchFilter ofVersion(String value) { return new SearchFilter(SearchFilterType.version, value); } + public static SearchFilter ofArtifactType(String value) { + return new SearchFilter(SearchFilterType.artifactType, value); + } + public static SearchFilter ofCanonicalHash(String value) { return new SearchFilter(SearchFilterType.canonicalHash, value); } diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java index 889871f60f..b294529e35 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java @@ -2,6 +2,6 @@ public enum SearchFilterType { - groupId, artifactId, version, name, description, labels, contentHash, canonicalHash, globalId, contentId, state + groupId, artifactId, version, name, description, labels, contentHash, canonicalHash, globalId, contentId, state, artifactType } diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java index 321c78b34c..03e46c691c 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java @@ -990,6 +990,13 @@ public ArtifactSearchResultsDto searchArtifacts(Set filters, Order query.bind(idx, filter.getStringValue()); }); break; + case artifactType: + op = filter.isNot() ? "!=" : "="; + where.append("a.type " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, filter.getStringValue()); + }); + break; case contentHash: op = filter.isNot() ? "!=" : "="; where.append( @@ -1601,9 +1608,17 @@ public VersionSearchResultsDto searchVersions(Set filters, OrderBy query.bind(idx, normalizeGroupId(filter.getStringValue())); }); break; + case artifactType: + op = filter.isNot() ? "!=" : "="; + where.append("a.type " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, filter.getStringValue()); + }); + break; case artifactId: case contentId: case globalId: + case state: case version: op = filter.isNot() ? "!=" : "="; where.append("v."); @@ -1664,13 +1679,6 @@ public VersionSearchResultsDto searchVersions(Set filters, OrderBy }); where.append(")"); break; - case state: - op = filter.isNot() ? "!=" : "="; - where.append("v.state " + op + " ?"); - binders.add((query, idx) -> { - query.bind(idx, normalizeGroupId(filter.getStringValue())); - }); - break; default: throw new RegistryStorageException("Filter type not supported: " + filter.getType()); } diff --git a/app/src/test/java/io/apicurio/registry/noprofile/ArtifactSearchTest.java b/app/src/test/java/io/apicurio/registry/noprofile/ArtifactSearchTest.java index 662eaad57b..481c171bc3 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/ArtifactSearchTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/ArtifactSearchTest.java @@ -8,6 +8,7 @@ import io.apicurio.registry.rest.client.models.SortOrder; import io.apicurio.registry.types.ArtifactType; import io.apicurio.registry.types.ContentTypes; +import io.apicurio.registry.utils.tests.TestUtils; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -195,4 +196,31 @@ void testCaseInsensitiveSearch() throws Exception { Assertions.assertEquals(1, propertiesSearch.getCount()); } -} + @Test + void testFilterByArtifactType() throws Exception { + String groupId = TestUtils.generateGroupId(); + + createArtifact(groupId, "avro-artifact", ArtifactType.AVRO, "{}", ContentTypes.APPLICATION_JSON); + createArtifact(groupId, "json-artifact", ArtifactType.JSON, "{}", ContentTypes.APPLICATION_JSON); + + ArtifactSearchResults results = clientV3.search().artifacts().get(config -> { + config.queryParameters.groupId = groupId; + }); + Assertions.assertNotNull(results); + Assertions.assertEquals(2, results.getCount()); + + results = clientV3.search().artifacts().get(config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactType = ArtifactType.AVRO; + }); + Assertions.assertNotNull(results); + Assertions.assertEquals(1, results.getCount()); + + results = clientV3.search().artifacts().get(config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactType = ArtifactType.JSON; + }); + Assertions.assertNotNull(results); + Assertions.assertEquals(1, results.getCount()); + } +} \ No newline at end of file diff --git a/app/src/test/java/io/apicurio/registry/noprofile/VersionSearchTest.java b/app/src/test/java/io/apicurio/registry/noprofile/VersionSearchTest.java new file mode 100644 index 0000000000..55e916296e --- /dev/null +++ b/app/src/test/java/io/apicurio/registry/noprofile/VersionSearchTest.java @@ -0,0 +1,44 @@ +package io.apicurio.registry.noprofile; + +import io.apicurio.registry.AbstractResourceTestBase; +import io.apicurio.registry.rest.client.models.VersionSearchResults; +import io.apicurio.registry.types.ArtifactType; +import io.apicurio.registry.types.ContentTypes; +import io.apicurio.registry.utils.tests.TestUtils; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +@QuarkusTest +public class VersionSearchTest extends AbstractResourceTestBase { + + @Test + void testFilterByArtifactType() throws Exception { + String groupId = TestUtils.generateGroupId(); + + createArtifact(groupId, "avro-artifact", ArtifactType.AVRO, "{}", ContentTypes.APPLICATION_JSON); + createArtifactVersion(groupId, "avro-artifact", "{ }", ContentTypes.APPLICATION_JSON); + createArtifact(groupId, "json-artifact", ArtifactType.JSON, "{}", ContentTypes.APPLICATION_JSON); + + VersionSearchResults results = clientV3.search().versions().get(config -> { + config.queryParameters.groupId = groupId; + }); + Assertions.assertNotNull(results); + Assertions.assertEquals(3, results.getCount()); + + results = clientV3.search().versions().get(config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactType = ArtifactType.AVRO; + }); + Assertions.assertNotNull(results); + Assertions.assertEquals(2, results.getCount()); + + results = clientV3.search().versions().get(config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactType = ArtifactType.JSON; + }); + Assertions.assertNotNull(results); + Assertions.assertEquals(1, results.getCount()); + + } +} \ No newline at end of file diff --git a/common/src/main/resources/META-INF/openapi.json b/common/src/main/resources/META-INF/openapi.json index 3afdd2503f..bcac247698 100644 --- a/common/src/main/resources/META-INF/openapi.json +++ b/common/src/main/resources/META-INF/openapi.json @@ -376,6 +376,14 @@ "type": "string" }, "in": "query" + }, + { + "name": "artifactType", + "description": "Filter by artifact type (`AVRO`, `JSON`, etc).", + "schema": { + "$ref": "#/components/schemas/ArtifactType" + }, + "in": "query" } ], "responses": { @@ -2930,6 +2938,14 @@ "$ref": "#/components/schemas/VersionState" }, "in": "query" + }, + { + "name": "artifactType", + "description": "Filter by artifact type (`AVRO`, `JSON`, etc).", + "schema": { + "$ref": "#/components/schemas/ArtifactType" + }, + "in": "query" } ], "responses": { diff --git a/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc b/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc index f577ec0606..7301d0aece 100644 --- a/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc +++ b/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc @@ -669,36 +669,6 @@ The following {registry} configuration options are available for each component |`sa` |`3.0.0` |Gitops green datasource username -|`apicurio.datasource.jdbc.initial-size` -|`string` -|`20` -|`3.0.0` -|Application datasource pool initial size -|`apicurio.datasource.jdbc.max-size` -|`string` -|`100` -|`3.0.0` -|Application datasource pool maximum size -|`apicurio.datasource.jdbc.min-size` -|`string` -|`20` -|`3.0.0` -|Application datasource pool minimum size -|`apicurio.datasource.password` -|`string` -|`sa` -|`3.0.0` -|Application datasource password -|`apicurio.datasource.url` -|`string` -|`jdbc:h2:mem:registry_db` -|`3.0.0` -|Application datasource jdbc url -|`apicurio.datasource.username` -|`string` -|`sa` -|`3.0.0` -|Application datasource username |`apicurio.events.kafka.topic` |`string` |`registry-events` diff --git a/go-sdk/pkg/registryclient-v3/groups/item_artifacts_request_builder.go b/go-sdk/pkg/registryclient-v3/groups/item_artifacts_request_builder.go index 2d84489535..efc37c6279 100644 --- a/go-sdk/pkg/registryclient-v3/groups/item_artifacts_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/groups/item_artifacts_request_builder.go @@ -47,7 +47,7 @@ type ItemArtifactsRequestBuilderGetRequestConfiguration struct { QueryParameters *ItemArtifactsRequestBuilderGetQueryParameters } -// ItemArtifactsRequestBuilderPostQueryParameters creates a new artifact. The body of the request should be a `CreateArtifact` object, which includes the metadata of the new artifact and, optionally, the metadata and content of the first version.If the artifact type is not provided, the registry attempts to figure out what kind of artifact is being added from thefollowing supported list:* Avro (`AVRO`)* Protobuf (`PROTOBUF`)* JSON Schema (`JSON`)* Kafka Connect (`KCONNECT`)* OpenAPI (`OPENAPI`)* AsyncAPI (`ASYNCAPI`)* GraphQL (`GRAPHQL`)* Web Services Description Language (`WSDL`)* XML Schema (`XSD`)An artifact will be created using the unique artifact ID that can optionally be provided in the request body. If not provided in the request, the server willgenerate a unique ID for the artifact. It is typically recommended that callersprovide the ID, because it is typically a meaningful identifier, and as suchfor most use cases should be supplied by the caller.If an artifact with the provided artifact ID already exists, the default behavioris for the server to reject the content with a 409 error. However, the caller cansupply the `ifExists` query parameter to alter this default behavior. The `ifExists`query parameter can have one of the following values:* `FAIL` (*default*) - server rejects the content with a 409 error* `UPDATE` - server updates the existing artifact and returns the new metadata* `RETURN` - server does not create or add content to the server, but instead returns the metadata for the existing artifact* `RETURN_OR_UPDATE` - server returns an existing **version** that matches the provided content if such a version exists, otherwise a new version is createdThis operation may fail for one of the following reasons:* An invalid `ArtifactType` was indicated (HTTP error `400`)* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)* Provided content (request body) was empty (HTTP error `400`)* An invalid version number was used for the optional included first version (HTTP error `400`)* An artifact with the provided ID already exists (HTTP error `409`)* The content violates one of the configured global rules (HTTP error `409`)* A server error occurred (HTTP error `500`)Note that if the `dryRun` query parameter is set to `true`, then this operationwill not actually make any changes. Instead it will succeed or fail based on whether it **would have worked**. Use this option to, for example, check if anartifact is valid or if a new version passes configured compatibility checks. +// ItemArtifactsRequestBuilderPostQueryParameters creates a new artifact. The body of the request should be a `CreateArtifact` object, which includes the metadata of the new artifact and, optionally, the metadata and content of the first version.If the artifact type is not provided, the registry attempts to figure out what kind of artifact is being added from thefollowing supported list:* Avro (`AVRO`)* Protobuf (`PROTOBUF`)* JSON Schema (`JSON`)* Kafka Connect (`KCONNECT`)* OpenAPI (`OPENAPI`)* AsyncAPI (`ASYNCAPI`)* GraphQL (`GRAPHQL`)* Web Services Description Language (`WSDL`)* XML Schema (`XSD`)An artifact will be created using the unique artifact ID that can optionally be provided in the request body. If not provided in the request, the server willgenerate a unique ID for the artifact. It is typically recommended that callersprovide the ID, because it is typically a meaningful identifier, and as suchfor most use cases should be supplied by the caller.If an artifact with the provided artifact ID already exists, the default behavioris for the server to reject the content with a 409 error. However, the caller cansupply the `ifExists` query parameter to alter this default behavior. The `ifExists`query parameter can have one of the following values:* `FAIL` (*default*) - server rejects the content with a 409 error* `CREATE_VERSION` - server creates a new version of the existing artifact and returns it* `FIND_OR_CREATE_VERSION` - server returns an existing **version** that matches the provided content if such a version exists, otherwise a new version is createdThis operation may fail for one of the following reasons:* An invalid `ArtifactType` was indicated (HTTP error `400`)* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)* Provided content (request body) was empty (HTTP error `400`)* An invalid version number was used for the optional included first version (HTTP error `400`)* An artifact with the provided ID already exists (HTTP error `409`)* The content violates one of the configured global rules (HTTP error `409`)* A server error occurred (HTTP error `500`)Note that if the `dryRun` query parameter is set to `true`, then this operationwill not actually make any changes. Instead it will succeed or fail based on whether it **would have worked**. Use this option to, for example, check if anartifact is valid or if a new version passes configured compatibility checks. type ItemArtifactsRequestBuilderPostQueryParameters struct { // Used only when the `ifExists` query parameter is set to `RETURN_OR_UPDATE`, this parameter can be set to `true` to indicate that the server should "canonicalize" the content when searching for a matching version. The canonicalization algorithm is unique to each artifact type, but typically involves removing extra whitespace and formatting the content in a consistent manner. Canonical *bool `uriparametername:"canonical"` @@ -136,7 +136,7 @@ func (m *ItemArtifactsRequestBuilder) Get(ctx context.Context, requestConfigurat return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.ArtifactSearchResultsable), nil } -// Post creates a new artifact. The body of the request should be a `CreateArtifact` object, which includes the metadata of the new artifact and, optionally, the metadata and content of the first version.If the artifact type is not provided, the registry attempts to figure out what kind of artifact is being added from thefollowing supported list:* Avro (`AVRO`)* Protobuf (`PROTOBUF`)* JSON Schema (`JSON`)* Kafka Connect (`KCONNECT`)* OpenAPI (`OPENAPI`)* AsyncAPI (`ASYNCAPI`)* GraphQL (`GRAPHQL`)* Web Services Description Language (`WSDL`)* XML Schema (`XSD`)An artifact will be created using the unique artifact ID that can optionally be provided in the request body. If not provided in the request, the server willgenerate a unique ID for the artifact. It is typically recommended that callersprovide the ID, because it is typically a meaningful identifier, and as suchfor most use cases should be supplied by the caller.If an artifact with the provided artifact ID already exists, the default behavioris for the server to reject the content with a 409 error. However, the caller cansupply the `ifExists` query parameter to alter this default behavior. The `ifExists`query parameter can have one of the following values:* `FAIL` (*default*) - server rejects the content with a 409 error* `UPDATE` - server updates the existing artifact and returns the new metadata* `RETURN` - server does not create or add content to the server, but instead returns the metadata for the existing artifact* `RETURN_OR_UPDATE` - server returns an existing **version** that matches the provided content if such a version exists, otherwise a new version is createdThis operation may fail for one of the following reasons:* An invalid `ArtifactType` was indicated (HTTP error `400`)* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)* Provided content (request body) was empty (HTTP error `400`)* An invalid version number was used for the optional included first version (HTTP error `400`)* An artifact with the provided ID already exists (HTTP error `409`)* The content violates one of the configured global rules (HTTP error `409`)* A server error occurred (HTTP error `500`)Note that if the `dryRun` query parameter is set to `true`, then this operationwill not actually make any changes. Instead it will succeed or fail based on whether it **would have worked**. Use this option to, for example, check if anartifact is valid or if a new version passes configured compatibility checks. +// Post creates a new artifact. The body of the request should be a `CreateArtifact` object, which includes the metadata of the new artifact and, optionally, the metadata and content of the first version.If the artifact type is not provided, the registry attempts to figure out what kind of artifact is being added from thefollowing supported list:* Avro (`AVRO`)* Protobuf (`PROTOBUF`)* JSON Schema (`JSON`)* Kafka Connect (`KCONNECT`)* OpenAPI (`OPENAPI`)* AsyncAPI (`ASYNCAPI`)* GraphQL (`GRAPHQL`)* Web Services Description Language (`WSDL`)* XML Schema (`XSD`)An artifact will be created using the unique artifact ID that can optionally be provided in the request body. If not provided in the request, the server willgenerate a unique ID for the artifact. It is typically recommended that callersprovide the ID, because it is typically a meaningful identifier, and as suchfor most use cases should be supplied by the caller.If an artifact with the provided artifact ID already exists, the default behavioris for the server to reject the content with a 409 error. However, the caller cansupply the `ifExists` query parameter to alter this default behavior. The `ifExists`query parameter can have one of the following values:* `FAIL` (*default*) - server rejects the content with a 409 error* `CREATE_VERSION` - server creates a new version of the existing artifact and returns it* `FIND_OR_CREATE_VERSION` - server returns an existing **version** that matches the provided content if such a version exists, otherwise a new version is createdThis operation may fail for one of the following reasons:* An invalid `ArtifactType` was indicated (HTTP error `400`)* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)* Provided content (request body) was empty (HTTP error `400`)* An invalid version number was used for the optional included first version (HTTP error `400`)* An artifact with the provided ID already exists (HTTP error `409`)* The content violates one of the configured global rules (HTTP error `409`)* A server error occurred (HTTP error `500`)Note that if the `dryRun` query parameter is set to `true`, then this operationwill not actually make any changes. Instead it will succeed or fail based on whether it **would have worked**. Use this option to, for example, check if anartifact is valid or if a new version passes configured compatibility checks. // returns a CreateArtifactResponseable when successful // returns a ProblemDetails error when the service returns a 400 status code // returns a RuleViolationProblemDetails error when the service returns a 409 status code @@ -188,7 +188,7 @@ func (m *ItemArtifactsRequestBuilder) ToGetRequestInformation(ctx context.Contex return requestInfo, nil } -// ToPostRequestInformation creates a new artifact. The body of the request should be a `CreateArtifact` object, which includes the metadata of the new artifact and, optionally, the metadata and content of the first version.If the artifact type is not provided, the registry attempts to figure out what kind of artifact is being added from thefollowing supported list:* Avro (`AVRO`)* Protobuf (`PROTOBUF`)* JSON Schema (`JSON`)* Kafka Connect (`KCONNECT`)* OpenAPI (`OPENAPI`)* AsyncAPI (`ASYNCAPI`)* GraphQL (`GRAPHQL`)* Web Services Description Language (`WSDL`)* XML Schema (`XSD`)An artifact will be created using the unique artifact ID that can optionally be provided in the request body. If not provided in the request, the server willgenerate a unique ID for the artifact. It is typically recommended that callersprovide the ID, because it is typically a meaningful identifier, and as suchfor most use cases should be supplied by the caller.If an artifact with the provided artifact ID already exists, the default behavioris for the server to reject the content with a 409 error. However, the caller cansupply the `ifExists` query parameter to alter this default behavior. The `ifExists`query parameter can have one of the following values:* `FAIL` (*default*) - server rejects the content with a 409 error* `UPDATE` - server updates the existing artifact and returns the new metadata* `RETURN` - server does not create or add content to the server, but instead returns the metadata for the existing artifact* `RETURN_OR_UPDATE` - server returns an existing **version** that matches the provided content if such a version exists, otherwise a new version is createdThis operation may fail for one of the following reasons:* An invalid `ArtifactType` was indicated (HTTP error `400`)* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)* Provided content (request body) was empty (HTTP error `400`)* An invalid version number was used for the optional included first version (HTTP error `400`)* An artifact with the provided ID already exists (HTTP error `409`)* The content violates one of the configured global rules (HTTP error `409`)* A server error occurred (HTTP error `500`)Note that if the `dryRun` query parameter is set to `true`, then this operationwill not actually make any changes. Instead it will succeed or fail based on whether it **would have worked**. Use this option to, for example, check if anartifact is valid or if a new version passes configured compatibility checks. +// ToPostRequestInformation creates a new artifact. The body of the request should be a `CreateArtifact` object, which includes the metadata of the new artifact and, optionally, the metadata and content of the first version.If the artifact type is not provided, the registry attempts to figure out what kind of artifact is being added from thefollowing supported list:* Avro (`AVRO`)* Protobuf (`PROTOBUF`)* JSON Schema (`JSON`)* Kafka Connect (`KCONNECT`)* OpenAPI (`OPENAPI`)* AsyncAPI (`ASYNCAPI`)* GraphQL (`GRAPHQL`)* Web Services Description Language (`WSDL`)* XML Schema (`XSD`)An artifact will be created using the unique artifact ID that can optionally be provided in the request body. If not provided in the request, the server willgenerate a unique ID for the artifact. It is typically recommended that callersprovide the ID, because it is typically a meaningful identifier, and as suchfor most use cases should be supplied by the caller.If an artifact with the provided artifact ID already exists, the default behavioris for the server to reject the content with a 409 error. However, the caller cansupply the `ifExists` query parameter to alter this default behavior. The `ifExists`query parameter can have one of the following values:* `FAIL` (*default*) - server rejects the content with a 409 error* `CREATE_VERSION` - server creates a new version of the existing artifact and returns it* `FIND_OR_CREATE_VERSION` - server returns an existing **version** that matches the provided content if such a version exists, otherwise a new version is createdThis operation may fail for one of the following reasons:* An invalid `ArtifactType` was indicated (HTTP error `400`)* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)* Provided content (request body) was empty (HTTP error `400`)* An invalid version number was used for the optional included first version (HTTP error `400`)* An artifact with the provided ID already exists (HTTP error `409`)* The content violates one of the configured global rules (HTTP error `409`)* A server error occurred (HTTP error `500`)Note that if the `dryRun` query parameter is set to `true`, then this operationwill not actually make any changes. Instead it will succeed or fail based on whether it **would have worked**. Use this option to, for example, check if anartifact is valid or if a new version passes configured compatibility checks. // returns a *RequestInformation when successful func (m *ItemArtifactsRequestBuilder) ToPostRequestInformation(ctx context.Context, body i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateArtifactable, requestConfiguration *ItemArtifactsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/go-sdk/pkg/registryclient-v3/kiota-lock.json b/go-sdk/pkg/registryclient-v3/kiota-lock.json index e76df826a5..3bd9a7f358 100644 --- a/go-sdk/pkg/registryclient-v3/kiota-lock.json +++ b/go-sdk/pkg/registryclient-v3/kiota-lock.json @@ -1,5 +1,5 @@ { - "descriptionHash": "1494AA12BB8D5D92915A230B88E70766D0D39CD6DFFF99D36D62AED1CAE34F87673F1CB46CB5CB48DB3BC4A45C3B84CBE26F2EEEBC4FB567BD6F2E564B225FF4", + "descriptionHash": "9C6B7AD5AB1EEDA5B3806FF89BC6FAA4C7C5164514EA4645441DA93008326F0CBFCDCF30FC33303D563EC43A1ECD5237F283B1E799182B40B375A5A69853C931", "descriptionLocation": "../../v3.json", "lockFileVersion": "1.0.0", "kiotaVersion": "1.20.0", diff --git a/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go b/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go index 024a74ff76..d2dcc5a7c9 100644 --- a/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go @@ -15,6 +15,8 @@ type ArtifactsRequestBuilder struct { type ArtifactsRequestBuilderGetQueryParameters struct { // Filter by artifactId. ArtifactId *string `uriparametername:"artifactId"` + // Filter by artifact type (`AVRO`, `JSON`, etc). + ArtifactType *string `uriparametername:"artifactType"` // Filter by contentId. ContentId *int64 `uriparametername:"contentId"` // Filter by description. diff --git a/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go b/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go index 68386fc4db..9225209213 100644 --- a/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go @@ -15,6 +15,8 @@ type VersionsRequestBuilder struct { type VersionsRequestBuilderGetQueryParameters struct { // Filter by artifactId. ArtifactId *string `uriparametername:"artifactId"` + // Filter by artifact type (`AVRO`, `JSON`, etc). + ArtifactType *string `uriparametername:"artifactType"` // Filter by contentId. ContentId *int64 `uriparametername:"contentId"` // Filter by description.