Skip to content

Nested validation doesn't working  #124

@ziasultan2

Description

@ziasultan2
{
    "pnr": "bddddd",
    "quantity": 100,
    "flightType": "direct",
    "platform": {
        "groupWindowOffice": true,
        "groupWindowB2B": false,
        "serpOffice": true,
        "serpB2B": false
    }
}

I want to validate the platform nested struct but it doesn't validating. Further more it gives me error if I try to create rules like document. So I've to do it like this way "platform.*"

	rules := govalidator.MapData{
		"pnr":         []string{"required"},
		"quantity":    []string{"required"},
		"platform.groupWindowOffice": []string{"required"},
		"platform.groupWindowB2B":    []string{"required"},
		"platform.serpOffice":        []string{"required"},
		"platform.serpB2B":           []string{"required"},
	}

But this is not validating the nested data it always shows me data required. Will you please help me to find the solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions