generated-event.go 986 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.
  2. package client
  3. import "encoding/json"
  4. import "fmt"
  5. type EventStorageWrite struct {
  6. // Body corresponds to the JSON schema field "body".
  7. Body interface{} `json:"body" yaml:"body" mapstructure:"body"`
  8. // Key corresponds to the JSON schema field "key".
  9. Key string `json:"key" yaml:"key" mapstructure:"key"`
  10. }
  11. // UnmarshalJSON implements json.Unmarshaler.
  12. func (j *EventStorageWrite) UnmarshalJSON(value []byte) error {
  13. var raw map[string]interface{}
  14. if err := json.Unmarshal(value, &raw); err != nil {
  15. return err
  16. }
  17. if _, ok := raw["body"]; raw != nil && !ok {
  18. return fmt.Errorf("field body in EventStorageWrite: required")
  19. }
  20. if _, ok := raw["key"]; raw != nil && !ok {
  21. return fmt.Errorf("field key in EventStorageWrite: required")
  22. }
  23. type Plain EventStorageWrite
  24. var plain Plain
  25. if err := json.Unmarshal(value, &plain); err != nil {
  26. return err
  27. }
  28. *j = EventStorageWrite(plain)
  29. return nil
  30. }