Skip to content

Commit de52bf2

Browse files
committed
Fixed issues with labels on branches (branches do not have labels).
1 parent d1b4dc4 commit de52bf2

File tree

8 files changed

+8
-51
lines changed

8 files changed

+8
-51
lines changed

app/src/main/java/io/apicurio/registry/rest/v3/V3ApiUtil.java

-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ public static BranchSearchResults dtoToSearchResults(BranchSearchResultsDto dto)
181181
searchedBranch.setBranchId(branch.getBranchId());
182182
searchedBranch.setModifiedBy(branch.getModifiedBy());
183183
searchedBranch.setModifiedOn(new Date(branch.getModifiedOn()));
184-
searchedBranch.setLabels(branch.getLabels());
185184
results.getBranches().add(searchedBranch);
186185
});
187186
return results;

app/src/main/java/io/apicurio/registry/storage/dto/SearchedBranchDto.java

-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import lombok.Setter;
99
import lombok.ToString;
1010

11-
import java.util.Map;
12-
1311
@NoArgsConstructor
1412
@AllArgsConstructor
1513
@Builder
@@ -28,6 +26,5 @@ public class SearchedBranchDto {
2826
private long createdOn;
2927
private String modifiedBy;
3028
private long modifiedOn;
31-
private Map<String, String> labels;
3229

3330
}

app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -3450,7 +3450,6 @@ public BranchSearchResultsDto getBranches(GA ga, int offset, int limit) {
34503450

34513451
// Execute query
34523452
List<SearchedBranchDto> branches = branchesQuery.map(SearchedBranchMapper.instance).list();
3453-
limitReturnedLabelsInBranches(branches);
34543453
// Execute count query
34553454
Integer count = countQuery.mapTo(Integer.class).one();
34563455

@@ -3813,7 +3812,7 @@ private Map<String, String> limitReturnedLabels(Map<String, String> labels) {
38133812
if (totalBytes < maxBytes) {
38143813
String value = labels.get(key);
38153814
cappedLabels.put(key, value);
3816-
totalBytes += value.length() + key.length();
3815+
totalBytes += key.length() + (value != null ? value.length() : 0);
38173816
}
38183817
}
38193818
return cappedLabels;
@@ -3846,12 +3845,4 @@ private void limitReturnedLabelsInVersions(List<SearchedVersionDto> versions) {
38463845
});
38473846
}
38483847

3849-
private void limitReturnedLabelsInBranches(List<SearchedBranchDto> branches) {
3850-
branches.forEach(branch -> {
3851-
Map<String, String> labels = branch.getLabels();
3852-
Map<String, String> cappedLabels = limitReturnedLabels(labels);
3853-
branch.setLabels(cappedLabels);
3854-
});
3855-
}
3856-
38573848
}

app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedBranchMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public SearchedBranchDto map(ResultSet rs) throws SQLException {
2828
.description(rs.getString("description")).systemDefined(rs.getBoolean("systemDefined"))
2929
.owner(rs.getString("owner")).createdOn(rs.getTimestamp("createdOn").getTime())
3030
.modifiedBy(rs.getString("modifiedBy")).modifiedOn(rs.getTimestamp("modifiedOn").getTime())
31-
.labels(RegistryContentUtils.deserializeLabels(rs.getString("labels"))).build();
31+
.build();
3232
}
3333
}

common/src/main/resources/META-INF/openapi.json

