Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Feb 28, 2024
1 parent 9448e9f commit b121162
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 34 deletions.
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
"python.analysis.extraPaths": [
"src/clients/python-client"
],
"dotnet.defaultSolution": "Nexus.sln",
"julia.environmentPath": "/home/vincent/Dokumente/Git/GitHub/malstroem-labs/nexus"
"dotnet.defaultSolution": "Nexus.sln"
}
2 changes: 1 addition & 1 deletion src/Nexus.ClientGenerator/Nexus.ClientGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Apollo3zehn.OpenApiClientGenerator" Version="1.0.0-beta.6" />
<PackageReference Include="Apollo3zehn.OpenApiClientGenerator" Version="1.0.0-beta.8" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Nexus.UI/Core/NexusDemoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ public Task<string> GetHelpLinkAsync(CancellationToken cancellationToken = defau
return Task.FromResult("https://github.com/malstroem-labs/nexus");
}

public void SetConfiguration(IReadOnlyDictionary<string, JsonElement?>? configuration)
public void SetConfiguration(IReadOnlyDictionary<string, JsonElement>? configuration)
{
throw new NotImplementedException();
}

public Task SetConfigurationAsync(IReadOnlyDictionary<string, JsonElement?>? configuration, CancellationToken cancellationToken = default)
public Task SetConfigurationAsync(IReadOnlyDictionary<string, JsonElement>? configuration, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
Expand Down
8 changes: 4 additions & 4 deletions src/clients/dotnet-client/NexusClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2262,14 +2262,14 @@ public interface ISystemClient
/// Sets the system configuration.
/// </summary>
/// <param name="configuration"></param>
void SetConfiguration(IReadOnlyDictionary<string, JsonElement?>? configuration);
void SetConfiguration(IReadOnlyDictionary<string, JsonElement>? configuration);

/// <summary>
/// Sets the system configuration.
/// </summary>
/// <param name="configuration"></param>
/// <param name="cancellationToken">The token to cancel the current operation.</param>
Task SetConfigurationAsync(IReadOnlyDictionary<string, JsonElement?>? configuration, CancellationToken cancellationToken = default);
Task SetConfigurationAsync(IReadOnlyDictionary<string, JsonElement>? configuration, CancellationToken cancellationToken = default);

}

Expand Down Expand Up @@ -2344,7 +2344,7 @@ public Task<string> GetHelpLinkAsync(CancellationToken cancellationToken = defau
}

