You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble making calls to the API when the endpoint directly uses an optional enum query parameter.
I have followed this section of the docs, but am running into issues which do not seem to be covered.
I have created a minimal openapi.json as shown below. This API has one endpoint, /data/ which takes one query parameter unit_system, which is allowed to be either "SI" or "FPS" - or it can be null.
After this, I run into issues when querying. The output below demonstrates trying to call the endpoint in a number of different ways. All of these fail on the Matlab side before even attempting to communicate with the API.
Am I making a mistake, or is this somehow an edge case that is currently not working?
Errors when attempting to use the generated enum models
>> client = exampleclient.api.Default(serverUri="http://localhost:8000")
client =
Default with properties:
serverUri: [1×1 matlab.net.URI]
httpOptions: [1×1 matlab.net.http.HTTPOptions]
preferredAuthMethod: [0×0 string]
bearerToken: '<unset>'
apiKey: '<unset>'
httpCredentials: '<unset>'
cookies: [1×1 exampleclient.CookieJar]
>> client.getData(unit_system="SI")
Error using matlab.net.QueryParameter>convert
Unable to convert the value of the query parameter
"unit_system" of type exampleclient.models.Unit_System
to a string.
Error in matlab.net.QueryParameter/string (line 351)
values = convert(obj.Name, value, obj.Literal);
Error in matlab.net.URI/string (line 673)
query = '?' + string(obj.Query);
Error in matlab.net.URI/char (line 696)
str = string(obj);
Error in matlab.net.http.RequestMessage>getProxySettings (line 2133)
proxyInfo = matlab.internal.webservices.getProxyInfo(char(uri));
Error in matlab.net.http.RequestMessage/send (line 405)
[proxyURI, username, password] = getProxySettings(createURIFromInput(uri));
Error in exampleclient.api.Default/getData (line 175)
[response, ~, history] = send(request, uri, httpOptions);>> client.getData(unit_system=exampleclient.models.UnitSystem.SI)
Error using exampleclient.api.Default/getData
client.getData(unit_system=exampleclient.models.UnitSystem.SI)
↑
Invalid value for'unit_system' argument. Value must be of type exampleclient.models.Unit_System or be convertible
to exampleclient.models.Unit_System.
>> client.getData(unit_system=exampleclient.models.Unit_System("SI"))
Error using matlab.net.QueryParameter>convert
Unable to convert the value of the query parameter "unit_system" of type exampleclient.models.Unit_System to a
string.
Error in matlab.net.QueryParameter/string (line 351)
values = convert(obj.Name, value, obj.Literal);
Error in matlab.net.URI/string (line 673)
query = '?' + string(obj.Query);
Error in matlab.net.URI/char (line 696)
str = string(obj);
Error in matlab.net.http.RequestMessage>getProxySettings (line 2133)
proxyInfo = matlab.internal.webservices.getProxyInfo(char(uri));
Error in matlab.net.http.RequestMessage/send (line 405)
[proxyURI, username, password] = getProxySettings(createURIFromInput(uri));
Error in exampleclient.api.Default/getData (line 175)
[response, ~, history] = send(request, uri, httpOptions);
The text was updated successfully, but these errors were encountered:
Thanks for the report. I've not been able to replicate this exactly I see a different issue...
Could I ask you to share the output of the npx @openapitools/openapi-generator-cli version command please.
Also we've not qualified the package with 3.1.0 support yet and know of some issues, could you change the spec to use 3.0.0 (line #2 of the spec) and see how that goes as a quick test.
I am having trouble making calls to the API when the endpoint directly uses an optional enum query parameter.
I have followed this section of the docs, but am running into issues which do not seem to be covered.
I have created a minimal
openapi.json
as shown below. This API has one endpoint,/data/
which takes one query parameterunit_system
, which is allowed to be either"SI"
or"FPS"
- or it can benull
.openapi.json
I generate the client code via:
This generates the following tree:
After this, I run into issues when querying. The output below demonstrates trying to call the endpoint in a number of different ways. All of these fail on the Matlab side before even attempting to communicate with the API.
Am I making a mistake, or is this somehow an edge case that is currently not working?
Errors when attempting to use the generated enum models
The text was updated successfully, but these errors were encountered: