From 4d6f297078686d8f7ffdba9c6a267f363f5c61a1 Mon Sep 17 00:00:00 2001 From: Kostis Stefanou Date: Wed, 17 Apr 2024 18:48:22 +0300 Subject: [PATCH] Update petstore.yaml with deepObject parameter --- .../Resources/Docs/petstore.yaml | 12 ++++++++ .../ReferenceSources/Petstore/Client.swift | 7 +++++ .../ReferenceSources/Petstore/Server.swift | 7 +++++ .../ReferenceSources/Petstore/Types.swift | 28 +++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/Tests/OpenAPIGeneratorReferenceTests/Resources/Docs/petstore.yaml b/Tests/OpenAPIGeneratorReferenceTests/Resources/Docs/petstore.yaml index ac8a417d..a1c7365b 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/Resources/Docs/petstore.yaml +++ b/Tests/OpenAPIGeneratorReferenceTests/Resources/Docs/petstore.yaml @@ -69,6 +69,18 @@ paths: schema: format: uuid type: string + - name: sort + in: query + required: false + style: deepObject + explode: true + schema: + type: object + properties: + id: + type: string + name: + type: string - $ref: '#/components/parameters/query.born-since' responses: '200': diff --git a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Client.swift b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Client.swift index 75c9bf22..04eaaf6a 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Client.swift +++ b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Client.swift @@ -87,6 +87,13 @@ public struct Client: APIProtocol { name: "My-Request-UUID", value: input.headers.My_hyphen_Request_hyphen_UUID ) + try converter.setQueryItemAsURI( + in: &request, + style: .deepObject, + explode: true, + name: "sort", + value: input.query.sort + ) try converter.setQueryItemAsURI( in: &request, style: .form, diff --git a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Server.swift b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Server.swift index 80d642b3..d255b183 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Server.swift +++ b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Server.swift @@ -187,6 +187,13 @@ fileprivate extension UniversalServer where APIHandler: APIProtocol { name: "feeds", as: Operations.listPets.Input.Query.feedsPayload.self ), + sort: try converter.getOptionalQueryItemAsURI( + in: request.soar_query, + style: .deepObject, + explode: true, + name: "sort", + as: Operations.listPets.Input.Query.sortPayload.self + ), since: try converter.getOptionalQueryItemAsURI( in: request.soar_query, style: .form, diff --git a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift index 818aff50..a4f707e7 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift +++ b/Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift @@ -1791,6 +1791,31 @@ public enum Operations { 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/sort`. + public struct sortPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/paths/pets/GET/query/sort/id`. + public var id: Swift.String? + /// - Remark: Generated from `#/paths/pets/GET/query/sort/name`. + public var name: Swift.String? + /// Creates a new `sortPayload`. + /// + /// - Parameters: + /// - id: + /// - name: + public init( + id: Swift.String? = nil, + name: Swift.String? = nil + ) { + self.id = id + self.name = name + } + public enum CodingKeys: String, CodingKey { + case id + case name + } + } + /// - Remark: Generated from `#/paths/pets/GET/query/sort`. + public var sort: Operations.listPets.Input.Query.sortPayload? /// Supply this parameter to filter pets born since the provided date. /// /// - Remark: Generated from `#/paths/pets/GET/query/since`. @@ -1801,16 +1826,19 @@ public enum Operations { /// - limit: How many items to return at one time (max 100) /// - habitat: /// - feeds: + /// - sort: /// - since: Supply this parameter to filter pets born since the provided date. public init( limit: Swift.Int32? = nil, habitat: Operations.listPets.Input.Query.habitatPayload? = nil, feeds: Operations.listPets.Input.Query.feedsPayload? = nil, + sort: Operations.listPets.Input.Query.sortPayload? = nil, since: Components.Parameters.query_period_born_hyphen_since? = nil ) { self.limit = limit self.habitat = habitat self.feeds = feeds + self.sort = sort self.since = since } }