-4
Original file line numberDiff line numberDiff line change
@@ -5218,10 +5218,6 @@
52185218
"systemDefined": {
52195219
"description": "",
52205220
"type": "boolean"
5221-
},
5222-
"labels": {
5223-
"$ref": "#/components/schemas/Labels",
5224-
"description": ""
52255221
}
52265222
},
52275223
"example": {

docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc

+5
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ The following {registry} configuration options are available for each component
557557
|`false`
558558
|`3.0.2`
559559
|Enables artifact version mutability
560+
|`apicurio.rest.search-results.labels.max-size.bytes`
561+
|`int`
562+
|`512`
563+
|`3.0.3`
564+
|Max size of the labels (in bytes) per item from within search results
560565
|===
561566

562567
== semver

go-sdk/pkg/registryclient-v3/kiota-lock.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"descriptionHash": "00581DCACB1B1D7CFE571A59235CDC2AE7CA2C5158E25D26D03F23337D82CC23EFFD219AFAF562BB50AA94EFB196FFED7150C31C23BBB22910B7AD366AC7FF2D",
2+
"descriptionHash": "D346A2A9A40F1B86E55F338BFB56645B0AE0D95EF3B3E66B14920108B20F119845B8EF22305D5C70D8DFDCC4BA0E39B5A78BD1F19D81AB90587F206B2470163D",
33
"descriptionLocation": "../../v3.json",
44
"lockFileVersion": "1.0.0",
55
"kiotaVersion": "1.19.1",

go-sdk/pkg/registryclient-v3/models/searched_branch.go

-31
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ type SearchedBranch struct {
1818
description *string
1919
// An ID of a single artifact group.
2020
groupId *string
21-
// User-defined name-value pairs. Name and value must be strings.
22-
labels Labelsable
2321
// The modifiedBy property
2422
modifiedBy *string
2523
// The modifiedOn property
@@ -127,16 +125,6 @@ func (m *SearchedBranch) GetFieldDeserializers() map[string]func(i878a80d2330e89
127125
}
128126
return nil
129127
}
130-
res["labels"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
131-
val, err := n.GetObjectValue(CreateLabelsFromDiscriminatorValue)
132-
if err != nil {
133-
return err
134-
}
135-
if val != nil {
136-
m.SetLabels(val.(Labelsable))
137-
}
138-
return nil
139-
}
140128
res["modifiedBy"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
141129
val, err := n.GetStringValue()
142130
if err != nil {
@@ -186,12 +174,6 @@ func (m *SearchedBranch) GetGroupId() *string {
186174
return m.groupId
187175
}
188176

189-
// GetLabels gets the labels property value. User-defined name-value pairs. Name and value must be strings.
190-
// returns a Labelsable when successful
191-
func (m *SearchedBranch) GetLabels() Labelsable {
192-
return m.labels
193-
}
194-
195177
// GetModifiedBy gets the modifiedBy property value. The modifiedBy property
196178
// returns a *string when successful
197179
func (m *SearchedBranch) GetModifiedBy() *string {
@@ -248,12 +230,6 @@ func (m *SearchedBranch) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a
248230
return err
249231
}
250232
}
251-
{
252-
err := writer.WriteObjectValue("labels", m.GetLabels())
253-
if err != nil {
254-
return err
255-
}
256-
}
257233
{
258234
err := writer.WriteStringValue("modifiedBy", m.GetModifiedBy())
259235
if err != nil {
@@ -317,11 +293,6 @@ func (m *SearchedBranch) SetGroupId(value *string) {
317293
m.groupId = value
318294
}
319295

320-
// SetLabels sets the labels property value. User-defined name-value pairs. Name and value must be strings.
321-
func (m *SearchedBranch) SetLabels(value Labelsable) {
322-
m.labels = value
323-
}
324-
325296
// SetModifiedBy sets the modifiedBy property value. The modifiedBy property
326297
func (m *SearchedBranch) SetModifiedBy(value *string) {
327298
m.modifiedBy = value
@@ -350,7 +321,6 @@ type SearchedBranchable interface {
350321
GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time
351322
GetDescription() *string
352323
GetGroupId() *string
353-
GetLabels() Labelsable
354324
GetModifiedBy() *string
355325
GetModifiedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time
356326
GetOwner() *string
@@ -360,7 +330,6 @@ type SearchedBranchable interface {
360330
SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
361331
SetDescription(value *string)
362332
SetGroupId(value *string)
363-
SetLabels(value Labelsable)
364333
SetModifiedBy(value *string)
365334
SetModifiedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
366335
SetOwner(value *string)

0 commit comments

Comments
 (0)