Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Ada] Server skeleton does not compile when an operation has no parameter #8641

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{{>licenseInfo}}
pragma Warnings (Off, "*is not referenced");
with Swagger.Streams;
package body {{package}}.Clients is
pragma Style_Checks ("-mr");
{{#apiInfo}}
{{#apis}}
{{#operations}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
with {{package}}.Models;
with Swagger.Clients;
package {{package}}.Clients is
pragma Style_Checks ("-mr");

type Client_Type is new Swagger.Clients.Client_Type with null record;

Expand Down
35 changes: 15 additions & 20 deletions modules/openapi-generator/src/main/resources/Ada/config.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ abstract project Config is

type Yes_No is ("yes", "no");

type Library_Type_Type is ("relocatable", "static");
type Library_Type_Type is ("relocatable", "static", "static-pic");

type Mode_Type is ("distrib", "debug", "optimize", "profile");
Mode : Mode_Type := external ("MODE", "debug");
type Build_Type is ("distrib", "debug", "optimize", "profile", "coverage");
Mode : Build_Type := external ("BUILD", "debug");

Coverage : Yes_No := External ("COVERAGE", "no");
Processors := External ("PROCESSORS", "1");

package Builder is
case Mode is
when "debug" =>
when "debug" =>
for Default_Switches ("Ada") use ("-g", "-j" & Processors);
when others =>
for Default_Switches ("Ada") use ("-g", "-O2", "-j" & Processors);
Expand All @@ -29,21 +28,20 @@ abstract project Config is

when "debug" =>
for Default_Switches ("Ada") use defaults & warnings
& ("-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM99");
& ("-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127");

when "coverage" =>
for Default_Switches ("Ada") use defaults & warnings
& ("-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127",
"-fprofile-arcs", "-ftest-coverage");

when "optimize" =>
for Default_Switches ("Ada") use defaults & warnings
& ("-gnatn", "-gnatp", "-fdata-sections", "-ffunction-sections");

when "profile" =>
for Default_Switches ("Ada") use defaults & warnings & ("-pg");
end case;

case Coverage is
when "yes" =>
for Default_Switches ("ada") use Compiler'Default_Switches ("Ada") &
("-fprofile-arcs", "-ftest-coverage");
when others =>
end case;
end compiler;

Expand All @@ -69,18 +67,15 @@ abstract project Config is
when "optimize" =>
for Default_Switches ("Ada") use ("-Wl,--gc-sections");

when "coverage" =>
for Default_Switches ("ada") use ("-fprofile-arcs");

when others =>
null;
end case;

case Coverage is
when "yes" =>
for Default_Switches ("ada") use Linker'Default_Switches ("ada") &
("-fprofile-arcs");
when others =>
end case;
end linker;

end linker;

package Ide is
for VCS_Kind use "git";
end Ide;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- {{{appDescription}}}
--
-- {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}}
-- {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
--{{#infoEmail}} Contact: {{{infoEmail}}}{{/infoEmail}}
--
-- NOTE: This package is auto generated by OpenAPI-Generator {{{generatorVersion}}}.
-- https://openapi-generator.tech
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{>licenseInfo}}

package body {{package}}.Models is
pragma Style_Checks ("-mr");

pragma Warnings (Off, "*use clause for package*");

use Swagger.Streams;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
with Swagger.Streams;
with Ada.Containers.Vectors;
package {{package}}.Models is
pragma Style_Checks ("-mr");

{{#orderedModels}}{{#model}}{{^isArray}}
{{#title}} -- ------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{{>licenseInfo}}
pragma Warnings (Off, "*is not referenced");
with Swagger.Streams;
with Swagger.Servers.Operation;
package body {{package}}.Skeletons is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*use clause for package*");

use Swagger.Streams;

package body Skeleton is

Expand Down Expand Up @@ -58,7 +63,7 @@ package body {{package}}.Skeletons is
{{#hasParams}}
{{#hasBodyParam}}
Swagger.Servers.Read (Req, Input);
{{#bodyParams}}{{#vendorExtensions.x-is-model-type}}
{{#bodyParams}}{{#vendorExtensions.x-is-model-type}}
{{package}}.Models.Deserialize (Input, "{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}{{#isFile}}
-- TODO: Serialize (Input.Stream, "{{basename}}", {{paramName}});{{/isFile}}{{^isFile}}{{^isLong}}
Deserialize (Input, "{{baseName}}", {{paramName}});{{/isLong}}{{#isLong}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{{>licenseInfo}}
{{#imports}}with {{import}};
{{/imports}}
pragma Warnings (Off, "*is not referenced");
pragma Warnings (Off, "*no entities of*are referenced");
with Swagger.Servers;
with {{package}}.Models;
with Security.Permissions;
package {{package}}.Skeletons is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*use clause for package*");
use {{package}}.Models;
type Server_Type is limited interface;
{{#authMethods}}{{#scopes}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ with Swagger.Servers;
with {{package}}.Models;
with {{package}}.Skeletons;
package {{package}}.Servers is
pragma Warnings (Off, "*use clause for package*");
use {{package}}.Models;
type Server_Type is limited new {{package}}.Skeletons.Server_Type with null record;

Expand Down