Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Adding codegen config support for spm module type versions #539

Merged
merged 10 commits into from
Nov 27, 2024
791 changes: 791 additions & 0 deletions Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions Tests/ApolloCodegenTests/ApolloCodegenTests.swift
Original file line number Diff line number Diff line change
@@ -640,7 +640,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackage(),
operations: .inSchemaModule,
path: directoryURL.path
)
@@ -756,7 +756,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackage(),
operations: .absolute(path: operationsOutputURL.path),
path: directoryURL.path
)
@@ -862,7 +862,7 @@ class ApolloCodegenTests: XCTestCase {
input: .init(schemaPath: schemaPath, operationSearchPaths: [operationsPath]),
output: .init(
schemaTypes: .init(path: directoryURL.path,
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .inSchemaModule,
testMocks: .absolute(path: directoryURL.appendingPathComponent("TestMocks").path)
)
@@ -938,7 +938,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackage(),
operations: .inSchemaModule,
path: "./RelativePath"
)
@@ -1051,7 +1051,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackage(),
operations: .absolute(path: "./RelativeOperations"),
path: "./RelativePath"
)
@@ -1183,7 +1183,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .inSchemaModule
),
options: .init(pruneGeneratedFiles: false)
@@ -1241,7 +1241,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .inSchemaModule
)
)
@@ -1295,7 +1295,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .absolute(path: "OperationPath")
)
)
@@ -1364,7 +1364,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .relative(subpath: nil)
)
)
@@ -1437,7 +1437,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .relative(subpath: nil)
)
)
@@ -1489,7 +1489,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: schemaDirectory,
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .relative(subpath: relativeSubPath)
),
options: .init(
@@ -1586,7 +1586,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .relative(subpath: "subpath")
)
)
@@ -1694,7 +1694,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .relative(subpath: "subpath")
)
)
@@ -1796,7 +1796,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .relative(subpath: "subpath")
)
)
@@ -1860,7 +1860,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .inSchemaModule,
testMocks: .absolute(path: absolutePath)
)
@@ -1917,7 +1917,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
testMocks: .swiftPackage()
)
)
@@ -1975,7 +1975,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
testMocks: .swiftPackage(targetName: testMockTargetName)
)
)
@@ -2285,7 +2285,7 @@ class ApolloCodegenTests: XCTestCase {
func test__validation__givenSchemaTypesModule_swiftPackageManager_withCocoapodsCompatibleImportStatements_true_shouldThrow() throws {
// given
let config = ApolloCodegenConfiguration.mock(
.swiftPackageManager,
.swiftPackage(),
options: .init(cocoapodsCompatibleImportStatements: true)
)

@@ -2301,7 +2301,7 @@ class ApolloCodegenTests: XCTestCase {
func test__validation__givenSchemaTypesModule_swiftPackageManager_withCocoapodsCompatibleImportStatements_false_shouldNotThrow() throws {
// given
let config = ApolloCodegenConfiguration.mock(
.swiftPackageManager,
.swiftPackage(),
options: .init(cocoapodsCompatibleImportStatements: false)
)

@@ -2387,7 +2387,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .inSchemaModule
)
)
@@ -2538,7 +2538,7 @@ class ApolloCodegenTests: XCTestCase {
input: .init(schemaPath: schemaPath, operationSearchPaths: [operationsPath]),
output: .init(
schemaTypes: .init(path: directoryURL.path,
moduleType: .swiftPackageManager),
moduleType: .swiftPackage()),
operations: .inSchemaModule
),
options: .init(
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class FileGeneratorTests: XCTestCase {

private func buildConfig() {
let mockedConfig = ApolloCodegenConfiguration.mock(output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackage(),
operations: .inSchemaModule
))

Loading

Unchanged files with check annotations Beta

///
/// - SeeAlso: [The Response Format section in the GraphQL specification](https://facebook.github.io/graphql/#sec-Response-Format)
public struct GraphQLError: Error, Hashable {
private let object: JSONObject

Check warning on line 10 in apollo-ios/Sources/Apollo/GraphQLError.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

stored property 'object' of 'Sendable'-conforming struct 'GraphQLError' has non-sendable type 'JSONObject' (aka 'Dictionary<String, AnyHashable>'); this is an error in the Swift 6 language mode

Check warning on line 10 in apollo-ios/Sources/Apollo/GraphQLError.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

stored property 'object' of 'Sendable'-conforming struct 'GraphQLError' has non-sendable type 'JSONObject' (aka 'Dictionary<String, AnyHashable>'); this is an error in the Swift 6 language mode
public init(_ object: JSONObject) {
self.object = object
/// Corresponds to [graphql-js/GraphQLError](https://graphql.org/graphql-js/error/#graphqlerror)
/// You can get error details if you need them, or call `error.logLines` to get errors in a format
/// that lets Xcode show inline errors.
public final class GraphQLError: JavaScriptError {

Check warning on line 8 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLError.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLError' must restate inherited '@unchecked Sendable' conformance

Check warning on line 8 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLError.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLError' must restate inherited '@unchecked Sendable' conformance
private let source: GraphQLSource?
/// The source locations associated with this error.
public let sourceLocations: [GraphQLSourceLocation]?
}
/// A GraphQL schema validation error. This wraps one or more underlying validation errors.
public class GraphQLSchemaValidationError: JavaScriptError {

Check warning on line 78 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLError.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLSchemaValidationError' must restate inherited '@unchecked Sendable' conformance

Check warning on line 78 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLError.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLSchemaValidationError' must restate inherited '@unchecked Sendable' conformance
public let validationErrors: [GraphQLError]
required init(_ jsValue: JSValue, bridge: isolated JavaScriptBridge) {
}
}
public final class GraphQLScalarType: GraphQLNamedType {

Check warning on line 67 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLScalarType' must restate inherited '@unchecked Sendable' conformance

Check warning on line 67 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLScalarType' must restate inherited '@unchecked Sendable' conformance
public let specifiedByURL: String?
}
public final class GraphQLEnumType: GraphQLNamedType {

Check warning on line 99 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLEnumType' must restate inherited '@unchecked Sendable' conformance

Check warning on line 99 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLEnumType' must restate inherited '@unchecked Sendable' conformance
public private(set) var values: [GraphQLEnumValue]!
required init(_ jsValue: JSValue, bridge: isolated JavaScriptBridge) {
public typealias GraphQLInputFieldDictionary = OrderedDictionary<String, GraphQLInputField>
public final class GraphQLInputObjectType: GraphQLNamedType {

Check warning on line 155 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLInputObjectType' must restate inherited '@unchecked Sendable' conformance

Check warning on line 155 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLInputObjectType' must restate inherited '@unchecked Sendable' conformance
public private(set) var fields: GraphQLInputFieldDictionary!
required init(_ jsValue: JSValue, bridge: isolated JavaScriptBridge) {
}
}
public class GraphQLCompositeType: GraphQLNamedType {

Check warning on line 216 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLCompositeType' must restate inherited '@unchecked Sendable' conformance

Check warning on line 216 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLCompositeType' must restate inherited '@unchecked Sendable' conformance
public override var debugDescription: String {
"Type - \(name)"
}
}
}
public final class GraphQLObjectType: GraphQLCompositeType, GraphQLInterfaceImplementingType {

Check warning on line 232 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLObjectType' must restate inherited '@unchecked Sendable' conformance

Check warning on line 232 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLObjectType' must restate inherited '@unchecked Sendable' conformance
public private(set) var fields: [String: GraphQLField]!
}
}
public class GraphQLAbstractType: GraphQLCompositeType {

Check warning on line 264 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen CLI Unit Tests - macOS

class 'GraphQLAbstractType' must restate inherited '@unchecked Sendable' conformance

Check warning on line 264 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLAbstractType' must restate inherited '@unchecked Sendable' conformance
}
public final class GraphQLInterfaceType: GraphQLAbstractType, GraphQLInterfaceImplementingType {

Check warning on line 267 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLInterfaceType' must restate inherited '@unchecked Sendable' conformance
public private(set) var fields: [String: GraphQLField]!
}
}
public final class GraphQLUnionType: GraphQLAbstractType {

Check warning on line 299 in apollo-ios-codegen/Sources/GraphQLCompiler/GraphQLSchema.swift

GitHub Actions / Codegen Lib Unit Tests - macOS

class 'GraphQLUnionType' must restate inherited '@unchecked Sendable' conformance
public let types: [GraphQLObjectType]
required init(_ jsValue: JSValue, bridge: isolated JavaScriptBridge) {