Skip to content

Commit f4f0f12

Browse files
Michael BrowneMichael Browne
Michael Browne
authored and
Michael Browne
committed
v1.0.9 updates
1 parent 2586276 commit f4f0f12

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

Diff for: RELEASENOTES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# MATLAB Generator *for OpenAPI*
22

3+
## Version 1.0.9 (October 27th 2023)
4+
5+
* Correctly set package version in file header when using the MATLAB client
6+
* Added support for package names containing periods when using the MATLAB client
7+
* Minor improvement to copyright string handling
8+
39
## Version 1.0.8 (October 26th 2023)
410

511
* Minor bug fix to Client error message handling

Diff for: Software/MATLAB/app/system/+openapi/+build/@Client/Client.m

+25-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
end
5252

5353
if isempty(obj.additionalProperties) && isa(obj.additionalProperties, 'double')
54-
obj.additionalProperties = containers.Map();
54+
obj.additionalProperties = containers.Map({'packageVersion'}, {obj.getPackageVersion});
5555
end
5656
if ~isa(obj.additionalProperties, 'containers.Map')
5757
error('Client:Client', 'Expected additionalProperties property to be a containers.Map, not: %s', class(obj.additionalProperties));
@@ -71,11 +71,16 @@
7171
name string {mustBeTextScalar, mustBeNonzeroLengthText}
7272
end
7373

74-
[newName, modified] = matlab.lang.makeValidName(name);
75-
if modified
76-
fprintf("Warning: Invalid packageName: %s, changing to: %s\n", name, newName);
74+
% Allow for package names that have "." in them
75+
nfields = split(name, '.');
76+
for m = 1:numel(nfields)
77+
[newName, modified] = matlab.lang.makeValidName(nfields(m));
78+
if modified
79+
fprintf("Warning: Invalid packageName: %s, changing to: %s\n", nfields(m), newName);
80+
nfields(m) = newName;
81+
end
7782
end
78-
obj.packageName = newName;
83+
obj.packageName = join(nfields, '.');
7984
end
8085

8186
function obj = build(obj)
@@ -144,7 +149,7 @@
144149
[tf, reportOut] = openapi.verifyPackage(obj.output, 'mode', options.mode, 'ignoredChecks', options.ignoredChecks);
145150
end
146151

147-
152+
148153
function set.templateDir(obj, templateDir)
149154
arguments
150155
obj (1,1) openapi.build.Client
@@ -257,7 +262,7 @@
257262
copyrightNotice string {mustBeTextScalar}
258263
end
259264

260-
if ~startsWith(copyrightNotice, whitespacePattern + "%")
265+
if ~startsWith(copyrightNotice, whitespacePattern(0,inf) + "%")
261266
copyrightNotice = "% " + copyrightNotice;
262267
end
263268
obj.copyrightNotice = copyrightNotice;
@@ -909,5 +914,18 @@ function buildAdditionalPropertiesFileEntry(obj)
909914
tf = false;
910915
end
911916
end
917+
918+
function V = getPackageVersion()
919+
% getPackageVersion Return version of the package from the VERSION file
920+
% A character vector is returned
921+
verFile = fullfile(openapiRoot(-2), 'VERSION');
922+
if ~isfile(verFile)
923+
V = '1.0.0';
924+
warning('Client:getPackageVersion','VERSION file not found: %s, using version 1.0.0', verFile, V);
925+
else
926+
V = char(strip(string(fileread(verFile))));
927+
end
928+
end
929+
912930
end
913931
end %class

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.8
1+
1.0.9

0 commit comments

Comments
 (0)