Skip to content

Commit

Permalink
fix: Try to use response with schema for Success response if it there.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Nov 13, 2024
1 parent beba4f9 commit dd676ab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/libs/AutoSDK/Models/EndPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ public static EndPoint FromSchema(OperationContext operation)
Path: preparedPath,
RequestMediaType: requestMediaType,
Parameters: parameters.ToImmutableArray(),
SuccessResponse: responses.Any(x => x.Is2XX)
? responses.First(x => x.Is2XX)
: responses.Any(x => x.IsDefault)
? responses.First(x => x.IsDefault)
: EndPointResponse.Default,
SuccessResponse: responses.Any(x => x.Is2XX && !string.IsNullOrWhiteSpace(x.Type.CSharpTypeRaw))
? responses.First(x => x.Is2XX && !string.IsNullOrWhiteSpace(x.Type.CSharpTypeRaw))
: responses.Any(x => x.Is2XX)
? responses.First(x => x.Is2XX)
: responses.Any(x => x.IsDefault)
? responses.First(x => x.IsDefault)
: EndPointResponse.Default,
ErrorResponses: responses.Where(x => !x.Is2XX).ToImmutableArray(),
QueryParameters: queryParameters.ToImmutableArray(),
Authorizations: authorizations,
Expand Down

0 comments on commit dd676ab

Please sign in to comment.