Skip to content

Commit f7c1116

Browse files
committed
Fixes issue with non-string path parameters
1 parent e37f31c commit f7c1116

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

RELEASENOTES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# MATLAB Generator *for OpenAPI*
22

3+
## Version 3.0.3 (September 26th 2025)
4+
5+
* Fixes issue with non-string path parameters.
6+
37
## Version 3.0.2 (September 24th 2025)
48

5-
* Fixes issue where the data type of enum fields were not set correctly.
9+
* Fixes issue where the data type of enum fields was not set correctly.
610

711
## Version 3.0.1 (August 25th 2025)
812

Software/MATLAB/test/unit/invokeTests.m

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,27 @@ function testIntegersApi(testCase)
3232
testCase.verifyEqual(r.u64,uint64(18446744073709551614));
3333
testCase.verifyEqual(r.b,true);
3434
end
35+
36+
function testPathParameters(testCase)
37+
client = Test.api.App;
38+
% Standard string parameter
39+
[c,r] = client.apppathMessage("Hello World");
40+
testCase.verifyEqual(c,matlab.net.http.StatusCode.OK);
41+
testCase.verifyClass(r,'Test.models.HelloMessage');
42+
testCase.verifyEqual(r.message, "Hello World");
43+
% Logical/boolean parameter
44+
% Most importantly test that the next line does not error out
45+
[c,r] = client.apppathBool(true);
46+
% For good measure also verify the actual return value
47+
testCase.verifyEqual(c,matlab.net.http.StatusCode.OK);
48+
testCase.verifyClass(r,'Test.models.HelloMessage');
49+
testCase.verifyEqual(r.message, "state is true");
50+
% Numeric parameter
51+
[c,r] = client.apppathNumber(42);
52+
testCase.verifyEqual(c,matlab.net.http.StatusCode.OK);
53+
testCase.verifyClass(r,'Test.models.HelloMessage');
54+
testCase.verifyEqual(r.message, "num is 42");
55+
56+
end
3557
end
3658
end

Software/Mustache/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ classdef {{classname}} < {{packageName}}.BaseClient
158158
uri.EncodedPath = uri.EncodedPath + "{{path}}";
159159

160160
{{^pathParams}}% No path parameters{{/pathParams}}{{#pathParams}}{{#-first}}% Substitute path parameters{{/-first}}
161-
uri.Path = replace(uri.Path, "{" + "{{baseName}}" + "}", {{>paramName}});{{/pathParams}}
161+
uri.Path = replace(uri.Path, "{" + "{{baseName}}" + "}", string({{>paramName}}));{{/pathParams}}
162162

163163
{{^queryParams}}% No query parameters{{/queryParams}}{{#queryParams}}{{#-first}}% Set query parameters{{/-first}}{{#required}}
164164
uri.Query(end+1) = matlab.net.QueryParameter("{{baseName}}", {{>paramName}}{{#isCollectionFormatMulti}}, matlab.net.ArrayFormat.repeating{{/isCollectionFormatMulti}});{{/required}}{{^required}}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.2
1+
3.0.3

0 commit comments

Comments
 (0)