Skip to content

Commit 88dd694

Browse files
committed
Update existing tests
1 parent b00422f commit 88dd694

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponseOutcome.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,19 @@ extension TypesFileTranslator {
6868
let responseHasNoContent = typedResponse.response.content.isEmpty
6969
if responseHasNoContent && responseHasNoHeaders && !responseKind.wantsStatusCode {
7070
let staticMemberDesc = VariableDescription(
71-
accessModifier: .internal,
71+
accessModifier: config.access,
7272
isStatic: true,
7373
kind: .var,
7474
left: .identifier(.pattern(enumCaseName)),
7575
type: .member(["Self"]),
76-
right: .closureInvocation(body: [
77-
.expression(.functionCall(calledExpression: .dot(enumCaseName), arguments: [.dot("init")]))
78-
])
76+
getter: [
77+
.expression(
78+
.functionCall(
79+
calledExpression: .dot(enumCaseName),
80+
arguments: [.functionCall(calledExpression: .dot("init"))]
81+
)
82+
)
83+
]
7984
)
8085
staticMemberDecl = .commentable(enumCaseDocComment, .variable(staticMemberDesc))
8186
}

Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,6 +2279,14 @@ public enum Operations {
22792279
///
22802280
/// HTTP response code: `204 noContent`.
22812281
case noContent(Operations.createPetWithForm.Output.NoContent)
2282+
/// Successfully created pet using a url form
2283+
///
2284+
/// - Remark: Generated from `#/paths//pets/create/post(createPetWithForm)/responses/204`.
2285+
///
2286+
/// HTTP response code: `204 noContent`.
2287+
public static var noContent: Self {
2288+
.noContent(.init())
2289+
}
22822290
/// The associated value of the enum case if `self` is `.noContent`.
22832291
///
22842292
/// - Throws: An error if `self` is not `.noContent`.
@@ -2499,6 +2507,14 @@ public enum Operations {
24992507
///
25002508
/// HTTP response code: `202 accepted`.
25012509
case accepted(Operations.postStats.Output.Accepted)
2510+
/// Accepted data.
2511+
///
2512+
/// - Remark: Generated from `#/paths//pets/stats/post(postStats)/responses/202`.
2513+
///
2514+
/// HTTP response code: `202 accepted`.
2515+
public static var accepted: Self {
2516+
.accepted(.init())
2517+
}
25022518
/// The associated value of the enum case if `self` is `.accepted`.
25032519
///
25042520
/// - Throws: An error if `self` is not `.accepted`.
@@ -2541,6 +2557,14 @@ public enum Operations {
25412557
///
25422558
/// HTTP response code: `204 noContent`.
25432559
case noContent(Operations.probe.Output.NoContent)
2560+
/// Ack
2561+
///
2562+
/// - Remark: Generated from `#/paths//probe//post(probe)/responses/204`.
2563+
///
2564+
/// HTTP response code: `204 noContent`.
2565+
public static var noContent: Self {
2566+
.noContent(.init())
2567+
}
25442568
/// The associated value of the enum case if `self` is `.noContent`.
25452569
///
25462570
/// - Throws: An error if `self` is not `.noContent`.
@@ -2626,6 +2650,14 @@ public enum Operations {
26262650
///
26272651
/// HTTP response code: `204 noContent`.
26282652
case noContent(Operations.updatePet.Output.NoContent)
2653+
/// Successfully updated
2654+
///
2655+
/// - Remark: Generated from `#/paths//pets/{petId}/patch(updatePet)/responses/204`.
2656+
///
2657+
/// HTTP response code: `204 noContent`.
2658+
public static var noContent: Self {
2659+
.noContent(.init())
2660+
}
26292661
/// The associated value of the enum case if `self` is `.noContent`.
26302662
///
26312663
/// - Throws: An error if `self` is not `.noContent`.
@@ -3098,6 +3130,14 @@ public enum Operations {
30983130
///
30993131
/// HTTP response code: `202 accepted`.
31003132
case accepted(Operations.multipartUploadTyped.Output.Accepted)
3133+
/// Successfully accepted the data.
3134+
///
3135+
/// - Remark: Generated from `#/paths//pets/multipart-typed/post(multipartUploadTyped)/responses/202`.
3136+
///
3137+
/// HTTP response code: `202 accepted`.
3138+
public static var accepted: Self {
3139+
.accepted(.init())
3140+
}
31013141
/// The associated value of the enum case if `self` is `.accepted`.
31023142
///
31033143
/// - Throws: An error if `self` is not `.accepted`.

0 commit comments

Comments
 (0)