Files
openapi-generator/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache
Stephane Carrez a06af89be9 Fix #8640: [BUG] [Ada] Server skeleton does not compile when an operation has no parameter (#8641)
- add missing 'use Swagger.Streams;' clause
- add Style_Checks pragma to fix style compilation warnings in generated Ada code
- fix spurious spaces in licence headers that cause Ada style compilation warning
- update the default GNAT project config
2021-02-08 11:20:15 +08:00

122 lines
3.4 KiB
Plaintext
Vendored

{{>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}}
-- {{description}}
package ACL_{{ident}} is new Security.Permissions.Definition ("{{scope}}");
{{/scopes}}{{/authMethods}}
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
-- {{summary}}{{#vendorExtensions.x-has-notes}}
-- {{#lambdaAdaComment}}{{unescapedNotes}}{{/lambdaAdaComment}}{{/vendorExtensions.x-has-notes}}
procedure {{operationId}}
(Server : in out Server_Type{{#hasParams}};{{/hasParams}}
{{#allParams}}{{paramName}} : in {{dataType}}{{^-last}};
{{/-last}}{{/allParams}}{{#returnType}};
Result : out {{returnType}}{{/returnType}};
Context : in out Swagger.Servers.Context_Type) is abstract;
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
generic
type Implementation_Type is limited new Server_Type with private;
URI_Prefix : String := "";
package Skeleton is
procedure Register (Server : in out Swagger.Servers.Application_Type'Class);
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
-- {{summary}}
procedure {{operationId}}
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type);
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
end Skeleton;
generic
type Implementation_Type is limited new Server_Type with private;
URI_Prefix : String := "";
package Shared_Instance is
procedure Register (Server : in out Swagger.Servers.Application_Type'Class);
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
-- {{summary}}
procedure {{operationId}}
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type);
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
private
protected Server is
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
-- {{summary}}
{{#hasParams}}
procedure {{operationId}}
({{#allParams}}{{paramName}} : in {{dataType}}{{^-last}};
{{/-last}}{{/allParams}}{{#returnType}};
Result : out {{returnType}}{{/returnType}};
Context : in out Swagger.Servers.Context_Type);
{{/hasParams}}
{{^hasParams}}
{{#returnType}}
procedure {{operationId}}
(Result : out {{returnType}};
Context : in out Swagger.Servers.Context_Type);
{{/returnType}}
{{^returnType}}
procedure {{operationId}} (Context : in out Swagger.Servers.Context_Type);
{{/returnType}}
{{/hasParams}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
private
Impl : Implementation_Type;
end Server;
end Shared_Instance;
end {{package}}.Skeletons;