Fix 3522: [BUG][Ada] Wrong style for generated Ada model types and missing security scopes (#4863)

* [Ada] Operation security scopes are ignored when generating the server (#1043)
- Update fromOperation() to keep the operation required scopes for each auth
  method and store that information in the x-scopes vendor extensions attribute
- Update postProcessOperationsWithModels() to process the operation required
  scopes and build a list of authMethods which only contain the required scopes
  for the operation and store these authMethods in the x-auth-scopes attribute.
- Update postProcessAuthMethod() to handle the logic of filtering and building
  the operation authMethod (new instances are created because we must not
  modify the global authMethod definitions)
- Update the Ada server templates to use the x-auth-scopes instead of authMethods
  Add a URL prefix parameter for the Ada server instantiation

* Fix Ada code generator
- update to generate Ada style type names (broken by the use of Camelize)
- update the templates for Ada Util and Swagger libraries

* Update generated GNAT project to add the 'utilada_xml' dependency

* Update the Ada samples

* Fix compilation of the petstore Ada sample
This commit is contained in:
Stephane Carrez 2019-12-26 07:50:35 +01:00 committed by William Cheng
parent 4b01943b06
commit a8bc3360fd
10 changed files with 199 additions and 164 deletions

View File

@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme; import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*; import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -163,7 +164,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
addOption(CodegenConstants.PROJECT_NAME, "GNAT project name", addOption(CodegenConstants.PROJECT_NAME, "GNAT project name",
this.projectName); this.projectName);
modelNameSuffix = "_Type"; modelNameSuffix = "Type";
embeddedTemplateDir = templateDir = "Ada"; embeddedTemplateDir = templateDir = "Ada";
languageSpecificPrimitives = new HashSet<String>( languageSpecificPrimitives = new HashSet<String>(
@ -242,11 +243,37 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
* @return capitalized model name * @return capitalized model name
*/ */
public String toModelName(final String name) { public String toModelName(final String name) {
String result = super.toModelName(name); String result = camelize(sanitizeName(name));
if (result.matches("^\\d.*") || result.startsWith("_")) {
result = "Model_" + result; if (!StringUtils.isEmpty(modelNamePrefix)) {
result = modelNamePrefix + "_" + result;
} }
return result.replaceAll("[\\.-]", "_").replaceAll("__+", "_");
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(name)) {
String modelName = "Model_" + result;
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
return modelName;
}
// model name starts with number
if (result.matches("^\\d.*")) {
String modelName = "Model_" + result; // e.g. 200Response => Model_200Response (after camelize)
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
return modelName;
}
if (languageSpecificPrimitives.contains(result)) {
String modelName = "Model_" + result;
LOGGER.warn(name + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName);
return modelName;
}
if (!StringUtils.isEmpty(modelNameSuffix)) {
result = result + "_" + modelNameSuffix;
}
return result;
} }
@Override @Override
@ -517,7 +544,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
if (v instanceof CodegenModel) { if (v instanceof CodegenModel) {
CodegenModel m = (CodegenModel) v; CodegenModel m = (CodegenModel) v;
List<String> d = new ArrayList<String>(); List<String> d = new ArrayList<String>();
for (CodegenProperty p : m.allVars) { for (CodegenProperty p : m.vars) {
boolean isModel = false; boolean isModel = false;
CodegenProperty item = p; CodegenProperty item = p;
if (p.isContainer) { if (p.isContainer) {
@ -531,9 +558,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
isModel = true; isModel = true;
} }
p.vendorExtensions.put("x-is-model-type", isModel); p.vendorExtensions.put("x-is-model-type", isModel);
Boolean required = p.getRequired();
// Convert optional members to use the Nullable_<T> type. // Convert optional members to use the Nullable_<T> type.
if (!p.required && nullableTypeMapping.containsKey(p.dataType)) { if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(p.dataType)) {
p.dataType = nullableTypeMapping.get(p.dataType); p.dataType = nullableTypeMapping.get(p.dataType);
} }
} }

View File

@ -6,11 +6,12 @@
-- --
-- NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). -- NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
with "config"; with "config";
with "util"; with "utilada_sys";
with "util_http"; with "utilada_xml";
with "utilada_http";
with "security"; with "security";
with "swagger";{{#isServer}} with "swagger";{{#isServer}}
with "servlet"; with "servletada";
with "swagger_server";{{/isServer}} with "swagger_server";{{/isServer}}
project {{{projectName}}} is project {{{projectName}}} is

View File

@ -2,17 +2,22 @@ with Ada.IO_Exceptions;
with AWS.Config.Set; with AWS.Config.Set;
with Swagger.Servers.AWS; with Swagger.Servers.AWS;
with Swagger.Servers.Applications; with Swagger.Servers.Applications;
with Util.Strings;
with Util.Log.Loggers; with Util.Log.Loggers;
with Util.Properties; with Util.Properties;
with Util.Properties.Basic;
with {{package}}.Servers; with {{package}}.Servers;
procedure {{package}}.Server is procedure {{package}}.Server is
procedure Configure (Config : in out AWS.Config.Object); procedure Configure (Config : in out AWS.Config.Object);
use Util.Properties.Basic;
CONFIG_PATH : constant String := "{{packageConfig}}.properties"; CONFIG_PATH : constant String := "{{packageConfig}}.properties";
Port : Natural := 8080;
procedure Configure (Config : in out AWS.Config.Object) is procedure Configure (Config : in out AWS.Config.Object) is
begin begin
AWS.Config.Set.Server_Port (Config, 8080); AWS.Config.Set.Server_Port (Config, Port);
AWS.Config.Set.Max_Connection (Config, 8); AWS.Config.Set.Max_Connection (Config, 8);
AWS.Config.Set.Accept_Queue_Size (Config, 512); AWS.Config.Set.Accept_Queue_Size (Config, 512);
end Configure; end Configure;
@ -25,13 +30,15 @@ begin
Props.Load_Properties (CONFIG_PATH); Props.Load_Properties (CONFIG_PATH);
Util.Log.Loggers.Initialize (Props); Util.Log.Loggers.Initialize (Props);
Port := Integer_Property.Get (Props, "swagger.port", Port);
App.Configure (Props); App.Configure (Props);
{{package}}.Servers.Server_Impl.Register (App); {{package}}.Servers.Server_Impl.Register (App);
WS.Configure (Configure'Access); WS.Configure (Configure'Access);
WS.Register_Application ("{{basePathWithoutHost}}", App'Unchecked_Access); WS.Register_Application ("{{basePathWithoutHost}}", App'Unchecked_Access);
App.Dump_Routes (Util.Log.INFO_LEVEL); App.Dump_Routes (Util.Log.INFO_LEVEL);
Log.Info ("Connect you browser to: http://localhost:8080{{basePathWithoutHost}}/ui/index.html"); Log.Info ("Connect you browser to: http://localhost:{0}{{basePathWithoutHost}}/ui/index.html",
Util.Strings.Image (Port));
WS.Start; WS.Start;

View File

@ -1 +1 @@
4.0.0-SNAPSHOT 4.2.3-SNAPSHOT

View File

@ -6,8 +6,9 @@
-- --
-- NOTE: Auto generated by the swagger code generator program. -- NOTE: Auto generated by the swagger code generator program.
with "config"; with "config";
with "util"; with "utilada_sys";
with "util_http"; with "utilada_xml";
with "utilada_http";
with "security"; with "security";
with "swagger"; with "swagger";
project Petstore is project Petstore is

View File

@ -1,10 +1,10 @@
-- OpenAPI Petstore -- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
-- --
-- OpenAPI spec version: 1.0.0 -- The version of the OpenAPI document: 1.0.0
-- --
-- --
-- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. -- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech -- https://openapi-generator.tech
-- Do not edit the class manually. -- Do not edit the class manually.
@ -14,7 +14,7 @@ package body Samples.Petstore.Clients is
-- Add a new pet to the store -- Add a new pet to the store
procedure Add_Pet procedure Add_Pet
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.PetType) is P_Body : in Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
begin begin
@ -46,7 +46,7 @@ package body Samples.Petstore.Clients is
procedure Find_Pets_By_Status procedure Find_Pets_By_Status
(Client : in out Client_Type; (Client : in out Client_Type;
Status : in Swagger.UString_Vectors.Vector; Status : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.PetType_Vectors.Vector) is Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
begin begin
@ -64,7 +64,7 @@ package body Samples.Petstore.Clients is
procedure Find_Pets_By_Tags procedure Find_Pets_By_Tags
(Client : in out Client_Type; (Client : in out Client_Type;
Tags : in Swagger.UString_Vectors.Vector; Tags : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.PetType_Vectors.Vector) is Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
begin begin
@ -82,7 +82,7 @@ package body Samples.Petstore.Clients is
procedure Get_Pet_By_Id procedure Get_Pet_By_Id
(Client : in out Client_Type; (Client : in out Client_Type;
Pet_Id : in Swagger.Long; Pet_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.PetType) is Result : out Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
begin begin
@ -98,7 +98,7 @@ package body Samples.Petstore.Clients is
-- Update an existing pet -- Update an existing pet
procedure Update_Pet procedure Update_Pet
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.PetType) is P_Body : in Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
begin begin
@ -136,7 +136,7 @@ package body Samples.Petstore.Clients is
Pet_Id : in Swagger.Long; Pet_Id : in Swagger.Long;
Additional_Metadata : in Swagger.Nullable_UString; Additional_Metadata : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type; File : in Swagger.File_Part_Type;
Result : out Samples.Petstore.Models.ApiResponseType) is Result : out Samples.Petstore.Models.ApiResponse_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
@ -186,7 +186,7 @@ package body Samples.Petstore.Clients is
procedure Get_Order_By_Id procedure Get_Order_By_Id
(Client : in out Client_Type; (Client : in out Client_Type;
Order_Id : in Swagger.Long; Order_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.OrderType) is Result : out Samples.Petstore.Models.Order_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
begin begin
@ -202,8 +202,8 @@ package body Samples.Petstore.Clients is
-- Place an order for a pet -- Place an order for a pet
procedure Place_Order procedure Place_Order
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.OrderType; P_Body : in Samples.Petstore.Models.Order_Type;
Result : out Samples.Petstore.Models.OrderType) is Result : out Samples.Petstore.Models.Order_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
@ -222,7 +222,7 @@ package body Samples.Petstore.Clients is
-- This can only be done by the logged in user. -- This can only be done by the logged in user.
procedure Create_User procedure Create_User
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.UserType) is P_Body : in Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
begin begin
@ -237,7 +237,7 @@ package body Samples.Petstore.Clients is
-- Creates list of users with given input array -- Creates list of users with given input array
procedure Create_Users_With_Array_Input procedure Create_Users_With_Array_Input
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector) is P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
begin begin
@ -252,7 +252,7 @@ package body Samples.Petstore.Clients is
-- Creates list of users with given input array -- Creates list of users with given input array
procedure Create_Users_With_List_Input procedure Create_Users_With_List_Input
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector) is P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
begin begin
@ -282,7 +282,7 @@ package body Samples.Petstore.Clients is
procedure Get_User_By_Name procedure Get_User_By_Name
(Client : in out Client_Type; (Client : in out Client_Type;
Username : in Swagger.UString; Username : in Swagger.UString;
Result : out Samples.Petstore.Models.UserType) is Result : out Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type; Reply : Swagger.Value_Type;
begin begin
@ -330,7 +330,7 @@ package body Samples.Petstore.Clients is
procedure Update_User procedure Update_User
(Client : in out Client_Type; (Client : in out Client_Type;
Username : in Swagger.UString; Username : in Swagger.UString;
P_Body : in Samples.Petstore.Models.UserType) is P_Body : in Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type; URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type; Req : Swagger.Clients.Request_Type;
begin begin

View File

@ -1,10 +1,10 @@
-- OpenAPI Petstore -- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
-- --
-- OpenAPI spec version: 1.0.0 -- The version of the OpenAPI document: 1.0.0
-- --
-- --
-- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. -- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech -- https://openapi-generator.tech
-- Do not edit the class manually. -- Do not edit the class manually.
@ -17,7 +17,7 @@ package Samples.Petstore.Clients is
-- Add a new pet to the store -- Add a new pet to the store
procedure Add_Pet procedure Add_Pet
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.PetType); P_Body : in Samples.Petstore.Models.Pet_Type);
-- Deletes a pet -- Deletes a pet
procedure Delete_Pet procedure Delete_Pet
@ -30,26 +30,26 @@ package Samples.Petstore.Clients is
procedure Find_Pets_By_Status procedure Find_Pets_By_Status
(Client : in out Client_Type; (Client : in out Client_Type;
Status : in Swagger.UString_Vectors.Vector; Status : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.PetType_Vectors.Vector); Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector);
-- Finds Pets by tags -- Finds Pets by tags
-- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. -- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
procedure Find_Pets_By_Tags procedure Find_Pets_By_Tags
(Client : in out Client_Type; (Client : in out Client_Type;
Tags : in Swagger.UString_Vectors.Vector; Tags : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.PetType_Vectors.Vector); Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector);
-- Find pet by ID -- Find pet by ID
-- Returns a single pet -- Returns a single pet
procedure Get_Pet_By_Id procedure Get_Pet_By_Id
(Client : in out Client_Type; (Client : in out Client_Type;
Pet_Id : in Swagger.Long; Pet_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.PetType); Result : out Samples.Petstore.Models.Pet_Type);
-- Update an existing pet -- Update an existing pet
procedure Update_Pet procedure Update_Pet
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.PetType); P_Body : in Samples.Petstore.Models.Pet_Type);
-- Updates a pet in the store with form data -- Updates a pet in the store with form data
procedure Update_Pet_With_Form procedure Update_Pet_With_Form
@ -64,7 +64,7 @@ package Samples.Petstore.Clients is
Pet_Id : in Swagger.Long; Pet_Id : in Swagger.Long;
Additional_Metadata : in Swagger.Nullable_UString; Additional_Metadata : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type; File : in Swagger.File_Part_Type;
Result : out Samples.Petstore.Models.ApiResponseType); Result : out Samples.Petstore.Models.ApiResponse_Type);
-- Delete purchase order by ID -- Delete purchase order by ID
-- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors -- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@ -83,29 +83,29 @@ package Samples.Petstore.Clients is
procedure Get_Order_By_Id procedure Get_Order_By_Id
(Client : in out Client_Type; (Client : in out Client_Type;
Order_Id : in Swagger.Long; Order_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.OrderType); Result : out Samples.Petstore.Models.Order_Type);
-- Place an order for a pet -- Place an order for a pet
procedure Place_Order procedure Place_Order
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.OrderType; P_Body : in Samples.Petstore.Models.Order_Type;
Result : out Samples.Petstore.Models.OrderType); Result : out Samples.Petstore.Models.Order_Type);
-- Create user -- Create user
-- This can only be done by the logged in user. -- This can only be done by the logged in user.
procedure Create_User procedure Create_User
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.UserType); P_Body : in Samples.Petstore.Models.User_Type);
-- Creates list of users with given input array -- Creates list of users with given input array
procedure Create_Users_With_Array_Input procedure Create_Users_With_Array_Input
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector); P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector);
-- Creates list of users with given input array -- Creates list of users with given input array
procedure Create_Users_With_List_Input procedure Create_Users_With_List_Input
(Client : in out Client_Type; (Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector); P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector);
-- Delete user -- Delete user
-- This can only be done by the logged in user. -- This can only be done by the logged in user.
@ -117,7 +117,7 @@ package Samples.Petstore.Clients is
procedure Get_User_By_Name procedure Get_User_By_Name
(Client : in out Client_Type; (Client : in out Client_Type;
Username : in Swagger.UString; Username : in Swagger.UString;
Result : out Samples.Petstore.Models.UserType); Result : out Samples.Petstore.Models.User_Type);
-- Logs user into the system -- Logs user into the system
procedure Login_User procedure Login_User
@ -135,6 +135,6 @@ package Samples.Petstore.Clients is
procedure Update_User procedure Update_User
(Client : in out Client_Type; (Client : in out Client_Type;
Username : in Swagger.UString; Username : in Swagger.UString;
P_Body : in Samples.Petstore.Models.UserType); P_Body : in Samples.Petstore.Models.User_Type);
end Samples.Petstore.Clients; end Samples.Petstore.Clients;

