Skip to content

Commit 39a46b3

Browse files
committed
Fix lint issues and GET_NOC_ROOT_BY_VID_AND_SKID REST query
1 parent af46592 commit 39a46b3

File tree

11 files changed

+21
-17
lines changed

11 files changed

+21
-17
lines changed

docs/static/openapi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9877,7 +9877,7 @@ paths:
98779877
format: int32
98789878
tags:
98799879
- Query
9880-
/dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}:
9880+
/dcl/pki/noc-root-certificates/{vid}/{subjectKeyId}:
98819881
get:
98829882
summary: Queries a NocRootCertificatesByVidAndSkid by index.
98839883
operationId: NocRootCertificatesByVidAndSkid

proto/pki/query.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ service Query {
120120

121121
// Queries a NocRootCertificatesByVidAndSkid by index.
122122
rpc NocRootCertificatesByVidAndSkid(QueryGetNocRootCertificatesByVidAndSkidRequest) returns (QueryGetNocRootCertificatesByVidAndSkidResponse) {
123-
option (google.api.http).get = "/dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}";
123+
option (google.api.http).get = "/dcl/pki/noc-root-certificates/{vid}/{subjectKeyId}";
124124
}
125125

126126
// Queries a list of NocRootCertificates items.

vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -845,11 +845,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
845845
* @tags Query
846846
* @name QueryNocRootCertificatesByVidAndSkid
847847
* @summary Queries a NocRootCertificatesByVidAndSkid by index.
848-
* @request GET:/dcl/pki/noc_root_certificates/{vid}/{subjectKeyId}
848+
* @request GET:/dcl/pki/noc-root-certificates/{vid}/{subjectKeyId}
849849
*/
850850
queryNocRootCertificatesByVidAndSkid = (vid: number, subjectKeyId: string, params: RequestParams = {}) =>
851851
this.request<PkiQueryGetNocRootCertificatesByVidAndSkidResponse, RpcStatus>({
852-
path: `/dcl/pki/noc_root_certificates/${vid}/${subjectKeyId}`,
852+
path: `/dcl/pki/noc-root-certificates/${vid}/${subjectKeyId}`,
853853
method: "GET",
854854
format: "json",
855855
...params,

x/pki/handler_revoke_noc_root_cert_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ func TestHandler_RevokeNocX509RootCert_RevokeWithSerialNumber(t *testing.T) {
457457
require.Equal(t, 1, len(revNocRoot.Certs))
458458
require.Equal(t, testconstants.NocRootCert1CopySerialNumber, revNocRoot.Certs[0].SerialNumber)
459459

460-
// query noc root certificate by VID and SKID should return only one root cert
460+
// query noc root certificate by VID and SKID
461461
nocRootCertificatesByVidAndSkid, err := queryNocRootCertificatesByVidAndSkid(setup, testconstants.Vid, testconstants.NocRootCert1SubjectKeyID)
462462
require.NoError(t, err)
463463
require.Equal(t, testconstants.NocRootCert1SubjectKeyID, nocRootCertificatesByVidAndSkid.SubjectKeyId)

x/pki/keeper/grpc_query_noc_root_certificates_by_vid_and_skid_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"
1515
)
1616

17-
// Prevent strconv unused error
17+
// Prevent strconv unused error.
1818
var _ = strconv.IntSize
1919

2020
func TestNocRootCertificatesByVidAndSkidQuerySingle(t *testing.T) {

x/pki/keeper/keeper.go

+2
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ func findCertificate(serialNumber string, certificates *[]*types.Certificate) (*
106106

107107
func filterCertificates(certificates *[]*types.Certificate, predicate CertificatePredicate) []*types.Certificate {
108108
var result []*types.Certificate
109+
109110
for _, s := range *certificates {
110111
if predicate(s) {
111112
result = append(result, s)
112113
}
113114
}
115+
114116
return result
115117
}

x/pki/keeper/noc_root_certificates_by_vid_and_skid.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"
99
)
1010

11-
// SetNocRootCertificatesByVidAndSkid set a specific nocRootCertificatesByVidAndSkid in the store from its index
11+
// SetNocRootCertificatesByVidAndSkid set a specific nocRootCertificatesByVidAndSkid in the store from its index.
1212
func (k Keeper) SetNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocRootCertificatesByVidAndSkid types.NocRootCertificatesByVidAndSkid) {
1313
store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix))
1414
b := k.cdc.MustMarshal(&nocRootCertificatesByVidAndSkid)
@@ -18,7 +18,7 @@ func (k Keeper) SetNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocRootCerti
1818
), b)
1919
}
2020

