|
37 | 37 | (declare cis->BigPayload) |
38 | 38 | (declare ecis->BigPayload) |
39 | 39 | (declare new-BigPayload) |
| 40 | +(declare cis->ShouldThrowRequest) |
| 41 | +(declare ecis->ShouldThrowRequest) |
| 42 | +(declare new-ShouldThrowRequest) |
| 43 | +(declare cis->ShouldThrowResponse) |
| 44 | +(declare ecis->ShouldThrowResponse) |
| 45 | +(declare new-ShouldThrowResponse) |
40 | 46 |
|
41 | 47 | ;;---------------------------------------------------------------------------------- |
42 | 48 | ;;---------------------------------------------------------------------------------- |
|
378 | 384 |
|
379 | 385 | (def ^:protojure.protobuf.any/record BigPayload-meta {:type "protojure.test.grpc.BigPayload" :decoder pb->BigPayload}) |
380 | 386 |
|
| 387 | +;----------------------------------------------------------------------------- |
| 388 | +; ShouldThrowRequest |
| 389 | +;----------------------------------------------------------------------------- |
| 390 | +(defrecord ShouldThrowRequest-record [case] |
| 391 | + pb/Writer |
| 392 | + (serialize [this os] |
| 393 | + (serdes.core/write-Int32 1 {:optimize true} (:case this) os)) |
| 394 | + pb/TypeReflection |
| 395 | + (gettype [this] |
| 396 | + "protojure.test.grpc.ShouldThrowRequest")) |
| 397 | + |
| 398 | +(s/def :protojure.test.grpc.ShouldThrowRequest/case int?) |
| 399 | +(s/def ::ShouldThrowRequest-spec (s/keys :opt-un [:protojure.test.grpc.ShouldThrowRequest/case ])) |
| 400 | +(def ShouldThrowRequest-defaults {:case 0 }) |
| 401 | + |
| 402 | +(defn cis->ShouldThrowRequest |
| 403 | + "CodedInputStream to ShouldThrowRequest" |
| 404 | + [is] |
| 405 | + (->> (tag-map ShouldThrowRequest-defaults |
| 406 | + (fn [tag index] |
| 407 | + (case index |
| 408 | + 1 [:case (serdes.core/cis->Int32 is)] |
| 409 | + |
| 410 | + [index (serdes.core/cis->undefined tag is)])) |
| 411 | + is) |
| 412 | + (map->ShouldThrowRequest-record))) |
| 413 | + |
| 414 | +(defn ecis->ShouldThrowRequest |
| 415 | + "Embedded CodedInputStream to ShouldThrowRequest" |
| 416 | + [is] |
| 417 | + (serdes.core/cis->embedded cis->ShouldThrowRequest is)) |
| 418 | + |
| 419 | +(defn new-ShouldThrowRequest |
| 420 | + "Creates a new instance from a map, similar to map->ShouldThrowRequest except that |
| 421 | + it properly accounts for nested messages, when applicable. |
| 422 | + " |
| 423 | + [init] |
| 424 | + {:pre [(if (s/valid? ::ShouldThrowRequest-spec init) true (throw (ex-info "Invalid input" (s/explain-data ::ShouldThrowRequest-spec init))))]} |
| 425 | + (-> (merge ShouldThrowRequest-defaults init) |
| 426 | + (map->ShouldThrowRequest-record))) |
| 427 | + |
| 428 | +(defn pb->ShouldThrowRequest |
| 429 | + "Protobuf to ShouldThrowRequest" |
| 430 | + [input] |
| 431 | + (cis->ShouldThrowRequest (serdes.stream/new-cis input))) |
| 432 | + |
| 433 | +(def ^:protojure.protobuf.any/record ShouldThrowRequest-meta {:type "protojure.test.grpc.ShouldThrowRequest" :decoder pb->ShouldThrowRequest}) |
| 434 | + |
| 435 | +;----------------------------------------------------------------------------- |
| 436 | +; ShouldThrowResponse |
| 437 | +;----------------------------------------------------------------------------- |
| 438 | +(defrecord ShouldThrowResponse-record [numbers] |
| 439 | + pb/Writer |
| 440 | + (serialize [this os] |
| 441 | + (serdes.complex/write-repeated serdes.core/write-Int32 1 (:numbers this) os)) |
| 442 | + pb/TypeReflection |
| 443 | + (gettype [this] |
| 444 | + "protojure.test.grpc.ShouldThrowResponse")) |
| 445 | + |
| 446 | +(s/def :protojure.test.grpc.ShouldThrowResponse/numbers (s/every int?)) |
| 447 | +(s/def ::ShouldThrowResponse-spec (s/keys :opt-un [:protojure.test.grpc.ShouldThrowResponse/numbers ])) |
| 448 | +(def ShouldThrowResponse-defaults {:numbers [] }) |
| 449 | + |
| 450 | +(defn cis->ShouldThrowResponse |
| 451 | + "CodedInputStream to ShouldThrowResponse" |
| 452 | + [is] |
| 453 | + (->> (tag-map ShouldThrowResponse-defaults |
| 454 | + (fn [tag index] |
| 455 | + (case index |
| 456 | + 1 [:numbers (serdes.complex/cis->packablerepeated tag serdes.core/cis->Int32 is)] |
| 457 | + |
| 458 | + [index (serdes.core/cis->undefined tag is)])) |
| 459 | + is) |
| 460 | + (map->ShouldThrowResponse-record))) |
| 461 | + |
| 462 | +(defn ecis->ShouldThrowResponse |
| 463 | + "Embedded CodedInputStream to ShouldThrowResponse" |
| 464 | + [is] |
| 465 | + (serdes.core/cis->embedded cis->ShouldThrowResponse is)) |
| 466 | + |
| 467 | +(defn new-ShouldThrowResponse |
| 468 | + "Creates a new instance from a map, similar to map->ShouldThrowResponse except that |
| 469 | + it properly accounts for nested messages, when applicable. |
| 470 | + " |
| 471 | + [init] |
| 472 | + {:pre [(if (s/valid? ::ShouldThrowResponse-spec init) true (throw (ex-info "Invalid input" (s/explain-data ::ShouldThrowResponse-spec init))))]} |
| 473 | + (-> (merge ShouldThrowResponse-defaults init) |
| 474 | + (map->ShouldThrowResponse-record))) |
| 475 | + |
| 476 | +(defn pb->ShouldThrowResponse |
| 477 | + "Protobuf to ShouldThrowResponse" |
| 478 | + [input] |
| 479 | + (cis->ShouldThrowResponse (serdes.stream/new-cis input))) |
| 480 | + |
| 481 | +(def ^:protojure.protobuf.any/record ShouldThrowResponse-meta {:type "protojure.test.grpc.ShouldThrowResponse" :decoder pb->ShouldThrowResponse}) |
| 482 | + |
0 commit comments