Skip to content

Commit 8cea982

Browse files
committed
chore: upgrade go v1.26 and dependencie
1 parent 8ad2f13 commit 8cea982

14 files changed

Lines changed: 422 additions & 343 deletions

File tree

CLAUDE.md

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Production-ready HTTP client with:
198198

199199
### Prerequisites
200200

201-
- **Go 1.24+** (as specified in [go.mod](go.mod:3))
201+
- **Go 1.26.1+** (as specified in [go.work](go.work:1))
202202
- **golangci-lint** for linting
203203
- **Docker** (optional, for integration tests)
204204

@@ -226,11 +226,20 @@ make go-tidy
226226
# Generate JSON schema
227227
make build-jsonschema
228228

229+
# Generate test configuration from OpenAPI specs
230+
make generate-test-config
231+
232+
# Remove build output directory
233+
make clean
234+
229235
# Start DDN environment
230236
make start-ddn
231237

232238
# Stop DDN environment
233239
make stop-ddn
240+
241+
# Build and test full supergraph integration
242+
make build-supergraph-test
234243
```
235244

236245
### Testing
@@ -248,9 +257,21 @@ go test -v ./connector/internal/contenttype/
248257
```
249258

250259
Test fixtures are in:
251-
- [connector/testdata/](connector/testdata/) - Connector test configurations
260+
- [connector/testdata/](connector/testdata/) - Connector test configurations:
261+
- `petstore3/` - Petstore API OpenAPI 3.0 example with query/mutation snapshots
262+
- `jsonplaceholder/` - JSONPlaceholder API integration example
263+
- `auth/` - Authentication scheme examples
264+
- `patch/` - JSON Patch before/after examples
265+
- `compression/` - Compression handling tests
266+
- `presets/` - Argument preset examples
267+
- `tls/` - TLS/mTLS certificate tests with `certs/` and `certs_s1/` subdirectories
268+
- `multi-schemas/` - Multi-API composition (cat.yaml, dog.yaml)
269+
- `raw/` - Raw/schemaless request examples
270+
- `stripe/` - Stripe API example
252271
- [ndc-http-schema/command/testdata/](ndc-http-schema/command/testdata/) - CLI test data
253-
- [tests/](tests/) - Integration tests
272+
- [tests/](tests/) - Integration tests and DDN engine configurations
273+
274+
The CI test script ([scripts/test.sh](scripts/test.sh)) runs coverage collection per module, starts a Hydra OAuth server for auth integration tests, and uses `ndc-test` for NDC specification compliance validation.
254275

255276
### Building
256277

@@ -387,10 +408,12 @@ Combine multiple API specifications into a single connector:
387408
- **Retry with Backoff** - Configurable retry strategy with exponential backoff
388409
- **Timeout Management** - Per-request and global timeouts
389410
- **Header Forwarding** - Forward headers from Hasura engine
390-
- **Argument Presets** - Set default argument values
391-
- **Response Transforms** - Transform API responses before returning
392-
- **Distributed Execution** - Send requests to multiple servers
411+
- **Argument Presets** - Set default argument values using JSONPath for nested field navigation
412+
- **Response Transforms** - Transform API responses before returning via JSONPath/templates
413+
- **Distributed Execution** - Fan-out requests to multiple upstream servers; controlled via `HTTPOptions` (fields: `servers`, `parallel`, `concurrency`)
393414
- **Schemaless Requests** - GraphQL-to-REST proxy without schema
415+
- **Compression** - Automatic gzip/deflate request encoding and response decompression via `Accept-Encoding`
416+
- **JSON Patch** - Modify OpenAPI specs at conversion time without editing source files
394417

395418
### 4. Observability
396419

@@ -436,6 +459,22 @@ The project uses Go workspaces ([go.work](go.work:1)):
436459
- Local modules: `./ndc-http-schema`, `./exhttp`
437460
- Run `make go-tidy` after dependency changes
438461

462+
### Linter Configuration
463+
464+
The project uses golangci-lint v2 (see [.golangci.yml](.golangci.yml)):
465+
466+
**Formatters:** `gci`, `gofmt`, `gofumpt`, `goimports`, `golines`
467+
468+
**Complexity thresholds:**
469+
- Function length: 200 lines / 90 statements
470+
- Cyclomatic complexity: 40 (`gocyclo`), 30 (`cyclop`)
471+
- Cognitive complexity: 60 (`gocognit`)
472+
- Nesting complexity: 15 (`nestif`)
473+
474+
**Per-directory exclusions:**
475+
- `ndc-http-schema`: `goconst` disabled (many repeated schema strings)
476+
- `ndc-http-schema/openapi`: `dupl` disabled (similar OpenAPI parsing patterns)
477+
439478
## Important Files
440479

