RegoValueOk is only used for unit testing. There is no easy way to get the error for the unexported method, and this is intentional. Failed rego values can default to the backup json marshal method, so errors are not fatal. Unit tests should be aware when the custom rego marshaller fails.
()
| 123 | // so errors are not fatal. Unit tests should be aware when the custom |
| 124 | // rego marshaller fails. |
| 125 | func (s Subject) RegoValueOk() error { |
| 126 | tmp := s |
| 127 | _, err := tmp.regoValue() |
| 128 | return err |
| 129 | } |
| 130 | |
| 131 | // WithCachedASTValue can be called if the subject is static. This will compute |
| 132 | // the ast value once and cache it for future calls. |