Suggestion for a dynamic Struct Validation Rules

This page summarizes the projects mentioned and recommended in the original post on /r/golang

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers
Other PDF SDKs promise a lot - then break. Laggy scrolling, poor mobile UX, tons of bugs, and lack of support cost you endless frustrations. Nutrient’s SDK handles billion-page workloads - so you don’t have to debug PDFs. Used by ~1 billion end users in more than 150 different countries.
www.nutrient.io
featured
  1. validator

    :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

    github.com/go-playground/validator/ has a bug with nested struct which breaks. Also somewhat limited Ruleset it seems.

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. ozzo-validation

    An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.

    https://github.com/go-ozzo/ozzo-validation Seems to do what I need but likely will need some convoluted reflection to build out the rules. Also likely some custom rules to be written which is okay since it's a one time cost and reuse in the expressions.

  4. expr

    Discontinued Expression language and expression evaluation for Go [Moved to: https://github.com/expr-lang/expr] (by antonmedv)

    https://github.com/antonmedv/expr/ Seems really promising though having a rough time finding examples or basic do something as simple as struct.Value == N though I did find some examples on iterating and such.

  5. cel-go

    Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)

    https://github.com/google/cel-go Didn't find much support for structs.

  6. otto

    A JavaScript interpreter in Go (golang)

    Otto https://github.com/robertkrimen/otto Seems interesting. It lets me call Go functions from inside JS as well as return results. The fncs pattern reminds me a bit of how the template engine works.

  7. Nutrient

    Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers. Other PDF SDKs promise a lot - then break. Laggy scrolling, poor mobile UX, tons of bugs, and lack of support cost you endless frustrations. Nutrient’s SDK handles billion-page workloads - so you don’t have to debug PDFs. Used by ~1 billion end users in more than 150 different countries.

    Nutrient logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Lingo: A Go micro language framework for building Domain Specific Languages

    5 projects | news.ycombinator.com | 24 Oct 2024
  • CEL on N resources?

    1 project | /r/kubernetes | 4 Dec 2023
  • Library to analyze an arbitrary JSON string

    5 projects | /r/golang | 1 May 2023
  • Common Expression Language (CEL); lightweight expression evaluation

    1 project | news.ycombinator.com | 29 Apr 2021
  • Developing a Simple RESTful API with Gin, ginvalidator, and validatorgo

    4 projects | dev.to | 13 Jan 2025

Did you know that Go is
the 4th most popular programming language
based on number of references?