Skip to content

Commit 2d29839

Browse files
committed
Fix compilation for binary types
The implementation may not be correct, but at least it compiles. To be checked if someday someone actually uses it/complains.
1 parent 38060f9 commit 2d29839

File tree

10 files changed

+37
-0
lines changed

10 files changed

+37
-0
lines changed

modules/openapi-generator/src/main/resources/ocaml/to_json.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232
{{/isEnum}}
3333
{{/isContainer}}
3434
{{/isModel}}
35+
{{#isBinary}}JsonSupport.of_string{{/isBinary}}

samples/client/petstore/ocaml-fake-petstore/src/apis/another_fake_api.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let call_123_test_special_tags ~client_t =
2020

2121

2222
Client.to_yojson
23+
2324
client_t
2425
in
2526
Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml-fake-petstore/src/apis/fake_api.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ let fake_http_signature_test ~pet_t ?query_1 ?header_1 () =
3838

3939

4040
Pet.to_yojson
41+
4142
pet_t
4243
in
4344
Cohttp_lwt_unix.Client.call `GET uri ~headers ~body >>= fun (resp, body) ->
@@ -57,6 +58,7 @@ let fake_outer_boolean_serialize ~body () =
5758

5859

5960
JsonSupport.of_bool
61+
6062
body
6163
in
6264
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -77,6 +79,7 @@ let fake_outer_composite_serialize ~outer_composite_t () =
7779

7880

7981
Outer_composite.to_yojson
82+
8083
outer_composite_t
8184
in
8285
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -96,6 +99,7 @@ let fake_outer_number_serialize ~body () =
9699
JsonSupport.of_float
97100

98101

102+
99103
body
100104
in
101105
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -115,6 +119,7 @@ let fake_outer_string_serialize ~body () =
115119

116120

117121

122+
118123
body
119124
in
120125
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -135,6 +140,7 @@ let fake_property_enum_integer_serialize ~outer_object_with_enum_property_t =
135140

136141

137142
Outer_object_with_enum_property.to_yojson
143+
138144
outer_object_with_enum_property_t
139145
in
140146
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -166,6 +172,7 @@ let test_body_with_binary ~body =
166172

167173

168174

175+
JsonSupport.of_string
169176
body
170177
in
171178
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
@@ -186,6 +193,7 @@ let test_body_with_file_schema ~file_schema_test_class_t =
186193

187194

188195
File_schema_test_class.to_yojson
196+
189197
file_schema_test_class_t
190198
in
191199
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
@@ -208,6 +216,7 @@ let test_body_with_query_params ~query ~user_t =
208216

209217

210218
User.to_yojson
219+
211220
user_t
212221
in
213222
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
@@ -228,6 +237,7 @@ let test_client_model ~client_t =
228237

229238

230239
Client.to_yojson
240+
231241
client_t
232242
in
233243
Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) ->
@@ -334,6 +344,7 @@ let test_inline_additional_properties ~request_body =
334344

335345

336346

347+
337348
)
338349

339350

@@ -342,6 +353,7 @@ let test_inline_additional_properties ~request_body =
342353

343354

344355

356+
345357
request_body
346358
in
347359
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -362,6 +374,7 @@ let test_inline_freeform_additional_properties ~test_inline_freeform_additional_
362374

363375

364376
Test_inline_freeform_additional_properties_request.to_yojson
377+
365378
test_inline_freeform_additional_properties_request_t
366379
in
367380
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -395,6 +408,7 @@ let test_nullable ~child_with_nullable_t =
395408

396409

397410
Child_with_nullable.to_yojson
411+
398412
child_with_nullable_t
399413
in
400414
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -441,6 +455,7 @@ let test_string_map_reference ~request_body =
441455

442456

443457

458+
444459
)
445460

446461

@@ -449,6 +464,7 @@ let test_string_map_reference ~request_body =
449464

450465

451466

467+
452468
request_body
453469
in
454470
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml-fake-petstore/src/apis/fake_classname_tags123_api.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ let test_classname ~client_t =
2121

2222

2323
Client.to_yojson
24+
2425
client_t
2526
in
2627
Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml-fake-petstore/src/apis/pet_api.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let add_pet ~pet_t =
2020

2121

2222
Pet.to_yojson
23+
2324
pet_t
2425
in
2526
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -81,6 +82,7 @@ let update_pet ~pet_t =
8182

8283

8384
Pet.to_yojson
85+
8486
pet_t
8587
in
8688
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml-fake-petstore/src/apis/store_api.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ let place_order ~order_t =
4646

4747

4848
Order.to_yojson
49+
4950
order_t
5051
in
5152
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml-fake-petstore/src/apis/user_api.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let create_user ~user_t =
2020

2121

2222
User.to_yojson
23+
2324
user_t
2425
in
2526
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -40,6 +41,7 @@ let create_users_with_array_input ~user =
4041

4142

4243
User.to_yojson
44+
4345
)
4446

4547

@@ -48,6 +50,7 @@ let create_users_with_array_input ~user =
4850

4951

5052

53+
5154
user
5255
in
5356
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -68,6 +71,7 @@ let create_users_with_list_input ~user =
6871

6972

7073
User.to_yojson
74+
7175
)
7276

7377

@@ -76,6 +80,7 @@ let create_users_with_list_input ~user =
7680

7781

7882

83+
7984
user
8085
in
8186
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -134,6 +139,7 @@ let update_user ~username ~user_t =
134139

135140

136141
User.to_yojson
142+
137143
user_t
138144
in
139145
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml/src/apis/pet_api.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let add_pet ~pet_t =
2020

2121

2222
Pet.to_yojson
23+
2324
pet_t
2425
in
2526
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -81,6 +82,7 @@ let update_pet ~pet_t =
8182

8283

8384
Pet.to_yojson
85+
8486
pet_t
8587
in
8688
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml/src/apis/store_api.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ let place_order ~order_t =
4646

4747

4848
Order.to_yojson
49+
4950
order_t
5051
in
5152
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->

samples/client/petstore/ocaml/src/apis/user_api.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ let create_user ~user_t =
2121

2222

2323
User.to_yojson
24+
2425
user_t
2526
in
2627
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -42,6 +43,7 @@ let create_users_with_array_input ~user =
4243

4344

4445
User.to_yojson
46+
4547
)
4648

4749

@@ -50,6 +52,7 @@ let create_users_with_array_input ~user =
5052

5153

5254

55+
5356
user
5457
in
5558
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -71,6 +74,7 @@ let create_users_with_list_input ~user =
7174

7275

7376
User.to_yojson
77+
7478
)
7579

7680

@@ -79,6 +83,7 @@ let create_users_with_list_input ~user =
7983

8084

8185

86+
8287
user
8388
in
8489
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
@@ -140,6 +145,7 @@ let update_user ~username ~user_t =
140145

141146

142147
User.to_yojson
148+
143149
user_t
144150
in
145151
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->

0 commit comments

Comments
 (0)