Fix 7459: [Ada] wrong JSON in POST operations (#7460)

* 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
This commit is contained in:
Stephane Carrez 2018-01-22 06:21:09 +01:00 committed by William Cheng
parent c73118524c
commit 2b2b85eec7
6 changed files with 13 additions and 13 deletions

View File

@ -24,7 +24,7 @@ package body {{package}}.Clients is
{{/hasMore}}{{/produces}}));{{/hasProduces}}{{#hasBodyParam}} {{/hasMore}}{{/produces}}));{{/hasProduces}}{{#hasBodyParam}}
Client.Initialize (Req, ({{#hasConsumes}}{{#consumes}}{{#vendorExtensions.x-has-uniq-consumes}}1 -> {{/vendorExtensions.x-has-uniq-consumes}}Swagger.Clients.{{adaMediaType}}{{#hasMore}}, 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}} {{/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}} -- TODO: Serialize (Req.Stream, "{{basename}}", {{paramName}});{{/isFile}}{{^isFile}}{{^isLong}}
Req.Stream.Write_Entity ("{{baseName}}", {{paramName}});{{/isLong}}{{#isLong}} Req.Stream.Write_Entity ("{{baseName}}", {{paramName}});{{/isLong}}{{#isLong}}
Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/isLong}}{{/isFile}}{{/vendorExtensions.x-is-model-type}}{{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}} Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/isLong}}{{/isFile}}{{/vendorExtensions.x-is-model-type}}{{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}

View File

@ -1 +1 @@
2.3.0-SNAPSHOT 2.3.1

View File

@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0 -- OpenAPI spec version: 1.0.0
-- Contact: apiteam@swagger.io -- Contact: apiteam@swagger.io
-- --
-- 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 -- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually. -- Do not edit the class manually.
with Swagger.Streams; with Swagger.Streams;
@ -21,7 +21,7 @@ package body Samples.Petstore.Clients is
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON, Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
Swagger.Clients.APPLICATION_XML)); 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"); URI.Set_Path ("/pet");
Client.Call (Swagger.Clients.POST, URI, Req); Client.Call (Swagger.Clients.POST, URI, Req);
@ -107,7 +107,7 @@ package body Samples.Petstore.Clients is
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON, Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
Swagger.Clients.APPLICATION_XML)); 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"); URI.Set_Path ("/pet");
Client.Call (Swagger.Clients.PUT, URI, Req); Client.Call (Swagger.Clients.PUT, URI, Req);
@ -215,7 +215,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => 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"); URI.Set_Path ("/store/order");
Client.Call (Swagger.Clients.POST, URI, Req, Reply); Client.Call (Swagger.Clients.POST, URI, Req, Reply);
@ -233,7 +233,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => 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"); URI.Set_Path ("/user");
Client.Call (Swagger.Clients.POST, URI, Req); Client.Call (Swagger.Clients.POST, URI, Req);
@ -249,7 +249,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => 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"); URI.Set_Path ("/user/createWithArray");
Client.Call (Swagger.Clients.POST, URI, Req); Client.Call (Swagger.Clients.POST, URI, Req);
@ -265,7 +265,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => 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"); URI.Set_Path ("/user/createWithList");
Client.Call (Swagger.Clients.POST, URI, Req); Client.Call (Swagger.Clients.POST, URI, Req);
@ -346,7 +346,7 @@ package body Samples.Petstore.Clients is
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML, Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON)); Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => 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 ("/user/{username}");
URI.Set_Path_Param ("username", Username); URI.Set_Path_Param ("username", Username);

View File

@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0 -- OpenAPI spec version: 1.0.0
-- Contact: apiteam@swagger.io -- Contact: apiteam@swagger.io
-- --
-- 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 -- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually. -- Do not edit the class manually.
with Samples.Petstore.Models; with Samples.Petstore.Models;

View File

@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0 -- OpenAPI spec version: 1.0.0
-- Contact: apiteam@swagger.io -- Contact: apiteam@swagger.io
-- --
-- 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 -- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually. -- Do not edit the class manually.

View File

@ -4,7 +4,7 @@
-- OpenAPI spec version: 1.0.0 -- OpenAPI spec version: 1.0.0
-- Contact: apiteam@swagger.io -- Contact: apiteam@swagger.io
-- --
-- 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 -- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually. -- Do not edit the class manually.
with Swagger.Streams; with Swagger.Streams;