View File

@ -1,10 +1,10 @@
-- OpenAPI Petstore -- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
-- --
-- OpenAPI spec version: 1.0.0 -- The version of the OpenAPI document: 1.0.0
-- --
-- --
-- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. -- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech -- https://openapi-generator.tech
-- Do not edit the class manually. -- Do not edit the class manually.
@ -17,7 +17,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in ApiResponseType) is Value : in ApiResponse_Type) is
begin begin
Into.Start_Entity (Name); Into.Start_Entity (Name);
Into.Write_Entity ("code", Value.Code); Into.Write_Entity ("code", Value.Code);
@ -28,7 +28,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in ApiResponseType_Vectors.Vector) is Value : in ApiResponse_Type_Vectors.Vector) is
begin begin
Into.Start_Array (Name); Into.Start_Array (Name);
for Item of Value loop for Item of Value loop
@ -39,7 +39,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out ApiResponseType) is Value : out ApiResponse_Type) is
Object : Swagger.Value_Type; Object : Swagger.Value_Type;
begin begin
Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (From, Name, Object);
@ -50,9 +50,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out ApiResponseType_Vectors.Vector) is Value : out ApiResponse_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type; List : Swagger.Value_Array_Type;
Item : ApiResponseType; Item : ApiResponse_Type;
begin begin
Value.Clear; Value.Clear;
Swagger.Streams.Deserialize (From, Name, List); Swagger.Streams.Deserialize (From, Name, List);
@ -67,7 +67,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in TagType) is Value : in Tag_Type) is
begin begin
Into.Start_Entity (Name); Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id); Serialize (Into, "id", Value.Id);
@ -77,7 +77,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in TagType_Vectors.Vector) is Value : in Tag_Type_Vectors.Vector) is
begin begin
Into.Start_Array (Name); Into.Start_Array (Name);
for Item of Value loop for Item of Value loop
@ -88,7 +88,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out TagType) is Value : out Tag_Type) is
Object : Swagger.Value_Type; Object : Swagger.Value_Type;
begin begin
Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (From, Name, Object);
@ -98,9 +98,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out TagType_Vectors.Vector) is Value : out Tag_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type; List : Swagger.Value_Array_Type;
Item : TagType; Item : Tag_Type;
begin begin
Value.Clear; Value.Clear;
Swagger.Streams.Deserialize (From, Name, List); Swagger.Streams.Deserialize (From, Name, List);
@ -115,7 +115,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in CategoryType) is Value : in Category_Type) is
begin begin
Into.Start_Entity (Name); Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id); Serialize (Into, "id", Value.Id);
@ -125,7 +125,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in CategoryType_Vectors.Vector) is Value : in Category_Type_Vectors.Vector) is
begin begin
Into.Start_Array (Name); Into.Start_Array (Name);
for Item of Value loop for Item of Value loop
@ -136,7 +136,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out CategoryType) is Value : out Category_Type) is
Object : Swagger.Value_Type; Object : Swagger.Value_Type;
begin begin
Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (From, Name, Object);
@ -146,9 +146,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out CategoryType_Vectors.Vector) is Value : out Category_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type; List : Swagger.Value_Array_Type;
Item : CategoryType; Item : Category_Type;
begin begin
Value.Clear; Value.Clear;
Swagger.Streams.Deserialize (From, Name, List); Swagger.Streams.Deserialize (From, Name, List);
@ -163,7 +163,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in PetType) is Value : in Pet_Type) is
begin begin
Into.Start_Entity (Name); Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id); Serialize (Into, "id", Value.Id);
@ -177,7 +177,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in PetType_Vectors.Vector) is Value : in Pet_Type_Vectors.Vector) is
begin begin
Into.Start_Array (Name); Into.Start_Array (Name);
for Item of Value loop for Item of Value loop
@ -188,23 +188,23 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out PetType) is Value : out Pet_Type) is
Object : Swagger.Value_Type; Object : Swagger.Value_Type;
begin begin
Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "category", Value.Category); Deserialize (Object, "category", Value.Category);
Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "name", Value.Name);
Swagger.Streams.Deserialize (Object, "photoUrls", Value.Photo_Urls); Swagger.Streams.Deserialize (Object, "photoUrls", Value.Photo_Urls);
Swagger.Streams.Deserialize (Object, "tags", Value.Tags); Deserialize (Object, "tags", Value.Tags);
Swagger.Streams.Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "status", Value.Status);
end Deserialize; end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out PetType_Vectors.Vector) is Value : out Pet_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type; List : Swagger.Value_Array_Type;
Item : PetType; Item : Pet_Type;
begin begin
Value.Clear; Value.Clear;
Swagger.Streams.Deserialize (From, Name, List); Swagger.Streams.Deserialize (From, Name, List);
@ -219,7 +219,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in UserType) is Value : in User_Type) is
begin begin
Into.Start_Entity (Name); Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id); Serialize (Into, "id", Value.Id);
@ -235,7 +235,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in UserType_Vectors.Vector) is Value : in User_Type_Vectors.Vector) is
begin begin
Into.Start_Array (Name); Into.Start_Array (Name);
for Item of Value loop for Item of Value loop
@ -246,7 +246,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out UserType) is Value : out User_Type) is
Object : Swagger.Value_Type; Object : Swagger.Value_Type;
begin begin
Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (From, Name, Object);
@ -262,9 +262,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out UserType_Vectors.Vector) is Value : out User_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type; List : Swagger.Value_Array_Type;
Item : UserType; Item : User_Type;
begin begin
Value.Clear; Value.Clear;
Swagger.Streams.Deserialize (From, Name, List); Swagger.Streams.Deserialize (From, Name, List);
@ -279,7 +279,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in OrderType) is Value : in Order_Type) is
begin begin
Into.Start_Entity (Name); Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id); Serialize (Into, "id", Value.Id);
@ -293,7 +293,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in OrderType_Vectors.Vector) is Value : in Order_Type_Vectors.Vector) is
begin begin
Into.Start_Array (Name); Into.Start_Array (Name);
for Item of Value loop for Item of Value loop
@ -304,23 +304,23 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out OrderType) is Value : out Order_Type) is
Object : Swagger.Value_Type; Object : Swagger.Value_Type;
begin begin
Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "petId", Value.Pet_Id); Swagger.Streams.Deserialize (Object, "petId", Value.Pet_Id);
Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity); Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity);
Swagger.Streams.Deserialize (Object, "shipDate", Value.Ship_Date); Deserialize (Object, "shipDate", Value.Ship_Date);
Swagger.Streams.Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "complete", Value.Complete); Swagger.Streams.Deserialize (Object, "complete", Value.Complete);
end Deserialize; end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out OrderType_Vectors.Vector) is Value : out Order_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type; List : Swagger.Value_Array_Type;
Item : OrderType; Item : Order_Type;
begin begin
Value.Clear; Value.Clear;
Swagger.Streams.Deserialize (From, Name, List); Swagger.Streams.Deserialize (From, Name, List);

