Skip to content

Commit 357a9e2

Browse files
fix: resolve CI lint and buf format failures
- Replace byte() casts with unicode.ToLower in camelToSnake to avoid gosec G115 vs nolintlint conflict across golangci-lint versions - Run buf format on proto files (trailing whitespace, missing EOF newlines, comment alignment) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9998cad commit 357a9e2

File tree

5 files changed

+29
-28
lines changed

5 files changed

+29
-28
lines changed

internal/httpgen/generator.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"strconv"
66
"strings"
7+
"unicode"
78

89
"google.golang.org/protobuf/compiler/protogen"
910

@@ -887,18 +888,18 @@ func (g *Generator) getPathParams(method *protogen.Method) []string {
887888
}
888889

889890
func camelToSnake(s string) string {
890-
var result []byte
891+
var b strings.Builder
891892
for i, r := range s {
892893
if r >= 'A' && r <= 'Z' {
893894
if i > 0 {
894-
result = append(result, '_')
895+
b.WriteByte('_')
895896
}
896-
result = append(result, byte(r+'a'-'A')) //nolint:gosec // r is guaranteed ASCII uppercase A-Z
897+
b.WriteRune(unicode.ToLower(r))
897898
} else {
898-
result = append(result, byte(r)) //nolint:gosec // r is guaranteed ASCII lowercase or digit
899+
b.WriteRune(r)
899900
}
900901
}
901-
return string(result)
902+
return b.String()
902903
}
903904

904905
// generateErrorResponseFunctions generates error response helper functions.

proto/sebuf/http/annotations.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ extend google.protobuf.EnumValueOptions {
209209
// When set, this value is used for JSON serialization instead of the proto name.
210210
// Combines with enum_encoding=STRING on fields using this enum.
211211
optional string enum_value = 50012;
212-
}
212+
}

proto/sebuf/http/errors.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ message FieldViolation {
2323
// The field path that failed validation (e.g., "user.email" for nested fields)
2424
// For header validation, this will be the header name (e.g., "X-API-Key")
2525
string field = 1;
26-
26+
2727
// Human-readable description of the validation violation
2828
// (e.g., "must be a valid email address", "required field missing")
2929
string description = 2;
30-
}
30+
}

proto/sebuf/http/headers.proto

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ option go_package = "github.com/SebastienMelki/sebuf/http;http";
1010
message Header {
1111
// Name of the header parameter
1212
string name = 1;
13-
13+
1414
// Description of the header parameter
1515
string description = 2;
16-
16+
1717
// Type of the header parameter (string, integer, number, boolean, array)
1818
string type = 3;
19-
19+
2020
// Whether the header is required
2121
bool required = 4;
22-
22+
2323
// Schema format (e.g. "uuid", "email", "date-time")
2424
string format = 5;
25-
25+
2626
// Example value for the header
2727
string example = 6;
28-
28+
2929
// Whether the header is deprecated
3030
bool deprecated = 7;
3131
}
@@ -50,4 +50,4 @@ extend google.protobuf.ServiceOptions {
5050
// Extension for method-level headers
5151
extend google.protobuf.MethodOptions {
5252
MethodHeaders method_headers = 50006;
53-
}
53+
}

proto/sebuf/krakend/krakend.proto

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,30 @@ enum JWTAlgorithm {
8080
JWT_ALGORITHM_UNSPECIFIED = 0;
8181

8282
// RSA PKCS#1 v1.5 with SHA-256/384/512. Most common for Auth0, Okta, etc.
83-
JWT_ALGORITHM_RS256 = 1; // JSON: "RS256"
84-
JWT_ALGORITHM_RS384 = 2; // JSON: "RS384"
85-
JWT_ALGORITHM_RS512 = 3; // JSON: "RS512"
83+
JWT_ALGORITHM_RS256 = 1; // JSON: "RS256"
84+
JWT_ALGORITHM_RS384 = 2; // JSON: "RS384"
85+
JWT_ALGORITHM_RS512 = 3; // JSON: "RS512"
8686

8787
// HMAC with SHA-256/384/512. Symmetric — same secret signs and verifies.
8888
// Use only when the signing secret can be securely shared with KrakenD.
89-
JWT_ALGORITHM_HS256 = 4; // JSON: "HS256"
90-
JWT_ALGORITHM_HS384 = 5; // JSON: "HS384"
91-
JWT_ALGORITHM_HS512 = 6; // JSON: "HS512"
89+
JWT_ALGORITHM_HS256 = 4; // JSON: "HS256"
90+
JWT_ALGORITHM_HS384 = 5; // JSON: "HS384"
91+
JWT_ALGORITHM_HS512 = 6; // JSON: "HS512"
9292

9393
// ECDSA with P-256/P-384/P-521 curves and SHA-256/384/512.
9494
// Smaller keys than RSA with equivalent security.
95-
JWT_ALGORITHM_ES256 = 7; // JSON: "ES256"
96-
JWT_ALGORITHM_ES384 = 8; // JSON: "ES384"
97-
JWT_ALGORITHM_ES512 = 9; // JSON: "ES512"
95+
JWT_ALGORITHM_ES256 = 7; // JSON: "ES256"
96+
JWT_ALGORITHM_ES384 = 8; // JSON: "ES384"
97+
JWT_ALGORITHM_ES512 = 9; // JSON: "ES512"
9898

9999
// RSA-PSS with SHA-256/384/512. More secure padding than PKCS#1 v1.5.
100-
JWT_ALGORITHM_PS256 = 10; // JSON: "PS256"
101-
JWT_ALGORITHM_PS384 = 11; // JSON: "PS384"
102-
JWT_ALGORITHM_PS512 = 12; // JSON: "PS512"
100+
JWT_ALGORITHM_PS256 = 10; // JSON: "PS256"
101+
JWT_ALGORITHM_PS384 = 11; // JSON: "PS384"
102+
JWT_ALGORITHM_PS512 = 12; // JSON: "PS512"
103103

104104
// Edwards-curve Digital Signature Algorithm (Ed25519).
105105
// High performance, small signatures.
106-
JWT_ALGORITHM_EDDSA = 13; // JSON: "EdDSA"
106+
JWT_ALGORITHM_EDDSA = 13; // JSON: "EdDSA"
107107
}
108108

109109
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)