From 2f8d66c1c61b67fc48da50c5b63b848258f02a0b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Aug 2026 06:34:03 +0000 Subject: [PATCH] Bump github.com/go-openapi/runtime from 0.33.0 to 0.33.1 Bumps [github.com/go-openapi/runtime](https://github.com/go-openapi/runtime) from 0.33.0 to 0.33.1. - [Release notes](https://github.com/go-openapi/runtime/releases) - [Commits](https://github.com/go-openapi/runtime/compare/v0.33.0...v0.33.1) --- updated-dependencies: - dependency-name: github.com/go-openapi/runtime dependency-version: 0.33.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 24 +- go.sum | 59 +- .../go-openapi/analysis/CONTRIBUTORS.md | 4 +- .../go-openapi/analysis/analyzer.go | 21 + .../go-openapi/loads/CONTRIBUTORS.md | 4 +- vendor/github.com/go-openapi/loads/errors.go | 21 +- vendor/github.com/go-openapi/loads/loaders.go | 7 +- vendor/github.com/go-openapi/loads/spec.go | 11 +- .../go-openapi/runtime/.golangci.yml | 1 + .../go-openapi/runtime/CONTRIBUTORS.md | 8 +- .../go-openapi/runtime/multipart_stream.go | 13 +- .../github.com/go-openapi/validate/.gitignore | 1 + .../go-openapi/validate/.golangci.yml | 2 + .../go-openapi/validate/CONTRIBUTORS.md | 5 +- .../go-openapi/validate/default_validator.go | 146 +- .../go-openapi/validate/example_validator.go | 131 +- .../github.com/go-openapi/validate/formats.go | 22 +- .../github.com/go-openapi/validate/helpers.go | 133 +- .../go-openapi/validate/object_validator.go | 100 +- .../go-openapi/validate/param_locations.go | 122 + vendor/github.com/go-openapi/validate/path.go | 269 ++ .../github.com/go-openapi/validate/pools.go | 420 +-- .../go-openapi/validate/pools_debug.go | 1015 -------- .../go-openapi/validate/ref_locations.go | 49 + .../go-openapi/validate/ref_redirects.go | 71 + .../go-openapi/validate/required_walk.go | 179 ++ .../go-openapi/validate/resolvable.go | 70 + .../github.com/go-openapi/validate/result.go | 254 +- .../github.com/go-openapi/validate/schema.go | 72 +- .../go-openapi/validate/schema_props.go | 60 +- .../go-openapi/validate/slice_validator.go | 43 +- .../github.com/go-openapi/validate/sorted.go | 39 + vendor/github.com/go-openapi/validate/spec.go | 339 ++- .../go-openapi/validate/spec_messages.go | 7 + .../go-openapi/validate/spec_ref_warnings.go | 6 +- vendor/github.com/go-openapi/validate/type.go | 22 +- .../go-openapi/validate/validator.go | 201 +- vendor/go.opentelemetry.io/otel/.golangci.yml | 4 +- vendor/go.opentelemetry.io/otel/.lycheeignore | 14 + vendor/go.opentelemetry.io/otel/AGENTS.md | 3 + vendor/go.opentelemetry.io/otel/CHANGELOG.md | 78 +- .../go.opentelemetry.io/otel/CONTRIBUTING.md | 12 +- vendor/go.opentelemetry.io/otel/Makefile | 20 +- vendor/go.opentelemetry.io/otel/README.md | 7 + .../go.opentelemetry.io/otel/attribute/doc.go | 2 +- .../otel/attribute/encoder.go | 2 +- .../otel/attribute/filter.go | 2 +- .../otel/attribute/hash.go | 162 +- .../otel/attribute/internal/attribute.go | 2 +- .../otel/attribute/internal/xxhash/xxhash.go | 2 +- .../otel/attribute/iterator.go | 2 +- .../go.opentelemetry.io/otel/attribute/key.go | 134 +- .../go.opentelemetry.io/otel/attribute/kv.go | 80 +- .../otel/attribute/rawhelpers.go | 2 +- .../go.opentelemetry.io/otel/attribute/set.go | 2 +- .../otel/attribute/type_string.go | 5 +- .../otel/attribute/value.go | 312 ++- .../otel/baggage/baggage.go | 2 +- .../otel/baggage/context.go | 2 +- .../go.opentelemetry.io/otel/baggage/doc.go | 2 +- .../go.opentelemetry.io/otel/codes/codes.go | 4 +- vendor/go.opentelemetry.io/otel/codes/doc.go | 2 +- .../otel/dependencies.Dockerfile | 2 +- vendor/go.opentelemetry.io/otel/doc.go | 2 +- .../go.opentelemetry.io/otel/error_handler.go | 2 +- vendor/go.opentelemetry.io/otel/handler.go | 2 +- .../otel/internal/baggage/baggage.go | 2 +- .../otel/internal/baggage/context.go | 2 +- .../internal/errorhandler/errorhandler.go | 2 +- .../otel/internal/global/handler.go | 2 +- .../otel/internal/global/instruments.go | 2 +- .../otel/internal/global/internal_logging.go | 2 +- .../otel/internal/global/meter.go | 2 +- .../otel/internal/global/propagator.go | 2 +- .../otel/internal/global/state.go | 2 +- .../otel/internal/global/trace.go | 2 +- .../otel/internal_logging.go | 2 +- vendor/go.opentelemetry.io/otel/metric.go | 2 +- .../otel/metric/asyncfloat64.go | 2 +- .../otel/metric/asyncint64.go | 2 +- .../go.opentelemetry.io/otel/metric/config.go | 2 +- vendor/go.opentelemetry.io/otel/metric/doc.go | 2 +- .../otel/metric/embedded/embedded.go | 2 +- .../otel/metric/instrument.go | 2 +- .../go.opentelemetry.io/otel/metric/meter.go | 2 +- .../otel/metric/syncfloat64.go | 4 +- .../otel/metric/syncint64.go | 4 +- .../go.opentelemetry.io/otel/propagation.go | 2 +- .../otel/propagation/baggage.go | 2 +- .../otel/propagation/doc.go | 2 +- .../otel/propagation/propagation.go | 2 +- .../otel/propagation/trace_context.go | 2 +- .../go.opentelemetry.io/otel/requirements.txt | 2 +- .../otel/semconv/v1.37.0/attribute_group.go | 2 +- .../otel/semconv/v1.37.0/doc.go | 2 +- .../otel/semconv/v1.37.0/error_type.go | 2 +- .../otel/semconv/v1.37.0/exception.go | 2 +- .../otel/semconv/v1.37.0/schema.go | 2 +- .../otel/semconv/v1.41.0/MIGRATION.md | 17 - .../otel/semconv/v1.41.0/README.md | 3 - .../otel/semconv/v1.43.0/MIGRATION.md | 4 + .../otel/semconv/v1.43.0/README.md | 3 + .../{v1.41.0 => v1.43.0}/attribute_group.go | 2249 ++++------------- .../otel/semconv/{v1.41.0 => v1.43.0}/doc.go | 4 +- .../{v1.41.0 => v1.43.0}/error_type.go | 2 +- .../semconv/{v1.41.0 => v1.43.0}/exception.go | 2 +- .../semconv/{v1.41.0 => v1.43.0}/schema.go | 4 +- vendor/go.opentelemetry.io/otel/trace.go | 2 +- vendor/go.opentelemetry.io/otel/trace/auto.go | 14 +- .../go.opentelemetry.io/otel/trace/config.go | 2 +- .../go.opentelemetry.io/otel/trace/context.go | 2 +- vendor/go.opentelemetry.io/otel/trace/doc.go | 2 +- .../otel/trace/embedded/embedded.go | 2 +- vendor/go.opentelemetry.io/otel/trace/hex.go | 2 +- .../otel/trace/internal/telemetry/attr.go | 2 +- .../otel/trace/internal/telemetry/doc.go | 2 +- .../otel/trace/internal/telemetry/id.go | 2 +- .../otel/trace/internal/telemetry/number.go | 2 +- .../otel/trace/internal/telemetry/resource.go | 2 +- .../otel/trace/internal/telemetry/scope.go | 2 +- .../otel/trace/internal/telemetry/span.go | 2 +- .../otel/trace/internal/telemetry/status.go | 2 +- .../otel/trace/internal/telemetry/traces.go | 2 +- .../otel/trace/internal/telemetry/value.go | 2 +- .../otel/trace/nonrecording.go | 2 +- vendor/go.opentelemetry.io/otel/trace/noop.go | 2 +- .../otel/trace/noop/noop.go | 2 +- .../otel/trace/provider.go | 2 +- vendor/go.opentelemetry.io/otel/trace/span.go | 2 +- .../go.opentelemetry.io/otel/trace/trace.go | 2 +- .../go.opentelemetry.io/otel/trace/tracer.go | 2 +- .../otel/trace/tracestate.go | 2 +- vendor/go.opentelemetry.io/otel/version.go | 4 +- vendor/go.opentelemetry.io/otel/versions.yaml | 8 +- vendor/go.yaml.in/yaml/v3/parserc.go | 178 +- vendor/go.yaml.in/yaml/v3/yamlh.go | 44 +- .../x/crypto/internal/poly1305/mac_noasm.go | 2 +- .../x/crypto/internal/poly1305/sum_asm.go | 2 +- .../x/crypto/internal/poly1305/sum_riscv64.s | 158 ++ .../x/text/secure/precis/nickname.go | 17 +- .../x/text/secure/precis/profile.go | 8 +- vendor/modules.txt | 26 +- 142 files changed, 3575 insertions(+), 4108 deletions(-) create mode 100644 vendor/github.com/go-openapi/validate/param_locations.go create mode 100644 vendor/github.com/go-openapi/validate/path.go delete mode 100644 vendor/github.com/go-openapi/validate/pools_debug.go create mode 100644 vendor/github.com/go-openapi/validate/ref_locations.go create mode 100644 vendor/github.com/go-openapi/validate/ref_redirects.go create mode 100644 vendor/github.com/go-openapi/validate/required_walk.go create mode 100644 vendor/github.com/go-openapi/validate/resolvable.go create mode 100644 vendor/github.com/go-openapi/validate/sorted.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.41.0/MIGRATION.md delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.41.0/README.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md rename vendor/go.opentelemetry.io/otel/semconv/{v1.41.0 => v1.43.0}/attribute_group.go (90%) rename vendor/go.opentelemetry.io/otel/semconv/{v1.41.0 => v1.43.0}/doc.go (83%) rename vendor/go.opentelemetry.io/otel/semconv/{v1.41.0 => v1.43.0}/error_type.go (96%) rename vendor/go.opentelemetry.io/otel/semconv/{v1.41.0 => v1.43.0}/exception.go (80%) rename vendor/go.opentelemetry.io/otel/semconv/{v1.41.0 => v1.43.0}/schema.go (75%) create mode 100644 vendor/golang.org/x/crypto/internal/poly1305/sum_riscv64.s diff --git a/go.mod b/go.mod index d810b91ec..cef1b6c78 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/gdamore/tcell/v2 v2.13.10 github.com/go-gormigrate/gormigrate/v2 v2.1.6 github.com/go-openapi/errors v0.22.8 - github.com/go-openapi/runtime v0.33.0 + github.com/go-openapi/runtime v0.33.1 github.com/go-openapi/strfmt v0.27.0 github.com/go-openapi/swag v0.28.0 github.com/golang-jwt/jwt/v5 v5.3.1 @@ -31,7 +31,7 @@ require ( github.com/rivo/uniseg v0.4.7 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 - golang.org/x/crypto v0.54.0 + golang.org/x/crypto v0.55.0 golang.org/x/mod v0.38.0 golang.org/x/oauth2 v0.36.0 golang.org/x/sync v0.22.0 @@ -58,11 +58,11 @@ require ( github.com/gdamore/encoding v1.0.1 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-openapi/analysis v0.25.5 // indirect + github.com/go-openapi/analysis v0.26.0 // indirect github.com/go-openapi/jsonpointer v1.0.0 // indirect github.com/go-openapi/jsonreference v1.0.0 // indirect - github.com/go-openapi/loads v0.25.0 // indirect - github.com/go-openapi/runtime/server-middleware v0.32.6 // indirect + github.com/go-openapi/loads v0.25.1 // indirect + github.com/go-openapi/runtime/server-middleware v0.33.1 // indirect github.com/go-openapi/spec v0.22.9 // indirect github.com/go-openapi/swag/cmdutils v0.28.0 // indirect github.com/go-openapi/swag/conv v0.28.0 // indirect @@ -75,7 +75,7 @@ require ( github.com/go-openapi/swag/stringutils v0.28.0 // indirect github.com/go-openapi/swag/typeutils v0.28.0 // indirect github.com/go-openapi/swag/yamlutils v0.28.0 // indirect - github.com/go-openapi/validate v0.26.1 // indirect + github.com/go-openapi/validate v0.26.3 // indirect github.com/go-sql-driver/mysql v1.10.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect @@ -102,14 +102,14 @@ require ( github.com/stretchr/objx v0.5.3 // indirect github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/otel v1.44.0 // indirect - go.opentelemetry.io/otel/metric v1.44.0 // indirect - go.opentelemetry.io/otel/trace v1.44.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.opentelemetry.io/otel v1.45.0 // indirect + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/trace v1.45.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect - golang.org/x/net v0.57.0 // indirect + golang.org/x/net v0.58.0 // indirect golang.org/x/sys v0.47.0 // indirect - golang.org/x/text v0.40.0 // indirect + golang.org/x/text v0.41.0 // indirect google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4d239eab0..d35657715 100644 --- a/go.sum +++ b/go.sum @@ -48,20 +48,20 @@ github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/analysis v0.25.5 h1:xPYEvTb90o1y0epuiOPAoG4QqahjP3cdp5xNlHeKJRI= -github.com/go-openapi/analysis v0.25.5/go.mod h1:d3UGtQC5uq5Kqqqis2VH09Km/v3vwsWrYkbp4gdm+Rc= +github.com/go-openapi/analysis v0.26.0 h1:1xECln1iMMmQnTjgcknC1vi1hA4KISt6IHpSwnqcuwI= +github.com/go-openapi/analysis v0.26.0/go.mod h1:40gERFi/2dyXA1FaqRRLxkv1IlC6X+GPDNd1xrYAjZE= github.com/go-openapi/errors v0.22.8 h1:oP7sW7TWc3wFFjrzzj0nI83H2qMBkNjNfSd+XRejk/I= github.com/go-openapi/errors v0.22.8/go.mod h1:BuUoHcYrU6E7V9gfj1I5wLQqgtIHnup/alXZ8KdgQ0w= github.com/go-openapi/jsonpointer v1.0.0 h1:kR9tHqY0CtZaOPVFm622dPVNhrvYpwr4uCxgL3h1H8s= github.com/go-openapi/jsonpointer v1.0.0/go.mod h1:Z3rw7dWu1p9IgitXCFamSlA5lmDiklEB6vkaxcNZW5Y= github.com/go-openapi/jsonreference v1.0.0 h1:jlmTr6torcd1YgDQvSfNmRtKzYDO4FGBkrAdlAVWnpY= github.com/go-openapi/jsonreference v1.0.0/go.mod h1:jtwdyGbJk0Xhe5Y+rwtglQP6Sb1WZST4rT32LWB+sv0= -github.com/go-openapi/loads v0.25.0 h1:74Bc2snfaVlsHzwdQj/3gsA9XJz3daXTJVs+4ZaK7jI= -github.com/go-openapi/loads v0.25.0/go.mod h1:JFBw4SIB9+PTIFHDfcXuSSy5h6aWzjtUCrPYyx3qWU8= -github.com/go-openapi/runtime v0.33.0 h1:Dd3Oj2ig+WH8ckK95l0Wn2V8a4bH/UqWPRZVT0vc8yU= -github.com/go-openapi/runtime v0.33.0/go.mod h1:+rsupH3+TFKqmFysqkmgBOTxpVJV8eV+j9myvvea2Xw= -github.com/go-openapi/runtime/server-middleware v0.32.6 h1:IGTYzybyFrUeSqQEwwO1y/9KnOk4QsabFNtAQtIHxDE= -github.com/go-openapi/runtime/server-middleware v0.32.6/go.mod h1:OQHTBqMGquJShXhPYQ62yAqDMtC1rYpsEwldNWjYKhA= +github.com/go-openapi/loads v0.25.1 h1:toKQdIDLxlqfKLLGUUmUsiTd5/X0Chzvde9EGYQP/Ac= +github.com/go-openapi/loads v0.25.1/go.mod h1:33Hen4tsKXHL45TyYojvfD5fZUFN4O1y4r/XhsRW2zc= +github.com/go-openapi/runtime v0.33.1 h1:jCvhI+wAdsn29byy+RgcPcg+j39YT6E304QOE/WqIVk= +github.com/go-openapi/runtime v0.33.1/go.mod h1:Dl5SMVRnJz+d8bX6Y1zxy0QKpqe/ysvVeUEh1nCpEZ4= +github.com/go-openapi/runtime/server-middleware v0.33.1 h1:IAeKbwWnBnpsYTpuPVS8t73ZrPpKvRZnK2iJ2KJGUV0= +github.com/go-openapi/runtime/server-middleware v0.33.1/go.mod h1:2Gej5fDxqeJxY+w38vxXYW0BgFASfgBsJ5rXwN1Fseg= github.com/go-openapi/spec v0.22.9 h1:/vKIFDcGKp0ktZWGbym/tJEWbk6/XOEmAVU0kqKMH+w= github.com/go-openapi/spec v0.22.9/go.mod h1:b/mNUYIOQOyIiUzUzXEE8xzyZqf93KvM9hQGP91yfl0= github.com/go-openapi/strfmt v0.27.0 h1:kbcTeaD9TXuXD0hhMXzuYa1sdTo6+dWGvwjW93E80IM= @@ -92,12 +92,12 @@ github.com/go-openapi/swag/typeutils v0.28.0 h1:nRBKSBXjDgf01VDPB3fWeD9nQuhCOVeI github.com/go-openapi/swag/typeutils v0.28.0/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= github.com/go-openapi/swag/yamlutils v0.28.0 h1:TV3JXH6DS46KUroDtMLAYHGkdWf5VDq3wVWFirmzROY= github.com/go-openapi/swag/yamlutils v0.28.0/go.mod h1:x0q/yndZHEgk9Rx3DyDqzFUmHy55KTvIZldvF2dTJXs= -github.com/go-openapi/testify/enable/yaml/v2 v2.6.0 h1:gGHwAJ0R/5jU8BEGDbfRNR3hL68dAVi84WuOApp29B0= -github.com/go-openapi/testify/enable/yaml/v2 v2.6.0/go.mod h1:tY+St1SGq4NFl0QIqdTY4aEdbChAHxhyB77XQi9iJCo= -github.com/go-openapi/testify/v2 v2.6.0 h1:5PKH2HE7YJ/LuRPQGvSxBRlFXNQhSetBLlGAgUEu3ug= -github.com/go-openapi/testify/v2 v2.6.0/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= -github.com/go-openapi/validate v0.26.1 h1:pZSbvtRO8G2R2FpWTYRn3w8LrsNwbtaVhP2dWiBa0Us= -github.com/go-openapi/validate v0.26.1/go.mod h1:B8UMgXiQiwwQWIbmuROlwJZDPGlikPuh7iHV1vPX9Oo= +github.com/go-openapi/testify/enable/yaml/v2 v2.6.1 h1:Jm+/ze2rMtbD98yen92AhATGLGREDYXG56Xr4gMjEtE= +github.com/go-openapi/testify/enable/yaml/v2 v2.6.1/go.mod h1:YDPnwCRDu38/oJBVMBVXOUDiJ9cIeBHWvfImHaXqnv4= +github.com/go-openapi/testify/v2 v2.6.1 h1:6CNJhTjMzgaeaH8WhshcsZNPIvRemiOcFpU7seO/y7Q= +github.com/go-openapi/testify/v2 v2.6.1/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-openapi/validate v0.26.3 h1:OkfZgLvLDnGP2hrRGD+42WBiPWWkoHomTJ+IVI+KaDc= +github.com/go-openapi/validate v0.26.3/go.mod h1:7DOOa4raU6NRe7A8VQSKbm3VcuUIioREYHFt+er9Sk8= github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw= github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= @@ -212,26 +212,27 @@ github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569/go.mod h1:2Ly+NIf github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= -go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= -go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= -go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= -go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58= -go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0= -go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= -go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4= go.yaml.in/yaml/v4 v4.0.0-rc.6/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= @@ -240,8 +241,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -269,8 +270,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/vendor/github.com/go-openapi/analysis/CONTRIBUTORS.md b/vendor/github.com/go-openapi/analysis/CONTRIBUTORS.md index a89274cdb..89eb5b0b3 100644 --- a/vendor/github.com/go-openapi/analysis/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/analysis/CONTRIBUTORS.md @@ -4,11 +4,11 @@ | Total Contributors | Total Contributions | | --- | --- | -| 22 | 273 | +| 22 | 276 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 133 | | +| @fredbi | 136 | | | @casualjim | 91 | | | @keramix | 9 | | | @youyuanwu | 8 | | diff --git a/vendor/github.com/go-openapi/analysis/analyzer.go b/vendor/github.com/go-openapi/analysis/analyzer.go index c24811aae..9eab8bd37 100644 --- a/vendor/github.com/go-openapi/analysis/analyzer.go +++ b/vendor/github.com/go-openapi/analysis/analyzer.go @@ -585,6 +585,20 @@ func (s *Spec) AllRefs() (result []spec.Ref) { return } +// AllRefsByLocation returns all the references found in the document, keyed by +// where each one is declared. +// +// Keys are local JSON references into the analyzed document, with tokens +// escaped as per RFC 6901, e.g. "#/paths/~1pets/get/responses/200/schema". +// +// Unlike [Spec.AllRefs], the result is not deduplicated: the same reference +// declared in several places appears under each of its locations. +// +// The map is cloned to avoid accidental changes. +func (s *Spec) AllRefsByLocation() map[string]spec.Ref { + return cloneRefMap(s.references.allRefs) +} + // ParameterPatterns returns all the patterns found in parameters // the map is cloned to avoid accidental changes. func (s *Spec) ParameterPatterns() map[string]string { @@ -1053,6 +1067,13 @@ func cloneStringMap(source map[string]string) map[string]string { return res } +func cloneRefMap(source map[string]spec.Ref) map[string]spec.Ref { + res := make(map[string]spec.Ref, len(source)) + maps.Copy(res, source) + + return res +} + func cloneEnumMap(source map[string][]any) map[string][]any { res := make(map[string][]any, len(source)) maps.Copy(res, source) diff --git a/vendor/github.com/go-openapi/loads/CONTRIBUTORS.md b/vendor/github.com/go-openapi/loads/CONTRIBUTORS.md index ff3fd3508..b13f2b8d2 100644 --- a/vendor/github.com/go-openapi/loads/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/loads/CONTRIBUTORS.md @@ -4,11 +4,11 @@ | Total Contributors | Total Contributions | | --- | --- | -| 14 | 136 | +| 14 | 139 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 58 | | +| @fredbi | 61 | | | @casualjim | 48 | | | @youyuanwu | 6 | | | @vburenin | 4 | | diff --git a/vendor/github.com/go-openapi/loads/errors.go b/vendor/github.com/go-openapi/loads/errors.go index e94f038f9..f1df4e38a 100644 --- a/vendor/github.com/go-openapi/loads/errors.go +++ b/vendor/github.com/go-openapi/loads/errors.go @@ -3,6 +3,11 @@ package loads +import ( + "errors" + "fmt" +) + type loaderError string func (e loaderError) Error() string { @@ -11,7 +16,7 @@ func (e loaderError) Error() string { const ( // ErrLoads is an error returned by the loads package. - ErrLoads loaderError = "loaderrs error" + ErrLoads loaderError = "cannot load spec" // ErrNoLoader indicates that no configured loader matched the input. ErrNoLoader loaderError = "no loader matched" @@ -20,3 +25,17 @@ const ( // to a non-public address (loopback, private, link-local, or unspecified). ErrForbiddenAddress loaderError = "blocked dial to a non-public address" ) + +// errLoads marks err as an error from this package, so callers may test it with +// [errors.Is] against [ErrLoads]. +// +// The cause is reported on a single line, after the sentinel. An error that already +// carries the sentinel is returned unchanged: loaders are chained, and reporting +// "cannot load spec" once per link in the chain would tell the caller nothing. +func errLoads(err error) error { + if err == nil || errors.Is(err, ErrLoads) { + return err + } + + return fmt.Errorf("%w: %w", ErrLoads, err) +} diff --git a/vendor/github.com/go-openapi/loads/loaders.go b/vendor/github.com/go-openapi/loads/loaders.go index ba5c48b65..dc5f22fe1 100644 --- a/vendor/github.com/go-openapi/loads/loaders.go +++ b/vendor/github.com/go-openapi/loads/loaders.go @@ -5,7 +5,6 @@ package loads import ( "encoding/json" - "errors" "net/url" "slices" @@ -162,7 +161,7 @@ func (l *loader) WithNext(next *loader) *loader { func (l *loader) Load(path string) (json.RawMessage, error) { _, erp := url.Parse(path) if erp != nil { - return nil, errors.Join(erp, ErrLoads) + return nil, errLoads(erp) } var lastErr error = ErrNoLoader // default error if no match was found @@ -180,7 +179,7 @@ func (l *loader) Load(path string) (json.RawMessage, error) { lastErr = err } - return nil, errors.Join(lastErr, ErrLoads) + return nil, errLoads(lastErr) } func (l *loader) clone() *loader { @@ -202,7 +201,7 @@ func (l *loader) clone() *loader { func JSONDoc(path string, opts ...loading.Option) (json.RawMessage, error) { data, err := loading.LoadFromFileOrHTTP(path, opts...) if err != nil { - return nil, errors.Join(err, ErrLoads) + return nil, errLoads(err) } return json.RawMessage(data), nil } diff --git a/vendor/github.com/go-openapi/loads/spec.go b/vendor/github.com/go-openapi/loads/spec.go index 40eaff2c7..e9e4b57b7 100644 --- a/vendor/github.com/go-openapi/loads/spec.go +++ b/vendor/github.com/go-openapi/loads/spec.go @@ -7,7 +7,6 @@ import ( "bytes" "encoding/gob" "encoding/json" - "errors" "fmt" "maps" @@ -110,7 +109,7 @@ func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*D version = "2.0" } if version != "2.0" { - return nil, fmt.Errorf("spec version %q is not supported: %w", version, ErrLoads) + return nil, fmt.Errorf("%w: spec version %q is not supported", ErrLoads, version) } raw, err := trimData(data) // trim blanks, then convert yaml docs into json @@ -120,12 +119,12 @@ func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*D swspec := new(spec.Swagger) if err = json.Unmarshal(raw, swspec); err != nil { - return nil, errors.Join(err, ErrLoads) + return nil, errLoads(err) } origsqspec, err := cloneSpec(swspec) if err != nil { - return nil, errors.Join(err, ErrLoads) + return nil, errLoads(err) } d := &Document{ @@ -153,12 +152,12 @@ func trimData(in json.RawMessage) (json.RawMessage, error) { // assume yaml doc: convert it to json yml, err := yamlutils.BytesToYAMLDoc(trimmed) if err != nil { - return nil, fmt.Errorf("analyzed: %w: %w", err, ErrLoads) + return nil, fmt.Errorf("analyzed: %w", errLoads(err)) } d, err := yamlutils.YAMLToJSON(yml) if err != nil { - return nil, fmt.Errorf("analyzed: %w: %w", err, ErrLoads) + return nil, fmt.Errorf("analyzed: %w", errLoads(err)) } return d, nil diff --git a/vendor/github.com/go-openapi/runtime/.golangci.yml b/vendor/github.com/go-openapi/runtime/.golangci.yml index affd69c88..3e917ed30 100644 --- a/vendor/github.com/go-openapi/runtime/.golangci.yml +++ b/vendor/github.com/go-openapi/runtime/.golangci.yml @@ -5,6 +5,7 @@ linters: - depguard - err113 # disabled temporarily: there are just too many issues to address - exhaustruct + - exhaustruct_v5 - funlen - gochecknoglobals - gochecknoinits diff --git a/vendor/github.com/go-openapi/runtime/CONTRIBUTORS.md b/vendor/github.com/go-openapi/runtime/CONTRIBUTORS.md index 9c959ef48..10195c33b 100644 --- a/vendor/github.com/go-openapi/runtime/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/runtime/CONTRIBUTORS.md @@ -4,12 +4,12 @@ | Total Contributors | Total Contributions | | --- | --- | -| 71 | 570 | +| 73 | 573 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | | @casualjim | 268 | | -| @fredbi | 144 | | +| @fredbi | 145 | | | @youyuanwu | 19 | | | @josephwoodward | 13 | | | @kenjones-cisco | 12 | | @@ -40,12 +40,13 @@ | @tschaub | 1 | | | @pytlesk4 | 1 | | | @tgraf | 1 | | +| @delthas | 1 | | | @seanprince | 1 | | | @rodriguise | 1 | | | @petrkotas | 1 | | +| @fpawel | 1 | | | @maxatome | 1 | | | @maxkarelov | 1 | | -| @tooolbox | 1 | | | @akutz | 1 | | | @yabberyabber | 1 | | | @elv-gilles | 1 | | @@ -79,5 +80,6 @@ | @KuaaMU | 1 | | | @germanhs | 1 | | | @pracucci | 1 | | +| @tooolbox | 1 | | _this file was generated by the [Contributors GitHub Action](https://github.com/github-community-projects/contributors)_ diff --git a/vendor/github.com/go-openapi/runtime/multipart_stream.go b/vendor/github.com/go-openapi/runtime/multipart_stream.go index 76e1bf460..78bc97559 100644 --- a/vendor/github.com/go-openapi/runtime/multipart_stream.go +++ b/vendor/github.com/go-openapi/runtime/multipart_stream.go @@ -342,6 +342,10 @@ func (s *MultipartFormStream) Drain() error { // particular, a net/http server request body may discard a limited amount of // unread data to allow connection reuse, so Close is not guaranteed to return // immediately. Call Drain when trailing form fields must be collected. +// +// Close returns the error reported by the request body, except io.EOF: a +// net/http server body reports io.EOF once it discards that unread remainder, +// which tells us the body ended, not that closing it failed. func (s *MultipartFormStream) Close() error { if s == nil || s.closed { return nil @@ -357,7 +361,14 @@ func (s *MultipartFormStream) Close() error { return nil } - return s.request.Body.Close() + // Since go1.27.0, net/http (*body).Close returns io.EOF when it discards + // the unread remainder of the request itself. Reaching the end of the body + // is not a close failure. + if err := s.request.Body.Close(); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil } func supportsMultipartFormStream(method string) bool { diff --git a/vendor/github.com/go-openapi/validate/.gitignore b/vendor/github.com/go-openapi/validate/.gitignore index d8f4186fe..fbb78de2c 100644 --- a/vendor/github.com/go-openapi/validate/.gitignore +++ b/vendor/github.com/go-openapi/validate/.gitignore @@ -3,3 +3,4 @@ .idea .env .mcp.json +.worktrees diff --git a/vendor/github.com/go-openapi/validate/.golangci.yml b/vendor/github.com/go-openapi/validate/.golangci.yml index 4d6b36e47..b8875d7ab 100644 --- a/vendor/github.com/go-openapi/validate/.golangci.yml +++ b/vendor/github.com/go-openapi/validate/.golangci.yml @@ -7,6 +7,8 @@ linters: - gochecknoglobals - gochecknoinits - godox + - gomodguard + - gomodguard_v2 - exhaustruct - ireturn - nlreturn diff --git a/vendor/github.com/go-openapi/validate/CONTRIBUTORS.md b/vendor/github.com/go-openapi/validate/CONTRIBUTORS.md index 40d877a11..62bd8518f 100644 --- a/vendor/github.com/go-openapi/validate/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/validate/CONTRIBUTORS.md @@ -4,12 +4,12 @@ | Total Contributors | Total Contributions | | --- | --- | -| 31 | 310 | +| 32 | 312 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | | @casualjim | 169 | | -| @fredbi | 73 | | +| @fredbi | 74 | | | @sttts | 11 | | | @youyuanwu | 9 | | | @keramix | 8 | | @@ -32,6 +32,7 @@ | @liggitt | 1 | | | @ilyakaznacheev | 1 | | | @hypnoglow | 1 | | +| @HNO3Miracle | 1 | | | @gautierdelorme | 1 | | | @flavioribeiro | 1 | | | @pheepi | 1 | | diff --git a/vendor/github.com/go-openapi/validate/default_validator.go b/vendor/github.com/go-openapi/validate/default_validator.go index ebcd80713..5902cee5c 100644 --- a/vendor/github.com/go-openapi/validate/default_validator.go +++ b/vendor/github.com/go-openapi/validate/default_validator.go @@ -4,9 +4,6 @@ package validate import ( - "fmt" - "strings" - "github.com/go-openapi/spec" ) @@ -20,7 +17,7 @@ type defaultValidator struct { // Validate validates the default values declared in the swagger spec. func (d *defaultValidator) Validate() *Result { - errs := pools.poolOfResults.BorrowResult() // will redeem when merged + errs := validatorPools.results.Borrow() // will redeem when merged if d == nil || d.SpecValidator == nil { return errs @@ -44,28 +41,16 @@ func (d *defaultValidator) resetVisited() { } } -func isVisited(path string, visitedSchemas map[string]struct{}) bool { - _, found := visitedSchemas[path] +func isVisited(path pathSegments, visitedSchemas map[string]struct{}) bool { + _, found := visitedSchemas[path.pointer()] if found { return true } - // search for overlapping paths - var ( - parent string - suffix string - ) - const backtrackFromEnd = 2 - for i := len(path) - backtrackFromEnd; i >= 0; i-- { - r := path[i] - if r != '.' { - continue - } - - parent = path[0:i] - suffix = path[i+1:] - - if strings.HasSuffix(parent, suffix) { + // search for overlapping paths: a trailing run of tokens that already + // appears at the end of what leads to it means we are going in circles. + for i := 1; i < len(path); i++ { + if path[:i].hasSuffix(path[i:]) { return true } } @@ -74,12 +59,12 @@ func isVisited(path string, visitedSchemas map[string]struct{}) bool { } // beingVisited asserts a schema is being visited. -func (d *defaultValidator) beingVisited(path string) { - d.visitedSchemas[path] = struct{}{} +func (d *defaultValidator) beingVisited(path pathSegments) { + d.visitedSchemas[path.pointer()] = struct{}{} } // isVisited tells if a path has already been visited. -func (d *defaultValidator) isVisited(path string) bool { +func (d *defaultValidator) isVisited(path pathSegments) bool { return isVisited(path, d.visitedSchemas) } @@ -88,15 +73,18 @@ func (d *defaultValidator) validateDefaultValueValidAgainstSchema() *Result { // every default value that is specified must validate against the schema for that property // headers, items, parameters, schema - res := pools.poolOfResults.BorrowResult() // will redeem when merged + res := validatorPools.results.Borrow() // will redeem when merged s := d.SpecValidator - for method, pathItem := range s.expandedAnalyzer().Operations() { - for path, op := range pathItem { + operations := s.expandedAnalyzer().Operations() + for _, method := range sortedKeys(operations) { + pathItem := operations[method] + for _, path := range sortedKeys(pathItem) { + op := pathItem[path] // parameters for _, param := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) { if param.Default != nil && param.Required { - res.AddWarnings(requiredHasDefaultMsg(param.Name, param.In)) + res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), requiredHasDefaultMsg(param.Name, param.In)) } // reset explored schemas to get depth-first recursive-proof exploration @@ -107,33 +95,34 @@ func (d *defaultValidator) validateDefaultValueValidAgainstSchema() *Result { if param.Default != nil && param.Schema == nil { // check param default value is valid red := newParamValidator(¶m, s.KnownFormats, d.schemaOptions).Validate(param.Default) //#nosec + red.relocate(s.parameterPath(path, method, param.In, param.Name).child(jsonDefault)) if red.HasErrorsOrWarnings() { - res.AddErrors(defaultValueDoesNotValidateMsg(param.Name, param.In)) + res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), defaultValueDoesNotValidateMsg(param.Name, param.In)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } // Recursively follows Items and Schemas if param.Items != nil { - red := d.validateDefaultValueItemsAgainstSchema(param.Name, param.In, ¶m, param.Items) //#nosec + red := d.validateDefaultValueItemsAgainstSchema(s.parameterPath(path, method, param.In, param.Name), param.In, ¶m, param.Items) //#nosec if red.HasErrorsOrWarnings() { - res.AddErrors(defaultValueItemsDoesNotValidateMsg(param.Name, param.In)) + res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), defaultValueItemsDoesNotValidateMsg(param.Name, param.In)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } if param.Schema != nil { // Validate default value against schema - red := d.validateDefaultValueSchemaAgainstSchema(param.Name, param.In, param.Schema) + red := d.validateDefaultValueSchemaAgainstSchema(s.parameterPath(path, method, param.In, param.Name).structuralChild(jsonSchema), param.In, param.Schema) if red.HasErrorsOrWarnings() { - res.AddErrors(defaultValueDoesNotValidateMsg(param.Name, param.In)) + res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), defaultValueDoesNotValidateMsg(param.Name, param.In)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } } @@ -141,68 +130,74 @@ func (d *defaultValidator) validateDefaultValueValidAgainstSchema() *Result { if op.Responses != nil { if op.Responses.Default != nil { // Same constraint on default Response - res.Merge(d.validateDefaultInResponse(op.Responses.Default, jsonDefault, path, 0, op.ID)) + res.Merge(d.validateDefaultInResponse(op.Responses.Default, jsonDefault, path, method, 0, op.ID)) } // Same constraint on regular Responses if op.Responses.StatusCodeResponses != nil { // Safeguard - for code, r := range op.Responses.StatusCodeResponses { - res.Merge(d.validateDefaultInResponse(&r, "response", path, code, op.ID)) //#nosec + for _, code := range sortedKeys(op.Responses.StatusCodeResponses) { + r := op.Responses.StatusCodeResponses[code] + res.Merge(d.validateDefaultInResponse(&r, "response", path, method, code, op.ID)) } } } else if op.ID != "" { // Empty op.ID means there is no meaningful operation: no need to report a specific message - res.AddErrors(noValidResponseMsg(op.ID)) + res.addErrorsAt(operationPath(path, method), noValidResponseMsg(op.ID)) } } } if s.spec.Spec().Definitions != nil { // Safeguard // reset explored schemas to get depth-first recursive-proof exploration d.resetVisited() - for nm, sch := range s.spec.Spec().Definitions { - res.Merge(d.validateDefaultValueSchemaAgainstSchema("definitions."+nm, "body", &sch)) //#nosec + definitions := s.spec.Spec().Definitions + for _, nm := range sortedKeys(definitions) { + sch := definitions[nm] + res.Merge(d.validateDefaultValueSchemaAgainstSchema(newPathSegments(swaggerDefinitions, nm), "body", &sch)) } } return res } -func (d *defaultValidator) validateDefaultInResponse(resp *spec.Response, responseType, path string, responseCode int, operationID string) *Result { +func (d *defaultValidator) validateDefaultInResponse( + resp *spec.Response, responseType, path, method string, responseCode int, operationID string, +) *Result { s := d.SpecValidator - response, res := responseHelp.expandResponseRef(resp, path, s) + responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode) + response, res := responseHelp.expandResponseRef(resp, path, responsePath(path, method, responseCodeAsStr), s) if !res.IsValid() { return res } - responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode) - if response.Headers != nil { // Safeguard - for nm, h := range response.Headers { + for _, nm := range sortedKeys(response.Headers) { + h := response.Headers[nm] // reset explored schemas to get depth-first recursive-proof exploration d.resetVisited() if h.Default != nil { red := newHeaderValidator(nm, &h, s.KnownFormats, d.schemaOptions).Validate(h.Default) //#nosec + red.relocate(responseHeaderPath(path, method, responseCodeAsStr, nm).child(jsonDefault)) if red.HasErrorsOrWarnings() { - res.AddErrors(defaultValueHeaderDoesNotValidateMsg(operationID, nm, responseName)) + res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), defaultValueHeaderDoesNotValidateMsg(operationID, nm, responseName)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } // Headers have inline definition, like params if h.Items != nil { - red := d.validateDefaultValueItemsAgainstSchema(nm, "header", &h, h.Items) //#nosec + red := d.validateDefaultValueItemsAgainstSchema(responseHeaderPath(path, method, responseCodeAsStr, nm), "header", &h, h.Items) //#nosec if red.HasErrorsOrWarnings() { - res.AddErrors(defaultValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName)) + res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), defaultValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } if _, err := compileRegexp(h.Pattern); err != nil { - res.AddErrors(invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err)) + res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err)) } // Headers don't have schema @@ -212,62 +207,65 @@ func (d *defaultValidator) validateDefaultInResponse(resp *spec.Response, respon // reset explored schemas to get depth-first recursive-proof exploration d.resetVisited() - red := d.validateDefaultValueSchemaAgainstSchema(responseCodeAsStr, "response", response.Schema) + red := d.validateDefaultValueSchemaAgainstSchema( + responsePath(path, method, responseCodeAsStr).structuralChild(jsonSchema), "response", response.Schema) if red.HasErrorsOrWarnings() { // Additional message to make sure the context of the error is not lost - res.AddErrors(defaultValueInDoesNotValidateMsg(operationID, responseName)) + res.addErrorsAt(responsePath(path, method, responseCodeAsStr), defaultValueInDoesNotValidateMsg(operationID, responseName)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } return res } -func (d *defaultValidator) validateDefaultValueSchemaAgainstSchema(path, in string, schema *spec.Schema) *Result { +func (d *defaultValidator) validateDefaultValueSchemaAgainstSchema(path pathSegments, in string, schema *spec.Schema) *Result { if schema == nil || d.isVisited(path) { // Avoids recursing if we are already done with that check return nil } d.beingVisited(path) - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() s := d.SpecValidator if schema.Default != nil { res.Merge( - newSchemaValidator(schema, s.spec.Spec(), path+".default", s.KnownFormats, d.schemaOptions).Validate(schema.Default), + newSchemaValidator(schema, s.spec.Spec(), path.child(jsonDefault), s.KnownFormats, d.schemaOptions).Validate(schema.Default), ) } if schema.Items != nil { if schema.Items.Schema != nil { - res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+".items.default", in, schema.Items.Schema)) + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonItems), in, schema.Items.Schema)) } // Multiple schemas in items if schema.Items.Schemas != nil { // Safeguard for i, sch := range schema.Items.Schemas { - res.Merge(d.validateDefaultValueSchemaAgainstSchema(fmt.Sprintf("%s.items[%d].default", path, i), in, &sch)) //#nosec + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonItems).item(i), in, &sch)) //#nosec } } } if _, err := compileRegexp(schema.Pattern); err != nil { - res.AddErrors(invalidPatternInMsg(path, in, schema.Pattern)) + res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, schema.Pattern)) } if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil { // NOTE: we keep validating values, even though additionalItems is not supported by Swagger 2.0 (and 3.0 as well) - res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+".additionalItems", in, schema.AdditionalItems.Schema)) + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonAdditionalItems), in, schema.AdditionalItems.Schema)) } - for propName, prop := range schema.Properties { - res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec + for _, propName := range sortedKeys(schema.Properties) { + prop := schema.Properties[propName] + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.structuralChild(jsonProperties).child(propName), in, &prop)) } - for propName, prop := range schema.PatternProperties { - res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec + for _, propName := range sortedKeys(schema.PatternProperties) { + prop := schema.PatternProperties[propName] + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.structuralChild(jsonPatternProperties).child(propName), in, &prop)) } if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil { - res.Merge(d.validateDefaultValueSchemaAgainstSchema(path+".additionalProperties", in, schema.AdditionalProperties.Schema)) + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonAdditionalProperties), in, schema.AdditionalProperties.Schema)) } if schema.AllOf != nil { for i, aoSch := range schema.AllOf { - res.Merge(d.validateDefaultValueSchemaAgainstSchema(fmt.Sprintf("%s.allOf[%d]", path, i), in, &aoSch)) //#nosec + res.Merge(d.validateDefaultValueSchemaAgainstSchema(path.child(jsonAllOf).item(i), in, &aoSch)) //#nosec } } return res @@ -275,8 +273,8 @@ func (d *defaultValidator) validateDefaultValueSchemaAgainstSchema(path, in stri // NOTE: Temporary duplicated code. Need to refactor with examples -func (d *defaultValidator) validateDefaultValueItemsAgainstSchema(path, in string, root any, items *spec.Items) *Result { - res := pools.poolOfResults.BorrowResult() +func (d *defaultValidator) validateDefaultValueItemsAgainstSchema(path pathSegments, in string, root any, items *spec.Items) *Result { + res := validatorPools.results.Borrow() s := d.SpecValidator if items != nil { if items.Default != nil { @@ -285,10 +283,10 @@ func (d *defaultValidator) validateDefaultValueItemsAgainstSchema(path, in strin ) } if items.Items != nil { - res.Merge(d.validateDefaultValueItemsAgainstSchema(path+"[0].default", in, root, items.Items)) + res.Merge(d.validateDefaultValueItemsAgainstSchema(path.item(0), in, root, items.Items)) } if _, err := compileRegexp(items.Pattern); err != nil { - res.AddErrors(invalidPatternInMsg(path, in, items.Pattern)) + res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, items.Pattern)) } } return res diff --git a/vendor/github.com/go-openapi/validate/example_validator.go b/vendor/github.com/go-openapi/validate/example_validator.go index eb6b5ee5c..0e193d523 100644 --- a/vendor/github.com/go-openapi/validate/example_validator.go +++ b/vendor/github.com/go-openapi/validate/example_validator.go @@ -4,8 +4,6 @@ package validate import ( - "fmt" - "github.com/go-openapi/spec" ) @@ -24,7 +22,7 @@ type exampleValidator struct { // - individual property // - responses func (ex *exampleValidator) Validate() *Result { - errs := pools.poolOfResults.BorrowResult() + errs := validatorPools.results.Borrow() if ex == nil || ex.SpecValidator == nil { return errs @@ -50,12 +48,12 @@ func (ex *exampleValidator) resetVisited() { } // beingVisited asserts a schema is being visited. -func (ex *exampleValidator) beingVisited(path string) { - ex.visitedSchemas[path] = struct{}{} +func (ex *exampleValidator) beingVisited(path pathSegments) { + ex.visitedSchemas[path.pointer()] = struct{}{} } // isVisited tells if a path has already been visited. -func (ex *exampleValidator) isVisited(path string) bool { +func (ex *exampleValidator) isVisited(path pathSegments) bool { return isVisited(path, ex.visitedSchemas) } @@ -65,11 +63,14 @@ func (ex *exampleValidator) validateExampleValueValidAgainstSchema() *Result { // in: schemas, properties, object, items // not in: headers, parameters without schema - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() s := ex.SpecValidator - for method, pathItem := range s.expandedAnalyzer().Operations() { - for path, op := range pathItem { + operations := s.expandedAnalyzer().Operations() + for _, method := range sortedKeys(operations) { + pathItem := operations[method] + for _, path := range sortedKeys(pathItem) { + op := pathItem[path] // parameters for _, param := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) { @@ -84,33 +85,34 @@ func (ex *exampleValidator) validateExampleValueValidAgainstSchema() *Result { if param.Example != nil && param.Schema == nil { // check param default value is valid red := newParamValidator(¶m, s.KnownFormats, ex.schemaOptions).Validate(param.Example) //#nosec + red.relocate(s.parameterPath(path, method, param.In, param.Name).child(swaggerExample)) if red.HasErrorsOrWarnings() { - res.AddWarnings(exampleValueDoesNotValidateMsg(param.Name, param.In)) + res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), exampleValueDoesNotValidateMsg(param.Name, param.In)) res.MergeAsWarnings(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } // Recursively follows Items and Schemas if param.Items != nil { - red := ex.validateExampleValueItemsAgainstSchema(param.Name, param.In, ¶m, param.Items) //#nosec + red := ex.validateExampleValueItemsAgainstSchema(s.parameterPath(path, method, param.In, param.Name), param.In, ¶m, param.Items) //#nosec if red.HasErrorsOrWarnings() { - res.AddWarnings(exampleValueItemsDoesNotValidateMsg(param.Name, param.In)) + res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), exampleValueItemsDoesNotValidateMsg(param.Name, param.In)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } if param.Schema != nil { // Validate example value against schema - red := ex.validateExampleValueSchemaAgainstSchema(param.Name, param.In, param.Schema) + red := ex.validateExampleValueSchemaAgainstSchema(s.parameterPath(path, method, param.In, param.Name).structuralChild(jsonSchema), param.In, param.Schema) if red.HasErrorsOrWarnings() { - res.AddWarnings(exampleValueDoesNotValidateMsg(param.Name, param.In)) + res.addWarningsAt(s.parameterPath(path, method, param.In, param.Name), exampleValueDoesNotValidateMsg(param.Name, param.In)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } } @@ -118,68 +120,74 @@ func (ex *exampleValidator) validateExampleValueValidAgainstSchema() *Result { if op.Responses != nil { if op.Responses.Default != nil { // Same constraint on default Response - res.Merge(ex.validateExampleInResponse(op.Responses.Default, jsonDefault, path, 0, op.ID)) + res.Merge(ex.validateExampleInResponse(op.Responses.Default, jsonDefault, path, method, 0, op.ID)) } // Same constraint on regular Responses if op.Responses.StatusCodeResponses != nil { // Safeguard - for code, r := range op.Responses.StatusCodeResponses { - res.Merge(ex.validateExampleInResponse(&r, "response", path, code, op.ID)) //#nosec + for _, code := range sortedKeys(op.Responses.StatusCodeResponses) { + r := op.Responses.StatusCodeResponses[code] + res.Merge(ex.validateExampleInResponse(&r, "response", path, method, code, op.ID)) } } } else if op.ID != "" { // Empty op.ID means there is no meaningful operation: no need to report a specific message - res.AddErrors(noValidResponseMsg(op.ID)) + res.addErrorsAt(operationPath(path, method), noValidResponseMsg(op.ID)) } } } if s.spec.Spec().Definitions != nil { // Safeguard // reset explored schemas to get depth-first recursive-proof exploration ex.resetVisited() - for nm, sch := range s.spec.Spec().Definitions { - res.Merge(ex.validateExampleValueSchemaAgainstSchema("definitions."+nm, "body", &sch)) //#nosec + definitions := s.spec.Spec().Definitions + for _, nm := range sortedKeys(definitions) { + sch := definitions[nm] + res.Merge(ex.validateExampleValueSchemaAgainstSchema(newPathSegments(swaggerDefinitions, nm), "body", &sch)) } } return res } -func (ex *exampleValidator) validateExampleInResponse(resp *spec.Response, responseType, path string, responseCode int, operationID string) *Result { +func (ex *exampleValidator) validateExampleInResponse( + resp *spec.Response, responseType, path, method string, responseCode int, operationID string, +) *Result { s := ex.SpecValidator - response, res := responseHelp.expandResponseRef(resp, path, s) + responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode) + response, res := responseHelp.expandResponseRef(resp, path, responsePath(path, method, responseCodeAsStr), s) if !res.IsValid() { // Safeguard return res } - responseName, responseCodeAsStr := responseHelp.responseMsgVariants(responseType, responseCode) - if response.Headers != nil { // Safeguard - for nm, h := range response.Headers { + for _, nm := range sortedKeys(response.Headers) { + h := response.Headers[nm] // reset explored schemas to get depth-first recursive-proof exploration ex.resetVisited() if h.Example != nil { red := newHeaderValidator(nm, &h, s.KnownFormats, ex.schemaOptions).Validate(h.Example) //#nosec + red.relocate(responseHeaderPath(path, method, responseCodeAsStr, nm).child(swaggerExample)) if red.HasErrorsOrWarnings() { - res.AddWarnings(exampleValueHeaderDoesNotValidateMsg(operationID, nm, responseName)) + res.addWarningsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), exampleValueHeaderDoesNotValidateMsg(operationID, nm, responseName)) res.MergeAsWarnings(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } // Headers have inline definition, like params if h.Items != nil { - red := ex.validateExampleValueItemsAgainstSchema(nm, "header", &h, h.Items) //#nosec + red := ex.validateExampleValueItemsAgainstSchema(responseHeaderPath(path, method, responseCodeAsStr, nm), "header", &h, h.Items) //#nosec if red.HasErrorsOrWarnings() { - res.AddWarnings(exampleValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName)) + res.addWarningsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), exampleValueHeaderItemsDoesNotValidateMsg(operationID, nm, responseName)) res.MergeAsWarnings(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } if _, err := compileRegexp(h.Pattern); err != nil { - res.AddErrors(invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err)) + res.addErrorsAt(responseHeaderPath(path, method, responseCodeAsStr, nm), invalidPatternInHeaderMsg(operationID, nm, responseName, h.Pattern, err)) } // Headers don't have schema @@ -189,77 +197,84 @@ func (ex *exampleValidator) validateExampleInResponse(resp *spec.Response, respo // reset explored schemas to get depth-first recursive-proof exploration ex.resetVisited() - red := ex.validateExampleValueSchemaAgainstSchema(responseCodeAsStr, "response", response.Schema) + red := ex.validateExampleValueSchemaAgainstSchema( + responsePath(path, method, responseCodeAsStr).structuralChild(jsonSchema), "response", response.Schema) if red.HasErrorsOrWarnings() { // Additional message to make sure the context of the error is not lost - res.AddWarnings(exampleValueInDoesNotValidateMsg(operationID, responseName)) + res.addWarningsAt(responsePath(path, method, responseCodeAsStr), exampleValueInDoesNotValidateMsg(operationID, responseName)) res.Merge(red) } else if red.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(red) + redeemResult(red) } } if response.Examples != nil { if response.Schema != nil { - if example, ok := response.Examples["application/json"]; ok { + if example, ok := response.Examples[jsonMimeApplicationJSON]; ok { + exampleAt := responsePath(path, method, responseCodeAsStr). + child(swaggerExamples). + structuralChild(jsonMimeApplicationJSON) res.MergeAsWarnings( - newSchemaValidator(response.Schema, s.spec.Spec(), path+".examples", s.KnownFormats, s.schemaOptions).Validate(example), + newSchemaValidator(response.Schema, s.spec.Spec(), + exampleAt, s.KnownFormats, s.schemaOptions).Validate(example), ) } else { // Proposal for enhancement: validate other media types too - res.AddWarnings(examplesMimeNotSupportedMsg(operationID, responseName)) + res.addWarningsAt(responsePath(path, method, responseCodeAsStr).child(swaggerExamples), examplesMimeNotSupportedMsg(operationID, responseName)) } } else { - res.AddWarnings(examplesWithoutSchemaMsg(operationID, responseName)) + res.addWarningsAt(responsePath(path, method, responseCodeAsStr).child(swaggerExamples), examplesWithoutSchemaMsg(operationID, responseName)) } } return res } -func (ex *exampleValidator) validateExampleValueSchemaAgainstSchema(path, in string, schema *spec.Schema) *Result { +func (ex *exampleValidator) validateExampleValueSchemaAgainstSchema(path pathSegments, in string, schema *spec.Schema) *Result { if schema == nil || ex.isVisited(path) { // Avoids recursing if we are already done with that check return nil } ex.beingVisited(path) s := ex.SpecValidator - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() if schema.Example != nil { res.MergeAsWarnings( - newSchemaValidator(schema, s.spec.Spec(), path+".example", s.KnownFormats, ex.schemaOptions).Validate(schema.Example), + newSchemaValidator(schema, s.spec.Spec(), path.child(swaggerExample), s.KnownFormats, ex.schemaOptions).Validate(schema.Example), ) } if schema.Items != nil { if schema.Items.Schema != nil { - res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+".items.example", in, schema.Items.Schema)) + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonItems), in, schema.Items.Schema)) } // Multiple schemas in items if schema.Items.Schemas != nil { // Safeguard for i, sch := range schema.Items.Schemas { - res.Merge(ex.validateExampleValueSchemaAgainstSchema(fmt.Sprintf("%s.items[%d].example", path, i), in, &sch)) //#nosec + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonItems).item(i), in, &sch)) //#nosec } } } if _, err := compileRegexp(schema.Pattern); err != nil { - res.AddErrors(invalidPatternInMsg(path, in, schema.Pattern)) + res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, schema.Pattern)) } if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil { // NOTE: we keep validating values, even though additionalItems is unsupported in Swagger 2.0 (and 3.0 as well) - res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+".additionalItems", in, schema.AdditionalItems.Schema)) + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonAdditionalItems), in, schema.AdditionalItems.Schema)) } - for propName, prop := range schema.Properties { - res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec + for _, propName := range sortedKeys(schema.Properties) { + prop := schema.Properties[propName] + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.structuralChild(jsonProperties).child(propName), in, &prop)) } - for propName, prop := range schema.PatternProperties { - res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+"."+propName, in, &prop)) //#nosec + for _, propName := range sortedKeys(schema.PatternProperties) { + prop := schema.PatternProperties[propName] + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.structuralChild(jsonPatternProperties).child(propName), in, &prop)) } if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil { - res.Merge(ex.validateExampleValueSchemaAgainstSchema(path+".additionalProperties", in, schema.AdditionalProperties.Schema)) + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonAdditionalProperties), in, schema.AdditionalProperties.Schema)) } if schema.AllOf != nil { for i, aoSch := range schema.AllOf { - res.Merge(ex.validateExampleValueSchemaAgainstSchema(fmt.Sprintf("%s.allOf[%d]", path, i), in, &aoSch)) //#nosec + res.Merge(ex.validateExampleValueSchemaAgainstSchema(path.child(jsonAllOf).item(i), in, &aoSch)) //#nosec } } return res @@ -268,8 +283,8 @@ func (ex *exampleValidator) validateExampleValueSchemaAgainstSchema(path, in str // NOTE: Temporary duplicated code. Need to refactor with examples // -func (ex *exampleValidator) validateExampleValueItemsAgainstSchema(path, in string, root any, items *spec.Items) *Result { - res := pools.poolOfResults.BorrowResult() +func (ex *exampleValidator) validateExampleValueItemsAgainstSchema(path pathSegments, in string, root any, items *spec.Items) *Result { + res := validatorPools.results.Borrow() s := ex.SpecValidator if items != nil { if items.Example != nil { @@ -278,10 +293,10 @@ func (ex *exampleValidator) validateExampleValueItemsAgainstSchema(path, in stri ) } if items.Items != nil { - res.Merge(ex.validateExampleValueItemsAgainstSchema(path+"[0].example", in, root, items.Items)) + res.Merge(ex.validateExampleValueItemsAgainstSchema(path.item(0), in, root, items.Items)) } if _, err := compileRegexp(items.Pattern); err != nil { - res.AddErrors(invalidPatternInMsg(path, in, items.Pattern)) + res.addErrorsAt(path, invalidPatternInMsg(path.dotted(), in, items.Pattern)) } } diff --git a/vendor/github.com/go-openapi/validate/formats.go b/vendor/github.com/go-openapi/validate/formats.go index eab261537..23359e35d 100644 --- a/vendor/github.com/go-openapi/validate/formats.go +++ b/vendor/github.com/go-openapi/validate/formats.go @@ -11,21 +11,21 @@ import ( ) type formatValidator struct { - Path string + Path pathSegments In string Format string KnownFormats strfmt.Registry Options *SchemaValidatorOptions } -func newFormatValidator(path, in, format string, formats strfmt.Registry, opts *SchemaValidatorOptions) *formatValidator { +func newFormatValidator(path pathSegments, in, format string, formats strfmt.Registry, opts *SchemaValidatorOptions) *formatValidator { if opts == nil { opts = new(SchemaValidatorOptions) } var f *formatValidator if opts.recycleValidators { - f = pools.poolOfFormatValidators.BorrowValidator() + f = validatorPools.formatValidators.Borrow() } else { f = new(formatValidator) } @@ -39,10 +39,6 @@ func newFormatValidator(path, in, format string, formats strfmt.Registry, opts * return f } -func (f *formatValidator) SetPath(path string) { - f.Path = path -} - func (f *formatValidator) Applies(source any, kind reflect.Kind) bool { if source == nil || f.KnownFormats == nil { return false @@ -71,7 +67,7 @@ func (f *formatValidator) Validate(val any) *Result { var result *Result if f.Options.recycleResult { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() } else { result = new(Result) } @@ -81,13 +77,17 @@ func (f *formatValidator) Validate(val any) *Result { return result } - if err := FormatOf(f.Path, f.In, f.Format, str, f.KnownFormats); err != nil { - result.AddErrors(err) + if err := FormatOf(f.Path.dotted(), f.In, f.Format, str, f.KnownFormats); err != nil { + result.addErrorsAt(f.Path, err) } return result } +func (f *formatValidator) setPath(path pathSegments) { + f.Path = path +} + func (f *formatValidator) redeem() { - pools.poolOfFormatValidators.RedeemValidator(f) + validatorPools.formatValidators.Redeem(f) } diff --git a/vendor/github.com/go-openapi/validate/helpers.go b/vendor/github.com/go-openapi/validate/helpers.go index 7cc254e02..62deb97d0 100644 --- a/vendor/github.com/go-openapi/validate/helpers.go +++ b/vendor/github.com/go-openapi/validate/helpers.go @@ -12,6 +12,7 @@ import ( "strings" "github.com/go-openapi/errors" + "github.com/go-openapi/jsonpointer" "github.com/go-openapi/spec" ) @@ -33,13 +34,78 @@ const ( ) const ( - jsonProperties = "properties" - jsonItems = "items" - jsonType = "type" - // jsonSchema = "schema". - jsonDefault = "default" + jsonProperties = "properties" + jsonPatternProperties = "patternProperties" + jsonItems = "items" + jsonType = "type" + jsonSchema = "schema" + jsonRequired = "required" + jsonRef = "$ref" + jsonDefault = "default" + + jsonAllOf = "allOf" + jsonAnyOf = "anyOf" + jsonOneOf = "oneOf" + jsonNot = "not" + jsonAdditionalItems = "additionalItems" + jsonAdditionalProperties = "additionalProperties" + + swaggerPaths = "paths" + swaggerDefinitions = "definitions" + swaggerResponses = "responses" + swaggerParameters = "parameters" + swaggerHeaders = "headers" + swaggerOperationID = "operationId" + + jsonMimeApplicationJSON = "application/json" ) +// operationPath locates an operation in the spec document. +func operationPath(path, method string) pathSegments { + return newPathSegments(swaggerPaths, path, methodToken(method)) +} + +// parameterPath locates a parameter of an operation in the spec document. +func (s *SpecValidator) parameterPath(path, method, in, name string) pathSegments { + return s.paramLocations.at(path, method, in, name) +} + +// responsePath locates a response of an operation in the spec document. +func responsePath(path, method, responseCode string) pathSegments { + return operationPath(path, method).children(swaggerResponses, responseCode) +} + +// responseHeaderPath locates a header declared by a response. +func responseHeaderPath(path, method, responseCode, header string) pathSegments { + return responsePath(path, method, responseCode).children(swaggerHeaders, header) +} + +// methodToken normalizes an HTTP method into the key under which the operation +// is found in the document: the analyzer hands them over in upper case, but a +// path item spells them in lower case. +func methodToken(method string) string { + return strings.ToLower(method) +} + +// localRefPath turns a local JSON reference such as "#/definitions/Pet" into +// the location of what it points to. +// +// It yields the document root for anything that does not address a local +// fragment, a remote reference in particular. +func localRefPath(ref string) pathSegments { + rest, isLocal := strings.CutPrefix(ref, "#/") + if !isLocal { + return rootPath() + } + + tokens := strings.Split(rest, "/") + for i, token := range tokens { + tokens[i] = jsonpointer.Unescape(token) + } + + return newPathSegments(tokens...) +} + const ( stringFormatDate = "date" stringFormatDateTime = "date-time" @@ -91,24 +157,33 @@ type errorHelper struct { } func (h *errorHelper) sErr(err errors.Error, recycle bool) *Result { - // Builds a Result from standard errors.Error + return h.sErrAt(nil, err, recycle) +} + +// sErrAt builds a Result from a standard errors.Error reported at a known location. +func (h *errorHelper) sErrAt(at pathSegments, err errors.Error, recycle bool) *Result { var result *Result if recycle { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() } else { result = new(Result) } - result.Errors = []error{err} + result.addErrorsAt(at, err) return result } func (h *errorHelper) addPointerError(res *Result, err error, ref string, fromPath string) *Result { - // Provides more context on error messages - // reported by the jsoinpointer package by altering the passed Result + return h.addPointerErrorAt(res, nil, err, ref, fromPath) +} + +// addPointerErrorAt provides more context on error messages reported by the +// jsonpointer package, by altering the passed Result. +func (h *errorHelper) addPointerErrorAt(res *Result, at pathSegments, err error, ref string, fromPath string) *Result { if err != nil { - res.AddErrors(cannotResolveRefMsg(fromPath, ref, err)) + res.addErrorsAt(at, cannotResolveRefMsg(fromPath, ref, err)) } + return res } @@ -222,15 +297,19 @@ func (h *paramHelper) safeExpandedParamsFor(path, method, operationID string, re // remove params with invalid expansion from Slice operation.Parameters = resolvedParams - for _, ppr := range s.expandedAnalyzer().SafeParamsFor(method, path, + // the analyzer keys parameters by name and location: walk those keys in + // order, so that findings about an operation's parameters come out the + // same way on every run + safeParams := s.expandedAnalyzer().SafeParamsFor(method, path, func(_ spec.Parameter, err error) bool { // since params have already been expanded, there are few causes for error - res.AddErrors(someParametersBrokenMsg(path, method, operationID)) + res.addErrorsAt(operationPath(path, method), someParametersBrokenMsg(path, method, operationID)) // original error from analyzer - res.AddErrors(err) + res.addErrorsAt(operationPath(path, method), err) return true - }) { - params = append(params, ppr) + }) + for _, k := range sortedKeys(safeParams) { + params = append(params, safeParams[k]) } } return @@ -249,14 +328,16 @@ func (h *paramHelper) resolveParam(path, method, operationID string, param *spec if err != nil { // Safeguard // NOTE: we may enter here when the whole parameter is an unresolved $ref refPath := strings.Join([]string{"\"" + path + "\"", method}, ".") - errorHelp.addPointerError(res, err, param.Ref.String(), refPath) + errorHelp.addPointerErrorAt(res, s.parameterPath(path, method, param.In, param.Name), err, param.Ref.String(), refPath) return nil, res } - res.Merge(h.checkExpandedParam(param, param.Name, param.In, operationID, isRef)) + res.Merge(h.checkExpandedParam(param, param.Name, param.In, operationID, s.parameterPath(path, method, param.In, param.Name), isRef)) return param, res } -func (h *paramHelper) checkExpandedParam(pr *spec.Parameter, path, in, operation string, isRef bool) *Result { +func (h *paramHelper) checkExpandedParam( + pr *spec.Parameter, path, in, operation string, at pathSegments, isRef bool, +) *Result { // Secure parameter structure after $ref resolution res := new(Result) simpleZero := spec.SimpleSchema{} @@ -267,17 +348,17 @@ func (h *paramHelper) checkExpandedParam(pr *spec.Parameter, path, in, operation // Most likely, a $ref with a sibling is an unwanted situation: in itself this is a warning... // but we detect it because of the following error: // schema took over Parameter for an unexplained reason - res.AddWarnings(refShouldNotHaveSiblingsMsg(path, operation)) + res.addWarningsAt(at, refShouldNotHaveSiblingsMsg(path, operation)) } - res.AddErrors(invalidParameterDefinitionMsg(path, in, operation)) + res.addErrorsAt(at, invalidParameterDefinitionMsg(path, in, operation)) case pr.In != swaggerBody && pr.Schema != nil: if isRef { - res.AddWarnings(refShouldNotHaveSiblingsMsg(path, operation)) + res.addWarningsAt(at, refShouldNotHaveSiblingsMsg(path, operation)) } - res.AddErrors(invalidParameterDefinitionAsSchemaMsg(path, in, operation)) + res.addErrorsAt(at, invalidParameterDefinitionAsSchemaMsg(path, in, operation)) case (pr.In == swaggerBody && pr.Schema == nil) || (pr.In != swaggerBody && pr.SimpleSchema == simpleZero): // Other unexpected mishaps - res.AddErrors(invalidParameterDefinitionMsg(path, in, operation)) + res.addErrorsAt(at, invalidParameterDefinitionMsg(path, in, operation)) } return res } @@ -288,7 +369,7 @@ type responseHelper struct { func (r *responseHelper) expandResponseRef( response *spec.Response, - path string, s *SpecValidator, + path string, at pathSegments, s *SpecValidator, ) (*spec.Response, *Result) { // Ensure response is expanded var err error @@ -301,7 +382,7 @@ func (r *responseHelper) expandResponseRef( } if err != nil { // Safeguard // NOTE: we may enter here when the whole response is an unresolved $ref. - errorHelp.addPointerError(res, err, response.Ref.String(), path) + errorHelp.addPointerErrorAt(res, at, err, response.Ref.String(), path) return nil, res } diff --git a/vendor/github.com/go-openapi/validate/object_validator.go b/vendor/github.com/go-openapi/validate/object_validator.go index e651b3f70..4f1dd15a2 100644 --- a/vendor/github.com/go-openapi/validate/object_validator.go +++ b/vendor/github.com/go-openapi/validate/object_validator.go @@ -4,7 +4,6 @@ package validate import ( - "fmt" "reflect" "strings" @@ -14,7 +13,7 @@ import ( ) type objectValidator struct { - Path string + Path pathSegments In string MaxProperties *int64 MinProperties *int64 @@ -25,10 +24,9 @@ type objectValidator struct { Root any KnownFormats strfmt.Registry Options *SchemaValidatorOptions - splitPath []string } -func newObjectValidator(path, in string, +func newObjectValidator(path pathSegments, in string, maxProperties, minProperties *int64, required []string, properties spec.SchemaProperties, additionalProperties *spec.SchemaOrBool, patternProperties spec.SchemaProperties, root any, formats strfmt.Registry, opts *SchemaValidatorOptions, @@ -39,7 +37,7 @@ func newObjectValidator(path, in string, var v *objectValidator if opts.recycleValidators { - v = pools.poolOfObjectValidators.BorrowValidator() + v = validatorPools.objectValidators.Borrow() } else { v = new(objectValidator) } @@ -55,7 +53,6 @@ func newObjectValidator(path, in string, v.Root = root v.KnownFormats = formats v.Options = opts - v.splitPath = strings.Split(v.Path, ".") return v } @@ -72,21 +69,21 @@ func (o *objectValidator) Validate(data any) *Result { var ok bool val, ok = data.(map[string]any) if !ok { - return errorHelp.sErr(invalidObjectMsg(o.Path, o.In), o.Options.recycleResult) + return errorHelp.sErrAt(o.Path, invalidObjectMsg(o.Path.dotted(), o.In), o.Options.recycleResult) } } numKeys := int64(len(val)) if o.MinProperties != nil && numKeys < *o.MinProperties { - return errorHelp.sErr(errors.TooFewProperties(o.Path, o.In, *o.MinProperties), o.Options.recycleResult) + return errorHelp.sErrAt(o.Path, errors.TooFewProperties(o.Path.dotted(), o.In, *o.MinProperties), o.Options.recycleResult) } if o.MaxProperties != nil && numKeys > *o.MaxProperties { - return errorHelp.sErr(errors.TooManyProperties(o.Path, o.In, *o.MaxProperties), o.Options.recycleResult) + return errorHelp.sErrAt(o.Path, errors.TooManyProperties(o.Path.dotted(), o.In, *o.MaxProperties), o.Options.recycleResult) } var res *Result if o.Options.recycleResult { - res = pools.poolOfResults.BorrowResult() + res = validatorPools.results.Borrow() } else { res = new(Result) } @@ -106,7 +103,8 @@ func (o *objectValidator) Validate(data any) *Result { // Check patternProperties // NOTE: it looks like we have done that twice in many cases - for key, value := range val { + for _, key := range sortedKeys(val) { + value := val[key] _, regularProperty := o.Properties[key] matched, _, patterns := o.validatePatternProperty(key, value, res) // applies to regular properties as well if regularProperty || !matched { @@ -115,7 +113,7 @@ func (o *objectValidator) Validate(data any) *Result { for _, pName := range patterns { if v, ok := o.PatternProperties[pName]; ok { - r := newSchemaValidator(&v, o.Root, o.Path+"."+key, o.KnownFormats, o.Options).Validate(value) + r := newSchemaValidator(&v, o.Root, o.Path.child(key), o.KnownFormats, o.Options).Validate(value) res.mergeForField(data.(map[string]any), key, r) //nolint:forcetypeassert // data is always map[string]any at this point } } @@ -124,11 +122,6 @@ func (o *objectValidator) Validate(data any) *Result { return res } -func (o *objectValidator) SetPath(path string) { - o.Path = path - o.splitPath = strings.Split(path, ".") -} - func (o *objectValidator) Applies(source any, kind reflect.Kind) bool { // NOTE: this should also work for structs // there is a problem in the type validator where it will be unhappy about null values @@ -137,19 +130,29 @@ func (o *objectValidator) Applies(source any, kind reflect.Kind) bool { return isSchema && (kind == reflect.Map || kind == reflect.Struct) } +// The three predicates below tell what kind of content the validated object +// is, so that schema-only checks are not run against plain data. +// +// Array indices are trimmed first: an element of an example is example data +// just as much as the example itself. + func (o *objectValidator) isProperties() bool { - p := o.splitPath - return len(p) > 1 && p[len(p)-1] == jsonProperties && p[len(p)-2] != jsonProperties + p := o.Path.trimIndexes() + + return p.last() == jsonProperties && p.beforeLast() != jsonProperties } func (o *objectValidator) isDefault() bool { - p := o.splitPath - return len(p) > 1 && p[len(p)-1] == jsonDefault && p[len(p)-2] != jsonDefault + p := o.Path.trimIndexes() + + return p.last() == jsonDefault && p.beforeLast() != jsonDefault } func (o *objectValidator) isExample() bool { - p := o.splitPath - return len(p) > 1 && (p[len(p)-1] == swaggerExample || p[len(p)-1] == swaggerExamples) && p[len(p)-2] != swaggerExample + p := o.Path.trimIndexes() + last := p.last() + + return (last == swaggerExample || last == swaggerExamples) && p.beforeLast() != swaggerExample } func (o *objectValidator) checkArrayMustHaveItems(res *Result, val map[string]any) { @@ -174,7 +177,7 @@ func (o *objectValidator) checkArrayMustHaveItems(res *Result, val map[string]an return } - res.AddErrors(errors.Required(jsonItems, o.Path, item)) + res.addErrorsAt(o.Path, errors.Required(jsonItems, o.Path.dotted(), item)) } func (o *objectValidator) checkItemsMustBeTypeArray(res *Result, val map[string]any) { @@ -194,11 +197,11 @@ func (o *objectValidator) checkItemsMustBeTypeArray(res *Result, val map[string] t, typeFound := val[jsonType] if !typeFound { // there is no type - res.AddErrors(errors.Required(jsonType, o.Path, t)) + res.addErrorsAt(o.Path, errors.Required(jsonType, o.Path.dotted(), t)) } if tpe, isString := t.(string); !isString || tpe != arrayType { - res.AddErrors(errors.InvalidType(o.Path, o.In, arrayType, nil)) + res.addErrorsAt(o.Path, errors.InvalidType(o.Path.dotted(), o.In, arrayType, nil)) } } @@ -212,7 +215,7 @@ func (o *objectValidator) precheck(res *Result, val map[string]any) { } func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res *Result) { - for k := range val { + for _, k := range sortedKeys(val) { if k == "$schema" || k == "id" { // special properties "$schema" and "id" are ignored continue @@ -238,7 +241,7 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res continue } - res.AddErrors(errors.PropertyNotAllowed(o.Path, o.In, k)) + res.addErrorsAt(o.Path.child(k), errors.PropertyNotAllowed(o.Path.dotted(), o.In, k)) // BUG(fredbi): This section should move to a part dedicated to spec validation as // it will conflict with regular schemas where a property "headers" is defined. @@ -261,7 +264,8 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res continue } - for headerKey, headerBody := range headers { + for _, headerKey := range sortedKeys(headers) { + headerBody := headers[headerKey] if headerBody == nil { continue } @@ -282,7 +286,7 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res } msg := strings.Join([]string{", one may not use $ref=\":", refString, "\""}, "") - res.AddErrors(refNotAllowedInHeaderMsg(o.Path, headerKey, msg)) + res.addErrorsAt(o.Path, refNotAllowedInHeaderMsg(o.Path.dotted(), headerKey, msg)) /* case "$ref": if val[k] != nil { @@ -294,7 +298,8 @@ func (o *objectValidator) validateNoAdditionalProperties(val map[string]any, res } func (o *objectValidator) validateAdditionalProperties(val map[string]any, res *Result) { - for key, value := range val { + for _, key := range sortedKeys(val) { + value := val[key] _, regularProperty := o.Properties[key] if regularProperty { continue @@ -315,7 +320,7 @@ func (o *objectValidator) validateAdditionalProperties(val map[string]any, res * // Cases: properties which are not regular properties and have not been matched by the PatternProperties validator // AdditionalProperties as Schema - r := newSchemaValidator(o.AdditionalProperties.Schema, o.Root, o.Path+"."+key, o.KnownFormats, o.Options).Validate(value) + r := newSchemaValidator(o.AdditionalProperties.Schema, o.Root, o.Path.child(key), o.KnownFormats, o.Options).Validate(value) res.mergeForField(val, key, r) } // Valid cases: additionalProperties: true or undefined @@ -326,19 +331,14 @@ func (o *objectValidator) validatePropertiesSchema(val map[string]any, res *Resu // Property types: // - regular Property - pSchema := pools.poolOfSchemas.BorrowSchema() // recycle a spec.Schema object which lifespan extends only to the validation of properties + pSchema := validatorPools.schemas.Borrow() // recycle a spec.Schema object which lifespan extends only to the validation of properties defer func() { - pools.poolOfSchemas.RedeemSchema(pSchema) + validatorPools.schemas.Redeem(pSchema) }() - for pName := range o.Properties { + for _, pName := range sortedKeys(o.Properties) { *pSchema = o.Properties[pName] - var rName string - if o.Path == "" { - rName = pName - } else { - rName = o.Path + "." + pName - } + rName := o.Path.child(pName) // Recursively validates each property against its schema v, ok := val[pName] @@ -374,7 +374,9 @@ func (o *objectValidator) validatePropertiesSchema(val map[string]any, res *Resu continue } - res.AddErrors(errors.Required(fmt.Sprintf("%s.%s", o.Path, k), o.In, v)) + // located on the object that lacks the property: the property itself + // has no node to point at, and the object is what has to be amended + res.addErrorsAt(o.Path, errors.Required(o.Path.child(k).dotted(), o.In, v)) } } @@ -388,12 +390,12 @@ func (o *objectValidator) validatePatternProperty(key string, value any, result succeededOnce := false patterns := make([]string, 0, len(o.PatternProperties)) - schema := pools.poolOfSchemas.BorrowSchema() + schema := validatorPools.schemas.Borrow() defer func() { - pools.poolOfSchemas.RedeemSchema(schema) + validatorPools.schemas.Redeem(schema) }() - for k := range o.PatternProperties { + for _, k := range sortedKeys(o.PatternProperties) { re, err := compileRegexp(k) if err != nil { continue @@ -407,7 +409,7 @@ func (o *objectValidator) validatePatternProperty(key string, value any, result *schema = o.PatternProperties[k] patterns = append(patterns, k) matched = true - validator := newSchemaValidator(schema, o.Root, fmt.Sprintf("%s.%s", o.Path, key), o.KnownFormats, o.Options) + validator := newSchemaValidator(schema, o.Root, o.Path.child(key), o.KnownFormats, o.Options) res := validator.Validate(value) result.Merge(res) @@ -416,6 +418,10 @@ func (o *objectValidator) validatePatternProperty(key string, value any, result return matched, succeededOnce, patterns } +func (o *objectValidator) setPath(path pathSegments) { + o.Path = path +} + func (o *objectValidator) redeem() { - pools.poolOfObjectValidators.RedeemValidator(o) + validatorPools.objectValidators.Redeem(o) } diff --git a/vendor/github.com/go-openapi/validate/param_locations.go b/vendor/github.com/go-openapi/validate/param_locations.go new file mode 100644 index 000000000..703d6ca17 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/param_locations.go @@ -0,0 +1,122 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "strconv" + + "github.com/go-openapi/spec" +) + +// paramLocations tells where an operation declares a parameter. +// +// Parameters are held in an array, so a name is not how a document addresses +// one: only its index is. The index is not something a validator can work out +// from an expanded parameter either, because expansion merges the parameters +// an operation declares with those its path item declares, and resolves the +// ones written as a $ref. So the unexpanded document is indexed once, and +// looked up by what a validator does know: the operation, and the name and +// location of the parameter it is reporting on. +type paramLocations map[paramKey]pathSegments + +// paramKey identifies a parameter the way the swagger specification does: +// a name is unique only within an "in". +type paramKey struct { + path string + method string + in string + name string +} + +// newParamLocations indexes the parameters declared by an unexpanded document. +func newParamLocations(sp *spec.Swagger) paramLocations { + locations := make(paramLocations) + if sp == nil || sp.Paths == nil { + return locations + } + + for path, pathItem := range sp.Paths.Paths { + at := newPathSegments(swaggerPaths, path) + + // parameters declared by the path item are shared by all its + // operations: recorded once, without a method + locations.collect(sp, paramKey{path: path}, at, pathItem.Parameters) + + for method, op := range operationsOf(&pathItem) { //#nosec + if op == nil { + continue + } + + locations.collect(sp, paramKey{path: path, method: method}, at.child(method), op.Parameters) + } + } + + return locations +} + +// at returns where an operation declares a parameter. +// +// A parameter the operation does not declare itself may come from its path +// item. When neither knows it, which happens for a parameter too broken to be +// identified, the pointer stops on the array holding it and the name is kept +// for the message alone: an index no one could work out would be a guess. +func (l paramLocations) at(path, method, in, name string) pathSegments { + if found, isDeclared := l[paramKey{path: path, method: methodToken(method), in: in, name: name}]; isDeclared { + return found + } + + if found, isDeclared := l[paramKey{path: path, in: in, name: name}]; isDeclared { + return found + } + + return operationPath(path, method).child(swaggerParameters).cosmeticChild(name) +} + +func (l paramLocations) collect(sp *spec.Swagger, key paramKey, at pathSegments, params []spec.Parameter) { + for i := range params { + name, in, ok := parameterIdentity(sp, ¶ms[i]) + if !ok { + continue + } + + key.name = name + key.in = in + l[key] = at.child(swaggerParameters).childAs(strconv.Itoa(i), name) + } +} + +// parameterIdentity names a parameter as declared, resolving the one indirection +// a document may put in the way: an entry written as a local $ref. +func parameterIdentity(sp *spec.Swagger, param *spec.Parameter) (name, in string, ok bool) { + if param.Ref.String() == "" { + return param.Name, param.In, param.Name != "" + } + + shared := localRefPath(param.Ref.String()) + const sharedParameterDepth = 2 + if len(shared) != sharedParameterDepth || shared.beforeLast() != swaggerParameters { + return "", "", false + } + + declared, isDeclared := sp.Parameters[shared.last()] + if !isDeclared { + return "", "", false + } + + return declared.Name, declared.In, declared.Name != "" +} + +// operationsOf yields the operations of a path item, keyed as the document +// spells them. +func operationsOf(pathItem *spec.PathItem) map[string]*spec.Operation { + return map[string]*spec.Operation{ + "get": pathItem.Get, + "put": pathItem.Put, + "post": pathItem.Post, + "delete": pathItem.Delete, + "options": pathItem.Options, + "head": pathItem.Head, + "patch": pathItem.Patch, + } +} diff --git a/vendor/github.com/go-openapi/validate/path.go b/vendor/github.com/go-openapi/validate/path.go new file mode 100644 index 000000000..940fc4be5 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/path.go @@ -0,0 +1,269 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "slices" + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" +) + +// pathSegments is the location of a validated value inside a document, +// held as an ordered list of unescaped JSON pointer reference tokens. +// +// Validators build a location by appending tokens as they descend into +// properties and array items, then render it only when they report an error. +// Keeping the tokens apart until then is what makes it possible to produce a +// valid [RFC 6901] JSON pointer: a token is escaped when it is rendered, and +// the separator can never be confused with a token that contains one. +// +// The zero value is the location of the document root. +// +// [RFC 6901]: https://datatracker.ietf.org/doc/html/rfc6901 +type pathSegments []pathToken + +// pathToken is one step of a location. +// +// A token addresses a member the way the document does, which is not always +// the way a reader recognizes it: an operation addresses its parameters by +// index, while a message is far more useful naming them. When the two differ, +// display carries the readable form and only the message uses it. +type pathToken struct { + token string + display string + + // structural marks a token a document needs to address the value, but + // that messages have never shown: a "properties" between a schema and one + // of its members, say. It is part of the pointer and absent from the + // dotted form. + structural bool + + // cosmetic is the converse: a token messages name but that the document + // does not address, such as a parameter too broken to be found by name in + // the array holding it. It is part of the dotted form and absent from the + // pointer, which then stops at the deepest node the document does contain. + cosmetic bool +} + +// readable renders a token the way a message should spell it. +func (t pathToken) readable() string { + if t.display != "" { + return t.display + } + + return t.token +} + +// newPathSegments builds a location from a list of unescaped tokens. +func newPathSegments(tokens ...string) pathSegments { + if len(tokens) == 0 { + return nil + } + + segments := make(pathSegments, len(tokens)) + for i, token := range tokens { + segments[i] = pathToken{token: token} + } + + return segments +} + +// rootPath is the location of the document root. +func rootPath() pathSegments { return nil } + +// String implements [fmt.Stringer] with the legacy dotted notation, so that a +// location interpolated into a message reads as it always has. +func (p pathSegments) String() string { return p.dotted() } + +// child returns the location of a named member of the value at p. +// +// The receiver is never modified: sibling children may be derived from the +// same parent without aliasing one another. +func (p pathSegments) child(token string) pathSegments { + return p.appendToken(pathToken{token: token}) +} + +// childAs returns the location of a member the document addresses as token, +// which messages should spell as display instead. +func (p pathSegments) childAs(token, display string) pathSegments { + return p.appendToken(pathToken{token: token, display: display}) +} + +// structuralChild returns the location of a member a document addresses but +// messages do not name. +func (p pathSegments) structuralChild(token string) pathSegments { + return p.appendToken(pathToken{token: token, structural: true}) +} + +// cosmeticChild returns a location that messages spell as a member named token, +// while the pointer stays on p. +func (p pathSegments) cosmeticChild(token string) pathSegments { + return p.appendToken(pathToken{token: token, cosmetic: true}) +} + +func (p pathSegments) appendToken(token pathToken) pathSegments { + child := make(pathSegments, len(p)+1) + copy(child, p) + child[len(p)] = p.inherit(token) + + return child +} + +// inherit passes down what a parent token says about addressability: nothing +// below a token the document does not address is addressable either, so the +// pointer has to stop at the same place. +func (p pathSegments) inherit(token pathToken) pathToken { + if len(p) > 0 && p[len(p)-1].cosmetic { + token.cosmetic = true + } + + return token +} + +// children returns the location of a chain of named members below p. +func (p pathSegments) children(tokens ...string) pathSegments { + child := make(pathSegments, len(p)+len(tokens)) + copy(child, p) + for i, token := range tokens { + child[len(p)+i] = child[:len(p)+i].inherit(pathToken{token: token}) + } + + return child +} + +// item returns the location of the index'th element of the array at p. +func (p pathSegments) item(index int) pathSegments { + return p.child(strconv.Itoa(index)) +} + +// isEmpty tells if p locates the document root. +func (p pathSegments) isEmpty() bool { return len(p) == 0 } + +// last returns the trailing meaningful token, or an empty string at the +// document root. +// +// Structural tokens are skipped: they say how a document addresses the value, +// not what the value is, and the callers here are asking the latter. +func (p pathSegments) last() string { + if token, ok := p.meaningfulAt(0); ok { + return token + } + + return "" +} + +// beforeLast returns the meaningful token before the trailing one, or an empty +// string when p holds fewer than two of them. +func (p pathSegments) beforeLast() string { + if token, ok := p.meaningfulAt(1); ok { + return token + } + + return "" +} + +// meaningfulAt returns the nth token from the end, counting only the tokens a +// message would show. +func (p pathSegments) meaningfulAt(n int) (string, bool) { + seen := 0 + for _, token := range slices.Backward(p) { + if token.structural { + continue + } + + if seen == n { + return token.token, true + } + + seen++ + } + + return "", false +} + +// trimIndexes returns p without its trailing array index tokens. +// +// It answers "what is this value inside of", disregarding how deep into an +// array it sits: the items of an example are still an example. +func (p pathSegments) trimIndexes() pathSegments { + end := len(p) + for end > 0 && isIndexToken(p[end-1].token) { + end-- + } + + return p[:end] +} + +// isIndexToken tells if a token addresses an array element rather than a member. +func isIndexToken(token string) bool { + if token == "" { + return false + } + + for _, r := range token { + if r < '0' || r > '9' { + return false + } + } + + return true +} + +// hasSuffix tells if p ends with the given sequence of tokens. +func (p pathSegments) hasSuffix(suffix pathSegments) bool { + if len(suffix) > len(p) { + return false + } + + offset := len(p) - len(suffix) + for i, token := range suffix { + if p[offset+i].token != token.token { + return false + } + } + + return true +} + +// dotted renders the location in the legacy dot-separated notation, e.g. +// "definitions.Pet.friends.0.name". +// +// Tokens are emitted verbatim: a token containing a dot is indistinguishable +// from a separator. This notation is kept because it is what surfaces as the +// name of a validation error, and API consumers of go-swagger servers see it. +// Use [pathSegments.pointer] whenever the location needs to be unambiguous. +func (p pathSegments) dotted() string { + readable := make([]string, 0, len(p)) + for _, token := range p { + if token.structural { + continue + } + + readable = append(readable, token.readable()) + } + + return strings.Join(readable, ".") +} + +// pointer renders the location as an RFC 6901 JSON pointer, e.g. +// "/definitions/Pet/friends/0/name". The document root renders as "". +func (p pathSegments) pointer() string { + if len(p) == 0 { + return "" + } + + var w strings.Builder + for _, token := range p { + if token.cosmetic { + continue + } + + w.WriteByte('/') + w.WriteString(jsonpointer.Escape(token.token)) + } + + return w.String() +} diff --git a/vendor/github.com/go-openapi/validate/pools.go b/vendor/github.com/go-openapi/validate/pools.go index c8936bd10..0bc95d1aa 100644 --- a/vendor/github.com/go-openapi/validate/pools.go +++ b/vendor/github.com/go-openapi/validate/pools.go @@ -1,369 +1,87 @@ // SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers // SPDX-License-Identifier: Apache-2.0 -//go:build !validatedebug - package validate import ( - "sync" - "github.com/go-openapi/spec" + "github.com/go-openapi/swag/pools" ) -var pools allPools +// validatorPools recycles the objects allocated while validating. +// +// Validation allocates a validator per schema node and a result per check, so +// the same handful of types are built and thrown away constantly. Recycling +// them is what keeps validating a large specification affordable. +// +// Build with the "poolsdebug" tag to have every borrow and redeem tracked: +// misuse then panics where it happens rather than corrupting a pool, and +// [pools.AssertNoLeaks] reports what was borrowed and never given back. +var validatorPools allPools func init() { resetPools() } +// resetPools builds a fresh set of pools. +// +// Recycling an object twice leaves a pool holding it twice, and it would then +// be handed to two borrowers at once. A test that provokes such misuse has to +// start the next one from clean pools. func resetPools() { - // NOTE: for testing purpose, we might want to reset pools after calling Validate twice. - // The pool is corrupted in that case: calling Put twice inserts a duplicate in the pool - // and further calls to Get are mishandled. - - pools = allPools{ - poolOfSchemaValidators: schemaValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &SchemaValidator{} - - return s - }, - }, - }, - poolOfObjectValidators: objectValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &objectValidator{} - - return s - }, - }, - }, - poolOfSliceValidators: sliceValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &schemaSliceValidator{} - - return s - }, - }, - }, - poolOfItemsValidators: itemsValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &itemsValidator{} - - return s - }, - }, - }, - poolOfBasicCommonValidators: basicCommonValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &basicCommonValidator{} - - return s - }, - }, - }, - poolOfHeaderValidators: headerValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &HeaderValidator{} - - return s - }, - }, - }, - poolOfParamValidators: paramValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &ParamValidator{} - - return s - }, - }, - }, - poolOfBasicSliceValidators: basicSliceValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &basicSliceValidator{} - - return s - }, - }, - }, - poolOfNumberValidators: numberValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &numberValidator{} - - return s - }, - }, - }, - poolOfStringValidators: stringValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &stringValidator{} - - return s - }, - }, - }, - poolOfSchemaPropsValidators: schemaPropsValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &schemaPropsValidator{} - - return s - }, - }, - }, - poolOfFormatValidators: formatValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &formatValidator{} - - return s - }, - }, - }, - poolOfTypeValidators: typeValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &typeValidator{} - - return s - }, - }, - }, - poolOfSchemas: schemasPool{ - Pool: &sync.Pool{ - New: func() any { - s := &spec.Schema{} - - return s - }, - }, - }, - poolOfResults: resultsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &Result{} - - return s - }, - }, - }, - } -} - -type ( - allPools struct { - // memory pools for all validator objects. - // - // Each pool can be borrowed from and redeemed to. - poolOfSchemaValidators schemaValidatorsPool - poolOfObjectValidators objectValidatorsPool - poolOfSliceValidators sliceValidatorsPool - poolOfItemsValidators itemsValidatorsPool - poolOfBasicCommonValidators basicCommonValidatorsPool - poolOfHeaderValidators headerValidatorsPool - poolOfParamValidators paramValidatorsPool - poolOfBasicSliceValidators basicSliceValidatorsPool - poolOfNumberValidators numberValidatorsPool - poolOfStringValidators stringValidatorsPool - poolOfSchemaPropsValidators schemaPropsValidatorsPool - poolOfFormatValidators formatValidatorsPool - poolOfTypeValidators typeValidatorsPool - poolOfSchemas schemasPool - poolOfResults resultsPool - } - - schemaValidatorsPool struct { - *sync.Pool - } - - objectValidatorsPool struct { - *sync.Pool - } - - sliceValidatorsPool struct { - *sync.Pool - } - - itemsValidatorsPool struct { - *sync.Pool - } - - basicCommonValidatorsPool struct { - *sync.Pool - } - - headerValidatorsPool struct { - *sync.Pool - } - - paramValidatorsPool struct { - *sync.Pool - } - - basicSliceValidatorsPool struct { - *sync.Pool - } - - numberValidatorsPool struct { - *sync.Pool - } - - stringValidatorsPool struct { - *sync.Pool - } - - schemaPropsValidatorsPool struct { - *sync.Pool - } - - formatValidatorsPool struct { - *sync.Pool - } - - typeValidatorsPool struct { - *sync.Pool - } - - schemasPool struct { - *sync.Pool - } - - resultsPool struct { - *sync.Pool - } -) - -func (p schemaValidatorsPool) BorrowValidator() *SchemaValidator { - return p.Get().(*SchemaValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p schemaValidatorsPool) RedeemValidator(s *SchemaValidator) { - // NOTE: s might be nil. In that case, Put is a noop. - p.Put(s) -} - -func (p objectValidatorsPool) BorrowValidator() *objectValidator { - return p.Get().(*objectValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p objectValidatorsPool) RedeemValidator(s *objectValidator) { - p.Put(s) -} - -func (p sliceValidatorsPool) BorrowValidator() *schemaSliceValidator { - return p.Get().(*schemaSliceValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p sliceValidatorsPool) RedeemValidator(s *schemaSliceValidator) { - p.Put(s) -} - -func (p itemsValidatorsPool) BorrowValidator() *itemsValidator { - return p.Get().(*itemsValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p itemsValidatorsPool) RedeemValidator(s *itemsValidator) { - p.Put(s) -} - -func (p basicCommonValidatorsPool) BorrowValidator() *basicCommonValidator { - return p.Get().(*basicCommonValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p basicCommonValidatorsPool) RedeemValidator(s *basicCommonValidator) { - p.Put(s) -} - -func (p headerValidatorsPool) BorrowValidator() *HeaderValidator { - return p.Get().(*HeaderValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p headerValidatorsPool) RedeemValidator(s *HeaderValidator) { - p.Put(s) -} - -func (p paramValidatorsPool) BorrowValidator() *ParamValidator { - return p.Get().(*ParamValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p paramValidatorsPool) RedeemValidator(s *ParamValidator) { - p.Put(s) -} - -func (p basicSliceValidatorsPool) BorrowValidator() *basicSliceValidator { - return p.Get().(*basicSliceValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p basicSliceValidatorsPool) RedeemValidator(s *basicSliceValidator) { - p.Put(s) -} - -func (p numberValidatorsPool) BorrowValidator() *numberValidator { - return p.Get().(*numberValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p numberValidatorsPool) RedeemValidator(s *numberValidator) { - p.Put(s) -} - -func (p stringValidatorsPool) BorrowValidator() *stringValidator { - return p.Get().(*stringValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p stringValidatorsPool) RedeemValidator(s *stringValidator) { - p.Put(s) -} - -func (p schemaPropsValidatorsPool) BorrowValidator() *schemaPropsValidator { - return p.Get().(*schemaPropsValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p schemaPropsValidatorsPool) RedeemValidator(s *schemaPropsValidator) { - p.Put(s) -} - -func (p formatValidatorsPool) BorrowValidator() *formatValidator { - return p.Get().(*formatValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p formatValidatorsPool) RedeemValidator(s *formatValidator) { - p.Put(s) -} - -func (p typeValidatorsPool) BorrowValidator() *typeValidator { - return p.Get().(*typeValidator) //nolint:forcetypeassert // pool New always returns this type -} - -func (p typeValidatorsPool) RedeemValidator(s *typeValidator) { - p.Put(s) -} - -func (p schemasPool) BorrowSchema() *spec.Schema { - return p.Get().(*spec.Schema) //nolint:forcetypeassert // pool New always returns this type -} - -func (p schemasPool) RedeemSchema(s *spec.Schema) { - p.Put(s) -} - -func (p resultsPool) BorrowResult() *Result { - return p.Get().(*Result).cleared() //nolint:forcetypeassert // pool New always returns *Result -} - -func (p resultsPool) RedeemResult(s *Result) { - if s == emptyResult { + validatorPools = allPools{ + schemaValidators: pools.New[SchemaValidator](), + objectValidators: pools.New[objectValidator](), + sliceValidators: pools.New[schemaSliceValidator](), + itemsValidators: pools.New[itemsValidator](), + basicCommonValidators: pools.New[basicCommonValidator](), + headerValidators: pools.New[HeaderValidator](), + paramValidators: pools.New[ParamValidator](), + basicSliceValidators: pools.New[basicSliceValidator](), + numberValidators: pools.New[numberValidator](), + stringValidators: pools.New[stringValidator](), + schemaPropsValidators: pools.New[schemaPropsValidator](), + formatValidators: pools.New[formatValidator](), + typeValidators: pools.New[typeValidator](), + schemas: pools.New[spec.Schema](), + results: pools.New[Result](), + } +} + +// allPools is the set of pools shared by the validators of this package. +type allPools struct { + schemaValidators *pools.Pool[SchemaValidator] + objectValidators *pools.Pool[objectValidator] + sliceValidators *pools.Pool[schemaSliceValidator] + itemsValidators *pools.Pool[itemsValidator] + basicCommonValidators *pools.Pool[basicCommonValidator] + headerValidators *pools.Pool[HeaderValidator] + paramValidators *pools.Pool[ParamValidator] + basicSliceValidators *pools.Pool[basicSliceValidator] + numberValidators *pools.Pool[numberValidator] + stringValidators *pools.Pool[stringValidator] + schemaPropsValidators *pools.Pool[schemaPropsValidator] + formatValidators *pools.Pool[formatValidator] + typeValidators *pools.Pool[typeValidator] + schemas *pools.Pool[spec.Schema] + results *pools.Pool[Result] +} + +// redeemResult returns a result to the pool. +// +// emptyResult is a shared value that was never borrowed, so it is not the +// pool's to take back: handing it over would be reported as a foreign redeem, +// rightly. +// +// Results are borrowed straight from the pool rather than through a helper, +// so that the instrumented build attributes a leak to the code that borrowed it. +// +// This wrapper costs that attribution on redeem, where a double redeem still +// names the offending call site in the panic it raises. +func redeemResult(r *Result) { + if r == emptyResult { return } - p.Put(s) + + validatorPools.results.Redeem(r) } diff --git a/vendor/github.com/go-openapi/validate/pools_debug.go b/vendor/github.com/go-openapi/validate/pools_debug.go deleted file mode 100644 index d123ed409..000000000 --- a/vendor/github.com/go-openapi/validate/pools_debug.go +++ /dev/null @@ -1,1015 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -//go:build validatedebug - -package validate - -import ( - "fmt" - "runtime" - "sync" - "testing" - - "github.com/go-openapi/spec" -) - -// This version of the pools is to be used for debugging and testing, with build tag "validatedebug". -// -// In this mode, the pools are tracked for allocation and redemption of borrowed objects, so we can -// verify a few behaviors of the validators. The debug pools panic when an invalid usage pattern is detected. - -var pools allPools - -func init() { - resetPools() -} - -func resetPools() { - // NOTE: for testing purpose, we might want to reset pools after calling Validate twice. - // The pool is corrupted in that case: calling Put twice inserts a duplicate in the pool - // and further calls to Get are mishandled. - - pools = allPools{ - poolOfSchemaValidators: schemaValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &SchemaValidator{} - - return s - }, - }, - debugMap: make(map[*SchemaValidator]status), - allocMap: make(map[*SchemaValidator]string), - redeemMap: make(map[*SchemaValidator]string), - }, - poolOfObjectValidators: objectValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &objectValidator{} - - return s - }, - }, - debugMap: make(map[*objectValidator]status), - allocMap: make(map[*objectValidator]string), - redeemMap: make(map[*objectValidator]string), - }, - poolOfSliceValidators: sliceValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &schemaSliceValidator{} - - return s - }, - }, - debugMap: make(map[*schemaSliceValidator]status), - allocMap: make(map[*schemaSliceValidator]string), - redeemMap: make(map[*schemaSliceValidator]string), - }, - poolOfItemsValidators: itemsValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &itemsValidator{} - - return s - }, - }, - debugMap: make(map[*itemsValidator]status), - allocMap: make(map[*itemsValidator]string), - redeemMap: make(map[*itemsValidator]string), - }, - poolOfBasicCommonValidators: basicCommonValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &basicCommonValidator{} - - return s - }, - }, - debugMap: make(map[*basicCommonValidator]status), - allocMap: make(map[*basicCommonValidator]string), - redeemMap: make(map[*basicCommonValidator]string), - }, - poolOfHeaderValidators: headerValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &HeaderValidator{} - - return s - }, - }, - debugMap: make(map[*HeaderValidator]status), - allocMap: make(map[*HeaderValidator]string), - redeemMap: make(map[*HeaderValidator]string), - }, - poolOfParamValidators: paramValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &ParamValidator{} - - return s - }, - }, - debugMap: make(map[*ParamValidator]status), - allocMap: make(map[*ParamValidator]string), - redeemMap: make(map[*ParamValidator]string), - }, - poolOfBasicSliceValidators: basicSliceValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &basicSliceValidator{} - - return s - }, - }, - debugMap: make(map[*basicSliceValidator]status), - allocMap: make(map[*basicSliceValidator]string), - redeemMap: make(map[*basicSliceValidator]string), - }, - poolOfNumberValidators: numberValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &numberValidator{} - - return s - }, - }, - debugMap: make(map[*numberValidator]status), - allocMap: make(map[*numberValidator]string), - redeemMap: make(map[*numberValidator]string), - }, - poolOfStringValidators: stringValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &stringValidator{} - - return s - }, - }, - debugMap: make(map[*stringValidator]status), - allocMap: make(map[*stringValidator]string), - redeemMap: make(map[*stringValidator]string), - }, - poolOfSchemaPropsValidators: schemaPropsValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &schemaPropsValidator{} - - return s - }, - }, - debugMap: make(map[*schemaPropsValidator]status), - allocMap: make(map[*schemaPropsValidator]string), - redeemMap: make(map[*schemaPropsValidator]string), - }, - poolOfFormatValidators: formatValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &formatValidator{} - - return s - }, - }, - debugMap: make(map[*formatValidator]status), - allocMap: make(map[*formatValidator]string), - redeemMap: make(map[*formatValidator]string), - }, - poolOfTypeValidators: typeValidatorsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &typeValidator{} - - return s - }, - }, - debugMap: make(map[*typeValidator]status), - allocMap: make(map[*typeValidator]string), - redeemMap: make(map[*typeValidator]string), - }, - poolOfSchemas: schemasPool{ - Pool: &sync.Pool{ - New: func() any { - s := &spec.Schema{} - - return s - }, - }, - debugMap: make(map[*spec.Schema]status), - allocMap: make(map[*spec.Schema]string), - redeemMap: make(map[*spec.Schema]string), - }, - poolOfResults: resultsPool{ - Pool: &sync.Pool{ - New: func() any { - s := &Result{} - - return s - }, - }, - debugMap: make(map[*Result]status), - allocMap: make(map[*Result]string), - redeemMap: make(map[*Result]string), - }, - } -} - -const ( - statusFresh status = iota + 1 - statusRecycled - statusRedeemed -) - -func (s status) String() string { - switch s { - case statusFresh: - return "fresh" - case statusRecycled: - return "recycled" - case statusRedeemed: - return "redeemed" - default: - panic(fmt.Errorf("invalid status: %d", s)) - } -} - -type ( - // Debug - status uint8 - - allPools struct { - // memory pools for all validator objects. - // - // Each pool can be borrowed from and redeemed to. - poolOfSchemaValidators schemaValidatorsPool - poolOfObjectValidators objectValidatorsPool - poolOfSliceValidators sliceValidatorsPool - poolOfItemsValidators itemsValidatorsPool - poolOfBasicCommonValidators basicCommonValidatorsPool - poolOfHeaderValidators headerValidatorsPool - poolOfParamValidators paramValidatorsPool - poolOfBasicSliceValidators basicSliceValidatorsPool - poolOfNumberValidators numberValidatorsPool - poolOfStringValidators stringValidatorsPool - poolOfSchemaPropsValidators schemaPropsValidatorsPool - poolOfFormatValidators formatValidatorsPool - poolOfTypeValidators typeValidatorsPool - poolOfSchemas schemasPool - poolOfResults resultsPool - } - - schemaValidatorsPool struct { - *sync.Pool - debugMap map[*SchemaValidator]status - allocMap map[*SchemaValidator]string - redeemMap map[*SchemaValidator]string - mx sync.Mutex - } - - objectValidatorsPool struct { - *sync.Pool - debugMap map[*objectValidator]status - allocMap map[*objectValidator]string - redeemMap map[*objectValidator]string - mx sync.Mutex - } - - sliceValidatorsPool struct { - *sync.Pool - debugMap map[*schemaSliceValidator]status - allocMap map[*schemaSliceValidator]string - redeemMap map[*schemaSliceValidator]string - mx sync.Mutex - } - - itemsValidatorsPool struct { - *sync.Pool - debugMap map[*itemsValidator]status - allocMap map[*itemsValidator]string - redeemMap map[*itemsValidator]string - mx sync.Mutex - } - - basicCommonValidatorsPool struct { - *sync.Pool - debugMap map[*basicCommonValidator]status - allocMap map[*basicCommonValidator]string - redeemMap map[*basicCommonValidator]string - mx sync.Mutex - } - - headerValidatorsPool struct { - *sync.Pool - debugMap map[*HeaderValidator]status - allocMap map[*HeaderValidator]string - redeemMap map[*HeaderValidator]string - mx sync.Mutex - } - - paramValidatorsPool struct { - *sync.Pool - debugMap map[*ParamValidator]status - allocMap map[*ParamValidator]string - redeemMap map[*ParamValidator]string - mx sync.Mutex - } - - basicSliceValidatorsPool struct { - *sync.Pool - debugMap map[*basicSliceValidator]status - allocMap map[*basicSliceValidator]string - redeemMap map[*basicSliceValidator]string - mx sync.Mutex - } - - numberValidatorsPool struct { - *sync.Pool - debugMap map[*numberValidator]status - allocMap map[*numberValidator]string - redeemMap map[*numberValidator]string - mx sync.Mutex - } - - stringValidatorsPool struct { - *sync.Pool - debugMap map[*stringValidator]status - allocMap map[*stringValidator]string - redeemMap map[*stringValidator]string - mx sync.Mutex - } - - schemaPropsValidatorsPool struct { - *sync.Pool - debugMap map[*schemaPropsValidator]status - allocMap map[*schemaPropsValidator]string - redeemMap map[*schemaPropsValidator]string - mx sync.Mutex - } - - formatValidatorsPool struct { - *sync.Pool - debugMap map[*formatValidator]status - allocMap map[*formatValidator]string - redeemMap map[*formatValidator]string - mx sync.Mutex - } - - typeValidatorsPool struct { - *sync.Pool - debugMap map[*typeValidator]status - allocMap map[*typeValidator]string - redeemMap map[*typeValidator]string - mx sync.Mutex - } - - schemasPool struct { - *sync.Pool - debugMap map[*spec.Schema]status - allocMap map[*spec.Schema]string - redeemMap map[*spec.Schema]string - mx sync.Mutex - } - - resultsPool struct { - *sync.Pool - debugMap map[*Result]status - allocMap map[*Result]string - redeemMap map[*Result]string - mx sync.Mutex - } -) - -func (p *schemaValidatorsPool) BorrowValidator() *SchemaValidator { - s := p.Get().(*SchemaValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled schema should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *schemaValidatorsPool) RedeemValidator(s *SchemaValidator) { - // NOTE: s might be nil. In that case, Put is a noop. - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed schema should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed schema should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *objectValidatorsPool) BorrowValidator() *objectValidator { - s := p.Get().(*objectValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled object should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *objectValidatorsPool) RedeemValidator(s *objectValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed object should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed object should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *sliceValidatorsPool) BorrowValidator() *schemaSliceValidator { - s := p.Get().(*schemaSliceValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled schemaSliceValidator should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *sliceValidatorsPool) RedeemValidator(s *schemaSliceValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed schemaSliceValidator should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed schemaSliceValidator should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *itemsValidatorsPool) BorrowValidator() *itemsValidator { - s := p.Get().(*itemsValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled itemsValidator should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *itemsValidatorsPool) RedeemValidator(s *itemsValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed itemsValidator should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed itemsValidator should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *basicCommonValidatorsPool) BorrowValidator() *basicCommonValidator { - s := p.Get().(*basicCommonValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled basicCommonValidator should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *basicCommonValidatorsPool) RedeemValidator(s *basicCommonValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed basicCommonValidator should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed basicCommonValidator should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *headerValidatorsPool) BorrowValidator() *HeaderValidator { - s := p.Get().(*HeaderValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled HeaderValidator should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *headerValidatorsPool) RedeemValidator(s *HeaderValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed header should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed header should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *paramValidatorsPool) BorrowValidator() *ParamValidator { - s := p.Get().(*ParamValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled param should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *paramValidatorsPool) RedeemValidator(s *ParamValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed param should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed param should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *basicSliceValidatorsPool) BorrowValidator() *basicSliceValidator { - s := p.Get().(*basicSliceValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled basicSliceValidator should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *basicSliceValidatorsPool) RedeemValidator(s *basicSliceValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed basicSliceValidator should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed basicSliceValidator should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *numberValidatorsPool) BorrowValidator() *numberValidator { - s := p.Get().(*numberValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled number should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *numberValidatorsPool) RedeemValidator(s *numberValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed number should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed number should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *stringValidatorsPool) BorrowValidator() *stringValidator { - s := p.Get().(*stringValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled string should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *stringValidatorsPool) RedeemValidator(s *stringValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed string should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed string should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *schemaPropsValidatorsPool) BorrowValidator() *schemaPropsValidator { - s := p.Get().(*schemaPropsValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled param should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *schemaPropsValidatorsPool) RedeemValidator(s *schemaPropsValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed schemaProps should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed schemaProps should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *formatValidatorsPool) BorrowValidator() *formatValidator { - s := p.Get().(*formatValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled format should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *formatValidatorsPool) RedeemValidator(s *formatValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed format should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed format should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *typeValidatorsPool) BorrowValidator() *typeValidator { - s := p.Get().(*typeValidator) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled type should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *typeValidatorsPool) RedeemValidator(s *typeValidator) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed type should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic(fmt.Errorf("redeemed type should have been allocated from a fresh or recycled pointer. Got status %s, already redeamed at: %s", x, p.redeemMap[s])) - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *schemasPool) BorrowSchema() *spec.Schema { - s := p.Get().(*spec.Schema) - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled spec.Schema should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *schemasPool) RedeemSchema(s *spec.Schema) { - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed spec.Schema should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed spec.Schema should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *resultsPool) BorrowResult() *Result { - s := p.Get().(*Result).cleared() - - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - p.debugMap[s] = statusFresh - } else { - if x != statusRedeemed { - panic("recycled result should have been redeemed") - } - p.debugMap[s] = statusRecycled - } - p.allocMap[s] = caller() - - return s -} - -func (p *resultsPool) RedeemResult(s *Result) { - if s == emptyResult { - if len(s.Errors) > 0 || len(s.Warnings) > 0 { - panic("empty result should not mutate") - } - return - } - p.mx.Lock() - defer p.mx.Unlock() - x, ok := p.debugMap[s] - if !ok { - panic("redeemed Result should have been allocated") - } - if x != statusRecycled && x != statusFresh { - panic("redeemed Result should have been allocated from a fresh or recycled pointer") - } - p.debugMap[s] = statusRedeemed - p.redeemMap[s] = caller() - p.Put(s) -} - -func (p *allPools) allIsRedeemed(t testing.TB) bool { - outcome := true - for k, v := range p.poolOfSchemaValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("schemaValidator should be redeemed. Allocated by: %s", p.poolOfSchemaValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfObjectValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("objectValidator should be redeemed. Allocated by: %s", p.poolOfObjectValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfSliceValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("sliceValidator should be redeemed. Allocated by: %s", p.poolOfSliceValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfItemsValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("itemsValidator should be redeemed. Allocated by: %s", p.poolOfItemsValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfBasicCommonValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("basicCommonValidator should be redeemed. Allocated by: %s", p.poolOfBasicCommonValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfHeaderValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("headerValidator should be redeemed. Allocated by: %s", p.poolOfHeaderValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfParamValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("paramValidator should be redeemed. Allocated by: %s", p.poolOfParamValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfBasicSliceValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("basicSliceValidator should be redeemed. Allocated by: %s", p.poolOfBasicSliceValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfNumberValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("numberValidator should be redeemed. Allocated by: %s", p.poolOfNumberValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfStringValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("stringValidator should be redeemed. Allocated by: %s", p.poolOfStringValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfSchemaPropsValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("schemaPropsValidator should be redeemed. Allocated by: %s", p.poolOfSchemaPropsValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfFormatValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("formatValidator should be redeemed. Allocated by: %s", p.poolOfFormatValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfTypeValidators.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("typeValidator should be redeemed. Allocated by: %s", p.poolOfTypeValidators.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfSchemas.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("schemas should be redeemed. Allocated by: %s", p.poolOfSchemas.allocMap[k]) - outcome = false - } - for k, v := range p.poolOfResults.debugMap { - if v == statusRedeemed { - continue - } - t.Logf("result should be redeemed. Allocated by: %s", p.poolOfResults.allocMap[k]) - outcome = false - } - - return outcome -} - -func caller() string { - pc, _, _, _ := runtime.Caller(3) //nolint:dogsled - from, line := runtime.FuncForPC(pc).FileLine(pc) - - return fmt.Sprintf("%s:%d", from, line) -} diff --git a/vendor/github.com/go-openapi/validate/ref_locations.go b/vendor/github.com/go-openapi/validate/ref_locations.go new file mode 100644 index 000000000..1853340d2 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/ref_locations.go @@ -0,0 +1,49 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "github.com/go-openapi/analysis" +) + +// refLocations tells where a $ref value is declared in a document. +// +// The analyzer indexes references the other way around, by the location each +// was found at, so the index is inverted here. Only declarations are indexed: +// a "$ref" member sitting in an example or in a default value is data, and the +// analyzer never walks into it. +type refLocations map[string]pathSegments + +// newRefLocations inverts the analyzer's reference index. +// +// A reference declared in several places keeps the smallest declaration, so +// that the answer does not depend on map iteration order. +func newRefLocations(analyzer *analysis.Spec) refLocations { + declarations := make(map[string]string) + for location, ref := range analyzer.AllRefsByLocation() { + value := ref.String() + if value == "" { + continue + } + + if known, isKnown := declarations[value]; isKnown && known <= location { + continue + } + + declarations[value] = location + } + + locations := make(refLocations, len(declarations)) + for value, location := range declarations { + locations[value] = localRefPath(location) + } + + return locations +} + +// at returns where a reference is declared, or the document root when the +// reference is not one the analyzer indexed. +func (l refLocations) at(ref string) pathSegments { + return l[ref] +} diff --git a/vendor/github.com/go-openapi/validate/ref_redirects.go b/vendor/github.com/go-openapi/validate/ref_redirects.go new file mode 100644 index 000000000..95fe96c22 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/ref_redirects.go @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "strings" + + "github.com/go-openapi/analysis" +) + +// maxRefHops bounds how many $ref a pointer may be followed through, so that a +// document referring to itself cannot spin here. +const maxRefHops = 10 + +// refRedirects maps the location of a $ref to the location it points at, for +// the local references of a document. +// +// Checks walk the expanded document, so a finding below a $ref comes out with a +// pointer that descends into a node the authored document does not contain: a +// bare "$ref" member has nothing under it. Following the reference turns such a +// pointer back into one the document addresses. +type refRedirects map[string]string + +func newRefRedirects(analyzer *analysis.Spec) refRedirects { + redirects := make(refRedirects) + for location, ref := range analyzer.AllRefsByLocation() { + target := ref.String() + if !strings.HasPrefix(target, "#/") { + // only a local reference has a location in this document + continue + } + + redirects[strings.TrimPrefix(location, "#")] = strings.TrimPrefix(target, "#") + } + + return redirects +} + +// through rewrites a pointer that descends below a $ref. +// +// A pointer that stops at the $ref itself is left alone: that node exists, and +// it is where a reader has to go to amend the reference. +func (r refRedirects) through(pointer string) string { + if len(r) == 0 { + return pointer + } + + for range maxRefHops { + prefix, rest, ok := r.crossing(pointer) + if !ok { + return pointer + } + + pointer = prefix + rest + } + + return pointer +} + +// crossing finds the longest prefix of pointer that holds a $ref, and returns +// the location that reference points at together with what is left below it. +func (r refRedirects) crossing(pointer string) (target, rest string, ok bool) { + for at := strings.LastIndex(pointer, "/"); at > 0; at = strings.LastIndex(pointer[:at], "/") { + if target, isRef := r[pointer[:at]]; isRef { + return target, pointer[at:], true + } + } + + return "", "", false +} diff --git a/vendor/github.com/go-openapi/validate/required_walk.go b/vendor/github.com/go-openapi/validate/required_walk.go new file mode 100644 index 000000000..b3fd3cdf4 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/required_walk.go @@ -0,0 +1,179 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "strings" + + "github.com/go-openapi/errors" + "github.com/go-openapi/spec" +) + +// schemaIdentity is how a message refers to the schema a required entry +// belongs to. +// +// A definition is named on its own, the way it always has been. A schema the +// definition holds is named by the way down to it, relative to the definition: +// "A.inner" rather than "A", which would send a reader to the wrong place. +type schemaIdentity struct { + name string + nested bool +} + +// identify names the schema a location leads to. +func identify(at pathSegments) schemaIdentity { + const definitionDepth = 2 // "definitions", then the name of one + + return schemaIdentity{ + name: strings.TrimPrefix(at.dotted(), swaggerDefinitions+"."), + nested: len(at) > definitionDepth, + } +} + +func (i schemaIdentity) requiredButNotDefined(property string) errors.Error { + if i.nested { + return requiredButNotDefinedInSchemaMsg(property, i.name) + } + + return requiredButNotDefinedMsg(property, i.name) +} + +// maxCompositionHops bounds how far the search for a declared property follows +// allOf members and the local $ref they may be written as. +const maxCompositionHops = 20 + +// walkRequired checks the required entries of a schema, then those of every +// schema it holds inline. +// +// A definition is not the only place a document says an object must hold a +// property: so does the schema of a property, of an array item, of an +// additionalProperties. Each of those is a self-contained object definition, +// and a required entry naming something it never declares is the same slip +// wherever it sits. +// +// A schema written as a $ref is left alone: it is checked where it is defined, +// and following it here would report the same slip twice and, for a recursive +// definition, would not terminate. +// +// It reports whether the walk should carry on, which is how the caller stops on +// the first fault unless it was asked for everything. +func (s *SpecValidator) walkRequired(at pathSegments, v *spec.Schema, res *Result) bool { + if v == nil || v.Ref.String() != "" { + return true + } + + for i, pn := range v.Required { + // the offending entry of the required array, not the schema holding + // it: that is what a reader has to go and amend + red := s.validateRequiredProperties(pn, identify(at), at, at.child(jsonRequired).item(i), v) + // NOTE: capture validity before merging: Merge may redeem `red` to the + // pool (wantsRedeemOnMerge), after which reading it races with a + // concurrent BorrowResult().cleared() in another goroutine. + isValid := red.IsValid() + res.Merge(red) + if !isValid && !s.Options.ContinueOnErrors { + return false + } + } + + return s.walkInlineSchemas(at, v, res) +} + +// walkInlineSchemas descends into every schema a schema holds, without checking +// the required entries of a composition member. +// +// Inside allOf, anyOf, oneOf or not, a member is a fragment of a constraint +// rather than a complete definition: its required entries speak of the instance +// the whole composition describes, and are legitimately met by a sibling member +// or by no declaration at all. Those are honoured when data is validated, and +// saying anything about them here would be wrong. Their own members are still +// walked, because a property schema nested in one of them is a definition like +// any other. +func (s *SpecValidator) walkInlineSchemas(at pathSegments, v *spec.Schema, res *Result) bool { + for _, name := range sortedKeys(v.Properties) { + held := v.Properties[name] + if !s.walkRequired(at.structuralChild(jsonProperties).child(name), &held, res) { + return false + } + } + + for _, pattern := range sortedKeys(v.PatternProperties) { + held := v.PatternProperties[pattern] + if !s.walkRequired(at.structuralChild(jsonPatternProperties).child(pattern), &held, res) { + return false + } + } + + if v.Items != nil { + if v.Items.Schema != nil && !s.walkRequired(at.child(jsonItems), v.Items.Schema, res) { + return false + } + for i := range v.Items.Schemas { + if !s.walkRequired(at.child(jsonItems).item(i), &v.Items.Schemas[i], res) { + return false + } + } + } + + if v.AdditionalProperties != nil && v.AdditionalProperties.Schema != nil && + !s.walkRequired(at.child(jsonAdditionalProperties), v.AdditionalProperties.Schema, res) { + return false + } + + // a composition member is walked for the schemas it holds, never for its + // own required entries + for _, composition := range []struct { + keyword string + members []spec.Schema + }{ + {jsonAllOf, v.AllOf}, + {jsonAnyOf, v.AnyOf}, + {jsonOneOf, v.OneOf}, + } { + for i := range composition.members { + if !s.walkInlineSchemas(at.child(composition.keyword).item(i), &composition.members[i], res) { + return false + } + } + } + + if v.Not != nil { + return s.walkInlineSchemas(at.child(jsonNot), v.Not, res) + } + + return true +} + +// declaresProperty reports whether a schema, or any schema composed into it by +// allOf, declares the named property, and whether that declaration is readOnly. +// +// An allOf member may be written as a $ref, which is followed here: a property +// contributed by a base definition is declared just as plainly as one written +// in place. +func (s *SpecValidator) declaresProperty(v *spec.Schema, name string, hops int) (readOnly, declared bool) { + if v == nil || hops <= 0 { + return false, false + } + + if held, ok := v.Properties[name]; ok { + return held.ReadOnly, true + } + + for i := range v.AllOf { + member := &v.AllOf[i] + if member.Ref.String() != "" { + resolved, err := s.resolveRef(&member.Ref) + if err != nil { + continue + } + member = resolved + } + + if readOnly, ok := s.declaresProperty(member, name, hops-1); ok { + return readOnly, true + } + } + + return false, false +} diff --git a/vendor/github.com/go-openapi/validate/resolvable.go b/vendor/github.com/go-openapi/validate/resolvable.go new file mode 100644 index 000000000..bbd35d360 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/resolvable.go @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" +) + +// resolvable trims a pointer down to the deepest node the document holds. +// +// Checks walk an expanded, model-level view of a specification, which holds +// members the document itself never wrote: a parameter merged in from a path +// item, a member of a schema reached through a $ref. A pointer built along the +// way may therefore end on something a reader cannot go to. +// +// Trimming is the last word on a location, applied once every check has had its +// say: it only ever shortens, so a pointer that already addressed a node comes +// back untouched, and one that did not still says as much as it truthfully can. +// This is what makes [Located.Pointer] always resolve. +func (s *SpecValidator) resolvable(pointer string) string { + if pointer == "" || s.document == nil { + return pointer + } + + node := s.document + for at := 0; at < len(pointer); { + end := strings.IndexByte(pointer[at+1:], '/') + token := pointer[at+1:] + if end >= 0 { + token = pointer[at+1 : at+1+end] + } + + member, isHeld := memberOf(node, jsonpointer.Unescape(token)) + if !isHeld { + return pointer[:at] + } + node = member + + if end < 0 { + break + } + at += end + 1 + } + + return pointer +} + +// memberOf returns the member a reference token addresses in a decoded JSON +// node, and whether the node holds one at all. +func memberOf(node any, token string) (any, bool) { + switch held := node.(type) { + case map[string]any: + member, isHeld := held[token] + + return member, isHeld + case []any: + index, err := strconv.Atoi(token) + if err != nil || index < 0 || index >= len(held) { + return nil, false + } + + return held[index], true + default: + return nil, false + } +} diff --git a/vendor/github.com/go-openapi/validate/result.go b/vendor/github.com/go-openapi/validate/result.go index ede945503..5684774a5 100644 --- a/vendor/github.com/go-openapi/validate/result.go +++ b/vendor/github.com/go-openapi/validate/result.go @@ -14,6 +14,25 @@ import ( var emptyResult = &Result{MatchCount: 1} +// Located pairs a validation error with the location of the value that caused it. +type Located struct { + // Err is the reported error or warning. + Err error + + // Pointer locates the offending value as an RFC 6901 JSON pointer, + // relative to the validated document. + // + // It is empty when the document as a whole is the answer: either because + // the finding is about the document rather than a value in it, such as a + // duplicate operation id, or because the value in question is the root. + // An empty pointer is a valid one, addressing the whole document. + // + // A finding about something a document does not contain, a missing + // required property say, is located on the value that should contain it: + // what is absent has no node to point at. + Pointer string +} + // Result represents a validation result set, composed of // errors and warnings. // @@ -25,12 +44,17 @@ var emptyResult = &Result{MatchCount: 1} // schema validation. Results from the validation branch // with most matches get eventually selected. // -// Proposal for enhancement: keep path of key originating the error. +// Use [Result.LocatedErrors] to know where each error happened. type Result struct { Errors []error Warnings []error MatchCount int + // errorLocations[i] locates Errors[i], and likewise for warnings. Kept + // aligned by the add methods; see [Result.LocatedErrors]. + errorLocations []string + warningLocations []string + // the object data data any @@ -110,7 +134,7 @@ func (r *Result) Merge(others ...*Result) *Result { r.mergeWithoutRootSchemata(other) r.rootObjectSchemata.Append(other.rootObjectSchemata) if other.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(other) + redeemResult(other) } } return r @@ -173,11 +197,11 @@ func (r *Result) MergeAsErrors(others ...*Result) *Result { for _, other := range others { if other != nil { r.resetCaches() - r.AddErrors(other.Errors...) - r.AddErrors(other.Warnings...) + r.carryErrors(other.Errors, other.errorLocations) + r.carryErrors(other.Warnings, other.warningLocations) r.MatchCount += other.MatchCount if other.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(other) + redeemResult(other) } } } @@ -191,11 +215,11 @@ func (r *Result) MergeAsWarnings(others ...*Result) *Result { for _, other := range others { if other != nil { r.resetCaches() - r.AddWarnings(other.Errors...) - r.AddWarnings(other.Warnings...) + r.carryWarnings(other.Errors, other.errorLocations) + r.carryWarnings(other.Warnings, other.warningLocations) r.MatchCount += other.MatchCount if other.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(other) + redeemResult(other) } } } @@ -207,39 +231,79 @@ func (r *Result) MergeAsWarnings(others ...*Result) *Result { // Since the same check may be passed several times while exploring the // spec structure (via $ref, ...) reported messages are kept // unique. +// +// Errors added this way carry no location. Validators use [Result.addErrorsAt] +// so that [Result.LocatedErrors] can tell where the failure happened. func (r *Result) AddErrors(errors ...error) { - for _, e := range errors { - found := false - if e != nil { - for _, isReported := range r.Errors { - if e.Error() == isReported.Error() { - found = true - break - } - } - if !found { - r.Errors = append(r.Errors, e) - } - } - } + r.addLocatedErrors("", errors...) } // AddWarnings adds warnings to this validation result (if not already reported). func (r *Result) AddWarnings(warnings ...error) { - for _, e := range warnings { - found := false - if e != nil { - for _, isReported := range r.Warnings { - if e.Error() == isReported.Error() { - found = true - break - } - } - if !found { - r.Warnings = append(r.Warnings, e) - } + r.addLocatedWarnings("", warnings...) +} + +// isReportedError tells if the same message is already part of a collection. +func isReportedError(reported []error, e error) bool { + msg := e.Error() + for _, isReported := range reported { + if msg == isReported.Error() { + return true } } + + return false +} + +// locationAt reads a location out of a slice that may be shorter than the +// errors it describes. +func locationAt(locations []string, i int) string { + if i < len(locations) { + return locations[i] + } + + return "" +} + +// appendLocation records the location of the error that has just been appended, +// keeping the location slice aligned with the error slice it describes. +// +// Errors may reach a Result without going through the methods here (a caller +// assigning Errors directly, say), so the slice is padded rather than assumed +// to be in step. +func appendLocation(locations []string, upTo int, pointer string) []string { + for len(locations) < upTo-1 { + locations = append(locations, "") + } + + return append(locations, pointer) +} + +// LocatedErrors returns the reported errors, each paired with the JSON pointer +// of the value that caused it. +// +// The pointer is empty whenever the location is unknown, so callers should +// treat it as a hint and keep using the error message as the primary report. +func (r *Result) LocatedErrors() []Located { + return locate(r.Errors, r.errorLocations) +} + +// LocatedWarnings returns the reported warnings, each paired with the JSON +// pointer of the value that caused it. +func (r *Result) LocatedWarnings() []Located { + return locate(r.Warnings, r.warningLocations) +} + +func locate(errs []error, locations []string) []Located { + located := make([]Located, len(errs)) + for i, err := range errs { + located[i] = Located{Err: err} + if i < len(locations) { + located[i].Pointer = locations[i] + } + } + + return located } // IsValid returns true when this result is valid. @@ -298,6 +362,106 @@ func (r *Result) AsError() error { return errors.CompositeValidationError(r.Errors...) } +// Reset clears this result so it may be reused, keeping allocated capacity. +// +// It implements the hook the pool calls when a result is borrowed and when it +// is redeemed. Calling it on a result still in use loses its findings. +func (r *Result) Reset() { + _ = r.cleared() +} + +// addErrorsAt adds errors located at the given path. +func (r *Result) addErrorsAt(at pathSegments, errors ...error) { + r.addLocatedErrors(at.pointer(), errors...) +} + +// addWarningsAt adds warnings located at the given path. +func (r *Result) addWarningsAt(at pathSegments, warnings ...error) { + r.addLocatedWarnings(at.pointer(), warnings...) +} + +func (r *Result) addLocatedErrors(pointer string, errors ...error) { + for _, e := range errors { + if e == nil { + continue + } + + if isReportedError(r.Errors, e) { + continue + } + + r.Errors = append(r.Errors, e) + r.errorLocations = appendLocation(r.errorLocations, len(r.Errors), pointer) + } +} + +func (r *Result) addLocatedWarnings(pointer string, warnings ...error) { + for _, e := range warnings { + if e == nil { + continue + } + + if isReportedError(r.Warnings, e) { + continue + } + + r.Warnings = append(r.Warnings, e) + r.warningLocations = appendLocation(r.warningLocations, len(r.Warnings), pointer) + } +} + +// relocate rewrites every location this result recorded. +// +// The parameter and header validators are the ones a generated client uses at +// runtime, so they locate a finding by the name of the parameter or header it +// concerns: a name is all the caller has. When spec validation borrows them to +// check a default or an example, that name addresses nothing in the document, +// and the value's own node is the best location available for everything the +// borrowed validator found. +func (r *Result) relocate(at pathSegments) { + if r == nil { + return + } + + pointer := at.pointer() + r.errorLocations = fillLocations(r.errorLocations[:0], len(r.Errors), pointer) + r.warningLocations = fillLocations(r.warningLocations[:0], len(r.Warnings), pointer) +} + +// fillLocations records the same location for a whole run of findings. +func fillLocations(locations []string, count int, pointer string) []string { + for range count { + locations = append(locations, pointer) + } + + return locations +} + +// redirect rewrites every location this result recorded with the given mapping. +func (r *Result) redirect(through func(string) string) { + for i, pointer := range r.errorLocations { + r.errorLocations[i] = through(pointer) + } + for i, pointer := range r.warningLocations { + r.warningLocations[i] = through(pointer) + } +} + +// carryErrors adds errors from another result as errors, one by one, so that +// each keeps the location that result recorded for it. +func (r *Result) carryErrors(errs []error, locations []string) { + for i, e := range errs { + r.addLocatedErrors(locationAt(locations, i), e) + } +} + +// carryWarnings adds errors from another result as warnings, keeping locations. +func (r *Result) carryWarnings(errs []error, locations []string) { + for i, e := range errs { + r.addLocatedWarnings(locationAt(locations, i), e) + } +} + func (r *Result) resetCaches() { r.cachedFieldSchemata = nil r.cachedItemSchemata = nil @@ -324,7 +488,7 @@ func (r *Result) mergeForField(obj map[string]any, field string, other *Result) }) } if other.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(other) + redeemResult(other) } return r @@ -352,7 +516,7 @@ func (r *Result) mergeForSlice(slice reflect.Value, i int, other *Result) *Resul } if other.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(other) + redeemResult(other) } return r @@ -391,8 +555,8 @@ func (r *Result) addSliceSchemata(slice reflect.Value, i int, schema *spec.Schem // mergeWithoutRootSchemata merges other into r, ignoring the rootObject schemata. func (r *Result) mergeWithoutRootSchemata(other *Result) { r.resetCaches() - r.AddErrors(other.Errors...) - r.AddWarnings(other.Warnings...) + r.carryErrors(other.Errors, other.errorLocations) + r.carryWarnings(other.Warnings, other.warningLocations) r.MatchCount += other.MatchCount if other.fieldSchemata != nil { @@ -438,32 +602,40 @@ func (r *Result) keepRelevantErrors() *Result { // codes would require to change a lot here. So, for the moment, let's go with // placeholders. strippedErrors := []error{} - for _, e := range r.Errors { + strippedErrorLocations := []string{} + for i, e := range r.Errors { if isImportant(e) { strippedErrors = append(strippedErrors, stripImportantTag(e)) + strippedErrorLocations = append(strippedErrorLocations, locationAt(r.errorLocations, i)) } } strippedWarnings := []error{} - for _, e := range r.Warnings { + strippedWarningLocations := []string{} + for i, e := range r.Warnings { if isImportant(e) { strippedWarnings = append(strippedWarnings, stripImportantTag(e)) + strippedWarningLocations = append(strippedWarningLocations, locationAt(r.warningLocations, i)) } } var strippedResult *Result if r.wantsRedeemOnMerge { - strippedResult = pools.poolOfResults.BorrowResult() + strippedResult = validatorPools.results.Borrow() } else { strippedResult = new(Result) } strippedResult.Errors = strippedErrors + strippedResult.errorLocations = strippedErrorLocations strippedResult.Warnings = strippedWarnings + strippedResult.warningLocations = strippedWarningLocations return strippedResult } func (r *Result) cleared() *Result { // clear the Result to be reusable. Keep allocated capacity. r.Errors = r.Errors[:0] + r.errorLocations = r.errorLocations[:0] r.Warnings = r.Warnings[:0] + r.warningLocations = r.warningLocations[:0] r.MatchCount = 0 r.data = nil r.rootObjectSchemata.one = nil diff --git a/vendor/github.com/go-openapi/validate/schema.go b/vendor/github.com/go-openapi/validate/schema.go index 706b7f5ef..e7af892c7 100644 --- a/vendor/github.com/go-openapi/validate/schema.go +++ b/vendor/github.com/go-openapi/validate/schema.go @@ -15,7 +15,17 @@ import ( // SchemaValidator validates data against a JSON schema. type SchemaValidator struct { - Path string + // Path is the location of the validated value, in the legacy dot-separated + // notation. It is what surfaces as the name of a validation error. + // + // Deprecated: a dotted path is ambiguous whenever a property name contains + // a dot. Prefer the JSON pointer rendering of the same location. + Path string + + // path is the same location, kept as JSON pointer reference tokens so that + // children may be derived from it unambiguously. + path pathSegments + in string Schema *spec.Schema validators [8]valueValidator @@ -32,7 +42,7 @@ func AgainstSchema(schema *spec.Schema, data any, formats strfmt.Registry, optio append(options, WithRecycleValidators(true), withRecycleResults(true))..., ).Validate(data) defer func() { - pools.poolOfResults.RedeemResult(res) + redeemResult(res) }() if res.HasErrors() { @@ -51,10 +61,23 @@ func NewSchemaValidator(schema *spec.Schema, rootSchema any, root string, format o(opts) } - return newSchemaValidator(schema, rootSchema, root, formats, opts) + return newSchemaValidator(schema, rootSchema, rootPathFromString(root), formats, opts) +} + +// rootPathFromString interprets the root path of the exported constructors. +// +// The caller hands over an opaque string, so there is no telling which of its +// dots are separators and which belong to a name: it is taken as a single +// reference token. +func rootPathFromString(root string) pathSegments { + if root == "" { + return rootPath() + } + + return newPathSegments(root) } -func newSchemaValidator(schema *spec.Schema, rootSchema any, root string, formats strfmt.Registry, opts *SchemaValidatorOptions) *SchemaValidator { +func newSchemaValidator(schema *spec.Schema, rootSchema any, root pathSegments, formats strfmt.Registry, opts *SchemaValidatorOptions) *SchemaValidator { if schema == nil { return nil } @@ -77,12 +100,13 @@ func newSchemaValidator(schema *spec.Schema, rootSchema any, root string, format var s *SchemaValidator if opts.recycleValidators { - s = pools.poolOfSchemaValidators.BorrowValidator() + s = validatorPools.schemaValidators.Borrow() } else { s = new(SchemaValidator) } - s.Path = root + s.path = root + s.Path = root.dotted() s.in = "body" s.Schema = schema s.Root = rootSchema @@ -104,8 +128,11 @@ func newSchemaValidator(schema *spec.Schema, rootSchema any, root string, format } // SetPath sets the path for this schema validator. +// +// Note that the sub-validators are built when the validator is created, so +// this only affects errors reported by this validator, not by its children. func (s *SchemaValidator) SetPath(path string) { - s.Path = path + s.setPath(rootPathFromString(path)) } // Applies returns true when this schema validator applies. @@ -131,7 +158,7 @@ func (s *SchemaValidator) Validate(data any) *Result { var result *Result if s.Options.recycleResult { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() result.data = data } else { result = &Result{data: data} @@ -169,7 +196,7 @@ func (s *SchemaValidator) Validate(data any) *Result { // to map[string]interface{}. var dd any if err := jsonutils.FromDynamicJSON(data, &dd); err != nil { - result.AddErrors(err) + result.addErrorsAt(s.path, err) result.Inc() return result @@ -185,7 +212,7 @@ func (s *SchemaValidator) Validate(data any) *Result { if s.Schema.Type.Contains(integerType) { // avoid lossy conversion in, erri := num.Int64() if erri != nil { - result.AddErrors(invalidTypeConversionMsg(s.Path, erri)) + result.addErrorsAt(s.path, invalidTypeConversionMsg(s.Path, erri)) result.Inc() return result @@ -194,7 +221,7 @@ func (s *SchemaValidator) Validate(data any) *Result { } else { nf, errf := num.Float64() if errf != nil { - result.AddErrors(invalidTypeConversionMsg(s.Path, errf)) + result.addErrorsAt(s.path, invalidTypeConversionMsg(s.Path, errf)) result.Inc() return result @@ -235,7 +262,7 @@ func (s *SchemaValidator) Validate(data any) *Result { func (s *SchemaValidator) typeValidator() valueValidator { return newTypeValidator( - s.Path, + s.path, s.in, s.Schema.Type, s.Schema.Nullable, @@ -246,7 +273,7 @@ func (s *SchemaValidator) typeValidator() valueValidator { func (s *SchemaValidator) commonValidator() valueValidator { return newBasicCommonValidator( - s.Path, + s.path, s.in, s.Schema.Default, s.Schema.Enum, @@ -256,7 +283,7 @@ func (s *SchemaValidator) commonValidator() valueValidator { func (s *SchemaValidator) sliceValidator() valueValidator { return newSliceValidator( - s.Path, + s.path, s.in, s.Schema.MaxItems, s.Schema.MinItems, @@ -271,7 +298,7 @@ func (s *SchemaValidator) sliceValidator() valueValidator { func (s *SchemaValidator) numberValidator() valueValidator { return newNumberValidator( - s.Path, + s.path, s.in, s.Schema.Default, s.Schema.MultipleOf, @@ -287,7 +314,7 @@ func (s *SchemaValidator) numberValidator() valueValidator { func (s *SchemaValidator) stringValidator() valueValidator { return newStringValidator( - s.Path, + s.path, s.in, nil, false, @@ -301,7 +328,7 @@ func (s *SchemaValidator) stringValidator() valueValidator { func (s *SchemaValidator) formatValidator() valueValidator { return newFormatValidator( - s.Path, + s.path, s.in, s.Schema.Format, s.KnownFormats, @@ -312,14 +339,14 @@ func (s *SchemaValidator) formatValidator() valueValidator { func (s *SchemaValidator) schemaPropsValidator() valueValidator { sch := s.Schema return newSchemaPropsValidator( - s.Path, s.in, sch.AllOf, sch.OneOf, sch.AnyOf, sch.Not, sch.Dependencies, s.Root, s.KnownFormats, + s.path, s.in, sch.AllOf, sch.OneOf, sch.AnyOf, sch.Not, sch.Dependencies, s.Root, s.KnownFormats, s.Options, ) } func (s *SchemaValidator) objectValidator() valueValidator { return newObjectValidator( - s.Path, + s.path, s.in, s.Schema.MaxProperties, s.Schema.MinProperties, @@ -333,8 +360,13 @@ func (s *SchemaValidator) objectValidator() valueValidator { ) } +func (s *SchemaValidator) setPath(path pathSegments) { + s.path = path + s.Path = path.dotted() +} + func (s *SchemaValidator) redeem() { - pools.poolOfSchemaValidators.RedeemValidator(s) + validatorPools.schemaValidators.Redeem(s) } func (s *SchemaValidator) redeemChildren() { diff --git a/vendor/github.com/go-openapi/validate/schema_props.go b/vendor/github.com/go-openapi/validate/schema_props.go index 2c4354d08..d7ecb14ce 100644 --- a/vendor/github.com/go-openapi/validate/schema_props.go +++ b/vendor/github.com/go-openapi/validate/schema_props.go @@ -12,7 +12,7 @@ import ( ) type schemaPropsValidator struct { - Path string + Path pathSegments In string AllOf []spec.Schema OneOf []spec.Schema @@ -28,12 +28,8 @@ type schemaPropsValidator struct { Options *SchemaValidatorOptions } -func (s *schemaPropsValidator) SetPath(path string) { - s.Path = path -} - func newSchemaPropsValidator( - path string, in string, allOf, oneOf, anyOf []spec.Schema, not *spec.Schema, deps spec.Dependencies, root any, formats strfmt.Registry, + path pathSegments, in string, allOf, oneOf, anyOf []spec.Schema, not *spec.Schema, deps spec.Dependencies, root any, formats strfmt.Registry, opts *SchemaValidatorOptions, ) *schemaPropsValidator { if opts == nil { @@ -60,7 +56,7 @@ func newSchemaPropsValidator( var s *schemaPropsValidator if opts.recycleValidators { - s = pools.poolOfSchemaPropsValidators.BorrowValidator() + s = validatorPools.schemaPropsValidators.Borrow() } else { s = new(schemaPropsValidator) } @@ -91,7 +87,7 @@ func (s *schemaPropsValidator) Applies(source any, _ reflect.Kind) bool { func (s *schemaPropsValidator) Validate(data any) *Result { var mainResult *Result if s.Options.recycleResult { - mainResult = pools.poolOfResults.BorrowResult() + mainResult = validatorPools.results.Borrow() } else { mainResult = new(Result) } @@ -111,17 +107,17 @@ func (s *schemaPropsValidator) Validate(data any) *Result { } if len(s.anyOfValidators) > 0 { - keepResultAnyOf = pools.poolOfResults.BorrowResult() + keepResultAnyOf = validatorPools.results.Borrow() s.validateAnyOf(data, mainResult, keepResultAnyOf) } if len(s.oneOfValidators) > 0 { - keepResultOneOf = pools.poolOfResults.BorrowResult() + keepResultOneOf = validatorPools.results.Borrow() s.validateOneOf(data, mainResult, keepResultOneOf) } if len(s.allOfValidators) > 0 { - keepResultAllOf = pools.poolOfResults.BorrowResult() + keepResultAllOf = validatorPools.results.Borrow() s.validateAllOf(data, mainResult, keepResultAllOf) } @@ -154,7 +150,7 @@ func (s *schemaPropsValidator) validateAnyOf(data any, mainResult, keepResultAny if result.IsValid() { if bestFailures != nil && bestFailures.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(bestFailures) + redeemResult(bestFailures) } _ = keepResultAnyOf.cleared() @@ -166,7 +162,7 @@ func (s *schemaPropsValidator) validateAnyOf(data any, mainResult, keepResultAny // MatchCount is used to select errors from the schema with most positive checks if bestFailures == nil || result.MatchCount > bestFailures.MatchCount { if bestFailures != nil && bestFailures.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(bestFailures) + redeemResult(bestFailures) } bestFailures = result @@ -174,11 +170,11 @@ func (s *schemaPropsValidator) validateAnyOf(data any, mainResult, keepResultAny } if result.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(result) // this result is ditched + redeemResult(result) // this result is ditched } } - mainResult.AddErrors(mustValidateAtLeastOneSchemaMsg(s.Path)) + mainResult.addErrorsAt(s.Path, mustValidateAtLeastOneSchemaMsg(s.Path.dotted())) mainResult.Merge(bestFailures) } @@ -205,7 +201,7 @@ func (s *schemaPropsValidator) validateOneOf(data any, mainResult, keepResultOne if firstSuccess == nil { firstSuccess = result } else if result.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(result) // this result is ditched + redeemResult(result) // this result is ditched } continue @@ -214,29 +210,29 @@ func (s *schemaPropsValidator) validateOneOf(data any, mainResult, keepResultOne // MatchCount is used to select errors from the schema with most positive checks if validated == 0 && (bestFailures == nil || result.MatchCount > bestFailures.MatchCount) { if bestFailures != nil && bestFailures.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(bestFailures) + redeemResult(bestFailures) } bestFailures = result } else if result.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(result) // this result is ditched + redeemResult(result) // this result is ditched } } switch validated { case 0: - mainResult.AddErrors(mustValidateOnlyOneSchemaMsg(s.Path, "Found none valid")) + mainResult.addErrorsAt(s.Path, mustValidateOnlyOneSchemaMsg(s.Path.dotted(), "Found none valid")) mainResult.Merge(bestFailures) // firstSucess necessarily nil case 1: mainResult.Merge(firstSuccess) if bestFailures != nil && bestFailures.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(bestFailures) + redeemResult(bestFailures) } default: - mainResult.AddErrors(mustValidateOnlyOneSchemaMsg(s.Path, fmt.Sprintf("Found %d valid alternatives", validated))) + mainResult.addErrorsAt(s.Path, mustValidateOnlyOneSchemaMsg(s.Path.dotted(), fmt.Sprintf("Found %d valid alternatives", validated))) mainResult.Merge(bestFailures) if firstSuccess != nil && firstSuccess.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(firstSuccess) + redeemResult(firstSuccess) } } } @@ -260,10 +256,10 @@ func (s *schemaPropsValidator) validateAllOf(data any, mainResult, keepResultAll switch validated { case 0: - mainResult.AddErrors(mustValidateAllSchemasMsg(s.Path, ". None validated")) + mainResult.addErrorsAt(s.Path, mustValidateAllSchemasMsg(s.Path.dotted(), ". None validated")) case len(s.allOfValidators): default: - mainResult.AddErrors(mustValidateAllSchemasMsg(s.Path, "")) + mainResult.addErrorsAt(s.Path, mustValidateAllSchemasMsg(s.Path.dotted(), "")) } } @@ -274,16 +270,16 @@ func (s *schemaPropsValidator) validateNot(data any, mainResult *Result) { } // We keep inner IMPORTANT! errors no matter what MatchCount tells us if result.IsValid() { - mainResult.AddErrors(mustNotValidatechemaMsg(s.Path)) + mainResult.addErrorsAt(s.Path, mustNotValidatechemaMsg(s.Path.dotted())) } if result.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(result) // this result is ditched + redeemResult(result) // this result is ditched } } func (s *schemaPropsValidator) validateDependencies(data any, mainResult *Result) { val := data.(map[string]any) //nolint:forcetypeassert // caller guarantees map[string]any - for key := range val { + for _, key := range sortedKeys(val) { dep, ok := s.Dependencies[key] if !ok { continue @@ -291,7 +287,7 @@ func (s *schemaPropsValidator) validateDependencies(data any, mainResult *Result if dep.Schema != nil { mainResult.Merge( - newSchemaValidator(dep.Schema, s.Root, s.Path+"."+key, s.KnownFormats, s.Options).Validate(data), + newSchemaValidator(dep.Schema, s.Root, s.Path.child(key), s.KnownFormats, s.Options).Validate(data), ) continue } @@ -299,15 +295,19 @@ func (s *schemaPropsValidator) validateDependencies(data any, mainResult *Result if len(dep.Property) > 0 { for _, depKey := range dep.Property { if _, ok := val[depKey]; !ok { - mainResult.AddErrors(hasADependencyMsg(s.Path, depKey)) + mainResult.addErrorsAt(s.Path, hasADependencyMsg(s.Path.dotted(), depKey)) } } } } } +func (s *schemaPropsValidator) setPath(path pathSegments) { + s.Path = path +} + func (s *schemaPropsValidator) redeem() { - pools.poolOfSchemaPropsValidators.RedeemValidator(s) + validatorPools.schemaPropsValidators.Redeem(s) } func (s *schemaPropsValidator) redeemChildren() { diff --git a/vendor/github.com/go-openapi/validate/slice_validator.go b/vendor/github.com/go-openapi/validate/slice_validator.go index 8f49d1370..0a0ee7402 100644 --- a/vendor/github.com/go-openapi/validate/slice_validator.go +++ b/vendor/github.com/go-openapi/validate/slice_validator.go @@ -4,7 +4,6 @@ package validate import ( - "fmt" "reflect" "github.com/go-openapi/spec" @@ -12,7 +11,7 @@ import ( ) type schemaSliceValidator struct { - Path string + Path pathSegments In string MaxItems *int64 MinItems *int64 @@ -24,7 +23,7 @@ type schemaSliceValidator struct { Options *SchemaValidatorOptions } -func newSliceValidator(path, in string, +func newSliceValidator(path pathSegments, in string, maxItems, minItems *int64, uniqueItems bool, additionalItems *spec.SchemaOrBool, items *spec.SchemaOrArray, root any, formats strfmt.Registry, opts *SchemaValidatorOptions, @@ -35,7 +34,7 @@ func newSliceValidator(path, in string, var v *schemaSliceValidator if opts.recycleValidators { - v = pools.poolOfSliceValidators.BorrowValidator() + v = validatorPools.sliceValidators.Borrow() } else { v = new(schemaSliceValidator) } @@ -54,10 +53,6 @@ func newSliceValidator(path, in string, return v } -func (s *schemaSliceValidator) SetPath(path string) { - s.Path = path -} - func (s *schemaSliceValidator) Applies(source any, kind reflect.Kind) bool { _, ok := source.(*spec.Schema) r := ok && kind == reflect.Slice @@ -73,7 +68,7 @@ func (s *schemaSliceValidator) Validate(data any) *Result { var result *Result if s.Options.recycleResult { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() } else { result = new(Result) } @@ -85,8 +80,10 @@ func (s *schemaSliceValidator) Validate(data any) *Result { if s.Items != nil && s.Items.Schema != nil { for i := range size { - validator := newSchemaValidator(s.Items.Schema, s.Root, s.Path, s.KnownFormats, s.Options) - validator.SetPath(fmt.Sprintf("%s.%d", s.Path, i)) + // the index has to reach the constructor: the sub-validators that + // report the error are built there, and setting the path afterwards + // would leave them located on the array rather than on the item. + validator := newSchemaValidator(s.Items.Schema, s.Root, s.Path.item(i), s.KnownFormats, s.Options) value := val.Index(i) result.mergeForSlice(val, i, validator.Validate(value.Interface())) } @@ -100,41 +97,45 @@ func (s *schemaSliceValidator) Validate(data any) *Result { break } - validator := newSchemaValidator(&s.Items.Schemas[i], s.Root, fmt.Sprintf("%s.%d", s.Path, i), s.KnownFormats, s.Options) + validator := newSchemaValidator(&s.Items.Schemas[i], s.Root, s.Path.item(i), s.KnownFormats, s.Options) result.mergeForSlice(val, i, validator.Validate(val.Index(i).Interface())) } } if s.AdditionalItems != nil && itemsSize < size { if s.Items != nil && len(s.Items.Schemas) > 0 && !s.AdditionalItems.Allows { - result.AddErrors(arrayDoesNotAllowAdditionalItemsMsg()) + result.addErrorsAt(s.Path, arrayDoesNotAllowAdditionalItemsMsg()) } if s.AdditionalItems.Schema != nil { for i := itemsSize; i < size-itemsSize+1; i++ { - validator := newSchemaValidator(s.AdditionalItems.Schema, s.Root, fmt.Sprintf("%s.%d", s.Path, i), s.KnownFormats, s.Options) + validator := newSchemaValidator(s.AdditionalItems.Schema, s.Root, s.Path.item(i), s.KnownFormats, s.Options) result.mergeForSlice(val, i, validator.Validate(val.Index(i).Interface())) } } } if s.MinItems != nil { - if err := MinItems(s.Path, s.In, int64(size), *s.MinItems); err != nil { - result.AddErrors(err) + if err := MinItems(s.Path.dotted(), s.In, int64(size), *s.MinItems); err != nil { + result.addErrorsAt(s.Path, err) } } if s.MaxItems != nil { - if err := MaxItems(s.Path, s.In, int64(size), *s.MaxItems); err != nil { - result.AddErrors(err) + if err := MaxItems(s.Path.dotted(), s.In, int64(size), *s.MaxItems); err != nil { + result.addErrorsAt(s.Path, err) } } if s.UniqueItems { - if err := UniqueItems(s.Path, s.In, val.Interface()); err != nil { - result.AddErrors(err) + if err := UniqueItems(s.Path.dotted(), s.In, val.Interface()); err != nil { + result.addErrorsAt(s.Path, err) } } result.Inc() return result } +func (s *schemaSliceValidator) setPath(path pathSegments) { + s.Path = path +} + func (s *schemaSliceValidator) redeem() { - pools.poolOfSliceValidators.RedeemValidator(s) + validatorPools.sliceValidators.Redeem(s) } diff --git a/vendor/github.com/go-openapi/validate/sorted.go b/vendor/github.com/go-openapi/validate/sorted.go new file mode 100644 index 000000000..829a042c6 --- /dev/null +++ b/vendor/github.com/go-openapi/validate/sorted.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers +// SPDX-License-Identifier: Apache-2.0 + +package validate + +import ( + "cmp" + "maps" + "slices" + "strings" + + "github.com/go-openapi/spec" +) + +// sortedKeys returns the keys of a map in ascending order. +// +// Findings are reported in the order the checks walk the document, and several +// of them walk a map: definitions, paths, response codes, headers, properties. +// Go randomises map iteration, so the same bytes validated twice would list +// their findings in a different order — and where a check stops on the first +// fault it meets, would name a different offender altogether. +// +// Walking keys in sorted order makes both defined: findings come out in +// definition-name (or path, or status-code) order, on every run. +func sortedKeys[K cmp.Ordered, V any](m map[K]V) []K { + return slices.Sorted(maps.Keys(m)) +} + +// sortedRefs orders references by the location they point at. +// +// The analyzer gathers references in a map, so the slice it hands back comes +// out in a different order on every run. See [sortedKeys]. +func sortedRefs(refs []spec.Ref) []spec.Ref { + slices.SortFunc(refs, func(a, b spec.Ref) int { + return strings.Compare(a.String(), b.String()) + }) + + return refs +} diff --git a/vendor/github.com/go-openapi/validate/spec.go b/vendor/github.com/go-openapi/validate/spec.go index d6a61eae2..e5d16b679 100644 --- a/vendor/github.com/go-openapi/validate/spec.go +++ b/vendor/github.com/go-openapi/validate/spec.go @@ -10,6 +10,7 @@ import ( "fmt" "slices" "sort" + "strconv" "strings" "github.com/go-openapi/analysis" @@ -48,13 +49,17 @@ func Spec(doc *loads.Document, formats strfmt.Registry, options ...Option) error // SpecValidator validates a swagger 2.0 spec. type SpecValidator struct { - schema *spec.Schema // swagger 2.0 schema - spec *loads.Document - analyzer *analysis.Spec - expanded *loads.Document - KnownFormats strfmt.Registry - Options Opts // validation options - schemaOptions *SchemaValidatorOptions + schema *spec.Schema // swagger 2.0 schema + spec *loads.Document + analyzer *analysis.Spec + expanded *loads.Document + refLocations refLocations + refRedirects refRedirects + paramLocations paramLocations + document any // the document as decoded, to tell what it holds + KnownFormats strfmt.Registry + Options Opts // validation options + schemaOptions *SchemaValidatorOptions } // NewSpecValidator creates a new swagger spec validator instance. @@ -98,6 +103,15 @@ func (s *SpecValidator) Validate(data any) (*Result, *Result) { } s.spec = sd s.analyzer = analysis.New(sd.Spec()) + // where each $ref sits, as authored: refs are reported against the + // unexpanded document, before expansion flattens them away + s.refLocations = newRefLocations(s.analyzer) + // where each operation declares its parameters: the document addresses + // them by index, and expansion loses that + s.paramLocations = newParamLocations(sd.Spec()) + // where each $ref leads: checks walk the expanded document, and a finding + // below a $ref has to be brought back to a node the document contains + s.refRedirects = newRefRedirects(s.analyzer) // Raw spec unmarshalling errors var obj any @@ -106,16 +120,23 @@ func (s *SpecValidator) Validate(data any) (*Result, *Result) { // So this one is just a paranoid check on the behavior of the spec package panic(InvalidDocumentError) } + s.document = obj defer func() { + // bring findings reached through a $ref back onto the document, then + // hold every location to what the document actually addresses + errs.redirect(s.refRedirects.through) + errs.redirect(s.resolvable) // errs holds all errors and warnings, // warnings only warnings errs.MergeAsWarnings(warnings) - warnings.AddErrors(errs.Warnings...) + // reported as errors of the warnings-only result, but keeping the + // location each was recorded with + warnings.carryErrors(errs.Warnings, errs.warningLocations) }() // Swagger schema validator - schv := newSchemaValidator(s.schema, nil, "", s.KnownFormats, s.schemaOptions) + schv := newSchemaValidator(s.schema, nil, rootPath(), s.KnownFormats, s.schemaOptions) errs.Merge(schv.Validate(obj)) // error - // There may be a point in continuing to try and determine more accurate errors if !s.Options.ContinueOnErrors && errs.HasErrors() { @@ -167,24 +188,25 @@ func (s *SpecValidator) SetContinueOnErrors(c bool) { } func (s *SpecValidator) validateNonEmptyPathParamNames() *Result { - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() if s.spec.Spec().Paths == nil { - // There is no Paths object: error - res.AddErrors(noValidPathMsg()) + // There is no Paths object: the document itself is what lacks it, so + // there is no node below it to point at + res.addErrorsAt(rootPath(), noValidPathMsg()) return res } if s.spec.Spec().Paths.Paths == nil { // Paths may be empty: warning - res.AddWarnings(noValidPathMsg()) + res.addWarningsAt(newPathSegments(swaggerPaths), noValidPathMsg()) return res } - for k := range s.spec.Spec().Paths.Paths { + for _, k := range sortedKeys(s.spec.Spec().Paths.Paths) { if strings.Contains(k, "{}") { - res.AddErrors(emptyPathParameterMsg(k)) + res.addErrorsAt(newPathSegments(swaggerPaths, k), emptyPathParameterMsg(k)) } } @@ -201,21 +223,55 @@ func (s *SpecValidator) validateDuplicateOperationIDs() *Result { // fallback on possible incomplete picture because of previous errors analyzer = s.analyzer } - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() + + // the message says how many times an identifier is used, so the count is + // what it needs; a reader needs somewhere to go, so the first operation to + // declare the identifier is remembered along with it known := make(map[string]int) - for _, v := range analyzer.OperationIDs() { - if v != "" { - known[v]++ + declaredAt := make(map[string]pathSegments) + operations := analyzer.Operations() + for _, method := range sortedKeys(operations) { + byPath := operations[method] + for _, path := range sortedKeys(byPath) { + op := byPath[path] + id := operationIdentity(method, path, op) + known[id]++ + if _, isKnown := declaredAt[id]; !isKnown { + declaredAt[id] = operationIDPath(path, method, op) + } } } - for k, v := range known { - if v > 1 { - res.AddErrors(nonUniqueOperationIDMsg(k, v)) + + for _, k := range sortedKeys(known) { + if v := known[k]; v > 1 { + res.addErrorsAt(declaredAt[k], nonUniqueOperationIDMsg(k, v)) } } return res } +// operationIdentity names an operation the way the analyzer does: by its +// operationId, or by method and path when it declares none. +func operationIdentity(method, path string, op *spec.Operation) string { + if op == nil || op.ID == "" { + return strings.ToUpper(method) + " " + path + } + + return op.ID +} + +// operationIDPath locates the operationId of an operation, or the operation +// itself when it declares none. +func operationIDPath(path, method string, op *spec.Operation) pathSegments { + at := operationPath(path, method) + if op == nil || op.ID == "" { + return at + } + + return at.child(swaggerOperationID) +} + type dupProp struct { Name string Definition string @@ -223,8 +279,10 @@ type dupProp struct { func (s *SpecValidator) validateDuplicatePropertyNames() *Result { // definition can't declare a property that's already defined by one of its ancestors - res := pools.poolOfResults.BorrowResult() - for k, sch := range s.spec.Spec().Definitions { + res := validatorPools.results.Borrow() + definitions := s.spec.Spec().Definitions + for _, k := range sortedKeys(definitions) { + sch := definitions[k] if len(sch.AllOf) == 0 { continue } @@ -238,8 +296,15 @@ func (s *SpecValidator) validateDuplicatePropertyNames() *Result { res.Merge(rec) } if len(ancs) > 0 { - res.AddErrors(circularAncestryDefinitionMsg(k, ancs)) - return res + res.addErrorsAt(newPathSegments(swaggerDefinitions, k), circularAncestryDefinitionMsg(k, ancs)) + if !s.Options.ContinueOnErrors { + return res + } + + // the ancestry loops back on itself: searching it for duplicate + // property names would not terminate, so this definition stops here + // and the next one is examined. + continue } knowns := make(map[string]struct{}) @@ -252,7 +317,7 @@ func (s *SpecValidator) validateDuplicatePropertyNames() *Result { for _, v := range dups { pns = append(pns, v.Definition+"."+v.Name) } - res.AddErrors(duplicatePropertiesMsg(k, pns)) + res.addErrorsAt(newPathSegments(swaggerDefinitions, k), duplicatePropertiesMsg(k, pns)) } } @@ -272,7 +337,7 @@ func (s *SpecValidator) validateSchemaPropertyNames(nm string, sch spec.Schema, schn := nm schc := &sch - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() for schc.Ref.String() != "" { // gather property names @@ -296,7 +361,7 @@ func (s *SpecValidator) validateSchemaPropertyNames(nm string, sch spec.Schema, return dups, res } - for k := range schc.Properties { + for _, k := range sortedKeys(schc.Properties) { _, ok := knowns[k] if ok { dups = append(dups, dupProp{Name: k, Definition: schn}) @@ -309,7 +374,7 @@ func (s *SpecValidator) validateSchemaPropertyNames(nm string, sch spec.Schema, } func (s *SpecValidator) validateCircularAncestry(nm string, sch spec.Schema, knowns map[string]struct{}) ([]string, *Result) { - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() if sch.Ref.String() == "" && len(sch.AllOf) == 0 { // Safeguard. We should not be able to actually get there return nil, res @@ -360,14 +425,17 @@ func (s *SpecValidator) validateCircularAncestry(nm string, sch spec.Schema, kno //nolint:gocognit // refactor in a forthcoming PR func (s *SpecValidator) validateItems() *Result { // validate parameter, items, schema and response objects for presence of item if type is array - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() - for method, pi := range s.analyzer.Operations() { - for path, op := range pi { + operations := s.analyzer.Operations() + for _, method := range sortedKeys(operations) { + pi := operations[method] + for _, path := range sortedKeys(pi) { + op := pi[path] for _, param := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) { if param.TypeName() == arrayType && param.ItemsTypeName() == "" { - res.AddErrors(arrayInParamRequiresItemsMsg(param.Name, op.ID)) + res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), arrayInParamRequiresItemsMsg(param.Name, op.ID)) continue } if param.In != swaggerBody { @@ -375,7 +443,7 @@ func (s *SpecValidator) validateItems() *Result { items := param.Items for items.TypeName() == arrayType { if items.ItemsTypeName() == "" { - res.AddErrors(arrayInParamRequiresItemsMsg(param.Name, op.ID)) + res.addErrorsAt(s.parameterPath(path, method, param.In, param.Name), arrayInParamRequiresItemsMsg(param.Name, op.ID)) break } items = items.Items @@ -384,32 +452,41 @@ func (s *SpecValidator) validateItems() *Result { } else { // In: body if param.Schema != nil { - res.Merge(s.validateSchemaItems(*param.Schema, fmt.Sprintf("body param %q", param.Name), op.ID)) + res.Merge(s.validateSchemaItems(*param.Schema, s.parameterPath(path, method, param.In, param.Name).child(jsonSchema), + fmt.Sprintf("body param %q", param.Name), op.ID)) } } } - var responses []spec.Response + type codedResponse struct { + code string + resp spec.Response + } + var responses []codedResponse if op.Responses != nil { if op.Responses.Default != nil { - responses = append(responses, *op.Responses.Default) + responses = append(responses, codedResponse{code: jsonDefault, resp: *op.Responses.Default}) } if op.Responses.StatusCodeResponses != nil { - for _, v := range op.Responses.StatusCodeResponses { - responses = append(responses, v) + for _, code := range sortedKeys(op.Responses.StatusCodeResponses) { + responses = append(responses, codedResponse{ + code: strconv.Itoa(code), + resp: op.Responses.StatusCodeResponses[code], + }) } } } for _, resp := range responses { + at := responsePath(path, method, resp.code) // Response headers with array - for hn, hv := range resp.Headers { - if hv.TypeName() == arrayType && hv.ItemsTypeName() == "" { - res.AddErrors(arrayInHeaderRequiresItemsMsg(hn, op.ID)) + for _, hn := range sortedKeys(resp.resp.Headers) { + if hv := resp.resp.Headers[hn]; hv.TypeName() == arrayType && hv.ItemsTypeName() == "" { + res.addErrorsAt(at.children(swaggerHeaders, hn), arrayInHeaderRequiresItemsMsg(hn, op.ID)) } } - if resp.Schema != nil { - res.Merge(s.validateSchemaItems(*resp.Schema, "response body", op.ID)) + if resp.resp.Schema != nil { + res.Merge(s.validateSchemaItems(*resp.resp.Schema, at.child(jsonSchema), "response body", op.ID)) } } } @@ -418,24 +495,24 @@ func (s *SpecValidator) validateItems() *Result { } // Verifies constraints on array type. -func (s *SpecValidator) validateSchemaItems(schema spec.Schema, prefix, opID string) *Result { - res := pools.poolOfResults.BorrowResult() +func (s *SpecValidator) validateSchemaItems(schema spec.Schema, at pathSegments, prefix, opID string) *Result { + res := validatorPools.results.Borrow() if !schema.Type.Contains(arrayType) { return res } if schema.Items == nil || schema.Items.Len() == 0 { - res.AddErrors(arrayRequiresItemsMsg(prefix, opID)) + res.addErrorsAt(at, arrayRequiresItemsMsg(prefix, opID)) return res } if schema.Items.Schema != nil { schema = *schema.Items.Schema if _, err := compileRegexp(schema.Pattern); err != nil { - res.AddErrors(invalidItemsPatternMsg(prefix, opID, schema.Pattern)) + res.addErrorsAt(at, invalidItemsPatternMsg(prefix, opID, schema.Pattern)) } - res.Merge(s.validateSchemaItems(schema, prefix, opID)) + res.Merge(s.validateSchemaItems(schema, at.child(jsonItems), prefix, opID)) } return res } @@ -443,7 +520,7 @@ func (s *SpecValidator) validateSchemaItems(schema spec.Schema, prefix, opID str func (s *SpecValidator) validatePathParamPresence(path string, fromPath, fromOperation []string) *Result { // Each defined operation path parameters must correspond to a named element in the API's path pattern. // (For example, you cannot have a path parameter named id for the following path /pets/{petId} but you must have a path parameter named petId.) - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() for _, l := range fromPath { var matched bool for _, r := range fromOperation { @@ -453,7 +530,7 @@ func (s *SpecValidator) validatePathParamPresence(path string, fromPath, fromOpe } } if !matched { - res.AddErrors(noParameterInPathMsg(l)) + res.addErrorsAt(newPathSegments(swaggerPaths, path), noParameterInPathMsg(l)) } } @@ -463,7 +540,7 @@ func (s *SpecValidator) validatePathParamPresence(path string, fromPath, fromOpe matched = true } if !matched { - res.AddErrors(pathParamNotInPathMsg(path, p)) + res.addErrorsAt(newPathSegments(swaggerPaths, path), pathParamNotInPathMsg(path, p)) } } @@ -496,9 +573,9 @@ func (s *SpecValidator) validateReferencedParameters() *Result { if len(expected) == 0 { return nil } - result := pools.poolOfResults.BorrowResult() - for k := range expected { - result.AddWarnings(unusedParamMsg(k)) + result := validatorPools.results.Borrow() + for _, k := range sortedKeys(expected) { + result.addWarningsAt(localRefPath(k), unusedParamMsg(k)) } return result } @@ -521,10 +598,12 @@ func (s *SpecValidator) validateReferencedResponses() *Result { if len(expected) == 0 { return nil } - result := pools.poolOfResults.BorrowResult() - for k := range expected { - result.AddWarnings(unusedResponseMsg(k)) + + result := validatorPools.results.Borrow() + for _, k := range sortedKeys(expected) { + result.addWarningsAt(localRefPath(k), unusedResponseMsg(k)) } + return result } @@ -548,59 +627,63 @@ func (s *SpecValidator) validateReferencedDefinitions() *Result { } result := new(Result) - for k := range expected { - result.AddWarnings(unusedDefinitionMsg(k)) + for _, k := range sortedKeys(expected) { + result.addWarningsAt(localRefPath(k), unusedDefinitionMsg(k)) } return result } func (s *SpecValidator) validateRequiredDefinitions() *Result { // Each property listed in the required array must be defined in the properties of the model - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() + + definitions := s.spec.Spec().Definitions DEFINITIONS: - for d, schema := range s.spec.Spec().Definitions { - if schema.Required != nil { // Safeguard - for _, pn := range schema.Required { - red := s.validateRequiredProperties(pn, d, &schema) //#nosec - // NOTE: capture validity before merging: Merge may redeem `red` to the - // pool (wantsRedeemOnMerge), after which reading it races with a concurrent - // BorrowResult().cleared() in another goroutine sharing the global pool. - isValid := red.IsValid() - res.Merge(red) - if !isValid && !s.Options.ContinueOnErrors { - break DEFINITIONS // there is an error, let's stop that bleeding - } - } + for _, d := range sortedKeys(definitions) { + schema := definitions[d] + red := validatorPools.results.Borrow() + keepGoing := s.walkRequired(newPathSegments(swaggerDefinitions, d), &schema, red) //#nosec + res.Merge(red) + if !keepGoing { + break DEFINITIONS // there is an error, let's stop that bleeding } } return res } -func (s *SpecValidator) validateRequiredProperties(path, in string, v *spec.Schema) *Result { +// validateRequiredProperties checks one entry of a required array. +// +// schemaAt locates the schema being searched for the property, which moves as +// the search descends into additionalProperties. requiredAt locates the entry +// of the required array that started it, and stays put. +func (s *SpecValidator) validateRequiredProperties( + path string, of schemaIdentity, schemaAt, requiredAt pathSegments, v *spec.Schema, +) *Result { + in := of.name // Takes care of recursive property definitions, which may be nested in additionalProperties schemas - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() propertyMatch := false patternMatch := false additionalPropertiesMatch := false isReadOnly := false - // Regular properties - if _, ok := v.Properties[path]; ok { + // Regular properties, including those a base definition contributes + if readOnly, declared := s.declaresProperty(v, path, maxCompositionHops); declared { propertyMatch = true - isReadOnly = v.Properties[path].ReadOnly + isReadOnly = readOnly } // NOTE: patternProperties are not supported in swagger. Even though, we continue validation here // We check all defined patterns: if one regexp is invalid, croaks an error - for pp, pv := range v.PatternProperties { + for _, pp := range sortedKeys(v.PatternProperties) { re, err := compileRegexp(pp) if err != nil { - res.AddErrors(invalidPatternMsg(pp, in)) + res.addErrorsAt(schemaAt, invalidPatternMsg(pp, in)) } else if re.MatchString(path) { patternMatch = true if !propertyMatch { - isReadOnly = pv.ReadOnly + isReadOnly = v.PatternProperties[pp].ReadOnly } } } @@ -613,7 +696,7 @@ func (s *SpecValidator) validateRequiredProperties(path, in string, v *spec.Sche // additionalProperties as schema are upported in swagger // recursively validates additionalProperties schema // Proposal for enhancement: anyOf, allOf, oneOf like in schemaPropsValidator - red := s.validateRequiredProperties(path, in, v.AdditionalProperties.Schema) + red := s.validateRequiredProperties(path, of, schemaAt.child(jsonAdditionalProperties), requiredAt, v.AdditionalProperties.Schema) if red.IsValid() { additionalPropertiesMatch = true if !propertyMatch && !patternMatch { @@ -626,11 +709,11 @@ func (s *SpecValidator) validateRequiredProperties(path, in string, v *spec.Sche } if !propertyMatch && !patternMatch && !additionalPropertiesMatch { - res.AddErrors(requiredButNotDefinedMsg(path, in)) + res.addErrorsAt(requiredAt, of.requiredButNotDefined(path)) } if isReadOnly { - res.AddWarnings(readOnlyAndRequiredMsg(in, path)) + res.addWarningsAt(requiredAt, readOnlyAndRequiredMsg(in, path)) } return res } @@ -646,26 +729,29 @@ func (s *SpecValidator) validateParameters() *Result { // - parameters with pattern property must specify valid patterns // - $ref in parameters must resolve // - path param must be required - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() rexGarbledPathSegment := mustCompileRegexp(`.*[{}\s]+.*`) - for method, pi := range s.expandedAnalyzer().Operations() { + operations := s.expandedAnalyzer().Operations() + for _, method := range sortedKeys(operations) { + pi := operations[method] methodPaths := make(map[string]map[string]string) - for path, op := range pi { + for _, path := range sortedKeys(pi) { + op := pi[path] if s.Options.StrictPathParamUniqueness { pathToAdd := pathHelp.stripParametersInPath(path) // Warn on garbled path afer param stripping if rexGarbledPathSegment.MatchString(pathToAdd) { - res.AddWarnings(pathStrippedParamGarbledMsg(pathToAdd)) + res.addWarningsAt(newPathSegments(swaggerPaths, path), pathStrippedParamGarbledMsg(pathToAdd)) } // Check uniqueness of stripped paths if _, found := methodPaths[method][pathToAdd]; found { // Sort names for stable, testable output if strings.Compare(path, methodPaths[method][pathToAdd]) < 0 { - res.AddErrors(pathOverlapMsg(path, methodPaths[method][pathToAdd])) + res.addErrorsAt(newPathSegments(swaggerPaths, path), pathOverlapMsg(path, methodPaths[method][pathToAdd])) } else { - res.AddErrors(pathOverlapMsg(methodPaths[method][pathToAdd], path)) + res.addErrorsAt(newPathSegments(swaggerPaths, path), pathOverlapMsg(methodPaths[method][pathToAdd], path)) } } else { if _, found := methodPaths[method]; !found { @@ -697,10 +783,10 @@ func (s *SpecValidator) validateParameters() *Result { for _, pr := range paramHelp.safeExpandedParamsFor(path, method, op.ID, res, s) { // An expanded parameter must validate the Parameter schema (an unexpanded $ref always passes high-level schema validation) - schv := newSchemaValidator(¶mSchema, s.schema, fmt.Sprintf("%s.%s.parameters.%s", path, method, pr.Name), s.KnownFormats, s.schemaOptions) + schv := newSchemaValidator(¶mSchema, s.schema, s.parameterPath(path, method, pr.In, pr.Name), s.KnownFormats, s.schemaOptions) var obj any if err := jsonutils.FromDynamicJSON(pr, &obj); err != nil { - res.AddErrors(err) + res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), err) return res } @@ -709,7 +795,7 @@ func (s *SpecValidator) validateParameters() *Result { // Validate pattern regexp for parameters with a Pattern property if _, err := compileRegexp(pr.Pattern); err != nil { - res.AddErrors(invalidPatternInParamMsg(op.ID, pr.Name, pr.Pattern)) + res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), invalidPatternInParamMsg(op.ID, pr.Name, pr.Pattern)) } // There must be at most one parameter in body: list them all @@ -722,7 +808,7 @@ func (s *SpecValidator) validateParameters() *Result { paramNames = append(paramNames, pr.Name) // Path declared in path must have the required: true property if !pr.Required { - res.AddErrors(pathParamRequiredMsg(op.ID, pr.Name)) + res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), pathParamRequiredMsg(op.ID, pr.Name)) } } @@ -733,31 +819,31 @@ func (s *SpecValidator) validateParameters() *Result { if pr.Type != numberType && pr.Type != integerType && (pr.Maximum != nil || pr.Minimum != nil || pr.MultipleOf != nil) { // A non-numeric parameter has validation keywords for numeric instances (number and integer) - res.AddWarnings(parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type)) + res.addWarningsAt(s.parameterPath(path, method, pr.In, pr.Name), parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type)) } if pr.Type != stringType && // A non-string parameter has validation keywords for strings (pr.MaxLength != nil || pr.MinLength != nil || pr.Pattern != "") { - res.AddWarnings(parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type)) + res.addWarningsAt(s.parameterPath(path, method, pr.In, pr.Name), parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type)) } if pr.Type != arrayType && // A non-array parameter has validation keywords for arrays (pr.MaxItems != nil || pr.MinItems != nil || pr.UniqueItems) { - res.AddWarnings(parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type)) + res.addWarningsAt(s.parameterPath(path, method, pr.In, pr.Name), parameterValidationTypeMismatchMsg(pr.Name, path, pr.Type)) } } // In:formData and In:body are mutually exclusive if hasBody && hasForm { - res.AddErrors(bothFormDataAndBodyMsg(op.ID)) + res.addErrorsAt(operationPath(path, method), bothFormDataAndBodyMsg(op.ID)) } // There must be at most one body param // Accurately report situations when more than 1 body param is declared (possibly unnamed) if len(bodyParams) > 1 { sort.Strings(bodyParams) - res.AddErrors(multipleBodyParamMsg(op.ID, bodyParams)) + res.addErrorsAt(operationPath(path, method), multipleBodyParamMsg(op.ID, bodyParams)) } // Check uniqueness of parameters in path @@ -765,7 +851,7 @@ func (s *SpecValidator) validateParameters() *Result { for i, p := range paramsInPath { for j, q := range paramsInPath { if p == q && i > j { - res.AddErrors(pathParamNotUniqueMsg(path, p, q)) + res.addErrorsAt(newPathSegments(swaggerPaths, path), pathParamNotUniqueMsg(path, p, q)) break } } @@ -775,7 +861,7 @@ func (s *SpecValidator) validateParameters() *Result { rexGarbledParam := mustCompileRegexp(`{.*[{}\s]+.*}`) for _, p := range paramsInPath { if rexGarbledParam.MatchString(p) { - res.AddWarnings(pathParamGarbledMsg(path, p)) + res.addWarningsAt(newPathSegments(swaggerPaths, path), pathParamGarbledMsg(path, p)) } } @@ -788,10 +874,10 @@ func (s *SpecValidator) validateParameters() *Result { func (s *SpecValidator) validateReferencesValid() *Result { // each reference must point to a valid object - res := pools.poolOfResults.BorrowResult() - for _, r := range s.analyzer.AllRefs() { + res := validatorPools.results.Borrow() + for _, r := range sortedRefs(s.analyzer.AllRefs()) { if !r.IsValidURI(s.spec.SpecFilePath()) { // Safeguard - spec should always yield a valid URI - res.AddErrors(invalidRefMsg(r.String())) + res.addErrorsAt(s.refLocations.at(r.String()), invalidRefMsg(r.String())) } } if !res.HasErrors() { @@ -803,13 +889,48 @@ func (s *SpecValidator) validateReferencesValid() *Result { // is set, this is a no-op: loads falls back to the document's own loader. exp, err := s.spec.Expanded(s.schemaOptions.expandOptions("")) if err != nil { - res.AddErrors(unresolvedReferencesMsg(err)) + res.addErrorsAt(s.firstUnresolvableRef(), unresolvedReferencesMsg(err)) } s.expanded = exp } return res } +// firstUnresolvableRef locates the declaration of the first local $ref, in +// document order, that points at a node the document does not hold. +// +// Expansion reports the whole document in a single message, naming only the +// reference it happened to trip on, so the finding has no location of its own. +// A document usually has one broken reference; when it has several, this is the +// first one a reader would meet. +func (s *SpecValidator) firstUnresolvableRef() pathSegments { + first := rootPath() + found := false + + for _, r := range s.analyzer.AllRefs() { + value := r.String() + if !strings.HasPrefix(value, "#/") { + // a remote reference cannot be checked against the document alone + continue + } + + pointer, err := jsonpointer.New(strings.TrimPrefix(value, "#")) + if err != nil { + continue + } + if _, _, err := pointer.Get(s.document); err == nil { + continue + } + + at := s.refLocations.at(value) + if !found || at.pointer() < first.pointer() { + first, found = at, true + } + } + + return first +} + func (s *SpecValidator) checkUniqueParams(path, method string, op *spec.Operation) *Result { // Check for duplicate parameters declaration in param section. // Each parameter should have a unique `name` and `type` combination @@ -817,7 +938,7 @@ func (s *SpecValidator) checkUniqueParams(path, method string, op *spec.Operatio // However, there are some issues with such a factorization: // - analysis does not seem to fully expand params // - param keys may be altered by x-go-name - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() pnames := make(map[string]struct{}) if op.Parameters != nil { // Safeguard @@ -830,7 +951,7 @@ func (s *SpecValidator) checkUniqueParams(path, method string, op *spec.Operatio key := fmt.Sprintf("%s#%s", pr.In, pr.Name) if _, ok = pnames[key]; ok { - res.AddErrors(duplicateParamNameMsg(pr.In, pr.Name, op.ID)) + res.addErrorsAt(s.parameterPath(path, method, pr.In, pr.Name), duplicateParamNameMsg(pr.In, pr.Name, op.ID)) } pnames[key] = struct{}{} } diff --git a/vendor/github.com/go-openapi/validate/spec_messages.go b/vendor/github.com/go-openapi/validate/spec_messages.go index eeb8a8695..0a0739a75 100644 --- a/vendor/github.com/go-openapi/validate/spec_messages.go +++ b/vendor/github.com/go-openapi/validate/spec_messages.go @@ -132,6 +132,9 @@ const ( // RequiredButNotDefinedError ... RequiredButNotDefinedError = "%q is present in required but not defined as property in definition %q" + // RequiredButNotDefinedInSchemaError is the same slip, in a schema a definition holds rather than + // in the definition itself. + RequiredButNotDefinedInSchemaError = "%q is present in required but not defined as property in schema %q" // SomeParametersBrokenError indicates that some parameters could not be resolved, which might result in partial checks to be carried on. SomeParametersBrokenError = "some parameters definitions are broken in %q.%s. Cannot carry on full checks on parameters for operation %s" @@ -260,6 +263,10 @@ func requiredButNotDefinedMsg(path, definition string) errors.Error { return errors.New(errors.CompositeErrorCode, RequiredButNotDefinedError, path, definition) } +func requiredButNotDefinedInSchemaMsg(path, schema string) errors.Error { + return errors.New(errors.CompositeErrorCode, RequiredButNotDefinedInSchemaError, path, schema) +} + func pathParamGarbledMsg(path, param string) errors.Error { return errors.New(errors.CompositeErrorCode, PathParamGarbledWarning, path, param) } diff --git a/vendor/github.com/go-openapi/validate/spec_ref_warnings.go b/vendor/github.com/go-openapi/validate/spec_ref_warnings.go index 49c72314c..d56cb177c 100644 --- a/vendor/github.com/go-openapi/validate/spec_ref_warnings.go +++ b/vendor/github.com/go-openapi/validate/spec_ref_warnings.go @@ -34,12 +34,12 @@ const minDistinctHostsToWarn = 2 // // All findings are warnings: they do not affect validity (see Result.IsValid). func (s *SpecValidator) validateDubiousRefs() *Result { - res := pools.poolOfResults.BorrowResult() + res := validatorPools.results.Borrow() baseDir, hasBase := s.localBaseDir() remoteHosts := make(map[string]struct{}) - for _, r := range s.analyzer.AllRefs() { + for _, r := range sortedRefs(s.analyzer.AllRefs()) { u := r.GetURL() if u == nil { // Safeguard: a valid spec always yields parseable refs continue @@ -48,7 +48,7 @@ func (s *SpecValidator) validateDubiousRefs() *Result { // Rule 1: absolute local reference escaping the base path. if refPath, isLocalAbs := absoluteLocalRefPath(r, u); isLocalAbs { if !hasBase || !isBeneathBase(refPath, baseDir) { - res.AddWarnings(dubiousAbsoluteRefMsg(r.String())) + res.addWarningsAt(s.refLocations.at(r.String()), dubiousAbsoluteRefMsg(r.String())) } continue } diff --git a/vendor/github.com/go-openapi/validate/type.go b/vendor/github.com/go-openapi/validate/type.go index d29574c34..3016783f0 100644 --- a/vendor/github.com/go-openapi/validate/type.go +++ b/vendor/github.com/go-openapi/validate/type.go @@ -15,7 +15,7 @@ import ( ) type typeValidator struct { - Path string + Path pathSegments In string Type spec.StringOrArray Nullable bool @@ -23,14 +23,14 @@ type typeValidator struct { Options *SchemaValidatorOptions } -func newTypeValidator(path, in string, typ spec.StringOrArray, nullable bool, format string, opts *SchemaValidatorOptions) *typeValidator { +func newTypeValidator(path pathSegments, in string, typ spec.StringOrArray, nullable bool, format string, opts *SchemaValidatorOptions) *typeValidator { if opts == nil { opts = new(SchemaValidatorOptions) } var t *typeValidator if opts.recycleValidators { - t = pools.poolOfTypeValidators.BorrowValidator() + t = validatorPools.typeValidators.Borrow() } else { t = new(typeValidator) } @@ -45,10 +45,6 @@ func newTypeValidator(path, in string, typ spec.StringOrArray, nullable bool, fo return t } -func (t *typeValidator) SetPath(path string) { - t.Path = path -} - func (t *typeValidator) Applies(source any, _ reflect.Kind) bool { // typeValidator applies to Schema, Parameter and Header objects switch source.(type) { @@ -72,7 +68,7 @@ func (t *typeValidator) Validate(data any) *Result { if data == nil { // nil or zero value for the passed structure require Type: null if len(t.Type) > 0 && !t.Type.Contains(nullType) && !t.Nullable { // NOTE: if a property is not required it also passes this - return errorHelp.sErr(errors.InvalidType(t.Path, t.In, strings.Join(t.Type, ","), nullType), t.Options.recycleResult) + return errorHelp.sErrAt(t.Path, errors.InvalidType(t.Path.dotted(), t.In, strings.Join(t.Type, ","), nullType), t.Options.recycleResult) } return emptyResult @@ -98,7 +94,7 @@ func (t *typeValidator) Validate(data any) *Result { !isFloatInt && !isIntFloat && !isLowerInt && !isLowerFloat if formatMismatch { // NOTE: test case - return errorHelp.sErr(errors.InvalidType(t.Path, t.In, t.Format, format), t.Options.recycleResult) + return errorHelp.sErrAt(t.Path, errors.InvalidType(t.Path.dotted(), t.In, t.Format, format), t.Options.recycleResult) } if !t.Type.Contains(numberType) && !t.Type.Contains(integerType) && t.Format != "" && (kind == reflect.String || kind == reflect.Slice) { @@ -106,7 +102,7 @@ func (t *typeValidator) Validate(data any) *Result { } if !t.Type.Contains(schType) && !isFloatInt && !isIntFloat { - return errorHelp.sErr(errors.InvalidType(t.Path, t.In, strings.Join(t.Type, ","), schType), t.Options.recycleResult) + return errorHelp.sErrAt(t.Path, errors.InvalidType(t.Path.dotted(), t.In, strings.Join(t.Type, ","), schType), t.Options.recycleResult) } return emptyResult @@ -201,6 +197,10 @@ func (t *typeValidator) schemaInfoForType(data any) (string, string) { return "", "" } +func (t *typeValidator) setPath(path pathSegments) { + t.Path = path +} + func (t *typeValidator) redeem() { - pools.poolOfTypeValidators.RedeemValidator(t) + validatorPools.typeValidators.Redeem(t) } diff --git a/vendor/github.com/go-openapi/validate/validator.go b/vendor/github.com/go-openapi/validate/validator.go index e7aebc525..3989b21e7 100644 --- a/vendor/github.com/go-openapi/validate/validator.go +++ b/vendor/github.com/go-openapi/validate/validator.go @@ -4,7 +4,6 @@ package validate import ( - "fmt" "reflect" "github.com/go-openapi/errors" @@ -18,7 +17,7 @@ type EntityValidator interface { } type valueValidator interface { - SetPath(path string) + setPath(path pathSegments) Applies(source any, kind reflect.Kind) bool Validate(data any) *Result } @@ -26,21 +25,21 @@ type valueValidator interface { type itemsValidator struct { items *spec.Items root any - path string + path pathSegments in string validators [6]valueValidator KnownFormats strfmt.Registry Options *SchemaValidatorOptions } -func newItemsValidator(path, in string, items *spec.Items, root any, formats strfmt.Registry, opts *SchemaValidatorOptions) *itemsValidator { +func newItemsValidator(path pathSegments, in string, items *spec.Items, root any, formats strfmt.Registry, opts *SchemaValidatorOptions) *itemsValidator { if opts == nil { opts = new(SchemaValidatorOptions) } var iv *itemsValidator if opts.recycleValidators { - iv = pools.poolOfItemsValidators.BorrowValidator() + iv = validatorPools.itemsValidators.Borrow() } else { iv = new(itemsValidator) } @@ -74,12 +73,12 @@ func (i *itemsValidator) Validate(index int, data any) *Result { kind := tpe.Kind() var result *Result if i.Options.recycleResult { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() } else { result = new(Result) } - path := fmt.Sprintf("%s.%d", i.path, index) + path := i.path.item(index) for idx, validator := range i.validators { if !validator.Applies(i.root, kind) { @@ -97,7 +96,7 @@ func (i *itemsValidator) Validate(index int, data any) *Result { continue } - validator.SetPath(path) + validator.setPath(path) err := validator.Validate(data) if i.Options.recycleValidators { i.validators[idx] = nil // prevents further (unsafe) usage @@ -130,7 +129,7 @@ func (i *itemsValidator) typeValidator() valueValidator { func (i *itemsValidator) commonValidator() valueValidator { return newBasicCommonValidator( - "", + nil, // located by the item index, set on each Validate call i.in, i.items.Default, i.items.Enum, @@ -140,7 +139,7 @@ func (i *itemsValidator) commonValidator() valueValidator { func (i *itemsValidator) sliceValidator() valueValidator { return newBasicSliceValidator( - "", + nil, // located by the item index, set on each Validate call i.in, i.items.Default, i.items.MaxItems, @@ -155,7 +154,7 @@ func (i *itemsValidator) sliceValidator() valueValidator { func (i *itemsValidator) numberValidator() valueValidator { return newNumberValidator( - "", + nil, // located by the item index, set on each Validate call i.in, i.items.Default, i.items.MultipleOf, @@ -171,7 +170,7 @@ func (i *itemsValidator) numberValidator() valueValidator { func (i *itemsValidator) stringValidator() valueValidator { return newStringValidator( - "", + nil, // located by the item index, set on each Validate call i.in, i.items.Default, false, // Required @@ -185,7 +184,7 @@ func (i *itemsValidator) stringValidator() valueValidator { func (i *itemsValidator) formatValidator() valueValidator { return newFormatValidator( - "", + nil, // located by the item index, set on each Validate call i.in, i.items.Format, i.KnownFormats, @@ -194,7 +193,7 @@ func (i *itemsValidator) formatValidator() valueValidator { } func (i *itemsValidator) redeem() { - pools.poolOfItemsValidators.RedeemValidator(i) + validatorPools.itemsValidators.Redeem(i) } func (i *itemsValidator) redeemChildren() { @@ -213,21 +212,21 @@ func (i *itemsValidator) redeemChildren() { } type basicCommonValidator struct { - Path string + Path pathSegments In string Default any Enum []any Options *SchemaValidatorOptions } -func newBasicCommonValidator(path, in string, def any, enum []any, opts *SchemaValidatorOptions) *basicCommonValidator { +func newBasicCommonValidator(path pathSegments, in string, def any, enum []any, opts *SchemaValidatorOptions) *basicCommonValidator { if opts == nil { opts = new(SchemaValidatorOptions) } var b *basicCommonValidator if opts.recycleValidators { - b = pools.poolOfBasicCommonValidators.BorrowValidator() + b = validatorPools.basicCommonValidators.Borrow() } else { b = new(basicCommonValidator) } @@ -241,10 +240,6 @@ func newBasicCommonValidator(path, in string, def any, enum []any, opts *SchemaV return b } -func (b *basicCommonValidator) SetPath(path string) { - b.Path = path -} - func (b *basicCommonValidator) Applies(source any, _ reflect.Kind) bool { switch source.(type) { case *spec.Parameter, *spec.Schema, *spec.Header: @@ -279,11 +274,15 @@ func (b *basicCommonValidator) Validate(data any) (res *Result) { } } - return errorHelp.sErr(errors.EnumFail(b.Path, b.In, data, b.Enum), b.Options.recycleResult) + return errorHelp.sErrAt(b.Path, errors.EnumFail(b.Path.dotted(), b.In, data, b.Enum), b.Options.recycleResult) +} + +func (b *basicCommonValidator) setPath(path pathSegments) { + b.Path = path } func (b *basicCommonValidator) redeem() { - pools.poolOfBasicCommonValidators.RedeemValidator(b) + validatorPools.basicCommonValidators.Redeem(b) } // A HeaderValidator has very limited subset of validations to apply. @@ -312,7 +311,7 @@ func newHeaderValidator(name string, header *spec.Header, formats strfmt.Registr var p *HeaderValidator if opts.recycleValidators { - p = pools.poolOfHeaderValidators.BorrowValidator() + p = validatorPools.headerValidators.Borrow() } else { p = new(HeaderValidator) } @@ -323,7 +322,7 @@ func newHeaderValidator(name string, header *spec.Header, formats strfmt.Registr p.Options = opts p.validators = [6]valueValidator{ newTypeValidator( - name, + newPathSegments(name), "header", spec.StringOrArray([]string{header.Type}), header.Nullable, @@ -355,7 +354,7 @@ func (p *HeaderValidator) Validate(data any) *Result { var result *Result if p.Options.recycleResult { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() } else { result = new(Result) } @@ -397,7 +396,7 @@ func (p *HeaderValidator) Validate(data any) *Result { func (p *HeaderValidator) commonValidator() valueValidator { return newBasicCommonValidator( - p.name, + newPathSegments(p.name), "response", p.header.Default, p.header.Enum, @@ -407,7 +406,7 @@ func (p *HeaderValidator) commonValidator() valueValidator { func (p *HeaderValidator) sliceValidator() valueValidator { return newBasicSliceValidator( - p.name, + newPathSegments(p.name), "response", p.header.Default, p.header.MaxItems, @@ -422,7 +421,7 @@ func (p *HeaderValidator) sliceValidator() valueValidator { func (p *HeaderValidator) numberValidator() valueValidator { return newNumberValidator( - p.name, + newPathSegments(p.name), "response", p.header.Default, p.header.MultipleOf, @@ -438,7 +437,7 @@ func (p *HeaderValidator) numberValidator() valueValidator { func (p *HeaderValidator) stringValidator() valueValidator { return newStringValidator( - p.name, + newPathSegments(p.name), "response", p.header.Default, true, @@ -452,7 +451,7 @@ func (p *HeaderValidator) stringValidator() valueValidator { func (p *HeaderValidator) formatValidator() valueValidator { return newFormatValidator( - p.name, + newPathSegments(p.name), "response", p.header.Format, p.KnownFormats, @@ -461,7 +460,7 @@ func (p *HeaderValidator) formatValidator() valueValidator { } func (p *HeaderValidator) redeem() { - pools.poolOfHeaderValidators.RedeemValidator(p) + validatorPools.headerValidators.Redeem(p) } func (p *HeaderValidator) redeemChildren() { @@ -504,7 +503,7 @@ func newParamValidator(param *spec.Parameter, formats strfmt.Registry, opts *Sch var p *ParamValidator if opts.recycleValidators { - p = pools.poolOfParamValidators.BorrowValidator() + p = validatorPools.paramValidators.Borrow() } else { p = new(ParamValidator) } @@ -514,7 +513,7 @@ func newParamValidator(param *spec.Parameter, formats strfmt.Registry, opts *Sch p.Options = opts p.validators = [6]valueValidator{ newTypeValidator( - param.Name, + newPathSegments(param.Name), param.In, spec.StringOrArray([]string{param.Type}), param.Nullable, @@ -539,7 +538,7 @@ func (p *ParamValidator) Validate(data any) *Result { var result *Result if p.Options.recycleResult { - result = pools.poolOfResults.BorrowResult() + result = validatorPools.results.Borrow() } else { result = new(Result) } @@ -589,7 +588,7 @@ func (p *ParamValidator) Validate(data any) *Result { func (p *ParamValidator) commonValidator() valueValidator { return newBasicCommonValidator( - p.param.Name, + newPathSegments(p.param.Name), p.param.In, p.param.Default, p.param.Enum, @@ -599,7 +598,7 @@ func (p *ParamValidator) commonValidator() valueValidator { func (p *ParamValidator) sliceValidator() valueValidator { return newBasicSliceValidator( - p.param.Name, + newPathSegments(p.param.Name), p.param.In, p.param.Default, p.param.MaxItems, @@ -614,7 +613,7 @@ func (p *ParamValidator) sliceValidator() valueValidator { func (p *ParamValidator) numberValidator() valueValidator { return newNumberValidator( - p.param.Name, + newPathSegments(p.param.Name), p.param.In, p.param.Default, p.param.MultipleOf, @@ -630,7 +629,7 @@ func (p *ParamValidator) numberValidator() valueValidator { func (p *ParamValidator) stringValidator() valueValidator { return newStringValidator( - p.param.Name, + newPathSegments(p.param.Name), p.param.In, p.param.Default, p.param.Required, @@ -644,7 +643,7 @@ func (p *ParamValidator) stringValidator() valueValidator { func (p *ParamValidator) formatValidator() valueValidator { return newFormatValidator( - p.param.Name, + newPathSegments(p.param.Name), p.param.In, p.param.Format, p.KnownFormats, @@ -653,7 +652,7 @@ func (p *ParamValidator) formatValidator() valueValidator { } func (p *ParamValidator) redeem() { - pools.poolOfParamValidators.RedeemValidator(p) + validatorPools.paramValidators.Redeem(p) } func (p *ParamValidator) redeemChildren() { @@ -672,7 +671,7 @@ func (p *ParamValidator) redeemChildren() { } type basicSliceValidator struct { - Path string + Path pathSegments In string Default any MaxItems *int64 @@ -685,7 +684,7 @@ type basicSliceValidator struct { } func newBasicSliceValidator( - path, in string, + path pathSegments, in string, def any, maxItems, minItems *int64, uniqueItems bool, items *spec.Items, source any, formats strfmt.Registry, opts *SchemaValidatorOptions, @@ -696,7 +695,7 @@ func newBasicSliceValidator( var s *basicSliceValidator if opts.recycleValidators { - s = pools.poolOfBasicSliceValidators.BorrowValidator() + s = validatorPools.basicSliceValidators.Borrow() } else { s = new(basicSliceValidator) } @@ -715,10 +714,6 @@ func newBasicSliceValidator( return s } -func (s *basicSliceValidator) SetPath(path string) { - s.Path = path -} - func (s *basicSliceValidator) Applies(source any, kind reflect.Kind) bool { switch source.(type) { case *spec.Parameter, *spec.Items, *spec.Header: @@ -738,20 +733,20 @@ func (s *basicSliceValidator) Validate(data any) *Result { size := int64(val.Len()) if s.MinItems != nil { - if err := MinItems(s.Path, s.In, size, *s.MinItems); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := MinItems(s.Path.dotted(), s.In, size, *s.MinItems); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } if s.MaxItems != nil { - if err := MaxItems(s.Path, s.In, size, *s.MaxItems); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := MaxItems(s.Path.dotted(), s.In, size, *s.MaxItems); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } if s.UniqueItems { - if err := UniqueItems(s.Path, s.In, data); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := UniqueItems(s.Path.dotted(), s.In, data); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } @@ -767,7 +762,7 @@ func (s *basicSliceValidator) Validate(data any) *Result { return err } if err.wantsRedeemOnMerge { - pools.poolOfResults.RedeemResult(err) + redeemResult(err) } } } @@ -775,12 +770,16 @@ func (s *basicSliceValidator) Validate(data any) *Result { return nil } +func (s *basicSliceValidator) setPath(path pathSegments) { + s.Path = path +} + func (s *basicSliceValidator) redeem() { - pools.poolOfBasicSliceValidators.RedeemValidator(s) + validatorPools.basicSliceValidators.Redeem(s) } type numberValidator struct { - Path string + Path pathSegments In string Default any MultipleOf *float64 @@ -795,7 +794,7 @@ type numberValidator struct { } func newNumberValidator( - path, in string, def any, + path pathSegments, in string, def any, multipleOf, maximum *float64, exclusiveMaximum bool, minimum *float64, exclusiveMinimum bool, typ, format string, opts *SchemaValidatorOptions, @@ -806,7 +805,7 @@ func newNumberValidator( var n *numberValidator if opts.recycleValidators { - n = pools.poolOfNumberValidators.BorrowValidator() + n = validatorPools.numberValidators.Borrow() } else { n = new(numberValidator) } @@ -826,10 +825,6 @@ func newNumberValidator( return n } -func (n *numberValidator) SetPath(path string) { - n.Path = path -} - func (n *numberValidator) Applies(source any, kind reflect.Kind) bool { switch source.(type) { case *spec.Parameter, *spec.Schema, *spec.Items, *spec.Header: @@ -871,7 +866,7 @@ func (n *numberValidator) Validate(val any) *Result { var res, resMultiple, resMinimum, resMaximum *Result if n.Options.recycleResult { - res = pools.poolOfResults.BorrowResult() + res = validatorPools.results.Borrow() } else { res = new(Result) } @@ -881,58 +876,58 @@ func (n *numberValidator) Validate(val any) *Result { data := valueHelp.asFloat64(val) // Is the provided value within the range of the specified numeric type and format? - res.AddErrors(IsValueValidAgainstRange(val, n.Type, n.Format, "Checked", n.Path)) + res.addErrorsAt(n.Path, IsValueValidAgainstRange(val, n.Type, n.Format, "Checked", n.Path.dotted())) if n.MultipleOf != nil { - resMultiple = pools.poolOfResults.BorrowResult() + resMultiple = validatorPools.results.Borrow() // Is the constraint specifier within the range of the specific numeric type and format? - resMultiple.AddErrors(IsValueValidAgainstRange(*n.MultipleOf, n.Type, n.Format, "MultipleOf", n.Path)) + resMultiple.addErrorsAt(n.Path, IsValueValidAgainstRange(*n.MultipleOf, n.Type, n.Format, "MultipleOf", n.Path.dotted())) if resMultiple.IsValid() { // Constraint validated with compatible types - if err := MultipleOfNativeType(n.Path, n.In, val, *n.MultipleOf); err != nil { - resMultiple.Merge(errorHelp.sErr(err, n.Options.recycleResult)) + if err := MultipleOfNativeType(n.Path.dotted(), n.In, val, *n.MultipleOf); err != nil { + resMultiple.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult)) } } else { // Constraint nevertheless validated, converted as general number - if err := MultipleOf(n.Path, n.In, data, *n.MultipleOf); err != nil { - resMultiple.Merge(errorHelp.sErr(err, n.Options.recycleResult)) + if err := MultipleOf(n.Path.dotted(), n.In, data, *n.MultipleOf); err != nil { + resMultiple.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult)) } } } if n.Maximum != nil { - resMaximum = pools.poolOfResults.BorrowResult() + resMaximum = validatorPools.results.Borrow() // Is the constraint specifier within the range of the specific numeric type and format? - resMaximum.AddErrors(IsValueValidAgainstRange(*n.Maximum, n.Type, n.Format, "Maximum boundary", n.Path)) + resMaximum.addErrorsAt(n.Path, IsValueValidAgainstRange(*n.Maximum, n.Type, n.Format, "Maximum boundary", n.Path.dotted())) if resMaximum.IsValid() { // Constraint validated with compatible types - if err := MaximumNativeType(n.Path, n.In, val, *n.Maximum, n.ExclusiveMaximum); err != nil { - resMaximum.Merge(errorHelp.sErr(err, n.Options.recycleResult)) + if err := MaximumNativeType(n.Path.dotted(), n.In, val, *n.Maximum, n.ExclusiveMaximum); err != nil { + resMaximum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult)) } } else { // Constraint nevertheless validated, converted as general number - if err := Maximum(n.Path, n.In, data, *n.Maximum, n.ExclusiveMaximum); err != nil { - resMaximum.Merge(errorHelp.sErr(err, n.Options.recycleResult)) + if err := Maximum(n.Path.dotted(), n.In, data, *n.Maximum, n.ExclusiveMaximum); err != nil { + resMaximum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult)) } } } if n.Minimum != nil { - resMinimum = pools.poolOfResults.BorrowResult() + resMinimum = validatorPools.results.Borrow() // Is the constraint specifier within the range of the specific numeric type and format? - resMinimum.AddErrors(IsValueValidAgainstRange(*n.Minimum, n.Type, n.Format, "Minimum boundary", n.Path)) + resMinimum.addErrorsAt(n.Path, IsValueValidAgainstRange(*n.Minimum, n.Type, n.Format, "Minimum boundary", n.Path.dotted())) if resMinimum.IsValid() { // Constraint validated with compatible types - if err := MinimumNativeType(n.Path, n.In, val, *n.Minimum, n.ExclusiveMinimum); err != nil { - resMinimum.Merge(errorHelp.sErr(err, n.Options.recycleResult)) + if err := MinimumNativeType(n.Path.dotted(), n.In, val, *n.Minimum, n.ExclusiveMinimum); err != nil { + resMinimum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult)) } } else { // Constraint nevertheless validated, converted as general number - if err := Minimum(n.Path, n.In, data, *n.Minimum, n.ExclusiveMinimum); err != nil { - resMinimum.Merge(errorHelp.sErr(err, n.Options.recycleResult)) + if err := Minimum(n.Path.dotted(), n.In, data, *n.Minimum, n.ExclusiveMinimum); err != nil { + resMinimum.Merge(errorHelp.sErrAt(n.Path, err, n.Options.recycleResult)) } } } @@ -942,12 +937,16 @@ func (n *numberValidator) Validate(val any) *Result { return res } +func (n *numberValidator) setPath(path pathSegments) { + n.Path = path +} + func (n *numberValidator) redeem() { - pools.poolOfNumberValidators.RedeemValidator(n) + validatorPools.numberValidators.Redeem(n) } type stringValidator struct { - Path string + Path pathSegments In string Default any Required bool @@ -959,7 +958,7 @@ type stringValidator struct { } func newStringValidator( - path, in string, + path pathSegments, in string, def any, required, allowEmpty bool, maxLength, minLength *int64, pattern string, opts *SchemaValidatorOptions, ) *stringValidator { @@ -969,7 +968,7 @@ func newStringValidator( var s *stringValidator if opts.recycleValidators { - s = pools.poolOfStringValidators.BorrowValidator() + s = validatorPools.stringValidators.Borrow() } else { s = new(stringValidator) } @@ -987,10 +986,6 @@ func newStringValidator( return s } -func (s *stringValidator) SetPath(path string) { - s.Path = path -} - func (s *stringValidator) Applies(source any, kind reflect.Kind) bool { switch source.(type) { case *spec.Parameter, *spec.Schema, *spec.Items, *spec.Header: @@ -1009,35 +1004,39 @@ func (s *stringValidator) Validate(val any) *Result { data, ok := val.(string) if !ok { - return errorHelp.sErr(errors.InvalidType(s.Path, s.In, stringType, val), s.Options.recycleResult) + return errorHelp.sErrAt(s.Path, errors.InvalidType(s.Path.dotted(), s.In, stringType, val), s.Options.recycleResult) } if s.Required && !s.AllowEmptyValue && (s.Default == nil || s.Default == "") { - if err := RequiredString(s.Path, s.In, data); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := RequiredString(s.Path.dotted(), s.In, data); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } if s.MaxLength != nil { - if err := MaxLength(s.Path, s.In, data, *s.MaxLength); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := MaxLength(s.Path.dotted(), s.In, data, *s.MaxLength); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } if s.MinLength != nil { - if err := MinLength(s.Path, s.In, data, *s.MinLength); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := MinLength(s.Path.dotted(), s.In, data, *s.MinLength); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } if s.Pattern != "" { - if err := Pattern(s.Path, s.In, data, s.Pattern); err != nil { - return errorHelp.sErr(err, s.Options.recycleResult) + if err := Pattern(s.Path.dotted(), s.In, data, s.Pattern); err != nil { + return errorHelp.sErrAt(s.Path, err, s.Options.recycleResult) } } return nil } +func (s *stringValidator) setPath(path pathSegments) { + s.Path = path +} + func (s *stringValidator) redeem() { - pools.poolOfStringValidators.RedeemValidator(s) + validatorPools.stringValidators.Redeem(s) } diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml index 645c7e6af..8a7f1ec5d 100644 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -96,9 +96,9 @@ linters: - "!**/exporters/zipkin/**" deny: - pkg: go.opentelemetry.io/otel/semconv - desc: "Use go.opentelemetry.io/otel/semconv/v1.41.0 instead. If a newer semconv version has been released, update the depguard rule." + desc: "Use go.opentelemetry.io/otel/semconv/v1.43.0 instead. If a newer semconv version has been released, update the depguard rule." allow: - - go.opentelemetry.io/otel/semconv/v1.41.0 + - go.opentelemetry.io/otel/semconv/v1.43.0 gocritic: disabled-checks: - appendAssign diff --git a/vendor/go.opentelemetry.io/otel/.lycheeignore b/vendor/go.opentelemetry.io/otel/.lycheeignore index 994b677df..df0d328bf 100644 --- a/vendor/go.opentelemetry.io/otel/.lycheeignore +++ b/vendor/go.opentelemetry.io/otel/.lycheeignore @@ -11,3 +11,17 @@ http://4.3.2.1:78/user/123 file:///home/runner/work/opentelemetry-go/opentelemetry-go/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/dns:/:4317 # URL works, but it has blocked link checkers. https://dl.acm.org/doi/10.1145/198429.198435 +https://pkg.go.dev/google.golang.org/grpc.*internal/resolver +https://golang.org/src/crypto/tls/generate_cert.go +https://github.com/grpc/grpc/blob/.*/doc/naming.md +https://github.com/open-telemetry/opentelemetry-specification/blob/.* +# Fake domains used in otlp options_test.go tests +https?://env\.endpoint.* +https?://env\.metrics\.endpoint.* +https?://env_metrics_endpoint.* +https?://env\.traces\.endpoint.* +https?://env_traces_endpoint.* +https?://someendpoint.* +https?://overrode\.by\.signal\.specific.* +https?://overrode_by_signal_specific.* +https?://proxy\.com.* diff --git a/vendor/go.opentelemetry.io/otel/AGENTS.md b/vendor/go.opentelemetry.io/otel/AGENTS.md index 26c0fc4dd..02db71528 100644 --- a/vendor/go.opentelemetry.io/otel/AGENTS.md +++ b/vendor/go.opentelemetry.io/otel/AGENTS.md @@ -47,6 +47,9 @@ For docs-only, test-only, or review-only tasks, still start with the required re - Prefer examples over long code snippets in GoDoc when practical. - Keep docs aligned with actual behavior. Do not leave stale comments, stale examples, or stale package documentation behind. - For user-visible changes, update `CHANGELOG.md` under the appropriate `Added`, `Changed`, `Deprecated`, `Fixed`, or `Removed` section within `## [Unreleased]`. + - Always put the PR number at the end of the line (e.g., `(#1234)`), NOT the issue number. + - If the PR number is not yet known, omit it until the PR is created, then update the changelog entry before merging. + - Always use references to the go module that is updated (e.g., `go.opentelemetry.io/otel/sdk/metric`), instead of just the path (e.g., `sdk/metric`). ## Repository habits diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index 6a90451f5..2db588ea2 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -11,6 +11,75 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## [1.45.0/0.67.0/0.21.0/0.0.18] - 2026-08-03 + +### Added + +- Add experimental observability metrics to `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log`. (#7124) +- Add the experimental `WithUnsafeAttributes` no-copy attribute option to `go.opentelemetry.io/otel/metric/x` for future performance improvements. This API is a work in progress. (#8251) +- Add `Map` and `MapValue` functions for the new `MAP` attribute type in `go.opentelemetry.io/otel/attribute`. (#8445) +- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#8453) +- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlplog`. (#8453) +- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#8453) +- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/zipkin`. (#8453) +- Apply `AttributeValueLengthLimit` recursively to values contained in `attribute.MAP` attributes in `go.opentelemetry.io/otel/sdk/trace`. (#8454) +- Remove duplicate keys from `attribute.MAP` values in `go.opentelemetry.io/otel/sdk/resource` using last-value-wins semantics. (#8471) +- Remove duplicate keys by default from `attribute.MAP` values in instrumentation scope attributes in `go.opentelemetry.io/otel/sdk/log` using last-value-wins semantics. (#8471) +- Remove duplicate keys by default from `attribute.MAP` values in span, event, link, and instrumentation scope attributes in `go.opentelemetry.io/otel/sdk/trace` using last-value-wins semantics. (#8471) +- Remove duplicate keys by default from `attribute.MAP` values in measurement and instrumentation scope attributes in `go.opentelemetry.io/otel/sdk/metric` using last-value-wins semantics. (#8471) +- Extend `WithAllowKeyDuplication` in `go.opentelemetry.io/otel/sdk/log` to disable duplicate-key removal in `attribute.MAP` values for instrumentation scope attributes. (#8471) +- Add the `go.opentelemetry.io/otel/semconv/v1.42.0` package. + The package contains semantic conventions from the `v1.42.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.42.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.41.0`. (#8484) +- Add `WithoutPanicRecording` as a `TracerProviderOption` in `go.opentelemetry.io/otel/sdk/trace` to disable exception event recording for panics. (#8532) +- Add the `go.opentelemetry.io/otel/semconv/v1.43.0` package. + The package contains semantic conventions from the `v1.43.0` version of the OpenTelemetry Semantic Conventions. + See the [migration documentation](./semconv/v1.43.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.42.0`. (#8628) + +### Changed + +- `HistogramReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` now uses a time-unbiased sampling algorithm for exemplars. (#8306) +- ⚠️ **Breaking Change:** Use `go.opentelemetry.io/otel/attribute.Value` and `go.opentelemetry.io/otel/attribute.KeyValue` for log bodies and attributes in `go.opentelemetry.io/otel/log`, `go.opentelemetry.io/otel/log/logtest`, `go.opentelemetry.io/otel/sdk/log`, and `go.opentelemetry.io/otel/sdk/log/logtest`. (#8490) +- Encode log bodies and attributes as `go.opentelemetry.io/otel/attribute.Value` JSON in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#8490) +- Improve the performance of hashing `BOOLSLICE`, `INT64SLICE`, `FLOAT64SLICE`, and `STRINGSLICE` attribute values by avoiding reflection for short slices in `go.opentelemetry.io/otel/attribute`. (#8511) +- ⚠️ **Breaking Change:** `WithEndpointURL` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` no longer appends the default signal path when an endpoint URL has no path, making the behavior consistent with `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and with setting the endpoint through `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`. If the URL has no path component, the root path (`/`) is used. Use `WithEndpointURL(url.JoinPath(endpoint, "/v1/metrics"))` to preserve the previous behavior. (#8538) +- ⚠️ **Breaking Change:** `WithEndpointURL` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` no longer appends the default signal path when an endpoint URL has no path, making the behavior consistent with `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and with setting the endpoint through `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`. If the URL has no path component, the root path (`/`) is used. Use `WithEndpointURL(url.JoinPath(endpoint, "/v1/traces"))` to preserve the previous behavior. (#8538) + +### Deprecated + +- Deprecate `WithExportBufferSize` in `go.opentelemetry.io/otel/sdk/log`. The option remains available for source compatibility but no longer affects behavior; `BatchProcessor` no longer maintains a separate export-request buffer. (#8620) + +### Removed + +- ⚠️ **Breaking Change:** Remove `Kind`, `Value`, `KeyValue`, their constructors, and attribute conversion helpers from `go.opentelemetry.io/otel/log`. (#8490) +- ⚠️ **Breaking Change:** Remove the `AttributeValueLengthLimit` and `AttributeCountLimit` fields from `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest`; records produced by the factory now keep attribute limits disabled so test code can append exact attributes. (#8556) + +### Fixed + +- Apply TLS certificates configured through environment variables to gRPC connections in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. +- Prevent panics in `go.opentelemetry.io/otel/bridge/opentracing` when OpenTracing baggage is propagated concurrently with `Span.SetBaggageItem`. +- Fix an off-by-one error in `FixedSizeReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` that prevented the first exemplar from being sampled after the reservoir was filled. (#8309) +- Interpret HTTP `Retry-After` header values as seconds instead of nanoseconds when retrying OTLP HTTP exports in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8383) +- Fix a memory leak in the `Reservoir` implementation in `go.opentelemetry.io/otel/sdk/metric/exemplar`, where storing the full `context.Context` pinned large objects such as gRPC transport buffers. (#8389) +- Prevent a non-empty attribute set whose computed hash is zero from collapsing to an empty set in `go.opentelemetry.io/otel/attribute`. (#8402) +- Fix histogram data point reuse in `go.opentelemetry.io/otel/sdk/metric` aggregation to avoid leaking stale sum, minimum, and maximum values when they are disabled in subsequent collections. (#8403) +- Avoid preallocating scope attributes when they are disabled in `go.opentelemetry.io/otel/exporters/prometheus`. (#8404) +- Support HTTP-date values in the HTTP `Retry-After` header when retrying OTLP HTTP exports in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8417) +- Reduce histogram heap allocations by reusing `BucketCounts` and `Exemplars` slices across `Collect` cycles in the cumulative histogram aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#8428) +- Fix `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` self-observability to record `error.type` on the operation-duration histogram when the `exportedSpans` metric is disabled. (#8432) +- Stop including trace exporter endpoint configuration in internal logs from `go.opentelemetry.io/otel/sdk/trace`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, and `go.opentelemetry.io/otel/exporters/zipkin`. (#8438) +- Fix invalid error formatting for out-of-range JSON code values in `go.opentelemetry.io/otel/codes`. (#8497) +- Clarify in `go.opentelemetry.io/otel/log` that `Logger.Enabled` should be checked for every log emission because its result may change over time. (#8565) +- Preserve user-provided exception attributes while independently deriving missing exception message and type attributes in `go.opentelemetry.io/otel/sdk/log`. (#8566) +- Make `WithAttributeCountLimit(0)` and `OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT=0` discard all log record attributes in `go.opentelemetry.io/otel/sdk/log`. (#8570) +- Clarify that the `Record` methods of `Float64Histogram` and `Int64Histogram` in `go.opentelemetry.io/otel/metric` expect non-negative values. (#8574) +- Clarify in `go.opentelemetry.io/otel/log` that `LoggerProvider` implementations should retain an empty `Logger` name instead of replacing it with a default. (#8587) +- Ensure that the built-in processors in `go.opentelemetry.io/otel/sdk/log` call exporter `ForceFlush` during `Shutdown`. (#8599) +- Prevent processor operations in `go.opentelemetry.io/otel/sdk/log` from overlapping with processor shutdown or running after `LoggerProvider` shutdown. (#8608) +- Prevent `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` from busy-spinning under exporter backpressure and serialize dequeue, export, force-flush, and shutdown work in one worker. (#8620) +- Make `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` return errors encountered while draining records during `ForceFlush` and `Shutdown`, while continuing to attempt later batches as long as the request context remains valid. (#8620) +- Keep the default `BatchProcessor` maximum export batch size in `go.opentelemetry.io/otel/sdk/log` at or below the configured maximum queue size. (#8620) + ## [1.44.0/0.66.0/0.20.0/0.0.17] 2026-05-27 ### Added @@ -42,13 +111,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Set `OTEL_GO_X_METRIC_EXPORT_BATCH_SIZE=` to enable for all periodic readers. See `go.opentelemetry.io/otel/sdk/metric/internal/x` for feature documentation. (#8071) - Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. - Enable with `OTEL_GO_X_SELF_OBSERVABILITY=true` environment variable. + Enable with `OTEL_GO_X_OBSERVABILITY=true` environment variable. See `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/x` for feature documentation. (#8192) - Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. - Enable with `OTEL_GO_X_SELF_OBSERVABILITY=true` environment variable. + Enable with `OTEL_GO_X_OBSERVABILITY=true` environment variable. See `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/x` for feature documentation. (#8194) - Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. - Enable with `OTEL_GO_X_SELF_OBSERVABILITY=true` environment variable. + Enable with `OTEL_GO_X_OBSERVABILITY=true` environment variable. See `go.opentelemetry.io/otel/stdout/stdoutlog/internal/x` for feature documentation. (#8263) - Add `WithDefaultAttributes` to `go.opentelemetry.io/otel/metric/x` to support setting default attributes on instruments. (#8135) - Add `go.opentelemetry.io/otel/semconv/v1.41.0` package. @@ -3713,7 +3782,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.44.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.45.0...HEAD +[1.45.0/0.67.0/0.21.0/0.0.18]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.45.0 [1.44.0/0.66.0/0.20.0/0.0.17]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.44.0 [1.43.0/0.65.0/0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.43.0 [1.42.0/0.64.0/0.18.0/0.0.16]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.42.0 diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md index 3ec17d683..2aba71e19 100644 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -8,8 +8,10 @@ repo for information on this and other language SIGs. See the [public meeting notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) for a summary description of past meetings. To request edit access, -join the meeting or get in touch on -[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). +join the meeting or get in touch on the +[#otel-go](https://cloud-native.slack.com/archives/C01NPAXACKT) +channel on CNCF Slack. If you are new to the CNCF Slack community, +you can [create an account](https://slack.cncf.io/). The meeting is open for all to join. We invite everyone to join our meeting, regardless of your experience level. Whether you're a @@ -752,8 +754,8 @@ Encapsulate setup in constructor functions, ensuring clear ownership and scope: import ( "errors" - semconv "go.opentelemetry.io/otel/semconv/v1.41.0" - "go.opentelemetry.io/otel/semconv/v1.41.0/otelconv" + semconv "go.opentelemetry.io/otel/semconv/v1.43.0" + "go.opentelemetry.io/otel/semconv/v1.43.0/otelconv" ) type SDKComponent struct { @@ -1054,7 +1056,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) All observability metrics should follow the [OpenTelemetry Semantic Conventions for SDK metrics](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/otel/sdk-metrics.md). -Use the metric semantic conventions convenience package [otelconv](./semconv/v1.41.0/otelconv/metric.go). +Use the metric semantic conventions convenience package [otelconv](./semconv/v1.43.0/otelconv/metric.go). ##### Component Identification diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index de63a5e9b..d4711257d 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -10,6 +10,7 @@ ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} GO = go TIMEOUT = 60 +GO_VERSION := $(shell awk '/^go [0-9]/ {print $$2; exit}' go.mod) # User to run as in docker images. DOCKER_USER=$(shell id -u):$(shell id -g) @@ -19,7 +20,7 @@ DEPENDENCIES_DOCKERFILE=./dependencies.Dockerfile .PHONY: precommit ci precommit: generate toolchain-check license-check misspell go-mod-tidy golangci-lint-fix verify-readmes verify-mods test-default -ci: generate toolchain-check license-check lint vanity-import-check verify-readmes verify-mods build test-default check-clean-work-tree test-coverage +ci: generate toolchain-check license-check lint verify-readmes verify-mods build test-default check-clean-work-tree test-coverage # Tools @@ -59,9 +60,6 @@ $(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge STRINGER = $(TOOLS)/stringer $(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer -PORTO = $(TOOLS)/porto -$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto - GOTMPL = $(TOOLS)/gotmpl $(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl @@ -72,7 +70,7 @@ GOVULNCHECK = $(TOOLS)/govulncheck $(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck .PHONY: tools -tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(VERIFYREADMES) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(VERIFYREADMES) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) # Virtualized python tools via docker @@ -110,7 +108,7 @@ $(CODESPELL): PACKAGE=codespell # Generate .PHONY: generate -generate: go-generate vanity-import-fix +generate: go-generate .PHONY: go-generate go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) @@ -120,14 +118,10 @@ go-generate/%: $(STRINGER) $(GOTMPL) && cd $(DIR) \ && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... -.PHONY: vanity-import-fix -vanity-import-fix: $(PORTO) - @$(PORTO) --include-internal -w . - # Generate go.work file for local development. .PHONY: go-work go-work: $(CROSSLINK) - $(CROSSLINK) work --root=$(shell pwd) --go=1.22.7 + $(CROSSLINK) work --root=$(shell pwd) --go=$(GO_VERSION) # Build @@ -228,10 +222,6 @@ go-mod-tidy/%: crosslink .PHONY: lint lint: misspell go-mod-tidy golangci-lint -.PHONY: vanity-import-check -vanity-import-check: $(PORTO) - @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) - .PHONY: misspell misspell: $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md index 16a72004c..ce97e9a25 100644 --- a/vendor/go.opentelemetry.io/otel/README.md +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -113,3 +113,10 @@ All officially supported exporters for the OpenTelemetry project are contained i ## Contributing See the [contributing documentation](CONTRIBUTING.md). + +### Emeritus + +- [Alex Kats](https://github.com/akats7), Triager + +For more information about the emeritus role, see the +[community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager). diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go index eef51ebc2..c543f2ca6 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/doc.go +++ b/vendor/go.opentelemetry.io/otel/attribute/doc.go @@ -2,4 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 // Package attribute provides key and value attributes. -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go index ca186d8ac..413e7a185 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/encoder.go +++ b/vendor/go.opentelemetry.io/otel/attribute/encoder.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go index 624ebbe38..6dab64f5d 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/filter.go +++ b/vendor/go.opentelemetry.io/otel/attribute/filter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute // Filter supports removing certain attributes from attribute sets. When // the filter returns true, the attribute will be kept in the filtered diff --git a/vendor/go.opentelemetry.io/otel/attribute/hash.go b/vendor/go.opentelemetry.io/otel/attribute/hash.go index 92f39ffe7..f651eb13d 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/hash.go +++ b/vendor/go.opentelemetry.io/otel/attribute/hash.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute import ( "fmt" @@ -29,6 +29,7 @@ const ( stringSliceID uint64 = 7453010373645655387 // "[]string" (little endian) byteSliceID uint64 = 6874028470941080415 // "_[]byte_" (little endian) sliceID uint64 = 7883494272577650031 // "__slice_" (little endian) + mapID uint64 = 6872316492666199903 // "__map___" (little endian) emptyID uint64 = 7305809155345288421 // "__empty_" (little endian) ) @@ -38,7 +39,13 @@ func hashKVs(kvs []KeyValue) uint64 { for _, kv := range kvs { h = hashKV(h, kv) } - return h.Sum64() + sum := h.Sum64() + // Remap 0 to a non-zero value for non-empty input because hash == 0 is a reserved sentinel (treated as empty/invalid). + const remappedZeroHash uint64 = 1 + if sum == 0 && len(kvs) > 0 { + return remappedZeroHash + } + return sum } // hashKV returns the xxHash64 hash of kv with h as the base. @@ -64,27 +71,79 @@ func hashValue(h xxhash.Hash, v Value) xxhash.Hash { h = h.String(v.stringly) case BOOLSLICE: h = h.Uint64(boolSliceID) - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.Bool(rv.Index(i).Bool()) + switch vals := v.slice.(type) { + case [0]bool: + case [1]bool: + h = h.Bool(vals[0]) + case [2]bool: + h = h.Bool(vals[0]) + h = h.Bool(vals[1]) + case [3]bool: + h = h.Bool(vals[0]) + h = h.Bool(vals[1]) + h = h.Bool(vals[2]) + default: + rv := reflect.ValueOf(v.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Bool(rv.Index(i).Bool()) + } } case INT64SLICE: h = h.Uint64(int64SliceID) - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.Int64(rv.Index(i).Int()) + switch vals := v.slice.(type) { + case [0]int64: + case [1]int64: + h = h.Int64(vals[0]) + case [2]int64: + h = h.Int64(vals[0]) + h = h.Int64(vals[1]) + case [3]int64: + h = h.Int64(vals[0]) + h = h.Int64(vals[1]) + h = h.Int64(vals[2]) + default: + rv := reflect.ValueOf(v.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Int64(rv.Index(i).Int()) + } } case FLOAT64SLICE: h = h.Uint64(float64SliceID) - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.Float64(rv.Index(i).Float()) + switch vals := v.slice.(type) { + case [0]float64: + case [1]float64: + h = h.Float64(vals[0]) + case [2]float64: + h = h.Float64(vals[0]) + h = h.Float64(vals[1]) + case [3]float64: + h = h.Float64(vals[0]) + h = h.Float64(vals[1]) + h = h.Float64(vals[2]) + default: + rv := reflect.ValueOf(v.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Float64(rv.Index(i).Float()) + } } case STRINGSLICE: h = h.Uint64(stringSliceID) - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.String(rv.Index(i).String()) + switch vals := v.slice.(type) { + case [0]string: + case [1]string: + h = h.String(vals[0]) + case [2]string: + h = h.String(vals[0]) + h = h.String(vals[1]) + case [3]string: + h = h.String(vals[0]) + h = h.String(vals[1]) + h = h.String(vals[2]) + default: + rv := reflect.ValueOf(v.slice) + for i := 0; i < rv.Len(); i++ { + h = h.String(rv.Index(i).String()) + } } case BYTESLICE: h = h.Uint64(byteSliceID) @@ -95,21 +154,79 @@ func hashValue(h xxhash.Hash, v Value) xxhash.Hash { case [0]Value: // No values to hash, but the type identifier is still hashed above. case [1]Value: - h = hashValueSlice(h, vals[:]) + h = hashValue(h, vals[0]) case [2]Value: - h = hashValueSlice(h, vals[:]) + h = hashValue(h, vals[0]) + h = hashValue(h, vals[1]) case [3]Value: - h = hashValueSlice(h, vals[:]) + h = hashValue(h, vals[0]) + h = hashValue(h, vals[1]) + h = hashValue(h, vals[2]) case [4]Value: - h = hashValueSlice(h, vals[:]) + h = hashValue(h, vals[0]) + h = hashValue(h, vals[1]) + h = hashValue(h, vals[2]) + h = hashValue(h, vals[3]) case [5]Value: - h = hashValueSlice(h, vals[:]) + h = hashValue(h, vals[0]) + h = hashValue(h, vals[1]) + h = hashValue(h, vals[2]) + h = hashValue(h, vals[3]) + h = hashValue(h, vals[4]) default: rv := reflect.ValueOf(v.slice) for i := 0; i < rv.Len(); i++ { h = hashValue(h, rv.Index(i).Interface().(Value)) } } + case MAP: + h = h.Uint64(mapID) + switch vals := v.slice.(type) { + case [0]KeyValue: + // No values to hash, but the type identifier is still hashed above. + case [1]KeyValue: + h = h.String(string(vals[0].Key)) + h = hashValue(h, vals[0].Value) + case [2]KeyValue: + h = h.String(string(vals[0].Key)) + h = hashValue(h, vals[0].Value) + h = h.String(string(vals[1].Key)) + h = hashValue(h, vals[1].Value) + case [3]KeyValue: + h = h.String(string(vals[0].Key)) + h = hashValue(h, vals[0].Value) + h = h.String(string(vals[1].Key)) + h = hashValue(h, vals[1].Value) + h = h.String(string(vals[2].Key)) + h = hashValue(h, vals[2].Value) + case [4]KeyValue: + h = h.String(string(vals[0].Key)) + h = hashValue(h, vals[0].Value) + h = h.String(string(vals[1].Key)) + h = hashValue(h, vals[1].Value) + h = h.String(string(vals[2].Key)) + h = hashValue(h, vals[2].Value) + h = h.String(string(vals[3].Key)) + h = hashValue(h, vals[3].Value) + case [5]KeyValue: + h = h.String(string(vals[0].Key)) + h = hashValue(h, vals[0].Value) + h = h.String(string(vals[1].Key)) + h = hashValue(h, vals[1].Value) + h = h.String(string(vals[2].Key)) + h = hashValue(h, vals[2].Value) + h = h.String(string(vals[3].Key)) + h = hashValue(h, vals[3].Value) + h = h.String(string(vals[4].Key)) + h = hashValue(h, vals[4].Value) + default: + rv := reflect.ValueOf(v.slice) + for i := 0; i < rv.Len(); i++ { + kv := rv.Index(i).Interface().(KeyValue) + h = h.String(string(kv.Key)) + h = hashValue(h, kv.Value) + } + } case EMPTY: h = h.Uint64(emptyID) default: @@ -121,10 +238,3 @@ func hashValue(h xxhash.Hash, v Value) xxhash.Hash { } return h } - -func hashValueSlice(h xxhash.Hash, vals []Value) xxhash.Hash { - for _, v := range vals { - h = hashValue(h, v) - } - return h -} diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go index d9f51fa2d..ec4a5f07f 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go @@ -5,7 +5,7 @@ Package attribute provide several helper functions for some commonly used logic of processing attributes. */ -package attribute // import "go.opentelemetry.io/otel/attribute/internal" +package attribute import ( "reflect" diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go b/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go index 113a97838..c851179cc 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Package xxhash provides a wrapper around the xxhash library for attribute hashing. -package xxhash // import "go.opentelemetry.io/otel/attribute/internal/xxhash" +package xxhash import ( "encoding/binary" diff --git a/vendor/go.opentelemetry.io/otel/attribute/iterator.go b/vendor/go.opentelemetry.io/otel/attribute/iterator.go index 8df6249f0..1afd00ff0 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/iterator.go +++ b/vendor/go.opentelemetry.io/otel/attribute/iterator.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute // Iterator allows iterating over the set of attributes in order, sorted by // key. diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go index cdc7089e8..6403191c2 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/key.go +++ b/vendor/go.opentelemetry.io/otel/attribute/key.go @@ -1,16 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute // Key represents the key part in key-value pairs. It's a string. The // allowed character set in the key depends on the use of the key. type Key string -// Bool creates a KeyValue instance with a BOOL Value. +// Bool returns a [KeyValue] for a bool value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Bool(name, value). +// If creating both a key and value at the same time, use the package-level +// [Bool] function. func (k Key) Bool(v bool) KeyValue { return KeyValue{ Key: k, @@ -18,10 +18,15 @@ func (k Key) Bool(v bool) KeyValue { } } -// BoolSlice creates a KeyValue instance with a BOOLSLICE Value. +// BoolSlice returns a [KeyValue] for a []bool value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- BoolSlice(name, value). +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// If creating both a key and value at the same time, use the package-level +// [BoolSlice] function. func (k Key) BoolSlice(v []bool) KeyValue { return KeyValue{ Key: k, @@ -29,10 +34,12 @@ func (k Key) BoolSlice(v []bool) KeyValue { } } -// Int creates a KeyValue instance with an INT64 Value. +// Int returns a [KeyValue] for an int value. +// +// It is provided as a convenience for [Key.Int64]. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int(name, value). +// If creating both a key and value at the same time, use the package-level [Int] +// function. func (k Key) Int(v int) KeyValue { return KeyValue{ Key: k, @@ -40,10 +47,17 @@ func (k Key) Int(v int) KeyValue { } } -// IntSlice creates a KeyValue instance with an INT64SLICE Value. +// IntSlice returns a [KeyValue] for a []int value. +// +// It is provided as a convenience for [Key.Int64Slice]. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- IntSlice(name, value). +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// If creating both a key and value at the same time, use the package-level +// [IntSlice] function. func (k Key) IntSlice(v []int) KeyValue { return KeyValue{ Key: k, @@ -51,10 +65,10 @@ func (k Key) IntSlice(v []int) KeyValue { } } -// Int64 creates a KeyValue instance with an INT64 Value. +// Int64 returns a [KeyValue] for an int64 value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int64(name, value). +// If creating both a key and value at the same time, use the package-level +// [Int64] function. func (k Key) Int64(v int64) KeyValue { return KeyValue{ Key: k, @@ -62,10 +76,15 @@ func (k Key) Int64(v int64) KeyValue { } } -// Int64Slice creates a KeyValue instance with an INT64SLICE Value. +// Int64Slice returns a [KeyValue] for a []int64 value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int64Slice(name, value). +// If creating both a key and value at the same time, use the package-level +// [Int64Slice] function. func (k Key) Int64Slice(v []int64) KeyValue { return KeyValue{ Key: k, @@ -73,10 +92,10 @@ func (k Key) Int64Slice(v []int64) KeyValue { } } -// Float64 creates a KeyValue instance with a FLOAT64 Value. +// Float64 returns a [KeyValue] for a float64 value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Float64(name, value). +// If creating both a key and value at the same time, use the package-level +// [Float64] function. func (k Key) Float64(v float64) KeyValue { return KeyValue{ Key: k, @@ -84,10 +103,15 @@ func (k Key) Float64(v float64) KeyValue { } } -// Float64Slice creates a KeyValue instance with a FLOAT64SLICE Value. +// Float64Slice returns a [KeyValue] for a []float64 value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Float64(name, value). +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// If creating both a key and value at the same time, use the package-level +// [Float64Slice] function. func (k Key) Float64Slice(v []float64) KeyValue { return KeyValue{ Key: k, @@ -95,10 +119,10 @@ func (k Key) Float64Slice(v []float64) KeyValue { } } -// String creates a KeyValue instance with a STRING Value. +// String returns a [KeyValue] for a string value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- String(name, value). +// If creating both a key and value at the same time, use the package-level +// [String] function. func (k Key) String(v string) KeyValue { return KeyValue{ Key: k, @@ -106,10 +130,15 @@ func (k Key) String(v string) KeyValue { } } -// StringSlice creates a KeyValue instance with a STRINGSLICE Value. +// StringSlice returns a [KeyValue] for a []string value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- StringSlice(name, value). +// If creating both a key and value at the same time, use the package-level +// [StringSlice] function. func (k Key) StringSlice(v []string) KeyValue { return KeyValue{ Key: k, @@ -117,10 +146,15 @@ func (k Key) StringSlice(v []string) KeyValue { } } -// ByteSlice creates a KeyValue instance with a BYTESLICE Value. +// ByteSlice returns a [KeyValue] for a []byte value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- ByteSlice(name, value). +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// If creating both a key and value at the same time, use the package-level +// [ByteSlice] function. func (k Key) ByteSlice(v []byte) KeyValue { return KeyValue{ Key: k, @@ -128,10 +162,15 @@ func (k Key) ByteSlice(v []byte) KeyValue { } } -// Slice creates a KeyValue instance with a SLICE Value. +// Slice returns a [KeyValue] for a []Value value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Slice(name, values...). +// If creating both a key and value at the same time, use the package-level +// [Slice] function. func (k Key) Slice(v ...Value) KeyValue { return KeyValue{ Key: k, @@ -139,6 +178,27 @@ func (k Key) Slice(v ...Value) KeyValue { } } +// Map returns a [KeyValue] for a []KeyValue value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// Users should avoid providing duplicate keys; many receivers handle maps +// containing duplicate keys unpredictably. +// +// The order of v is not preserved. +// +// If creating both a key and value at the same time, use the package-level [Map] +// function. +func (k Key) Map(v ...KeyValue) KeyValue { + return KeyValue{ + Key: k, + Value: MapValue(v...), + } +} + // Defined reports whether the key is not empty. func (k Key) Defined() bool { return len(k) != 0 diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go index eeb76a134..c4f0dd928 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/kv.go +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute import ( "fmt" @@ -18,66 +18,120 @@ func (kv KeyValue) Valid() bool { return kv.Key.Defined() } -// Bool creates a KeyValue with a BOOL Value type. +// Bool returns a [KeyValue] for a bool value. func Bool(k string, v bool) KeyValue { return Key(k).Bool(v) } -// BoolSlice creates a KeyValue with a BOOLSLICE Value type. +// BoolSlice returns a [KeyValue] for a []bool value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func BoolSlice(k string, v []bool) KeyValue { return Key(k).BoolSlice(v) } -// Int creates a KeyValue with an INT64 Value type. +// Int returns a [KeyValue] for an int value. +// +// It is provided as a convenience for [Int64]. func Int(k string, v int) KeyValue { return Key(k).Int(v) } -// IntSlice creates a KeyValue with an INT64SLICE Value type. +// IntSlice returns a [KeyValue] for a []int value. +// +// It is provided as a convenience for [Int64Slice]. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func IntSlice(k string, v []int) KeyValue { return Key(k).IntSlice(v) } -// Int64 creates a KeyValue with an INT64 Value type. +// Int64 returns a [KeyValue] for an int64 value. func Int64(k string, v int64) KeyValue { return Key(k).Int64(v) } -// Int64Slice creates a KeyValue with an INT64SLICE Value type. +// Int64Slice returns a [KeyValue] for a []int64 value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func Int64Slice(k string, v []int64) KeyValue { return Key(k).Int64Slice(v) } -// Float64 creates a KeyValue with a FLOAT64 Value type. +// Float64 returns a [KeyValue] for a float64 value. func Float64(k string, v float64) KeyValue { return Key(k).Float64(v) } -// Float64Slice creates a KeyValue with a FLOAT64SLICE Value type. +// Float64Slice returns a [KeyValue] for a []float64 value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func Float64Slice(k string, v []float64) KeyValue { return Key(k).Float64Slice(v) } -// String creates a KeyValue with a STRING Value type. +// String returns a [KeyValue] for a string value. func String(k, v string) KeyValue { return Key(k).String(v) } -// StringSlice creates a KeyValue with a STRINGSLICE Value type. +// StringSlice returns a [KeyValue] for a []string value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func StringSlice(k string, v []string) KeyValue { return Key(k).StringSlice(v) } -// ByteSlice creates a KeyValue with a BYTESLICE Value type. +// ByteSlice returns a [KeyValue] for a []byte value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func ByteSlice(k string, v []byte) KeyValue { return Key(k).ByteSlice(v) } -// Slice creates a KeyValue with a SLICE Value type. +// Slice returns a [KeyValue] for a []Value value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func Slice(k string, v ...Value) KeyValue { return Key(k).Slice(v...) } +// Map returns a [KeyValue] for a []KeyValue value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// Users should avoid providing duplicate keys; many receivers handle maps +// containing duplicate keys unpredictably. +// +// The order of v is not preserved. +func Map(k string, v ...KeyValue) KeyValue { + return Key(k).Map(v...) +} + // Stringer creates a new key-value pair with a passed name and a string // value generated by the passed Stringer interface. func Stringer(k string, v fmt.Stringer) KeyValue { diff --git a/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go b/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go index 5791c6e7a..939e46f90 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go +++ b/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute import ( "math" diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go index a4b6ce81d..87d6f9620 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/set.go +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute import ( "cmp" diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go index dbc01d324..ab5da2288 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/type_string.go +++ b/vendor/go.opentelemetry.io/otel/attribute/type_string.go @@ -19,11 +19,12 @@ func _() { _ = x[STRINGSLICE-8] _ = x[BYTESLICE-9] _ = x[SLICE-10] + _ = x[MAP-11] } -const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICEBYTESLICESLICE" +const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICEBYTESLICESLICEMAP" -var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69, 78, 83} +var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69, 78, 83, 86} func (i Type) String() string { idx := int(i) - 0 diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go index 0529fefae..07a0353a1 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -1,14 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute // import "go.opentelemetry.io/otel/attribute" +package attribute import ( + "cmp" "encoding/base64" "encoding/json" "fmt" "math" "reflect" + "slices" "strconv" "strings" "unicode/utf8" @@ -18,10 +20,10 @@ import ( //go:generate stringer -type=Type -// Type describes the type of the data Value holds. +// Type describes the kind of data a [Value] holds. type Type int // nolint: revive // redefines builtin Type. -// Value represents the value part in key-value pairs. +// Value represents the value in key-value pairs. // // Note that the zero value is a valid empty value. type Value struct { @@ -32,35 +34,40 @@ type Value struct { } const ( - // EMPTY is used for a Value with no value set. + // EMPTY identifies a Value with no data. EMPTY Type = iota - // BOOL is a boolean Type Value. + // BOOL identifies a Value containing a bool. BOOL - // INT64 is a 64-bit signed integral Type Value. + // INT64 identifies a Value containing an int64. INT64 - // FLOAT64 is a 64-bit floating point Type Value. + // FLOAT64 identifies a Value containing a float64. FLOAT64 - // STRING is a string Type Value. + // STRING identifies a Value containing a string. STRING - // BOOLSLICE is a slice of booleans Type Value. + // BOOLSLICE identifies a Value containing a []bool. BOOLSLICE - // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. + // INT64SLICE identifies a Value containing a []int64. INT64SLICE - // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. + // FLOAT64SLICE identifies a Value containing a []float64. FLOAT64SLICE - // STRINGSLICE is a slice of strings Type Value. + // STRINGSLICE identifies a Value containing a []string. STRINGSLICE - // BYTESLICE is a slice of bytes Type Value. + // BYTESLICE identifies a Value containing a []byte. BYTESLICE - // SLICE is a slice of Value Type values. + // SLICE identifies a Value containing a []Value. SLICE + // MAP identifies a Value containing a []KeyValue representation of a map. + // + // Note that MAP values may contain duplicate keys if duplicate keys are + // provided when creating the value. + MAP // INVALID is used for a Value with no value set. // // Deprecated: Use EMPTY instead as an empty value is a valid value. INVALID = EMPTY ) -// BoolValue creates a BOOL Value. +// BoolValue returns a [Value] for a bool value. func BoolValue(v bool) Value { return Value{ vtype: BOOL, @@ -68,17 +75,31 @@ func BoolValue(v bool) Value { } } -// BoolSliceValue creates a BOOLSLICE Value. +// BoolSliceValue returns a [Value] for a []bool value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func BoolSliceValue(v []bool) Value { return Value{vtype: BOOLSLICE, slice: attribute.SliceValue(v)} } -// IntValue creates an INT64 Value. +// IntValue returns a [Value] for an int value. +// +// It is provided as a convenience for [Int64Value]. func IntValue(v int) Value { return Int64Value(int64(v)) } -// IntSliceValue creates an INT64SLICE Value. +// IntSliceValue returns a [Value] for a []int value. +// +// It is provided as a convenience for [Int64SliceValue]. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func IntSliceValue(v []int) Value { val := Value{vtype: INT64SLICE} @@ -104,7 +125,7 @@ func IntSliceValue(v []int) Value { return val } -// Int64Value creates an INT64 Value. +// Int64Value returns a [Value] for an int64 value. func Int64Value(v int64) Value { return Value{ vtype: INT64, @@ -112,12 +133,17 @@ func Int64Value(v int64) Value { } } -// Int64SliceValue creates an INT64SLICE Value. +// Int64SliceValue returns a [Value] for a []int64 value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func Int64SliceValue(v []int64) Value { return Value{vtype: INT64SLICE, slice: attribute.SliceValue(v)} } -// Float64Value creates a FLOAT64 Value. +// Float64Value returns a [Value] for a float64 value. func Float64Value(v float64) Value { return Value{ vtype: FLOAT64, @@ -125,12 +151,17 @@ func Float64Value(v float64) Value { } } -// Float64SliceValue creates a FLOAT64SLICE Value. +// Float64SliceValue returns a [Value] for a []float64 value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func Float64SliceValue(v []float64) Value { return Value{vtype: FLOAT64SLICE, slice: attribute.SliceValue(v)} } -// StringValue creates a STRING Value. +// StringValue returns a [Value] for a string value. func StringValue(v string) Value { return Value{ vtype: STRING, @@ -138,12 +169,22 @@ func StringValue(v string) Value { } } -// StringSliceValue creates a STRINGSLICE Value. +// StringSliceValue returns a [Value] for a []string value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func StringSliceValue(v []string) Value { return Value{vtype: STRINGSLICE, slice: attribute.SliceValue(v)} } -// ByteSliceValue creates a BYTESLICE Value. +// ByteSliceValue returns a [Value] for a []byte value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func ByteSliceValue(v []byte) Value { return Value{ vtype: BYTESLICE, @@ -151,12 +192,32 @@ func ByteSliceValue(v []byte) Value { } } -// SliceValue creates a SLICE Value. +// SliceValue returns a [Value] for a []Value value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. func SliceValue(v ...Value) Value { return Value{vtype: SLICE, slice: sliceValue(v)} } -// Type returns a type of the Value. +// MapValue returns a [Value] for a []KeyValue value. +// +// Note that many observability backends are not optimized to query, index, or +// aggregate complex attribute values. Complex values may also carry +// additional performance overhead. Prefer primitive values when +// possible. +// +// Users should avoid providing duplicate keys; many receivers handle maps +// containing duplicate keys unpredictably. +// +// The order of v is not preserved. +func MapValue(v ...KeyValue) Value { + return Value{vtype: MAP, slice: mapValue(v)} +} + +// Type returns v's type. func (v Value) Type() Type { return v.vtype } @@ -277,6 +338,53 @@ func asValueSliceReflect(v any) []Value { return cpy } +// AsMap returns the []KeyValue value. Make sure that the Value's type is +// MAP. +// +// The returned slice is sorted by key and may differ from the order +// provided when creating the map value. +// +// The returned slice may contain duplicate keys if duplicate keys were +// provided when creating the map value. Callers should not assume the returned +// keys are unique. +func (v Value) AsMap() []KeyValue { + if v.vtype != MAP { + return nil + } + return v.asMap() +} + +func (v Value) asMap() []KeyValue { + switch vals := v.slice.(type) { + case [0]KeyValue: + return []KeyValue{} + case [1]KeyValue: + return []KeyValue{vals[0]} + case [2]KeyValue: + return []KeyValue{vals[0], vals[1]} + case [3]KeyValue: + return []KeyValue{vals[0], vals[1], vals[2]} + case [4]KeyValue: + return []KeyValue{vals[0], vals[1], vals[2], vals[3]} + case [5]KeyValue: + return []KeyValue{vals[0], vals[1], vals[2], vals[3], vals[4]} + default: + return asKeyValueSliceReflect(v.slice) + } +} + +func asKeyValueSliceReflect(v any) []KeyValue { + rv := reflect.ValueOf(v) + if !rv.IsValid() || rv.Kind() != reflect.Array || rv.Type().Elem() != reflect.TypeFor[KeyValue]() { + return nil + } + cpy := make([]KeyValue, rv.Len()) + if len(cpy) > 0 { + _ = reflect.Copy(reflect.ValueOf(cpy), rv) + } + return cpy +} + // AsByteSlice returns the bytes value. Make sure that the Value's type // is BYTESLICE. func (v Value) AsByteSlice() []byte { @@ -315,6 +423,8 @@ func (v Value) AsInterface() any { return v.asByteSlice() case SLICE: return v.asSlice() + case MAP: + return v.asMap() case EMPTY: return nil } @@ -327,10 +437,10 @@ func (v Value) AsInterface() any { // Strings are returned as-is without JSON quoting, booleans and integers use // JSON literals, floating-point values use JSON numbers except that NaN and // ±Inf are rendered as NaN, Infinity, and -Infinity, byte slices are -// base64-encoded, empty values are the empty string, and slices are encoded as -// JSON arrays. String, byte, and special floating-point values inside arrays -// are encoded as JSON strings, and empty values inside arrays are encoded as -// null. +// base64-encoded, empty values are the empty string, slices are encoded as JSON +// arrays, and maps are encoded as JSON objects. String, byte, and special +// floating-point values inside arrays and maps are encoded as JSON strings, and +// empty values inside arrays and maps are encoded as null. // // [OpenTelemetry AnyValue representation for non-OTLP protocols]: https://opentelemetry.io/docs/specs/otel/common/#anyvalue-representation-for-non-otlp-protocols func (v Value) String() string { @@ -355,6 +465,8 @@ func (v Value) String() string { return formatByteSlice(v.stringly) case SLICE: return formatValueSliceValue(v.slice) + case MAP: + return formatMapValue(v.slice) case EMPTY: return "" default: @@ -399,6 +511,8 @@ func (v Value) Emit() string { return formatByteSlice(v.stringly) case SLICE: return formatValueSliceValue(v.slice) + case MAP: + return formatMapValue(v.slice) case EMPTY: return "" default: @@ -439,6 +553,47 @@ func sliceValueReflect(v []Value) any { return cp.Interface() } +func mapValue(v []KeyValue) any { + switch len(v) { + case 0: + return [0]KeyValue{} + case 1: + return [1]KeyValue{v[0]} + case 2: + vals := [2]KeyValue{v[0], v[1]} + sortKeyValues(vals[:]) + return vals + case 3: + vals := [3]KeyValue{v[0], v[1], v[2]} + sortKeyValues(vals[:]) + return vals + case 4: + vals := [4]KeyValue{v[0], v[1], v[2], v[3]} + sortKeyValues(vals[:]) + return vals + case 5: + vals := [5]KeyValue{v[0], v[1], v[2], v[3], v[4]} + sortKeyValues(vals[:]) + return vals + default: + return mapValueReflect(v) + } +} + +func mapValueReflect(v []KeyValue) any { + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[KeyValue]())).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + vals := cp.Slice(0, len(v)).Interface().([]KeyValue) + sortKeyValues(vals) + return cp.Interface() +} + +func sortKeyValues(vals []KeyValue) { + slices.SortStableFunc(vals, func(a, b KeyValue) int { + return cmp.Compare(a.Key, b.Key) + }) +} + func formatBoolSliceValue(v any) string { switch vals := v.(type) { case [0]bool: @@ -807,6 +962,37 @@ func formatValueSliceReflect(v any) string { return b.String() } +func formatMapValue(v any) string { + switch vals := v.(type) { + case [0]KeyValue: + return "{}" + case [1]KeyValue: + return formatMap(vals[:]) + case [2]KeyValue: + return formatMap(vals[:]) + case [3]KeyValue: + return formatMap(vals[:]) + case [4]KeyValue: + return formatMap(vals[:]) + case [5]KeyValue: + return formatMap(vals[:]) + default: + return formatMapReflect(v) + } +} + +func formatMap(vals []KeyValue) string { + var b strings.Builder + appendMap(&b, vals) + return b.String() +} + +func formatMapReflect(v any) string { + var b strings.Builder + appendMapReflect(&b, reflect.ValueOf(v)) + return b.String() +} + func appendValueSliceValue(dst *strings.Builder, v any) { switch vals := v.(type) { case [0]Value: @@ -852,6 +1038,68 @@ func appendValueSliceReflect(dst *strings.Builder, rv reflect.Value) { _ = dst.WriteByte(']') } +func appendMapValue(dst *strings.Builder, v any) { + switch vals := v.(type) { + case [0]KeyValue: + _, _ = dst.WriteString("{}") + case [1]KeyValue: + appendMap(dst, vals[:]) + case [2]KeyValue: + appendMap(dst, vals[:]) + case [3]KeyValue: + appendMap(dst, vals[:]) + case [4]KeyValue: + appendMap(dst, vals[:]) + case [5]KeyValue: + appendMap(dst, vals[:]) + default: + appendMapReflect(dst, reflect.ValueOf(v)) + } +} + +func appendMap(dst *strings.Builder, vals []KeyValue) { + // Estimate 32 bytes per value for small values, plus key quotes, colon, + // and commas. Escaped keys and larger values grow the builder as needed. + size := len("{}") + len(vals)*commaLen + len(vals)*32 + for _, val := range vals { + size += len(val.Key) + len(`"":`) + } + + dst.Grow(size) + _ = dst.WriteByte('{') + for i, val := range vals { + if i > 0 { + _ = dst.WriteByte(',') + } + appendJSONString(dst, string(val.Key)) + _ = dst.WriteByte(':') + appendJSONValue(dst, val.Value) + } + _ = dst.WriteByte('}') +} + +func appendMapReflect(dst *strings.Builder, rv reflect.Value) { + // Estimate 32 bytes per value for small values, plus key quotes, colon, + // and commas. Escaped keys and larger values grow the builder as needed. + size := len("{}") + rv.Len()*commaLen + rv.Len()*32 + for i := 0; i < rv.Len(); i++ { + size += len(rv.Index(i).Field(0).String()) + len(`"":`) + } + + dst.Grow(size) + _ = dst.WriteByte('{') + for i := 0; i < rv.Len(); i++ { + if i > 0 { + _ = dst.WriteByte(',') + } + val := rv.Index(i).Interface().(KeyValue) + appendJSONString(dst, string(val.Key)) + _ = dst.WriteByte(':') + appendJSONValue(dst, val.Value) + } + _ = dst.WriteByte('}') +} + func appendJSONValue(dst *strings.Builder, v Value) { switch v.Type() { case BOOL: @@ -894,6 +1142,8 @@ func appendJSONValue(dst *strings.Builder, v Value) { _ = dst.WriteByte('"') case SLICE: appendValueSliceValue(dst, v.slice) + case MAP: + appendMapValue(dst, v.slice) case EMPTY: _, _ = dst.WriteString("null") default: diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go index b290c6d6c..25c739d08 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package baggage // import "go.opentelemetry.io/otel/baggage" +package baggage import ( "errors" diff --git a/vendor/go.opentelemetry.io/otel/baggage/context.go b/vendor/go.opentelemetry.io/otel/baggage/context.go index a572461a0..4d09b59aa 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/context.go +++ b/vendor/go.opentelemetry.io/otel/baggage/context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package baggage // import "go.opentelemetry.io/otel/baggage" +package baggage import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go index b51d87cab..74d3a8709 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/doc.go +++ b/vendor/go.opentelemetry.io/otel/baggage/doc.go @@ -6,4 +6,4 @@ Package baggage provides functionality for storing and retrieving baggage items in Go context. For propagating the baggage, see the go.opentelemetry.io/otel/propagation package. */ -package baggage // import "go.opentelemetry.io/otel/baggage" +package baggage diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go index d48847ed8..9355545a8 100644 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package codes // import "go.opentelemetry.io/otel/codes" +package codes import ( "encoding/json" @@ -81,7 +81,7 @@ func (c *Code) UnmarshalJSON(b []byte) error { case float64: if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { if ci >= maxCode { - return fmt.Errorf("invalid code: %q", ci) + return fmt.Errorf("invalid code: %d", ci) } *c = Code(ci) // nolint: gosec // Bit size of 32 check above. diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go index ee8db448b..1073f6543 100644 --- a/vendor/go.opentelemetry.io/otel/codes/doc.go +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -7,4 +7,4 @@ Package codes defines the canonical error codes used by OpenTelemetry. It conforms to [the OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). */ -package codes // import "go.opentelemetry.io/otel/codes" +package codes diff --git a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile index 74fa510bc..20eecba40 100644 --- a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile +++ b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile @@ -1,4 +1,4 @@ # This is a renovate-friendly source of Docker images. FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python -FROM otel/weaver:v0.23.0@sha256:7984ecb55b859eb3034ae9d836c4eeda137e2bdd0873b7ba2bb6c3d24d6ff457 AS weaver +FROM otel/weaver:v0.25.1@sha256:9ad46ca9cd4fa5974b121f886aa3e9946a8ef8ea905001a96c018d21f9db87ca AS weaver FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go index 921f85961..92b7a0566 100644 --- a/vendor/go.opentelemetry.io/otel/doc.go +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -22,4 +22,4 @@ To read more about logs, see go.opentelemetry.io/otel/log. To read more about propagation, see go.opentelemetry.io/otel/propagation and go.opentelemetry.io/otel/baggage. */ -package otel // import "go.opentelemetry.io/otel" +package otel diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go index 67414c71e..06fd49da2 100644 --- a/vendor/go.opentelemetry.io/otel/error_handler.go +++ b/vendor/go.opentelemetry.io/otel/error_handler.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel // ErrorHandler handles irremediable events. type ErrorHandler interface { diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go index 07623b679..1f45ea388 100644 --- a/vendor/go.opentelemetry.io/otel/handler.go +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go index b4f85f44a..cbeb14fcd 100644 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go @@ -10,7 +10,7 @@ this need this package would not need to exist and the `go.opentelemetry.io/otel/baggage` package would be the singular place where W3C baggage is handled. */ -package baggage // import "go.opentelemetry.io/otel/internal/baggage" +package baggage // List is the collection of baggage members. The W3C allows for duplicates, // but OpenTelemetry does not, therefore, this is represented as a map. diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go index 3aea9c491..f3bece165 100644 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package baggage // import "go.opentelemetry.io/otel/internal/baggage" +package baggage import "context" diff --git a/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go b/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go index 3f0ab3131..de294461c 100644 --- a/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go +++ b/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go @@ -5,7 +5,7 @@ // // This package has no OTel dependencies, allowing it to be imported by any // package in the module without creating import cycles. -package errorhandler // import "go.opentelemetry.io/otel/internal/errorhandler" +package errorhandler import ( "errors" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go index 77d0425f5..6fb8034f8 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/handler.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Package global provides the OpenTelemetry global API. -package global // import "go.opentelemetry.io/otel/internal/global" +package global import ( "go.opentelemetry.io/otel/internal/errorhandler" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go index 55255cddf..4db3fdcde 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global // import "go.opentelemetry.io/otel/internal/global" +package global import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go index 86d7f4ba0..8e1327354 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global // import "go.opentelemetry.io/otel/internal/global" +package global import ( "log" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go index 50043d669..48be49037 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/meter.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/meter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global // import "go.opentelemetry.io/otel/internal/global" +package global import ( "container/list" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go index 38560ff99..90c462ef0 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global // import "go.opentelemetry.io/otel/internal/global" +package global import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go index 225c9e501..f8fcb82bc 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/state.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/state.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global // import "go.opentelemetry.io/otel/internal/global" +package global import ( "errors" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go index bf5cf3119..45899f8c0 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/trace.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global // import "go.opentelemetry.io/otel/internal/global" +package global /* This file contains the forwarding implementation of the TracerProvider used as diff --git a/vendor/go.opentelemetry.io/otel/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal_logging.go index 6de7f2e4d..3f6b7b10d 100644 --- a/vendor/go.opentelemetry.io/otel/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal_logging.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel import ( "github.com/go-logr/logr" diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go index 527d9aec8..30dbb4118 100644 --- a/vendor/go.opentelemetry.io/otel/metric.go +++ b/vendor/go.opentelemetry.io/otel/metric.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go index 1d21e2eb7..11e5b282f 100644 --- a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go +++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go index 9d45a4d41..f5577b0c5 100644 --- a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go +++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go index 889545e23..31a5da817 100644 --- a/vendor/go.opentelemetry.io/otel/metric/config.go +++ b/vendor/go.opentelemetry.io/otel/metric/config.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "slices" diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go index 794e1a8ba..235e81f3a 100644 --- a/vendor/go.opentelemetry.io/otel/metric/doc.go +++ b/vendor/go.opentelemetry.io/otel/metric/doc.go @@ -201,4 +201,4 @@ fully implement all the API interfaces when a user updates their API. [OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ [GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ -package metric // import "go.opentelemetry.io/otel/metric" +package metric diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go index 1a9dc6809..10f361b5b 100644 --- a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go @@ -11,7 +11,7 @@ // the API package). // // [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric -package embedded // import "go.opentelemetry.io/otel/metric/embedded" +package embedded // MeterProvider is embedded in // [go.opentelemetry.io/otel/metric.MeterProvider]. diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go index 2e79ab568..e8c1c96cb 100644 --- a/vendor/go.opentelemetry.io/otel/metric/instrument.go +++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go index 5606ec4bd..70ff4c731 100644 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go index 2101f686a..2770ac2dc 100644 --- a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go +++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "context" @@ -158,6 +158,8 @@ type Float64Histogram interface { // Record adds an additional value to the distribution. // + // The incr value is expected to be non-negative. + // // Use the WithAttributeSet (or, if performance is not a concern, // the WithAttributes) option to include measurement attributes. // diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go index 425c1a0d5..c8a739c90 100644 --- a/vendor/go.opentelemetry.io/otel/metric/syncint64.go +++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric // import "go.opentelemetry.io/otel/metric" +package metric import ( "context" @@ -158,6 +158,8 @@ type Int64Histogram interface { // Record adds an additional value to the distribution. // + // The incr value is expected to be non-negative. + // // Use the WithAttributeSet (or, if performance is not a concern, // the WithAttributes) option to include measurement attributes. // diff --git a/vendor/go.opentelemetry.io/otel/propagation.go b/vendor/go.opentelemetry.io/otel/propagation.go index 2fd949733..05e9b11ce 100644 --- a/vendor/go.opentelemetry.io/otel/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go index d81b709a2..9d7ef7c89 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/baggage.go +++ b/vendor/go.opentelemetry.io/otel/propagation/baggage.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package propagation // import "go.opentelemetry.io/otel/propagation" +package propagation import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go index 33a3baf15..6e2bbbb18 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/doc.go +++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go @@ -10,4 +10,4 @@ package is the W3C Trace Context encoding (https://www.w3.org/TR/trace-context/), and W3C Baggage (https://www.w3.org/TR/baggage/). */ -package propagation // import "go.opentelemetry.io/otel/propagation" +package propagation diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go index 0a32c59aa..a3891fbe7 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package propagation // import "go.opentelemetry.io/otel/propagation" +package propagation import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go index 11f404deb..ffaa90303 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go +++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package propagation // import "go.opentelemetry.io/otel/propagation" +package propagation import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt index 7c541dee7..b2666ab48 100644 --- a/vendor/go.opentelemetry.io/otel/requirements.txt +++ b/vendor/go.opentelemetry.io/otel/requirements.txt @@ -1 +1 @@ -codespell==2.4.2 +codespell==2.4.3 diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go index 2fcab2435..d20ad49ef 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go @@ -3,7 +3,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" +package semconv import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go index 111010321..b67c64b96 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go @@ -6,4 +6,4 @@ // OpenTelemetry semantic conventions are agreed standardized naming // patterns for OpenTelemetry things. This package represents the v1.37.0 // version of the OpenTelemetry semantic conventions. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" +package semconv diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go index 267979c05..719241429 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" +package semconv import ( "reflect" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go index e67469a4f..3fe84aae0 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" +package semconv const ( // ExceptionEventName is the name of the Span event representing an exception. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go index f8a0b7044..0009b185b 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" +package semconv // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/MIGRATION.md deleted file mode 100644 index ba52cadf7..000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/MIGRATION.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Migration from v1.40.0 to v1.41.0 - -The `go.opentelemetry.io/otel/semconv/v1.41.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.40.0` with the following exceptions. - -## Removed - -The following declarations have been removed. -Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions. - -If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use. -If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case. - -- `DeploymentEnvironmentName` - -[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions -[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/README.md deleted file mode 100644 index 8353bb715..000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.41.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.41.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.41.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md new file mode 100644 index 000000000..54d8e7d70 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md @@ -0,0 +1,4 @@ + +# Migration from v1.42.0 to v1.43.0 + +The `go.opentelemetry.io/otel/semconv/v1.43.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.42.0`. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md new file mode 100644 index 000000000..20e64d795 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.43.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.43.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.43.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/attribute_group.go similarity index 90% rename from vendor/go.opentelemetry.io/otel/semconv/v1.41.0/attribute_group.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.43.0/attribute_group.go index 7cee08680..770388dfc 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/attribute_group.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/attribute_group.go @@ -3,7 +3,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0" +package semconv import "go.opentelemetry.io/otel/attribute" @@ -22,7 +22,7 @@ const ( // [Activity lifecycle callbacks], and from which the `OS identifiers` are // derived. // - // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lc + // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lifecycle-callbacks AndroidAppStateKey = attribute.Key("android.app.state") // AndroidOSAPILevelKey is the attribute Key conforming to the @@ -87,6 +87,24 @@ const ( // "9f2b833506aa6973a92fde9733e6271f", "my-app-1.0.0-code-123" AppBuildIDKey = attribute.Key("app.build_id") + // AppCrashIDKey is the attribute Key conforming to the "app.crash.id" semantic + // conventions. It represents a unique identifier representing an instance of an + // end-user facing app crash. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "083d3d2d-9a0e-47f8-be3d-bc3c5538ba38" + // Note: Its value MAY be meaningful and be used as a reference for telemetry + // and metadata recorded by + // the same instrumentation (e.g. it is an ID generated by an external source + // that captured the crash). + // It MAY come from a source external to the instrumentation such that it can be + // used to look up additional + // data from other sources as well as facilitate deduplication. + AppCrashIDKey = attribute.Key("app.crash.id") + // AppInstallationIDKey is the attribute Key conforming to the // "app.installation.id" semantic conventions. It represents a unique identifier // representing the installation of an application on a specific device. @@ -252,6 +270,13 @@ func AppBuildID(val string) attribute.KeyValue { return AppBuildIDKey.String(val) } +// AppCrashID returns an attribute KeyValue conforming to the "app.crash.id" +// semantic conventions. It represents a unique identifier representing an +// instance of an end-user facing app crash. +func AppCrashID(val string) attribute.KeyValue { + return AppCrashIDKey.String(val) +} + // AppInstallationID returns an attribute KeyValue conforming to the // "app.installation.id" semantic conventions. It represents a unique identifier // representing the installation of an application on a specific device. @@ -1744,6 +1769,19 @@ const ( // Examples: 1000, 1002 AzureCosmosDBResponseSubStatusCodeKey = attribute.Key("azure.cosmosdb.response.sub_status_code") + // AzureResourceGroupNameKey is the attribute Key conforming to the + // "azure.resource_group.name" semantic conventions. It represents the name of + // the Azure [resource group] the resource belongs to. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "my-resource-group", "rg-myapp-prod" + // + // [resource group]: https://learn.microsoft.com/azure/azure-resource-manager/management/manage-resource-groups-portal + AzureResourceGroupNameKey = attribute.Key("azure.resource_group.name") + // AzureResourceProviderNamespaceKey is the attribute Key conforming to the // "azure.resource_provider.namespace" semantic conventions. It represents the // [Azure Resource Provider Namespace] as recognized by the client. @@ -1808,6 +1846,15 @@ func AzureCosmosDBResponseSubStatusCode(val int) attribute.KeyValue { return AzureCosmosDBResponseSubStatusCodeKey.Int(val) } +// AzureResourceGroupName returns an attribute KeyValue conforming to the +// "azure.resource_group.name" semantic conventions. It represents the name of +// the Azure [resource group] the resource belongs to. +// +// [resource group]: https://learn.microsoft.com/azure/azure-resource-manager/management/manage-resource-groups-portal +func AzureResourceGroupName(val string) attribute.KeyValue { + return AzureResourceGroupNameKey.String(val) +} + // AzureResourceProviderNamespace returns an attribute KeyValue conforming to the // "azure.resource_provider.namespace" semantic conventions. It represents the // [Azure Resource Provider Namespace] as recognized by the client. @@ -1871,6 +1918,19 @@ const ( // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface BrowserBrandsKey = attribute.Key("browser.brands") + // BrowserDocumentURLFullKey is the attribute Key conforming to the + // "browser.document.url.full" semantic conventions. It represents the absolute + // URL of the current browser document according to [RFC3986]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "https://www.example.com/search?q=OpenTelemetry#SemConv" + // + // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 + BrowserDocumentURLFullKey = attribute.Key("browser.document.url.full") + // BrowserLanguageKey is the attribute Key conforming to the "browser.language" // semantic conventions. It represents the preferred language of the user using // the browser. @@ -1933,6 +1993,15 @@ func BrowserBrands(val ...string) attribute.KeyValue { return BrowserBrandsKey.StringSlice(val) } +// BrowserDocumentURLFull returns an attribute KeyValue conforming to the +// "browser.document.url.full" semantic conventions. It represents the absolute +// URL of the current browser document according to [RFC3986]. +// +// [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 +func BrowserDocumentURLFull(val string) attribute.KeyValue { + return BrowserDocumentURLFullKey.String(val) +} + // BrowserLanguage returns an attribute KeyValue conforming to the // "browser.language" semantic conventions. It represents the preferred language // of the user using the browser. @@ -2107,7 +2176,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "BUILD", "RUN", "SYNC" CICDPipelineActionNameKey = attribute.Key("cicd.pipeline.action.name") @@ -2118,7 +2187,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "Build and Test", "Lint", "Deploy Go Project", // "deploy_to_environment" @@ -2130,9 +2199,9 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // - // Examples: "success", "failure", "timeout", "skipped" + // Examples: "success", "failure", "timeout", "skip" CICDPipelineResultKey = attribute.Key("cicd.pipeline.result") // CICDPipelineRunIDKey is the attribute Key conforming to the @@ -2141,7 +2210,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "120912" CICDPipelineRunIDKey = attribute.Key("cicd.pipeline.run.id") @@ -2152,7 +2221,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "pending", "executing", "finalizing" CICDPipelineRunStateKey = attribute.Key("cicd.pipeline.run.state") @@ -2164,7 +2233,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763?pr=1075" @@ -2180,7 +2249,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "Run GoLang Linter", "Go Build", "go-test", "deploy_binary" // @@ -2193,7 +2262,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "12097" // Note: For a given pipeline run and task, the `cicd.pipeline.task.run.id` MUST @@ -2209,9 +2278,9 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // - // Examples: "success", "failure", "timeout", "skipped" + // Examples: "success", "failure", "timeout", "skip" CICDPipelineTaskRunResultKey = attribute.Key("cicd.pipeline.task.run.result") // CICDPipelineTaskRunURLFullKey is the attribute Key conforming to the @@ -2221,7 +2290,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763/job/26920038674?pr=1075" @@ -2235,52 +2304,52 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "build", "test", "deploy" CICDPipelineTaskTypeKey = attribute.Key("cicd.pipeline.task.type") // CICDSystemComponentKey is the attribute Key conforming to the // "cicd.system.component" semantic conventions. It represents the name of a - // component of the CICD system. + // component of the CI/CD system. // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "controller", "scheduler", "agent" CICDSystemComponentKey = attribute.Key("cicd.system.component") // CICDWorkerIDKey is the attribute Key conforming to the "cicd.worker.id" // semantic conventions. It represents the unique identifier of a worker within - // a CICD system. + // a CI/CD system. // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "abc123", "10.0.1.2", "controller" CICDWorkerIDKey = attribute.Key("cicd.worker.id") // CICDWorkerNameKey is the attribute Key conforming to the "cicd.worker.name" - // semantic conventions. It represents the name of a worker within a CICD + // semantic conventions. It represents the name of a worker within a CI/CD // system. // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "agent-abc", "controller", "Ubuntu LTS" CICDWorkerNameKey = attribute.Key("cicd.worker.name") // CICDWorkerStateKey is the attribute Key conforming to the "cicd.worker.state" - // semantic conventions. It represents the state of a CICD worker / agent. + // semantic conventions. It represents the state of a CI/CD worker / agent. // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // - // Examples: "idle", "busy", "down" + // Examples: "available", "busy", "offline" CICDWorkerStateKey = attribute.Key("cicd.worker.state") // CICDWorkerURLFullKey is the attribute Key conforming to the @@ -2290,7 +2359,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "https://cicd.example.org/worker/abc123" // @@ -2352,21 +2421,21 @@ func CICDPipelineTaskRunURLFull(val string) attribute.KeyValue { // CICDSystemComponent returns an attribute KeyValue conforming to the // "cicd.system.component" semantic conventions. It represents the name of a -// component of the CICD system. +// component of the CI/CD system. func CICDSystemComponent(val string) attribute.KeyValue { return CICDSystemComponentKey.String(val) } // CICDWorkerID returns an attribute KeyValue conforming to the "cicd.worker.id" // semantic conventions. It represents the unique identifier of a worker within a -// CICD system. +// CI/CD system. func CICDWorkerID(val string) attribute.KeyValue { return CICDWorkerIDKey.String(val) } // CICDWorkerName returns an attribute KeyValue conforming to the // "cicd.worker.name" semantic conventions. It represents the name of a worker -// within a CICD system. +// within a CI/CD system. func CICDWorkerName(val string) attribute.KeyValue { return CICDWorkerNameKey.String(val) } @@ -2384,39 +2453,39 @@ func CICDWorkerURLFull(val string) attribute.KeyValue { // Enum values for cicd.pipeline.action.name var ( // The pipeline run is executing a build. - // Stability: development + // Stability: release_candidate CICDPipelineActionNameBuild = CICDPipelineActionNameKey.String("BUILD") // The pipeline run is executing. - // Stability: development + // Stability: release_candidate CICDPipelineActionNameRun = CICDPipelineActionNameKey.String("RUN") // The pipeline run is executing a sync. - // Stability: development + // Stability: release_candidate CICDPipelineActionNameSync = CICDPipelineActionNameKey.String("SYNC") ) // Enum values for cicd.pipeline.result var ( // The pipeline run finished successfully. - // Stability: development + // Stability: release_candidate CICDPipelineResultSuccess = CICDPipelineResultKey.String("success") // The pipeline run did not finish successfully, eg. due to a compile error or a // failing test. Such failures are usually detected by non-zero exit codes of // the tools executed in the pipeline run. - // Stability: development + // Stability: release_candidate CICDPipelineResultFailure = CICDPipelineResultKey.String("failure") - // The pipeline run failed due to an error in the CICD system, eg. due to the + // The pipeline run failed due to an error in the CI/CD system, eg. due to the // worker being killed. - // Stability: development + // Stability: release_candidate CICDPipelineResultError = CICDPipelineResultKey.String("error") // A timeout caused the pipeline run to be interrupted. - // Stability: development + // Stability: release_candidate CICDPipelineResultTimeout = CICDPipelineResultKey.String("timeout") // The pipeline run was cancelled, eg. by a user manually cancelling the // pipeline run. - // Stability: development + // Stability: release_candidate CICDPipelineResultCancellation = CICDPipelineResultKey.String("cancellation") // The pipeline run was skipped, eg. due to a precondition not being met. - // Stability: development + // Stability: release_candidate CICDPipelineResultSkip = CICDPipelineResultKey.String("skip") ) @@ -2426,66 +2495,66 @@ var ( // the execution of the run starts (eg. time spent in a queue, provisioning // agents, creating run resources). // - // Stability: development + // Stability: release_candidate CICDPipelineRunStatePending = CICDPipelineRunStateKey.String("pending") // The executing state spans the execution of any run tasks (eg. build, test). - // Stability: development + // Stability: release_candidate CICDPipelineRunStateExecuting = CICDPipelineRunStateKey.String("executing") // The finalizing state spans from when the run has finished executing (eg. // cleanup of run resources). - // Stability: development + // Stability: release_candidate CICDPipelineRunStateFinalizing = CICDPipelineRunStateKey.String("finalizing") ) // Enum values for cicd.pipeline.task.run.result var ( // The task run finished successfully. - // Stability: development + // Stability: release_candidate CICDPipelineTaskRunResultSuccess = CICDPipelineTaskRunResultKey.String("success") // The task run did not finish successfully, eg. due to a compile error or a // failing test. Such failures are usually detected by non-zero exit codes of // the tools executed in the task run. - // Stability: development + // Stability: release_candidate CICDPipelineTaskRunResultFailure = CICDPipelineTaskRunResultKey.String("failure") - // The task run failed due to an error in the CICD system, eg. due to the worker - // being killed. - // Stability: development + // The task run failed due to an error in the CI/CD system, eg. due to the + // worker being killed. + // Stability: release_candidate CICDPipelineTaskRunResultError = CICDPipelineTaskRunResultKey.String("error") // A timeout caused the task run to be interrupted. - // Stability: development + // Stability: release_candidate CICDPipelineTaskRunResultTimeout = CICDPipelineTaskRunResultKey.String("timeout") // The task run was cancelled, eg. by a user manually cancelling the task run. - // Stability: development + // Stability: release_candidate CICDPipelineTaskRunResultCancellation = CICDPipelineTaskRunResultKey.String("cancellation") // The task run was skipped, eg. due to a precondition not being met. - // Stability: development + // Stability: release_candidate CICDPipelineTaskRunResultSkip = CICDPipelineTaskRunResultKey.String("skip") ) // Enum values for cicd.pipeline.task.type var ( // build - // Stability: development + // Stability: release_candidate CICDPipelineTaskTypeBuild = CICDPipelineTaskTypeKey.String("build") // test - // Stability: development + // Stability: release_candidate CICDPipelineTaskTypeTest = CICDPipelineTaskTypeKey.String("test") // deploy - // Stability: development + // Stability: release_candidate CICDPipelineTaskTypeDeploy = CICDPipelineTaskTypeKey.String("deploy") ) // Enum values for cicd.worker.state var ( - // The worker is not performing work for the CICD system. It is available to the - // CICD system to perform work on (online / idle). - // Stability: development + // The worker is not performing work for the CI/CD system. It is available to + // the CI/CD system to perform work on (online / idle). + // Stability: release_candidate CICDWorkerStateAvailable = CICDWorkerStateKey.String("available") - // The worker is performing work for the CICD system. - // Stability: development + // The worker is performing work for the CI/CD system. + // Stability: release_candidate CICDWorkerStateBusy = CICDWorkerStateKey.String("busy") - // The worker is not available to the CICD system (disconnected / down). - // Stability: development + // The worker is not available to the CI/CD system (disconnected / down). + // Stability: release_candidate CICDWorkerStateOffline = CICDWorkerStateKey.String("offline") ) @@ -2544,7 +2613,9 @@ const ( // RequirementLevel: Recommended // Stability: Development // - // Examples: "111111111111", "opentelemetry" + // Examples: "111111111111", "opentelemetry", + // "22222222-2222-2222-2222-222222222222" + // Note: For Azure, this is the subscription ID. CloudAccountIDKey = attribute.Key("cloud.account.id") // CloudAvailabilityZoneKey is the attribute Key conforming to the @@ -3436,7 +3507,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "a3bf90e006b2" // @@ -3472,7 +3543,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "gcr.io/opentelemetry/operator" ContainerImageNameKey = attribute.Key("container.image.name") @@ -3483,7 +3554,7 @@ const ( // // Type: string[] // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: // "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", @@ -3502,7 +3573,7 @@ const ( // // Type: string[] // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "v1.27.1", "3.5.7-0" // @@ -3691,7 +3762,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "user", "system" CPUModeKey = attribute.Key("cpu.mode") @@ -3707,29 +3778,26 @@ func CPULogicalNumber(val int) attribute.KeyValue { // Enum values for cpu.mode var ( // User - // Stability: development + // Stability: release_candidate CPUModeUser = CPUModeKey.String("user") // System - // Stability: development + // Stability: release_candidate CPUModeSystem = CPUModeKey.String("system") // Nice - // Stability: development + // Stability: release_candidate CPUModeNice = CPUModeKey.String("nice") // Idle - // Stability: development + // Stability: release_candidate CPUModeIdle = CPUModeKey.String("idle") // IO Wait - // Stability: development + // Stability: release_candidate CPUModeIOWait = CPUModeKey.String("iowait") // Interrupt - // Stability: development + // Stability: release_candidate CPUModeInterrupt = CPUModeKey.String("interrupt") // Steal - // Stability: development + // Stability: release_candidate CPUModeSteal = CPUModeKey.String("steal") - // Kernel - // Stability: development - CPUModeKernel = CPUModeKey.String("kernel") ) // Namespace: db @@ -3803,15 +3871,46 @@ const ( // DBOperationBatchSizeKey is the attribute Key conforming to the // "db.operation.batch.size" semantic conventions. It represents the number of - // queries included in a batch operation. + // database operations included in a batch operation. // // Type: int // RequirementLevel: Recommended // Stability: Stable // // Examples: 2, 3, 4 - // Note: Operations are only considered batches when they contain two or more - // operations, and so `db.operation.batch.size` SHOULD never be `1`. + // Note: Except for empty batch requests described below, a batch operation + // contains two + // or more database operations explicitly submitted as separate operations in a + // single + // client call, protocol message, or database command. + // + // Requests to batch APIs that contain only one operation SHOULD be modeled as + // single + // operations, not as batch operations. + // + // A database call is not a batch operation solely because one operation accepts + // multiple operands, such as keys, rows, documents, points, or other data + // elements, + // including Redis [`MGET`] with + // multiple keys. + // + // In batch APIs that execute the same parameterized operation with parameter + // sets, + // each parameter set represents one database operation for determining whether + // the + // request is a batch operation. Requests with only one parameter set SHOULD be + // modeled + // as single operations, not as batch operations. + // + // `db.operation.batch.size` SHOULD be set to the number of operations in the + // batch. + // It SHOULD NOT be set for non-batch operations. + // + // A request to execute a batch operation with no operations SHOULD also be + // treated + // as a batch operation, and `db.operation.batch.size` SHOULD be set to `0`. + // + // [`MGET`]: https://redis.io/docs/latest/commands/mget/ DBOperationBatchSizeKey = attribute.Key("db.operation.batch.size") // DBOperationNameKey is the attribute Key conforming to the "db.operation.name" @@ -3980,7 +4079,7 @@ func DBNamespace(val string) attribute.KeyValue { // DBOperationBatchSize returns an attribute KeyValue conforming to the // "db.operation.batch.size" semantic conventions. It represents the number of -// queries included in a batch operation. +// database operations included in a batch operation. func DBOperationBatchSize(val int) attribute.KeyValue { return DBOperationBatchSizeKey.Int(val) } @@ -4511,7 +4610,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "read" DiskIODirectionKey = attribute.Key("disk.io.direction") @@ -4520,10 +4619,10 @@ const ( // Enum values for disk.io.direction var ( // read - // Stability: development + // Stability: release_candidate DiskIODirectionRead = DiskIODirectionKey.String("read") // write - // Stability: development + // Stability: release_candidate DiskIODirectionWrite = DiskIODirectionKey.String("write") ) @@ -5496,6 +5595,45 @@ const ( // Examples: "256383" FileInodeKey = attribute.Key("file.inode") + // FileLockMechanismKey is the attribute Key conforming to the + // "file.lock.mechanism" semantic conventions. It represents the lock mechanism + // such as noted by [POSIX]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "POSIX", "FLOCK", "DELEG", "LEASE" + // + // [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html + FileLockMechanismKey = attribute.Key("file.lock.mechanism") + + // FileLockModeKey is the attribute Key conforming to the "file.lock.mode" + // semantic conventions. It represents the mode of lock or operation such as + // documented by [POSIX]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "ADVISORY", "MANDATORY", "BREAKING", "ACTIVE", "BREAKER" + // + // [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html + FileLockModeKey = attribute.Key("file.lock.mode") + + // FileLockTypeKey is the attribute Key conforming to the "file.lock.type" + // semantic conventions. It represents the lock type as represented by i.e. + // [POSIX]'s l_type. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "read" + // + // [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html + FileLockTypeKey = attribute.Key("file.lock.type") + // FileModeKey is the attribute Key conforming to the "file.mode" semantic // conventions. It represents the mode of the file in octal representation. // @@ -5652,6 +5790,24 @@ func FileInode(val string) attribute.KeyValue { return FileInodeKey.String(val) } +// FileLockMechanism returns an attribute KeyValue conforming to the +// "file.lock.mechanism" semantic conventions. It represents the lock mechanism +// such as noted by [POSIX]. +// +// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html +func FileLockMechanism(val string) attribute.KeyValue { + return FileLockMechanismKey.String(val) +} + +// FileLockMode returns an attribute KeyValue conforming to the "file.lock.mode" +// semantic conventions. It represents the mode of lock or operation such as +// documented by [POSIX]. +// +// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html +func FileLockMode(val string) attribute.KeyValue { + return FileLockModeKey.String(val) +} + // FileMode returns an attribute KeyValue conforming to the "file.mode" semantic // conventions. It represents the mode of the file in octal representation. func FileMode(val string) attribute.KeyValue { @@ -5706,6 +5862,16 @@ func FileSymbolicLinkTargetPath(val string) attribute.KeyValue { return FileSymbolicLinkTargetPathKey.String(val) } +// Enum values for file.lock.type +var ( + // read + // Stability: development + FileLockTypeRead = FileLockTypeKey.String("read") + // write + // Stability: development + FileLockTypeWrite = FileLockTypeKey.String("write") +) + // Namespace: gcp const ( // GCPAppHubApplicationContainerKey is the attribute Key conforming to the @@ -6152,6 +6318,13 @@ func GCPGCEInstanceHostname(val string) attribute.KeyValue { return GCPGCEInstanceHostnameKey.String(val) } +// GCPGCEInstanceLabels returns an attribute KeyValue conforming to the +// "gcp.gce.instance.labels" semantic conventions. It represents the GCE instance +// labels, `` being the label name and the value being the label value. +func GCPGCEInstanceLabels(key string, val string) attribute.KeyValue { + return attribute.String("gcp.gce.instance.labels."+key, val) +} + // GCPGCEInstanceName returns an attribute KeyValue conforming to the // "gcp.gce.instance.name" semantic conventions. It represents the instance name // of a GCE instance. This is the value provided by `host.name`, the visible name @@ -6314,1270 +6487,94 @@ var ( GCPAppHubDestinationWorkloadEnvironmentTypeDevelopment = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("DEVELOPMENT") ) -// Namespace: gen_ai +// Namespace: geo const ( - // GenAIAgentDescriptionKey is the attribute Key conforming to the - // "gen_ai.agent.description" semantic conventions. It represents the free-form - // description of the GenAI agent provided by the application. + // GeoContinentCodeKey is the attribute Key conforming to the + // "geo.continent.code" semantic conventions. It represents the two-letter code + // representing continent’s name. // - // Type: string + // Type: Enum // RequirementLevel: Recommended // Stability: Development // - // Examples: "Helps with math problems", "Generates fiction stories" - GenAIAgentDescriptionKey = attribute.Key("gen_ai.agent.description") + // Examples: + GeoContinentCodeKey = attribute.Key("geo.continent.code") - // GenAIAgentIDKey is the attribute Key conforming to the "gen_ai.agent.id" - // semantic conventions. It represents the unique identifier of the GenAI agent. + // GeoCountryISOCodeKey is the attribute Key conforming to the + // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO + // Country Code ([ISO 3166-1 alpha2]). // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "asst_5j66UpCpwteGg4YSxUnt7lPY" - GenAIAgentIDKey = attribute.Key("gen_ai.agent.id") - - // GenAIAgentNameKey is the attribute Key conforming to the "gen_ai.agent.name" - // semantic conventions. It represents the human-readable name of the GenAI - // agent provided by the application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development + // Examples: "CA" // - // Examples: "Math Tutor", "Fiction Writer" - GenAIAgentNameKey = attribute.Key("gen_ai.agent.name") + // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes + GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") - // GenAIAgentVersionKey is the attribute Key conforming to the - // "gen_ai.agent.version" semantic conventions. It represents the version of the - // GenAI agent. + // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" + // semantic conventions. It represents the locality name. Represents the name of + // a city, town, village, or similar populated place. // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "1.0.0", "2025-05-01" - GenAIAgentVersionKey = attribute.Key("gen_ai.agent.version") + // Examples: "Montreal", "Berlin" + GeoLocalityNameKey = attribute.Key("geo.locality.name") - // GenAIConversationIDKey is the attribute Key conforming to the - // "gen_ai.conversation.id" semantic conventions. It represents the unique - // identifier for a conversation (session, thread), used to store and correlate - // messages within this conversation. + // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" + // semantic conventions. It represents the latitude of the geo location in + // [WGS84]. // - // Type: string + // Type: double // RequirementLevel: Recommended // Stability: Development // - // Examples: "conv_5j66UpCpwteGg4YSxUnt7lPY" - GenAIConversationIDKey = attribute.Key("gen_ai.conversation.id") - - // GenAIDataSourceIDKey is the attribute Key conforming to the - // "gen_ai.data_source.id" semantic conventions. It represents the data source - // identifier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development + // Examples: 45.505918 // - // Examples: "H7STPQYOND" - // Note: Data sources are used by AI agents and RAG applications to store - // grounding data. A data source may be an external database, object store, - // document collection, website, or any other storage system used by the GenAI - // agent or application. The `gen_ai.data_source.id` SHOULD match the identifier - // used by the GenAI system rather than a name specific to the external storage, - // such as a database or object store. Semantic conventions referencing - // `gen_ai.data_source.id` MAY also leverage additional attributes, such as - // `db.*`, to further identify and describe the data source. - GenAIDataSourceIDKey = attribute.Key("gen_ai.data_source.id") + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLatKey = attribute.Key("geo.location.lat") - // GenAIEmbeddingsDimensionCountKey is the attribute Key conforming to the - // "gen_ai.embeddings.dimension.count" semantic conventions. It represents the - // number of dimensions the resulting output embeddings should have. + // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" + // semantic conventions. It represents the longitude of the geo location in + // [WGS84]. // - // Type: int + // Type: double // RequirementLevel: Recommended // Stability: Development // - // Examples: 512, 1024 - GenAIEmbeddingsDimensionCountKey = attribute.Key("gen_ai.embeddings.dimension.count") - - // GenAIEvaluationExplanationKey is the attribute Key conforming to the - // "gen_ai.evaluation.explanation" semantic conventions. It represents a - // free-form explanation for the assigned score provided by the evaluator. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development + // Examples: -73.61483 // - // Examples: "The response is factually accurate but lacks sufficient detail to - // fully address the question." - GenAIEvaluationExplanationKey = attribute.Key("gen_ai.evaluation.explanation") + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLonKey = attribute.Key("geo.location.lon") - // GenAIEvaluationNameKey is the attribute Key conforming to the - // "gen_ai.evaluation.name" semantic conventions. It represents the name of the - // evaluation metric used for the GenAI response. + // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" + // semantic conventions. It represents the postal code associated with the + // location. Values appropriate for this field may also be known as a postcode + // or ZIP code and will vary widely from country to country. // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "Relevance", "IntentResolution" - GenAIEvaluationNameKey = attribute.Key("gen_ai.evaluation.name") + // Examples: "94040" + GeoPostalCodeKey = attribute.Key("geo.postal_code") - // GenAIEvaluationScoreLabelKey is the attribute Key conforming to the - // "gen_ai.evaluation.score.label" semantic conventions. It represents the human - // readable label for evaluation. + // GeoRegionISOCodeKey is the attribute Key conforming to the + // "geo.region.iso_code" semantic conventions. It represents the region ISO code + // ([ISO 3166-2]). // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "relevant", "not_relevant", "correct", "incorrect", "pass", "fail" - // Note: This attribute provides a human-readable interpretation of the - // evaluation score produced by an evaluator. For example, a score value of 1 - // could mean "relevant" in one evaluation system and "not relevant" in another, - // depending on the scoring range and evaluator. The label SHOULD have low - // cardinality. Possible values depend on the evaluation metric and evaluator - // used; implementations SHOULD document the possible values. - GenAIEvaluationScoreLabelKey = attribute.Key("gen_ai.evaluation.score.label") - - // GenAIEvaluationScoreValueKey is the attribute Key conforming to the - // "gen_ai.evaluation.score.value" semantic conventions. It represents the - // evaluation score returned by the evaluator. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development + // Examples: "CA-QC" // - // Examples: 4.0 - GenAIEvaluationScoreValueKey = attribute.Key("gen_ai.evaluation.score.value") - - // GenAIInputMessagesKey is the attribute Key conforming to the - // "gen_ai.input.messages" semantic conventions. It represents the chat history - // provided to the model as an input. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "role": "user",\n "parts": [\n {\n "type": "text",\n - // "content": "Weather in Paris?"\n }\n ]\n },\n {\n "role": "assistant",\n - // "parts": [\n {\n "type": "tool_call",\n "id": - // "call_VSPygqKTWdrhaFErNvMV18Yl",\n "name": "get_weather",\n "arguments": {\n - // "location": "Paris"\n }\n }\n ]\n },\n {\n "role": "tool",\n "parts": [\n {\n - // "type": "tool_call_response",\n "id": " call_VSPygqKTWdrhaFErNvMV18Yl",\n - // "result": "rainy, 57°F"\n }\n ]\n }\n]\n" - // Note: Instrumentations MUST follow [Input messages JSON schema]. - // When the attribute is recorded on events, it MUST be recorded in structured - // form. When recorded on spans, it MAY be recorded as a JSON string if - // structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Messages MUST be provided in the order they were sent to the model. - // Instrumentations MAY provide a way for users to filter or truncate - // input messages. - // - // > [!Warning] - // > This attribute is likely to contain sensitive information including - // > user/PII data. - // - // See [Recording content on attributes] - // section for more details. - // - // [Input messages JSON schema]: /docs/gen-ai/gen-ai-input-messages.json - // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes - GenAIInputMessagesKey = attribute.Key("gen_ai.input.messages") - - // GenAIOperationNameKey is the attribute Key conforming to the - // "gen_ai.operation.name" semantic conventions. It represents the name of the - // operation being performed. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: If one of the predefined values applies, but specific system uses a - // different name it's RECOMMENDED to document it in the semantic conventions - // for specific GenAI system and use system-specific name in the - // instrumentation. If a different name is not documented, instrumentation - // libraries SHOULD use applicable predefined value. - GenAIOperationNameKey = attribute.Key("gen_ai.operation.name") - - // GenAIOutputMessagesKey is the attribute Key conforming to the - // "gen_ai.output.messages" semantic conventions. It represents the messages - // returned by the model where each message represents a specific model response - // (choice, candidate). - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "role": "assistant",\n "parts": [\n {\n "type": "text",\n - // "content": "The weather in Paris is currently rainy with a temperature of - // 57°F."\n }\n ],\n "finish_reason": "stop"\n }\n]\n" - // Note: Instrumentations MUST follow [Output messages JSON schema] - // - // Each message represents a single output choice/candidate generated by - // the model. Each message corresponds to exactly one generation - // (choice/candidate) and vice versa - one choice cannot be split across - // multiple messages or one message cannot contain parts from multiple choices. - // - // When the attribute is recorded on events, it MUST be recorded in structured - // form. When recorded on spans, it MAY be recorded as a JSON string if - // structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Instrumentations MAY provide a way for users to filter or truncate - // output messages. - // - // > [!Warning] - // > This attribute is likely to contain sensitive information including - // > user/PII data. - // - // See [Recording content on attributes] - // section for more details. - // - // [Output messages JSON schema]: /docs/gen-ai/gen-ai-output-messages.json - // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes - GenAIOutputMessagesKey = attribute.Key("gen_ai.output.messages") - - // GenAIOutputTypeKey is the attribute Key conforming to the - // "gen_ai.output.type" semantic conventions. It represents the represents the - // content type requested by the client. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: This attribute SHOULD be used when the client requests output of a - // specific type. The model may return zero or more outputs of this type. - // This attribute specifies the output modality and not the actual output - // format. For example, if an image is requested, the actual output could be a - // URL pointing to an image file. - // Additional output format details may be recorded in the future in the - // `gen_ai.output.{type}.*` attributes. - GenAIOutputTypeKey = attribute.Key("gen_ai.output.type") - - // GenAIPromptNameKey is the attribute Key conforming to the - // "gen_ai.prompt.name" semantic conventions. It represents the name of the - // prompt that uniquely identifies it. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "analyze-code" - GenAIPromptNameKey = attribute.Key("gen_ai.prompt.name") - - // GenAIProviderNameKey is the attribute Key conforming to the - // "gen_ai.provider.name" semantic conventions. It represents the Generative AI - // provider as identified by the client or server instrumentation. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - // Note: The attribute SHOULD be set based on the instrumentation's best - // knowledge and may differ from the actual model provider. - // - // Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms - // are accessible using the OpenAI REST API and corresponding client libraries, - // but may proxy or host models from different providers. - // - // The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address` - // attributes may help identify the actual system in use. - // - // The `gen_ai.provider.name` attribute acts as a discriminator that - // identifies the GenAI telemetry format flavor specific to that provider - // within GenAI semantic conventions. - // It SHOULD be set consistently with provider-specific attributes and signals. - // For example, GenAI spans, metrics, and events related to AWS Bedrock - // should have the `gen_ai.provider.name` set to `aws.bedrock` and include - // applicable `aws.bedrock.*` attributes and are not expected to include - // `openai.*` attributes. - GenAIProviderNameKey = attribute.Key("gen_ai.provider.name") - - // GenAIRequestChoiceCountKey is the attribute Key conforming to the - // "gen_ai.request.choice.count" semantic conventions. It represents the target - // number of candidate completions to return. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 3 - GenAIRequestChoiceCountKey = attribute.Key("gen_ai.request.choice.count") - - // GenAIRequestEncodingFormatsKey is the attribute Key conforming to the - // "gen_ai.request.encoding_formats" semantic conventions. It represents the - // encoding formats requested in an embeddings operation, if specified. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "base64"], ["float", "binary" - // Note: In some GenAI systems the encoding formats are called embedding types. - // Also, some GenAI systems only accept a single format per request. - GenAIRequestEncodingFormatsKey = attribute.Key("gen_ai.request.encoding_formats") - - // GenAIRequestFrequencyPenaltyKey is the attribute Key conforming to the - // "gen_ai.request.frequency_penalty" semantic conventions. It represents the - // frequency penalty setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.1 - GenAIRequestFrequencyPenaltyKey = attribute.Key("gen_ai.request.frequency_penalty") - - // GenAIRequestMaxTokensKey is the attribute Key conforming to the - // "gen_ai.request.max_tokens" semantic conventions. It represents the maximum - // number of tokens the model generates for a request. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - GenAIRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") - - // GenAIRequestModelKey is the attribute Key conforming to the - // "gen_ai.request.model" semantic conventions. It represents the name of the - // GenAI model a request is being made to. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: gpt-4 - GenAIRequestModelKey = attribute.Key("gen_ai.request.model") - - // GenAIRequestPresencePenaltyKey is the attribute Key conforming to the - // "gen_ai.request.presence_penalty" semantic conventions. It represents the - // presence penalty setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.1 - GenAIRequestPresencePenaltyKey = attribute.Key("gen_ai.request.presence_penalty") - - // GenAIRequestSeedKey is the attribute Key conforming to the - // "gen_ai.request.seed" semantic conventions. It represents the requests with - // same seed value more likely to return same result. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - GenAIRequestSeedKey = attribute.Key("gen_ai.request.seed") - - // GenAIRequestStopSequencesKey is the attribute Key conforming to the - // "gen_ai.request.stop_sequences" semantic conventions. It represents the list - // of sequences that the model will use to stop generating further tokens. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "forest", "lived" - GenAIRequestStopSequencesKey = attribute.Key("gen_ai.request.stop_sequences") - - // GenAIRequestStreamKey is the attribute Key conforming to the - // "gen_ai.request.stream" semantic conventions. It represents the indicates - // whether the GenAI request was made in streaming mode. - // - // Type: boolean - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - GenAIRequestStreamKey = attribute.Key("gen_ai.request.stream") - - // GenAIRequestTemperatureKey is the attribute Key conforming to the - // "gen_ai.request.temperature" semantic conventions. It represents the - // temperature setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.0 - GenAIRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") - - // GenAIRequestTopKKey is the attribute Key conforming to the - // "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling - // setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0 - GenAIRequestTopKKey = attribute.Key("gen_ai.request.top_k") - - // GenAIRequestTopPKey is the attribute Key conforming to the - // "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling - // setting for the GenAI request. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 1.0 - GenAIRequestTopPKey = attribute.Key("gen_ai.request.top_p") - - // GenAIResponseFinishReasonsKey is the attribute Key conforming to the - // "gen_ai.response.finish_reasons" semantic conventions. It represents the - // array of reasons the model stopped generating tokens, corresponding to each - // generation received. - // - // Type: string[] - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "stop"], ["stop", "length" - GenAIResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") - - // GenAIResponseIDKey is the attribute Key conforming to the - // "gen_ai.response.id" semantic conventions. It represents the unique - // identifier for the completion. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "chatcmpl-123" - GenAIResponseIDKey = attribute.Key("gen_ai.response.id") - - // GenAIResponseModelKey is the attribute Key conforming to the - // "gen_ai.response.model" semantic conventions. It represents the name of the - // model that generated the response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "gpt-4-0613" - GenAIResponseModelKey = attribute.Key("gen_ai.response.model") - - // GenAIResponseTimeToFirstChunkKey is the attribute Key conforming to the - // "gen_ai.response.time_to_first_chunk" semantic conventions. It represents the - // time to first chunk in a streaming response, measured from request issuance, - // in seconds. The value is measured from when the client issues the generation - // request to when the first chunk is received in the response stream. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 0.5, 1.2 - GenAIResponseTimeToFirstChunkKey = attribute.Key("gen_ai.response.time_to_first_chunk") - - // GenAIRetrievalDocumentsKey is the attribute Key conforming to the - // "gen_ai.retrieval.documents" semantic conventions. It represents the - // documents retrieved. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "id": "doc_123",\n "score": 0.95\n },\n {\n "id": - // "doc_456",\n "score": 0.87\n },\n {\n "id": "doc_789",\n "score": 0.82\n - // }\n]\n" - // Note: Instrumentations MUST follow [Retrieval documents JSON schema]. - // When the attribute is recorded on events, it MUST be recorded in structured - // form. When recorded on spans, it MAY be recorded as a JSON string if - // structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Each document object SHOULD contain at least the following properties: - // `id` (string): A unique identifier for the document, `score` (double): The - // relevance score of the document - // - // [Retrieval documents JSON schema]: /docs/gen-ai/gen-ai-retrieval-documents.json - GenAIRetrievalDocumentsKey = attribute.Key("gen_ai.retrieval.documents") - - // GenAIRetrievalQueryTextKey is the attribute Key conforming to the - // "gen_ai.retrieval.query.text" semantic conventions. It represents the query - // text used for retrieval. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "What is the capital of France?", "weather in Paris" - // Note: > [!Warning] - // - // > This attribute may contain sensitive information. - GenAIRetrievalQueryTextKey = attribute.Key("gen_ai.retrieval.query.text") - - // GenAISystemInstructionsKey is the attribute Key conforming to the - // "gen_ai.system_instructions" semantic conventions. It represents the system - // message or instructions provided to the GenAI model separately from the chat - // history. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "type": "text",\n "content": "You are an Agent that greet - // users, always use greetings tool to respond"\n }\n]\n", "[\n {\n "type": - // "text",\n "content": "You are a language translator."\n },\n {\n "type": - // "text",\n "content": "Your mission is to translate text in English to - // French."\n }\n]\n" - // Note: This attribute SHOULD be used when the corresponding provider or API - // allows to provide system instructions or messages separately from the - // chat history. - // - // Instructions that are part of the chat history SHOULD be recorded in - // `gen_ai.input.messages` attribute instead. - // - // Instrumentations MUST follow [System instructions JSON schema]. - // - // When recorded on spans, it MAY be recorded as a JSON string if structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Instrumentations MAY provide a way for users to filter or truncate - // system instructions. - // - // > [!Warning] - // > This attribute may contain sensitive information. - // - // See [Recording content on attributes] - // section for more details. - // - // [System instructions JSON schema]: /docs/gen-ai/gen-ai-system-instructions.json - // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes - GenAISystemInstructionsKey = attribute.Key("gen_ai.system_instructions") - - // GenAITokenTypeKey is the attribute Key conforming to the "gen_ai.token.type" - // semantic conventions. It represents the type of token being counted. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "input", "output" - GenAITokenTypeKey = attribute.Key("gen_ai.token.type") - - // GenAIToolCallArgumentsKey is the attribute Key conforming to the - // "gen_ai.tool.call.arguments" semantic conventions. It represents the - // parameters passed to the tool call. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{\n "location": "San Francisco?",\n "date": "2025-10-01"\n}\n" - // Note: > [!WARNING] - // - // > This attribute may contain sensitive information. - // - // It's expected to be an object - in case a serialized string is available - // to the instrumentation, the instrumentation SHOULD do the best effort to - // deserialize it to an object. When recorded on spans, it MAY be recorded as a - // JSON string if structured format is not supported and SHOULD be recorded in - // structured form otherwise. - GenAIToolCallArgumentsKey = attribute.Key("gen_ai.tool.call.arguments") - - // GenAIToolCallIDKey is the attribute Key conforming to the - // "gen_ai.tool.call.id" semantic conventions. It represents the tool call - // identifier. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "call_mszuSIzqtI65i1wAUOE8w5H4" - GenAIToolCallIDKey = attribute.Key("gen_ai.tool.call.id") - - // GenAIToolCallResultKey is the attribute Key conforming to the - // "gen_ai.tool.call.result" semantic conventions. It represents the result - // returned by the tool call (if any and if execution was successful). - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "{\n "temperature_range": {\n "high": 75,\n "low": 60\n },\n - // "conditions": "sunny"\n}\n" - // Note: > [!WARNING] - // - // > This attribute may contain sensitive information. - // - // It's expected to be an object - in case a serialized string is available - // to the instrumentation, the instrumentation SHOULD do the best effort to - // deserialize it to an object. When recorded on spans, it MAY be recorded as a - // JSON string if structured format is not supported and SHOULD be recorded in - // structured form otherwise. - GenAIToolCallResultKey = attribute.Key("gen_ai.tool.call.result") - - // GenAIToolDefinitionsKey is the attribute Key conforming to the - // "gen_ai.tool.definitions" semantic conventions. It represents the list of - // tool definitions available to the GenAI agent or model. - // - // Type: any - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "[\n {\n "type": "function",\n "name": "get_current_weather",\n - // "description": "Get the current weather in a given location",\n "parameters": - // {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n - // "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": - // {\n "type": "string",\n "enum": [\n "celsius",\n "fahrenheit"\n ]\n }\n },\n - // "required": [\n "location",\n "unit"\n ]\n }\n }\n]\n" - // Note: Instrumentations MUST follow [Tool Definitions JSON Schema]. - // - // When the attribute is recorded on events, it MUST be recorded in structured - // form. When recorded on spans, it MAY be recorded as a JSON string if - // structured - // format is not supported and SHOULD be recorded in structured form otherwise. - // - // Since this attribute could be large, it's NOT RECOMMENDED to populate - // non-required properties by default. Instrumentations MAY provide a way - // to enable populating optional properties. - // - // [Tool Definitions JSON Schema]: /docs/gen-ai/gen-ai-tool-definitions.json - GenAIToolDefinitionsKey = attribute.Key("gen_ai.tool.definitions") - - // GenAIToolDescriptionKey is the attribute Key conforming to the - // "gen_ai.tool.description" semantic conventions. It represents the tool - // description. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Multiply two numbers" - GenAIToolDescriptionKey = attribute.Key("gen_ai.tool.description") - - // GenAIToolNameKey is the attribute Key conforming to the "gen_ai.tool.name" - // semantic conventions. It represents the name of the tool utilized by the - // agent. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Flights" - GenAIToolNameKey = attribute.Key("gen_ai.tool.name") - - // GenAIToolTypeKey is the attribute Key conforming to the "gen_ai.tool.type" - // semantic conventions. It represents the type of the tool utilized by the - // agent. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "function", "extension", "datastore" - // Note: Extension: A tool executed on the agent-side to directly call external - // APIs, bridging the gap between the agent and real-world systems. - // Agent-side operations involve actions that are performed by the agent on the - // server or within the agent's controlled environment. - // Function: A tool executed on the client-side, where the agent generates - // parameters for a predefined function, and the client executes the logic. - // Client-side operations are actions taken on the user's end or within the - // client application. - // Datastore: A tool used by the agent to access and query structured or - // unstructured external data for retrieval-augmented tasks or knowledge - // updates. - GenAIToolTypeKey = attribute.Key("gen_ai.tool.type") - - // GenAIUsageCacheCreationInputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.cache_creation.input_tokens" semantic conventions. It - // represents the number of input tokens written to a provider-managed cache. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 25 - // Note: The value SHOULD be included in `gen_ai.usage.input_tokens`. - GenAIUsageCacheCreationInputTokensKey = attribute.Key("gen_ai.usage.cache_creation.input_tokens") - - // GenAIUsageCacheReadInputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.cache_read.input_tokens" semantic conventions. It represents - // the number of input tokens served from a provider-managed cache. - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 50 - // Note: The value SHOULD be included in `gen_ai.usage.input_tokens`. - GenAIUsageCacheReadInputTokensKey = attribute.Key("gen_ai.usage.cache_read.input_tokens") - - // GenAIUsageInputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.input_tokens" semantic conventions. It represents the number of - // tokens used in the GenAI input (prompt). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 100 - // Note: This value SHOULD include all types of input tokens, including cached - // tokens. - // Instrumentations SHOULD make a best effort to populate this value, using a - // total - // provided by the provider when available or, depending on the provider API, - // by summing different token types parsed from the provider output. - GenAIUsageInputTokensKey = attribute.Key("gen_ai.usage.input_tokens") - - // GenAIUsageOutputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.output_tokens" semantic conventions. It represents the number - // of tokens used in the GenAI response (completion). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 180 - GenAIUsageOutputTokensKey = attribute.Key("gen_ai.usage.output_tokens") - - // GenAIUsageReasoningOutputTokensKey is the attribute Key conforming to the - // "gen_ai.usage.reasoning.output_tokens" semantic conventions. It represents - // the number of output tokens used for reasoning (e.g. chain-of-thought, - // extended thinking). - // - // Type: int - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 50 - // Note: The value SHOULD be included in `gen_ai.usage.output_tokens`. - GenAIUsageReasoningOutputTokensKey = attribute.Key("gen_ai.usage.reasoning.output_tokens") - - // GenAIWorkflowNameKey is the attribute Key conforming to the - // "gen_ai.workflow.name" semantic conventions. It represents the human-readable - // name of the GenAI workflow provided by the application. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "multi_agent_rag", "customer_support_pipeline" - // Note: This attribute can be populated in different frameworks eg: name of the - // first chain in LangChain OR name of the crew in CrewAI. - GenAIWorkflowNameKey = attribute.Key("gen_ai.workflow.name") -) - -// GenAIAgentDescription returns an attribute KeyValue conforming to the -// "gen_ai.agent.description" semantic conventions. It represents the free-form -// description of the GenAI agent provided by the application. -func GenAIAgentDescription(val string) attribute.KeyValue { - return GenAIAgentDescriptionKey.String(val) -} - -// GenAIAgentID returns an attribute KeyValue conforming to the "gen_ai.agent.id" -// semantic conventions. It represents the unique identifier of the GenAI agent. -func GenAIAgentID(val string) attribute.KeyValue { - return GenAIAgentIDKey.String(val) -} - -// GenAIAgentName returns an attribute KeyValue conforming to the -// "gen_ai.agent.name" semantic conventions. It represents the human-readable -// name of the GenAI agent provided by the application. -func GenAIAgentName(val string) attribute.KeyValue { - return GenAIAgentNameKey.String(val) -} - -// GenAIAgentVersion returns an attribute KeyValue conforming to the -// "gen_ai.agent.version" semantic conventions. It represents the version of the -// GenAI agent. -func GenAIAgentVersion(val string) attribute.KeyValue { - return GenAIAgentVersionKey.String(val) -} - -// GenAIConversationID returns an attribute KeyValue conforming to the -// "gen_ai.conversation.id" semantic conventions. It represents the unique -// identifier for a conversation (session, thread), used to store and correlate -// messages within this conversation. -func GenAIConversationID(val string) attribute.KeyValue { - return GenAIConversationIDKey.String(val) -} - -// GenAIDataSourceID returns an attribute KeyValue conforming to the -// "gen_ai.data_source.id" semantic conventions. It represents the data source -// identifier. -func GenAIDataSourceID(val string) attribute.KeyValue { - return GenAIDataSourceIDKey.String(val) -} - -// GenAIEmbeddingsDimensionCount returns an attribute KeyValue conforming to the -// "gen_ai.embeddings.dimension.count" semantic conventions. It represents the -// number of dimensions the resulting output embeddings should have. -func GenAIEmbeddingsDimensionCount(val int) attribute.KeyValue { - return GenAIEmbeddingsDimensionCountKey.Int(val) -} - -// GenAIEvaluationExplanation returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.explanation" semantic conventions. It represents a -// free-form explanation for the assigned score provided by the evaluator. -func GenAIEvaluationExplanation(val string) attribute.KeyValue { - return GenAIEvaluationExplanationKey.String(val) -} - -// GenAIEvaluationName returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.name" semantic conventions. It represents the name of the -// evaluation metric used for the GenAI response. -func GenAIEvaluationName(val string) attribute.KeyValue { - return GenAIEvaluationNameKey.String(val) -} - -// GenAIEvaluationScoreLabel returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.score.label" semantic conventions. It represents the human -// readable label for evaluation. -func GenAIEvaluationScoreLabel(val string) attribute.KeyValue { - return GenAIEvaluationScoreLabelKey.String(val) -} - -// GenAIEvaluationScoreValue returns an attribute KeyValue conforming to the -// "gen_ai.evaluation.score.value" semantic conventions. It represents the -// evaluation score returned by the evaluator. -func GenAIEvaluationScoreValue(val float64) attribute.KeyValue { - return GenAIEvaluationScoreValueKey.Float64(val) -} - -// GenAIPromptName returns an attribute KeyValue conforming to the -// "gen_ai.prompt.name" semantic conventions. It represents the name of the -// prompt that uniquely identifies it. -func GenAIPromptName(val string) attribute.KeyValue { - return GenAIPromptNameKey.String(val) -} - -// GenAIRequestChoiceCount returns an attribute KeyValue conforming to the -// "gen_ai.request.choice.count" semantic conventions. It represents the target -// number of candidate completions to return. -func GenAIRequestChoiceCount(val int) attribute.KeyValue { - return GenAIRequestChoiceCountKey.Int(val) -} - -// GenAIRequestEncodingFormats returns an attribute KeyValue conforming to the -// "gen_ai.request.encoding_formats" semantic conventions. It represents the -// encoding formats requested in an embeddings operation, if specified. -func GenAIRequestEncodingFormats(val ...string) attribute.KeyValue { - return GenAIRequestEncodingFormatsKey.StringSlice(val) -} - -// GenAIRequestFrequencyPenalty returns an attribute KeyValue conforming to the -// "gen_ai.request.frequency_penalty" semantic conventions. It represents the -// frequency penalty setting for the GenAI request. -func GenAIRequestFrequencyPenalty(val float64) attribute.KeyValue { - return GenAIRequestFrequencyPenaltyKey.Float64(val) -} - -// GenAIRequestMaxTokens returns an attribute KeyValue conforming to the -// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum -// number of tokens the model generates for a request. -func GenAIRequestMaxTokens(val int) attribute.KeyValue { - return GenAIRequestMaxTokensKey.Int(val) -} - -// GenAIRequestModel returns an attribute KeyValue conforming to the -// "gen_ai.request.model" semantic conventions. It represents the name of the -// GenAI model a request is being made to. -func GenAIRequestModel(val string) attribute.KeyValue { - return GenAIRequestModelKey.String(val) -} - -// GenAIRequestPresencePenalty returns an attribute KeyValue conforming to the -// "gen_ai.request.presence_penalty" semantic conventions. It represents the -// presence penalty setting for the GenAI request. -func GenAIRequestPresencePenalty(val float64) attribute.KeyValue { - return GenAIRequestPresencePenaltyKey.Float64(val) -} - -// GenAIRequestSeed returns an attribute KeyValue conforming to the -// "gen_ai.request.seed" semantic conventions. It represents the requests with -// same seed value more likely to return same result. -func GenAIRequestSeed(val int) attribute.KeyValue { - return GenAIRequestSeedKey.Int(val) -} - -// GenAIRequestStopSequences returns an attribute KeyValue conforming to the -// "gen_ai.request.stop_sequences" semantic conventions. It represents the list -// of sequences that the model will use to stop generating further tokens. -func GenAIRequestStopSequences(val ...string) attribute.KeyValue { - return GenAIRequestStopSequencesKey.StringSlice(val) -} - -// GenAIRequestStream returns an attribute KeyValue conforming to the -// "gen_ai.request.stream" semantic conventions. It represents the indicates -// whether the GenAI request was made in streaming mode. -func GenAIRequestStream(val bool) attribute.KeyValue { - return GenAIRequestStreamKey.Bool(val) -} - -// GenAIRequestTemperature returns an attribute KeyValue conforming to the -// "gen_ai.request.temperature" semantic conventions. It represents the -// temperature setting for the GenAI request. -func GenAIRequestTemperature(val float64) attribute.KeyValue { - return GenAIRequestTemperatureKey.Float64(val) -} - -// GenAIRequestTopK returns an attribute KeyValue conforming to the -// "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling -// setting for the GenAI request. -func GenAIRequestTopK(val float64) attribute.KeyValue { - return GenAIRequestTopKKey.Float64(val) -} - -// GenAIRequestTopP returns an attribute KeyValue conforming to the -// "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling -// setting for the GenAI request. -func GenAIRequestTopP(val float64) attribute.KeyValue { - return GenAIRequestTopPKey.Float64(val) -} - -// GenAIResponseFinishReasons returns an attribute KeyValue conforming to the -// "gen_ai.response.finish_reasons" semantic conventions. It represents the array -// of reasons the model stopped generating tokens, corresponding to each -// generation received. -func GenAIResponseFinishReasons(val ...string) attribute.KeyValue { - return GenAIResponseFinishReasonsKey.StringSlice(val) -} - -// GenAIResponseID returns an attribute KeyValue conforming to the -// "gen_ai.response.id" semantic conventions. It represents the unique identifier -// for the completion. -func GenAIResponseID(val string) attribute.KeyValue { - return GenAIResponseIDKey.String(val) -} - -// GenAIResponseModel returns an attribute KeyValue conforming to the -// "gen_ai.response.model" semantic conventions. It represents the name of the -// model that generated the response. -func GenAIResponseModel(val string) attribute.KeyValue { - return GenAIResponseModelKey.String(val) -} - -// GenAIResponseTimeToFirstChunk returns an attribute KeyValue conforming to the -// "gen_ai.response.time_to_first_chunk" semantic conventions. It represents the -// time to first chunk in a streaming response, measured from request issuance, -// in seconds. The value is measured from when the client issues the generation -// request to when the first chunk is received in the response stream. -func GenAIResponseTimeToFirstChunk(val float64) attribute.KeyValue { - return GenAIResponseTimeToFirstChunkKey.Float64(val) -} - -// GenAIRetrievalQueryText returns an attribute KeyValue conforming to the -// "gen_ai.retrieval.query.text" semantic conventions. It represents the query -// text used for retrieval. -func GenAIRetrievalQueryText(val string) attribute.KeyValue { - return GenAIRetrievalQueryTextKey.String(val) -} - -// GenAIToolCallID returns an attribute KeyValue conforming to the -// "gen_ai.tool.call.id" semantic conventions. It represents the tool call -// identifier. -func GenAIToolCallID(val string) attribute.KeyValue { - return GenAIToolCallIDKey.String(val) -} - -// GenAIToolDescription returns an attribute KeyValue conforming to the -// "gen_ai.tool.description" semantic conventions. It represents the tool -// description. -func GenAIToolDescription(val string) attribute.KeyValue { - return GenAIToolDescriptionKey.String(val) -} - -// GenAIToolName returns an attribute KeyValue conforming to the -// "gen_ai.tool.name" semantic conventions. It represents the name of the tool -// utilized by the agent. -func GenAIToolName(val string) attribute.KeyValue { - return GenAIToolNameKey.String(val) -} - -// GenAIToolType returns an attribute KeyValue conforming to the -// "gen_ai.tool.type" semantic conventions. It represents the type of the tool -// utilized by the agent. -func GenAIToolType(val string) attribute.KeyValue { - return GenAIToolTypeKey.String(val) -} - -// GenAIUsageCacheCreationInputTokens returns an attribute KeyValue conforming to -// the "gen_ai.usage.cache_creation.input_tokens" semantic conventions. It -// represents the number of input tokens written to a provider-managed cache. -func GenAIUsageCacheCreationInputTokens(val int) attribute.KeyValue { - return GenAIUsageCacheCreationInputTokensKey.Int(val) -} - -// GenAIUsageCacheReadInputTokens returns an attribute KeyValue conforming to the -// "gen_ai.usage.cache_read.input_tokens" semantic conventions. It represents the -// number of input tokens served from a provider-managed cache. -func GenAIUsageCacheReadInputTokens(val int) attribute.KeyValue { - return GenAIUsageCacheReadInputTokensKey.Int(val) -} - -// GenAIUsageInputTokens returns an attribute KeyValue conforming to the -// "gen_ai.usage.input_tokens" semantic conventions. It represents the number of -// tokens used in the GenAI input (prompt). -func GenAIUsageInputTokens(val int) attribute.KeyValue { - return GenAIUsageInputTokensKey.Int(val) -} - -// GenAIUsageOutputTokens returns an attribute KeyValue conforming to the -// "gen_ai.usage.output_tokens" semantic conventions. It represents the number of -// tokens used in the GenAI response (completion). -func GenAIUsageOutputTokens(val int) attribute.KeyValue { - return GenAIUsageOutputTokensKey.Int(val) -} - -// GenAIUsageReasoningOutputTokens returns an attribute KeyValue conforming to -// the "gen_ai.usage.reasoning.output_tokens" semantic conventions. It represents -// the number of output tokens used for reasoning (e.g. chain-of-thought, -// extended thinking). -func GenAIUsageReasoningOutputTokens(val int) attribute.KeyValue { - return GenAIUsageReasoningOutputTokensKey.Int(val) -} - -// GenAIWorkflowName returns an attribute KeyValue conforming to the -// "gen_ai.workflow.name" semantic conventions. It represents the human-readable -// name of the GenAI workflow provided by the application. -func GenAIWorkflowName(val string) attribute.KeyValue { - return GenAIWorkflowNameKey.String(val) -} - -// Enum values for gen_ai.operation.name -var ( - // Chat completion operation such as [OpenAI Chat API] - // Stability: development - // - // [OpenAI Chat API]: https://platform.openai.com/docs/api-reference/chat - GenAIOperationNameChat = GenAIOperationNameKey.String("chat") - // Multimodal content generation operation such as [Gemini Generate Content] - // Stability: development - // - // [Gemini Generate Content]: https://ai.google.dev/api/generate-content - GenAIOperationNameGenerateContent = GenAIOperationNameKey.String("generate_content") - // Text completions operation such as [OpenAI Completions API (Legacy)] - // Stability: development - // - // [OpenAI Completions API (Legacy)]: https://platform.openai.com/docs/api-reference/completions - GenAIOperationNameTextCompletion = GenAIOperationNameKey.String("text_completion") - // Embeddings operation such as [OpenAI Create embeddings API] - // Stability: development - // - // [OpenAI Create embeddings API]: https://platform.openai.com/docs/api-reference/embeddings/create - GenAIOperationNameEmbeddings = GenAIOperationNameKey.String("embeddings") - // Retrieval operation such as [OpenAI Search Vector Store API] - // Stability: development - // - // [OpenAI Search Vector Store API]: https://platform.openai.com/docs/api-reference/vector-stores/search - GenAIOperationNameRetrieval = GenAIOperationNameKey.String("retrieval") - // Create GenAI agent - // Stability: development - GenAIOperationNameCreateAgent = GenAIOperationNameKey.String("create_agent") - // Invoke GenAI agent - // Stability: development - GenAIOperationNameInvokeAgent = GenAIOperationNameKey.String("invoke_agent") - // Execute a tool - // Stability: development - GenAIOperationNameExecuteTool = GenAIOperationNameKey.String("execute_tool") - // Invoke GenAI workflow - // Stability: development - GenAIOperationNameInvokeWorkflow = GenAIOperationNameKey.String("invoke_workflow") -) - -// Enum values for gen_ai.output.type -var ( - // Plain text - // Stability: development - GenAIOutputTypeText = GenAIOutputTypeKey.String("text") - // JSON object with known or unknown schema - // Stability: development - GenAIOutputTypeJSON = GenAIOutputTypeKey.String("json") - // Image - // Stability: development - GenAIOutputTypeImage = GenAIOutputTypeKey.String("image") - // Speech - // Stability: development - GenAIOutputTypeSpeech = GenAIOutputTypeKey.String("speech") -) - -// Enum values for gen_ai.provider.name -var ( - // [OpenAI] - // Stability: development - // - // [OpenAI]: https://openai.com/ - GenAIProviderNameOpenAI = GenAIProviderNameKey.String("openai") - // Any Google generative AI endpoint - // Stability: development - GenAIProviderNameGCPGenAI = GenAIProviderNameKey.String("gcp.gen_ai") - // [Vertex AI] - // Stability: development - // - // [Vertex AI]: https://cloud.google.com/vertex-ai - GenAIProviderNameGCPVertexAI = GenAIProviderNameKey.String("gcp.vertex_ai") - // [Gemini] - // Stability: development - // - // [Gemini]: https://cloud.google.com/products/gemini - GenAIProviderNameGCPGemini = GenAIProviderNameKey.String("gcp.gemini") - // [Anthropic] - // Stability: development - // - // [Anthropic]: https://www.anthropic.com/ - GenAIProviderNameAnthropic = GenAIProviderNameKey.String("anthropic") - // [Cohere] - // Stability: development - // - // [Cohere]: https://cohere.com/ - GenAIProviderNameCohere = GenAIProviderNameKey.String("cohere") - // Azure AI Inference - // Stability: development - GenAIProviderNameAzureAIInference = GenAIProviderNameKey.String("azure.ai.inference") - // [Azure OpenAI] - // Stability: development - // - // [Azure OpenAI]: https://learn.microsoft.com/en-us/azure/ai-services/openai/overview - GenAIProviderNameAzureAIOpenAI = GenAIProviderNameKey.String("azure.ai.openai") - // [IBM Watsonx AI] - // Stability: development - // - // [IBM Watsonx AI]: https://www.ibm.com/products/watsonx-ai - GenAIProviderNameIBMWatsonxAI = GenAIProviderNameKey.String("ibm.watsonx.ai") - // [AWS Bedrock] - // Stability: development - // - // [AWS Bedrock]: https://aws.amazon.com/bedrock - GenAIProviderNameAWSBedrock = GenAIProviderNameKey.String("aws.bedrock") - // [Perplexity] - // Stability: development - // - // [Perplexity]: https://www.perplexity.ai/ - GenAIProviderNamePerplexity = GenAIProviderNameKey.String("perplexity") - // [xAI] - // Stability: development - // - // [xAI]: https://x.ai/ - GenAIProviderNameXAI = GenAIProviderNameKey.String("x_ai") - // [DeepSeek] - // Stability: development - // - // [DeepSeek]: https://www.deepseek.com/ - GenAIProviderNameDeepseek = GenAIProviderNameKey.String("deepseek") - // [Groq] - // Stability: development - // - // [Groq]: https://groq.com/ - GenAIProviderNameGroq = GenAIProviderNameKey.String("groq") - // [Mistral AI] - // Stability: development - // - // [Mistral AI]: https://mistral.ai/ - GenAIProviderNameMistralAI = GenAIProviderNameKey.String("mistral_ai") -) - -// Enum values for gen_ai.token.type -var ( - // Input tokens (prompt, input, etc.) - // Stability: development - GenAITokenTypeInput = GenAITokenTypeKey.String("input") - // Output tokens (completion, response, etc.) - // Stability: development - GenAITokenTypeOutput = GenAITokenTypeKey.String("output") -) - -// Namespace: geo -const ( - // GeoContinentCodeKey is the attribute Key conforming to the - // "geo.continent.code" semantic conventions. It represents the two-letter code - // representing continent’s name. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - GeoContinentCodeKey = attribute.Key("geo.continent.code") - - // GeoCountryISOCodeKey is the attribute Key conforming to the - // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO - // Country Code ([ISO 3166-1 alpha2]). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CA" - // - // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes - GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") - - // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" - // semantic conventions. It represents the locality name. Represents the name of - // a city, town, village, or similar populated place. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Montreal", "Berlin" - GeoLocalityNameKey = attribute.Key("geo.locality.name") - - // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" - // semantic conventions. It represents the latitude of the geo location in - // [WGS84]. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: 45.505918 - // - // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 - GeoLocationLatKey = attribute.Key("geo.location.lat") - - // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" - // semantic conventions. It represents the longitude of the geo location in - // [WGS84]. - // - // Type: double - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: -73.61483 - // - // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 - GeoLocationLonKey = attribute.Key("geo.location.lon") - - // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" - // semantic conventions. It represents the postal code associated with the - // location. Values appropriate for this field may also be known as a postcode - // or ZIP code and will vary widely from country to country. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "94040" - GeoPostalCodeKey = attribute.Key("geo.postal_code") - - // GeoRegionISOCodeKey is the attribute Key conforming to the - // "geo.region.iso_code" semantic conventions. It represents the region ISO code - // ([ISO 3166-2]). - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "CA-QC" - // - // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 - GeoRegionISOCodeKey = attribute.Key("geo.region.iso_code") -) + // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 + GeoRegionISOCodeKey = attribute.Key("geo.region.iso_code") +) // GeoCountryISOCode returns an attribute KeyValue conforming to the // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO @@ -9201,7 +8198,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry-cluster" K8SClusterNameKey = attribute.Key("k8s.cluster.name") @@ -9212,7 +8209,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" // Note: K8s doesn't have support for obtaining a cluster ID. If this is ever @@ -9241,6 +8238,19 @@ const ( // [ISO/IEC 9834-8 and ITU-T X.667]: https://www.itu.int/ITU-T/studygroups/com17/oid.html K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") + // K8SContainerEphemeralStorageFsTypeKey is the attribute Key conforming to the + // "k8s.container.ephemeral_storage.fs_type" semantic conventions. It represents + // the type of file system component for ephemeral storage. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "rootfs", "logs" + // Note: Eviction decisions based on ephemeral-storage resource limits are made + // based on the total container usage. + K8SContainerEphemeralStorageFsTypeKey = attribute.Key("k8s.container.ephemeral_storage.fs_type") + // K8SContainerNameKey is the attribute Key conforming to the // "k8s.container.name" semantic conventions. It represents the name of the // Container from Pod specification, must be unique within a Pod. Container @@ -9248,7 +8258,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "redis" K8SContainerNameKey = attribute.Key("k8s.container.name") @@ -9260,7 +8270,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") @@ -9289,8 +8299,8 @@ const ( // "CreateContainerConfigError", "ErrImagePull", "ImagePullBackOff", // "OOMKilled", "Completed", "Error", "ContainerCannotRun" // - // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core - // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core + // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#containerstatewaiting-v1-core + // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#containerstateterminated-v1-core K8SContainerStatusReasonKey = attribute.Key("k8s.container.status.reason") // K8SContainerStatusStateKey is the attribute Key conforming to the @@ -9303,7 +8313,7 @@ const ( // // Examples: "terminated", "running", "waiting" // - // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core + // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#containerstate-v1-core K8SContainerStatusStateKey = attribute.Key("k8s.container.status.state") // K8SCronJobNameKey is the attribute Key conforming to the "k8s.cronjob.name" @@ -9311,7 +8321,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry" K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") @@ -9321,7 +8331,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") @@ -9332,7 +8342,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry" K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") @@ -9342,7 +8352,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") @@ -9353,7 +8363,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry" K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") @@ -9364,7 +8374,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") @@ -9454,7 +8464,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry" K8SJobNameKey = attribute.Key("k8s.job.name") @@ -9464,7 +8474,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SJobUIDKey = attribute.Key("k8s.job.uid") @@ -9475,7 +8485,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "default" K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") @@ -9492,7 +8502,7 @@ const ( // Note: This attribute aligns with the `phase` field of the // [K8s NamespaceStatus] // - // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core + // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#namespacestatus-v1-core K8SNamespacePhaseKey = attribute.Key("k8s.namespace.phase") // K8SNodeConditionStatusKey is the attribute Key conforming to the @@ -9507,7 +8517,7 @@ const ( // Note: This attribute aligns with the `status` field of the // [NodeCondition] // - // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#nodecondition-v1-core K8SNodeConditionStatusKey = attribute.Key("k8s.node.condition.status") // K8SNodeConditionTypeKey is the attribute Key conforming to the @@ -9531,8 +8541,8 @@ const ( // When this occurs, the exact value as reported by the Kubernetes API SHOULD be // used. // - // [K8s documentation]: https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition - // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core + // [K8s documentation]: https://kubernetes.io/docs/reference/node/node-status/#condition + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#nodecondition-v1-core K8SNodeConditionTypeKey = attribute.Key("k8s.node.condition.type") // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" @@ -9540,7 +8550,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "node-1" K8SNodeNameKey = attribute.Key("k8s.node.name") @@ -9561,7 +8571,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2" K8SNodeUIDKey = attribute.Key("k8s.node.uid") @@ -9661,7 +8671,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "collector-gateway" // Note: The K8s Pod spec has an optional hostname field, which can be used to @@ -9681,7 +8691,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "172.18.0.2" // Note: This attribute aligns with the `podIP` field of the @@ -9695,7 +8705,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry-pod-autoconf" K8SPodNameKey = attribute.Key("k8s.pod.name") @@ -9706,7 +8716,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "2025-12-04T08:41:03Z" // Note: Date and time at which the object was acknowledged by the Kubelet. @@ -9750,7 +8760,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SPodUIDKey = attribute.Key("k8s.pod.uid") @@ -9761,7 +8771,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry" K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") @@ -9772,7 +8782,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") @@ -9985,7 +8995,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "opentelemetry" K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") @@ -9996,7 +9006,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Stable // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") @@ -10011,7 +9021,7 @@ const ( // // Examples: "gold.storageclass.storage.k8s.io" // - // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io + // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#storageclass-v1-storage-k8s-io K8SStorageclassNameKey = attribute.Key("k8s.storageclass.name") // K8SVolumeNameKey is the attribute Key conforming to the "k8s.volume.name" @@ -10559,7 +9569,7 @@ func K8SStatefulSetUID(val string) attribute.KeyValue { // "k8s.storageclass.name" semantic conventions. It represents the name of K8s // [StorageClass] object. // -// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io +// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#storageclass-v1-storage-k8s-io func K8SStorageclassName(val string) attribute.KeyValue { return K8SStorageclassNameKey.String(val) } @@ -10571,6 +9581,16 @@ func K8SVolumeName(val string) attribute.KeyValue { return K8SVolumeNameKey.String(val) } +// Enum values for k8s.container.ephemeral_storage.fs_type +var ( + // For the container's writable layer usage. + // Stability: development + K8SContainerEphemeralStorageFsTypeRootfs = K8SContainerEphemeralStorageFsTypeKey.String("rootfs") + // For the container's log files usage (stdout/stderr). + // Stability: development + K8SContainerEphemeralStorageFsTypeLogs = K8SContainerEphemeralStorageFsTypeKey.String("logs") +) + // Enum values for k8s.container.status.reason var ( // The container is being created. @@ -10809,32 +9829,32 @@ var ( // A [persistentVolumeClaim] volume // Stability: development // - // [persistentVolumeClaim]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim + // [persistentVolumeClaim]: https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim K8SVolumeTypePersistentVolumeClaim = K8SVolumeTypeKey.String("persistentVolumeClaim") // A [configMap] volume // Stability: development // - // [configMap]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap + // [configMap]: https://kubernetes.io/docs/concepts/storage/volumes/#configmap K8SVolumeTypeConfigMap = K8SVolumeTypeKey.String("configMap") // A [downwardAPI] volume // Stability: development // - // [downwardAPI]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi + // [downwardAPI]: https://kubernetes.io/docs/concepts/storage/volumes/#downwardapi K8SVolumeTypeDownwardAPI = K8SVolumeTypeKey.String("downwardAPI") // An [emptyDir] volume // Stability: development // - // [emptyDir]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir + // [emptyDir]: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir K8SVolumeTypeEmptyDir = K8SVolumeTypeKey.String("emptyDir") // A [secret] volume // Stability: development // - // [secret]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret + // [secret]: https://kubernetes.io/docs/concepts/storage/volumes/#secret K8SVolumeTypeSecret = K8SVolumeTypeKey.String("secret") // A [local] volume // Stability: development // - // [local]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local + // [local]: https://kubernetes.io/docs/concepts/storage/volumes/#local K8SVolumeTypeLocal = K8SVolumeTypeKey.String("local") ) @@ -10959,227 +9979,45 @@ func LogFilePathResolved(val string) attribute.KeyValue { // original Log Record. func LogRecordOriginal(val string) attribute.KeyValue { return LogRecordOriginalKey.String(val) -} - -// LogRecordUID returns an attribute KeyValue conforming to the "log.record.uid" -// semantic conventions. It represents a unique identifier for the Log Record. -func LogRecordUID(val string) attribute.KeyValue { - return LogRecordUIDKey.String(val) -} - -// Enum values for log.iostream -var ( - // Logs from stdout stream - // Stability: development - LogIostreamStdout = LogIostreamKey.String("stdout") - // Events from stderr stream - // Stability: development - LogIostreamStderr = LogIostreamKey.String("stderr") -) - -// Namespace: mainframe -const ( - // MainframeLparNameKey is the attribute Key conforming to the - // "mainframe.lpar.name" semantic conventions. It represents the name of the - // logical partition that hosts a systems with a mainframe operating system. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "LPAR01" - MainframeLparNameKey = attribute.Key("mainframe.lpar.name") -) - -// MainframeLparName returns an attribute KeyValue conforming to the -// "mainframe.lpar.name" semantic conventions. It represents the name of the -// logical partition that hosts a systems with a mainframe operating system. -func MainframeLparName(val string) attribute.KeyValue { - return MainframeLparNameKey.String(val) -} - -// Namespace: mcp -const ( - // McpMethodNameKey is the attribute Key conforming to the "mcp.method.name" - // semantic conventions. It represents the name of the request or notification - // method. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - McpMethodNameKey = attribute.Key("mcp.method.name") - - // McpProtocolVersionKey is the attribute Key conforming to the - // "mcp.protocol.version" semantic conventions. It represents the [version] of - // the Model Context Protocol used. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "2025-06-18" - // - // [version]: https://modelcontextprotocol.io/specification/versioning - McpProtocolVersionKey = attribute.Key("mcp.protocol.version") - - // McpResourceURIKey is the attribute Key conforming to the "mcp.resource.uri" - // semantic conventions. It represents the value of the resource uri. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "postgres://database/customers/schema", - // "file:///home/user/documents/report.pdf" - // Note: This is a URI of the resource provided in the following requests or - // notifications: `resources/read`, `resources/subscribe`, - // `resources/unsubscribe`, or `notifications/resources/updated`. - McpResourceURIKey = attribute.Key("mcp.resource.uri") - - // McpSessionIDKey is the attribute Key conforming to the "mcp.session.id" - // semantic conventions. It represents the identifies [MCP session]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "191c4850af6c49e08843a3f6c80e5046" - // - // [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management - McpSessionIDKey = attribute.Key("mcp.session.id") -) - -// McpProtocolVersion returns an attribute KeyValue conforming to the -// "mcp.protocol.version" semantic conventions. It represents the [version] of -// the Model Context Protocol used. -// -// [version]: https://modelcontextprotocol.io/specification/versioning -func McpProtocolVersion(val string) attribute.KeyValue { - return McpProtocolVersionKey.String(val) -} - -// McpResourceURI returns an attribute KeyValue conforming to the -// "mcp.resource.uri" semantic conventions. It represents the value of the -// resource uri. -func McpResourceURI(val string) attribute.KeyValue { - return McpResourceURIKey.String(val) -} - -// McpSessionID returns an attribute KeyValue conforming to the "mcp.session.id" -// semantic conventions. It represents the identifies [MCP session]. -// -// [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management -func McpSessionID(val string) attribute.KeyValue { - return McpSessionIDKey.String(val) -} - -// Enum values for mcp.method.name -var ( - // Notification cancelling a previously-issued request. - // - // Stability: development - McpMethodNameNotificationsCancelled = McpMethodNameKey.String("notifications/cancelled") - // Request to initialize the MCP client. - // - // Stability: development - McpMethodNameInitialize = McpMethodNameKey.String("initialize") - // Notification indicating that the MCP client has been initialized. - // - // Stability: development - McpMethodNameNotificationsInitialized = McpMethodNameKey.String("notifications/initialized") - // Notification indicating the progress for a long-running operation. - // - // Stability: development - McpMethodNameNotificationsProgress = McpMethodNameKey.String("notifications/progress") - // Request to check that the other party is still alive. - // - // Stability: development - McpMethodNamePing = McpMethodNameKey.String("ping") - // Request to list resources available on server. - // - // Stability: development - McpMethodNameResourcesList = McpMethodNameKey.String("resources/list") - // Request to list resource templates available on server. - // - // Stability: development - McpMethodNameResourcesTemplatesList = McpMethodNameKey.String("resources/templates/list") - // Request to read a resource. - // - // Stability: development - McpMethodNameResourcesRead = McpMethodNameKey.String("resources/read") - // Notification indicating that the list of resources has changed. - // - // Stability: development - McpMethodNameNotificationsResourcesListChanged = McpMethodNameKey.String("notifications/resources/list_changed") - // Request to subscribe to a resource. - // - // Stability: development - McpMethodNameResourcesSubscribe = McpMethodNameKey.String("resources/subscribe") - // Request to unsubscribe from resource updates. - // - // Stability: development - McpMethodNameResourcesUnsubscribe = McpMethodNameKey.String("resources/unsubscribe") - // Notification indicating that a resource has been updated. - // - // Stability: development - McpMethodNameNotificationsResourcesUpdated = McpMethodNameKey.String("notifications/resources/updated") - // Request to list prompts available on server. - // - // Stability: development - McpMethodNamePromptsList = McpMethodNameKey.String("prompts/list") - // Request to get a prompt. - // - // Stability: development - McpMethodNamePromptsGet = McpMethodNameKey.String("prompts/get") - // Notification indicating that the list of prompts has changed. - // - // Stability: development - McpMethodNameNotificationsPromptsListChanged = McpMethodNameKey.String("notifications/prompts/list_changed") - // Request to list tools available on server. - // - // Stability: development - McpMethodNameToolsList = McpMethodNameKey.String("tools/list") - // Request to call a tool. - // - // Stability: development - McpMethodNameToolsCall = McpMethodNameKey.String("tools/call") - // Notification indicating that the list of tools has changed. - // - // Stability: development - McpMethodNameNotificationsToolsListChanged = McpMethodNameKey.String("notifications/tools/list_changed") - // Request to set the logging level. - // - // Stability: development - McpMethodNameLoggingSetLevel = McpMethodNameKey.String("logging/setLevel") - // Notification indicating that a message has been received. - // - // Stability: development - McpMethodNameNotificationsMessage = McpMethodNameKey.String("notifications/message") - // Request to create a sampling message. - // - // Stability: development - McpMethodNameSamplingCreateMessage = McpMethodNameKey.String("sampling/createMessage") - // Request to complete a prompt. - // +} + +// LogRecordUID returns an attribute KeyValue conforming to the "log.record.uid" +// semantic conventions. It represents a unique identifier for the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Enum values for log.iostream +var ( + // Logs from stdout stream // Stability: development - McpMethodNameCompletionComplete = McpMethodNameKey.String("completion/complete") - // Request to list roots available on server. - // + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream // Stability: development - McpMethodNameRootsList = McpMethodNameKey.String("roots/list") - // Notification indicating that the list of roots has changed. + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// Namespace: mainframe +const ( + // MainframeLparNameKey is the attribute Key conforming to the + // "mainframe.lpar.name" semantic conventions. It represents the name of the + // logical partition that hosts a systems with a mainframe operating system. // - // Stability: development - McpMethodNameNotificationsRootsListChanged = McpMethodNameKey.String("notifications/roots/list_changed") - // Request from the server to elicit additional information from the user via - // the client + // Type: string + // RequirementLevel: Recommended + // Stability: Development // - // Stability: development - McpMethodNameElicitationCreate = McpMethodNameKey.String("elicitation/create") + // Examples: "LPAR01" + MainframeLparNameKey = attribute.Key("mainframe.lpar.name") ) +// MainframeLparName returns an attribute KeyValue conforming to the +// "mainframe.lpar.name" semantic conventions. It represents the name of the +// logical partition that hosts a systems with a mainframe operating system. +func MainframeLparName(val string) attribute.KeyValue { + return MainframeLparNameKey.String(val) +} + // Namespace: messaging const ( // MessagingBatchMessageCountKey is the attribute Key conforming to the @@ -12073,12 +10911,14 @@ const ( NetworkInterfaceNameKey = attribute.Key("network.interface.name") // NetworkIODirectionKey is the attribute Key conforming to the - // "network.io.direction" semantic conventions. It represents the network IO - // operation direction. + // "network.io.direction" semantic conventions. It represents the direction of + // traffic from the perspective of the observing host's physical or virtual + // network interface. It should not be used to represent the logical direction + // of a stateful connection or network flow. // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "transmit" NetworkIODirectionKey = attribute.Key("network.io.direction") @@ -12395,10 +11235,10 @@ var ( // Enum values for network.io.direction var ( // transmit - // Stability: development + // Stability: release_candidate NetworkIODirectionTransmit = NetworkIODirectionKey.String("transmit") // receive - // Stability: development + // Stability: release_candidate NetworkIODirectionReceive = NetworkIODirectionKey.String("receive") ) @@ -12577,90 +11417,6 @@ func OncRPCVersion(val int) attribute.KeyValue { return OncRPCVersionKey.Int(val) } -// Namespace: openai -const ( - // OpenAIAPITypeKey is the attribute Key conforming to the "openai.api.type" - // semantic conventions. It represents the type of OpenAI API being used. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: - OpenAIAPITypeKey = attribute.Key("openai.api.type") - - // OpenAIRequestServiceTierKey is the attribute Key conforming to the - // "openai.request.service_tier" semantic conventions. It represents the service - // tier requested. May be a specific tier, default, or auto. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "auto", "default" - OpenAIRequestServiceTierKey = attribute.Key("openai.request.service_tier") - - // OpenAIResponseServiceTierKey is the attribute Key conforming to the - // "openai.response.service_tier" semantic conventions. It represents the - // service tier used for the response. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "scale", "default" - OpenAIResponseServiceTierKey = attribute.Key("openai.response.service_tier") - - // OpenAIResponseSystemFingerprintKey is the attribute Key conforming to the - // "openai.response.system_fingerprint" semantic conventions. It represents a - // fingerprint to track any eventual change in the Generative AI environment. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "fp_44709d6fcb" - OpenAIResponseSystemFingerprintKey = attribute.Key("openai.response.system_fingerprint") -) - -// OpenAIResponseServiceTier returns an attribute KeyValue conforming to the -// "openai.response.service_tier" semantic conventions. It represents the service -// tier used for the response. -func OpenAIResponseServiceTier(val string) attribute.KeyValue { - return OpenAIResponseServiceTierKey.String(val) -} - -// OpenAIResponseSystemFingerprint returns an attribute KeyValue conforming to -// the "openai.response.system_fingerprint" semantic conventions. It represents a -// fingerprint to track any eventual change in the Generative AI environment. -func OpenAIResponseSystemFingerprint(val string) attribute.KeyValue { - return OpenAIResponseSystemFingerprintKey.String(val) -} - -// Enum values for openai.api.type -var ( - // The OpenAI [Chat Completions API]. - // Stability: development - // - // [Chat Completions API]: https://developers.openai.com/api/reference/chat-completions/overview - OpenAIAPITypeChatCompletions = OpenAIAPITypeKey.String("chat_completions") - // The OpenAI [Responses API]. - // Stability: development - // - // [Responses API]: https://developers.openai.com/api/reference/responses/overview - OpenAIAPITypeResponses = OpenAIAPITypeKey.String("responses") -) - -// Enum values for openai.request.service_tier -var ( - // The system will utilize scale tier credits until they are exhausted. - // Stability: development - OpenAIRequestServiceTierAuto = OpenAIRequestServiceTierKey.String("auto") - // The system will utilize the default scale tier. - // Stability: development - OpenAIRequestServiceTierDefault = OpenAIRequestServiceTierKey.String("default") -) - // Namespace: openshift const ( // OpenShiftClusterquotaNameKey is the attribute Key conforming to the @@ -12733,7 +11489,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "example.com", "corp.internal", "prod.db.local" // Note: This attribute SHOULD be set to the value of the `DB_DOMAIN` @@ -12753,7 +11509,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "ORCL1", "ORCL2", "ORCL3" // Note: There can be multiple instances associated with a single database @@ -12769,7 +11525,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "ORCL1", "FREE" // Note: This attribute SHOULD be set to the value of the parameter `DB_NAME` @@ -12782,7 +11538,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "PDB1", "FREEPDB" // Note: This attribute SHOULD reflect the PDB that the session is currently @@ -12800,7 +11556,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "order-processing-service", "db_low.adb.oraclecloud.com", // "db_high.adb.oraclecloud.com" @@ -13529,7 +12285,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 4 // Note: This field can be useful for querying or performing bucket analysis on @@ -13545,7 +12301,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "cmd/otelcol" ProcessCommandKey = attribute.Key("process.command") @@ -13561,7 +12317,7 @@ const ( // // Type: string[] // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "cmd/otecol", "--config=config.yaml" ProcessCommandArgsKey = attribute.Key("process.command_args") @@ -13576,7 +12332,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "C:\cmd\otecol --config="my directory\config.yaml"" ProcessCommandLineKey = attribute.Key("process.command_line") @@ -13588,7 +12344,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: ProcessContextSwitchTypeKey = attribute.Key("process.context_switch.type") @@ -13599,7 +12355,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "2023-11-21T09:25:34.853Z" ProcessCreationTimeKey = attribute.Key("process.creation.time") @@ -13610,7 +12366,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "c89b11207f6479603b0d49bf291c092c2b719293" ProcessExecutableBuildIDGNUKey = attribute.Key("process.executable.build_id.gnu") @@ -13621,7 +12377,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: // "foh3mEXu7BLZjsN9pOwG/kATcXlYVCDEFouRMQed_/WwRFB1hPo9LBkekthSPG/x8hMC8emW2cCjXD0_1aY" @@ -13633,7 +12389,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "600DCAFE4A110000F2BF38C493F5FB92" // Note: GNU and Go build IDs may be stripped or unavailable in some @@ -13660,7 +12416,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "otelcol" ProcessExecutableNameKey = attribute.Key("process.executable.name") @@ -13673,7 +12429,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "/usr/bin/cmd/otelcol" ProcessExecutablePathKey = attribute.Key("process.executable.path") @@ -13683,7 +12439,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 127 ProcessExitCodeKey = attribute.Key("process.exit.code") @@ -13694,7 +12450,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "2023-11-21T09:26:12.315Z" ProcessExitTimeKey = attribute.Key("process.exit.time") @@ -13706,7 +12462,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 23 ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") @@ -13717,7 +12473,7 @@ const ( // // Type: boolean // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: ProcessInteractiveKey = attribute.Key("process.interactive") @@ -13728,7 +12484,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "1:name=systemd:/user.slice/user-1000.slice/session-3.scope", // "0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope" @@ -13746,7 +12502,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "root" ProcessOwnerKey = attribute.Key("process.owner") @@ -13757,7 +12513,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 111 ProcessParentPIDKey = attribute.Key("process.parent_pid") @@ -13767,7 +12523,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 1234 ProcessPIDKey = attribute.Key("process.pid") @@ -13778,7 +12534,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 1000 ProcessRealUserIDKey = attribute.Key("process.real_user.id") @@ -13789,7 +12545,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "operator" ProcessRealUserNameKey = attribute.Key("process.real_user.name") @@ -13801,7 +12557,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0 ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") @@ -13812,7 +12568,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "OpenJDK Runtime Environment" ProcessRuntimeNameKey = attribute.Key("process.runtime.name") @@ -13823,7 +12579,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 14.0.2 ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") @@ -13834,7 +12590,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 1002 ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") @@ -13845,7 +12601,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "operator" ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") @@ -13857,7 +12613,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 14 ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") @@ -13868,7 +12624,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "running" // @@ -13880,7 +12636,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "cat /etc/hostname", "xfce4-session", "bash" // Note: In many Unix-like systems, process title (proctitle), is the string @@ -13894,7 +12650,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 1001 ProcessUserIDKey = attribute.Key("process.user.id") @@ -13905,7 +12661,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "root" ProcessUserNameKey = attribute.Key("process.user.name") @@ -13915,7 +12671,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: 12 // Note: The process ID within a PID namespace. This is not necessarily unique @@ -13929,7 +12685,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "/root" ProcessWorkingDirectoryKey = attribute.Key("process.working_directory") @@ -14178,26 +12934,26 @@ func ProcessWorkingDirectory(val string) attribute.KeyValue { // Enum values for process.context_switch.type var ( // voluntary - // Stability: development + // Stability: release_candidate ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") // involuntary - // Stability: development + // Stability: release_candidate ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") ) // Enum values for process.state var ( // running - // Stability: development + // Stability: release_candidate ProcessStateRunning = ProcessStateKey.String("running") // sleeping - // Stability: development + // Stability: release_candidate ProcessStateSleeping = ProcessStateKey.String("sleeping") // stopped - // Stability: development + // Stability: release_candidate ProcessStateStopped = ProcessStateKey.String("stopped") // defunct - // Stability: development + // Stability: release_candidate ProcessStateDefunct = ProcessStateKey.String("defunct") ) @@ -14293,6 +13049,12 @@ var ( // // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) ProfileFrameTypeRust = ProfileFrameTypeKey.String("rust") + // [LuaJIT] + // + // Stability: development + // + // [LuaJIT]: https://en.wikipedia.org/wiki/LuaJIT + ProfileFrameTypeLuajit = ProfileFrameTypeKey.String("luajit") ) // Namespace: rpc @@ -14642,7 +13404,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Alpha // // Examples: "critical", "high", "medium", "low" // Note: Application developers are encouraged to set `service.criticality` to @@ -14840,21 +13602,21 @@ var ( // Service is business-critical; downtime directly impacts revenue, user // experience, or core functionality. // - // Stability: development + // Stability: alpha ServiceCriticalityCritical = ServiceCriticalityKey.String("critical") // Service is important but has degradation tolerance or fallback mechanisms. // - // Stability: development + // Stability: alpha ServiceCriticalityHigh = ServiceCriticalityKey.String("high") // Service provides supplementary functionality; degradation has limited user // impact. // - // Stability: development + // Stability: alpha ServiceCriticalityMedium = ServiceCriticalityKey.String("medium") // Service is non-essential to core operations; used for background tasks or // internal tools. // - // Stability: development + // Stability: alpha ServiceCriticalityLow = ServiceCriticalityKey.String("low") ) @@ -15095,7 +13857,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "minor" SystemPagingFaultTypeKey = attribute.Key("system.paging.fault.type") @@ -15216,10 +13978,10 @@ var ( // Enum values for system.paging.fault.type var ( // major - // Stability: development + // Stability: release_candidate SystemPagingFaultTypeMajor = SystemPagingFaultTypeKey.String("major") // minor - // Stability: development + // Stability: release_candidate SystemPagingFaultTypeMinor = SystemPagingFaultTypeKey.String("minor") ) @@ -15350,6 +14112,9 @@ var ( // java // Stability: stable TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // kotlin + // Stability: stable + TelemetrySDKLanguageKotlin = TelemetrySDKLanguageKey.String("kotlin") // nodejs // Stability: stable TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") @@ -16191,8 +14956,9 @@ const ( // replaced by the // value `REDACTED`: // - // - [`AWSAccessKeyId`] - // - [`Signature`] + // - [`X-Amz-Signature`] + // - [`X-Amz-Credential`] + // - [`X-Amz-Security-Token`] // - [`sig`] // - [`X-Goog-Signature`] // @@ -16215,8 +14981,9 @@ const ( // `https://www.example.com/path?color=blue&sig=REDACTED`. // // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 - // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`X-Amz-Signature`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html + // [`X-Amz-Credential`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html + // [`X-Amz-Security-Token`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls URLFullKey = attribute.Key("url.full") @@ -16278,8 +15045,9 @@ const ( // Query string values for the following keys SHOULD be redacted by default and // replaced by the value `REDACTED`: // - // - [`AWSAccessKeyId`] - // - [`Signature`] + // - [`X-Amz-Signature`] + // - [`X-Amz-Credential`] + // - [`X-Amz-Security-Token`] // - [`sig`] // - [`X-Goog-Signature`] // @@ -16301,8 +15069,9 @@ const ( // `q=OpenTelemetry&sig=REDACTED`. // // [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 - // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`X-Amz-Signature`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html + // [`X-Amz-Credential`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html + // [`X-Amz-Security-Token`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls URLQueryKey = attribute.Key("url.query") @@ -16752,7 +15521,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "123" VCSChangeIDKey = attribute.Key("vcs.change.id") @@ -16763,7 +15532,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "open", "closed", "merged" VCSChangeStateKey = attribute.Key("vcs.change.state") @@ -16775,7 +15544,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "Fixes broken thing", "feat: add my new feature", "[chore] update // dependency" @@ -16787,7 +15556,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "added", "removed" VCSLineChangeTypeKey = attribute.Key("vcs.line_change.type") @@ -16798,7 +15567,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "my-org", "myteam", "business-unit" VCSOwnerNameKey = attribute.Key("vcs.owner.name") @@ -16809,7 +15578,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "github", "gitlab", "gitea", "bitbucket" VCSProviderNameKey = attribute.Key("vcs.provider.name") @@ -16820,7 +15589,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "my-feature-branch", "tag-1-test" // Note: `base` refers to the starting point of a change. For example, `main` @@ -16837,7 +15606,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", // "main", "123", "HEAD" @@ -16869,7 +15638,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "branch", "tag" // Note: `base` refers to the starting point of a change. For example, `main` @@ -16885,7 +15654,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "my-feature-branch", "tag-1-test" // Note: `head` refers to where you are right now; the current reference at a @@ -16901,7 +15670,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", // "main", "123", "HEAD" @@ -16931,7 +15700,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "branch", "tag" // Note: `head` refers to where you are right now; the current reference at a @@ -16945,7 +15714,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "branch", "tag" // @@ -16959,7 +15728,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "semantic-conventions", "my-cool-repo" // Note: Due to it only being the name, it can clash with forks of the same @@ -16974,7 +15743,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: // "https://github.com/opentelemetry/open-telemetry-collector-contrib", @@ -16991,7 +15760,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Development + // Stability: Release_Candidate // // Examples: "ahead", "behind" VCSRevisionDeltaDirectionKey = attribute.Key("vcs.revision_delta.direction") @@ -17082,53 +15851,53 @@ var ( // Open means the change is currently active and under review. It hasn't been // merged into the target branch yet, and it's still possible to make changes or // add comments. - // Stability: development + // Stability: release_candidate VCSChangeStateOpen = VCSChangeStateKey.String("open") // WIP (work-in-progress, draft) means the change is still in progress and not // yet ready for a full review. It might still undergo significant changes. - // Stability: development + // Stability: release_candidate VCSChangeStateWip = VCSChangeStateKey.String("wip") // Closed means the merge request has been closed without merging. This can // happen for various reasons, such as the changes being deemed unnecessary, the // issue being resolved in another way, or the author deciding to withdraw the // request. - // Stability: development + // Stability: release_candidate VCSChangeStateClosed = VCSChangeStateKey.String("closed") // Merged indicates that the change has been successfully integrated into the // target codebase. - // Stability: development + // Stability: release_candidate VCSChangeStateMerged = VCSChangeStateKey.String("merged") ) // Enum values for vcs.line_change.type var ( // How many lines were added. - // Stability: development + // Stability: release_candidate VCSLineChangeTypeAdded = VCSLineChangeTypeKey.String("added") // How many lines were removed. - // Stability: development + // Stability: release_candidate VCSLineChangeTypeRemoved = VCSLineChangeTypeKey.String("removed") ) // Enum values for vcs.provider.name var ( // [GitHub] - // Stability: development + // Stability: release_candidate // // [GitHub]: https://github.com VCSProviderNameGithub = VCSProviderNameKey.String("github") // [GitLab] - // Stability: development + // Stability: release_candidate // // [GitLab]: https://gitlab.com VCSProviderNameGitlab = VCSProviderNameKey.String("gitlab") // [Gitea] - // Stability: development + // Stability: release_candidate // // [Gitea]: https://gitea.io VCSProviderNameGitea = VCSProviderNameKey.String("gitea") // [Bitbucket] - // Stability: development + // Stability: release_candidate // // [Bitbucket]: https://bitbucket.org VCSProviderNameBitbucket = VCSProviderNameKey.String("bitbucket") @@ -17137,12 +15906,12 @@ var ( // Enum values for vcs.ref.base.type var ( // [branch] - // Stability: development + // Stability: release_candidate // // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch VCSRefBaseTypeBranch = VCSRefBaseTypeKey.String("branch") // [tag] - // Stability: development + // Stability: release_candidate // // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag VCSRefBaseTypeTag = VCSRefBaseTypeKey.String("tag") @@ -17151,12 +15920,12 @@ var ( // Enum values for vcs.ref.head.type var ( // [branch] - // Stability: development + // Stability: release_candidate // // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch VCSRefHeadTypeBranch = VCSRefHeadTypeKey.String("branch") // [tag] - // Stability: development + // Stability: release_candidate // // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag VCSRefHeadTypeTag = VCSRefHeadTypeKey.String("tag") @@ -17165,12 +15934,12 @@ var ( // Enum values for vcs.ref.type var ( // [branch] - // Stability: development + // Stability: release_candidate // // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch VCSRefTypeBranch = VCSRefTypeKey.String("branch") // [tag] - // Stability: development + // Stability: release_candidate // // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag VCSRefTypeTag = VCSRefTypeKey.String("tag") @@ -17179,10 +15948,10 @@ var ( // Enum values for vcs.revision_delta.direction var ( // How many revisions the change is behind the target ref. - // Stability: development + // Stability: release_candidate VCSRevisionDeltaDirectionBehind = VCSRevisionDeltaDirectionKey.String("behind") // How many revisions the change is ahead of the target ref. - // Stability: development + // Stability: release_candidate VCSRevisionDeltaDirectionAhead = VCSRevisionDeltaDirectionKey.String("ahead") ) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/doc.go similarity index 83% rename from vendor/go.opentelemetry.io/otel/semconv/v1.41.0/doc.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.43.0/doc.go index a45d424d8..aadce15c0 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/doc.go @@ -6,6 +6,6 @@ // Package semconv implements OpenTelemetry semantic conventions. // // OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the v1.41.0 +// patterns for OpenTelemetry things. This package represents the v1.43.0 // version of the OpenTelemetry semantic conventions. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0" +package semconv diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/error_type.go similarity index 96% rename from vendor/go.opentelemetry.io/otel/semconv/v1.41.0/error_type.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.43.0/error_type.go index 0b13f0de8..5d8eff222 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/error_type.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/error_type.go @@ -3,7 +3,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0" +package semconv import ( "errors" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/exception.go similarity index 80% rename from vendor/go.opentelemetry.io/otel/semconv/v1.41.0/exception.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.43.0/exception.go index 5f0151aff..6c9b05adb 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/exception.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/exception.go @@ -3,7 +3,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0" +package semconv const ( // ExceptionEventName is the name of the Span event representing an exception. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/schema.go similarity index 75% rename from vendor/go.opentelemetry.io/otel/semconv/v1.41.0/schema.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.43.0/schema.go index 24948a48f..ce5f5f5c5 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/schema.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/schema.go @@ -3,9 +3,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv // import "go.opentelemetry.io/otel/semconv/v1.41.0" +package semconv // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare // non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.41.0" +const SchemaURL = "https://opentelemetry.io/schemas/1.43.0" diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go index 6836c6547..9c1567a2e 100644 --- a/vendor/go.opentelemetry.io/otel/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/trace/auto.go b/vendor/go.opentelemetry.io/otel/trace/auto.go index a75cf047d..17cf898cd 100644 --- a/vendor/go.opentelemetry.io/otel/trace/auto.go +++ b/vendor/go.opentelemetry.io/otel/trace/auto.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "context" @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.41.0" + semconv "go.opentelemetry.io/otel/semconv/v1.43.0" "go.opentelemetry.io/otel/trace/embedded" "go.opentelemetry.io/otel/trace/internal/telemetry" ) @@ -358,6 +358,16 @@ func convAttrValue(value attribute.Value) telemetry.Value { out = append(out, convAttrValue(v)) } return telemetry.SliceValue(out...) + case attribute.MAP: + kvs := value.AsMap() + out := make([]telemetry.Attr, 0, len(kvs)) + for _, kv := range kvs { + out = append(out, telemetry.Attr{ + Key: string(kv.Key), + Value: convAttrValue(kv.Value), + }) + } + return telemetry.MapValue(out...) } return telemetry.Value{} } diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go index 4cedba5ac..862ecc898 100644 --- a/vendor/go.opentelemetry.io/otel/trace/config.go +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "slices" diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go index 8c45a7107..89927eda6 100644 --- a/vendor/go.opentelemetry.io/otel/trace/context.go +++ b/vendor/go.opentelemetry.io/otel/trace/context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go index cdbf41d6d..57de8f348 100644 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -116,4 +116,4 @@ It is strongly recommended that authors only embed That implementation is the only one OpenTelemetry authors can guarantee will fully implement all the API interfaces when a user updates their API. */ -package trace // import "go.opentelemetry.io/otel/trace" +package trace diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go index 3e359a00b..59d8a510b 100644 --- a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go @@ -11,7 +11,7 @@ // the API package). // // [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace -package embedded // import "go.opentelemetry.io/otel/trace/embedded" +package embedded // TracerProvider is embedded in // [go.opentelemetry.io/otel/trace.TracerProvider]. diff --git a/vendor/go.opentelemetry.io/otel/trace/hex.go b/vendor/go.opentelemetry.io/otel/trace/hex.go index 1cbef1d4b..5f156b0dc 100644 --- a/vendor/go.opentelemetry.io/otel/trace/hex.go +++ b/vendor/go.opentelemetry.io/otel/trace/hex.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace const ( // hexLU is a hex lookup table of the 16 lowercase hex digits. diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go index ff0f6eac6..9503318eb 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry // Attr is a key-value pair. type Attr struct { diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go index 5debe90bb..949e2165c 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go @@ -5,4 +5,4 @@ Package telemetry provides a lightweight representations of OpenTelemetry telemetry that is compatible with the OTLP JSON protobuf encoding. */ -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go index bea56f2e7..3a6d6b87a 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "encoding/hex" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go index f5e3a8cec..29e629d66 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "encoding/json" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go index 1798a702d..cecad8bae 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go index c2b4c635b..b6f2e28d4 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go index 61c7819a2..0da6e5fd6 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go index 1039bf40c..5dac1b2cb 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry // StatusCode is the status of a Span. // diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go index e5f10767c..44197b808 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go index cb7927b81..9d2d68063 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" +package telemetry import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go index c00221e7b..d672f03c2 100644 --- a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go +++ b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace // nonRecordingSpan is a minimal implementation of a Span that wraps a // SpanContext. It performs no operations other than to return the wrapped diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go index 400fab123..b954251b2 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go index 689d220df..4f8190e41 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go @@ -10,7 +10,7 @@ // This implementation can be embedded in other implementations of the // OpenTelemetry trace API. Doing so will mean the implementation defaults to // no operation for methods it does not implement. -package noop // import "go.opentelemetry.io/otel/trace/noop" +package noop import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/provider.go b/vendor/go.opentelemetry.io/otel/trace/provider.go index ef85cb70c..891cc0b8c 100644 --- a/vendor/go.opentelemetry.io/otel/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/trace/provider.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import "go.opentelemetry.io/otel/trace/embedded" diff --git a/vendor/go.opentelemetry.io/otel/trace/span.go b/vendor/go.opentelemetry.io/otel/trace/span.go index d01e79366..603b2c146 100644 --- a/vendor/go.opentelemetry.io/otel/trace/span.go +++ b/vendor/go.opentelemetry.io/otel/trace/span.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index e3d103c4b..c4c383819 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "encoding/json" diff --git a/vendor/go.opentelemetry.io/otel/trace/tracer.go b/vendor/go.opentelemetry.io/otel/trace/tracer.go index 77952d2a0..7e6e5ee93 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracer.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracer.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go index e9cb3fd4d..9ac78fa04 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace // import "go.opentelemetry.io/otel/trace" +package trace import ( "encoding/json" diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index 72746acfd..ea7903096 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -1,9 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel // import "go.opentelemetry.io/otel" +package otel // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.44.0" + return "1.45.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index d6dbf803e..3b1ad7301 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -3,7 +3,7 @@ module-sets: stable-v1: - version: v1.44.0 + version: v1.45.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -22,12 +22,12 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.66.0 + version: v0.67.0 modules: - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/metric/x experimental-logs: - version: v0.20.0 + version: v0.21.0 modules: - go.opentelemetry.io/otel/log - go.opentelemetry.io/otel/log/logtest @@ -37,7 +37,7 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp - go.opentelemetry.io/otel/exporters/stdout/stdoutlog experimental-schema: - version: v0.0.17 + version: v0.0.18 modules: - go.opentelemetry.io/otel/schema excluded-modules: diff --git a/vendor/go.yaml.in/yaml/v3/parserc.go b/vendor/go.yaml.in/yaml/v3/parserc.go index 25fe82363..f35829db4 100644 --- a/vendor/go.yaml.in/yaml/v3/parserc.go +++ b/vendor/go.yaml.in/yaml/v3/parserc.go @@ -226,9 +226,9 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool } // Parse the production: -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END // -// ************ +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -249,13 +249,11 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) } // Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// -// * // -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// -// ************************* +// implicit_document ::= block_node DOCUMENT-END* +// * +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -359,9 +357,9 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t } // Parse the productions: -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // -// *********** +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -382,11 +380,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event } // Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// -// ************* // -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// implicit_document ::= block_node DOCUMENT-END* +// ************* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -432,42 +429,32 @@ func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) } // Parse the productions: -// block_node_or_indentless_sequence ::= -// -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * -// -// block_node ::= ALIAS -// -// ***** -// | properties block_content? -// ********** * -// | block_content -// * -// -// flow_node ::= ALIAS -// -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * -// -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// -// ************************* -// -// block_content ::= block_collection | flow_collection | SCALAR -// -// ****** // -// flow_content ::= flow_collection | SCALAR -// -// ****** +// block_node_or_indentless_sequence ::= +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// block_node ::= ALIAS +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// flow_node ::= ALIAS +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// ************************* +// block_content ::= block_collection | flow_collection | SCALAR +// ****** +// flow_content ::= flow_collection | SCALAR +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -697,9 +684,9 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i } // Parse the productions: -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END // -// ******************** *********** * ********* +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -755,9 +742,9 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e } // Parse the productions: -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ // -// *********** * +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -821,15 +808,15 @@ func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { } // Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START // -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* +// block_mapping ::= BLOCK-MAPPING_START +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -896,13 +883,14 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even } // Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? +// block_mapping ::= BLOCK-MAPPING_START +// +// ((KEY block_node_or_indentless_sequence?)? // -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -929,19 +917,17 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev } // Parse the productions: -// flow_sequence ::= FLOW-SEQUENCE-START -// -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** // -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// -// * +// flow_sequence ::= FLOW-SEQUENCE-START +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -1005,9 +991,9 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev } // Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // -// *** * +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1026,9 +1012,9 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev } // Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // -// ***** * +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1050,9 +1036,9 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, } // Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // -// * +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1068,18 +1054,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev } // Parse the productions: -// flow_mapping ::= FLOW-MAPPING-START -// -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** // -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// - *** * +// flow_mapping ::= FLOW-MAPPING-START +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -1144,8 +1129,9 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event } // Parse the productions: -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// - ***** * +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/vendor/go.yaml.in/yaml/v3/yamlh.go b/vendor/go.yaml.in/yaml/v3/yamlh.go index f59aa40f6..07c442361 100644 --- a/vendor/go.yaml.in/yaml/v3/yamlh.go +++ b/vendor/go.yaml.in/yaml/v3/yamlh.go @@ -433,21 +433,19 @@ type yaml_document_t struct { // The prototype of a read handler. // -// The read handler is called when the parser needs to read more bytes from the -// source. The handler should write not more than size bytes to the buffer. -// The number of written bytes should be set to the size_read variable. +// The read handler is called when the parser needs to read more bytes from the +// source. The handler should write not more than size bytes to the buffer. +// The number of written bytes should be set to the size_read variable. // -// [in,out] data A pointer to an application data specified by +// [in,out] data A pointer to an application data specified by +// yaml_parser_set_input(). +// [out] buffer The buffer to write the data from the source. +// [in] size The size of the buffer. +// [out] size_read The actual number of bytes read from the source. // -// yaml_parser_set_input(). -// -// [out] buffer The buffer to write the data from the source. -// [in] size The size of the buffer. -// [out] size_read The actual number of bytes read from the source. -// -// On success, the handler should return 1. If the handler failed, -// the returned value should be 0. On EOF, the handler should set the -// size_read to 0 and return 1. +// On success, the handler should return 1. If the handler failed, +// the returned value should be 0. On EOF, the handler should set the +// size_read to 0 and return 1. type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) // This structure holds information about a potential simple key. @@ -655,19 +653,17 @@ type yaml_comment_t struct { // The prototype of a write handler. // -// The write handler is called when the emitter needs to flush the accumulated -// characters to the output. The handler should write @a size bytes of the -// @a buffer to the output. -// -// @param[in,out] data A pointer to an application data specified by -// -// yaml_emitter_set_output(). +// The write handler is called when the emitter needs to flush the accumulated +// characters to the output. The handler should write @a size bytes of the +// @a buffer to the output. // -// @param[in] buffer The buffer with bytes to be written. -// @param[in] size The size of the buffer. +// @param[in,out] data A pointer to an application data specified by +// yaml_emitter_set_output(). +// @param[in] buffer The buffer with bytes to be written. +// @param[in] size The size of the buffer. // -// @returns On success, the handler should return @c 1. If the handler failed, -// the returned value should be @c 0. +// @returns On success, the handler should return @c 1. If the handler failed, +// the returned value should be @c 0. type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go index 8d99551fe..b1da45687 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (!amd64 && !loong64 && !ppc64le && !ppc64 && !s390x) || !gc || purego +//go:build (!amd64 && !loong64 && !ppc64le && !ppc64 && !riscv64 && !s390x) || !gc || purego package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_asm.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_asm.go index 315b84ac3..55041bf51 100644 --- a/vendor/golang.org/x/crypto/internal/poly1305/sum_asm.go +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_asm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build gc && !purego && (amd64 || loong64 || ppc64 || ppc64le) +//go:build gc && !purego && (amd64 || loong64 || ppc64 || ppc64le || riscv64) package poly1305 diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_riscv64.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_riscv64.s new file mode 100644 index 000000000..ce5eb3d43 --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_riscv64.s @@ -0,0 +1,158 @@ +// Copyright 2026 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build gc && !purego + +#define LOAD64U(base, offset, t0, t1, t2, t3, dst) \ + MOVBU (offset+0*1)(base), t0; \ + MOVBU (offset+1*1)(base), t1; \ + MOVBU (offset+2*1)(base), t2; \ + MOVBU (offset+3*1)(base), t3; \ + SLL $8, t1; \ + SLL $16, t2; \ + SLL $24, t3; \ + OR t1, t0; \ + OR t3, t2; \ + OR t2, t0, dst; \ + MOVBU (offset+4*1)(base), t0; \ + MOVBU (offset+5*1)(base), t1; \ + MOVBU (offset+6*1)(base), t2; \ + MOVBU (offset+7*1)(base), t3; \ + SLL $32, t0; \ + SLL $40, t1; \ + SLL $48, t2; \ + SLL $56, t3; \ + OR t1, t0; \ + OR t3, t2; \ + OR t2, t0; \ + OR t0, dst + +// func update(state *macState, msg []byte) +TEXT ·update(SB), $0-32 + MOV state+0(FP), X5 + MOV msg_base+8(FP), X6 + MOV msg_len+16(FP), X7 + + MOV $16, X8 + + AND $7, X6, X28 + + MOV (0*8)(X5), X9 // h0 + MOV (1*8)(X5), X10 // h1 + MOV (2*8)(X5), X11 // h2 + MOV (3*8)(X5), X12 // r0 + MOV (4*8)(X5), X13 // r1 + + BLT X7, X8, tail + +loop: + BEQZ X28, aligned_load + + LOAD64U(X6, 0*8, X16, X18, X19, X20, X15) // msg[0:8] + LOAD64U(X6, 1*8, X16, X18, X19, X20, X17) // msg[8:16] + JMP block + +aligned_load: + MOV (0*8)(X6), X15 // msg[0:8] + MOV (1*8)(X6), X17 // msg[8:16] + +block: + ADD X15, X9 // h0 (x1 + y1 = z1', if z1' < x1 then z1' overflow) + SLTU X15, X9, X19 // h0.carry + ADD X17, X10, X22 + SLTU X17, X22, X23 + ADD X22, X19, X10 // h1 + SLTU X22, X10, X19 + OR X23, X19 // h1.carry + ADD $1, X19 + ADD X19, X11 // h2 + + ADD $16, X6 // msg = msg[16:] + +multiply: + MULHU X9, X12, X16 // h0r0.hi + MUL X9, X12, X15 // h0r0.lo + MULHU X10, X12, X17 // h1r0.hi + MUL X10, X12, X14 // h1r0.lo + ADD X14, X16 + SLTU X14, X16, X19 + ADD X19, X17 + MUL X11, X12, X20 + ADD X17, X20 + MULHU X9, X13, X17 // h0r1.hi + MUL X9, X13, X14 // h0r1.lo + ADD X14, X16 + SLTU X14, X16, X19 + ADD X19, X17 + MOV X17, X9 + MUL X11, X13, X21 // h2r1 + MULHU X10, X13, X17 // h1r1.hi + MUL X10, X13, X14 // h1r1.lo + ADD X14, X20 + ADD X17, X21, X22 + SLTU X14, X20, X19 + ADD X22, X19, X21 + ADD X9, X20 + SLTU X9, X20, X19 + ADD X19, X21 + AND $3, X20, X11 + AND $-4, X20, X18 + ADD X18, X15, X9 + ADD X21, X16, X22 + SLTU X18, X9, X19 + SLTU X21, X22, X23 + ADD X22, X19, X10 + SLTU X22, X10, X19 + OR X19, X23, X19 + ADD X19, X11 + SLL $62, X21, X22 + SRL $2, X20, X23 + SRL $2, X21, X21 + OR X22, X23, X20 + ADD X20, X9, X9 + ADD X21, X10, X22 + SLTU X20, X9, X19 + SLTU X21, X22, X23 + ADD X22, X19, X10 + SLTU X22, X10, X19 + OR X19, X23, X19 + ADD X19, X11, X11 + + SUB $16, X7, X7 + BGE X7, X8, loop + +tail: + BEQ X7, X0, done + MOV $1, X15 + MOV $0, X16 + ADD X7, X6, X6 + +flush_buffer: + MOVBU -1(X6), X20 + SRL $56, X15, X19 + SLL $8, X16, X23 + SLL $8, X15, X15 + OR X19, X23, X16 + XOR X20, X15 + SUB $1, X7, X7 + SUB $1, X6, X6 + BNE X7, X0, flush_buffer + + ADD X15, X9 + SLTU X15, X9, X19 + ADD X16, X10, X22 + SLTU X16, X22, X23 + ADD X22, X19, X10 + SLTU X22, X10, X19 + OR X23, X19 + ADD X19, X11 + + MOV $16, X7 + JMP multiply + +done: + MOV X9, (0*8)(X5) // h0 + MOV X10, (1*8)(X5) + MOV X11, (2*8)(X5) + RET diff --git a/vendor/golang.org/x/text/secure/precis/nickname.go b/vendor/golang.org/x/text/secure/precis/nickname.go index 11e0ccbb1..73b8f0e73 100644 --- a/vendor/golang.org/x/text/secure/precis/nickname.go +++ b/vendor/golang.org/x/text/secure/precis/nickname.go @@ -44,24 +44,25 @@ func (t *nickAdditionalMapping) Transform(dst, src []byte, atEOF bool) (nDst, nS // to a single ASCII space character (e.g., "St Peter" is // mapped to "St Peter"). for nSrc < len(src) { - r, size := utf8.DecodeRune(src[nSrc:]) - if size == 0 { // Incomplete UTF-8 encoding - if !atEOF { - return nDst, nSrc, transform.ErrShortSrc - } - size = 1 + if !utf8.FullRune(src[nSrc:]) && !atEOF { + return nDst, nSrc, transform.ErrShortSrc } + r, size := utf8.DecodeRune(src[nSrc:]) if unicode.Is(unicode.Zs, r) { t.prevSpace = true } else { if t.prevSpace && t.notStart { + if nDst >= len(dst) { + return nDst, nSrc, transform.ErrShortDst + } dst[nDst] = ' ' nDst += 1 + t.prevSpace = false } - if size != copy(dst[nDst:], src[nSrc:nSrc+size]) { - nDst += size + if len(dst)-nDst < size { return nDst, nSrc, transform.ErrShortDst } + copy(dst[nDst:], src[nSrc:nSrc+size]) nDst += size t.prevSpace = false t.notStart = true diff --git a/vendor/golang.org/x/text/secure/precis/profile.go b/vendor/golang.org/x/text/secure/precis/profile.go index bdd991bb9..e62e79ba8 100644 --- a/vendor/golang.org/x/text/secure/precis/profile.go +++ b/vendor/golang.org/x/text/secure/precis/profile.go @@ -349,13 +349,13 @@ func (c *checker) Reset() { func (c *checker) span(src []byte, atEOF bool) (n int, err error) { for n < len(src) { e, sz := dpTrie.lookup(src[n:]) - d := categoryTransitions[category(e&catMask)] if sz == 0 { if !atEOF { return n, transform.ErrShortSrc } return n, errDisallowedRune } + d := categoryTransitions[category(e&catMask)] doLookAhead := false if property(e) < c.p.class.validFrom { if d.rule == nil { @@ -389,6 +389,9 @@ func (c *checker) span(src []byte, atEOF bool) (n int, err error) { n += sz } if m := c.beforeBits >> finalShift; c.beforeBits&m != m || c.termBits != 0 { + if !atEOF { + return n, transform.ErrShortSrc + } err = errContext } return n, err @@ -396,8 +399,9 @@ func (c *checker) span(src []byte, atEOF bool) (n int, err error) { // TODO: we may get rid of this transform if transform.Chain understands // something like a Spanner interface. -func (c checker) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { +func (c *checker) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { short := false + if len(dst) < len(src) { src = src[:len(dst)] atEOF = false diff --git a/vendor/modules.txt b/vendor/modules.txt index 1099f6580..7dd6535c6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -93,7 +93,7 @@ github.com/go-logr/logr/funcr # github.com/go-logr/stdr v1.2.2 ## explicit; go 1.16 github.com/go-logr/stdr -# github.com/go-openapi/analysis v0.25.5 +# github.com/go-openapi/analysis v0.26.0 ## explicit; go 1.25.0 github.com/go-openapi/analysis github.com/go-openapi/analysis/internal/debug @@ -113,10 +113,10 @@ github.com/go-openapi/jsonpointer/jsonname ## explicit; go 1.25.0 github.com/go-openapi/jsonreference github.com/go-openapi/jsonreference/internal -# github.com/go-openapi/loads v0.25.0 +# github.com/go-openapi/loads v0.25.1 ## explicit; go 1.25.0 github.com/go-openapi/loads -# github.com/go-openapi/runtime v0.33.0 +# github.com/go-openapi/runtime v0.33.1 ## explicit; go 1.25.0 github.com/go-openapi/runtime github.com/go-openapi/runtime/client @@ -127,7 +127,7 @@ github.com/go-openapi/runtime/middleware/denco github.com/go-openapi/runtime/middleware/untyped github.com/go-openapi/runtime/security github.com/go-openapi/runtime/yamlpc -# github.com/go-openapi/runtime/server-middleware v0.32.6 +# github.com/go-openapi/runtime/server-middleware v0.33.1 ## explicit; go 1.25.0 github.com/go-openapi/runtime/server-middleware/docui github.com/go-openapi/runtime/server-middleware/mediatype @@ -180,7 +180,7 @@ github.com/go-openapi/swag/typeutils # github.com/go-openapi/swag/yamlutils v0.28.0 ## explicit; go 1.25.0 github.com/go-openapi/swag/yamlutils -# github.com/go-openapi/validate v0.26.1 +# github.com/go-openapi/validate v0.26.3 ## explicit; go 1.25.0 github.com/go-openapi/validate # github.com/go-sql-driver/mysql v1.10.0 @@ -352,7 +352,7 @@ github.com/teris-io/shortid ## explicit; go 1.24.0 go.opentelemetry.io/auto/sdk go.opentelemetry.io/auto/sdk/internal/telemetry -# go.opentelemetry.io/otel v1.44.0 +# go.opentelemetry.io/otel v1.45.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute @@ -365,18 +365,18 @@ go.opentelemetry.io/otel/internal/errorhandler go.opentelemetry.io/otel/internal/global go.opentelemetry.io/otel/propagation go.opentelemetry.io/otel/semconv/v1.37.0 -go.opentelemetry.io/otel/semconv/v1.41.0 -# go.opentelemetry.io/otel/metric v1.44.0 +go.opentelemetry.io/otel/semconv/v1.43.0 +# go.opentelemetry.io/otel/metric v1.45.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/metric go.opentelemetry.io/otel/metric/embedded -# go.opentelemetry.io/otel/trace v1.44.0 +# go.opentelemetry.io/otel/trace v1.45.0 ## explicit; go 1.25.0 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded go.opentelemetry.io/otel/trace/internal/telemetry go.opentelemetry.io/otel/trace/noop -# go.yaml.in/yaml/v3 v3.0.4 +# go.yaml.in/yaml/v3 v3.0.5 ## explicit; go 1.16 go.yaml.in/yaml/v3 # go.yaml.in/yaml/v4 v4.0.0-rc.6 @@ -384,7 +384,7 @@ go.yaml.in/yaml/v3 go.yaml.in/yaml/v4 go.yaml.in/yaml/v4/internal/libyaml go.yaml.in/yaml/v4/plugin/limit -# golang.org/x/crypto v0.54.0 +# golang.org/x/crypto v0.55.0 ## explicit; go 1.25.0 golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish @@ -396,7 +396,7 @@ golang.org/x/crypto/internal/poly1305 # golang.org/x/mod v0.38.0 ## explicit; go 1.25.0 golang.org/x/mod/semver -# golang.org/x/net v0.57.0 +# golang.org/x/net v0.58.0 ## explicit; go 1.25.0 golang.org/x/net/idna golang.org/x/net/internal/socks @@ -418,7 +418,7 @@ golang.org/x/sys/windows # golang.org/x/term v0.45.0 ## explicit; go 1.25.0 golang.org/x/term -# golang.org/x/text v0.40.0 +# golang.org/x/text v0.41.0 ## explicit; go 1.25.0 golang.org/x/text/cases golang.org/x/text/currency