View File

@ -1,10 +1,10 @@
-- OpenAPI Petstore -- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
-- --
-- OpenAPI spec version: 1.0.0 -- The version of the OpenAPI document: 1.0.0
-- --
-- --
-- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. -- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech -- https://openapi-generator.tech
-- Do not edit the class manually. -- Do not edit the class manually.
@ -17,32 +17,32 @@ package Samples.Petstore.Models is
-- An uploaded response -- An uploaded response
-- Describes the result of uploading an image resource -- Describes the result of uploading an image resource
-- ------------------------------ -- ------------------------------
type ApiResponseType is type ApiResponse_Type is
record record
Code : Integer; Code : Swagger.Nullable_Integer;
P_Type : Swagger.UString; P_Type : Swagger.Nullable_UString;
Message : Swagger.UString; Message : Swagger.Nullable_UString;
end record; end record;
package ApiResponseType_Vectors is package ApiResponse_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive, new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => ApiResponseType); Element_Type => ApiResponse_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in ApiResponseType); Value : in ApiResponse_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in ApiResponseType_Vectors.Vector); Value : in ApiResponse_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out ApiResponseType); Value : out ApiResponse_Type);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out ApiResponseType_Vectors.Vector); Value : out ApiResponse_Type_Vectors.Vector);
@ -50,31 +50,31 @@ package Samples.Petstore.Models is
-- Pet Tag -- Pet Tag
-- A tag for a pet -- A tag for a pet
-- ------------------------------ -- ------------------------------
type TagType is type Tag_Type is
record record
Id : Swagger.Long; Id : Swagger.Nullable_Long;
Name : Swagger.UString; Name : Swagger.Nullable_UString;
end record; end record;
package TagType_Vectors is package Tag_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive, new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => TagType); Element_Type => Tag_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in TagType); Value : in Tag_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in TagType_Vectors.Vector); Value : in Tag_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out TagType); Value : out Tag_Type);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out TagType_Vectors.Vector); Value : out Tag_Type_Vectors.Vector);
@ -82,31 +82,31 @@ package Samples.Petstore.Models is
-- Pet category -- Pet category
-- A category for a pet -- A category for a pet
-- ------------------------------ -- ------------------------------
type CategoryType is type Category_Type is
record record
Id : Swagger.Long; Id : Swagger.Nullable_Long;
Name : Swagger.UString; Name : Swagger.Nullable_UString;
end record; end record;
package CategoryType_Vectors is package Category_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive, new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => CategoryType); Element_Type => Category_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in CategoryType); Value : in Category_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in CategoryType_Vectors.Vector); Value : in Category_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out CategoryType); Value : out Category_Type);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out CategoryType_Vectors.Vector); Value : out Category_Type_Vectors.Vector);
@ -114,35 +114,35 @@ package Samples.Petstore.Models is
-- a Pet -- a Pet
-- A pet for sale in the pet store -- A pet for sale in the pet store
-- ------------------------------ -- ------------------------------
type PetType is type Pet_Type is
record record
Id : Swagger.Long; Id : Swagger.Nullable_Long;
Category : Samples.Petstore.Models.CategoryType; Category : Samples.Petstore.Models.Category_Type;
Name : Swagger.UString; Name : Swagger.UString;
Photo_Urls : Swagger.UString_Vectors.Vector; Photo_Urls : Swagger.UString_Vectors.Vector;
Tags : Samples.Petstore.Models.TagType_Vectors.Vector; Tags : Samples.Petstore.Models.Tag_Type_Vectors.Vector;
Status : Swagger.UString; Status : Swagger.Nullable_UString;
end record; end record;
package PetType_Vectors is package Pet_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive, new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => PetType); Element_Type => Pet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in PetType); Value : in Pet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in PetType_Vectors.Vector); Value : in Pet_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out PetType); Value : out Pet_Type);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out PetType_Vectors.Vector); Value : out Pet_Type_Vectors.Vector);
@ -150,37 +150,37 @@ package Samples.Petstore.Models is
-- a User -- a User
-- A User who is purchasing from the pet store -- A User who is purchasing from the pet store
-- ------------------------------ -- ------------------------------
type UserType is type User_Type is
record record
Id : Swagger.Long; Id : Swagger.Nullable_Long;
Username : Swagger.UString; Username : Swagger.Nullable_UString;
First_Name : Swagger.UString; First_Name : Swagger.Nullable_UString;
Last_Name : Swagger.UString; Last_Name : Swagger.Nullable_UString;
Email : Swagger.UString; Email : Swagger.Nullable_UString;
Password : Swagger.UString; Password : Swagger.Nullable_UString;
Phone : Swagger.UString; Phone : Swagger.Nullable_UString;
User_Status : Integer; User_Status : Swagger.Nullable_Integer;
end record; end record;
package UserType_Vectors is package User_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive, new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => UserType); Element_Type => User_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in UserType); Value : in User_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in UserType_Vectors.Vector); Value : in User_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out UserType); Value : out User_Type);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out UserType_Vectors.Vector); Value : out User_Type_Vectors.Vector);
@ -188,35 +188,35 @@ package Samples.Petstore.Models is
-- Pet Order -- Pet Order
-- An order for a pets from the pet store -- An order for a pets from the pet store
-- ------------------------------ -- ------------------------------
type OrderType is type Order_Type is
record record
Id : Swagger.Long; Id : Swagger.Nullable_Long;
Pet_Id : Swagger.Long; Pet_Id : Swagger.Nullable_Long;
Quantity : Integer; Quantity : Swagger.Nullable_Integer;
Ship_Date : Swagger.Datetime; Ship_Date : Swagger.Nullable_Date;
Status : Swagger.UString; Status : Swagger.Nullable_UString;
Complete : Boolean; Complete : Swagger.Nullable_Boolean;
end record; end record;
package OrderType_Vectors is package Order_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive, new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => OrderType); Element_Type => Order_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in OrderType); Value : in Order_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String; Name : in String;
Value : in OrderType_Vectors.Vector); Value : in Order_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out OrderType); Value : out Order_Type);
procedure Deserialize (From : in Swagger.Value_Type; procedure Deserialize (From : in Swagger.Value_Type;
Name : in String; Name : in String;
Value : out OrderType_Vectors.Vector); Value : out Order_Type_Vectors.Vector);

