Skip to content

Commit

Permalink
Update ApolloCodegenOptions to be compatible with default ApolloSchem…
Browse files Browse the repository at this point in the history
…aDownloadConfiguration output (#1968)
  • Loading branch information
calvincestari authored Sep 24, 2021
1 parent d898967 commit 6c3a75b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/ApolloCodegenLib/ApolloCodegenOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public struct ApolloCodegenOptions {
public init(targetRootURL folder: URL,
codegenEngine: CodeGenerationEngine = .default,
downloadTimeout: Double = 30.0) {
let schema = folder.appendingPathComponent("schema.json")
let schema = folder.appendingPathComponent("schema.graphqls")

let outputFileURL: URL
switch codegenEngine {
Expand Down
8 changes: 8 additions & 0 deletions Tests/ApolloCodegenTests/ApolloSchemaInternalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ class ApolloSchemaInternalTests: XCTestCase {
let postType = try schema.getType(named: "Post")
XCTAssertEqual(postType?.name, "Post")
}

func testConfiguration_usingOnlyOutputFolders_shouldGenerateCompatibleFilenames() {
let downloadConfiguration = ApolloSchemaDownloadConfiguration(using: .introspection(endpointURL: TestURL.mockPort8080.url),
outputFolderURL: CodegenTestHelper.outputFolderURL())
let codegenOptions = ApolloCodegenOptions(targetRootURL: CodegenTestHelper.outputFolderURL())

XCTAssertEqual(downloadConfiguration.outputURL, codegenOptions.urlToSchemaFile)
}
}

0 comments on commit 6c3a75b

Please sign in to comment.