signature/policy_config.go
func (pr *prSignedBaseLayer) UnmarshalJSON(data []byte) error {
	*pr = prSignedBaseLayer{}
	var tmp prSignedBaseLayer
	var baseLayerIdentity json.RawMessage
	if err := paranoidUnmarshalJSONObjectExactFields(data, map[string]interface{}{
		"type":              &tmp.Type,
		"baseLayerIdentity": &baseLayerIdentity,
	}); err != nil {
		return err
	}

	if tmp.Type != prTypeSignedBaseLayer {
		return InvalidPolicyFormatError(fmt.Sprintf("Unexpected policy requirement type \"%s\"", tmp.Type))
	}
	bli, err := newPolicyReferenceMatchFromJSON(baseLayerIdentity)
	if err != nil {
		return err
	}
	res, err := newPRSignedBaseLayer(bli)
	if err != nil {
		// Coverage: This should never happen, newPolicyReferenceMatchFromJSON has ensured bli is valid.
		return err
	}
	*pr = *res
	return nil
}
func (pr *prSignedBaseLayer) UnmarshalJSON(data []byte) error {
	*pr = prSignedBaseLayer{}
	var tmp prSignedBaseLayer
	var baseLayerIdentity json.RawMessage
	if err := paranoidUnmarshalJSONObjectExactFields(data, map[string]interface{}{
		"type":              &tmp.Type,
		"baseLayerIdentity": &baseLayerIdentity,
	}); err != nil {
		return err
	}

	if tmp.Type != prTypeSignedBaseLayer {
		return InvalidPolicyFormatError(fmt.Sprintf("Unexpected policy requirement type \"%s\"", tmp.Type))
	}
	bli, err := newPolicyReferenceMatchFromJSON(baseLayerIdentity)
	if err != nil {
		return err
	}
	res, err := newPRSignedBaseLayer(bli)
	if err != nil {
		// Coverage: This should never happen, newPolicyReferenceMatchFromJSON has ensured bli is valid.
		return err
	}
	*pr = *res
	return nil
}
func ( pr * prSignedBaseLayer ) UnmarshalJSON ( data [ ] byte ) error { * pr = prSignedBaseLayer { } var tmp prSignedBaseLayer var baseLayerIdentity json . RawMessage if err := paranoidUnmarshalJSONObjectExactFields ( data , map [ string ] interface { } { " " : & tmp . Type , " " : & baseLayerIdentity , } ) ; err != nil { return err } if tmp . Type != prTypeSignedBaseLayer { return InvalidPolicyFormatError ( fmt . Sprintf ( " \" \" " , tmp . Type ) ) } bli , err := newPolicyReferenceMatchFromJSON ( baseLayerIdentity ) if err != nil { return err } res , err := newPRSignedBaseLayer ( bli ) if err != nil { // Coverage: This should never happen, newPolicyReferenceMatchFromJSON has ensured bli is valid. return err } * pr = * res return nil }
// UnmarshalJSON implements the json.Unmarshaler interface.
UnmarshalJSON implements the json . Unmarshaler interface .