From b59b8a32f3c9fb8b9df1ec95a8e1b35741a963bb Mon Sep 17 00:00:00 2001 From: takeshi-1000 Date: Thu, 17 Aug 2023 19:10:33 +0900 Subject: [PATCH] Emit JSON path reference in comments for all generated types (#196) ### Motivation Resolve #13 ### Modifications Applied commentable to the declaration variable in Traslator so that a comment in Types.swift is added indicating that it was generated from the Json path of the openapi document ### Result Some comments in Types.swift is generated, like `Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift`. ### Test Plan Modify Type.swift in the reference source --------- Co-authored-by: Honza Dvorsky --- .../CommonTypes/CommentExtensions.swift | 41 +++++++ .../Translator/Content/ContentType.swift | 8 ++ .../Operations/OperationDescription.swift | 5 +- .../Parameters/translateParameter.swift | 1 + .../RequestBody/TypedRequestBody.swift | 3 +- .../RequestBody/translateRequestBody.swift | 19 +++- .../Translator/Responses/ResponseKind.swift | 5 +- .../Responses/translateResponse.swift | 51 ++++++--- .../Responses/translateResponseHeader.swift | 10 +- .../Translator/TypeAssignment/TypeName.swift | 4 +- .../TypesTranslator/translateOperations.swift | 17 +-- .../ReferenceSources/Petstore/Types.swift | 104 ++++++++++++++++-- .../Types.swift | 104 +++++++++++++++++- 13 files changed, 320 insertions(+), 52 deletions(-) diff --git a/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/CommentExtensions.swift b/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/CommentExtensions.swift index 305c45dd..b35829a2 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/CommentExtensions.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/CommentExtensions.swift @@ -96,6 +96,23 @@ extension TypeName { suffix: generatedFromCommentText ) } + + /// Returns a documentation comment by appending the "generated from" + /// string to the specified user description. + /// + /// The "generated from" string also includes a subpath. + /// - Parameter userDescription: The description specified by the user. + /// - Parameter subPath: A subpath appended to the JSON path of this + /// type name. + func docCommentWithUserDescription(_ userDescription: String?, subPath: String) -> Comment? { + guard let fullyQualifiedJSONPath else { + return Comment.doc(prefix: userDescription, suffix: nil) + } + return Comment.doc( + prefix: userDescription, + suffix: "- Remark: Generated from `\(fullyQualifiedJSONPath)/\(subPath)`." + ) + } } extension ResponseKind { @@ -131,6 +148,30 @@ extension ResponseKind { } } +extension TypedParameter { + /// Returns a documentation comment for the parameter. + /// - Parameters: + /// - parent: The parent type of the parameter. + func docComment(parent: TypeName) -> Comment? { + parent.docCommentWithUserDescription( + nil, + subPath: "\(parameter.location.rawValue)/\(parameter.name)" + ) + } +} + +extension ContentType { + /// Returns a documentation comment for the content type. + /// - Parameters: + /// - typeName: The type name of the content. + func docComment(typeName: TypeName) -> Comment? { + typeName.docCommentWithUserDescription( + nil, + subPath: lowercasedTypeAndSubtypeWithEscape + ) + } +} + extension Comment { /// Returns a reference documentation string to attach to the generated function for an operation. diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentType.swift b/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentType.swift index c125463d..5b29ce76 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentType.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Content/ContentType.swift @@ -143,6 +143,14 @@ struct ContentType: Hashable { "\(lowercasedType)/\(lowercasedSubtype)" } + /// Returns the type and subtype as a "\/" string. + /// + /// Lowercased to ease case-insensitive comparisons, and escaped to show + /// that the slash between type and subtype is not a path separator. + var lowercasedTypeAndSubtypeWithEscape: String { + "\(lowercasedType)\\/\(lowercasedSubtype)" + } + /// The header value used when sending a content-type header. var headerValueForSending: String { guard case .json = category else { diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Operations/OperationDescription.swift b/Sources/_OpenAPIGeneratorCore/Translator/Operations/OperationDescription.swift index b21f63fc..19aedf6e 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Operations/OperationDescription.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Operations/OperationDescription.swift @@ -137,10 +137,7 @@ extension OperationDescription { var outputTypeName: TypeName { operationNamespace.appending( swiftComponent: Constants.Operation.Output.typeName, - - // intentionally nil, we'll append the specific params etc - // with their valid JSON key path when nested inside Output - jsonComponent: nil + jsonComponent: "responses" ) } diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Parameters/translateParameter.swift b/Sources/_OpenAPIGeneratorCore/Translator/Parameters/translateParameter.swift index 4a125508..571e9936 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Parameters/translateParameter.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Parameters/translateParameter.swift @@ -44,6 +44,7 @@ extension TypesFileTranslator { associatedDeclarations = [] } return .init( + comment: parameter.docComment(parent: parent), isDeprecated: parameter.parameter.deprecated, originalName: parameter.name, typeUsage: parameter.typeUsage, diff --git a/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/TypedRequestBody.swift b/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/TypedRequestBody.swift index e61abe24..3a2a3266 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/TypedRequestBody.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/TypedRequestBody.swift @@ -64,7 +64,8 @@ extension FileTranslator { type = try typeAssigner.typeName(for: reference) case .b: type = parent.appending( - swiftComponent: Constants.Operation.Body.typeName + swiftComponent: Constants.Operation.Body.typeName, + jsonComponent: "requestBody" ) } return try typedRequestBody( diff --git a/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/translateRequestBody.swift b/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/translateRequestBody.swift index d77a4125..54df348e 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/translateRequestBody.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/RequestBody/translateRequestBody.swift @@ -44,6 +44,8 @@ extension TypesFileTranslator { for requestBody: TypedRequestBody ) throws -> [Declaration] { var bodyMembers: [Declaration] = [] + let typeName = requestBody.typeUsage.typeName + let contentTypeName = typeName.appending(jsonComponent: "content") let contents = requestBody.contents for content in contents { if TypeMatcher.isInlinable(content.content.schema) { @@ -52,10 +54,12 @@ extension TypesFileTranslator { ) bodyMembers.append(contentsOf: inlineTypeDecls) } - let identifier = contentSwiftName(content.content.contentType) + let contentType = content.content.contentType + let identifier = contentSwiftName(contentType) let associatedType = content.resolvedTypeUsage - let contentCase: Declaration = .enumCase( - .init( + let contentCase: Declaration = .commentable( + contentType.docComment(typeName: contentTypeName), + .enumCase( name: identifier, kind: .nameWithAssociatedValues([ .init(type: associatedType.fullyQualifiedNonOptionalSwiftName) @@ -99,7 +103,8 @@ extension TypesFileTranslator { } else { isRequestBodyOptional = true bodyEnumTypeName = parent.appending( - swiftComponent: Constants.Operation.Body.typeName + swiftComponent: Constants.Operation.Body.typeName, + jsonComponent: "requestBody" ) extraDecls = [ translateRequestBodyInTypes( @@ -154,7 +159,11 @@ extension TypesFileTranslator { conformances: Constants.Operation.Output.conformances, members: members ) - return bodyEnumDecl + let comment: Comment? = typeName.docCommentWithUserDescription(nil) + return .commentable( + comment, + bodyEnumDecl + ) } } diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Responses/ResponseKind.swift b/Sources/_OpenAPIGeneratorCore/Translator/Responses/ResponseKind.swift index c292e549..a87f516f 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Responses/ResponseKind.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Responses/ResponseKind.swift @@ -181,7 +181,10 @@ enum ResponseKind { /// Returns a new type name that appends the response's Swift name to /// the specified parent type name. func typeName(in parent: TypeName) -> TypeName { - parent.appending(swiftComponent: prettyName.uppercasingFirstLetter) + parent.appending( + swiftComponent: prettyName.uppercasingFirstLetter, + jsonComponent: jsonPathComponent + ) } } diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponse.swift b/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponse.swift index 60c73831..0003ea46 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponse.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponse.swift @@ -23,21 +23,26 @@ extension TypesFileTranslator { typeName: TypeName, response: TypedResponse ) throws -> Declaration { - let response = response.response - let headersTypeName = typeName.appending( - swiftComponent: Constants.Operation.Output.Payload.Headers.typeName + swiftComponent: Constants.Operation.Output.Payload.Headers.typeName, + jsonComponent: "headers" ) let headers = try typedResponseHeaders( from: response, inParent: headersTypeName ) let headerProperties: [PropertyBlueprint] = try headers.map { header in - try parseResponseHeaderAsProperty(for: header) + try parseResponseHeaderAsProperty( + for: header, + parent: headersTypeName + ) } + let headerStructComment: Comment? = + headersTypeName + .docCommentWithUserDescription(nil) let headersStructBlueprint: StructBlueprint = .init( - comment: nil, + comment: headerStructComment, access: config.access, typeName: headersTypeName, conformances: Constants.Operation.Output.Payload.Headers.conformances, @@ -58,7 +63,8 @@ extension TypesFileTranslator { ) let bodyTypeName = typeName.appending( - swiftComponent: Constants.Operation.Body.typeName + swiftComponent: Constants.Operation.Body.typeName, + jsonComponent: "content" ) let typedContents = try supportedTypedContents( response.content, @@ -66,7 +72,8 @@ extension TypesFileTranslator { ) var bodyCases: [Declaration] = [] for typedContent in typedContents { - let identifier = contentSwiftName(typedContent.content.contentType) + let contentType = typedContent.content.contentType + let identifier = contentSwiftName(contentType) let associatedType = typedContent.resolvedTypeUsage if TypeMatcher.isInlinable(typedContent.content.schema), let inlineType = typedContent.typeUsage { let inlineTypeDecls = try translateSchema( @@ -76,22 +83,30 @@ extension TypesFileTranslator { ) bodyCases.append(contentsOf: inlineTypeDecls) } - let bodyCase: Declaration = .enumCase( - name: identifier, - kind: .nameWithAssociatedValues([ - .init(type: associatedType.fullyQualifiedSwiftName) - ]) + + let bodyCase: Declaration = .commentable( + contentType.docComment(typeName: bodyTypeName), + .enumCase( + name: identifier, + kind: .nameWithAssociatedValues([ + .init(type: associatedType.fullyQualifiedSwiftName) + ]) + ) ) bodyCases.append(bodyCase) } let hasNoContent: Bool = bodyCases.isEmpty - let contentEnumDecl: Declaration = .enum( - isFrozen: true, - accessModifier: config.access, - name: bodyTypeName.shortSwiftName, - conformances: Constants.Operation.Body.conformances, - members: bodyCases + let contentEnumDecl: Declaration = .commentable( + bodyTypeName.docCommentWithUserDescription(nil), + .enum( + isFrozen: true, + accessModifier: config.access, + name: bodyTypeName.shortSwiftName, + conformances: Constants.Operation.Body.conformances, + members: bodyCases + ) ) + let contentTypeUsage = bodyTypeName.asUsage.withOptional(hasNoContent) let contentProperty = PropertyBlueprint( comment: .doc("Received HTTP response body"), diff --git a/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponseHeader.swift b/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponseHeader.swift index 2b4543d9..f8a79bae 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponseHeader.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/Responses/translateResponseHeader.swift @@ -20,12 +20,18 @@ extension TypesFileTranslator { /// /// - Parameters: /// - header: A response parameter. + /// - parent: The type name of the parent struct. /// - Returns: A property blueprint. func parseResponseHeaderAsProperty( - for header: TypedResponseHeader + for header: TypedResponseHeader, + parent: TypeName ) throws -> PropertyBlueprint { + let comment = parent.docCommentWithUserDescription( + nil, + subPath: header.name + ) return .init( - comment: nil, + comment: comment, originalName: header.name, typeUsage: header.typeUsage, default: header.header.required ? nil : .nil, diff --git a/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeName.swift b/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeName.swift index c1505b21..f3bd6b3e 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeName.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeName.swift @@ -112,8 +112,10 @@ struct TypeName: Equatable { /// - Parameters: /// - swiftComponent: The name of the Swift type component. /// - jsonComponent: The name of the JSON path component. + /// - Precondition: At least one of the components must be non-nil. /// - Returns: A new type name. - func appending(swiftComponent: String, jsonComponent: String? = nil) -> Self { + func appending(swiftComponent: String? = nil, jsonComponent: String? = nil) -> Self { + precondition(swiftComponent != nil || jsonComponent != nil, "At least the Swift or JSON name must be non-nil.") let newComponent = Component(swift: swiftComponent, json: jsonComponent) return .init(components: components + [newComponent]) } diff --git a/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateOperations.swift b/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateOperations.swift index 88521b64..6503fe50 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateOperations.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/TypesTranslator/translateOperations.swift @@ -36,13 +36,16 @@ extension TypesFileTranslator { inParent: inputTypeName ) } - let structDecl: Declaration = translateStructBlueprint( - .init( - comment: nil, - access: config.access, - typeName: structTypeName, - conformances: Constants.Operation.Input.conformances, - properties: structProperties + let structDecl: Declaration = .commentable( + structTypeName.docCommentWithUserDescription(nil), + translateStructBlueprint( + .init( + comment: nil, + access: config.access, + typeName: structTypeName, + conformances: Constants.Operation.Input.conformances, + properties: structProperties + ) ) ) diff --git a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift index b004b52c..81ef17f8 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift +++ b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift @@ -636,6 +636,7 @@ public enum Components { } /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. public enum RequestBodies { + /// - Remark: Generated from `#/components/requestBodies/UpdatePetRequest`. @frozen public enum UpdatePetRequest: Sendable, Equatable, Hashable { /// - Remark: Generated from `#/components/requestBodies/UpdatePetRequest/json`. public struct jsonPayload: Codable, Equatable, Hashable, Sendable { @@ -666,13 +667,16 @@ public enum Components { case tag } } + /// - Remark: Generated from `#/components/requestBodies/UpdatePetRequest/content/application\/json`. case json(Components.RequestBodies.UpdatePetRequest.jsonPayload) } } /// Types generated from the `#/components/responses` section of the OpenAPI document. public enum Responses { public struct ErrorBadRequest: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/headers`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/headers/X-Reason`. public var X_Reason: Swift.String? /// Creates a new `Headers`. /// @@ -682,10 +686,11 @@ public enum Components { } /// Received HTTP response headers public var headers: Components.Responses.ErrorBadRequest.Headers + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content`. @frozen public enum Body: Sendable, Equatable, Hashable { - /// - Remark: Generated from `#/components/responses/ErrorBadRequest/json`. + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content/json`. public struct jsonPayload: Codable, Equatable, Hashable, Sendable { - /// - Remark: Generated from `#/components/responses/ErrorBadRequest/json/code`. + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content/json/code`. public var code: Swift.Int /// Creates a new `jsonPayload`. /// @@ -694,6 +699,7 @@ public enum Components { public init(code: Swift.Int) { self.code = code } public enum CodingKeys: String, CodingKey { case code } } + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content/application\/json`. case json(Components.Responses.ErrorBadRequest.Body.jsonPayload) } /// Received HTTP response body @@ -730,12 +736,15 @@ public enum Operations { public enum listPets { public static let id: String = "listPets" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.listPets.Input.Path + /// - Remark: Generated from `#/paths/pets/GET/query`. public struct Query: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/query/limit`. public var limit: Swift.Int32? /// - Remark: Generated from `#/paths/pets/GET/query/habitat`. @frozen @@ -768,6 +777,7 @@ public enum Operations { } public static var allCases: [habitatPayload] { [.water, .land, .air, ._empty] } } + /// - Remark: Generated from `#/paths/pets/GET/query/habitat`. public var habitat: Operations.listPets.Input.Query.habitatPayload? /// - Remark: Generated from `#/paths/pets/GET/query/feedsPayload`. @frozen @@ -802,7 +812,9 @@ public enum Operations { /// - Remark: Generated from `#/paths/pets/GET/query/feeds`. public typealias feedsPayload = [Operations.listPets.Input.Query .feedsPayloadPayload] + /// - Remark: Generated from `#/paths/pets/GET/query/feeds`. public var feeds: Operations.listPets.Input.Query.feedsPayload? + /// - Remark: Generated from `#/paths/pets/GET/query/since`. public var since: Components.Parameters.query_born_since? /// Creates a new `Query`. /// @@ -824,7 +836,9 @@ public enum Operations { } } public var query: Operations.listPets.Input.Query + /// - Remark: Generated from `#/paths/pets/GET/header`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/header/My-Request-UUID`. public var My_Request_UUID: Swift.String? /// Creates a new `Headers`. /// @@ -835,11 +849,13 @@ public enum Operations { } } public var headers: Operations.listPets.Input.Headers + /// - Remark: Generated from `#/paths/pets/GET/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.listPets.Input.Cookies + /// - Remark: Generated from `#/paths/pets/GET/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable {} public var body: Operations.listPets.Input.Body? /// Creates a new `Input`. @@ -866,8 +882,11 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Ok: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/200/headers`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/200/headers/My-Response-UUID`. public var My_Response_UUID: Swift.String + /// - Remark: Generated from `#/paths/pets/GET/responses/200/headers/My-Tracing-Header`. public var My_Tracing_Header: Components.Headers.TracingHeader? /// Creates a new `Headers`. /// @@ -884,7 +903,9 @@ public enum Operations { } /// Received HTTP response headers public var headers: Operations.listPets.Output.Ok.Headers + /// - Remark: Generated from `#/paths/pets/GET/responses/200/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/200/content/application\/json`. case json(Components.Schemas.Pets) } /// Received HTTP response body @@ -909,13 +930,16 @@ public enum Operations { /// HTTP response code: `200 ok`. case ok(Operations.listPets.Output.Ok) public struct Default: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/default/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.listPets.Output.Default.Headers + /// - Remark: Generated from `#/paths/pets/GET/responses/default/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/default/content/application\/json`. case json(Components.Schemas._Error) } /// Received HTTP response body @@ -948,17 +972,21 @@ public enum Operations { public enum createPet { public static let id: String = "createPet" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.createPet.Input.Path + /// - Remark: Generated from `#/paths/pets/POST/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.createPet.Input.Query + /// - Remark: Generated from `#/paths/pets/POST/header`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/header/X-Extra-Arguments`. public var X_Extra_Arguments: Components.Schemas.CodeError? /// Creates a new `Headers`. /// @@ -969,12 +997,15 @@ public enum Operations { } } public var headers: Operations.createPet.Input.Headers + /// - Remark: Generated from `#/paths/pets/POST/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.createPet.Input.Cookies + /// - Remark: Generated from `#/paths/pets/POST/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/requestBody/content/application\/json`. case json(Components.Schemas.CreatePetRequest) } public var body: Operations.createPet.Input.Body @@ -1002,7 +1033,9 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Created: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/responses/201/headers`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/responses/201/headers/X-Extra-Arguments`. public var X_Extra_Arguments: Components.Schemas.CodeError? /// Creates a new `Headers`. /// @@ -1014,7 +1047,9 @@ public enum Operations { } /// Received HTTP response headers public var headers: Operations.createPet.Output.Created.Headers + /// - Remark: Generated from `#/paths/pets/POST/responses/201/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/responses/201/content/application\/json`. case json(Components.Schemas.Pet) } /// Received HTTP response body @@ -1055,26 +1090,31 @@ public enum Operations { public enum getStats { public static let id: String = "getStats" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/GET/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.getStats.Input.Path + /// - Remark: Generated from `#/paths/pets/stats/GET/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.getStats.Input.Query + /// - Remark: Generated from `#/paths/pets/stats/GET/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.getStats.Input.Headers + /// - Remark: Generated from `#/paths/pets/stats/GET/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.getStats.Input.Cookies + /// - Remark: Generated from `#/paths/pets/stats/GET/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable {} public var body: Operations.getStats.Input.Body? /// Creates a new `Input`. @@ -1101,13 +1141,16 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Ok: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.getStats.Output.Ok.Headers + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/content/application\/json`. case json(Components.Schemas.PetStats) } /// Received HTTP response body @@ -1142,27 +1185,33 @@ public enum Operations { public enum postStats { public static let id: String = "postStats" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/POST/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.postStats.Input.Path + /// - Remark: Generated from `#/paths/pets/stats/POST/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.postStats.Input.Query + /// - Remark: Generated from `#/paths/pets/stats/POST/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.postStats.Input.Headers + /// - Remark: Generated from `#/paths/pets/stats/POST/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.postStats.Input.Cookies + /// - Remark: Generated from `#/paths/pets/stats/POST/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/POST/requestBody/content/application\/json`. case json(Components.Schemas.PetStats) } public var body: Operations.postStats.Input.Body @@ -1190,12 +1239,14 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Accepted: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/POST/responses/202/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.postStats.Output.Accepted.Headers + /// - Remark: Generated from `#/paths/pets/stats/POST/responses/202/content`. @frozen public enum Body: Sendable, Equatable, Hashable {} /// Received HTTP response body public var body: Operations.postStats.Output.Accepted.Body? @@ -1229,26 +1280,31 @@ public enum Operations { public enum probe { public static let id: String = "probe" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/probe/POST/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.probe.Input.Path + /// - Remark: Generated from `#/paths/probe/POST/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.probe.Input.Query + /// - Remark: Generated from `#/paths/probe/POST/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.probe.Input.Headers + /// - Remark: Generated from `#/paths/probe/POST/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.probe.Input.Cookies + /// - Remark: Generated from `#/paths/probe/POST/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable {} public var body: Operations.probe.Input.Body? /// Creates a new `Input`. @@ -1275,12 +1331,14 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct NoContent: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/probe/POST/responses/204/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.probe.Output.NoContent.Headers + /// - Remark: Generated from `#/paths/probe/POST/responses/204/content`. @frozen public enum Body: Sendable, Equatable, Hashable {} /// Received HTTP response body public var body: Operations.probe.Output.NoContent.Body? @@ -1316,7 +1374,9 @@ public enum Operations { public enum updatePet { public static let id: String = "updatePet" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/path`. public struct Path: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/path/petId`. public var petId: Swift.Int64 /// Creates a new `Path`. /// @@ -1325,16 +1385,19 @@ public enum Operations { public init(petId: Swift.Int64) { self.petId = petId } } public var path: Operations.updatePet.Input.Path + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.updatePet.Input.Query + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.updatePet.Input.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} @@ -1365,12 +1428,14 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct NoContent: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/204/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.updatePet.Output.NoContent.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/204/content`. @frozen public enum Body: Sendable, Equatable, Hashable {} /// Received HTTP response body public var body: Operations.updatePet.Output.NoContent.Body? @@ -1394,16 +1459,18 @@ public enum Operations { /// HTTP response code: `204 noContent`. case noContent(Operations.updatePet.Output.NoContent) public struct BadRequest: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.updatePet.Output.BadRequest.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content`. @frozen public enum Body: Sendable, Equatable, Hashable { - /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/json`. + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content/json`. public struct jsonPayload: Codable, Equatable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/json/message`. + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content/json/message`. public var message: Swift.String /// Creates a new `jsonPayload`. /// @@ -1412,6 +1479,7 @@ public enum Operations { public init(message: Swift.String) { self.message = message } public enum CodingKeys: String, CodingKey { case message } } + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content/application\/json`. case json(Operations.updatePet.Output.BadRequest.Body.jsonPayload) } /// Received HTTP response body @@ -1448,7 +1516,9 @@ public enum Operations { public enum uploadAvatarForPet { public static let id: String = "uploadAvatarForPet" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/path`. public struct Path: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/path/petId`. public var petId: Components.Parameters.path_petId /// Creates a new `Path`. /// @@ -1457,22 +1527,29 @@ public enum Operations { public init(petId: Components.Parameters.path_petId) { self.petId = petId } } public var path: Operations.uploadAvatarForPet.Input.Path + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.uploadAvatarForPet.Input.Query + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.uploadAvatarForPet.Input.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.uploadAvatarForPet.Input.Cookies - @frozen public enum Body: Sendable, Equatable, Hashable { case binary(Foundation.Data) } + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/requestBody`. + @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/requestBody/content/application\/octet-stream`. + case binary(Foundation.Data) + } public var body: Operations.uploadAvatarForPet.Input.Body /// Creates a new `Input`. /// @@ -1498,13 +1575,16 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Ok: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/200/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.uploadAvatarForPet.Output.Ok.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/200/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/200/content/application\/octet-stream`. case binary(Foundation.Data) } /// Received HTTP response body @@ -1529,13 +1609,18 @@ public enum Operations { /// HTTP response code: `200 ok`. case ok(Operations.uploadAvatarForPet.Output.Ok) public struct PreconditionFailed: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/412/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.uploadAvatarForPet.Output.PreconditionFailed.Headers - @frozen public enum Body: Sendable, Equatable, Hashable { case json(Swift.String) } + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/412/content`. + @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/412/content/application\/json`. + case json(Swift.String) + } /// Received HTTP response body public var body: Operations.uploadAvatarForPet.Output.PreconditionFailed.Body /// Creates a new `PreconditionFailed`. @@ -1559,13 +1644,18 @@ public enum Operations { /// HTTP response code: `412 preconditionFailed`. case preconditionFailed(Operations.uploadAvatarForPet.Output.PreconditionFailed) public struct InternalServerError: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/500/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.uploadAvatarForPet.Output.InternalServerError.Headers - @frozen public enum Body: Sendable, Equatable, Hashable { case text(Swift.String) } + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/500/content`. + @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/500/content/text\/plain`. + case text(Swift.String) + } /// Received HTTP response body public var body: Operations.uploadAvatarForPet.Output.InternalServerError.Body /// Creates a new `InternalServerError`. diff --git a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore_FF_MultipleContentTypes/Types.swift b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore_FF_MultipleContentTypes/Types.swift index 199f1c58..af17148a 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore_FF_MultipleContentTypes/Types.swift +++ b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore_FF_MultipleContentTypes/Types.swift @@ -636,6 +636,7 @@ public enum Components { } /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. public enum RequestBodies { + /// - Remark: Generated from `#/components/requestBodies/UpdatePetRequest`. @frozen public enum UpdatePetRequest: Sendable, Equatable, Hashable { /// - Remark: Generated from `#/components/requestBodies/UpdatePetRequest/json`. public struct jsonPayload: Codable, Equatable, Hashable, Sendable { @@ -666,13 +667,16 @@ public enum Components { case tag } } + /// - Remark: Generated from `#/components/requestBodies/UpdatePetRequest/content/application\/json`. case json(Components.RequestBodies.UpdatePetRequest.jsonPayload) } } /// Types generated from the `#/components/responses` section of the OpenAPI document. public enum Responses { public struct ErrorBadRequest: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/headers`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/headers/X-Reason`. public var X_hyphen_Reason: Swift.String? /// Creates a new `Headers`. /// @@ -684,10 +688,11 @@ public enum Components { } /// Received HTTP response headers public var headers: Components.Responses.ErrorBadRequest.Headers + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content`. @frozen public enum Body: Sendable, Equatable, Hashable { - /// - Remark: Generated from `#/components/responses/ErrorBadRequest/json`. + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content/json`. public struct jsonPayload: Codable, Equatable, Hashable, Sendable { - /// - Remark: Generated from `#/components/responses/ErrorBadRequest/json/code`. + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content/json/code`. public var code: Swift.Int /// Creates a new `jsonPayload`. /// @@ -696,6 +701,7 @@ public enum Components { public init(code: Swift.Int) { self.code = code } public enum CodingKeys: String, CodingKey { case code } } + /// - Remark: Generated from `#/components/responses/ErrorBadRequest/content/application\/json`. case json(Components.Responses.ErrorBadRequest.Body.jsonPayload) } /// Received HTTP response body @@ -732,12 +738,15 @@ public enum Operations { public enum listPets { public static let id: String = "listPets" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.listPets.Input.Path + /// - Remark: Generated from `#/paths/pets/GET/query`. public struct Query: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/query/limit`. public var limit: Swift.Int32? /// - Remark: Generated from `#/paths/pets/GET/query/habitat`. @frozen @@ -770,6 +779,7 @@ public enum Operations { } public static var allCases: [habitatPayload] { [.water, .land, .air, ._empty] } } + /// - Remark: Generated from `#/paths/pets/GET/query/habitat`. public var habitat: Operations.listPets.Input.Query.habitatPayload? /// - Remark: Generated from `#/paths/pets/GET/query/feedsPayload`. @frozen @@ -804,7 +814,9 @@ public enum Operations { /// - Remark: Generated from `#/paths/pets/GET/query/feeds`. public typealias feedsPayload = [Operations.listPets.Input.Query .feedsPayloadPayload] + /// - Remark: Generated from `#/paths/pets/GET/query/feeds`. public var feeds: Operations.listPets.Input.Query.feedsPayload? + /// - Remark: Generated from `#/paths/pets/GET/query/since`. public var since: Components.Parameters.query_period_born_hyphen_since? /// Creates a new `Query`. /// @@ -826,7 +838,9 @@ public enum Operations { } } public var query: Operations.listPets.Input.Query + /// - Remark: Generated from `#/paths/pets/GET/header`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/header/My-Request-UUID`. public var My_hyphen_Request_hyphen_UUID: Swift.String? /// Creates a new `Headers`. /// @@ -837,11 +851,13 @@ public enum Operations { } } public var headers: Operations.listPets.Input.Headers + /// - Remark: Generated from `#/paths/pets/GET/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.listPets.Input.Cookies + /// - Remark: Generated from `#/paths/pets/GET/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable {} public var body: Operations.listPets.Input.Body? /// Creates a new `Input`. @@ -868,8 +884,11 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Ok: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/200/headers`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/200/headers/My-Response-UUID`. public var My_hyphen_Response_hyphen_UUID: Swift.String + /// - Remark: Generated from `#/paths/pets/GET/responses/200/headers/My-Tracing-Header`. public var My_hyphen_Tracing_hyphen_Header: Components.Headers.TracingHeader? /// Creates a new `Headers`. /// @@ -886,7 +905,9 @@ public enum Operations { } /// Received HTTP response headers public var headers: Operations.listPets.Output.Ok.Headers + /// - Remark: Generated from `#/paths/pets/GET/responses/200/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/200/content/application\/json`. case json(Components.Schemas.Pets) } /// Received HTTP response body @@ -911,13 +932,16 @@ public enum Operations { /// HTTP response code: `200 ok`. case ok(Operations.listPets.Output.Ok) public struct Default: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/default/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.listPets.Output.Default.Headers + /// - Remark: Generated from `#/paths/pets/GET/responses/default/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/GET/responses/default/content/application\/json`. case json(Components.Schemas._Error) } /// Received HTTP response body @@ -950,17 +974,21 @@ public enum Operations { public enum createPet { public static let id: String = "createPet" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.createPet.Input.Path + /// - Remark: Generated from `#/paths/pets/POST/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.createPet.Input.Query + /// - Remark: Generated from `#/paths/pets/POST/header`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/header/X-Extra-Arguments`. public var X_hyphen_Extra_hyphen_Arguments: Components.Schemas.CodeError? /// Creates a new `Headers`. /// @@ -971,12 +999,15 @@ public enum Operations { } } public var headers: Operations.createPet.Input.Headers + /// - Remark: Generated from `#/paths/pets/POST/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.createPet.Input.Cookies + /// - Remark: Generated from `#/paths/pets/POST/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/requestBody/content/application\/json`. case json(Components.Schemas.CreatePetRequest) } public var body: Operations.createPet.Input.Body @@ -1004,7 +1035,9 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Created: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/responses/201/headers`. public struct Headers: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/responses/201/headers/X-Extra-Arguments`. public var X_hyphen_Extra_hyphen_Arguments: Components.Schemas.CodeError? /// Creates a new `Headers`. /// @@ -1016,7 +1049,9 @@ public enum Operations { } /// Received HTTP response headers public var headers: Operations.createPet.Output.Created.Headers + /// - Remark: Generated from `#/paths/pets/POST/responses/201/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/POST/responses/201/content/application\/json`. case json(Components.Schemas.Pet) } /// Received HTTP response body @@ -1057,26 +1092,31 @@ public enum Operations { public enum getStats { public static let id: String = "getStats" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/GET/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.getStats.Input.Path + /// - Remark: Generated from `#/paths/pets/stats/GET/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.getStats.Input.Query + /// - Remark: Generated from `#/paths/pets/stats/GET/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.getStats.Input.Headers + /// - Remark: Generated from `#/paths/pets/stats/GET/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.getStats.Input.Cookies + /// - Remark: Generated from `#/paths/pets/stats/GET/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable {} public var body: Operations.getStats.Input.Body? /// Creates a new `Input`. @@ -1103,15 +1143,20 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Ok: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.getStats.Output.Ok.Headers + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/content/application\/json`. case json(Components.Schemas.PetStats) + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/content/text\/plain`. case plainText(Swift.String) + /// - Remark: Generated from `#/paths/pets/stats/GET/responses/200/content/application\/octet-stream`. case binary(Foundation.Data) } /// Received HTTP response body @@ -1146,29 +1191,37 @@ public enum Operations { public enum postStats { public static let id: String = "postStats" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/POST/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.postStats.Input.Path + /// - Remark: Generated from `#/paths/pets/stats/POST/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.postStats.Input.Query + /// - Remark: Generated from `#/paths/pets/stats/POST/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.postStats.Input.Headers + /// - Remark: Generated from `#/paths/pets/stats/POST/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.postStats.Input.Cookies + /// - Remark: Generated from `#/paths/pets/stats/POST/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/POST/requestBody/content/application\/json`. case json(Components.Schemas.PetStats) + /// - Remark: Generated from `#/paths/pets/stats/POST/requestBody/content/text\/plain`. case plainText(Swift.String) + /// - Remark: Generated from `#/paths/pets/stats/POST/requestBody/content/application\/octet-stream`. case binary(Foundation.Data) } public var body: Operations.postStats.Input.Body @@ -1196,12 +1249,14 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Accepted: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/stats/POST/responses/202/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.postStats.Output.Accepted.Headers + /// - Remark: Generated from `#/paths/pets/stats/POST/responses/202/content`. @frozen public enum Body: Sendable, Equatable, Hashable {} /// Received HTTP response body public var body: Operations.postStats.Output.Accepted.Body? @@ -1235,26 +1290,31 @@ public enum Operations { public enum probe { public static let id: String = "probe" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/probe/POST/path`. public struct Path: Sendable, Equatable, Hashable { /// Creates a new `Path`. public init() {} } public var path: Operations.probe.Input.Path + /// - Remark: Generated from `#/paths/probe/POST/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.probe.Input.Query + /// - Remark: Generated from `#/paths/probe/POST/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.probe.Input.Headers + /// - Remark: Generated from `#/paths/probe/POST/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.probe.Input.Cookies + /// - Remark: Generated from `#/paths/probe/POST/requestBody`. @frozen public enum Body: Sendable, Equatable, Hashable {} public var body: Operations.probe.Input.Body? /// Creates a new `Input`. @@ -1281,12 +1341,14 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct NoContent: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/probe/POST/responses/204/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.probe.Output.NoContent.Headers + /// - Remark: Generated from `#/paths/probe/POST/responses/204/content`. @frozen public enum Body: Sendable, Equatable, Hashable {} /// Received HTTP response body public var body: Operations.probe.Output.NoContent.Body? @@ -1322,7 +1384,9 @@ public enum Operations { public enum updatePet { public static let id: String = "updatePet" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/path`. public struct Path: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/path/petId`. public var petId: Swift.Int64 /// Creates a new `Path`. /// @@ -1331,16 +1395,19 @@ public enum Operations { public init(petId: Swift.Int64) { self.petId = petId } } public var path: Operations.updatePet.Input.Path + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.updatePet.Input.Query + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.updatePet.Input.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} @@ -1371,12 +1438,14 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct NoContent: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/204/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.updatePet.Output.NoContent.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/204/content`. @frozen public enum Body: Sendable, Equatable, Hashable {} /// Received HTTP response body public var body: Operations.updatePet.Output.NoContent.Body? @@ -1400,16 +1469,18 @@ public enum Operations { /// HTTP response code: `204 noContent`. case noContent(Operations.updatePet.Output.NoContent) public struct BadRequest: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.updatePet.Output.BadRequest.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content`. @frozen public enum Body: Sendable, Equatable, Hashable { - /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/json`. + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content/json`. public struct jsonPayload: Codable, Equatable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/json/message`. + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content/json/message`. public var message: Swift.String /// Creates a new `jsonPayload`. /// @@ -1418,6 +1489,7 @@ public enum Operations { public init(message: Swift.String) { self.message = message } public enum CodingKeys: String, CodingKey { case message } } + /// - Remark: Generated from `#/paths/pets/{petId}/PATCH/responses/400/content/application\/json`. case json(Operations.updatePet.Output.BadRequest.Body.jsonPayload) } /// Received HTTP response body @@ -1454,7 +1526,9 @@ public enum Operations { public enum uploadAvatarForPet { public static let id: String = "uploadAvatarForPet" public struct Input: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/path`. public struct Path: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/path/petId`. public var petId: Components.Parameters.path_period_petId /// Creates a new `Path`. /// @@ -1463,22 +1537,29 @@ public enum Operations { public init(petId: Components.Parameters.path_period_petId) { self.petId = petId } } public var path: Operations.uploadAvatarForPet.Input.Path + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/query`. public struct Query: Sendable, Equatable, Hashable { /// Creates a new `Query`. public init() {} } public var query: Operations.uploadAvatarForPet.Input.Query + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/header`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } public var headers: Operations.uploadAvatarForPet.Input.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/cookie`. public struct Cookies: Sendable, Equatable, Hashable { /// Creates a new `Cookies`. public init() {} } public var cookies: Operations.uploadAvatarForPet.Input.Cookies - @frozen public enum Body: Sendable, Equatable, Hashable { case binary(Foundation.Data) } + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/requestBody`. + @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/requestBody/content/application\/octet-stream`. + case binary(Foundation.Data) + } public var body: Operations.uploadAvatarForPet.Input.Body /// Creates a new `Input`. /// @@ -1504,13 +1585,16 @@ public enum Operations { } @frozen public enum Output: Sendable, Equatable, Hashable { public struct Ok: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/200/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.uploadAvatarForPet.Output.Ok.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/200/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/200/content/application\/octet-stream`. case binary(Foundation.Data) } /// Received HTTP response body @@ -1535,13 +1619,18 @@ public enum Operations { /// HTTP response code: `200 ok`. case ok(Operations.uploadAvatarForPet.Output.Ok) public struct PreconditionFailed: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/412/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.uploadAvatarForPet.Output.PreconditionFailed.Headers - @frozen public enum Body: Sendable, Equatable, Hashable { case json(Swift.String) } + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/412/content`. + @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/412/content/application\/json`. + case json(Swift.String) + } /// Received HTTP response body public var body: Operations.uploadAvatarForPet.Output.PreconditionFailed.Body /// Creates a new `PreconditionFailed`. @@ -1565,13 +1654,16 @@ public enum Operations { /// HTTP response code: `412 preconditionFailed`. case preconditionFailed(Operations.uploadAvatarForPet.Output.PreconditionFailed) public struct InternalServerError: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/500/headers`. public struct Headers: Sendable, Equatable, Hashable { /// Creates a new `Headers`. public init() {} } /// Received HTTP response headers public var headers: Operations.uploadAvatarForPet.Output.InternalServerError.Headers + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/500/content`. @frozen public enum Body: Sendable, Equatable, Hashable { + /// - Remark: Generated from `#/paths/pets/{petId}/avatar/PUT/responses/500/content/text\/plain`. case plainText(Swift.String) } /// Received HTTP response body