Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,13 @@ private String setUniquePropertyName(CodegenModel model, CodegenProperty propert
return value;
}

/**
* Fixes nested maps so the generic type is defined
* Convertes List<List>> to List<List<T>>
/**
* Ensures property name is unique and not a reserved word.
* @param model
* @param property
* @param value
* @param composedPropertyNames
* @return
*/
private String patchPropertyName(CodegenModel model, CodegenProperty property, String value, Set<String> composedPropertyNames) {
value = setUniquePropertyName(model, property, value);
Expand Down Expand Up @@ -792,6 +796,10 @@ private void patchPropertyVendorExtensions(CodegenProperty property) {
protected void patchPropertyIsInherited(CodegenModel model, CodegenProperty property) {
}

/**
* Fixes nested maps so the generic type is defined
* Convertes List<List>> to List<List<T>>
*/
private void patchNestedMaps(CodegenProperty property) {
// Process nested types before making any replacements to ensure we have the correct inner type
if (property.items != null) {
Expand Down Expand Up @@ -823,6 +831,41 @@ private void patchNestedMaps(CodegenProperty property) {
}
}

/**
* Fixes nested maps so the generic type is defined
* Convertes List<List>> to List<List<T>>
*/
private void patchNestedMaps(CodegenResponse response) {
// Process nested types before making any replacements to ensure we have the correct inner type
if (response.items != null) {
patchNestedMaps(response.items);
}

String[] nestedTypes = {"List", "Collection", "ICollection", "Dictionary"};

if (response.dataType != null) {
String originalType = response.dataType;

for (String nestedType : nestedTypes) {
// fix incorrect data types for maps of maps
if (response.items != null) {
if (response.dataType.contains(", " + nestedType + ">")) {
response.dataType = response.dataType.replace(", " + nestedType + ">", ", " + response.items.datatypeWithEnum + ">");
}

if (response.dataType.contains("<" + nestedType + ">")) {
response.dataType = response.dataType.replace("<" + nestedType + ">", "<" + response.items.datatypeWithEnum + ">");
}
}
}

// Only update dataType if we actually made changes
if (!originalType.equals(response.dataType)) {
response.dataType = response.dataType;
}
}
}

protected void patchProperty(Map<String, CodegenModel> enumRefs, CodegenModel model, CodegenProperty property) {
if (enumRefs.containsKey(property.dataType)) {
// Handle any enum properties referred to by $ref.
Expand Down Expand Up @@ -960,6 +1003,7 @@ private void postProcessOperations(OperationMap operations, List<ModelMap> allMo
}
if (operation.responses != null) {
for (CodegenResponse response : operation.responses) {
patchNestedMaps(response);

if (response.returnProperty != null) {
Boolean isValueType = isValueType(response.returnProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1495,11 +1495,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List> Ok()
public List<List<RolesReportsHash>> Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: default;
}

Expand All @@ -1508,7 +1508,7 @@ public List<List> Ok()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk(out List<List> result)
public bool TryOk(out List<List<RolesReportsHash>> result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1495,11 +1495,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List> Ok()
public List<List<RolesReportsHash>> Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: default;
}

Expand All @@ -1508,7 +1508,7 @@ public List<List> Ok()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk(out List<List> result)
public bool TryOk(out List<List<RolesReportsHash>> result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1495,11 +1495,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List> Ok()
public List<List<RolesReportsHash>> Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: default;
}

Expand All @@ -1508,7 +1508,7 @@ public List<List> Ok()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk(out List<List> result)
public bool TryOk(out List<List<RolesReportsHash>> result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1495,11 +1495,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List> Ok()
public List<List<RolesReportsHash>> Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: default;
}

Expand All @@ -1508,7 +1508,7 @@ public List<List> Ok()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk(out List<List> result)
public bool TryOk(out List<List<RolesReportsHash>> result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1499,11 +1499,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List> Ok()
public List<List<RolesReportsHash>> Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: null;
}

Expand All @@ -1512,7 +1512,7 @@ public List<List> Ok()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk([NotNullWhen(true)]out List<List> result)
public bool TryOk([NotNullWhen(true)]out List<List<RolesReportsHash>> result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>?>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>?>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1501,11 +1501,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List>? Ok()
public List<List<RolesReportsHash>>? Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: null;
}

Expand All @@ -1514,7 +1514,7 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk([NotNullWhen(true)]out List<List>? result)
public bool TryOk([NotNullWhen(true)]out List<List<RolesReportsHash>>? result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiRes
/// <summary>
/// The <see cref="IRolesReportGetApiResponse"/>
/// </summary>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List>>
public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk<List<List<RolesReportsHash>>>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand Down Expand Up @@ -1499,11 +1499,11 @@ public RolesReportGetApiResponse(ILogger<RolesReportGetApiResponse> logger, Syst
/// Deserializes the response if the response is 200 Ok
/// </summary>
/// <returns></returns>
public List<List> Ok()
public List<List<RolesReportsHash>> Ok()
{
// This logic may be modified with the AsModel.mustache template
return IsOk
? System.Text.Json.JsonSerializer.Deserialize<List<List>>(RawContent, _jsonSerializerOptions)
? System.Text.Json.JsonSerializer.Deserialize<List<List<RolesReportsHash>>>(RawContent, _jsonSerializerOptions)
: null;
}

Expand All @@ -1512,7 +1512,7 @@ public List<List> Ok()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryOk([NotNullWhen(true)]out List<List> result)
public bool TryOk([NotNullWhen(true)]out List<List<RolesReportsHash>> result)
{
result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
Assert.IsType<List<List>>(model);
Assert.IsType<List<List<RolesReportsHash>>>(model);
}

/// <summary>
Expand Down
Loading
Loading