View File

@ -5,12 +5,10 @@ with Util.Http.Clients.Curl;
with Ada.Text_IO; with Ada.Text_IO;
with Ada.Command_Line; with Ada.Command_Line;
with Ada.Calendar.Formatting; with Ada.Calendar.Formatting;
with Ada.Strings.Unbounded;
with Ada.Exceptions; with Ada.Exceptions;
procedure Test is procedure Petstore is
use Ada.Text_IO; use Ada.Text_IO;
use type Ada.Strings.Unbounded.Unbounded_String;
procedure Usage; procedure Usage;
procedure Print_Pet (Pet : in Samples.Petstore.Models.Pet_Type); procedure Print_Pet (Pet : in Samples.Petstore.Models.Pet_Type);
@ -65,7 +63,7 @@ procedure Test is
Need_Indent := False; Need_Indent := False;
Put ("URLs : "); Put ("URLs : ");
for Url of Pet.Photo_Urls loop for Url of Pet.Photo_Urls loop
Put_Line ((if Need_Indent then " " else "") & Swagger.To_String (Url.Value)); Put_Line ((if Need_Indent then " " else "") & Url);
Need_Indent := True; Need_Indent := True;
end loop; end loop;
end if; end if;
@ -130,10 +128,10 @@ procedure Test is
begin begin
for I in Arg .. Arg_Count loop for I in Arg .. Arg_Count loop
declare declare
Status : Swagger.Nullable_UString_Vectors.Vector; Status : Swagger.UString_Vectors.Vector;
P : constant String := Ada.Command_Line.Argument (I); P : constant String := Ada.Command_Line.Argument (I);
begin begin
Status.Append ((Is_Null => False, Value => Swagger.To_UString (P))); Status.Append (New_Item => P);
C.Find_Pets_By_Status (Status, Pets); C.Find_Pets_By_Status (Status, Pets);
for Pet of Pets loop for Pet of Pets loop
Print_Pet (Pet); Print_Pet (Pet);
@ -143,17 +141,17 @@ procedure Test is
end List_Pet; end List_Pet;
procedure List_Inventory (C : in out Samples.Petstore.Clients.Client_Type) is procedure List_Inventory (C : in out Samples.Petstore.Clients.Client_Type) is
List : Swagger.Nullable_Integer_Map; List : Swagger.Integer_Map;
Iter : Swagger.Nullable_Integer_Maps.Cursor; Iter : Swagger.Integer_Maps.Cursor;
begin begin
C.Get_Inventory (List); C.Get_Inventory (List);
Ada.Text_IO.Put_Line ("Inventory size " & Natural'Image (Natural (List.Length))); Ada.Text_IO.Put_Line ("Inventory size " & Natural'Image (Natural (List.Length)));
Iter := List.First; Iter := List.First;
while Swagger.Nullable_Integer_Maps.Has_Element (Iter) loop while Swagger.Integer_Maps.Has_Element (Iter) loop
Put (Swagger.Nullable_Integer_Maps.Key (Iter)); Put (Swagger.Integer_Maps.Key (Iter));
Set_Col (70); Set_Col (70);
Put_Line (Natural'Image (Swagger.Nullable_Integer_Maps.Element (Iter).Value)); Put_Line (Natural'Image (Swagger.Integer_Maps.Element (Iter)));
Swagger.Nullable_Integer_Maps.Next (Iter); Swagger.Integer_Maps.Next (Iter);
end loop; end loop;
end List_Inventory; end List_Inventory;
@ -271,4 +269,4 @@ begin
Put_Line ("Constraint error raised: " & Ada.Exceptions.Exception_Message (E)); Put_Line ("Constraint error raised: " & Ada.Exceptions.Exception_Message (E));
end; end;
end Test; end Petstore;