Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema: add encoder.SetOmitEmptyDefault() method to properly encode ptrs #219

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Aug 25, 2024

  1. schema: add encoder.SetOmitEmptyDefault() method to properly encode ptrs

    By default encoder encodes all nil ptr fields as "null" and decoder is
    not able to decode them. Encoding such fields as empty ("") also doesn't
    work properly as decoder always initializes ptr fields to zero values
    even empty value provided. The only option is to add omitempty tags.
    
    encoder.SetOmitEmptyDefault() allows to make omitempty to be a default
    behaviour.
    
    This closes issue gorilla#216
    David It committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    eee40c8 View commit details
    Browse the repository at this point in the history