diff --git a/HarmonyCore.sln b/HarmonyCore.sln index ceb6ee37..7d111a7b 100644 --- a/HarmonyCore.sln +++ b/HarmonyCore.sln @@ -38,6 +38,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Templates", "Templates", "{ Templates\ODataUnitTestEnvironment.tpl = Templates\ODataUnitTestEnvironment.tpl Templates\ODataUnitTestHost.tpl = Templates\ODataUnitTestHost.tpl Templates\ODataUnitTests.tpl = Templates\ODataUnitTests.tpl + Templates\PostManDevelopmentEnvironment.tpl = Templates\PostManDevelopmentEnvironment.tpl EndProjectSection EndProject Project("{BBD0F5D1-1CC4-42FD-BA4C-A96779C64378}") = "Services", "Services\Services.synproj", "{24A1BBFD-2660-41E1-A4FC-90B7A13A4911}" @@ -59,18 +60,18 @@ Project("{BBD0F5D1-1CC4-42FD-BA4C-A96779C64378}") = "Services.Test", "Services.T EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleData", "SampleData", "{9977F09E-C08B-4E4C-900A-B06D532469AF}" ProjectSection(SolutionItems) = preProject - SampleData\customer_notes.txt = SampleData\customer_notes.txt - SampleData\customer_notes.xdl = SampleData\customer_notes.xdl SampleData\customers.txt = SampleData\customers.txt Services.Controllers\SampleData\customers.xdl = Services.Controllers\SampleData\customers.xdl + SampleData\customer_notes.txt = SampleData\customer_notes.txt + SampleData\customer_notes.xdl = SampleData\customer_notes.xdl SampleData\items.txt = SampleData\items.txt SampleData\items.xdl = SampleData\items.xdl + SampleData\orders.txt = SampleData\orders.txt + Services.Test\SampleData\orders.xdl = Services.Test\SampleData\orders.xdl SampleData\order_items.txt = SampleData\order_items.txt SampleData\order_items.xdl = SampleData\order_items.xdl SampleData\order_items_overlay.txt = SampleData\order_items_overlay.txt SampleData\order_items_overlay.xdl = SampleData\order_items_overlay.xdl - SampleData\orders.txt = SampleData\orders.txt - Services.Test\SampleData\orders.xdl = Services.Test\SampleData\orders.xdl SampleData\sysparams.txt = SampleData\sysparams.txt SampleData\test.txt = SampleData\test.txt SampleData\test.xdl = SampleData\test.xdl @@ -84,6 +85,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TraditionalBridge", "Tradit Templates\TraditionalBridge\InterfaceController.tpl = Templates\TraditionalBridge\InterfaceController.tpl Templates\TraditionalBridge\InterfaceDispatcher.tpl = Templates\TraditionalBridge\InterfaceDispatcher.tpl Templates\TraditionalBridge\InterfaceDispatcherCustom.tpl = Templates\TraditionalBridge\InterfaceDispatcherCustom.tpl + Templates\TraditionalBridge\InterfaceDispatcherData.tpl = Templates\TraditionalBridge\InterfaceDispatcherData.tpl + Templates\TraditionalBridge\InterfaceDocumentation.tpl = Templates\TraditionalBridge\InterfaceDocumentation.tpl Templates\TraditionalBridge\InterfaceMethodDispatchers.tpl = Templates\TraditionalBridge\InterfaceMethodDispatchers.tpl Templates\TraditionalBridge\InterfacePostmanTests.tpl = Templates\TraditionalBridge\InterfacePostmanTests.tpl Templates\TraditionalBridge\InterfaceService.tpl = Templates\TraditionalBridge\InterfaceService.tpl @@ -177,6 +180,13 @@ Project("{BBD0F5D1-1CC4-42FD-BA4C-A96779C64378}") = "TraditionalBridge.UnitTest" EndProject Project("{BBD0F5D1-1CC4-42FD-BA4C-A96779C64378}") = "Services.Test.GenerateValues", "Services.Test.GenerateValues\Services.Test.GenerateValues.synproj", "{518FA7FA-9BCD-420B-A7F5-1F02AA5DF595}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TypeScript", "TypeScript", "{37E2756D-C2CE-4E7F-9433-8D638412FE91}" + ProjectSection(SolutionItems) = preProject + Templates\TypeScript\TypeScriptInterfaceClient.tpl = Templates\TypeScript\TypeScriptInterfaceClient.tpl + Templates\TypeScript\TypeScriptInterfaceMethods.tpl = Templates\TypeScript\TypeScriptInterfaceMethods.tpl + Templates\TypeScript\TypeScriptInterfaceStructures.tpl = Templates\TypeScript\TypeScriptInterfaceStructures.tpl + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -687,6 +697,7 @@ Global {0C03E3B8-3A2D-4BE1-BB14-1D09B4FA1C82} = {23E9E063-53D3-4618-BD7A-FAFB67256B61} {45C17364-7208-4729-B2F2-4866CD62F1BD} = {3A316055-4B0B-442C-9FDB-846494C58E8D} {2D9A8574-2C5A-4D95-AAED-1266845B46ED} = {3A316055-4B0B-442C-9FDB-846494C58E8D} + {37E2756D-C2CE-4E7F-9433-8D638412FE91} = {3A316055-4B0B-442C-9FDB-846494C58E8D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {521EC2DF-FBE1-4295-A090-66B8CB009B0B} diff --git a/Templates/GenerateTestValues.tpl b/Templates/GenerateTestValues.tpl index 39779637..c9dfa9ef 100644 --- a/Templates/GenerateTestValues.tpl +++ b/Templates/GenerateTestValues.tpl @@ -14,9 +14,9 @@ proc new GenerateTestValues().SerializeValues() endmain -namespace Services.Test.GenerateValues +namespace - public class GenerateTestValues + public partial class GenerateTestValues @@ -24,6 +24,16 @@ namespace Services.Test.GenerateValues + + + private mFileSpec, string, "" + + + + partial method GetCustomFileSpec, void + required inout aFileSpec, string + endmethod + public method SerializeValues, void endparams proc @@ -32,15 +42,24 @@ namespace Services.Test.GenerateValues - ;;------------------------------------------------------------ - ;;Test data for - open(chin=0,i:i,"") + ;------------------------------------------------------------ + ;Test data for + + Console.WriteLine("Processing file ") + + ;If there is a GetCustomFileSpec method, call it + GetCustomFileSpec(mFileSpec) + + ;Open the data file + Console.WriteLine(" - Opening " + mFileSpec + "...") + open(chin=0,i:i,mFileSpec) ;// ;// ENABLE_GET_ALL ;// ;Total number of records + Console.WriteLine(" - Counting records...") count = 0 repeat begin @@ -54,6 +73,7 @@ namespace Services.Test.GenerateValues Console.WriteLine("ERROR: Failed to read record from ") exitloop end +;// ;//RELATION LOGIC MISSING ;// @@ -61,6 +81,7 @@ namespace Services.Test.GenerateValues ;// ;Get by primary key + Console.WriteLine(" - Determining parameters for read by primary key...") repeat begin read(chin,,^LAST) [ERR=eof2] @@ -119,10 +140,11 @@ namespace Services.Test.GenerateValues + ;Determine where to create the output file data jsonFilePath = .UnitTestEnvironment.FindRelativeFolderForAssembly("") File.WriteAllText(Path.Combine(jsonFilePath, "TestConstants.Values.json"), JsonSerializer.Serialize(TestConstants.Instance, new JsonSerializerOptions(){ WriteIndented = true })) endmethod endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/MySQL/ODataStartup.tpl b/Templates/MySQL/ODataStartup.tpl index eba9b886..49cf5d58 100644 --- a/Templates/MySQL/ODataStartup.tpl +++ b/Templates/MySQL/ODataStartup.tpl @@ -1,5 +1,5 @@ Startup.dbl -5.4.6 +5.8.5 API_DOCS_PATH API_TITLE MODELS_NAMESPACE @@ -338,7 +338,7 @@ namespace data mvcBuilder = services.AddMvcCore(MvcCoreConfig) & .SetCompatibilityVersion(CompatibilityVersion.Version_2_2 ) & .AddDataAnnotations() ;;Enable data annotations - & .AddNewtonsoftJson(lambda (opts) { opts.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver()}) + & .AddNewtonsoftJson(lambda (opts) { opts.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver() {NamingStrategy = new Newtonsoft.Json.Serialization.CamelCaseNamingStrategy()}}) & .AddApplicationPart(^typeof(IsolatedMethodsBase).Assembly) diff --git a/Templates/ODataClientModel.tpl b/Templates/ODataClientModel.tpl index ba4615a1..eca69420 100644 --- a/Templates/ODataClientModel.tpl +++ b/Templates/ODataClientModel.tpl @@ -1,5 +1,5 @@ .dbl -5.4.6 +5.7.5 TF Models ;//**************************************************************************** @@ -58,7 +58,7 @@ namespace ;;; - ;;; + ;;; ;;; public readwrite property , String @@ -131,7 +131,7 @@ namespace endclass - public class OData + public class ODataSingle {JsonProperty("odata.metadata")} public readwrite property Metadata, string @@ -141,7 +141,7 @@ namespace endclass - public class OData + public class ODataMultiple {JsonProperty("odata.metadata")} public readwrite property Metadata, string diff --git a/Templates/ODataController.tpl b/Templates/ODataController.tpl index 7ed5f3b0..1bfb38b4 100644 --- a/Templates/ODataController.tpl +++ b/Templates/ODataController.tpl @@ -1,5 +1,5 @@ Controller.dbl -5.5.3 +5.7.5 MODELS_NAMESPACE SERVICES_NAMESPACE API_ENABLE_QUERY_PARAMS @@ -134,7 +134,7 @@ namespace ;// GET ONE (ISAM, UNIQUE PRIMARY KEY READ) ----------------------------------- ;// - {HttpGet("(={a}<,>)")} + {HttpGet("(={a})")} {Produces("application/json")} {ProducesResponseType(^typeof(),StatusCodes.Status200OK)} @@ -155,7 +155,7 @@ namespace - ;;; + ;;; @@ -165,17 +165,13 @@ namespace {FromODataUri} - - required in a, string - - required in a, - + required in a, string proc ;//Shouldn't really need the generic type arg on FindQuery. Compiler issue? - mreturn new SingleResult<>(_DbContext..AsNoTracking().FindQuery<>(_DbContext, a.PadRight()<,>)) + mreturn new SingleResult<>(_DbContext..AsNoTracking().FindQuery<>(_DbContext, a.PadRight())) endmethod @@ -183,7 +179,7 @@ namespace ;// GET "ONE" (not in this case!) (ISAM, NON-UNIQUE PRIMARY KEY READ) --------- ;// - {HttpGet("(={a}<,>)")} + {HttpGet("(={a})")} {Produces("application/json")} {ProducesResponseType(^typeof(IEnumerable<>),StatusCodes.Status200OK)} @@ -203,7 +199,7 @@ namespace - ;;; + ;;; @@ -213,17 +209,13 @@ namespace {FromODataUri} - - required in a, string - - required in a, - + required in a, string proc ;//Shouldn't really need the generic type arg on FindQuery. Compiler issue? - mreturn Ok(_DbContext..AsNoTracking().FindQuery<>(_DbContext, a.PadRight()<,>)) + mreturn Ok(_DbContext..AsNoTracking().FindQuery<>(_DbContext, a.PadRight())) endmethod @@ -265,7 +257,7 @@ namespace ;// - {HttpGet("(={a}<,>)")} + {HttpGet("(={a})")} {Produces("application/json")} {ProducesResponseType(^typeof(IEnumerable<>),StatusCodes.Status200OK)} @@ -289,7 +281,7 @@ namespace ;;; - ;;; + ;;; ;;; Returns an IActionResult indicating the status of the operation and containing any data that was returned. @@ -301,7 +293,7 @@ namespace proc - data result = _DbContext..AsNoTracking().FindAlternate("",a<,>) + data result = _DbContext..AsNoTracking().FindAlternate("",a) if (result == ^null) mreturn NotFound() @@ -316,7 +308,7 @@ namespace - {HttpGet("(={a}<,>)")} + {HttpGet("(={a})")} {Produces("application/json")} {ProducesResponseType(^typeof(IEnumerable<>),StatusCodes.Status200OK)} @@ -336,7 +328,7 @@ namespace ;;; - ;;; + ;;; ;;; Returns an IActionResult indicating the status of the operation and containing any data that was returned. @@ -348,7 +340,7 @@ namespace proc - data result = _DbContext..AsNoTracking().FindAlternate("",a<,>) + data result = _DbContext..AsNoTracking().FindAlternate("",a) if (result == ^null) mreturn NotFound() mreturn Ok(result) @@ -425,7 +417,7 @@ namespace {Authorize(Roles="")} - {HttpPut("(={a}<,>)")} + {HttpPut("(={a})")} {Produces("application/json")} {ProducesResponseType(StatusCodes.Status201Created)} {ProducesResponseType(StatusCodes.Status400BadRequest)} @@ -438,7 +430,7 @@ namespace ;;; - ;;; + ;;; ;;; Returns an IActionResult indicating the status of the operation and containing any data that was returned. @@ -446,11 +438,7 @@ namespace {FromODataUri} - - required in a, string - - required in a, - + required in a, string {FromBody} @@ -459,11 +447,7 @@ namespace ;;Ensure that the key values in the URI win over any data that may be in the model object - - a. = - - a. = a - + a. = a ModelState.Remove("") @@ -475,11 +459,7 @@ namespace ;;Ensure that the key values in the URI win over any data that may be in the model object - - a. = - - a. = a - + a. = a @@ -487,7 +467,7 @@ namespace try begin ;;Add and commit - data existing = _DbContext..Find(a.PadRight()<,>) + data existing = _DbContext..Find(a.PadRight()) if(existing == ^null) then begin _DbContext..Add(a) @@ -531,7 +511,7 @@ namespace {Authorize(Roles="")} - {HttpPatch("(={a}<,>)")} + {HttpPatch("(={a})")} {Produces("application/json")} {ProducesResponseType(StatusCodes.Status204NoContent)} {ProducesResponseType(StatusCodes.Status400BadRequest)} @@ -544,7 +524,7 @@ namespace ;;; - ;;; + ;;; ;;; Returns an IActionResult indicating the status of the operation and containing any data that was returned. @@ -552,11 +532,7 @@ namespace {FromODataUri} - - required in a, string - - required in a, - + required in a, string {FromBody} @@ -570,7 +546,7 @@ namespace try begin ;;Get the to be updated - data ToUpdate = _DbContext..FindQuery<>(a.PadRight()<,>) + data ToUpdate = _DbContext..FindQuery<>(a.PadRight()) data patchError, @JsonPatchError, ^null ;;Did we find it? if(ToUpdate == ^null) @@ -624,7 +600,7 @@ namespace {Authorize(Roles="")} - {HttpDelete("(={a}<,>)")} + {HttpDelete("(={a})")} {ProducesResponseType(StatusCodes.Status204NoContent)} {ProducesResponseType(StatusCodes.Status401Unauthorized)} @@ -635,7 +611,7 @@ namespace ;;; - ;;; + ;;; ;;; Returns an IActionResult indicating the status of the operation and containing any data that was returned. @@ -643,16 +619,12 @@ namespace {FromODataUri} - - required in a, string - - required in a, - + required in a, string proc ;;Get the to be deleted - data ToRemove = _DbContext..FindQuery<>(a.PadRight()<,>) + data ToRemove = _DbContext..FindQuery<>(a.PadRight()) ;;Did we find it? if (ToRemove == ^null) diff --git a/Templates/ODataControllerPropertyEndpoints.tpl b/Templates/ODataControllerPropertyEndpoints.tpl index 7d6e07f4..2cecb43d 100644 --- a/Templates/ODataControllerPropertyEndpoints.tpl +++ b/Templates/ODataControllerPropertyEndpoints.tpl @@ -1,5 +1,5 @@ ControllerPropertyEndpoints.dbl -5.5.2 +5.7.5 ;//**************************************************************************** ;// ;// Title: ODataControllerPropertyEndpoints.tpl @@ -69,7 +69,7 @@ namespace ;// - {HttpGet("({key}={a}<,>)/")} + {HttpGet("({key}={a})/")} {Produces("application/json")} {ProducesResponseType(StatusCodes.Status200OK)} @@ -83,11 +83,11 @@ namespace ;;; Get the property of a single , by primary key. ;;; - ;;; + ;;; - ;;; + ;;; @@ -160,4 +160,4 @@ namespace endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/ODataCustomAuthTools.tpl b/Templates/ODataCustomAuthTools.tpl index 87ff5aee..844651f6 100644 --- a/Templates/ODataCustomAuthTools.tpl +++ b/Templates/ODataCustomAuthTools.tpl @@ -23,14 +23,14 @@ namespace public static method GetIssuer, string proc - ;TODO: Set the name of the "issuer" of the JWT. This is frequently the name of an organization. - mreturn "MyCompany" + ;Set the name of the "issuer" of the JWT. This is frequently the name of an organization. + mreturn "" endmethod public static method GetAudience, string proc - ;TODO: Set the name of the "audience" of the JWT. This is frequently the name of an API or service. - mreturn "MyApi" + ;Set the name of the "audience" of the JWT. This is frequently the name of an API or service. + mreturn "" endmethod public static method GetKey, [#]Byte @@ -114,4 +114,4 @@ namespace endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/ODataEdmBuilder.tpl b/Templates/ODataEdmBuilder.tpl index 68b3cae4..74d9882f 100644 --- a/Templates/ODataEdmBuilder.tpl +++ b/Templates/ODataEdmBuilder.tpl @@ -172,7 +172,7 @@ namespace - tempModel.AddAlternateKeyAnnotation(Type, new Dictionary() {{"",Type.FindProperty("")}<,>}) + tempModel.AddAlternateKeyAnnotation(Type, new Dictionary() {{"",Type.FindProperty("")}}) @@ -180,7 +180,7 @@ namespace - tempModel.AddAlternateKeyAnnotation(Type, new Dictionary() {{"",Type.FindProperty("")}<,>}) + tempModel.AddAlternateKeyAnnotation(Type, new Dictionary() {{"",Type.FindProperty("")}}) @@ -216,4 +216,4 @@ namespace endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/ODataModel.tpl b/Templates/ODataModel.tpl index d6da69ac..65c1453c 100644 --- a/Templates/ODataModel.tpl +++ b/Templates/ODataModel.tpl @@ -1,5 +1,5 @@ .dbl -5.5.4 +5.8.5 ;//**************************************************************************** ;// ;// Title: ODataModel.tpl @@ -115,11 +115,9 @@ namespace - - ;;; - ;;; + ;;; ;;; ;// ;// Field property attributes @@ -128,21 +126,21 @@ namespace {Key} - {Required(ErrorMessage=" is required. ")} + {Required(ErrorMessage=" is required. ")} ;//We can't add validation attributes for fields with custom data types!!! - {StringLength(, ErrorMessage=" cannot exceed characters. ")} + {StringLength(, ErrorMessage=" cannot exceed characters. ")} - {Range(,, ErrorMessage=" must be between and . ")} + {Range(,, ErrorMessage=" must be between and . ")} - {Range(,, ErrorMessage=" must be between and . ")} + {Range(,, ErrorMessage=" must be between and . ")} ;// @@ -163,7 +161,7 @@ namespace public property , String - public property , @Format + public property , ;// ;// Field property get method @@ -172,149 +170,123 @@ namespace proc mreturn Converter.Convert(mSynergyData.) - - + mreturn ()SynergyAlphaConverter.Convert(mSynergyData., ^null, ^null, ^null) - - - + + mreturn %string(mSynergyData.,"XXXX-XX-XX") - - - data String = (string)mSynergyData. - mreturn new Format(int.Parse(String.Substring(0, 24)), int.Parse(String.Substring(24))) - - data formatString = "YYYYMMDD" - - formatString = "YYMMDD" - - formatString = "YYYYJJJ" - - mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, formatString, ^null) - - - - - + + mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, "YYYYMMDD", ^null) + + mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, "YYMMDD", ^null) + + mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, "YYYYJJJ", ^null) + + mreturn %string(mSynergyData.,"XXXX/XX") + + mreturn %string(mSynergyData.,"XX/XX") + + + mreturn %string(mSynergyData.,"XX:XX") - + mreturn Convert.ToDateTime(%string(mSynergyData.,"XX:XX")) - - - - + + + mreturn %string(mSynergyData.,"XX:XX:XX") - + mreturn Convert.ToDateTime(%string(mSynergyData.,"XX:XX:XX")) - - - - - + + + + mreturn %string(SynergyImpliedDecimalConverter.Convert(mSynergyData., ^null, "DECIMALPLACES#", ^null),"") - - mreturn %string(mSynergyData.,"") - - + mreturn %string(mSynergyData.,"") + + + mreturn ()SynergyImpliedDecimalConverter.Convert(mSynergyData., ^null, "DECIMALPLACES#", ^null) - + mreturn ()mSynergyData. - - - - + + + mreturn ()mSynergyData. - - + mreturn ()mSynergyData. - - + mreturn ()mSynergyData. - - + mreturn ()mSynergyData. - - + mreturn (String)mSynergyData. - - + endmethod ;// ;// Field property set method ;// method set proc - - + throw new ApplicationException("Property is read only!") - - + mSynergyData. = Converter.ConvertBack(value) - - + mSynergyData. = ()SynergyAlphaConverter.ConvertBack(value.ToUpper(), ^null, ^null, ^null) - - + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XXXX-XX-XX") - - - mSynergyData. = value.YYYYYY * 100 + value.PP - - data formatString = "YYYYMMDD" - - formatString = "YYMMDD" - - - formatString = "YYYYJJJ" - - mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, formatString, ^null) - - - - + + mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, "YYYYMMDD", ^null) + + mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, "YYMMDD", ^null) + + mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, "YYYYJJJ", ^null) + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XXXX/XX") + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XX/XX") + + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XX:XX") - - + mSynergyData. = (value.Value.Hour * 100) + value.Value.Minute - + mSynergyData. = (value.Hour * 100) + value.Minute - - - - + + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XX:XX:XX") - - + mSynergyData. = (value.Value.Hour * 10000) + (value.Value.Minute * 100) + value.Value.Second - + mSynergyData. = (value.Hour * 10000) + (value.Minute * 100) + value.Second - - - - - + + + + mSynergyData. = SynergyImpliedDecimalConverter.ConvertBack(value,"") - - mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"") - + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"") + + mSynergyData. = value - - + + mSynergyData. = value - + mSynergyData. = value - + mSynergyData. = value - + mSynergyData. = value - - + mSynergyData. = value - - + endmethod ;// ;// End of field property @@ -322,7 +294,6 @@ namespace endproperty - .endregion ;// diff --git a/Templates/ODataPostManTests.tpl b/Templates/ODataPostManTests.tpl index 7a275a28..8008ed95 100644 --- a/Templates/ODataPostManTests.tpl +++ b/Templates/ODataPostManTests.tpl @@ -1,5 +1,5 @@ -PostManTests.postman_collection.json -5.5.3 +PostMan_ODataTests.postman_collection.json +5.7.5 API_TITLE SERVER_BASE_PATH SERVER_HTTPS_PORT @@ -7,80 +7,25 @@ SERVER_PROTOCOL { "info": { - "_postman_id": "", - "name": "", + "_postman_id": "3efc60d1-7fb2-4a4a-a466-2ba6f69ebe7d", + "name": " (OData)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ - - + { "name": "Get Access Token", - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.environment.set(\"JWT\", responseBody);" ], - "body": { - "mode": "raw", - "raw": "{ \"Username\": \"\", \"Password\": \"\"}" - }, - "url": { - "raw": "{{ServerAuthUri}}//", - "protocol": "", - "host": [ - "" - ], - "port": "", - "path": [ - "", - "" - ] - } - }, - "response": [] - }, - - { - "name": "Get Access Token (Jodah)", - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" + "type": "text/javascript" } - ], - "body": { - "mode": "raw", - "raw": "grant_type=password&username=jodah&password=P@ssw0rd&client_id=ro.client&client_secret=CBF7EBE6-D46E-41A7-903B-766A280616C3" - }, - "url": { - "raw": "http://localhost:5000/connect/token", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "5000", - "path": [ - "connect", - "token" - ] } - }, - "response": [] - }, - { - "name": "Get Access Token (Manny)", + ], "request": { "auth": { "type": "noauth" @@ -89,40 +34,31 @@ "header": [ { "key": "Content-Type", - "value": "application/x-www-form-urlencoded" + "value": "application/json" } ], "body": { "mode": "raw", - "raw": "grant_type=password&username=manny&password=P@ssw0rd&client_id=ro.client&client_secret=CBF7EBE6-D46E-41A7-903B-766A280616C3" + "raw": "" }, "url": { - "raw": "http://localhost:5000/connect/token", - "protocol": "http", + "raw": "{{ServerAuthUri}}", "host": [ - "localhost" - ], - "port": "5000", - "path": [ - "connect", - "token" + "{{ServerAuthUri}}" ] } }, "response": [] }, - - + { - "_postman_id": "", "name": " Tests", "item": [ { - "_postman_id": "", "name": "Read ", "request": { "method": "GET", @@ -137,17 +73,21 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/?$top=3", "host": [ "{{ServerBaseUri}}" ], "path": [ + "{{ODataPath}}", + "v{{ApiVersion}}", "" + ], + "query": [ + { + "key": "$top", + "value": "3" + } ] } }, @@ -160,7 +100,6 @@ , { - "_postman_id": "", "name": "Count ", "request": { "method": "GET", @@ -175,16 +114,14 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}//$count", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}//$count", "host": [ "{{ServerBaseUri}}" ], "path": [ + "{{ODataPath}}", + "v{{ApiVersion}}", "", "$count" ] @@ -199,7 +136,6 @@ , { - "_postman_id": "", "name": "Read ", "request": { "method": "GET", @@ -214,17 +150,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>InsertRecordNumber)", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123InsertRecordNumber)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>InsertRecordNumber)" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123InsertRecordNumber)" ] } }, @@ -241,7 +175,6 @@ , { - "_postman_id": "", "name": "Read by ", "request": { "method": "GET", @@ -256,17 +189,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>)", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>)" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123)" ] } }, @@ -277,7 +208,6 @@ , { - "_postman_id": "", "name": "Count by ", "request": { "method": "GET", @@ -292,17 +222,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>)/$count", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123)/$count", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>)", + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123)", "$count" ] } @@ -320,7 +248,6 @@ , { - "_postman_id": "", "name": "Read by partial key ", "request": { "method": "GET", @@ -335,17 +262,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>)", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>)" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123)" ] } }, @@ -355,7 +280,6 @@ , { - "_postman_id": "", "name": "Count by ", "request": { "method": "GET", @@ -370,17 +294,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>)/$count", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123)/$count", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>)", + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123)", "$count" ] } @@ -399,7 +321,6 @@ , { - "_postman_id": "", "name": "Read ", "request": { "method": "GET", @@ -414,17 +335,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>InsertRecordNumber)/", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123InsertRecordNumber)/", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>InsertRecordNumber)/" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123InsertRecordNumber)/" ] } }, @@ -434,7 +353,6 @@ , { - "_postman_id": "", "name": "Read raw value", "request": { "method": "GET", @@ -449,17 +367,15 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "" - }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>InsertRecordNumber)//$value", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123InsertRecordNumber)//$value", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>InsertRecordNumber)//$value" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123InsertRecordNumber)//$value" ] } }, @@ -476,7 +392,6 @@ , { - "_postman_id": "", "name": "Create (auto assign key)", "request": { "method": "POST", @@ -496,8 +411,10 @@ "raw": "{\n \"\": \"\"\"\"<,>\n}" }, "url": { - "raw": "{{ServerBaseUri}}/", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/", "host": [ + "{{ODataPath}}", + "v{{ApiVersion}}", "{{ServerBaseUri}}" ], "path": [ @@ -512,7 +429,6 @@ , { - "_postman_id": "", "name": "Create or update ", "request": { "method": "PUT", @@ -532,12 +448,14 @@ "raw": "{\n \"\": \"\"\"\"<,>\n}" }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>InsertRecordNumber)", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123InsertRecordNumber)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>InsertRecordNumber)" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123InsertRecordNumber)" ] } }, @@ -567,12 +485,14 @@ "raw": "[\r\n {\r\n \"op\": \"replace\",\r\n \"path\": \"PropertyName\",\r\n \"value\": \"PropertyValue\"\r\n }\r\n]" }, "url": { - "raw": "/(=--T'ABC'123<,>InsertRecordNumber)", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123InsertRecordNumber)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>InsertRecordNumber)" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123InsertRecordNumber)" ] } }, @@ -583,7 +503,6 @@ , { - "_postman_id": "", "name": "Delete ", "request": { "method": "DELETE", @@ -603,12 +522,14 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/(=--T'ABC'123<,>InsertRecordNumber)", + "raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/(=--T'ABC'123InsertRecordNumber)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "(=--T'ABC'123<,>InsertRecordNumber)" + "{{ODataPath}}", + "v{{ApiVersion}}", + "(=--T'ABC'123InsertRecordNumber)" ] } }, @@ -620,11 +541,22 @@ }<,> ], + + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{JWT}}", + "type": "string" + } + ] + }, + "event": [ { "listen": "prerequest", "script": { - "id": "", "type": "text/javascript", "exec": [ "" @@ -634,7 +566,6 @@ { "listen": "test", "script": { - "id": "", "type": "text/javascript", "exec": [ "" @@ -644,22 +575,19 @@ ], "variable": [ { - "id": "", "key": "TenantID", "value": "", "type": "string" }, { - "id": "", "key": "ServerBaseUri", "value": "://://v", "type": "string" }, { - "id": "", "key": "ServerAuthUri", - "value": "://:", + "value": "://://", "type": "string" } ] -} \ No newline at end of file +} diff --git a/Templates/ODataSelfHost.tpl b/Templates/ODataSelfHost.tpl index 72299d7d..ac05e58c 100644 --- a/Templates/ODataSelfHost.tpl +++ b/Templates/ODataSelfHost.tpl @@ -1,6 +1,5 @@ SelfHost.dbl 5.4.6 -API_DOCS_PATH SERVICES_NAMESPACE SERVER_PROTOCOL SERVER_NAME @@ -55,12 +54,24 @@ import Microsoft.AspNetCore.Hosting import System.Collections.Generic import System.IO import System.Text -import import +import main SelfHost proc + ;;------------------------------------------------------------------------- + ;;Wait for the Visual Studio debugger to attach + + if (!String.IsNullOrWhiteSpace(System.Environment.GetEnvironmentVariable("WAIT_FOR_DEBUGGER"))) + begin + while (!System.Diagnostics.Debugger.IsAttached) + begin + Console.WriteLine("Waiting for debugger to attach...") + sleep 1 + end + end + ;;------------------------------------------------------------------------- ;;Configure the environment try @@ -70,17 +81,13 @@ proc catch (ex, @Exception) begin Console.WriteLine(ex.Message) - Console.Write("Press a key to terminate: ") - Console.ReadKey() + ;Can't do this in IIS! + ;Console.Write("Press a key to terminate: ") + ;Console.ReadKey() stop end endtry - ;;------------------------------------------------------------------------- - ;;Report the location of the API documentation - - Console.WriteLine("API documentation is available at ://:/") - ;;------------------------------------------------------------------------- ;;Define the location that static files are served from and make sure it exists diff --git a/Templates/ODataSelfHostEnvironment.tpl b/Templates/ODataSelfHostEnvironment.tpl index 0e32f399..c8831218 100644 --- a/Templates/ODataSelfHostEnvironment.tpl +++ b/Templates/ODataSelfHostEnvironment.tpl @@ -51,6 +51,7 @@ import Microsoft.AspNetCore import Microsoft.AspNetCore.Hosting import System.Collections.Generic import System.IO +import System.Runtime.InteropServices import System.Text import import @@ -160,11 +161,12 @@ namespace proc data chout, int data dataFile, string + data fileExtension, a10 data xdlFile, string - data = load() + data Data = load() @@ -172,18 +174,19 @@ namespace ;;Create and load the file dataFile = "" + xcall parse(dataFile.ToLower(),1,,,,,fileExtension) - xdlFile = "@" + dataFile.ToLower().Replace(".ism",".xdl") + xdlFile = "@" + dataFile.ToLower().Replace(%atrim(fileExtension),".xdl") data , @ open(chout=0,o:i,dataFile,FDL:xdlFile) - foreach in + foreach in Data store(chout,.SynergyRecord) close chout - data sourceFile = dataFile.ToLower().Replace(".ddf",".txt") + data sourceFile = dataFile.ToLower().Replace(%atrim(fileExtension),".txt") xcall copy(sourceFile,dataFile,1) @@ -212,20 +215,22 @@ namespace public static method load, @List<> proc data dataFile = "" - data textFile = dataFile.ToLower().Replace(".ism",".txt") + data fileExtension, a10 + xcall parse(dataFile.ToLower(),1,,,,,fileExtension) + data textFile = dataFile.ToLower().Replace(%atrim(fileExtension),".txt") data Ch, int, 0 data Rec, str - data = new List<>() + data Data = new List<>() data grfa, a10 open(Ch,i:s,textFile) repeat begin reads(Ch,Rec,eof) - .Add(new (Rec, grfa)) + Data.Add(new (Rec, grfa)) end eof, close Ch - mreturn + mreturn Data endmethod @@ -242,11 +247,16 @@ namespace if(Directory.Exists(Path.Combine(currentFolder, folderName))) then mreturn Path.Combine(currentFolder, folderName) else - currentFolder = Path.GetFullPath(currentFolder + "..\") + begin + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) then + currentFolder = Path.GetFullPath(currentFolder + "..\") + else + currentFolder = Path.GetFullPath(currentFolder + "../") + end end mreturn ^null endmethod endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/ODataStartup.tpl b/Templates/ODataStartup.tpl index 4f062d96..c7d44ec4 100644 --- a/Templates/ODataStartup.tpl +++ b/Templates/ODataStartup.tpl @@ -1,6 +1,5 @@ Startup.dbl -5.4.6 -API_DOCS_PATH +5.8.5 API_TITLE MODELS_NAMESPACE CONTROLLERS_NAMESPACE @@ -272,6 +271,7 @@ namespace & .AddDataAnnotations() ;;Enable data annotations & .AddNewtonsoftJson(lambda (opts) { opts.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver()}) & .AddApplicationPart(^typeof(IsolatedMethodsBase).Assembly) + & .AddApplicationPart(^typeof(Microsoft.AspNetCore.OData.Routing.Controllers.MetadataController).Assembly) lambda configSwaggerGen(c) begin @@ -480,50 +480,6 @@ namespace app.UseAuthentication() - ;;------------------------------------------------------- - ;;Configure the MVC & OData environments - - lambda mvcBuilder(builder) - begin - lambda UriResolver(s) - begin - data result = app.ApplicationServices.GetRequiredService() - mreturn result - end - - lambda EnableRouting(configContext) - begin - configContext.RoutingConventions.Insert(1, new HarmonySprocRoutingConvention()) - configContext.RoutingConventions.Insert(1, new AdapterRoutingConvention()) - mreturn configContext.RoutingConventions - end - - lambda EnableWritableEdmModel(sp) - begin - mreturn new RefEdmModel() { RealModel = EdmBuilder.GetEdmModel(sp) } - end - - lambda EnableDI(containerBuilder) - begin - containerBuilder.AddService( Microsoft.OData.ServiceLifetime.Singleton, UriResolver) - nop - end - - lambda ConfigureRoute(containerBuilder) - begin - data containerBuilderType, @Type, ((@Object)containerBuilder).GetType() - data servicesField, @System.Reflection.FieldInfo, containerBuilderType.GetField("services", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) - data serviceDescriptors = ((@System.Collections.IEnumerable)servicesField.GetValue(containerBuilder)).OfType() - data versionedModelDescriptor = serviceDescriptors.Where(lambda(descriptor) { descriptor.ServiceType == ^typeof(IEdmModel) }).Last() - data versionedModel = versionedModelDescriptor.ImplementationInstance - if(versionedModel == ^null) - versionedModel = versionedModelDescriptor.ImplementationFactory(app.ApplicationServices) - containerBuilder.AddService(Microsoft.OData.ServiceLifetime.Scoped, lambda(sp) { new RefEdmModel() { RealModel = ^as(versionedModel, @IEdmModel) } }) - containerBuilder.AddService(Microsoft.OData.ServiceLifetime.Singleton, lambda(sp) { new UnqualifiedAltKeyUriResolver(^as(versionedModel, @IEdmModel)) { EnableCaseInsensitive = true } }) - containerBuilder.AddService( Microsoft.OData.ServiceLifetime.Singleton) - containerBuilder.AddService( Microsoft.OData.ServiceLifetime.Singleton) - end - end ;;------------------------------------------------------- @@ -550,6 +506,10 @@ namespace app.UseSwagger() app.UseSwaggerUI(lambda(c) { c.SwaggerEndpoint("/swagger/v/swagger.json", "") }) + ;;Enable serving static files + app.UseDefaultFiles() + app.UseStaticFiles() + app.UsePathBase(new PathString("/odata/v1")) ;;Use odata route debug, /$odata @@ -559,7 +519,6 @@ namespace lambda RoutingConfig(endpoints) begin endpoints.MapControllers() - endpoints.MapHub("//orders") end app.UseRouting() diff --git a/Templates/ODataUnitTestEnvironment.tpl b/Templates/ODataUnitTestEnvironment.tpl index 00555c51..c0597a1a 100644 --- a/Templates/ODataUnitTestEnvironment.tpl +++ b/Templates/ODataUnitTestEnvironment.tpl @@ -113,7 +113,7 @@ namespace else begin ;;Create a TestServer to host the Web API services - Server = new TestServer(WebHost.CreateDefaultBuilder().UseContentRoot(wwwroot).UseWebRoot(wwwroot).UseStartup()) + Server = new TestServer(WebHost.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).UseWebRoot(wwwroot).UseStartup()) end ;;Fake out HTTPS @@ -199,6 +199,12 @@ namespace endmethod + ;;Declare the SetLogicalsCustom partial method + ;;This method can be implemented in a partial class to provide custom code to define logical names + partial static method SetLogicalsCustom, void + required in logicals, @List + endmethod + private static method setLogicals, void proc data sampleDataFolder = FindRelativeFolderForAssembly("") @@ -216,12 +222,27 @@ namespace end + ;;If we have a SetLogicalsCustom method, call it + SetLogicalsCustom(Startup.LogicalNames) + + + ;;Now we'll check each logical. If it already has a value we'll do nothing, otherwise + ;;we'll set the logical to point to the local folder whose name is identified by the + ;;user-defined token DATA_FOLDER foreach logical in logicals begin data sts, int - xcall setlog(logical,sampleDataFolder,sts) + data translation, a80 + ;;Is it set? + xcall getlog(logical,translation,sts) + if (!sts) + begin + ;;No, we'll set it to + xcall setlog(logical,sampleDataFolder,sts) + end end + endmethod diff --git a/Templates/ODataUnitTests.tpl b/Templates/ODataUnitTests.tpl index 9904325f..3550811d 100644 --- a/Templates/ODataUnitTests.tpl +++ b/Templates/ODataUnitTests.tpl @@ -1,5 +1,5 @@ Tests.dbl -5.5.3 +5.7.5 TF UnitTests CLIENT_MODELS_NAMESPACE @@ -81,7 +81,7 @@ namespace {TestMethod} {TestCategory(" Tests - Read All")} - public method Get, void + public method GetAll, void proc disposable data client = UnitTestEnvironment.Server.CreateClient() @@ -90,7 +90,7 @@ namespace disposable data response = client.GetAsync("/odata/v/").Result data result = response.Content.ReadAsStringAsync().Result response.EnsureSuccessStatusCode() - data , @OData, JsonConvert.DeserializeObject>(result) + data , @ODataMultiple, JsonConvert.DeserializeObjectMultiple>(result) Assert.AreEqual(.Value.Count,TestConstants.Instance.Get_Count) endmethod ;// @@ -105,7 +105,7 @@ namespace {TestMethod} {TestCategory(" Tests - Read All")} - public method Get_Expand_, void + public method GetAll_Expand_, void proc data uri = "/odata/v/?$expand=" disposable data client = UnitTestEnvironment.Server.CreateClient() @@ -123,7 +123,7 @@ namespace {TestMethod} {TestCategory(" Tests - Read All")} - public method Get_Expand_All, void + public method GetAll_Expand_All, void proc data uri = "/odata/v/?$expand=<,>" disposable data client = UnitTestEnvironment.Server.CreateClient() @@ -147,17 +147,21 @@ namespace {TestMethod} {TestCategory(" Tests - Read by Primary Key")} - public method Get, void + public method GetOne, void proc disposable data client = UnitTestEnvironment.Server.CreateClient() client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",UnitTestEnvironment.AccessToken) - data request = String.Format("/odata/v/(='{}'<,>)","",TestConstants.Instance.Get_<,>) + data request = String.Format("/odata/v/(='{}')","",TestConstants.Instance.Get_<,>) data response = client.GetAsync(request).Result data result = response.Content.ReadAsStringAsync().Result response.EnsureSuccessStatusCode() - data , @OData, JsonConvert.DeserializeObject>(result) + + data , @ODataSingle, JsonConvert.DeserializeObjectSingle>(result) + + data , @ODataSingle, JsonConvert.DeserializeObjectSingle>(result) + endmethod ;// ;// @@ -170,17 +174,17 @@ namespace {TestMethod} {TestCategory(" Tests - Read by Primary Key")} - public method Get_Expand_, void + public method GetOne_Expand_, void proc disposable data client = UnitTestEnvironment.Server.CreateClient() client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",UnitTestEnvironment.AccessToken) - data request = String.Format("/odata/v/(='{}'<,>)?$expand=","",TestConstants.Instance.Get_Expand__<,>) + data request = String.Format("/odata/v/(='{}')?$expand=","",TestConstants.Instance.Get_Expand__<,>) data response = client.GetAsync(request).Result data result = response.Content.ReadAsStringAsync().Result response.EnsureSuccessStatusCode() - data , @OData, JsonConvert.DeserializeObject>(result) + data , @ODataSingle, JsonConvert.DeserializeObjectSingle>(result) endmethod @@ -189,17 +193,17 @@ namespace {TestMethod} {TestCategory(" Tests - Read by Primary Key")} - public method Get_Expand_All, void + public method GetOne_Expand_All, void proc disposable data client = UnitTestEnvironment.Server.CreateClient() client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",UnitTestEnvironment.AccessToken) - data request = String.Format("/odata/v/(='{}'<,>)?$expand=<,>","",TestConstants.Instance.Get_Expand_All_<,>) + data request = String.Format("/odata/v/(='{}')?$expand=<,>","",TestConstants.Instance.Get_Expand_All_<,>) data response = client.GetAsync(request).Result data result = response.Content.ReadAsStringAsync().Result response.EnsureSuccessStatusCode() - data , @OData, JsonConvert.DeserializeObject>(result) + data , @ODataSingle, JsonConvert.DeserializeObjectSingle>(result) endmethod @@ -221,11 +225,11 @@ namespace client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",UnitTestEnvironment.AccessToken) - data request = String.Format("/odata/v/(='{}'<,>)", "", TestConstants.Instance.Get_ByAltKey__.ToString("yyyy-MM-dd").ToString("hh:mm").ToString("hh:mm:ss").ToString().ToLower()<,>) + data request = String.Format("/odata/v/(='{}')", "", TestConstants.Instance.Get_ByAltKey__.ToString("yyyy-MM-dd").ToString("hh:mm").ToString("hh:mm:ss").ToString().ToLower()<,>) data response = client.GetAsync(request).Result data result = response.Content.ReadAsStringAsync().Result response.EnsureSuccessStatusCode() - data , @OData,JsonConvert.DeserializeObject>(result) + data , @ODataMultiple,JsonConvert.DeserializeObjectMultiple>(result) endmethod @@ -271,7 +275,7 @@ namespace ;;Get one from the file - data getRequest = String.Format("/odata/v/(='{}'<,>)","",TestConstants.Instance.Get_<,>) + data getRequest = String.Format("/odata/v/(='{}')","",TestConstants.Instance.Get_<,>) data getResponse = client.GetAsync(getRequest).Result data getResult = getResponse.Content.ReadAsStringAsync().Result @@ -291,7 +295,7 @@ namespace ;;Create new item disposable data requestBody = new StringContent(JsonConvert.SerializeObject(do),System.Text.Encoding.UTF8, "application/json") - data request = String.Format("/odata/v/(='{}'<,>)","",TestConstants.Instance.Update_<,>) + data request = String.Format("/odata/v/(='{}')","",TestConstants.Instance.Update_<,>) disposable data response = client.PutAsync(request, requestBody).Result ;;Check that we got a successful response from the web service @@ -306,7 +310,7 @@ namespace ;;Deserialize the JSON into a object - data results = JsonConvert.DeserializeObject>(getResult).Value + data results = JsonConvert.DeserializeObjectSingle>(getResult).Value data resultItem, @ do = results[0] @@ -336,7 +340,7 @@ namespace ;;Update full item requestBody = new StringContent(JsonConvert.SerializeObject(do),System.Text.Encoding.UTF8, "application/json") - request = String.Format("/odata/v/(='{}'<,>)","",TestConstants.Instance.Update_<,>) + request = String.Format("/odata/v/(='{}')","",TestConstants.Instance.Update_<,>) response = client.PutAsync(request, requestBody).Result ;;Check that we got a successful response from the web service @@ -463,11 +467,11 @@ namespace ;// ;// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",UnitTestEnvironment.AccessToken) ;// -;// data request = String.Format("/odata/v/(='{}'<,>)","",TestConstants.Instance.Get_ByPartialPrimaryKey_<,>) +;// data request = String.Format("/odata/v/(='{}')","",TestConstants.Instance.Get_ByPartialPrimaryKey_<,>) ;// data response = client.GetAsync(request).Result ;// data result = response.Content.ReadAsStringAsync().Result ;// response.EnsureSuccessStatusCode() -;// data , @OData, JsonConvert.DeserializeObject>(result) +;// data , @ODataSingle, JsonConvert.DeserializeObjectSingle>(result) ;// endmethod ;// ;// diff --git a/Templates/PostManDevelopmentEnvironment.tpl b/Templates/PostManDevelopmentEnvironment.tpl new file mode 100644 index 00000000..dd18b2e7 --- /dev/null +++ b/Templates/PostManDevelopmentEnvironment.tpl @@ -0,0 +1,40 @@ +Postman_LocalDevelopment.postman_environment.json +{ + "id": "021c358b-fa1d-45d0-a901-4e15931800b0", + "name": "LocalDevelopment", + "values": [ + { + "key": "ServerBaseUri", + "value": "://:", + "enabled": true + }, + { + "key": "ODataPath", + "value": "", + "enabled": true + }, + { + "key": "ApiVersion", + "value": "", + "enabled": true + }, + { + "key": "ServerAuthUri", + "value": "://://", + "enabled": true + }, + { + "key": "JWT", + "value": "PUT_JWT_HERE", + "enabled": true + }, + { + "key": "TenantID", + "value": "PUT_TENANT_ID_HERE", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2022-01-01T00:00:00.000Z", + "_postman_exported_using": "Postman/9.12.2" +} \ No newline at end of file diff --git a/Templates/SignalR/SignalRTests.tpl b/Templates/SignalR/SignalRTests.tpl index 35e4f851..946d00a3 100644 --- a/Templates/SignalR/SignalRTests.tpl +++ b/Templates/SignalR/SignalRTests.tpl @@ -43,11 +43,6 @@ namespace {TestMethod} public async method , @Task proc - ;;Do we have request data for asp_login? - data aspLoginRequestFile, string, Path.Combine(UnitTestEnvironment.TestRequestsFolder,"asp.asp_login.request.json") - if (!File.Exists(aspLoginRequestFile)) - Assert.Inconclusive("No input data provided for test asp.asp_login!") - ;;Do we have request data for this operation? data requestFile, string, Path.Combine(UnitTestEnvironment.TestRequestsFolder,"..request.json") @@ -72,12 +67,6 @@ namespace & .AddNewtonsoftJsonProtocol() & .Build() - ;;ASP_LOGIN - data asp_login_tcs = new TaskCompletionSource() - data asp_login_resultHandler, @Action - asp_login_resultHandler = lambda(msg) { asp_login_tcs.TrySetResult(msg) } - connection.On("asp_login_Result", asp_login_resultHandler) - ;;Setup up for a method call data tcs = new TaskCompletionSource<._Response>() data resultHandler, @Action<._Response> @@ -96,32 +85,7 @@ namespace await connection.StartAsync() ;;------------------------------------------------------------------------------------- - ;;Call ASP_LOGIN - begin - ;;Define the data to be sent to the request - data request = JsonConvert.DeserializeObject(File.ReadAllText(aspLoginRequestFile)) - - ;;Send the request - await connection.InvokeAsync("asp_login", request) - - ;;Wait for the response - data response = await asp_login_tcs.Task - - ;;Write the response data to a JSON file for easy viewing - data responseFile = Path.Combine(UnitTestEnvironment.TestResponsesFolder,"asp.asp_login.response.json") - File.WriteAllText(responseFile,JsonConvert.SerializeObject(response,Formatting.Indented)) - - ;;Are we logged in? - data result = false - data message = String.Empty - asp_login_Validate(request,response,result,message) - - if (!result) - Assert.Fail(message) - end - - ;;------------------------------------------------------------------------------------- - ;;If we get here, ASP_LOGIN worked so we can call the actual method to be tested + ;;Call the method ;;Define the data to be sent to the request diff --git a/Templates/TraditionalBridge/InterfaceController.tpl b/Templates/TraditionalBridge/InterfaceController.tpl index 40945050..c6409d0f 100644 --- a/Templates/TraditionalBridge/InterfaceController.tpl +++ b/Templates/TraditionalBridge/InterfaceController.tpl @@ -1,5 +1,5 @@ Controller.dbl -5.4.6 +5.8.5 MODELS_NAMESPACE DTOS_NAMESPACE ;//**************************************************************************** @@ -61,6 +61,7 @@ import System.Collections.Generic import System.Linq import System.Text import System.Threading.Tasks +import import @@ -92,14 +93,16 @@ namespace {HttpPostGet} {Route("")} + ;;; - ;;; + ;;; ;;; - ;;; - public async method PostGet_, @Task._Response>>@Task + ;;; + + public async method , @Task_Response>>@Task {FromBody} - required in aRequest, @._Request + required in aRequest, @_Request proc diff --git a/Templates/TraditionalBridge/InterfaceDispatcher.tpl b/Templates/TraditionalBridge/InterfaceDispatcher.tpl index e4c5264a..c380f4e1 100644 --- a/Templates/TraditionalBridge/InterfaceDispatcher.tpl +++ b/Templates/TraditionalBridge/InterfaceDispatcher.tpl @@ -1,5 +1,5 @@ Dispatcher.dbl -5.4.6 +5.8.5 ;//**************************************************************************** ;// ;// Title: InterfaceDispatcher.tpl @@ -53,13 +53,6 @@ namespace public method Dispatcher proc - - ;;Declare dispatcher classes fotr the sample methods - mDispatchStubs.Add("AddTwoNumbers", new AddTwoNumbersDispatcher()) - mDispatchStubs.Add("GetEnvironment", new GetEnvironmentDispatcher()) - mDispatchStubs.Add("GetLogicalName", new GetLogicalNameDispatcher()) - - ;;Declare dispatcher classes for the '' interface methods mDispatchStubs.Add("", new _Dispatcher()) @@ -72,4 +65,4 @@ namespace endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/TraditionalBridge/InterfaceDispatcherData.tpl b/Templates/TraditionalBridge/InterfaceDispatcherData.tpl new file mode 100644 index 00000000..c88004c6 --- /dev/null +++ b/Templates/TraditionalBridge/InterfaceDispatcherData.tpl @@ -0,0 +1,66 @@ +DispatcherData.dbl +SMC_INTERFACE +5.4.6 +;//**************************************************************************** +;// +;// Title: DispatcherData.tpl +;// +;// Type: CodeGen Template +;// +;// Description: Creates a class that initializes all data object metadata +;// +;// Copyright (c) 2018, Synergex International, Inc. All rights reserved. +;// +;// Redistribution and use in source and binary forms, with or without +;// modification, are permitted provided that the following conditions are met: +;// +;// * Redistributions of source code must retain the above copyright notice, +;// this list of conditions and the following disclaimer. +;// +;// * Redistributions in binary form must reproduce the above copyright notice, +;// this list of conditions and the following disclaimer in the documentation +;// and/or other materials provided with the distribution. +;// +;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +;// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +;// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +;// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +;// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +;// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +;// POSSIBILITY OF SUCH DAMAGE. +;// +;;***************************************************************************** +;; +;; Title: DispatcherData.dbl +;; +;; Description: Initializes all data object metadata +;; +;;***************************************************************************** +;; WARNING: GENERATED CODE! +;; This file was generated by CodeGen. Avoid editing the file if possible. +;; Any changes you make will be lost of the file is re-generated. +;;***************************************************************************** + +import Harmony.TraditionalBridge + +namespace + + public partial class Dispatcher + + ;;; + ;;; Initialize all data object metadata + ;;; + private method initMetaData, void + proc + + DataObjectMetadataBase.LookupType("") + + endmethod + + endclass + +endnamespace \ No newline at end of file diff --git a/Templates/TraditionalBridge/InterfaceDocumentation.tpl b/Templates/TraditionalBridge/InterfaceDocumentation.tpl new file mode 100644 index 00000000..f4e8efa2 --- /dev/null +++ b/Templates/TraditionalBridge/InterfaceDocumentation.tpl @@ -0,0 +1,148 @@ +.html +MODELS_NAMESPACE +5.8.1 +;//**************************************************************************** +;// +;// Title: InterfaceDocumentation.tpl +;// +;// Type: CodeGen Template +;// +;// Description: Generates documentation for exposed methods +;// +;// Copyright (c) 2021, Synergex International, Inc. All rights reserved. +;// +;// Redistribution and use in source and binary forms, with or without +;// modification, are permitted provided that the following conditions are met: +;// +;// * Redistributions of source code must retain the above copyright notice, +;// this list of conditions and the following disclaimer. +;// +;// * Redistributions in binary form must reproduce the above copyright notice, +;// this list of conditions and the following disclaimer in the documentation +;// and/or other materials provided with the distribution. +;// +;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +;// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +;// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +;// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +;// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +;// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +;// POSSIBILITY OF SUCH DAMAGE. +;// + + + <INTERFACE_NAME> + + + + + + + + + + + + + + + + + + + + + + + +

Traditional Bridge Documentation for

+ + + + +
+

+ + + + + + + + + + + + + + + + + + + + + None + + + + + +
DescriptionNot provided
HTTP methodPOSTGET
Method URI//
Request headers + + Content-Type: application/json
+ Authorization: Bearer <JWT>
+ None +
Request body
{"": ,}
Response body
{"ReturnValue": , "": , }
None
+ +

Back to Top

+ +
+ + diff --git a/Templates/TraditionalBridge/InterfaceMethodDispatchers.tpl b/Templates/TraditionalBridge/InterfaceMethodDispatchers.tpl index f4c3387c..adb711bb 100644 --- a/Templates/TraditionalBridge/InterfaceMethodDispatchers.tpl +++ b/Templates/TraditionalBridge/InterfaceMethodDispatchers.tpl @@ -1,6 +1,6 @@ MethodDispatchers.dbl MODELS_NAMESPACE -5.4.6 +5.8.5 ;//**************************************************************************** ;// ;// Title: MethodDispatchers.tpl diff --git a/Templates/TraditionalBridge/InterfaceMethodStubs.tpl b/Templates/TraditionalBridge/InterfaceMethodStubs.tpl index 798f5c13..9003933c 100644 --- a/Templates/TraditionalBridge/InterfaceMethodStubs.tpl +++ b/Templates/TraditionalBridge/InterfaceMethodStubs.tpl @@ -1,5 +1,6 @@ MethodStubs.dbl MODELS_NAMESPACE +5.7.8 ;//**************************************************************************** ;// ;// Title: InterfaceMethodStubs.tpl @@ -52,6 +53,11 @@ import ;;-------------------------------------------------------------------------------------------------- ;; () ;; + +;; Stub generation has been disabled for this method. +;; + + ;;; ;;; @@ -81,4 +87,5 @@ proc end - \ No newline at end of file + + diff --git a/Templates/TraditionalBridge/InterfacePostmanTests.tpl b/Templates/TraditionalBridge/InterfacePostmanTests.tpl index c4e7f896..48b9801b 100644 --- a/Templates/TraditionalBridge/InterfacePostmanTests.tpl +++ b/Templates/TraditionalBridge/InterfacePostmanTests.tpl @@ -1,10 +1,10 @@ -PostmanTests.postman_collection.json +Postman_Tests.postman_collection.json API_TITLE 5.4.6 { "info": { "_postman_id": "2648742f-eaf1-4fe1-8a13-52af1cd8534a", - "name": " ()", + "name": " (Code: )", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ @@ -27,12 +27,12 @@ "raw": "{ \n\t\"\": , \n}" }, "url": { - "raw": "{{server}}//", + "raw": "{{BridgeBaseUri}}/{{ControllerPath}}/", "host": [ - "{{server}}" + "{{BridgeBaseUri}}" ], "path": [ - "", + "{{ControllerPath}}", "" ] } @@ -46,12 +46,12 @@ "method": "GET", "header": [], "url": { - "raw": "{{server}}//", + "raw": "{{BridgeBaseUri}}/{{ControllerPath}}/", "host": [ - "{{server}}" + "{{BridgeBaseUri}}" ], "path": [ - "", + "{{ControllerPath}}", "" ] } @@ -96,9 +96,15 @@ "variable": [ { "id": "348faa4b-487a-4d1e-9c94-9880cb11f521", - "key": "server", - "value": "https://localhost:", + "key": "BridgeBaseUri", + "value": "://:", + "type": "string" + }, + { + "id": "a3b6a948-ca0e-4b59-958f-560f2eaa2205", + "key": "ControllerPath", + "value": "", "type": "string" } ] -} \ No newline at end of file +} diff --git a/Templates/TraditionalBridge/InterfaceService.tpl b/Templates/TraditionalBridge/InterfaceService.tpl index 796d38c2..f9c6f6f0 100644 --- a/Templates/TraditionalBridge/InterfaceService.tpl +++ b/Templates/TraditionalBridge/InterfaceService.tpl @@ -1,5 +1,5 @@ Service.dbl -5.4.6 +5.8.5 MODELS_NAMESPACE DTOS_NAMESPACE ;//**************************************************************************** @@ -59,7 +59,6 @@ import System import System.Collections.Generic import System.Text import Microsoft.AspNetCore.Mvc -import Microsoft.AspNet.OData import Microsoft.AspNetCore.Authorization import Newtonsoft.Json.Linq import System.Linq @@ -112,14 +111,14 @@ namespace ;;Make the JSON-RPC call the traditional Synergy routine data resultTuple = await CallMethod("" - & ,ArgumentHelper.MayBeOptional(args.ArgumentHelper.MaybeNull(response.)response.) + & ,ArgumentHelper.MayBeOptional(args.ArgumentHelper.MaybeNull(response.)response.) & ) ;;Set the return value in the return data - ArgumentHelper.Argument(0, resultTuple, response.ReturnValue) + ArgumentHelper.Argument(0, resultTuple, response.returnValueReturnValue) ;// diff --git a/Templates/TraditionalBridge/InterfaceServiceModels.tpl b/Templates/TraditionalBridge/InterfaceServiceModels.tpl index 6ae415a7..a44f2299 100644 --- a/Templates/TraditionalBridge/InterfaceServiceModels.tpl +++ b/Templates/TraditionalBridge/InterfaceServiceModels.tpl @@ -1,5 +1,5 @@ ServiceModels.dbl -5.4.6 +5.8.5 MODELS_NAMESPACE ;//**************************************************************************** ;// @@ -98,7 +98,7 @@ namespace ;;; No description found in method catalog ;;; - public , [#] + public , [#], String.Empty @@ -126,7 +126,7 @@ namespace ;;; ;;; Return value ;;; - public ReturnValue, + public returnValueReturnValue, @@ -143,7 +143,7 @@ namespace ;;; No description found in method catalog ;;;
- public , [#], new string[1]String.Empty + public , [#], new string[0]String.Empty, String.Empty diff --git a/Templates/TraditionalBridge/InterfaceSuperDispatcher.tpl b/Templates/TraditionalBridge/InterfaceSuperDispatcher.tpl index 049f2583..247790a6 100644 --- a/Templates/TraditionalBridge/InterfaceSuperDispatcher.tpl +++ b/Templates/TraditionalBridge/InterfaceSuperDispatcher.tpl @@ -1,5 +1,5 @@ MethodDispatcher.dbl -5.6.7 +5.8.5 ;//**************************************************************************** ;// ;// Title: InterfaceSuperDispatcher.tpl @@ -69,4 +69,4 @@ namespace endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/TraditionalBridge/ODataModel.tpl b/Templates/TraditionalBridge/ODataModel.tpl index 0a012ee0..1512f4e7 100644 --- a/Templates/TraditionalBridge/ODataModel.tpl +++ b/Templates/TraditionalBridge/ODataModel.tpl @@ -1,5 +1,5 @@ .dbl -5.5.4 +5.8.5 ;//**************************************************************************** ;// ;// Title: ODataModel.tpl @@ -114,11 +114,9 @@ namespace - - ;;; - ;;; + ;;; ;;; ;// ;// Field property attributes @@ -127,21 +125,21 @@ namespace {Key} - {Required(ErrorMessage=" is required. ")} + {Required(ErrorMessage=" is required. ")} ;//We can't add validation attributes for fields with custom data types!!! - {StringLength(, ErrorMessage=" cannot exceed characters. ")} + {StringLength(, ErrorMessage=" cannot exceed characters. ")} - {Range(,, ErrorMessage=" must be between and . ")} + {Range(,, ErrorMessage=" must be between and . ")} - {Range(,, ErrorMessage=" must be between and . ")} + {Range(,, ErrorMessage=" must be between and . ")} ;// @@ -162,7 +160,7 @@ namespace public property , String - public property , @Format + public property , ;// ;// Field property get method @@ -171,149 +169,123 @@ namespace proc mreturn Converter.Convert(mSynergyData.) - - + mreturn ()SynergyAlphaConverter.Convert(mSynergyData., ^null, ^null, ^null) - - - + + mreturn %string(mSynergyData.,"XXXX-XX-XX") - - - data String = (string)mSynergyData. - mreturn new Format(int.Parse(String.Substring(0, 24)), int.Parse(String.Substring(24))) - - data formatString = "YYYYMMDD" - - formatString = "YYMMDD" - - formatString = "YYYYJJJ" - - mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, formatString, ^null) - - - - - + + mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, "YYYYMMDD", ^null) + + mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, "YYMMDD", ^null) + + mreturn ()SynergyDecimalDateConverter.Convert(mSynergyData., ^null, "YYYYJJJ", ^null) + + mreturn %string(mSynergyData.,"XXXX/XX") + + mreturn %string(mSynergyData.,"XX/XX") + + + mreturn %string(mSynergyData.,"XX:XX") - + mreturn Convert.ToDateTime(%string(mSynergyData.,"XX:XX")) - - - - + + + mreturn %string(mSynergyData.,"XX:XX:XX") - + mreturn Convert.ToDateTime(%string(mSynergyData.,"XX:XX:XX")) - - - - - + + + + mreturn %string(SynergyImpliedDecimalConverter.Convert(mSynergyData., ^null, "DECIMALPLACES#", ^null),"") - - mreturn %string(mSynergyData.,"") - - + mreturn %string(mSynergyData.,"") + + + mreturn ()SynergyImpliedDecimalConverter.Convert(mSynergyData., ^null, "DECIMALPLACES#", ^null) - + mreturn ()mSynergyData. - - - - + + + mreturn ()mSynergyData. - - + mreturn ()mSynergyData. - - + mreturn ()mSynergyData. - - + mreturn ()mSynergyData. - - + mreturn (String)mSynergyData. - - + endmethod ;// ;// Field property set method ;// method set proc - - + throw new ApplicationException("Property is read only!") - - + mSynergyData. = Converter.ConvertBack(value) - - + mSynergyData. = ()SynergyAlphaConverter.ConvertBack(value.ToUpper(), ^null, ^null, ^null) - - + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XXXX-XX-XX") - - - mSynergyData. = value.YYYYYY * 100 + value.PP - - data formatString = "YYYYMMDD" - - formatString = "YYMMDD" - - - formatString = "YYYYJJJ" - - mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, formatString, ^null) - - - - + + mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, "YYYYMMDD", ^null) + + mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, "YYMMDD", ^null) + + mSynergyData. = ()SynergyDecimalDateConverter.ConvertBack(value, ^null, "YYYYJJJ", ^null) + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XXXX/XX") + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XX/XX") + + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XX:XX") - - + mSynergyData. = (value.Value.Hour * 100) + value.Value.Minute - + mSynergyData. = (value.Hour * 100) + value.Minute - - - - + + + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"XX:XX:XX") - - + mSynergyData. = (value.Value.Hour * 10000) + (value.Value.Minute * 100) + value.Value.Second - + mSynergyData. = (value.Hour * 10000) + (value.Minute * 100) + value.Second - - - - - + + + + mSynergyData. = SynergyImpliedDecimalConverter.ConvertBack(value,"") - - mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"") - + mSynergyData. = SynergyDecimalConverter.ConvertBack(value,"") + + mSynergyData. = value - - + + mSynergyData. = value - + mSynergyData. = value - + mSynergyData. = value - + mSynergyData. = value - - + mSynergyData. = value - - + endmethod ;// ;// End of field property @@ -321,7 +293,6 @@ namespace endproperty - .endregion ;// diff --git a/Templates/TraditionalBridge/OptionalParameterMethodDispatchers.tpl b/Templates/TraditionalBridge/OptionalParameterMethodDispatchers.tpl index b7d3dc26..f9a83609 100644 --- a/Templates/TraditionalBridge/OptionalParameterMethodDispatchers.tpl +++ b/Templates/TraditionalBridge/OptionalParameterMethodDispatchers.tpl @@ -131,7 +131,11 @@ namespace . arg, @ArrayList + + arg, D_HANDLE + arg, a + argPassed, boolean @@ -186,7 +190,7 @@ namespace . - RCBOutArgRCBArg( + , arguments[], FieldDataType.Field, arg, mRcbid, 0, argPassed) + RCBOutArgRCBArg( + , arguments[], FieldDataType.Field, ^a(arg), mRcbid, 0, argPassed) @@ -203,13 +207,21 @@ namespace . - RCBSerializeArg(, argPassed, FieldDataType.Field, arg, , 0, serializer) + RCBSerializeArg(, argPassed, FieldDataType.Field, ^a(arg), %mem_proc(DM_GETSIZE,arg), 0, serializer) end finally begin ;;Clear out the rcb handle to prevent a dangling pointer issue! + + + + + if (arg) + arg = %mem_proc(DM_FREE,arg) + + mRcbid = %rcb_create( + 1, DM_STATIC, mRcbid) end endtry @@ -218,4 +230,4 @@ namespace . endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/TraditionalBridge/TraditionalModel.tpl b/Templates/TraditionalBridge/TraditionalModel.tpl index 3278ea4b..265c49a4 100644 --- a/Templates/TraditionalBridge/TraditionalModel.tpl +++ b/Templates/TraditionalBridge/TraditionalModel.tpl @@ -1,6 +1,6 @@ .dbl TraditionalModel -5.4.6 +5.7.5 ;//**************************************************************************** ;// ;// Title: ODataModel.tpl @@ -85,7 +85,7 @@ namespace ;;; - ;;; + ;;; ;;; public property , method get @@ -138,4 +138,4 @@ namespace endclass -endnamespace \ No newline at end of file +endnamespace diff --git a/Templates/TypeScript/TypeScriptInterfaceClient.tpl b/Templates/TypeScript/TypeScriptInterfaceClient.tpl new file mode 100644 index 00000000..e1e30c51 --- /dev/null +++ b/Templates/TypeScript/TypeScriptInterfaceClient.tpl @@ -0,0 +1,36 @@ +Client.ts +5.8.5 +;// +;// This template generates TypeScript client exposing the methods +;// that are defined in a method catalog interface. +;// +;// To process this template, you must use the following CodeGen command line options: +;// +;// codegen -smc -interface +;// +/* + THIS CODE WAS CREATED BY A TOOL AND SHOULD NOT BE EDITED. + ANY CHANGES WILL BE OVERWRITTEN THE NEXT TIME THE TOOL IS USED! + + This code defines a client for the operations in the service "". +*/ + +import * as axios from './axios.js'; +import * as Methods from './Methods'; + +export class { + + instance: any; + + constructor(baseurl: string, jwt: string, tenant: string) + { + this.instance = axios.create({ baseURL: baseurl, timeout: 1000, headers: { 'x-tenant-id': tenant, 'Authorization': 'Bearer ' + jwt } }); + } + + + async (arg: Methods.Request): Promise<Methods.Response> + { + return this.instance.postget('', arg); + } + +} diff --git a/Templates/TypeScript/TypeScriptInterfaceMethods.tpl b/Templates/TypeScript/TypeScriptInterfaceMethods.tpl index 9c8a9e66..ee263372 100644 --- a/Templates/TypeScript/TypeScriptInterfaceMethods.tpl +++ b/Templates/TypeScript/TypeScriptInterfaceMethods.tpl @@ -1,5 +1,5 @@ Methods.ts -5.7.1 +5.8.5 ;// ;// This template generates TypeScript interfaces corresponding to the methods ;// that are defined in a method catalog interface. @@ -16,7 +16,7 @@ to the operations in the exposed service "". */ -import * as from './Structures'; +import * as Structures from './Structures'; //------------------------------------------------------------------------------ @@ -26,10 +26,10 @@ import * as from './Structures'; ;// REQUEST MODEL ;// -export interface _Request { +export interface Request { - : .; + : Structures.; } @@ -41,14 +41,14 @@ export interface _Request { ;// RESPONSE MODEL ;// -export interface _Response { +export interface Response { - ReturnValue: ; + rReturnValue: ; - : .; + : Structures.; diff --git a/Templates/TypeScript/TypeScriptInterfaceStructures.tpl b/Templates/TypeScript/TypeScriptInterfaceStructures.tpl index d6ffada5..977d504c 100644 --- a/Templates/TypeScript/TypeScriptInterfaceStructures.tpl +++ b/Templates/TypeScript/TypeScriptInterfaceStructures.tpl @@ -1,5 +1,5 @@ Structures.ts -5.7.1 +5.8.5 ;// ;// This template generates TypeScript interfaces corresponding to the data model classes ;// that are used for method parameter definitions in a method catalog. @@ -24,9 +24,9 @@ Stucture: Description: */ -export interface { +export interface { - : ; + : ; }