Skip to content

Enforce minLength on strings

Philippe Lafoucrière requested to merge fix-string-req into master

What does this MR do?

Requiring a field in the JSON schemas is not enough to have a valid report. Indeed, go has zero values for strings, and they're empty strings when the omitempty tag isn't set. This means some reports generated with the help of the Common library are considered valid from the JSON schema perspective (the field is present) but the parser will reject them because empty strings are not allowed.

Setting "minLength": 1 is a good sensible default for all strings, when patterns can't be enforced.

Availability and Testing

  • Review and add/update tests for this feature/bug

Approvals

Edited by Fabien Catteau

Merge request reports