/// <inheritdoc />
public void SetConfiguration(IReadOnlyDictionary<string, JsonElement?>? configuration)
public void SetConfiguration(IReadOnlyDictionary<string, JsonElement>? configuration)
{
var __urlBuilder = new StringBuilder();
__urlBuilder.Append("/api/v1/system/configuration");
Expand All @@ -2354,7 +2354,7 @@ public void SetConfiguration(IReadOnlyDictionary<string, JsonElement?>? configur
}

/// <inheritdoc />
public Task SetConfigurationAsync(IReadOnlyDictionary<string, JsonElement?>? configuration, CancellationToken cancellationToken = default)
public Task SetConfigurationAsync(IReadOnlyDictionary<string, JsonElement>? configuration, CancellationToken cancellationToken = default)
{
var __urlBuilder = new StringBuilder();
__urlBuilder.Append("/api/v1/system/configuration");
Expand Down
50 changes: 25 additions & 25 deletions src/clients/python-client/nexus_api/_nexus_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ def decode(type: Type[T], data: Any, options: Optional[JsonEncoderOptions] = Non
def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T:

if data is None:
return typing.cast(T, None)
return cast(T, None)

if typeCls == Any:
return data

origin = typing.cast(Type, typing.get_origin(typeCls))
origin = typing.get_origin(typeCls)
args = typing.get_args(typeCls)

if origin is not None:
Expand All @@ -101,7 +101,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T:
baseType = args[0]
instance3 = JsonEncoder._decode(baseType, data, options)

return typing.cast(T, instance3)
return cast(T, instance3)

# list
elif issubclass(origin, list):
Expand All @@ -112,7 +112,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T:
for value in data:
instance1.append(JsonEncoder._decode(listType, value, options))

return typing.cast(T, instance1)
return cast(T, instance1)

# dict
elif issubclass(origin, dict):
Expand All @@ -125,7 +125,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T:
for key, value in data.items():
instance2[key] = JsonEncoder._decode(valueType, value, options)

return typing.cast(T, instance2)
return cast(T, instance2)

# default
else:
Expand All @@ -140,7 +140,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T:
for key, value in data.items():

key = options.property_name_decoder(key)
parameter_type = typing.cast(Type, type_hints.get(key))
parameter_type = cast(Type, type_hints.get(key))

if (parameter_type is not None):
value = JsonEncoder._decode(parameter_type, value, options)
Expand All @@ -159,7 +159,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T:
else:
parameters[key] = None

instance = typing.cast(T, typeCls(**parameters))
instance = cast(T, typeCls(**parameters))

return instance

Expand Down Expand Up @@ -952,7 +952,7 @@ def get_license(self, catalog_id: str) -> Awaitable[Optional[str]]:
__url = "/api/v1/catalogs/{catalogId}/license"
__url = __url.replace("{catalogId}", quote(str(catalog_id), safe=""))

return self.___client._invoke(Optional[str], "GET", __url, "application/json", None, None)
return self.___client._invoke(str, "GET", __url, "application/json", None, None)

def get_attachments(self, catalog_id: str) -> Awaitable[list[str]]:
"""
Expand Down Expand Up @@ -1344,9 +1344,9 @@ def get_configuration(self) -> Awaitable[Optional[dict[str, object]]]:

__url = "/api/v1/system/configuration"

return self.___client._invoke(Optional[dict[str, object]], "GET", __url, "application/json", None, None)
return self.___client._invoke(dict[str, object], "GET", __url, "application/json", None, None)

def set_configuration(self, configuration: Optional[dict[str, Optional[object]]]) -> Awaitable[None]:
def set_configuration(self, configuration: Optional[dict[str, object]]) -> Awaitable[None]:
"""
Sets the system configuration.
Expand Down Expand Up @@ -1733,7 +1733,7 @@ def get_license(self, catalog_id: str) -> Optional[str]:
__url = "/api/v1/catalogs/{catalogId}/license"
__url = __url.replace("{catalogId}", quote(str(catalog_id), safe=""))

return self.___client._invoke(Optional[str], "GET", __url, "application/json", None, None)
return self.___client._invoke(str, "GET", __url, "application/json", None, None)

def get_attachments(self, catalog_id: str) -> list[str]:
"""
Expand Down Expand Up @@ -2125,9 +2125,9 @@ def get_configuration(self) -> Optional[dict[str, object]]:

__url = "/api/v1/system/configuration"

return self.___client._invoke(Optional[dict[str, object]], "GET", __url, "application/json", None, None)
return self.___client._invoke(dict[str, object], "GET", __url, "application/json", None, None)

def set_configuration(self, configuration: Optional[dict[str, Optional[object]]]) -> None:
def set_configuration(self, configuration: Optional[dict[str, object]]) -> None:
"""
Sets the system configuration.
Expand Down Expand Up @@ -2602,7 +2602,7 @@ def clear_configuration(self) -> None:
if self._configuration_header_key in self._http_client.headers:
del self._http_client.headers[self._configuration_header_key]

async def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T:
async def _invoke(self, typeOfT: Optional[Type[T]], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T:

# prepare request
request = self._build_request_message(method, relative_url, content, content_type_value, accept_header_value)
Expand Down Expand Up @@ -2653,18 +2653,18 @@ async def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept
try:

if typeOfT is type(None):
return typing.cast(T, type(None))
return cast(T, type(None))

elif typeOfT is Response:
return typing.cast(T, response)
return cast(T, response)

else:

jsonObject = json.loads(response.text)
return_value = JsonEncoder.decode(typeOfT, jsonObject, _json_encoder_options)
return_value = JsonEncoder.decode(cast(Type[T], typeOfT), jsonObject, _json_encoder_options)

if return_value is None:
raise NexusException(f"N01", "Response data could not be deserialized.")
raise NexusException("N01", "Response data could not be deserialized.")

return return_value

Expand Down Expand Up @@ -3078,7 +3078,7 @@ def clear_configuration(self) -> None:
if self._configuration_header_key in self._http_client.headers:
del self._http_client.headers[self._configuration_header_key]

def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T:
def _invoke(self, typeOfT: Optional[Type[T]], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T:

# prepare request
request = self._build_request_message(method, relative_url, content, content_type_value, accept_header_value)
Expand Down Expand Up @@ -3129,18 +3129,18 @@ def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept_heade
try:

if typeOfT is type(None):
return typing.cast(T, type(None))
return cast(T, type(None))

elif typeOfT is Response:
return typing.cast(T, response)
return cast(T, response)

else:

jsonObject = json.loads(response.text)
return_value = JsonEncoder.decode(typeOfT, jsonObject, _json_encoder_options)
return_value = JsonEncoder.decode(cast(Type[T], typeOfT), jsonObject, _json_encoder_options)

if return_value is None:
raise NexusException(f"N01", "Response data could not be deserialized.")
raise NexusException("N01", "Response data could not be deserialized.")

return return_value

Expand Down Expand Up @@ -3179,12 +3179,12 @@ def _refresh_token(self, refresh_token: str):
with open(self._token_file_path, "w") as file:
file.write(token_pair.refresh_token)

authorization_header_value = f"Bearer {token_pair.access_token}"
authorizationHeaderValue = f"Bearer {token_pair.access_token}"

if self._authorization_header_key in self._http_client.headers:
del self._http_client.headers[self._authorization_header_key]

self._http_client.headers[self._authorization_header_key] = authorization_header_value
self._http_client.headers[self._authorization_header_key] = authorizationHeaderValue
self._token_pair = token_pair

finally:
Expand Down

0 comments on commit b121162

Please sign in to comment.