mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-29 21:10:55 +00:00
Merge branch 'master' of https://github.com/openapitools/openapi-generator
This commit is contained in:
commit
abfeb6e035
@ -683,6 +683,11 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toModelName(final String name) {
|
public String toModelName(final String name) {
|
||||||
|
// obtain the name from modelNameMapping directly if provided
|
||||||
|
if (modelNameMapping.containsKey(name)) {
|
||||||
|
return modelNameMapping.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
// memoization
|
// memoization
|
||||||
if (schemaKeyToModelNameCache.containsKey(name)) {
|
if (schemaKeyToModelNameCache.containsKey(name)) {
|
||||||
return schemaKeyToModelNameCache.get(name);
|
return schemaKeyToModelNameCache.get(name);
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol URLSessionProtocol {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
internal protocol URLSessionProtocol {
|
internal protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
16
samples/client/petstore/swift5/validation/Package.resolved
Normal file
16
samples/client/petstore/swift5/validation/Package.resolved
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"object": {
|
||||||
|
"pins": [
|
||||||
|
{
|
||||||
|
"package": "AnyCodable",
|
||||||
|
"repositoryURL": "https://github.com/Flight-School/AnyCodable",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "862808b2070cd908cb04f9aafe7de83d35f81b05",
|
||||||
|
"version": "0.6.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import Foundation
|
|||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
#endif
|
#endif
|
||||||
|
#if canImport(UniformTypeIdentifiers)
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol URLSessionProtocol {
|
public protocol URLSessionProtocol {
|
||||||
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
|
||||||
@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
func mimeType(for url: URL) -> String {
|
func mimeType(for url: URL) -> String {
|
||||||
let pathExtension = url.pathExtension
|
let pathExtension = url.pathExtension
|
||||||
|
|
||||||
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
if #available(iOS 15, macOS 11, *) {
|
||||||
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
#if canImport(UniformTypeIdentifiers)
|
||||||
return mimetype as String
|
if let utType = UTType(filenameExtension: pathExtension) {
|
||||||
|
return utType.preferredMIMEType ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return "application/octet-stream"
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
|
||||||
|
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
|
||||||
|
return mimetype as String
|
||||||
|
}
|
||||||
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user