Skip to content

Commit

Permalink
Revert "uint don't need a min=0 validation"
Browse files Browse the repository at this point in the history
This reverts commit dc27da9.
  • Loading branch information
dmathieu committed Jul 26, 2023
1 parent 6f6bcaa commit fd78568
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
3 changes: 2 additions & 1 deletion input/elasticapm/docs/spec/rumv3/transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@
"properties": {
"count": {
"description": "Count is the total number of of longtasks.",
"type": "integer"
"type": "integer",
"minimum": 0
},
"max": {
"description": "Max longtask duration",
Expand Down
3 changes: 2 additions & 1 deletion input/elasticapm/docs/spec/v2/metricset.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"array"
],
"items": {
"type": "integer"
"type": "integer",
"minimum": 0
},
"minItems": 0
},
Expand Down
6 changes: 4 additions & 2 deletions input/elasticapm/docs/spec/v2/transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,8 @@
"type": [
"null",
"integer"
]
],
"minimum": 0
}
}
}
Expand Down Expand Up @@ -835,7 +836,8 @@
"properties": {
"count": {
"description": "Count is the total number of of longtasks.",
"type": "integer"
"type": "integer",
"minimum": 0
},
"max": {
"description": "Max longtask duration",
Expand Down
2 changes: 1 addition & 1 deletion input/elasticapm/internal/modeldecoder/rumv3/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ type transactionUserExperience struct {

type longtaskMetrics struct {
// Count is the total number of of longtasks.
Count nullable.Int `json:"count" validate:"required"`
Count nullable.Int `json:"count" validate:"required,min=0"`
// Max longtask duration
Max nullable.Float64 `json:"max" validate:"required,min=0"`
// Sum of longtask durations
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions input/elasticapm/internal/modeldecoder/v2/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ type metricsetSampleValue struct {
// If Counts is specified, then Values is expected to be
// specified with the same number of elements, and with the
// same order.
Counts []uint64 `json:"counts" validate:"requiredIfAny=values"`
Counts []uint64 `json:"counts" validate:"requiredIfAny=values,minVals=0"`
// Value holds the value of a single metric sample.
Value nullable.Float64 `json:"value"`
}
Expand Down Expand Up @@ -1117,7 +1117,7 @@ type transactionUserExperience struct {

type longtaskMetrics struct {
// Count is the total number of of longtasks.
Count nullable.Int `json:"count" validate:"required"`
Count nullable.Int `json:"count" validate:"required,min=0"`
// Max longtask duration
Max nullable.Float64 `json:"max" validate:"required,min=0"`
// Sum of longtask durations
Expand Down Expand Up @@ -1161,7 +1161,7 @@ type transactionDroppedSpansDuration struct {

type transactionDroppedSpansDurationSum struct {
// Us represents the summation of the span duration.
Us nullable.Int `json:"us"`
Us nullable.Int `json:"us" validate:"min=0"`
}

type spanLink struct {
Expand Down
11 changes: 11 additions & 0 deletions input/elasticapm/internal/modeldecoder/v2/model_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd78568

Please sign in to comment.