diff --git a/docs/generators/ada-server.md b/docs/generators/ada-server.md index 63c530a26cb..bf3952b2817 100644 --- a/docs/generators/ada-server.md +++ b/docs/generators/ada-server.md @@ -22,7 +22,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| +|httpSupport|The name of the HTTP support library. Possible values include 'curl' or 'aws'.| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|openApiName|The name of the Ada package which provides support for OpenAPI for the generated client and server code. The default is 'Swagger'.| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|GNAT project name| |defaultProject| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| @@ -228,16 +230,16 @@ These options may be applied as additional-properties (cli) or configOptions (pl |BasicAuth|✗|OAS2,OAS3 |ApiKey|✗|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 -|OAuth2_Password|✗|OAS2,OAS3 -|OAuth2_ClientCredentials|✗|OAS2,OAS3 -|OAuth2_AuthorizationCode|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 +|OAuth2_Password|✓|OAS2,OAS3 +|OAuth2_ClientCredentials|✓|OAS2,OAS3 +|OAuth2_AuthorizationCode|✓|OAS2,OAS3 ### Wire Format Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | |JSON|✓|OAS2,OAS3 -|XML|✗|OAS2,OAS3 +|XML|✓|OAS2,OAS3 |PROTOBUF|✗|ToolingExtension |Custom|✗|OAS2,OAS3 diff --git a/docs/generators/ada.md b/docs/generators/ada.md index 8bb28aefe70..91378a45435 100644 --- a/docs/generators/ada.md +++ b/docs/generators/ada.md @@ -22,7 +22,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| +|httpSupport|The name of the HTTP support library. Possible values include 'curl' or 'aws'.| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|openApiName|The name of the Ada package which provides support for OpenAPI for the generated client and server code. The default is 'Swagger'.| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|GNAT project name| |defaultProject| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java index 2473ebd97d1..9106d3bd02c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java @@ -45,6 +45,9 @@ import static org.openapitools.codegen.utils.StringUtils.camelize; abstract public class AbstractAdaCodegen extends DefaultCodegen implements CodegenConfig { private final Logger LOGGER = LoggerFactory.getLogger(AbstractAdaCodegen.class); + public static final String HTTP_SUPPORT_OPTION = "httpSupport"; + public static final String OPENAPI_PACKAGE_NAME_OPTION = "openApiName"; + protected String packageName = "defaultPackage"; protected String projectName = "defaultProject"; protected List> orderedModels; @@ -52,6 +55,8 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg protected final Map nullableTypeMapping; protected final Map operationsScopes; protected int scopeIndex = 0; + protected String httpClientPackageName = "Curl"; + protected String openApiPackageName = "Swagger"; public AbstractAdaCodegen() { super(); @@ -156,30 +161,11 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg ); typeMapping = new HashMap<>(); - typeMapping.put("date", "Swagger.Date"); - typeMapping.put("DateTime", "Swagger.Datetime"); - typeMapping.put("string", "Swagger.UString"); typeMapping.put("integer", "Integer"); - typeMapping.put("long", "Swagger.Long"); typeMapping.put("boolean", "Boolean"); - typeMapping.put("array", "Swagger.Vector"); - typeMapping.put("map", "Swagger.Map"); - typeMapping.put("object", "Swagger.Object"); - typeMapping.put("number", "Swagger.Number"); - typeMapping.put("UUID", "Swagger.UString"); - typeMapping.put("URI", "Swagger.UString"); - typeMapping.put("file", "Swagger.Http_Content_Type"); - typeMapping.put("binary", "Swagger.Binary"); // Mapping to convert an Ada required type to an optional type (nullable). nullableTypeMapping = new HashMap<>(); - nullableTypeMapping.put("Swagger.Date", "Swagger.Nullable_Date"); - nullableTypeMapping.put("Swagger.Datetime", "Swagger.Nullable_Date"); - nullableTypeMapping.put("Swagger.UString", "Swagger.Nullable_UString"); - nullableTypeMapping.put("Integer", "Swagger.Nullable_Integer"); - nullableTypeMapping.put("Swagger.Long", "Swagger.Nullable_Long"); - nullableTypeMapping.put("Boolean", "Swagger.Nullable_Boolean"); - nullableTypeMapping.put("Swagger.Object", "Swagger.Object"); modelDepends = new HashMap<>(); orderedModels = new ArrayList<>(); @@ -190,6 +176,9 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg addOption(CodegenConstants.PROJECT_NAME, "GNAT project name", this.projectName); + cliOptions.add(CliOption.newString(HTTP_SUPPORT_OPTION, "The name of the HTTP support library. Possible values include 'curl' or 'aws'.")); + cliOptions.add(CliOption.newString(OPENAPI_PACKAGE_NAME_OPTION, "The name of the Ada package which provides support for OpenAPI for the generated client and server code. The default is 'Swagger'.")); + modelNameSuffix = "Type"; embeddedTemplateDir = templateDir = "Ada"; @@ -198,6 +187,49 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg "double", "object", "string", "date", "DateTime", "binary")); } + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(HTTP_SUPPORT_OPTION)) { + String httpSupport = additionalProperties.get(HTTP_SUPPORT_OPTION).toString().toLowerCase(Locale.ROOT); + + if ("aws".equals(httpSupport)) { + this.httpClientPackageName = "Aws"; + } else if ("curl".equals(httpSupport)) { + this.httpClientPackageName = "Curl"; + } else { + LOGGER.error("invalid http support option `{}`", httpSupport); + } + } + if (additionalProperties.containsKey(OPENAPI_PACKAGE_NAME_OPTION)) { + this.openApiPackageName = additionalProperties.get(OPENAPI_PACKAGE_NAME_OPTION).toString(); + } + + typeMapping.put("date", openApiPackageName + ".Date"); + typeMapping.put("DateTime", openApiPackageName + ".Datetime"); + typeMapping.put("string", openApiPackageName + ".UString"); + typeMapping.put("long", openApiPackageName + ".Long"); + typeMapping.put("array", openApiPackageName + ".Vector"); + typeMapping.put("map", openApiPackageName + ".Map"); + typeMapping.put("object", openApiPackageName + ".Object"); + typeMapping.put("number", openApiPackageName + ".Number"); + typeMapping.put("UUID", openApiPackageName + ".UString"); + typeMapping.put("URI", openApiPackageName + ".UString"); + typeMapping.put("file", openApiPackageName + ".Http_Content_Type"); + typeMapping.put("binary", openApiPackageName + ".Binary"); + + // Mapping to convert an Ada required type to an optional type (nullable). + nullableTypeMapping.put(openApiPackageName + ".Date", openApiPackageName + ".Nullable_Date"); + nullableTypeMapping.put(openApiPackageName + ".Datetime", openApiPackageName + ".Nullable_Date"); + nullableTypeMapping.put(openApiPackageName + ".UString", openApiPackageName + ".Nullable_UString"); + nullableTypeMapping.put("Integer", openApiPackageName + ".Nullable_Integer"); + nullableTypeMapping.put(openApiPackageName + ".Long", openApiPackageName + ".Nullable_Long"); + nullableTypeMapping.put("Boolean", openApiPackageName + ".Nullable_Boolean"); + nullableTypeMapping.put(openApiPackageName + ".Object", openApiPackageName + ".Object"); + + } + public String toFilename(String name) { return name.replace(".", "-").toLowerCase(Locale.ROOT); } @@ -421,10 +453,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg if (ModelUtils.isMapSchema(p)) { Schema inner = getAdditionalProperties(p); String name = getTypeDeclaration(inner) + "_Map"; - if (name.startsWith("Swagger.")) { + if (name.startsWith(openApiPackageName)) { return name; } else { - return "Swagger." + name; + return openApiPackageName + "." + name; } } if (typeMapping.containsKey(schemaType)) { @@ -456,7 +488,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg if (!isModel && !parameter.isPrimitiveType && !parameter.isDate && !parameter.isFreeFormObject && !parameter.isString && !parameter.isContainer && !parameter.isFile - && !parameter.dataType.startsWith("Swagger")) { + && !parameter.dataType.startsWith(openApiPackageName)) { isModel = true; } return isModel; @@ -475,7 +507,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg if (!isModel && !parameter.isPrimitiveType && !parameter.isDate && !parameter.isFreeFormObject && !parameter.isString && !parameter.isContainer && !parameter.isFile - && !parameter.dataType.startsWith("Swagger")) { + && !parameter.dataType.startsWith(openApiPackageName)) { isModel = true; } return isModel; @@ -591,7 +623,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg // Set the file parameter type for both allParams and formParams. for (CodegenParameter p : op1.allParams) { if (p.isFormParam && p.isFile) { - p.dataType = "Swagger.File_Part_Type"; + p.dataType = openApiPackageName + ".File_Part_Type"; } // Convert optional parameters to use the Nullable_ type. if (!p.required && nullableTypeMapping.containsKey(p.dataType)) { @@ -600,7 +632,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg } for (CodegenParameter p : op1.formParams) { if (p.isFile) { - p.dataType = "Swagger.File_Part_Type"; + p.dataType = openApiPackageName + ".File_Part_Type"; } } @@ -672,6 +704,9 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg // Convert optional members to use the Nullable_ type. if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(p.dataType)) { p.dataType = nullableTypeMapping.get(p.dataType); + p.vendorExtensions.put("x-is-required", false); + } else { + p.vendorExtensions.put("x-is-required", true); } } // let us work with fully qualified names only diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java index f7ec26fac07..f4adfc3321c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java @@ -29,6 +29,7 @@ import org.openapitools.codegen.meta.features.*; import java.io.File; import java.io.IOException; import java.io.Writer; +import java.util.EnumSet; import java.util.Locale; public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig { @@ -56,22 +57,16 @@ public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig { public void processOpts() { super.processOpts(); - // TODO: Ada maintainer review. modifyFeatureSet(features -> features .excludeDocumentationFeatures(DocumentationFeature.Readme) - .excludeWireFormatFeatures( - WireFormatFeature.XML, - WireFormatFeature.PROTOBUF - ) - .excludeSecurityFeatures( - SecurityFeature.OpenIDConnect, + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) + .securityFeatures(EnumSet.of( SecurityFeature.OAuth2_Password, SecurityFeature.OAuth2_AuthorizationCode, SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_Implicit, - SecurityFeature.BearerToken, - SecurityFeature.ApiKey - ) + SecurityFeature.BearerToken + )) .excludeGlobalFeatures( GlobalFeature.XMLStructureDefinitions, GlobalFeature.Callbacks, @@ -123,6 +118,8 @@ public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig { additionalProperties.put("packageDir", "client"); additionalProperties.put("mainName", "client"); additionalProperties.put("isServer", false); + additionalProperties.put("httpClientPackageName", httpClientPackageName); + additionalProperties.put("openApiPackageName", openApiPackageName); additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName); String[] names = this.modelPackage.split("\\."); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaServerCodegen.java index 3565fa067fc..ef8056d701e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaServerCodegen.java @@ -28,6 +28,7 @@ import org.openapitools.codegen.meta.features.*; import java.io.File; import java.io.IOException; import java.io.Writer; +import java.util.EnumSet; import java.util.Locale; public class AdaServerCodegen extends AbstractAdaCodegen implements CodegenConfig { @@ -35,21 +36,18 @@ public class AdaServerCodegen extends AbstractAdaCodegen implements CodegenConfi public AdaServerCodegen() { super(); - // TODO: Ada maintainer review. + // Runtime library supports JSON, XML, OAuth2. + // Parameter Header and Cookie need some work. modifyFeatureSet(features -> features .includeDocumentationFeatures(DocumentationFeature.Readme) - .excludeWireFormatFeatures( - WireFormatFeature.XML, - WireFormatFeature.PROTOBUF - ) - .excludeSecurityFeatures( - SecurityFeature.OpenIDConnect, + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) + .securityFeatures(EnumSet.of( SecurityFeature.OAuth2_Password, SecurityFeature.OAuth2_AuthorizationCode, SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_Implicit, SecurityFeature.BearerToken - ) + )) .excludeGlobalFeatures( GlobalFeature.XMLStructureDefinitions, GlobalFeature.Callbacks, @@ -123,6 +121,8 @@ public class AdaServerCodegen extends AbstractAdaCodegen implements CodegenConfi additionalProperties.put("packageDir", "server"); additionalProperties.put("mainName", "server"); additionalProperties.put("isServer", "true"); + additionalProperties.put("httpClientPackageName", httpClientPackageName); + additionalProperties.put("openApiPackageName", openApiPackageName); additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName); String names[] = this.modelPackage.split("\\."); diff --git a/modules/openapi-generator/src/main/resources/Ada/README.mustache b/modules/openapi-generator/src/main/resources/Ada/README.mustache index d0f6d54028f..1ad3a600d8c 100644 --- a/modules/openapi-generator/src/main/resources/Ada/README.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/README.mustache @@ -1,4 +1,4 @@ -# {{appDescription}} - Swagger Ada Server +# {{appDescription}} - OpenAPI Ada Server ## Overview @@ -9,9 +9,9 @@ you can easily generate a server stub. ## Building To build the server you will need the GNAT Ada compiler as well as -the [Swagger Ada library](https://github.com/stcarrez/swagger-ada). +the [OpenAPI Ada library](https://github.com/stcarrez/swagger-ada). -When the GNAT Ada compiler and Swagger Ada libraries are installed, +When the GNAT Ada compiler and OpenAPI Ada libraries are installed, run the following command: ```shell diff --git a/modules/openapi-generator/src/main/resources/Ada/client-body.mustache b/modules/openapi-generator/src/main/resources/Ada/client-body.mustache index b13f1af1291..c18fe9cc363 100644 --- a/modules/openapi-generator/src/main/resources/Ada/client-body.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/client-body.mustache @@ -1,6 +1,6 @@ {{>licenseInfo}} pragma Warnings (Off, "*is not referenced"); -with Swagger.Streams; +with {{openApiPackageName}}.Streams; package body {{package}}.Clients is pragma Style_Checks ("-mr"); {{#apiInfo}} @@ -14,23 +14,23 @@ package body {{package}}.Clients is (Client : in out Client_Type{{#hasParams}};{{/hasParams}}{{#allParams}} {{paramName}} : in {{^isFile}}{{^isString}}{{^isPrimitiveType}}{{^isContainer}}{{package}}.Models.{{/isContainer}}{{/isPrimitiveType}}{{/isString}}{{/isFile}}{{dataType}}{{^-last}};{{/-last}}{{/allParams}}{{#returnType}}; Result : out {{.}}{{/returnType}}) is - URI : Swagger.Clients.URI_Type;{{#hasBodyParam}} - Req : Swagger.Clients.Request_Type;{{/hasBodyParam}}{{#hasFormParams}} - Req : Swagger.Clients.Request_Type;{{/hasFormParams}} + URI : {{openApiPackageName}}.Clients.URI_Type;{{#hasBodyParam}} + Req : {{openApiPackageName}}.Clients.Request_Type;{{/hasBodyParam}}{{#hasFormParams}} + Req : {{openApiPackageName}}.Clients.Request_Type;{{/hasFormParams}} {{#returnType}} - Reply : Swagger.Value_Type; + Reply : {{openApiPackageName}}.Value_Type; {{/returnType}} begin {{#hasProduces}} - Client.Set_Accept (({{#produces}}{{#vendorExtensions.x-has-uniq-produces}}1 => {{/vendorExtensions.x-has-uniq-produces}}Swagger.Clients.{{adaMediaType}}{{^-last}}, + Client.Set_Accept (({{#produces}}{{#vendorExtensions.x-has-uniq-produces}}1 => {{/vendorExtensions.x-has-uniq-produces}}{{openApiPackageName}}.Clients.{{adaMediaType}}{{^-last}}, {{/-last}}{{/produces}}));{{/hasProduces}}{{#hasBodyParam}} - Client.Initialize (Req, ({{#hasConsumes}}{{#consumes}}{{#vendorExtensions.x-has-uniq-consumes}}1 => {{/vendorExtensions.x-has-uniq-consumes}}Swagger.Clients.{{adaMediaType}}{{^-last}}, - {{/-last}}{{/consumes}}{{/hasConsumes}}{{^hasConsumes}}1 => Swagger.Clients.APPLICATION_JSON{{/hasConsumes}}));{{#bodyParams}}{{#vendorExtensions.x-is-model-type}} + Client.Initialize (Req, ({{#hasConsumes}}{{#consumes}}{{#vendorExtensions.x-has-uniq-consumes}}1 => {{/vendorExtensions.x-has-uniq-consumes}}{{openApiPackageName}}.Clients.{{adaMediaType}}{{^-last}}, + {{/-last}}{{/consumes}}{{/hasConsumes}}{{^hasConsumes}}1 => {{openApiPackageName}}.Clients.APPLICATION_JSON{{/hasConsumes}}));{{#bodyParams}}{{#vendorExtensions.x-is-model-type}} {{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}} - Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM));{{#formParams}}{{#vendorExtensions.x-is-model-type}} + Client.Initialize (Req, (1 => {{openApiPackageName}}.Clients.APPLICATION_FORM));{{#formParams}}{{#vendorExtensions.x-is-model-type}} {{package}}.Models.Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}} Req.Stream.Write_Entity ("{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{/formParams}}{{/hasFormParams}} {{#queryParams}}{{#isQueryParam}}{{^isPrimitiveType}}{{^isString}}{{^isContainer}}{{^isDateTime}} @@ -40,11 +40,11 @@ package body {{package}}.Clients is URI.Add_Param ("{{baseName}}", {{paramName}});{{/isContainer}}{{#isDateTime}} URI.Add_Param ("{{baseName}}", {{paramName}});{{/isDateTime}}{{/isQueryParam}}{{/queryParams}} URI.Set_Path ("{{path}}");{{#pathParams}} - URI.Set_Path_Param ("{{baseName}}", {{^isString}}Swagger.To_String ({{/isString}}{{paramName}}{{^isString}}){{/isString}});{{/pathParams}} - Client.Call (Swagger.Clients.{{httpMethod}}, URI{{#hasBodyParam}}, Req{{/hasBodyParam}}{{#hasFormParams}}, Req{{/hasFormParams}}{{#returnType}}, Reply{{/returnType}}); + URI.Set_Path_Param ("{{baseName}}", {{^isString}}{{openApiPackageName}}.To_String ({{/isString}}{{paramName}}{{^isString}}){{/isString}});{{/pathParams}} + Client.Call ({{openApiPackageName}}.Clients.{{httpMethod}}, URI{{#hasBodyParam}}, Req{{/hasBodyParam}}{{#hasFormParams}}, Req{{/hasFormParams}}{{#returnType}}, Reply{{/returnType}}); {{#returnType}} {{^vendorExtensions.x-is-model-type}} - Swagger.Streams.Deserialize (Reply, "", Result); + {{openApiPackageName}}.Streams.Deserialize (Reply, "", Result); {{/vendorExtensions.x-is-model-type}} {{#vendorExtensions.x-is-model-type}} {{package}}.Models.Deserialize (Reply, "", Result); diff --git a/modules/openapi-generator/src/main/resources/Ada/client-spec.mustache b/modules/openapi-generator/src/main/resources/Ada/client-spec.mustache index 134218b105e..a0ef72eb3dd 100644 --- a/modules/openapi-generator/src/main/resources/Ada/client-spec.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/client-spec.mustache @@ -2,11 +2,11 @@ {{#imports}}with {{import}}; {{/imports}} with {{package}}.Models; -with Swagger.Clients; +with {{openApiPackageName}}.Clients; package {{package}}.Clients is pragma Style_Checks ("-mr"); - type Client_Type is new Swagger.Clients.Client_Type with null record; + type Client_Type is new {{openApiPackageName}}.Clients.Client_Type with null record; {{#apiInfo}} {{#apis}} diff --git a/modules/openapi-generator/src/main/resources/Ada/client.mustache b/modules/openapi-generator/src/main/resources/Ada/client.mustache index 501bad4ec7c..829c0cb9618 100644 --- a/modules/openapi-generator/src/main/resources/Ada/client.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/client.mustache @@ -1,7 +1,7 @@ with {{package}}.Clients; with {{package}}.Models; -with Swagger; -with Util.Http.Clients.Curl; +with {{openApiPackageName}}; +with Util.Http.Clients.{{httpClientPackageName}}; with Ada.Text_IO; with Ada.Command_Line; with Ada.Calendar.Formatting; @@ -12,7 +12,7 @@ procedure {{package}}.Client is procedure Usage; - Server : constant Swagger.UString := Swagger.To_UString ("http://localhost:8080/v2"); + Server : constant {{openApiPackageName}}.UString := {{openApiPackageName}}.To_UString ("http://localhost:8080/v2"); Arg_Count : constant Natural := Ada.Command_Line.Argument_Count; Arg : Positive := 1; @@ -26,7 +26,7 @@ begin Usage; return; end if; - Util.Http.Clients.Curl.Register; + Util.Http.Clients.{{httpClientPackageName}}.Register; declare Command : constant String := Ada.Command_Line.Argument (Arg); Item : constant String := Ada.Command_Line.Argument (Arg + 1); diff --git a/modules/openapi-generator/src/main/resources/Ada/config.gpr b/modules/openapi-generator/src/main/resources/Ada/config.gpr index e46b6311ef5..0567eb7cb9f 100644 --- a/modules/openapi-generator/src/main/resources/Ada/config.gpr +++ b/modules/openapi-generator/src/main/resources/Ada/config.gpr @@ -11,12 +11,7 @@ abstract project Config is Processors := External ("PROCESSORS", "1"); package Builder is - case Mode is - when "debug" => - for Default_Switches ("Ada") use ("-g", "-j" & Processors); - when others => - for Default_Switches ("Ada") use ("-g", "-O2", "-j" & Processors); - end case; + for Default_Switches ("Ada") use ("-j" & Processors); end Builder; package compiler is @@ -24,20 +19,20 @@ abstract project Config is defaults := ("-gnat2012"); case Mode is when "distrib" => - for Default_Switches ("Ada") use defaults & ("-gnatafno", "-gnatVa", "-gnatwa"); + for Default_Switches ("Ada") use defaults & ("-O2", "-gnatafno", "-gnatVa", "-gnatwa"); when "debug" => for Default_Switches ("Ada") use defaults & warnings - & ("-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127"); + & ("-g", "-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127"); when "coverage" => for Default_Switches ("Ada") use defaults & warnings - & ("-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127", + & ("-g", "-O2", "-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127", "-fprofile-arcs", "-ftest-coverage"); when "optimize" => for Default_Switches ("Ada") use defaults & warnings - & ("-gnatn", "-gnatp", "-fdata-sections", "-ffunction-sections"); + & ("-O2", "-gnatn", "-gnatp", "-fdata-sections", "-ffunction-sections"); when "profile" => for Default_Switches ("Ada") use defaults & warnings & ("-pg"); diff --git a/modules/openapi-generator/src/main/resources/Ada/model-body.mustache b/modules/openapi-generator/src/main/resources/Ada/model-body.mustache index fafae8dbf8a..5c61d14ef8b 100644 --- a/modules/openapi-generator/src/main/resources/Ada/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/model-body.mustache @@ -5,23 +5,24 @@ package body {{package}}.Models is pragma Warnings (Off, "*use clause for package*"); - use Swagger.Streams; + use {{openApiPackageName}}.Streams; {{#orderedModels}} {{#model}}{{^isArray}} - procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; + procedure Serialize (Into : in out {{openApiPackageName}}.Streams.Output_Stream'Class; Name : in String; Value : in {{classname}}) is begin Into.Start_Entity (Name);{{#vars}}{{#vendorExtensions.x-is-stream-type}}{{^isLong}} - Into.Write_Entity ("{{baseName}}", Value.{{name}});{{/isLong}}{{#isLong}} - Into.Write_Long_Entity ("{{baseName}}", Value.{{name}});{{/isLong}}{{/vendorExtensions.x-is-stream-type}}{{^vendorExtensions.x-is-stream-type}} + Into.Write_Entity ("{{baseName}}", Value.{{name}});{{/isLong}}{{#isLong}}{{#vendorExtensions.x-is-required}} + Into.Write_Long_Entity ("{{baseName}}", Value.{{name}});{{/vendorExtensions.x-is-required}}{{^vendorExtensions.x-is-required}} + Into.Write_Entity ("{{baseName}}", Value.{{name}});{{/vendorExtensions.x-is-required}}{{/isLong}}{{/vendorExtensions.x-is-stream-type}}{{^vendorExtensions.x-is-stream-type}} Serialize (Into, "{{baseName}}", Value.{{name}});{{/vendorExtensions.x-is-stream-type}}{{/vars}} Into.End_Entity (Name); end Serialize; - procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; + procedure Serialize (Into : in out {{openApiPackageName}}.Streams.Output_Stream'Class; Name : in String; Value : in {{classname}}_Vectors.Vector) is begin @@ -32,24 +33,24 @@ package body {{package}}.Models is Into.End_Array (Name); end Serialize; - procedure Deserialize (From : in Swagger.Value_Type; + procedure Deserialize (From : in {{openApiPackageName}}.Value_Type; Name : in String; Value : out {{classname}}) is - Object : Swagger.Value_Type; + Object : {{openApiPackageName}}.Value_Type; begin - Swagger.Streams.Deserialize (From, Name, Object);{{#vars}}{{#vendorExtensions.x-is-model-type}} + {{openApiPackageName}}.Streams.Deserialize (From, Name, Object);{{#vars}}{{#vendorExtensions.x-is-model-type}} Deserialize (Object, "{{baseName}}", Value.{{name}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}} - Swagger.Streams.Deserialize (Object, "{{baseName}}", Value.{{name}});{{/vendorExtensions.x-is-model-type}}{{/vars}} + {{openApiPackageName}}.Streams.Deserialize (Object, "{{baseName}}", Value.{{name}});{{/vendorExtensions.x-is-model-type}}{{/vars}} end Deserialize; - procedure Deserialize (From : in Swagger.Value_Type; + procedure Deserialize (From : in {{openApiPackageName}}.Value_Type; Name : in String; Value : out {{classname}}_Vectors.Vector) is - List : Swagger.Value_Array_Type; + List : {{openApiPackageName}}.Value_Array_Type; Item : {{classname}}; begin Value.Clear; - Swagger.Streams.Deserialize (From, Name, List); + {{openApiPackageName}}.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); diff --git a/modules/openapi-generator/src/main/resources/Ada/model-spec.mustache b/modules/openapi-generator/src/main/resources/Ada/model-spec.mustache index 3852b0767e4..157b77a2f1a 100644 --- a/modules/openapi-generator/src/main/resources/Ada/model-spec.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/model-spec.mustache @@ -1,7 +1,7 @@ {{>licenseInfo}} {{#imports}}with {{import}}; {{/imports}} -with Swagger.Streams; +with {{openApiPackageName}}.Streams; with Ada.Containers.Vectors; package {{package}}.Models is pragma Style_Checks ("-mr"); @@ -22,19 +22,19 @@ package {{package}}.Models is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => {{classname}}); - procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; + procedure Serialize (Into : in out {{openApiPackageName}}.Streams.Output_Stream'Class; Name : in String; Value : in {{classname}}); - procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; + procedure Serialize (Into : in out {{openApiPackageName}}.Streams.Output_Stream'Class; Name : in String; Value : in {{classname}}_Vectors.Vector); - procedure Deserialize (From : in Swagger.Value_Type; + procedure Deserialize (From : in {{openApiPackageName}}.Value_Type; Name : in String; Value : out {{classname}}); - procedure Deserialize (From : in Swagger.Value_Type; + procedure Deserialize (From : in {{openApiPackageName}}.Value_Type; Name : in String; Value : out {{classname}}_Vectors.Vector); diff --git a/modules/openapi-generator/src/main/resources/Ada/server-body.mustache b/modules/openapi-generator/src/main/resources/Ada/server-body.mustache index 65225bef140..5c44f9a122d 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server-body.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server-body.mustache @@ -24,7 +24,7 @@ package body {{package}}.Servers is {{#allParams}}{{paramName}} : in {{dataType}}{{^-last}}; {{/-last}}{{/allParams}}{{#returnType}}; Result : out {{.}}{{/returnType}}; - Context : in out Swagger.Servers.Context_Type) is + Context : in out {{openApiPackageName}.Servers.Context_Type) is begin null; end {{operationId}}; diff --git a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache index 570508ab7fb..5b01ad22df2 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache @@ -1,12 +1,12 @@ {{>licenseInfo}} pragma Warnings (Off, "*is not referenced"); -with Swagger.Streams; -with Swagger.Servers.Operation; +with {{openApiPackageName}}.Streams; +with {{openApiPackageName}}.Servers.Operation; package body {{package}}.Skeletons is pragma Style_Checks ("-mr"); pragma Warnings (Off, "*use clause for package*"); - use Swagger.Streams; + use {{openApiPackageName}}.Streams; package body Skeleton is @@ -16,18 +16,19 @@ package body {{package}}.Skeletons is {{#operation}} package API_{{operationId}} is - new Swagger.Servers.Operation (Handler => {{operationId}}, - Method => Swagger.Servers.{{httpMethod}}, - URI => URI_Prefix & "{{path}}"); + new {{openApiPackageName}}.Servers.Operation + (Handler => {{operationId}}, + Method => {{openApiPackageName}}.Servers.{{httpMethod}}, + URI => URI_Prefix & "{{path}}"); -- {{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) is + (Req : in out {{openApiPackageName}}.Servers.Request'Class; + Reply : in out {{openApiPackageName}}.Servers.Response'Class; + Stream : in out {{openApiPackageName}}.Servers.Output_Stream'Class; + Context : in out {{openApiPackageName}}.Servers.Context_Type) is {{#hasBodyParam}} - Input : Swagger.Value_Type; + Input : {{openApiPackageName}}.Value_Type; {{/hasBodyParam}} Impl : Implementation_Type; {{#allParams}} @@ -50,19 +51,19 @@ package body {{package}}.Skeletons is {{/scopes}} {{/vendorExtensions.x-auth-scopes}} {{#queryParams}} - Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}}); + {{openApiPackageName}}.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}}); {{/queryParams}} {{#pathParams}} - Swagger.Servers.Get_Path_Parameter (Req, {{vendorExtensions.x-path-index}}, {{paramName}}); + {{openApiPackageName}}.Servers.Get_Path_Parameter (Req, {{vendorExtensions.x-path-index}}, {{paramName}}); {{/pathParams}} {{#hasFormParams}} {{#formParams}} - Swagger.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}}); + {{openApiPackageName}}.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}}); {{/formParams}} {{/hasFormParams}} {{#hasParams}} {{#hasBodyParam}} - Swagger.Servers.Read (Req, Input); + {{openApiPackageName}}.Servers.Read (Req, Input); {{#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}} @@ -84,8 +85,8 @@ package body {{package}}.Skeletons is {{#returnType}} if Context.Get_Status = 200 then Stream.Start_Document;{{#vendorExtensions.x-codegen-response.isString}} - Swagger.Streams.Serialize (Stream, "", Result);{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}{{#returnTypeIsPrimitive}} - Swagger.Streams.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}} + {{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}{{#returnTypeIsPrimitive}} + {{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}} {{package}}.Models.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{/vendorExtensions.x-codegen-response.isString}} Stream.End_Document; end if;{{/returnType}} @@ -95,13 +96,13 @@ package body {{package}}.Skeletons is {{/apis}} {{/apiInfo}} - procedure Register (Server : in out Swagger.Servers.Application_Type'Class) is + procedure Register (Server : in out {{openApiPackageName}}.Servers.Application_Type'Class) is begin {{#apiInfo}} {{#apis}} {{#operations}} {{#operation}} - Swagger.Servers.Register (Server, API_{{operationId}}.Definition); + {{openApiPackageName}}.Servers.Register (Server, API_{{operationId}}.Definition); {{/operation}} {{/operations}} {{/apis}} @@ -119,12 +120,12 @@ package body {{package}}.Skeletons is -- {{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) is + (Req : in out {{openApiPackageName}}.Servers.Request'Class; + Reply : in out {{openApiPackageName}}.Servers.Response'Class; + Stream : in out {{openApiPackageName}}.Servers.Output_Stream'Class; + Context : in out {{openApiPackageName}}.Servers.Context_Type) is {{#hasBodyParam}} - Input : Swagger.Value_Type; + Input : {{openApiPackageName}}.Value_Type; {{/hasBodyParam}} {{#allParams}} {{paramName}} : {{dataType}}; @@ -146,19 +147,19 @@ package body {{package}}.Skeletons is {{/scopes}} {{/vendorExtensions.x-auth-scopes}} {{#queryParams}} - Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}}); + {{openApiPackageName}}.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}}); {{/queryParams}} {{#pathParams}} - Swagger.Servers.Get_Path_Parameter (Req, {{vendorExtensions.x-path-index}}, {{paramName}}); + {{openApiPackageName}}.Servers.Get_Path_Parameter (Req, {{vendorExtensions.x-path-index}}, {{paramName}}); {{/pathParams}} {{#hasFormParams}} {{#formParams}} - Swagger.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}}); + {{openApiPackageName}}.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}}); {{/formParams}} {{/hasFormParams}} {{#hasParams}} {{#hasBodyParam}} - Swagger.Servers.Read (Req, Input); + {{openApiPackageName}}.Servers.Read (Req, Input); {{#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}} @@ -180,29 +181,30 @@ package body {{package}}.Skeletons is {{#returnType}} if Context.Get_Status = 200 then Stream.Start_Document;{{#vendorExtensions.x-codegen-response.isString}} - Swagger.Streams.Serialize (Stream, "", Result);{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}{{#returnTypeIsPrimitive}} - Swagger.Streams.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}} + {{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}{{#returnTypeIsPrimitive}} + {{openApiPackageName}}.Streams.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}} {{package}}.Models.Serialize (Stream, "", Result);{{/returnTypeIsPrimitive}}{{/vendorExtensions.x-codegen-response.isString}} Stream.End_Document; end if;{{/returnType}} end {{operationId}}; package API_{{operationId}} is - new Swagger.Servers.Operation (Handler => {{operationId}}, - Method => Swagger.Servers.{{httpMethod}}, - URI => URI_Prefix & "{{path}}"); + new {{openApiPackageName}}.Servers.Operation + (Handler => {{operationId}}, + Method => {{openApiPackageName}}.Servers.{{httpMethod}}, + URI => URI_Prefix & "{{path}}"); {{/operation}} {{/operations}} {{/apis}} {{/apiInfo}} - procedure Register (Server : in out Swagger.Servers.Application_Type'Class) is + procedure Register (Server : in out {{openApiPackageName}}.Servers.Application_Type'Class) is begin {{#apiInfo}} {{#apis}} {{#operations}} {{#operation}} - Swagger.Servers.Register (Server, API_{{operationId}}.Definition); + {{openApiPackageName}}.Servers.Register (Server, API_{{operationId}}.Definition); {{/operation}} {{/operations}} {{/apis}} @@ -220,7 +222,7 @@ package body {{package}}.Skeletons is ({{#allParams}}{{paramName}} : in {{dataType}}{{^-last}}; {{/-last}}{{/allParams}}{{#returnType}}; Result : out {{.}}{{/returnType}}; - Context : in out Swagger.Servers.Context_Type) is + Context : in out {{openApiPackageName}}.Servers.Context_Type) is begin Impl.{{operationId}} ({{#allParams}}{{paramName}}{{^-last}}, @@ -232,13 +234,13 @@ package body {{package}}.Skeletons is {{^hasParams}} {{#returnType}} procedure {{operationId}} (Result : out {{returnType}}; - Context : in out Swagger.Servers.Context_Type) is + Context : in out {{openApiPackageName}}.Servers.Context_Type) is begin Impl.{{operationId}} (Result, Context); end {{operationId}}; {{/returnType}} {{^returnType}} - procedure {{operationId}} (Context : in out Swagger.Servers.Context_Type) is + procedure {{operationId}} (Context : in out {{openApiPackageName}}.Servers.Context_Type) is begin Impl.{{operationId}} (Context); end {{operationId}}; diff --git a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache index 4365261e543..27394c2c58f 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache @@ -3,7 +3,7 @@ {{/imports}} pragma Warnings (Off, "*is not referenced"); pragma Warnings (Off, "*no entities of*are referenced"); -with Swagger.Servers; +with {{openApiPackageName}}.Servers; with {{package}}.Models; with Security.Permissions; package {{package}}.Skeletons is @@ -28,7 +28,7 @@ package {{package}}.Skeletons is {{#allParams}}{{paramName}} : in {{dataType}}{{^-last}}; {{/-last}}{{/allParams}}{{#returnType}}; Result : out {{.}}{{/returnType}}; - Context : in out Swagger.Servers.Context_Type) is abstract; + Context : in out {{openApiPackageName}}.Servers.Context_Type) is abstract; {{/operation}} {{/operations}} {{/apis}} @@ -39,7 +39,7 @@ package {{package}}.Skeletons is URI_Prefix : String := ""; package Skeleton is - procedure Register (Server : in out Swagger.Servers.Application_Type'Class); + procedure Register (Server : in out {{openApiPackageName}}.Servers.Application_Type'Class); {{#apiInfo}} {{#apis}} @@ -48,10 +48,10 @@ package {{package}}.Skeletons is -- {{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); + (Req : in out {{openApiPackageName}}.Servers.Request'Class; + Reply : in out {{openApiPackageName}}.Servers.Response'Class; + Stream : in out {{openApiPackageName}}.Servers.Output_Stream'Class; + Context : in out {{openApiPackageName}}.Servers.Context_Type); {{/operation}} {{/operations}} @@ -64,7 +64,7 @@ package {{package}}.Skeletons is URI_Prefix : String := ""; package Shared_Instance is - procedure Register (Server : in out Swagger.Servers.Application_Type'Class); + procedure Register (Server : in out {{openApiPackageName}}.Servers.Application_Type'Class); {{#apiInfo}} {{#apis}} @@ -73,10 +73,10 @@ package {{package}}.Skeletons is -- {{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); + (Req : in out {{openApiPackageName}}.Servers.Request'Class; + Reply : in out {{openApiPackageName}}.Servers.Response'Class; + Stream : in out {{openApiPackageName}}.Servers.Output_Stream'Class; + Context : in out {{openApiPackageName}}.Servers.Context_Type); {{/operation}} {{/operations}} @@ -96,16 +96,16 @@ package {{package}}.Skeletons is ({{#allParams}}{{paramName}} : in {{dataType}}{{^-last}}; {{/-last}}{{/allParams}}{{#returnType}}; Result : out {{.}}{{/returnType}}; - Context : in out Swagger.Servers.Context_Type); + Context : in out {{openApiPackageName}}.Servers.Context_Type); {{/hasParams}} {{^hasParams}} {{#returnType}} procedure {{operationId}} (Result : out {{returnType}}; - Context : in out Swagger.Servers.Context_Type); + Context : in out {{openApiPackageName}}.Servers.Context_Type); {{/returnType}} {{^returnType}} - procedure {{operationId}} (Context : in out Swagger.Servers.Context_Type); + procedure {{operationId}} (Context : in out {{openApiPackageName}}.Servers.Context_Type); {{/returnType}} {{/hasParams}} diff --git a/modules/openapi-generator/src/main/resources/Ada/server-spec.mustache b/modules/openapi-generator/src/main/resources/Ada/server-spec.mustache index 4abfb7d4e4f..cf4e223c116 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server-spec.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server-spec.mustache @@ -11,7 +11,7 @@ -- ------------ EDIT NOTE ------------ {{#imports}}with {{import}}; {{/imports}} -with Swagger.Servers; +with {{openApiPackageName}.Servers; with {{package}}.Models; with {{package}}.Skeletons; package {{package}}.Servers is @@ -32,7 +32,7 @@ package {{package}}.Servers is {{#allParams}}{{paramName}} : in {{dataType}}{{^-last}}; {{/-last}}{{/allParams}}{{#returnType}}; Result : out {{.}}{{/returnType}}; - Context : in out Swagger.Servers.Context_Type); + Context : in out {{openApiPackageName}.Servers.Context_Type); {{/operation}} {{/operations}} {{/apis}} diff --git a/modules/openapi-generator/src/main/resources/Ada/server.mustache b/modules/openapi-generator/src/main/resources/Ada/server.mustache index f0a0fd00885..14afdf65adb 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server.mustache @@ -1,7 +1,7 @@ with Ada.IO_Exceptions; with AWS.Config.Set; -with Swagger.Servers.AWS; -with Swagger.Servers.Applications; +with {{openApiPackageName}}.Servers.AWS; +with {{openApiPackageName}}.Servers.Applications; with Util.Strings; with Util.Log.Loggers; with Util.Properties; @@ -22,8 +22,8 @@ procedure {{package}}.Server is AWS.Config.Set.Accept_Queue_Size (Config, 512); end Configure; - App : aliased Swagger.Servers.Applications.Application_Type; - WS : Swagger.Servers.AWS.AWS_Container; + App : aliased {{openApiPackageName}}.Servers.Applications.Application_Type; + WS : {{openApiPackageName}}.Servers.AWS.AWS_Container; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("{{package}}.Server"); Props : Util.Properties.Manager; begin diff --git a/samples/client/petstore/ada/.openapi-generator/VERSION b/samples/client/petstore/ada/.openapi-generator/VERSION index d99e7162d01..5f68295fc19 100644 --- a/samples/client/petstore/ada/.openapi-generator/VERSION +++ b/samples/client/petstore/ada/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +6.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/ada/config.gpr b/samples/client/petstore/ada/config.gpr index e2f60ea1b6a..0567eb7cb9f 100644 --- a/samples/client/petstore/ada/config.gpr +++ b/samples/client/petstore/ada/config.gpr @@ -3,21 +3,15 @@ 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" => - for Default_Switches ("Ada") use ("-g", "-j" & Processors); - when others => - for Default_Switches ("Ada") use ("-g", "-O2", "-j" & Processors); - end case; + for Default_Switches ("Ada") use ("-j" & Processors); end Builder; package compiler is @@ -25,25 +19,24 @@ abstract project Config is defaults := ("-gnat2012"); case Mode is when "distrib" => - for Default_Switches ("Ada") use defaults & ("-gnatafno", "-gnatVa", "-gnatwa"); + for Default_Switches ("Ada") use defaults & ("-O2", "-gnatafno", "-gnatVa", "-gnatwa"); when "debug" => for Default_Switches ("Ada") use defaults & warnings - & ("-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM99"); + & ("-g", "-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127"); + + when "coverage" => + for Default_Switches ("Ada") use defaults & warnings + & ("-g", "-O2", "-gnata", "-gnatVaMI", "-gnaty3abcefhiklmnprstxM127", + "-fprofile-arcs", "-ftest-coverage"); when "optimize" => for Default_Switches ("Ada") use defaults & warnings - & ("-gnatn", "-gnatp", "-fdata-sections", "-ffunction-sections"); + & ("-O2", "-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; @@ -69,18 +62,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; diff --git a/samples/client/petstore/ada/src/client/samples-petstore-clients.adb b/samples/client/petstore/ada/src/client/samples-petstore-clients.adb index 9191b01ec64..d550af7bbe5 100644 --- a/samples/client/petstore/ada/src/client/samples-petstore-clients.adb +++ b/samples/client/petstore/ada/src/client/samples-petstore-clients.adb @@ -2,14 +2,16 @@ -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- -- The version of the OpenAPI document: 1.0.0 --- -- --- NOTE: This package is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. +-- +-- NOTE: This package is auto generated by OpenAPI-Generator 6.0.0-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. +pragma Warnings (Off, "*is not referenced"); with Swagger.Streams; package body Samples.Petstore.Clients is + pragma Style_Checks ("-mr"); -- Add a new pet to the store procedure Add_Pet diff --git a/samples/client/petstore/ada/src/client/samples-petstore-clients.ads b/samples/client/petstore/ada/src/client/samples-petstore-clients.ads index 912ab276627..ec06fd09d56 100644 --- a/samples/client/petstore/ada/src/client/samples-petstore-clients.ads +++ b/samples/client/petstore/ada/src/client/samples-petstore-clients.ads @@ -2,15 +2,16 @@ -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- -- The version of the OpenAPI document: 1.0.0 --- -- --- NOTE: This package is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. +-- +-- NOTE: This package is auto generated by OpenAPI-Generator 6.0.0-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. with Samples.Petstore.Models; with Swagger.Clients; package Samples.Petstore.Clients is + pragma Style_Checks ("-mr"); type Client_Type is new Swagger.Clients.Client_Type with null record; diff --git a/samples/client/petstore/ada/src/model/samples-petstore-models.adb b/samples/client/petstore/ada/src/model/samples-petstore-models.adb index 76f4071a12e..573683fae90 100644 --- a/samples/client/petstore/ada/src/model/samples-petstore-models.adb +++ b/samples/client/petstore/ada/src/model/samples-petstore-models.adb @@ -2,14 +2,17 @@ -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- -- The version of the OpenAPI document: 1.0.0 --- -- --- NOTE: This package is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. +-- +-- NOTE: This package is auto generated by OpenAPI-Generator 6.0.0-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. package body Samples.Petstore.Models is + pragma Style_Checks ("-mr"); + + pragma Warnings (Off, "*use clause for package*"); use Swagger.Streams; @@ -70,7 +73,7 @@ package body Samples.Petstore.Models is Value : in Tag_Type) is begin Into.Start_Entity (Name); - Into.Write_Long_Entity ("id", Value.Id); + Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("name", Value.Name); Into.End_Entity (Name); end Serialize; @@ -118,7 +121,7 @@ package body Samples.Petstore.Models is Value : in Category_Type) is begin Into.Start_Entity (Name); - Into.Write_Long_Entity ("id", Value.Id); + Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("name", Value.Name); Into.End_Entity (Name); end Serialize; @@ -166,7 +169,7 @@ package body Samples.Petstore.Models is Value : in Pet_Type) is begin Into.Start_Entity (Name); - Into.Write_Long_Entity ("id", Value.Id); + Into.Write_Entity ("id", Value.Id); Serialize (Into, "category", Value.Category); Into.Write_Entity ("name", Value.Name); Serialize (Into, "photoUrls", Value.Photo_Urls); @@ -222,8 +225,8 @@ package body Samples.Petstore.Models is Value : in Order_Type) is begin Into.Start_Entity (Name); - Into.Write_Long_Entity ("id", Value.Id); - Into.Write_Long_Entity ("petId", Value.Pet_Id); + Into.Write_Entity ("id", Value.Id); + Into.Write_Entity ("petId", Value.Pet_Id); Into.Write_Entity ("quantity", Value.Quantity); Into.Write_Entity ("shipDate", Value.Ship_Date); Into.Write_Entity ("status", Value.Status); @@ -278,7 +281,7 @@ package body Samples.Petstore.Models is Value : in User_Type) is begin Into.Start_Entity (Name); - Into.Write_Long_Entity ("id", Value.Id); + Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("username", Value.Username); Into.Write_Entity ("firstName", Value.First_Name); Into.Write_Entity ("lastName", Value.Last_Name); diff --git a/samples/client/petstore/ada/src/model/samples-petstore-models.ads b/samples/client/petstore/ada/src/model/samples-petstore-models.ads index fc0e70cd997..b4e34fff4fa 100644 --- a/samples/client/petstore/ada/src/model/samples-petstore-models.ads +++ b/samples/client/petstore/ada/src/model/samples-petstore-models.ads @@ -2,15 +2,16 @@ -- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters. -- -- The version of the OpenAPI document: 1.0.0 --- -- --- NOTE: This package is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT. +-- +-- NOTE: This package is auto generated by OpenAPI-Generator 6.0.0-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package Samples.Petstore.Models is + pragma Style_Checks ("-mr"); -- ------------------------------