Skip to content

Commit

Permalink
Fix 7459: [Ada] wrong JSON in POST operations (#7460)
Browse files Browse the repository at this point in the history
* Fix Ada client generated code to avoid having a spurious body name for parameters passed in the body

* Run bin/ada-petstore.sh to update the generated Ada client samples
  • Loading branch information
stcarrez authored and wing328 committed Jan 22, 2018
1 parent c731185 commit 2b2b85e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package body {{package}}.Clients is
{{/hasMore}}{{/produces}}));{{/hasProduces}}{{#hasBodyParam}}
Client.Initialize (Req, ({{#hasConsumes}}{{#consumes}}{{#vendorExtensions.x-has-uniq-consumes}}1 -> {{/vendorExtensions.x-has-uniq-consumes}}Swagger.Clients.{{adaMediaType}}{{#hasMore}},
{{/hasMore}}{{/consumes}}{{/hasConsumes}}{{^hasConsumes}}1 => Swagger.Clients.APPLICATION_JSON{{/hasConsumes}}));{{#bodyParams}}{{#vendorExtensions.x-is-model-type}}
{{package}}.Models.Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}{{#isFile}}
{{package}}.Models.Serialize (Req.Stream, "", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}{{#isFile}}
-- TODO: Serialize (Req.Stream, "{{basename}}", {{paramName}});{{/isFile}}{{^isFile}}{{^isLong}}
Req.Stream.Write_Entity ("{{baseName}}", {{paramName}});{{/isLong}}{{#isLong}}
Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/isLong}}{{/isFile}}{{/vendorExtensions.x-is-model-type}}{{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/ada/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0-SNAPSHOT
2.3.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
-- NOTE: This package is auto generated by the swagger code generator 2.3.1.
-- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually.
with Swagger.Streams;
Expand All @@ -21,7 +21,7 @@ package body Samples.Petstore.Clients is
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
Swagger.Clients.APPLICATION_XML));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/pet");
Client.Call (Swagger.Clients.POST, URI, Req);
Expand Down Expand Up @@ -107,7 +107,7 @@ package body Samples.Petstore.Clients is
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
Swagger.Clients.APPLICATION_XML));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/pet");
Client.Call (Swagger.Clients.PUT, URI, Req);
Expand Down Expand Up @@ -215,7 +215,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/store/order");
Client.Call (Swagger.Clients.POST, URI, Req, Reply);
Expand All @@ -233,7 +233,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/user");
Client.Call (Swagger.Clients.POST, URI, Req);
Expand All @@ -249,7 +249,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/user/createWithArray");
Client.Call (Swagger.Clients.POST, URI, Req);
Expand All @@ -265,7 +265,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/user/createWithList");
Client.Call (Swagger.Clients.POST, URI, Req);
Expand Down Expand Up @@ -346,7 +346,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "body", P_Body);
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);

URI.Set_Path ("/user/{username}");
URI.Set_Path_Param ("username", Username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
-- NOTE: This package is auto generated by the swagger code generator 2.3.1.
-- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually.
with Samples.Petstore.Models;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
-- NOTE: This package is auto generated by the swagger code generator 2.3.1.
-- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
-- NOTE: This package is auto generated by the swagger code generator 2.3.1.
-- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually.
with Swagger.Streams;
Expand Down

0 comments on commit 2b2b85e

Please sign in to comment.