Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions request/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ func (df *DecoderFactory) makeDefaultDecoder(input interface{}, m *decoder) {

s, err := df.JSONSchemaReflector.Reflect(vi)
if err != nil {
if err == jsonschema.ErrSkipProperty {
return
}
panic(err.Error())
}
Comment on lines 291 to 297
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 | Confidence: High

  • This change enables graceful handling of jsonschema.ErrSkipProperty during JSON Schema reflection in default value processing. Without this fix, any struct field with unsupported types would cause a panic during decoder initialization, breaking the entire request processing pipeline for affected endpoints. The change preserves existing panic behavior for other errors while allowing proper skipping of unsupported properties.
  • The error comparison uses direct equality check with jsonschema.ErrSkipProperty, which could be fragile if the error value implementation changes in the future. Consider using errors.Is() for more robust error handling.
  • The PR doesn't include test coverage for the new error handling path. Tests should verify that structs with unsupported properties don't panic when ErrSkipProperty occurs and that default value processing continues normally for supported fields.
Suggested change
s, err := df.JSONSchemaReflector.Reflect(vi)
if err != nil {
if err == jsonschema.ErrSkipProperty {
return
}
panic(err.Error())
}
s, err := df.JSONSchemaReflector.Reflect(vi)
if err != nil {
if errors.Is(err, jsonschema.ErrSkipProperty) {
return
}
panic(err.Error())
}

Evidence: path:web/service.go, symbol:DecoderFactory, method:makeDefaultDecoder


Expand Down