441480
### Configuration Files
@@ -502,6 +541,33 @@ The project uses Go workspaces ([go.work](go.work:1)):
502541
2. Update conversion logic in [ndc-http-schema/configuration/](ndc-http-schema/configuration/)
503542
3. Regenerate JSON schema: `make build-jsonschema`
504543

544+
### Using the Patch System
545+
546+
The connector supports JSON Patch (RFC 6902) to modify OpenAPI specs without editing source files. Patches are applied before schema conversion.
547+
548+
**Patch file format:**
549+
```yaml
550+
# patch-after.yaml - applied to the converted NDC schema
551+
- op: remove
552+
path: /settings/securitySchemes/petstore_auth
553+
- op: replace
554+
path: /settings/servers/0/url/value
555+
value: https://api.example.com
556+
```
557+
558+
**Register patches in config:**
559+
```yaml
560+
files:
561+
- file: openapi.yaml
562+
spec: openapi3
563+
patchBefore:
564+
- path: patch-before.yaml # applied before conversion
565+
patchAfter:
566+
- path: patch-after.yaml # applied after conversion
567+
```
568+
569+
Patch examples: [connector/testdata/patch/](connector/testdata/patch/), [ndc-http-schema/command/testdata/patch/](ndc-http-schema/command/testdata/patch/)
570+
505571
## Testing with Hasura DDN
506572

