Skip to content

Commit

Permalink
Remove swiftExperimental from codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
calvincestari committed Jul 16, 2021
1 parent 05c46a1 commit f084ca7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 60 deletions.
7 changes: 0 additions & 7 deletions Sources/ApolloCodegenLib/ApolloCodegenOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public struct ApolloCodegenOptions {
/// The default, tried and true code generation engine
case typescript

/// The VERY WORK IN PROGRESS Swift code generation engine. Use at your own risk!
case swiftExperimental

/// The current default for the code generation engine.
public static var `default`: CodeGenerationEngine {
.typescript
Expand All @@ -30,8 +27,6 @@ public struct ApolloCodegenOptions {
switch self {
case .typescript:
return "swift"
case .swiftExperimental:
return "json-modern"
}
}
}
Expand Down Expand Up @@ -145,8 +140,6 @@ public struct ApolloCodegenOptions {
switch codegenEngine {
case .typescript:
outputFileURL = folder.appendingPathComponent("API.swift")
case .swiftExperimental:
outputFileURL = folder.appendingPathComponent("API.json")
}

let operationIDsURL = folder.appendingPathComponent("operationIDs.json")
Expand Down
53 changes: 0 additions & 53 deletions Tests/ApolloCodegenTests/ApolloCodegenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,59 +58,6 @@ class ApolloCodegenTests: XCTestCase {
])
}

func testCreatingOptionsWithAllParameters() throws {
let sourceRoot = CodegenTestHelper.sourceRootURL()
let output = sourceRoot.appendingPathComponent("API")
let schema = sourceRoot.appendingPathComponent("schema.json")
let only = sourceRoot.appendingPathComponent("only.graphql")
let operationIDsURL = sourceRoot.appendingPathComponent("operationIDs.json")
let namespace = "ANameSpace"
let prefix = "MyPrefix"

let options = ApolloCodegenOptions(codegenEngine: .swiftExperimental,
includes: "*.graphql",
mergeInFieldsFromFragmentSpreads: false,
modifier: .internal,
namespace: namespace,
omitDeprecatedEnumCases: true,
only: only,
operationIDsURL: operationIDsURL,
outputFormat: .multipleFiles(inFolderAtURL: output),
customScalarFormat: .passthroughWithPrefix(prefix),
urlToSchemaFile: schema)
XCTAssertEqual(options.includes, "*.graphql")
XCTAssertFalse(options.mergeInFieldsFromFragmentSpreads)
XCTAssertEqual(options.namespace, namespace)
XCTAssertEqual(options.only, only)
XCTAssertEqual(options.operationIDsURL, operationIDsURL)
switch options.outputFormat {
case .singleFile:
XCTFail("This should be multiple files!")
case .multipleFiles(let folderURL):
XCTAssertEqual(folderURL, output)
}
XCTAssertEqual(options.customScalarFormat, .passthroughWithPrefix(prefix))
XCTAssertEqual(options.urlToSchemaFile, schema)
XCTAssertTrue(options.omitDeprecatedEnumCases)
XCTAssertEqual(options.modifier, .internal)


XCTAssertEqual(options.arguments, [
"codegen:generate",
"--target=json-modern",
"--addTypename",
"--includes='*.graphql'",
"--localSchemaFile='\(schema.path)'",
"--namespace=\(namespace)",
"--only='\(only.path)'",
"--operationIdsPath='\(operationIDsURL.path)'",
"--omitDeprecatedEnumCases",
"--passthroughCustomScalars",
"--customScalarsPrefix='\(prefix)'",
"'\(output.path)'",
])
}

func testTryingToUseAFileURLToOutputMultipleFilesFails() {
let scriptFolderURL = CodegenTestHelper.cliFolderURL()
let starWarsFolderURL = CodegenTestHelper.starWarsFolderURL()
Expand Down

0 comments on commit f084ca7

Please sign in to comment.