21-
// GetNocRootCertificatesByVidAndSkid returns a nocRootCertificatesByVidAndSkid from its index
21+
// GetNocRootCertificatesByVidAndSkid returns a nocRootCertificatesByVidAndSkid from its index.
2222
func (k Keeper) GetNocRootCertificatesByVidAndSkid(
2323
ctx sdk.Context,
2424
vid int32,
@@ -36,6 +36,7 @@ func (k Keeper) GetNocRootCertificatesByVidAndSkid(
3636
}
3737

3838
k.cdc.MustUnmarshal(b, &val)
39+
3940
return val, true
4041
}
4142

@@ -63,7 +64,7 @@ func (k Keeper) AddNocRootCertificatesByVidAndSkid(ctx sdk.Context, nocCertifica
6364
store.Set(types.NocRootCertificatesByVidAndSkidKey(nocCertificate.Vid, nocCertificate.SubjectKeyId), b)
6465
}
6566

66-
// RemoveNocRootCertificatesByVidAndSkid removes a nocRootCertificatesByVidAndSkid from the store
67+
// RemoveNocRootCertificatesByVidAndSkid removes a nocRootCertificatesByVidAndSkid from the store.
6768
func (k Keeper) RemoveNocRootCertificatesByVidAndSkid(
6869
ctx sdk.Context,
6970
vid int32,
@@ -129,7 +130,7 @@ func (k Keeper) _filterAndSetNocRootCertificateByVidAndSkid(
129130
}
130131
}
131132

132-
// GetAllNocRootCertificatesByVidAndSkid returns all nocRootCertificatesByVidAndSkid
133+
// GetAllNocRootCertificatesByVidAndSkid returns all nocRootCertificatesByVidAndSkid.
133134
func (k Keeper) GetAllNocRootCertificatesByVidAndSkid(ctx sdk.Context) (list []types.NocRootCertificatesByVidAndSkid) {
134135
store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.NocRootCertificatesByVidAndSkidKeyPrefix))
135136
iterator := sdk.KVStorePrefixIterator(store, []byte{})

x/pki/keeper/noc_root_certificates_by_vid_and_skid_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"
1313
)
1414

15-
// Prevent strconv unused error
15+
// Prevent strconv unused error.
1616
var _ = strconv.IntSize
1717

1818
func createNNocRootCertificatesByVidAndSkid(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.NocRootCertificatesByVidAndSkid {
@@ -23,6 +23,7 @@ func createNNocRootCertificatesByVidAndSkid(keeper *keeper.Keeper, ctx sdk.Conte
2323

2424
keeper.SetNocRootCertificatesByVidAndSkid(ctx, items[i])
2525
}
26+
2627
return items
2728
}
2829

x/pki/types/genesis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func DefaultGenesis() *GenesisState {
3333

3434
// Validate performs basic genesis state validation returning an error upon any
3535
// failure.
36-
func (gs GenesisState) Validate() error {
36+
func (gs GenesisState) Validate() error { //nolint:gocyclo,vet
3737
// Check for duplicated index in approvedCertificates
3838
approvedCertificatesIndexMap := make(map[string]struct{})
3939

x/pki/types/key_noc_root_certificates_by_vid_and_skid.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import "encoding/binary"
55
var _ binary.ByteOrder
66

77
const (
8-
// NocRootCertificatesByVidAndSkidKeyPrefix is the prefix to retrieve all NocRootCertificatesByVidAndSkid
8+
// NocRootCertificatesByVidAndSkidKeyPrefix is the prefix to retrieve all NocRootCertificatesByVidAndSkid.
99
NocRootCertificatesByVidAndSkidKeyPrefix = "NocRootCertificatesByVidAndSkid/value/"
1010
)
1111

12-
// NocRootCertificatesByVidAndSkidKey returns the store key to retrieve a NocRootCertificatesByVidAndSkid from the index fields
12+
// NocRootCertificatesByVidAndSkidKey returns the store key to retrieve a NocRootCertificatesByVidAndSkid from the index fields.
1313
func NocRootCertificatesByVidAndSkidKey(
1414
vid int32,
1515
subjectKeyID string,
@@ -21,8 +21,8 @@ func NocRootCertificatesByVidAndSkidKey(
2121
key = append(key, vidBytes...)
2222
key = append(key, []byte("/")...)
2323

24-
subjectKeyIdBytes := []byte(subjectKeyID)
25-
key = append(key, subjectKeyIdBytes...)
24+
subjectKeyIDBytes := []byte(subjectKeyID)
25+
key = append(key, subjectKeyIDBytes...)
2626
key = append(key, []byte("/")...)
2727

2828
return key

x/pki/types/query.pb.gw.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)