/backend/api/resolver/v1/resolver_api.pb.validate.go

https://github.com/lyft/clutch · Go · 551 lines · 370 code · 108 blank · 73 comment · 58 complexity · 33e90cb0cb84d14327416d09bd744d27 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: resolver/v1/resolver_api.proto
  3. package resolverv1
  4. import (
  5. "bytes"
  6. "errors"
  7. "fmt"
  8. "net"
  9. "net/mail"
  10. "net/url"
  11. "regexp"
  12. "strings"
  13. "time"
  14. "unicode/utf8"
  15. "github.com/golang/protobuf/ptypes"
  16. )
  17. // ensure the imports are used
  18. var (
  19. _ = bytes.MinRead
  20. _ = errors.New("")
  21. _ = fmt.Print
  22. _ = utf8.UTFMax
  23. _ = (*regexp.Regexp)(nil)
  24. _ = (*strings.Reader)(nil)
  25. _ = net.IPv4len
  26. _ = time.Duration(0)
  27. _ = (*url.URL)(nil)
  28. _ = (*mail.Address)(nil)
  29. _ = ptypes.DynamicAny{}
  30. )
  31. // define the regex for a UUID once up-front
  32. var _resolver_api_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
  33. // Validate checks the field values on ResolveRequest with the rules defined in
  34. // the proto definition for this message. If any rules are violated, an error
  35. // is returned.
  36. func (m *ResolveRequest) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. if len(m.GetWant()) < 1 {
  41. return ResolveRequestValidationError{
  42. field: "Want",
  43. reason: "value length must be at least 1 bytes",
  44. }
  45. }
  46. if m.GetHave() == nil {
  47. return ResolveRequestValidationError{
  48. field: "Have",
  49. reason: "value is required",
  50. }
  51. }
  52. if a := m.GetHave(); a != nil {
  53. }
  54. // no validation rules for Limit
  55. return nil
  56. }
  57. // ResolveRequestValidationError is the validation error returned by
  58. // ResolveRequest.Validate if the designated constraints aren't met.
  59. type ResolveRequestValidationError struct {
  60. field string
  61. reason string
  62. cause error
  63. key bool
  64. }
  65. // Field function returns field value.
  66. func (e ResolveRequestValidationError) Field() string { return e.field }
  67. // Reason function returns reason value.
  68. func (e ResolveRequestValidationError) Reason() string { return e.reason }
  69. // Cause function returns cause value.
  70. func (e ResolveRequestValidationError) Cause() error { return e.cause }
  71. // Key function returns key value.
  72. func (e ResolveRequestValidationError) Key() bool { return e.key }
  73. // ErrorName returns error name.
  74. func (e ResolveRequestValidationError) ErrorName() string { return "ResolveRequestValidationError" }
  75. // Error satisfies the builtin error interface
  76. func (e ResolveRequestValidationError) Error() string {
  77. cause := ""
  78. if e.cause != nil {
  79. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  80. }
  81. key := ""
  82. if e.key {
  83. key = "key for "
  84. }
  85. return fmt.Sprintf(
  86. "invalid %sResolveRequest.%s: %s%s",
  87. key,
  88. e.field,
  89. e.reason,
  90. cause)
  91. }
  92. var _ error = ResolveRequestValidationError{}
  93. var _ interface {
  94. Field() string
  95. Reason() string
  96. Key() bool
  97. Cause() error
  98. ErrorName() string
  99. } = ResolveRequestValidationError{}
  100. // Validate checks the field values on ResolveResponse with the rules defined
  101. // in the proto definition for this message. If any rules are violated, an
  102. // error is returned.
  103. func (m *ResolveResponse) Validate() error {
  104. if m == nil {
  105. return nil
  106. }
  107. for idx, item := range m.GetResults() {
  108. _, _ = idx, item
  109. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  110. if err := v.Validate(); err != nil {
  111. return ResolveResponseValidationError{
  112. field: fmt.Sprintf("Results[%v]", idx),
  113. reason: "embedded message failed validation",
  114. cause: err,
  115. }
  116. }
  117. }
  118. }
  119. for idx, item := range m.GetPartialFailures() {
  120. _, _ = idx, item
  121. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  122. if err := v.Validate(); err != nil {
  123. return ResolveResponseValidationError{
  124. field: fmt.Sprintf("PartialFailures[%v]", idx),
  125. reason: "embedded message failed validation",
  126. cause: err,
  127. }
  128. }
  129. }
  130. }
  131. return nil
  132. }
  133. // ResolveResponseValidationError is the validation error returned by
  134. // ResolveResponse.Validate if the designated constraints aren't met.
  135. type ResolveResponseValidationError struct {
  136. field string
  137. reason string
  138. cause error
  139. key bool
  140. }
  141. // Field function returns field value.
  142. func (e ResolveResponseValidationError) Field() string { return e.field }
  143. // Reason function returns reason value.
  144. func (e ResolveResponseValidationError) Reason() string { return e.reason }
  145. // Cause function returns cause value.
  146. func (e ResolveResponseValidationError) Cause() error { return e.cause }
  147. // Key function returns key value.
  148. func (e ResolveResponseValidationError) Key() bool { return e.key }
  149. // ErrorName returns error name.
  150. func (e ResolveResponseValidationError) ErrorName() string { return "ResolveResponseValidationError" }
  151. // Error satisfies the builtin error interface
  152. func (e ResolveResponseValidationError) Error() string {
  153. cause := ""
  154. if e.cause != nil {
  155. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  156. }
  157. key := ""
  158. if e.key {
  159. key = "key for "
  160. }
  161. return fmt.Sprintf(
  162. "invalid %sResolveResponse.%s: %s%s",
  163. key,
  164. e.field,
  165. e.reason,
  166. cause)
  167. }
  168. var _ error = ResolveResponseValidationError{}
  169. var _ interface {
  170. Field() string
  171. Reason() string
  172. Key() bool
  173. Cause() error
  174. ErrorName() string
  175. } = ResolveResponseValidationError{}
  176. // Validate checks the field values on SearchRequest with the rules defined in
  177. // the proto definition for this message. If any rules are violated, an error
  178. // is returned.
  179. func (m *SearchRequest) Validate() error {
  180. if m == nil {
  181. return nil
  182. }
  183. if len(m.GetWant()) < 1 {
  184. return SearchRequestValidationError{
  185. field: "Want",
  186. reason: "value length must be at least 1 bytes",
  187. }
  188. }
  189. if len(m.GetQuery()) < 1 {
  190. return SearchRequestValidationError{
  191. field: "Query",
  192. reason: "value length must be at least 1 bytes",
  193. }
  194. }
  195. // no validation rules for Limit
  196. return nil
  197. }
  198. // SearchRequestValidationError is the validation error returned by
  199. // SearchRequest.Validate if the designated constraints aren't met.
  200. type SearchRequestValidationError struct {
  201. field string
  202. reason string
  203. cause error
  204. key bool
  205. }
  206. // Field function returns field value.
  207. func (e SearchRequestValidationError) Field() string { return e.field }
  208. // Reason function returns reason value.
  209. func (e SearchRequestValidationError) Reason() string { return e.reason }
  210. // Cause function returns cause value.
  211. func (e SearchRequestValidationError) Cause() error { return e.cause }
  212. // Key function returns key value.
  213. func (e SearchRequestValidationError) Key() bool { return e.key }
  214. // ErrorName returns error name.
  215. func (e SearchRequestValidationError) ErrorName() string { return "SearchRequestValidationError" }
  216. // Error satisfies the builtin error interface
  217. func (e SearchRequestValidationError) Error() string {
  218. cause := ""
  219. if e.cause != nil {
  220. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  221. }
  222. key := ""
  223. if e.key {
  224. key = "key for "
  225. }
  226. return fmt.Sprintf(
  227. "invalid %sSearchRequest.%s: %s%s",
  228. key,
  229. e.field,
  230. e.reason,
  231. cause)
  232. }
  233. var _ error = SearchRequestValidationError{}
  234. var _ interface {
  235. Field() string
  236. Reason() string
  237. Key() bool
  238. Cause() error
  239. ErrorName() string
  240. } = SearchRequestValidationError{}
  241. // Validate checks the field values on SearchResponse with the rules defined in
  242. // the proto definition for this message. If any rules are violated, an error
  243. // is returned.
  244. func (m *SearchResponse) Validate() error {
  245. if m == nil {
  246. return nil
  247. }
  248. for idx, item := range m.GetResults() {
  249. _, _ = idx, item
  250. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  251. if err := v.Validate(); err != nil {
  252. return SearchResponseValidationError{
  253. field: fmt.Sprintf("Results[%v]", idx),
  254. reason: "embedded message failed validation",
  255. cause: err,
  256. }
  257. }
  258. }
  259. }
  260. for idx, item := range m.GetPartialFailures() {
  261. _, _ = idx, item
  262. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  263. if err := v.Validate(); err != nil {
  264. return SearchResponseValidationError{
  265. field: fmt.Sprintf("PartialFailures[%v]", idx),
  266. reason: "embedded message failed validation",
  267. cause: err,
  268. }
  269. }
  270. }
  271. }
  272. return nil
  273. }
  274. // SearchResponseValidationError is the validation error returned by
  275. // SearchResponse.Validate if the designated constraints aren't met.
  276. type SearchResponseValidationError struct {
  277. field string
  278. reason string
  279. cause error
  280. key bool
  281. }
  282. // Field function returns field value.
  283. func (e SearchResponseValidationError) Field() string { return e.field }
  284. // Reason function returns reason value.
  285. func (e SearchResponseValidationError) Reason() string { return e.reason }
  286. // Cause function returns cause value.
  287. func (e SearchResponseValidationError) Cause() error { return e.cause }
  288. // Key function returns key value.
  289. func (e SearchResponseValidationError) Key() bool { return e.key }
  290. // ErrorName returns error name.
  291. func (e SearchResponseValidationError) ErrorName() string { return "SearchResponseValidationError" }
  292. // Error satisfies the builtin error interface
  293. func (e SearchResponseValidationError) Error() string {
  294. cause := ""
  295. if e.cause != nil {
  296. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  297. }
  298. key := ""
  299. if e.key {
  300. key = "key for "
  301. }
  302. return fmt.Sprintf(
  303. "invalid %sSearchResponse.%s: %s%s",
  304. key,
  305. e.field,
  306. e.reason,
  307. cause)
  308. }
  309. var _ error = SearchResponseValidationError{}
  310. var _ interface {
  311. Field() string
  312. Reason() string
  313. Key() bool
  314. Cause() error
  315. ErrorName() string
  316. } = SearchResponseValidationError{}
  317. // Validate checks the field values on GetObjectSchemasRequest with the rules
  318. // defined in the proto definition for this message. If any rules are
  319. // violated, an error is returned.
  320. func (m *GetObjectSchemasRequest) Validate() error {
  321. if m == nil {
  322. return nil
  323. }
  324. if len(m.GetTypeUrl()) < 1 {
  325. return GetObjectSchemasRequestValidationError{
  326. field: "TypeUrl",
  327. reason: "value length must be at least 1 bytes",
  328. }
  329. }
  330. return nil
  331. }
  332. // GetObjectSchemasRequestValidationError is the validation error returned by
  333. // GetObjectSchemasRequest.Validate if the designated constraints aren't met.
  334. type GetObjectSchemasRequestValidationError struct {
  335. field string
  336. reason string
  337. cause error
  338. key bool
  339. }
  340. // Field function returns field value.
  341. func (e GetObjectSchemasRequestValidationError) Field() string { return e.field }
  342. // Reason function returns reason value.
  343. func (e GetObjectSchemasRequestValidationError) Reason() string { return e.reason }
  344. // Cause function returns cause value.
  345. func (e GetObjectSchemasRequestValidationError) Cause() error { return e.cause }
  346. // Key function returns key value.
  347. func (e GetObjectSchemasRequestValidationError) Key() bool { return e.key }
  348. // ErrorName returns error name.
  349. func (e GetObjectSchemasRequestValidationError) ErrorName() string {
  350. return "GetObjectSchemasRequestValidationError"
  351. }
  352. // Error satisfies the builtin error interface
  353. func (e GetObjectSchemasRequestValidationError) Error() string {
  354. cause := ""
  355. if e.cause != nil {
  356. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  357. }
  358. key := ""
  359. if e.key {
  360. key = "key for "
  361. }
  362. return fmt.Sprintf(
  363. "invalid %sGetObjectSchemasRequest.%s: %s%s",
  364. key,
  365. e.field,
  366. e.reason,
  367. cause)
  368. }
  369. var _ error = GetObjectSchemasRequestValidationError{}
  370. var _ interface {
  371. Field() string
  372. Reason() string
  373. Key() bool
  374. Cause() error
  375. ErrorName() string
  376. } = GetObjectSchemasRequestValidationError{}
  377. // Validate checks the field values on GetObjectSchemasResponse with the rules
  378. // defined in the proto definition for this message. If any rules are
  379. // violated, an error is returned.
  380. func (m *GetObjectSchemasResponse) Validate() error {
  381. if m == nil {
  382. return nil
  383. }
  384. // no validation rules for TypeUrl
  385. for idx, item := range m.GetSchemas() {
  386. _, _ = idx, item
  387. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  388. if err := v.Validate(); err != nil {
  389. return GetObjectSchemasResponseValidationError{
  390. field: fmt.Sprintf("Schemas[%v]", idx),
  391. reason: "embedded message failed validation",
  392. cause: err,
  393. }
  394. }
  395. }
  396. }
  397. return nil
  398. }
  399. // GetObjectSchemasResponseValidationError is the validation error returned by
  400. // GetObjectSchemasResponse.Validate if the designated constraints aren't met.
  401. type GetObjectSchemasResponseValidationError struct {
  402. field string
  403. reason string
  404. cause error
  405. key bool
  406. }
  407. // Field function returns field value.
  408. func (e GetObjectSchemasResponseValidationError) Field() string { return e.field }
  409. // Reason function returns reason value.
  410. func (e GetObjectSchemasResponseValidationError) Reason() string { return e.reason }
  411. // Cause function returns cause value.
  412. func (e GetObjectSchemasResponseValidationError) Cause() error { return e.cause }
  413. // Key function returns key value.
  414. func (e GetObjectSchemasResponseValidationError) Key() bool { return e.key }
  415. // ErrorName returns error name.
  416. func (e GetObjectSchemasResponseValidationError) ErrorName() string {
  417. return "GetObjectSchemasResponseValidationError"
  418. }
  419. // Error satisfies the builtin error interface
  420. func (e GetObjectSchemasResponseValidationError) Error() string {
  421. cause := ""
  422. if e.cause != nil {
  423. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  424. }
  425. key := ""
  426. if e.key {
  427. key = "key for "
  428. }
  429. return fmt.Sprintf(
  430. "invalid %sGetObjectSchemasResponse.%s: %s%s",
  431. key,
  432. e.field,
  433. e.reason,
  434. cause)
  435. }
  436. var _ error = GetObjectSchemasResponseValidationError{}
  437. var _ interface {
  438. Field() string
  439. Reason() string
  440. Key() bool
  441. Cause() error
  442. ErrorName() string
  443. } = GetObjectSchemasResponseValidationError{}