507573
### Local Development
@@ -550,6 +616,18 @@ ndc-http-schema convert --log-level=debug -f openapi.yaml
550616
HASURA_LOG_LEVEL=debug ./server/main.go serve
551617
```
552618

619+
## CI/CD Pipelines
620+
621+
Located in [.github/workflows/](.github/workflows/):
622+
623+
| Workflow | Trigger | What it does |
624+
|---|---|---|
625+
| `test.yaml` | Push/PR | Runs unit tests, NDC compliance tests (`ndc-test`), coverage reports posted to PRs |
626+
| `lint.yaml` | Push/PR | Detects all workspace modules, runs `golangci-lint` per module, checks `gofmt` |
627+
| `release.yaml` | Tag `v*` | Builds multi-platform Docker images (`linux/amd64`, `linux/arm64`), cross-compiles CLI binaries via `gox`, creates draft GitHub release, generates plugin manifests |
628+
629+
**Platforms for CLI release:** `linux/amd64`, `linux/arm64`, `darwin/amd64`, `darwin/arm64`, `windows/amd64`
630+
553631
## Contributing
554632

555633
1. Fork the repository

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build context at repo root: docker build -f Dockerfile .
2-
FROM golang:1.25 AS builder
2+
FROM golang:1.26 AS builder
33

44
WORKDIR /app
55

connector/internal/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414
"unicode"
1515

16+
"github.com/hasura/gotel"
1617
"github.com/hasura/ndc-http/connector/internal/contenttype"
1718
"github.com/hasura/ndc-http/exhttp"
1819
rest "github.com/hasura/ndc-http/ndc-http-schema/schema"
@@ -26,7 +27,7 @@ import (
2627
"golang.org/x/sync/errgroup"
2728
)
2829

29-
var tracer = connector.NewTracer("HTTPClient")
30+
var tracer = gotel.NewTracer("HTTPClient")
3031

3132
// HTTPClient represents a http client wrapper with advanced methods.
3233
type HTTPClient struct {

connector/internal/contenttype/parameter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (ssp ParameterItems) find(keys []Key) (*ParameterItem, int) {
7272
isEqual := false
7373

7474
for j, value := range item.keys {
75-
isEqual = value == keys[j]
75+
isEqual = len(keys) > j && value == keys[j] //nolint:gosec
7676
if !isEqual {
7777
return nil, -1
7878
}

connector/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import (
44
"errors"
55
"net/http"
66

7-
"github.com/hasura/ndc-sdk-go/v2/connector"
7+
"github.com/hasura/gotel"
88
)
99

1010
var errBuildSchemaFailed = errors.New("failed to build NDC HTTP schema")
1111

1212
// State is the global state which is shared for every connector request.
1313
type State struct {
14-
Tracer *connector.Tracer
14+
Tracer *gotel.Tracer
1515
}
1616

1717
type options struct {

exhttp/go.mod

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,58 @@
11
module github.com/hasura/ndc-http/exhttp
22

3-
go 1.24.13
3+
go 1.26.1
44

55
require (
66
github.com/cenkalti/backoff/v5 v5.0.3
7-
github.com/hasura/goenvconf v0.6.1
7+
github.com/hasura/goenvconf v0.6.2
8+
github.com/hasura/gotel v0.6.2
89
github.com/hasura/ndc-sdk-go/v2 v2.2.1-0.20260124011343-f658e14823b0
910
github.com/prometheus/common v0.67.5
10-
go.opentelemetry.io/otel v1.39.0
11-
go.opentelemetry.io/otel/trace v1.39.0
11+
go.opentelemetry.io/otel v1.42.0
12+
go.opentelemetry.io/otel/trace v1.42.0
1213
gotest.tools/v3 v3.5.2
1314
)
1415

1516
require (
1617
github.com/Masterminds/semver/v3 v3.4.0 // indirect
17-
github.com/alecthomas/kong v1.13.0 // indirect
18+
github.com/alecthomas/kong v1.14.0 // indirect
1819
github.com/beorn7/perks v1.0.1 // indirect
1920
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2021
github.com/go-logr/logr v1.4.3 // indirect
2122
github.com/go-logr/stdr v1.2.2 // indirect
2223
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
2324
github.com/google/go-cmp v0.7.0 // indirect
2425
github.com/google/uuid v1.6.0 // indirect
25-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.5 // indirect
26-
github.com/klauspost/compress v1.18.3 // indirect
26+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
27+
github.com/klauspost/compress v1.18.4 // indirect
2728
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
2829
github.com/prometheus/client_golang v1.23.2 // indirect
2930
github.com/prometheus/client_model v0.6.2 // indirect
3031
github.com/prometheus/otlptranslator v1.0.0 // indirect
31-
github.com/prometheus/procfs v0.19.2 // indirect
32+
github.com/prometheus/procfs v0.20.1 // indirect
3233
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
33-
go.opentelemetry.io/contrib/bridges/otelslog v0.14.0 // indirect
34-
go.opentelemetry.io/contrib/propagators/b3 v1.39.0 // indirect
35-
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.15.0 // indirect
36-
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.15.0 // indirect
37-
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0 // indirect
38-
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.39.0 // indirect
39-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
40-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 // indirect
41-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 // indirect
42-
go.opentelemetry.io/otel/exporters/prometheus v0.61.0 // indirect
43-
go.opentelemetry.io/otel/log v0.15.0 // indirect
44-
go.opentelemetry.io/otel/metric v1.39.0 // indirect
45-
go.opentelemetry.io/otel/sdk v1.39.0 // indirect
46-
go.opentelemetry.io/otel/sdk/log v0.15.0 // indirect
47-
go.opentelemetry.io/otel/sdk/metric v1.39.0 // indirect
48-
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
49-
go.yaml.in/yaml/v2 v2.4.3 // indirect
50-
golang.org/x/net v0.49.0 // indirect
51-
golang.org/x/sys v0.40.0 // indirect
52-
golang.org/x/text v0.33.0 // indirect
53-
google.golang.org/genproto/googleapis/api v0.0.0-20260122232226-8e98ce8d340d // indirect
54-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d // indirect
55-
google.golang.org/grpc v1.78.0 // indirect
34+
go.opentelemetry.io/contrib/bridges/otelslog v0.17.0 // indirect
35+
go.opentelemetry.io/contrib/propagators/b3 v1.42.0 // indirect
36+
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.18.0 // indirect
37+
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.18.0 // indirect
38+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 // indirect
39+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.42.0 // indirect
40+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
41+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect
42+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect
43+
go.opentelemetry.io/otel/exporters/prometheus v0.64.0 // indirect
44+
go.opentelemetry.io/otel/log v0.18.0 // indirect
45+
go.opentelemetry.io/otel/metric v1.42.0 // indirect
46+
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
47+
go.opentelemetry.io/otel/sdk/log v0.18.0 // indirect
48+
go.opentelemetry.io/otel/sdk/metric v1.42.0 // indirect
49+
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
50+
go.yaml.in/yaml/v2 v2.4.4 // indirect
51+
golang.org/x/net v0.51.0 // indirect
52+
golang.org/x/sys v0.42.0 // indirect
53+
golang.org/x/text v0.34.0 // indirect
54+
google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 // indirect
55+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect
56+
google.golang.org/grpc v1.79.2 // indirect
5657
google.golang.org/protobuf v1.36.11 // indirect
5758
)

0 commit comments

Comments
 (0)