diff --git a/.circleci/config.yml b/.circleci/config.yml index 3648bb075f..ec584ba10b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,296 +1,15 @@ version: 2.1 -parameters: - resource_class: - type: string - default: "macos.x86.medium.gen2" - xcode_version: - type: string - default: "14.3.1" - ios_current_version: - type: string - default: "16.4" - ios_previous_version: - type: string - default: "15.5" - macos_version: # The user-facing version string for macOS builds - type: string - default: "13.2" - tvos_version: # The user-facing version string of tvOS builds - type: string - default: "16.4" - -commands: - integration_test_setup: - steps: - - restore_cache: - key: starwars-server - - restore_cache: - key: apollo-server-graphql-transport-ws - - common_test_setup - - run: - command: ./scripts/install-node-v12.sh - name: Install Node - - run: - command: ./scripts/install-or-update-starwars-server.sh - name: Install/Update StarWars Server - - run: - command: cd ../starwars-server && npm start - name: Start StarWars Server - background: true - - run: - command: cd SimpleUploadServer && nvm use && npm install && npm start - name: Start Upload Server - background: true - - run: - command: sudo chmod -R +rwx SimpleUploadServer - name: Adjust permissions for simple upload server folder - - run: - command: ./scripts/install-apollo-server-docs-example-server.sh - name: Install Apollo Server (graphql-transport-ws configuration) - - run: - command: cd ../docs-examples/apollo-server/v3/subscriptions-graphql-ws && npm start - name: Start Apollo Server (graphql-transport-ws configuration) - background: true - integration_test_cleanup: - steps: - - save_cache: - key: starwars-server - paths: - - ../starwars-server - - save_cache: - key: apollo-server-graphql-transport-ws - paths: - - ../docs-examples/apollo-server/v3/subscriptions-graphql-ws - common_test_setup: - description: Commands to run for setup of every set of tests - steps: - - checkout - - run: - command: HOMEBREW_NO_AUTO_UPDATE=1 brew install xcbeautify - name: Install xcbeautify - build_and_run_xcode_tests: - steps: - - run: - command: xcodebuild clean test -resultBundlePath ~/TestResults/ResultBundle.xcresult -project "Apollo.xcodeproj" -scheme "${CIRCLE_XCODE_SCHEME}" -destination "${DESTINATION}" -testPlan "${CIRCLE_XCODE_TEST_PLAN}" | xcbeautify - name: Clean, build and run Xcode tests - - save-xcodebuild-artifacts - run_js_tests: - steps: - - run: - command: npm install && npm test - name: Run JS frontend tests - working_directory: Sources/ApolloCodegenLib/Frontend/JavaScript/ - cocoapods_install_test: - steps: - - run: - working_directory: Tests/CodegenCLITests/pod-install-test/ - command: pod install --verbose - name: CocoaPods - Install - - run: - working_directory: Tests/CodegenCLITests/pod-install-test/ - command: ./Pods/Apollo/apollo-ios-cli init --schema-name NewTestSchema --module-type other - name: CocoaPods - CLI Test (init) - - run: - working_directory: Tests/CodegenCLITests/pod-install-test/ - command: ./Pods/Apollo/apollo-ios-cli generate - name: CocoaPods - CLI Test (generate) - save-xcodebuild-artifacts: - description: Save artifacts logs, crash reports and test results generated by xcodebuild - steps: - - store_artifacts: - name: Save xcodebuild logs - path: logs - destination: logs - - store_artifacts: - name: Save crash logs - path: ~/Library/Logs/DiagnosticReports/ - destination: crashes - - run: - name: Zip result bundle - working_directory: ~/TestResults - command: zip -r ResultBundle.zip ResultBundle.xcresult - when: always - - store_artifacts: - name: Save test results - path: ~/TestResults/ResultBundle.zip - destination: results - codegen_test_configurations_generate_and_test: - steps: - - run: - command: | - if [[ ! -z "${CIRCLE_PR_REPONAME}" ]]; then - git clone "https://github.com/$CIRCLE_PR_USERNAME/$CIRCLE_PR_REPONAME.git" apollo-ios - cd apollo-ios - git checkout $CIRCLE_SHA1 - else - git clone -b "$CIRCLE_BRANCH" "$CIRCLE_REPOSITORY_URL" - fi - name: Manually clone Apollo iOS repository - - run: - command: HOMEBREW_NO_AUTO_UPDATE=1 brew install xcbeautify - name: Install xcbeautify - - run: - working_directory: apollo-ios/ - command: ./scripts/run-test-codegen-configurations.sh -t - name: Generate and Test Codegen Configurations - - -# Important! When adding a new job to `jobs`, make sure to define when it -# executes by also adding it to the `workflows` section below! -jobs: - Swift_Build: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - steps: - - common_test_setup - - run: - command: swift build - - XCFramework_Build: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - steps: - - common_test_setup - - run: - name: Build XCArchive (iOS Simulator) - command: xcodebuild archive -configuration Release -project "Apollo.xcodeproj" -scheme "Apollo" -destination 'generic/platform=iOS Simulator' -archivePath "./build/iphonesimulator.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES - - run: - name: Build XCArchive (iOS) - command: xcodebuild archive -configuration Release -project "Apollo.xcodeproj" -scheme "Apollo" -destination 'generic/platform=iOS' -archivePath "./build/iphoneos.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES - - run: - name: Build XCFramework - command: xcodebuild -create-xcframework -output ./build/Apollo.xcframework -framework ./build/iphonesimulator.xcarchive/Products/@rpath/Apollo.framework -framework ./build/iphoneos.xcarchive/Products/@rpath/Apollo.framework - - IntegrationTests_macOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=macOS,arch=x86_64 - CIRCLE_XCODE_SCHEME: Apollo - CIRCLE_XCODE_TEST_PLAN: Apollo-IntegrationTestPlan - steps: - - integration_test_setup - - build_and_run_xcode_tests - - integration_test_cleanup - - macOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=macOS,arch=x86_64 - CIRCLE_XCODE_SCHEME: Apollo - CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan - steps: - - common_test_setup - - build_and_run_xcode_tests - - iOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=iOS Simulator,OS=<< pipeline.parameters.ios_current_version >>,name=iPhone 14 - CIRCLE_XCODE_SCHEME: Apollo - CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan - steps: - - common_test_setup - - build_and_run_xcode_tests - - iOS_previous: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=iOS Simulator,OS=<< pipeline.parameters.ios_previous_version >>,name=iPhone 13 - CIRCLE_XCODE_SCHEME: Apollo - CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan - steps: - - common_test_setup - - build_and_run_xcode_tests - - tvOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=tvOS Simulator,OS=<< pipeline.parameters.tvos_version >>,name=Apple TV - CIRCLE_XCODE_SCHEME: Apollo - CIRCLE_XCODE_TEST_PLAN: Apollo-CITestPlan - steps: - - common_test_setup - - build_and_run_xcode_tests - - CodegenLib_macOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=macOS,arch=x86_64 - CIRCLE_XCODE_SCHEME: ApolloCodegenLib - CIRCLE_XCODE_TEST_PLAN: Apollo-Codegen-CITestPlan - steps: - - common_test_setup - - build_and_run_xcode_tests - - run_js_tests - - CodegenCLI_macOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=macOS,arch=x86_64 - CIRCLE_XCODE_SCHEME: CodegenCLI - CIRCLE_XCODE_TEST_PLAN: CodegenCLITestPlan - steps: - - common_test_setup - - build_and_run_xcode_tests - - CocoaPodsIntegration_macOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - environment: - DESTINATION: platform=macOS,arch=x86_64 - steps: - - common_test_setup - - cocoapods_install_test - - CodegenTestConfigurations_macOS_current: - resource_class: << pipeline.parameters.resource_class >> - macos: - xcode: << pipeline.parameters.xcode_version >> - steps: - - codegen_test_configurations_generate_and_test +orbs: + secops: apollo/circleci-secops-orb@2.0.0 workflows: - version: 2 - # This workflow builds and tests the library across various operating systems and versions - build-and-test: + security-scans: jobs: - - Swift_Build: - name: Build as Swift package - - XCFramework_Build: - name: Build XCFramework - - IntegrationTests_macOS_current: - name: Apollo Integration Tests - macOS << pipeline.parameters.macos_version >> - - macOS_current: - name: Apollo Unit Tests - macOS << pipeline.parameters.macos_version >> - - iOS_current: - name: Apollo Unit Tests - iOS << pipeline.parameters.ios_current_version >> - - iOS_previous: - name: Apollo Unit Tests - iOS << pipeline.parameters.ios_previous_version >> - - tvOS_current: - name: Apollo Unit Tests - tvOS << pipeline.parameters.tvos_version >> - - CodegenLib_macOS_current: - name: Codegen Lib Unit Tests - macOS << pipeline.parameters.macos_version >> - - CodegenCLI_macOS_current: - name: Codegen CLI Unit Tests - macOS << pipeline.parameters.macos_version >> - - CocoaPodsIntegration_macOS_current: - name: CocoaPods Integration Tests - macOS << pipeline.parameters.macos_version >> - - CodegenTestConfigurations_macOS_current: - name: Codegen Test Configurations - macOS << pipeline.parameters.macos_version >> + - secops/gitleaks: + context: + - platform-docker-ro + - github-orb + - secops-oidc + git-base-revision: <<#pipeline.git.base_revision>><><> + git-revision: << pipeline.git.revision >> diff --git a/.github/PULL_REQUEST_TEMPLATE/pull-request-template-release.md b/.github/PULL_REQUEST_TEMPLATE/pull-request-template-release.md deleted file mode 100644 index e87147de0f..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull-request-template-release.md +++ /dev/null @@ -1,17 +0,0 @@ -#### Diff - -[See diff since last version](https://github.com/apollographql/apollo-ios/compare/${PREVIOUS_VERSION_TAG}...{$VERSION_BRANCH}). - -#### Relevant changes: - - -#### Things to do in this PR -- [ ] Update the version constants using the `set-version.sh` script. -- [ ] Update [`CHANGELOG.md`](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md) with all relevant changes since the prior version. _Please include PR numbers and mention contributors for external PR submissions._ -- [ ] Run the Documentation Generator from the internal `SwiftScripts` folder using the command `swift run DocumentationGenerator` to re-generate the API reference documentation from source for all included libraries. _Make sure you are on HEAD of the parent branch otherwise the documentation generator will not catch all changes, rebase this PR if needed._ - -#### Things to do as part of releasing -- [ ] Add tag of format `major.minor.patch` to GitHub. -- [ ] Create a release on GitHub with the new tag, using the latest [`CHANGELOG.md`](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md) contents. -- [ ] Attach CLI binary to the GitHub release. _Use the `make archive-cli-for-release` command which builds both Intel and ARM architectures, and creates the tar archive for you._ -- [ ] Run `pod trunk push Apollo.podspec` to publish to CocoaPods. _You will need write permissions for this, please contact one of the [maintainers](https://github.com/apollographql/apollo-ios/blob/main/README.md#maintainers) if you need access to do this._ diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml deleted file mode 100644 index c7f2afe3bd..0000000000 --- a/.github/workflows/docs-publish.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Deploy docs to production - -on: - push: - branches: - - main - - release/1.0 - paths: - - docs/** - -permissions: - contents: read - -jobs: - publish: - permissions: - contents: read - uses: apollographql/docs/.github/workflows/publish.yml@main - secrets: - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml new file mode 100644 index 0000000000..b1829d4d30 --- /dev/null +++ b/.github/workflows/pr-close.yml @@ -0,0 +1,14 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened] + +jobs: + run: + name: Close and Comment PR + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: "We do not accept PRs directly to the 'apollo-ios' repo. All development is done through the 'apollo-ios-dev' repo, please see the CONTRIBUTING guide for more information." \ No newline at end of file diff --git a/.gitignore b/.gitignore index 41b895761d..514275e0fe 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ xcuserdata/ *.xcscmblueprint .DS_Store +## Visual Studio Code +.vscode/launch.json + ## Obj-C/Swift specific *.hmap *.ipa diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a625..0000000000 --- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Apollo.podspec b/Apollo.podspec index d51506a2ac..59c13778f4 100644 --- a/Apollo.podspec +++ b/Apollo.podspec @@ -17,9 +17,7 @@ Pod::Spec.new do |s| cli_binary_name = 'apollo-ios-cli' s.preserve_paths = [cli_binary_name] s.prepare_command = <<-CMD - make clean build-cli-for-cocoapods - cp .build/release/#{cli_binary_name} #{cli_binary_name} - chmod +x #{cli_binary_name} + make unpack-cli CMD s.subspec 'Core' do |ss| @@ -40,9 +38,4 @@ Pod::Spec.new do |s| ss.dependency 'Apollo/Core' end - s.subspec 'ApolloTestSupport' do |ss| - ss.source_files = 'Sources/ApolloTestSupport/*.swift' - ss.dependency 'Apollo/Core' - end - end diff --git a/Apollo.xcodeproj/project.pbxproj b/Apollo.xcodeproj/project.pbxproj deleted file mode 100644 index c044349e1c..0000000000 --- a/Apollo.xcodeproj/project.pbxproj +++ /dev/null @@ -1,6866 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXBuildFile section */ - 07236D332A992498009BFF7B /* RequestContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07236D322A992498009BFF7B /* RequestContextTests.swift */; }; - 073D39F52A8AD1AF001BD34A /* RequestContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 073D39F42A8AD1AF001BD34A /* RequestContext.swift */; }; - 19E9F6AC26D58A9A003AB80E /* OperationMessageIdCreatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E9F6AA26D58A92003AB80E /* OperationMessageIdCreatorTests.swift */; }; - 19E9F6B526D6BF25003AB80E /* OperationMessageIdCreator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E9F6A826D5867E003AB80E /* OperationMessageIdCreator.swift */; }; - 2EE7FFD0276802E30035DC39 /* CacheKeyConstructionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EE7FFCF276802E30035DC39 /* CacheKeyConstructionTests.swift */; }; - 534A754528EB21D6003291BE /* TemplateString+DeprecationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 534A754428EB21D6003291BE /* TemplateString+DeprecationMessage.swift */; }; - 54DDB0921EA045870009DD99 /* InMemoryNormalizedCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54DDB0911EA045870009DD99 /* InMemoryNormalizedCache.swift */; }; - 5AC6CA4322AAF7B200B7C94D /* GraphQLHTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AC6CA4222AAF7B200B7C94D /* GraphQLHTTPMethod.swift */; }; - 5BB2C0232380836100774170 /* VersionNumberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BB2C0222380836100774170 /* VersionNumberTests.swift */; }; - 6608B3362A7D402B006FB655 /* ApolloCodegenConfiguration+OperationManifestConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6608B3342A7D3FF5006FB655 /* ApolloCodegenConfiguration+OperationManifestConfiguration.swift */; }; - 662EA65E2A701483008A1931 /* GenerateOperationManifest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662EA65D2A701483008A1931 /* GenerateOperationManifest.swift */; }; - 662EA6602A705BD7008A1931 /* GenerateOperationManifestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662EA65F2A705BD7008A1931 /* GenerateOperationManifestTests.swift */; }; - 66321AE72A126C4400CC35CB /* IR+Formatting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66321AE62A126C4400CC35CB /* IR+Formatting.swift */; }; - 66B18E872A15367300525DFB /* URLSessionClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F4542244A2AD300C2CF7D /* URLSessionClientTests.swift */; }; - 66B18E902A16BF9B00525DFB /* MockURLProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66B18E8E2A16BF9B00525DFB /* MockURLProtocol.swift */; }; - 96F32D3B27CCD16B00F3383C /* animalkingdom-graphql in Resources */ = {isa = PBXBuildFile; fileRef = 96F32D3A27CCD16B00F3383C /* animalkingdom-graphql */; }; - 96F32D3C27CCD16D00F3383C /* animalkingdom-graphql in Resources */ = {isa = PBXBuildFile; fileRef = 96F32D3A27CCD16B00F3383C /* animalkingdom-graphql */; }; - 9B1CCDD92360F02C007C9032 /* Bundle+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B1CCDD82360F02C007C9032 /* Bundle+Helpers.swift */; }; - 9B21FD752422C29D00998B5C /* GraphQLFileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B21FD742422C29D00998B5C /* GraphQLFileTests.swift */; }; - 9B260BEB245A020300562176 /* ApolloInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BEA245A020300562176 /* ApolloInterceptor.swift */; }; - 9B260BF1245A025400562176 /* HTTPRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BF0245A025400562176 /* HTTPRequest.swift */; }; - 9B260BF3245A026F00562176 /* RequestChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BF2245A026F00562176 /* RequestChain.swift */; }; - 9B260BF5245A028D00562176 /* HTTPResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BF4245A028D00562176 /* HTTPResponse.swift */; }; - 9B260BF9245A030100562176 /* ResponseCodeInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BF8245A030100562176 /* ResponseCodeInterceptor.swift */; }; - 9B260BFB245A031900562176 /* NetworkFetchInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BFA245A031900562176 /* NetworkFetchInterceptor.swift */; }; - 9B260BFF245A054700562176 /* JSONRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BFE245A054700562176 /* JSONRequest.swift */; }; - 9B260C04245A090600562176 /* RequestChainNetworkTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C03245A090600562176 /* RequestChainNetworkTransport.swift */; }; - 9B260C08245A437400562176 /* InterceptorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C07245A437400562176 /* InterceptorProvider.swift */; }; - 9B260C0A245A532500562176 /* JSONResponseParsingInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C09245A532500562176 /* JSONResponseParsingInterceptor.swift */; }; - 9B2B66F42513FAFE00B53ABF /* CancellationHandlingInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B2B66F32513FAFE00B53ABF /* CancellationHandlingInterceptor.swift */; }; - 9B2DFBBF24E1FA1A00ED3AE6 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9B2DFBCD24E201A800ED3AE6 /* UploadAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2DFBB624E1FA0D00ED3AE6 /* UploadAPI.framework */; }; - 9B47518D2575AA850001FB87 /* Pluralizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B47516D2575AA690001FB87 /* Pluralizer.swift */; }; - 9B4751AD2575B5070001FB87 /* PluralizerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4751AC2575B5070001FB87 /* PluralizerTests.swift */; }; - 9B4F453F244A27B900C2CF7D /* URLSessionClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F453E244A27B900C2CF7D /* URLSessionClient.swift */; }; - 9B554CC4247DC29A002F452A /* TaskData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B554CC3247DC29A002F452A /* TaskData.swift */; }; - 9B64F6762354D219002D1BB5 /* URL+QueryDict.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B64F6752354D219002D1BB5 /* URL+QueryDict.swift */; }; - 9B68F0552416B33300E97318 /* LineByLineComparison.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B68F0542416B33300E97318 /* LineByLineComparison.swift */; }; - 9B708AAD2305884500604A11 /* ApolloClientProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B708AAC2305884500604A11 /* ApolloClientProtocol.swift */; }; - 9B78C71E2326E86E000C8C32 /* ErrorGenerationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B78C71B2326E859000C8C32 /* ErrorGenerationTests.swift */; }; - 9B7B6F59233C287200F32205 /* ApolloCodegen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B6F57233C287100F32205 /* ApolloCodegen.swift */; }; - 9B7B6F5A233C287200F32205 /* ApolloCodegenConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B6F58233C287100F32205 /* ApolloCodegenConfiguration.swift */; }; - 9B7B6F69233C2C0C00F32205 /* FileManager+Apollo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B6F68233C2C0C00F32205 /* FileManager+Apollo.swift */; }; - 9B7BDA9B23FDE94C00ACD198 /* WebSocketError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA9423FDE94C00ACD198 /* WebSocketError.swift */; }; - 9B7BDA9C23FDE94C00ACD198 /* WebSocketTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA9523FDE94C00ACD198 /* WebSocketTask.swift */; }; - 9B7BDA9D23FDE94C00ACD198 /* SplitNetworkTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA9623FDE94C00ACD198 /* SplitNetworkTransport.swift */; }; - 9B7BDA9E23FDE94C00ACD198 /* OperationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA9723FDE94C00ACD198 /* OperationMessage.swift */; }; - 9B7BDA9F23FDE94C00ACD198 /* WebSocketClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA9823FDE94C00ACD198 /* WebSocketClient.swift */; }; - 9B7BDAA023FDE94C00ACD198 /* WebSocketTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA9923FDE94C00ACD198 /* WebSocketTransport.swift */; }; - 9B7BDAD023FDEBE300ACD198 /* SQLiteSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDACD23FDEBE300ACD198 /* SQLiteSerialization.swift */; }; - 9B7BDAD223FDEBE300ACD198 /* SQLiteNormalizedCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDACF23FDEBE300ACD198 /* SQLiteNormalizedCache.swift */; }; - 9B7BDAF623FDEE2600ACD198 /* SQLite in Frameworks */ = {isa = PBXBuildFile; productRef = 9B7BDAF523FDEE2600ACD198 /* SQLite */; }; - 9B7BDAFA23FDEE8A00ACD198 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9B7BDAFD23FDEE9300ACD198 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9B8C3FB3248DA2FE00707B13 /* URL+Apollo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8C3FB1248DA2EA00707B13 /* URL+Apollo.swift */; }; - 9B8C3FB5248DA3E000707B13 /* URLExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8C3FB4248DA3E000707B13 /* URLExtensionsTests.swift */; }; - 9B95EDC022CAA0B000702BB2 /* GETTransformerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B95EDBF22CAA0AF00702BB2 /* GETTransformerTests.swift */; }; - 9B96500A24BE62B7003C29C0 /* RequestChainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B96500824BE6201003C29C0 /* RequestChainTests.swift */; }; - 9B96500C24BE7239003C29C0 /* CacheReadInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B96500B24BE7239003C29C0 /* CacheReadInterceptor.swift */; }; - 9B9BBAF324DB39D70021C30F /* UploadRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9BBAF224DB39D70021C30F /* UploadRequest.swift */; }; - 9B9BBAF524DB4F890021C30F /* AutomaticPersistedQueryInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9BBAF424DB4F890021C30F /* AutomaticPersistedQueryInterceptor.swift */; }; - 9B9BBB1C24DB760B0021C30F /* UploadRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9BBB1A24DB75E60021C30F /* UploadRequestTests.swift */; }; - 9B9F16A726013DAB00FB2F31 /* SQLiteDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9F16A626013DAB00FB2F31 /* SQLiteDatabase.swift */; }; - 9B9F16B82601532500FB2F31 /* SQLiteDotSwiftDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9F16B72601532500FB2F31 /* SQLiteDotSwiftDatabase.swift */; }; - 9BA1244A22D8A8EA00BF1D24 /* JSONSerialization+Sorting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BA1244922D8A8EA00BF1D24 /* JSONSerialization+Sorting.swift */; }; - 9BA3130E2302BEA5007B7FC5 /* DispatchQueue+Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BA3130D2302BEA5007B7FC5 /* DispatchQueue+Optional.swift */; }; - 9BAEEBEE2346644600808306 /* ApolloSchemaDownloadConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEBED2346644600808306 /* ApolloSchemaDownloadConfiguration.swift */; }; - 9BAEEBEF2346644B00808306 /* ApolloSchemaDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEBEB234663F200808306 /* ApolloSchemaDownloader.swift */; }; - 9BAEEBF32346DDAD00808306 /* CodegenLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEBF22346DDAD00808306 /* CodegenLogger.swift */; }; - 9BAEEBF72346F0A000808306 /* StaticString+Apollo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEBF62346F0A000808306 /* StaticString+Apollo.swift */; }; - 9BAEEC01234BB8FD00808306 /* ApolloCodegenLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; }; - 9BAEEC10234BB95B00808306 /* FileManagerExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEC0D234BB95B00808306 /* FileManagerExtensionTests.swift */; }; - 9BAEEC17234C275600808306 /* ApolloSchemaPublicTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEC16234C275600808306 /* ApolloSchemaPublicTests.swift */; }; - 9BAEEC19234C297800808306 /* ApolloCodegenConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEC18234C297800808306 /* ApolloCodegenConfigurationTests.swift */; }; - 9BC139A424EDCA6C00876D29 /* MaxRetryInterceptorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC139A224EDCA4400876D29 /* MaxRetryInterceptorTests.swift */; }; - 9BC139A624EDCAD900876D29 /* BlindRetryingTestInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC139A524EDCAD900876D29 /* BlindRetryingTestInterceptor.swift */; }; - 9BC139A824EDCE4F00876D29 /* RetryToCountThenSucceedInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC139A724EDCE4F00876D29 /* RetryToCountThenSucceedInterceptor.swift */; }; - 9BC742AC24CFB2FF0029282C /* ApolloErrorInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC742AB24CFB2FF0029282C /* ApolloErrorInterceptor.swift */; }; - 9BC742AE24CFB6450029282C /* CacheWriteInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC742AD24CFB6450029282C /* CacheWriteInterceptor.swift */; }; - 9BCA8C0926618226004FF2F6 /* UntypedGraphQLRequestBodyCreator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCA8C0826618226004FF2F6 /* UntypedGraphQLRequestBodyCreator.swift */; }; - 9BCF0CE023FC9CA50031D2A2 /* TestCacheProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCF0CD923FC9CA50031D2A2 /* TestCacheProvider.swift */; }; - 9BCF0CE323FC9CA50031D2A2 /* XCTAssertHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCF0CDC23FC9CA50031D2A2 /* XCTAssertHelpers.swift */; }; - 9BCF0CE423FC9CA50031D2A2 /* MockURLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCF0CDD23FC9CA50031D2A2 /* MockURLSession.swift */; }; - 9BCF0CE523FC9CA50031D2A2 /* MockNetworkTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCF0CDF23FC9CA50031D2A2 /* MockNetworkTransport.swift */; }; - 9BCF0CE623FC9D7B0031D2A2 /* ApolloInternalTestHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BCF0CDA23FC9CA50031D2A2 /* ApolloInternalTestHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9BDE43D122C6655300FD7C7F /* Cancellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BDE43D022C6655200FD7C7F /* Cancellable.swift */; }; - 9BDE43DF22C6708600FD7C7F /* GraphQLHTTPRequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BDE43DE22C6708600FD7C7F /* GraphQLHTTPRequestError.swift */; }; - 9BE071AD2368D08700FA5952 /* Collection+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE071AC2368D08700FA5952 /* Collection+Helpers.swift */; }; - 9BE74D3D23FB4A8E006D354F /* FileFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE74D3C23FB4A8E006D354F /* FileFinder.swift */; }; - 9BEDC79E22E5D2CF00549BF6 /* RequestBodyCreator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BEDC79D22E5D2CF00549BF6 /* RequestBodyCreator.swift */; }; - 9BEEDC2824E351E5001D1294 /* MaxRetryInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BEEDC2724E351E5001D1294 /* MaxRetryInterceptor.swift */; }; - 9BEEDC2B24E61995001D1294 /* TestURLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BEEDC2A24E61995001D1294 /* TestURLs.swift */; }; - 9BF1A95122CA6E71005292C2 /* GraphQLGETTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BF1A95022CA6E71005292C2 /* GraphQLGETTransformer.swift */; }; - 9BF6C94325194DE2000D5B93 /* MultipartFormData+Testing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BF6C91725194D7B000D5B93 /* MultipartFormData+Testing.swift */; }; - 9BF6C97025194ED7000D5B93 /* MultipartFormDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BF6C95225194EA5000D5B93 /* MultipartFormDataTests.swift */; }; - 9BFE8DA9265D5D8F000BBF81 /* URLDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BFE8DA8265D5D8F000BBF81 /* URLDownloader.swift */; }; - 9F1A966B258F34BB00A06EEB /* GraphQLJSFrontend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1A9665258F34BB00A06EEB /* GraphQLJSFrontend.swift */; }; - 9F1A966C258F34BB00A06EEB /* GraphQLSchema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1A9667258F34BB00A06EEB /* GraphQLSchema.swift */; }; - 9F1A966D258F34BB00A06EEB /* CompilationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1A9668258F34BB00A06EEB /* CompilationResult.swift */; }; - 9F1A966F258F34BB00A06EEB /* JavaScriptBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1A966A258F34BB00A06EEB /* JavaScriptBridge.swift */; }; - 9F21730E2567E6F000566121 /* DataLoaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FADC8531E6B86D900C677E6 /* DataLoaderTests.swift */; }; - 9F21735B2568F3E200566121 /* PossiblyDeferredTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F21735A2568F3E200566121 /* PossiblyDeferredTests.swift */; }; - 9F295E311E27534800A24949 /* GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F295E301E27534800A24949 /* GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift */; }; - 9F295E381E277B2A00A24949 /* GraphQLResultNormalizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F295E371E277B2A00A24949 /* GraphQLResultNormalizer.swift */; }; - 9F3910272549741400AF54A6 /* MockGraphQLServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3910262549741400AF54A6 /* MockGraphQLServer.swift */; }; - 9F438D071E6C2FD9007BDC1A /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9F533AB31E6C4A4200CBE097 /* BatchedLoadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F438D0B1E6C494C007BDC1A /* BatchedLoadTests.swift */; }; - 9F54C8B7255D760B0065AFD6 /* ParsingPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F54C8B6255D760B0065AFD6 /* ParsingPerformanceTests.swift */; }; - 9F54C8B9255D760B0065AFD6 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9F54C90F255D79C80065AFD6 /* ApolloInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */; }; - 9F54C910255D79C80065AFD6 /* GitHubAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FACA9C61F42E67200AE2DBD /* GitHubAPI.framework */; }; - 9F55347B1DE1DB2100E54264 /* ApolloStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F55347A1DE1DB2100E54264 /* ApolloStore.swift */; }; - 9F578D901D8D2CB300C0EA36 /* HTTPURLResponse+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F578D8F1D8D2CB300C0EA36 /* HTTPURLResponse+Helpers.swift */; }; - 9F628E9525935BE600F94F9D /* GraphQLType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F628E9425935BE600F94F9D /* GraphQLType.swift */; }; - 9F628EB52593651B00F94F9D /* GraphQLValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F628EB42593651B00F94F9D /* GraphQLValue.swift */; }; - 9F62DF8E2590539A00E6E808 /* SchemaIntrospectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F62DF8D2590539A00E6E808 /* SchemaIntrospectionTests.swift */; }; - 9F62DFAE2590557F00E6E808 /* DocumentParsingAndValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F62DFAD2590557F00E6E808 /* DocumentParsingAndValidationTests.swift */; }; - 9F62DFD02590710E00E6E808 /* GraphQLSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F62DFCF2590710E00E6E808 /* GraphQLSource.swift */; }; - 9F62E0102590728000E6E808 /* CompilationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F62E00F2590728000E6E808 /* CompilationTests.swift */; }; - 9F62E03F2590896400E6E808 /* GraphQLError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F62E03E2590896400E6E808 /* GraphQLError.swift */; }; - 9F65B1211EC106F30090B25F /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9F68F9F125415827004F26D0 /* XCTestCase+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F68F9F025415827004F26D0 /* XCTestCase+Helpers.swift */; }; - 9F69FFA91D42855900E000B1 /* NetworkTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69FFA81D42855900E000B1 /* NetworkTransport.swift */; }; - 9F86B68B1E6438D700B885FF /* GraphQLSelectionSetMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F86B68A1E6438D700B885FF /* GraphQLSelectionSetMapper.swift */; }; - 9F8A958D1EC0FFAB00304A2D /* ApolloInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */; }; - 9F8E0BD325668552000D9FA5 /* DataLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FADC84E1E6B865E00C677E6 /* DataLoader.swift */; }; - 9F8E0BE325668559000D9FA5 /* PossiblyDeferred.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F33D6A32566475600A1543F /* PossiblyDeferred.swift */; }; - 9F91CF8F1F6C0DB2008DD0BE /* MutatingSelectionSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F91CF8E1F6C0DB2008DD0BE /* MutatingSelectionSetTests.swift */; }; - 9FA6F3681E65DF4700BF8D73 /* GraphQLResultAccumulator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6F3671E65DF4700BF8D73 /* GraphQLResultAccumulator.swift */; }; - 9FACA9BE1F42E67200AE2DBD /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9FBE0D4025407B64002ED0B1 /* AsyncResultObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FBE0D3F25407B64002ED0B1 /* AsyncResultObserver.swift */; }; - 9FC2333D1E66BBF7001E4541 /* GraphQLDependencyTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC2333C1E66BBF7001E4541 /* GraphQLDependencyTracker.swift */; }; - 9FC750481D2A532C00458D91 /* Apollo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FC750471D2A532C00458D91 /* Apollo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9FC7504F1D2A532D00458D91 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - 9FC750631D2A59F600458D91 /* ApolloClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC750621D2A59F600458D91 /* ApolloClient.swift */; }; - 9FC9A9BD1E2C271C0023C4D5 /* RecordSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC9A9BC1E2C271C0023C4D5 /* RecordSet.swift */; }; - 9FC9A9BF1E2C27FB0023C4D5 /* GraphQLResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC9A9BE1E2C27FB0023C4D5 /* GraphQLResult.swift */; }; - 9FC9A9C81E2EFE6E0023C4D5 /* CacheKeyForFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC9A9C71E2EFE6E0023C4D5 /* CacheKeyForFieldTests.swift */; }; - 9FC9A9CC1E2FD0760023C4D5 /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC9A9CB1E2FD0760023C4D5 /* Record.swift */; }; - 9FCDFD291E33D0CE007519DC /* GraphQLQueryWatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCDFD281E33D0CE007519DC /* GraphQLQueryWatcher.swift */; }; - 9FCE2CEE1E6BE2D900E34457 /* NormalizedCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCE2CED1E6BE2D800E34457 /* NormalizedCache.swift */; }; - 9FCE2D091E6C254700E34457 /* StarWarsAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FCE2CFA1E6C213D00E34457 /* StarWarsAPI.framework */; }; - 9FD1519A255D7F30003BDAAA /* IssuesAndCommentsForRepository.json in Resources */ = {isa = PBXBuildFile; fileRef = 9FD15199255D7F30003BDAAA /* IssuesAndCommentsForRepository.json */; }; - 9FDE0731258F3AA100DC0CA5 /* SchemaLoadingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1A96AF258F36B200A06EEB /* SchemaLoadingTests.swift */; }; - 9FEB050D1DB5732300DA3B44 /* JSONSerializationFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FEB050C1DB5732300DA3B44 /* JSONSerializationFormat.swift */; }; - 9FF90A611DDDEB100034C3B6 /* GraphQLResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF90A5B1DDDEB100034C3B6 /* GraphQLResponse.swift */; }; - 9FF90A651DDDEB100034C3B6 /* GraphQLExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF90A5C1DDDEB100034C3B6 /* GraphQLExecutor.swift */; }; - 9FF90A6F1DDDEB420034C3B6 /* GraphQLMapEncodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF90A6A1DDDEB420034C3B6 /* GraphQLMapEncodingTests.swift */; }; - 9FF90A711DDDEB420034C3B6 /* GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF90A6B1DDDEB420034C3B6 /* GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift */; }; - 9FF90A731DDDEB420034C3B6 /* ParseQueryResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF90A6C1DDDEB420034C3B6 /* ParseQueryResponseTests.swift */; }; - B9C0075A298308F900855D2B /* ApolloMath.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9C00759298308F900855D2B /* ApolloMath.swift */; }; - B9C0075E298312FD00855D2B /* GraphQLFirstReceivedAtTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9C0075D298312FD00855D2B /* GraphQLFirstReceivedAtTracker.swift */; }; - C3279FC72345234D00224790 /* TestCustomRequestBodyCreator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3279FC52345233000224790 /* TestCustomRequestBodyCreator.swift */; }; - C338DF1722DD9DE9006AF33E /* RequestBodyCreatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C338DF1622DD9DE9006AF33E /* RequestBodyCreatorTests.swift */; }; - C377CCA922D798BD00572E03 /* GraphQLFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C377CCA822D798BD00572E03 /* GraphQLFile.swift */; }; - C377CCAB22D7992E00572E03 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C377CCAA22D7992E00572E03 /* MultipartFormData.swift */; }; - D87AC09F2564D60B0079FAA5 /* ApolloClientOperationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87AC09E2564D60B0079FAA5 /* ApolloClientOperationTests.swift */; }; - DE01451228A442BF000F6F18 /* String+SwiftNameEscaping.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE01451128A442BF000F6F18 /* String+SwiftNameEscaping.swift */; }; - DE01451428A5A156000F6F18 /* ValidationOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE01451328A5A156000F6F18 /* ValidationOptions.swift */; }; - DE01451628A5A971000F6F18 /* MockValidationOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE01451528A5A971000F6F18 /* MockValidationOptions.swift */; }; - DE03FDDB2784D0B2007425BD /* DataDict.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE03FDDA2784D0B2007425BD /* DataDict.swift */; }; - DE058609266978A100265760 /* Selection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE664ED326602AF60054DB4F /* Selection.swift */; }; - DE05860B266978A100265760 /* SelectionSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE3C7B10260A6FC900D2F4FF /* SelectionSet.swift */; }; - DE05860C266978A100265760 /* FragmentProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE3C7B12260A6FC900D2F4FF /* FragmentProtocols.swift */; }; - DE05860D266978A100265760 /* ScalarTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE3C7B15260A6FCA00D2F4FF /* ScalarTypes.swift */; }; - DE05860E266978A100265760 /* GraphQLNullable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B68F06E241C649E00E97318 /* GraphQLNullable.swift */; }; - DE058610266978A100265760 /* InputValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC9A9C11E2D3CAF0023C4D5 /* InputValue.swift */; }; - DE058616266978A100265760 /* GraphQLEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE3C7B14260A6FCA00D2F4FF /* GraphQLEnum.swift */; }; - DE05862D2669800000265760 /* Matchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE071AE2368D34D00FA5952 /* Matchable.swift */; }; - DE0586332669948500265760 /* InputValue+Evaluation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0586322669948500265760 /* InputValue+Evaluation.swift */; }; - DE0586372669958F00265760 /* GraphQLError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC9A9D21E2FD48B0023C4D5 /* GraphQLError.swift */; }; - DE0586392669985000265760 /* Dictionary+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0586382669985000265760 /* Dictionary+Helpers.swift */; }; - DE071E7A2899FB7F0089BDAA /* GraphQLCompositeType+SchemaTypeNamespace.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE071E792899FB7F0089BDAA /* GraphQLCompositeType+SchemaTypeNamespace.swift */; }; - DE09066F27A4713F00211300 /* OperationDefinitionTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE09066E27A4713F00211300 /* OperationDefinitionTemplateTests.swift */; }; - DE09114E27288B1F000648E5 /* SortedSelections.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE09114D27288B1F000648E5 /* SortedSelections.swift */; }; - DE09F9BD27024FEA00795949 /* InputObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE09F9BC27024FEA00795949 /* InputObject.swift */; }; - DE09F9C3270269E800795949 /* MockJavaScriptObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE09F9C0270269E800795949 /* MockJavaScriptObject.swift */; }; - DE09F9C6270269F800795949 /* OperationDefinitionTemplate_DocumentType_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE09F9C5270269F800795949 /* OperationDefinitionTemplate_DocumentType_Tests.swift */; }; - DE0D38F0282ECA6D00AFCC84 /* MockObjectFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0D38EF282ECA6D00AFCC84 /* MockObjectFileGenerator.swift */; }; - DE0D38F2282ECF9700AFCC84 /* MockObjectFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0D38F1282ECF9700AFCC84 /* MockObjectFileGeneratorTests.swift */; }; - DE100B18287F3FB100BE11C2 /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = DE100B17287F3FB100BE11C2 /* Documentation.docc */; }; - DE100B1A28872D0F00BE11C2 /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = DE100B1928872D0F00BE11C2 /* Documentation.docc */; }; - DE100B1C28872F4200BE11C2 /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = DE100B1B28872F4200BE11C2 /* Documentation.docc */; }; - DE100B1E28873A2500BE11C2 /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = DE100B1D28873A2500BE11C2 /* Documentation.docc */; }; - DE100B202887415D00BE11C2 /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = DE100B1F2887415D00BE11C2 /* Documentation.docc */; }; - DE12B2D7273B204B003371CC /* TestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE12B2D6273B204B003371CC /* TestError.swift */; }; - DE12B2D9273C4338003371CC /* MockIRSubscripts.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE12B2D8273C4338003371CC /* MockIRSubscripts.swift */; }; - DE1540DC2A3A76F700A5A8B6 /* IRInputObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1540DB2A3A76F700A5A8B6 /* IRInputObjectTests.swift */; }; - DE1696D4298C51CF00345E1A /* SelectionSetTemplate_Initializers_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1696D3298C51CF00345E1A /* SelectionSetTemplate_Initializers_Tests.swift */; }; - DE181A2C26C5C0CB000C0B9C /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE181A2B26C5C0CB000C0B9C /* WebSocket.swift */; }; - DE181A2E26C5C299000C0B9C /* SSLClientCertificate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE181A2D26C5C299000C0B9C /* SSLClientCertificate.swift */; }; - DE181A3026C5C38E000C0B9C /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE181A2F26C5C38E000C0B9C /* SSLSecurity.swift */; }; - DE181A3226C5C401000C0B9C /* Compression.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE181A3126C5C401000C0B9C /* Compression.swift */; }; - DE181A3426C5D8D4000C0B9C /* CompressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE181A3326C5D8D4000C0B9C /* CompressionTests.swift */; }; - DE181A3626C5DE4F000C0B9C /* WebSocketStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE181A3526C5DE4F000C0B9C /* WebSocketStream.swift */; }; - DE1C6F00284161DE0050164B /* AnyHashableConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1C6EFF284161DE0050164B /* AnyHashableConvertible.swift */; }; - DE223C1C271F3288004A0148 /* AnimalKingdomIRCreationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE223C1B271F3288004A0148 /* AnimalKingdomIRCreationTests.swift */; }; - DE223C24271F335D004A0148 /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE223C23271F335D004A0148 /* Resources.swift */; }; - DE223C2D2721FCE8004A0148 /* ScopedSelectionSetHashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE223C2C2721FCE8004A0148 /* ScopedSelectionSetHashable.swift */; }; - DE223C3327221144004A0148 /* IRMatchers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE223C2A2721FAD6004A0148 /* IRMatchers.swift */; }; - DE2739112769AEBA00B886EF /* SelectionSetTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2739102769AEBA00B886EF /* SelectionSetTemplate.swift */; }; - DE296539279B3B8200BF9B49 /* SelectionSetTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE296536279B3B8200BF9B49 /* SelectionSetTemplateTests.swift */; }; - DE296BA527A07C37004F571F /* MockMergedSelections.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE296BA427A07C37004F571F /* MockMergedSelections.swift */; }; - DE299E922A0D6FD6000F71D2 /* ObjectData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE299E912A0D6FD6000F71D2 /* ObjectData.swift */; }; - DE299E962A0D7916000F71D2 /* SelectionField_CacheKeyForFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE299E952A0D7916000F71D2 /* SelectionField_CacheKeyForFieldTests.swift */; }; - DE2A20E829032E1F008ADE48 /* VersionChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2A20E729032E1F008ADE48 /* VersionChecker.swift */; }; - DE2A20ED29033ABE008ADE48 /* VersionCheckerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2A20EC29033ABE008ADE48 /* VersionCheckerTests.swift */; }; - DE2FCF1D26E806710057EA67 /* SchemaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2FCF1C26E806710057EA67 /* SchemaConfiguration.swift */; }; - DE2FCF2726E8083A0057EA67 /* Union.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2FCF2326E8083A0057EA67 /* Union.swift */; }; - DE2FCF2826E8083A0057EA67 /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2FCF2426E8083A0057EA67 /* Interface.swift */; }; - DE2FCF2926E8083A0057EA67 /* Object.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2FCF2526E8083A0057EA67 /* Object.swift */; }; - DE2FCF4526E80CF10057EA67 /* GraphQLOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC750601D2A59C300458D91 /* GraphQLOperation.swift */; }; - DE2FCF4926E94D150057EA67 /* TestMockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2FCF4826E94D150057EA67 /* TestMockTests.swift */; }; - DE3484622746FF8F0065B77E /* IR+OperationBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE3484612746FF8F0065B77E /* IR+OperationBuilder.swift */; }; - DE363CB327640FBA001EC05B /* GraphQLJSFrontend+TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE363CB227640FBA001EC05B /* GraphQLJSFrontend+TestHelpers.swift */; }; - DE454BA728B40D52009DC80E /* SchemaConfigurationFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE454BA628B40D52009DC80E /* SchemaConfigurationFileGeneratorTests.swift */; }; - DE454BA928B40DA8009DC80E /* SchemaConfigurationFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE454BA828B40DA8009DC80E /* SchemaConfigurationFileGenerator.swift */; }; - DE454BAB28B40E56009DC80E /* SchemaConfigurationTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE454BAA28B40E56009DC80E /* SchemaConfigurationTemplate.swift */; }; - DE454BB528B43058009DC80E /* SchemaConfigurationTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE454BB428B43058009DC80E /* SchemaConfigurationTemplateTests.swift */; }; - DE46A55126EFEB6900357C52 /* JSONValueMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5EB9C626EFE0F80004176A /* JSONValueMatcher.swift */; }; - DE46A55626F13A7400357C52 /* JSONResponseParsingInterceptorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE46A55426F13A0900357C52 /* JSONResponseParsingInterceptorTests.swift */; }; - DE46A55826F13AD000357C52 /* ResponseCodeInterceptorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE46A55726F13AD000357C52 /* ResponseCodeInterceptorTests.swift */; }; - DE4766E826F92F30004622E0 /* MockSchemaMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4766E726F92F30004622E0 /* MockSchemaMetadata.swift */; }; - DE4B1E542889EF330058D1F6 /* EnumType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4B1E532889EF330058D1F6 /* EnumType.swift */; }; - DE4B1E572891D2F40058D1F6 /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B6CB23D238077B60007259D /* Atomic.swift */; }; - DE4B1E582891D5F10058D1F6 /* LinkedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4841A82745BBF10001E594 /* LinkedList.swift */; }; - DE4B1E592891D5FE0058D1F6 /* IsEverTrue.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE296BA627A09A11004F571F /* IsEverTrue.swift */; }; - DE4D54E727A3504B00D26B68 /* OperationFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4D54E627A3504B00D26B68 /* OperationFileGenerator.swift */; }; - DE4D54E927A3518100D26B68 /* FragmentFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4D54E827A3518100D26B68 /* FragmentFileGenerator.swift */; }; - DE5144B12A04703F00D991E9 /* NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5144B02A04703F00D991E9 /* NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift */; }; - DE56DC232683B2020090D6E4 /* DefaultInterceptorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE56DC222683B2020090D6E4 /* DefaultInterceptorProvider.swift */; }; - DE5B314027A482C80051C9D3 /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5B313F27A482C80051C9D3 /* Resources.swift */; }; - DE5E79BB289DA90600CD0DE5 /* MockInterfacesFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5E79BA289DA90600CD0DE5 /* MockInterfacesFileGeneratorTests.swift */; }; - DE5E79BD289DA97E00CD0DE5 /* MockInterfacesTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5E79BC289DA97E00CD0DE5 /* MockInterfacesTemplateTests.swift */; }; - DE5E79BF289DBCE700CD0DE5 /* CacheKeyInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5E79BE289DBCE700CD0DE5 /* CacheKeyInfo.swift */; }; - DE5EB9C026EFCB010004176A /* TestObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5EB9BF26EFCB010004176A /* TestObserver.swift */; }; - DE5EB9C226EFCBD40004176A /* MockApolloStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5EB9C126EFCBD40004176A /* MockApolloStore.swift */; }; - DE5EB9C526EFD4D10004176A /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = DE5EB9C426EFD4D10004176A /* Nimble */; }; - DE5EB9CB26EFE5510004176A /* MockOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5EB9CA26EFE5510004176A /* MockOperation.swift */; }; - DE5EEC83279796EA00AF5913 /* MockApolloCodegenConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD5FE276922AA0033EE23 /* MockApolloCodegenConfiguration.swift */; }; - DE5EEC8527988F1A00AF5913 /* IR+SelectionSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5EEC8427988F1A00AF5913 /* IR+SelectionSet.swift */; }; - DE5FD5FD2769222D0033EE23 /* OperationDefinitionTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD5FC2769222D0033EE23 /* OperationDefinitionTemplate.swift */; }; - DE5FD601276923620033EE23 /* TemplateString.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD600276923620033EE23 /* TemplateString.swift */; }; - DE5FD603276926EF0033EE23 /* IR+Mocking.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD602276926EF0033EE23 /* IR+Mocking.swift */; }; - DE5FD60527694FA70033EE23 /* SchemaMetadataTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD60427694FA70033EE23 /* SchemaMetadataTemplate.swift */; }; - DE5FD607276950CC0033EE23 /* IR+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD606276950CC0033EE23 /* IR+Schema.swift */; }; - DE5FD609276956C70033EE23 /* SchemaMetadataTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD608276956C70033EE23 /* SchemaMetadataTemplateTests.swift */; }; - DE5FD60B276970FC0033EE23 /* FragmentTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD60A276970FC0033EE23 /* FragmentTemplate.swift */; }; - DE6388DF28CBF38E00559697 /* GraphQLEnumValue+Rendered.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388DE28CBF38E00559697 /* GraphQLEnumValue+Rendered.swift */; }; - DE63891528D3BFBA00559697 /* PetDetails.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E228D3BFBA00559697 /* PetDetails.graphql.swift */; }; - DE63891628D3BFBA00559697 /* HeightInMeters.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E328D3BFBA00559697 /* HeightInMeters.graphql.swift */; }; - DE63891728D3BFBA00559697 /* ClassroomPetDetails.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E428D3BFBA00559697 /* ClassroomPetDetails.graphql.swift */; }; - DE63891828D3BFBA00559697 /* DogFragment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E528D3BFBA00559697 /* DogFragment.graphql.swift */; }; - DE63891928D3BFBA00559697 /* ClassroomPetDetailsCCN.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E628D3BFBA00559697 /* ClassroomPetDetailsCCN.graphql.swift */; }; - DE63891A28D3BFBA00559697 /* WarmBloodedDetails.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E728D3BFBA00559697 /* WarmBloodedDetails.graphql.swift */; }; - DE63891B28D3BFBA00559697 /* PetDetailsMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388E928D3BFBA00559697 /* PetDetailsMutation.graphql.swift */; }; - DE63891C28D3BFBA00559697 /* AllAnimalsLocalCacheMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388EA28D3BFBA00559697 /* AllAnimalsLocalCacheMutation.graphql.swift */; }; - DE63891D28D3BFBA00559697 /* PetAdoptionMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388ED28D3BFBA00559697 /* PetAdoptionMutation.graphql.swift */; }; - DE63891E28D3BFBA00559697 /* DogQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388EF28D3BFBA00559697 /* DogQuery.graphql.swift */; }; - DE63891F28D3BFBA00559697 /* AllAnimalsCCNQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F028D3BFBA00559697 /* AllAnimalsCCNQuery.graphql.swift */; }; - DE63892028D3BFBA00559697 /* ClassroomPetsQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F128D3BFBA00559697 /* ClassroomPetsQuery.graphql.swift */; }; - DE63892128D3BFBA00559697 /* ClassroomPetsCCNQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F228D3BFBA00559697 /* ClassroomPetsCCNQuery.graphql.swift */; }; - DE63892228D3BFBA00559697 /* AllAnimalsQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F328D3BFBA00559697 /* AllAnimalsQuery.graphql.swift */; }; - DE63892328D3BFBA00559697 /* AllAnimalsIncludeSkipQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F428D3BFBA00559697 /* AllAnimalsIncludeSkipQuery.graphql.swift */; }; - DE63892428D3BFBA00559697 /* PetSearchQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F528D3BFBA00559697 /* PetSearchQuery.graphql.swift */; }; - DE63892528D3BFBA00559697 /* ClassroomPet.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388F828D3BFBA00559697 /* ClassroomPet.graphql.swift */; }; - DE63892628D3BFBA00559697 /* CustomDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388FA28D3BFBA00559697 /* CustomDate.swift */; }; - DE63892728D3BFBA00559697 /* SkinCovering.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388FC28D3BFBA00559697 /* SkinCovering.graphql.swift */; }; - DE63892828D3BFBA00559697 /* RelativeSize.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388FD28D3BFBA00559697 /* RelativeSize.graphql.swift */; }; - DE63892928D3BFBA00559697 /* Rat.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6388FF28D3BFBA00559697 /* Rat.graphql.swift */; }; - DE63892A28D3BFBA00559697 /* Bird.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890028D3BFBA00559697 /* Bird.graphql.swift */; }; - DE63892B28D3BFBA00559697 /* PetRock.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890128D3BFBA00559697 /* PetRock.graphql.swift */; }; - DE63892C28D3BFBA00559697 /* Dog.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890228D3BFBA00559697 /* Dog.graphql.swift */; }; - DE63892D28D3BFBA00559697 /* Height.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890328D3BFBA00559697 /* Height.graphql.swift */; }; - DE63892E28D3BFBA00559697 /* Mutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890428D3BFBA00559697 /* Mutation.graphql.swift */; }; - DE63892F28D3BFBA00559697 /* Query.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890528D3BFBA00559697 /* Query.graphql.swift */; }; - DE63893028D3BFBA00559697 /* Cat.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890628D3BFBA00559697 /* Cat.graphql.swift */; }; - DE63893128D3BFBA00559697 /* Fish.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890728D3BFBA00559697 /* Fish.graphql.swift */; }; - DE63893228D3BFBA00559697 /* Human.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890828D3BFBA00559697 /* Human.graphql.swift */; }; - DE63893328D3BFBA00559697 /* Crocodile.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890928D3BFBA00559697 /* Crocodile.graphql.swift */; }; - DE63893428D3BFBA00559697 /* SchemaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890A28D3BFBA00559697 /* SchemaConfiguration.swift */; }; - DE63893528D3BFBA00559697 /* PetAdoptionInput.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890C28D3BFBA00559697 /* PetAdoptionInput.graphql.swift */; }; - DE63893628D3BFBA00559697 /* PetSearchFilters.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890D28D3BFBA00559697 /* PetSearchFilters.graphql.swift */; }; - DE63893728D3BFBA00559697 /* MeasurementsInput.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890E28D3BFBA00559697 /* MeasurementsInput.graphql.swift */; }; - DE63893828D3BFBA00559697 /* SchemaMetadata.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63890F28D3BFBA00559697 /* SchemaMetadata.graphql.swift */; }; - DE63893928D3BFBA00559697 /* HousePet.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63891128D3BFBA00559697 /* HousePet.graphql.swift */; }; - DE63893A28D3BFBA00559697 /* Pet.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63891228D3BFBA00559697 /* Pet.graphql.swift */; }; - DE63893B28D3BFBA00559697 /* Animal.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63891328D3BFBA00559697 /* Animal.graphql.swift */; }; - DE63893C28D3BFBA00559697 /* WarmBlooded.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63891428D3BFBA00559697 /* WarmBlooded.graphql.swift */; }; - DE63894628D3D60600559697 /* IncrementingSubscription.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894028D3D60600559697 /* IncrementingSubscription.graphql.swift */; }; - DE63894728D3D60700559697 /* Subscription.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894328D3D60600559697 /* Subscription.graphql.swift */; }; - DE63894828D3D60700559697 /* SchemaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894428D3D60600559697 /* SchemaConfiguration.swift */; }; - DE63894928D3D60700559697 /* SchemaMetadata.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894528D3D60600559697 /* SchemaMetadata.graphql.swift */; }; - DE63895728D3D62400559697 /* UploadMultipleFilesToTheSameParameterMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894C28D3D62400559697 /* UploadMultipleFilesToTheSameParameterMutation.graphql.swift */; }; - DE63895828D3D62400559697 /* UploadOneFileMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894D28D3D62400559697 /* UploadOneFileMutation.graphql.swift */; }; - DE63895928D3D62400559697 /* UploadMultipleFilesToDifferentParametersMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63894E28D3D62400559697 /* UploadMultipleFilesToDifferentParametersMutation.graphql.swift */; }; - DE63895A28D3D62400559697 /* Upload.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63895128D3D62400559697 /* Upload.swift */; }; - DE63895B28D3D62400559697 /* File.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63895328D3D62400559697 /* File.graphql.swift */; }; - DE63895C28D3D62400559697 /* Mutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63895428D3D62400559697 /* Mutation.graphql.swift */; }; - DE63895D28D3D62400559697 /* SchemaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63895528D3D62400559697 /* SchemaConfiguration.swift */; }; - DE63895E28D3D62400559697 /* SchemaMetadata.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63895628D3D62400559697 /* SchemaMetadata.graphql.swift */; }; - DE6389AF28D3D63800559697 /* DroidNameAndPrimaryFunction.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896128D3D63700559697 /* DroidNameAndPrimaryFunction.graphql.swift */; }; - DE6389B028D3D63800559697 /* HeroDetails.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896228D3D63700559697 /* HeroDetails.graphql.swift */; }; - DE6389B128D3D63800559697 /* DroidPrimaryFunction.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896328D3D63700559697 /* DroidPrimaryFunction.graphql.swift */; }; - DE6389B228D3D63800559697 /* FriendsNames.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896428D3D63700559697 /* FriendsNames.graphql.swift */; }; - DE6389B328D3D63800559697 /* CharacterName.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896528D3D63700559697 /* CharacterName.graphql.swift */; }; - DE6389B428D3D63800559697 /* CharacterNameAndAppearsIn.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896628D3D63700559697 /* CharacterNameAndAppearsIn.graphql.swift */; }; - DE6389B528D3D63800559697 /* DroidName.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896728D3D63700559697 /* DroidName.graphql.swift */; }; - DE6389B628D3D63800559697 /* CharacterNameAndDroidAppearsIn.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896828D3D63700559697 /* CharacterNameAndDroidAppearsIn.graphql.swift */; }; - DE6389B728D3D63800559697 /* HumanHeightWithVariable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896928D3D63700559697 /* HumanHeightWithVariable.graphql.swift */; }; - DE6389B828D3D63800559697 /* CharacterNameWithInlineFragment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896A28D3D63700559697 /* CharacterNameWithInlineFragment.graphql.swift */; }; - DE6389B928D3D63800559697 /* CharacterNameAndAppearsInWithNestedFragments.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896B28D3D63700559697 /* CharacterNameAndAppearsInWithNestedFragments.graphql.swift */; }; - DE6389BA28D3D63800559697 /* DroidDetails.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896C28D3D63700559697 /* DroidDetails.graphql.swift */; }; - DE6389BB28D3D63800559697 /* CharacterNameWithNestedAppearsInFragment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896D28D3D63700559697 /* CharacterNameWithNestedAppearsInFragment.graphql.swift */; }; - DE6389BC28D3D63800559697 /* CharacterNameAndDroidPrimaryFunction.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896E28D3D63700559697 /* CharacterNameAndDroidPrimaryFunction.graphql.swift */; }; - DE6389BD28D3D63800559697 /* CharacterAppearsIn.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63896F28D3D63700559697 /* CharacterAppearsIn.graphql.swift */; }; - DE6389BE28D3D63800559697 /* CreateAwesomeReviewMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897228D3D63700559697 /* CreateAwesomeReviewMutation.graphql.swift */; }; - DE6389BF28D3D63800559697 /* CreateReviewForEpisodeMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897328D3D63700559697 /* CreateReviewForEpisodeMutation.graphql.swift */; }; - DE6389C028D3D63800559697 /* CreateReviewWithNullFieldMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897428D3D63700559697 /* CreateReviewWithNullFieldMutation.graphql.swift */; }; - DE6389C128D3D63800559697 /* HeroDetailsQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897628D3D63700559697 /* HeroDetailsQuery.graphql.swift */; }; - DE6389C228D3D63800559697 /* HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897728D3D63700559697 /* HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift */; }; - DE6389C328D3D63800559697 /* HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897828D3D63700559697 /* HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift */; }; - DE6389C428D3D63800559697 /* SearchQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897928D3D63700559697 /* SearchQuery.graphql.swift */; }; - DE6389C528D3D63800559697 /* HeroNameWithIDQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897A28D3D63700559697 /* HeroNameWithIDQuery.graphql.swift */; }; - DE6389C628D3D63800559697 /* HeroAndFriendsNamesWithFragmentQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897B28D3D63700559697 /* HeroAndFriendsNamesWithFragmentQuery.graphql.swift */; }; - DE6389C728D3D63800559697 /* HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897C28D3D63700559697 /* HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift */; }; - DE6389C828D3D63800559697 /* HeroDetailsFragmentConditionalInclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897D28D3D63700559697 /* HeroDetailsFragmentConditionalInclusionQuery.graphql.swift */; }; - DE6389C928D3D63800559697 /* HeroAppearsInQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897E28D3D63700559697 /* HeroAppearsInQuery.graphql.swift */; }; - DE6389CA28D3D63800559697 /* HeroNameAndAppearsInWithFragmentQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63897F28D3D63700559697 /* HeroNameAndAppearsInWithFragmentQuery.graphql.swift */; }; - DE6389CB28D3D63800559697 /* DroidDetailsWithFragmentQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898028D3D63700559697 /* DroidDetailsWithFragmentQuery.graphql.swift */; }; - DE6389CC28D3D63800559697 /* HeroDetailsWithFragmentQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898128D3D63700559697 /* HeroDetailsWithFragmentQuery.graphql.swift */; }; - DE6389CD28D3D63800559697 /* HeroNameWithFragmentAndIDQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898228D3D63700559697 /* HeroNameWithFragmentAndIDQuery.graphql.swift */; }; - DE6389CE28D3D63800559697 /* HeroNameConditionalBothSeparateQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898328D3D63700559697 /* HeroNameConditionalBothSeparateQuery.graphql.swift */; }; - DE6389CF28D3D63800559697 /* StarshipCoordinatesQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898428D3D63700559697 /* StarshipCoordinatesQuery.graphql.swift */; }; - DE6389D028D3D63800559697 /* HeroNameConditionalBothQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898528D3D63700559697 /* HeroNameConditionalBothQuery.graphql.swift */; }; - DE6389D128D3D63800559697 /* HeroAndFriendsNamesWithIDsQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898628D3D63700559697 /* HeroAndFriendsNamesWithIDsQuery.graphql.swift */; }; - DE6389D228D3D63800559697 /* HeroNameConditionalExclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898728D3D63700559697 /* HeroNameConditionalExclusionQuery.graphql.swift */; }; - DE6389D328D3D63800559697 /* HeroNameAndAppearsInQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898828D3D63700559697 /* HeroNameAndAppearsInQuery.graphql.swift */; }; - DE6389D428D3D63800559697 /* HeroFriendsDetailsConditionalInclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898928D3D63700559697 /* HeroFriendsDetailsConditionalInclusionQuery.graphql.swift */; }; - DE6389D528D3D63800559697 /* HeroDetailsInlineConditionalInclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898A28D3D63700559697 /* HeroDetailsInlineConditionalInclusionQuery.graphql.swift */; }; - DE6389D628D3D63800559697 /* HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898B28D3D63700559697 /* HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift */; }; - DE6389D728D3D63800559697 /* StarshipQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898C28D3D63700559697 /* StarshipQuery.graphql.swift */; }; - DE6389D828D3D63800559697 /* HumanQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898D28D3D63700559697 /* HumanQuery.graphql.swift */; }; - DE6389D928D3D63800559697 /* HeroAndFriendsNamesQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898E28D3D63700559697 /* HeroAndFriendsNamesQuery.graphql.swift */; }; - DE6389DA28D3D63800559697 /* HeroTypeDependentAliasedFieldQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63898F28D3D63700559697 /* HeroTypeDependentAliasedFieldQuery.graphql.swift */; }; - DE6389DB28D3D63800559697 /* HeroNameWithFragmentQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899028D3D63700559697 /* HeroNameWithFragmentQuery.graphql.swift */; }; - DE6389DC28D3D63800559697 /* HeroParentTypeDependentFieldQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899128D3D63800559697 /* HeroParentTypeDependentFieldQuery.graphql.swift */; }; - DE6389DD28D3D63800559697 /* TwoHeroesQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899228D3D63800559697 /* TwoHeroesQuery.graphql.swift */; }; - DE6389DE28D3D63800559697 /* HeroNameConditionalInclusionQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899328D3D63800559697 /* HeroNameConditionalInclusionQuery.graphql.swift */; }; - DE6389DF28D3D63800559697 /* HeroFriendsOfFriendsNamesQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899428D3D63800559697 /* HeroFriendsOfFriendsNamesQuery.graphql.swift */; }; - DE6389E028D3D63800559697 /* HeroNameQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899528D3D63800559697 /* HeroNameQuery.graphql.swift */; }; - DE6389E128D3D63800559697 /* SameHeroTwiceQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899628D3D63800559697 /* SameHeroTwiceQuery.graphql.swift */; }; - DE6389E228D3D63800559697 /* HeroAndFriendsIDsQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899728D3D63800559697 /* HeroAndFriendsIDsQuery.graphql.swift */; }; - DE6389E328D3D63800559697 /* HeroAppearsInWithFragmentQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899828D3D63800559697 /* HeroAppearsInWithFragmentQuery.graphql.swift */; }; - DE6389E428D3D63800559697 /* ReviewAddedSubscription.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899A28D3D63800559697 /* ReviewAddedSubscription.graphql.swift */; }; - DE6389E528D3D63800559697 /* SearchResult.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899D28D3D63800559697 /* SearchResult.graphql.swift */; }; - DE6389E628D3D63800559697 /* Episode.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE63899F28D3D63800559697 /* Episode.graphql.swift */; }; - DE6389E728D3D63800559697 /* Subscription.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A128D3D63800559697 /* Subscription.graphql.swift */; }; - DE6389E828D3D63800559697 /* Droid.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A228D3D63800559697 /* Droid.graphql.swift */; }; - DE6389E928D3D63800559697 /* Starship.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A328D3D63800559697 /* Starship.graphql.swift */; }; - DE6389EA28D3D63800559697 /* Mutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A428D3D63800559697 /* Mutation.graphql.swift */; }; - DE6389EB28D3D63800559697 /* Review.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A528D3D63800559697 /* Review.graphql.swift */; }; - DE6389EC28D3D63800559697 /* Query.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A628D3D63800559697 /* Query.graphql.swift */; }; - DE6389ED28D3D63800559697 /* Human.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A728D3D63800559697 /* Human.graphql.swift */; }; - DE6389EE28D3D63800559697 /* SchemaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389A828D3D63800559697 /* SchemaConfiguration.swift */; }; - DE6389EF28D3D63800559697 /* ColorInput.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389AA28D3D63800559697 /* ColorInput.graphql.swift */; }; - DE6389F028D3D63800559697 /* ReviewInput.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389AB28D3D63800559697 /* ReviewInput.graphql.swift */; }; - DE6389F128D3D63800559697 /* SchemaMetadata.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389AC28D3D63800559697 /* SchemaMetadata.graphql.swift */; }; - DE6389F228D3D63800559697 /* Character.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389AE28D3D63800559697 /* Character.graphql.swift */; }; - DE638AE228D3D64400559697 /* AuthorDetails.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389F528D3D64400559697 /* AuthorDetails.graphql.swift */; }; - DE638AE328D3D64400559697 /* RepositoryQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389F828D3D64400559697 /* RepositoryQuery.graphql.swift */; }; - DE638AE428D3D64400559697 /* IssuesAndCommentsForRepositoryQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389F928D3D64400559697 /* IssuesAndCommentsForRepositoryQuery.graphql.swift */; }; - DE638AE528D3D64400559697 /* RepoURLQuery.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389FA28D3D64400559697 /* RepoURLQuery.graphql.swift */; }; - DE638AE628D3D64400559697 /* IssueOrPullRequest.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389FD28D3D64400559697 /* IssueOrPullRequest.graphql.swift */; }; - DE638AE728D3D64400559697 /* URI.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6389FF28D3D64400559697 /* URI.swift */; }; - DE638AE828D3D64400559697 /* MarketplaceListing.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0128D3D64400559697 /* MarketplaceListing.graphql.swift */; }; - DE638AE928D3D64400559697 /* UnlockedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0228D3D64400559697 /* UnlockedEvent.graphql.swift */; }; - DE638AEA28D3D64400559697 /* MarkedAsDuplicateEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0328D3D64400559697 /* MarkedAsDuplicateEvent.graphql.swift */; }; - DE638AEB28D3D64400559697 /* OrganizationInvitation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0428D3D64400559697 /* OrganizationInvitation.graphql.swift */; }; - DE638AEC28D3D64400559697 /* Release.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0528D3D64400559697 /* Release.graphql.swift */; }; - DE638AED28D3D64400559697 /* OrgInviteToBusinessAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0628D3D64400559697 /* OrgInviteToBusinessAuditEntry.graphql.swift */; }; - DE638AEE28D3D64400559697 /* PullRequestReviewThread.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0728D3D64400559697 /* PullRequestReviewThread.graphql.swift */; }; - DE638AEF28D3D64400559697 /* RepoChangeMergeSettingAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0828D3D64400559697 /* RepoChangeMergeSettingAuditEntry.graphql.swift */; }; - DE638AF028D3D64400559697 /* Sponsorship.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0928D3D64400559697 /* Sponsorship.graphql.swift */; }; - DE638AF128D3D64400559697 /* OrgAddMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0A28D3D64400559697 /* OrgAddMemberAuditEntry.graphql.swift */; }; - DE638AF228D3D64400559697 /* DependencyGraphManifest.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0B28D3D64400559697 /* DependencyGraphManifest.graphql.swift */; }; - DE638AF328D3D64400559697 /* OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0C28D3D64400559697 /* OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift */; }; - DE638AF428D3D64400559697 /* OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0D28D3D64400559697 /* OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift */; }; - DE638AF528D3D64400559697 /* RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0E28D3D64400559697 /* RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift */; }; - DE638AF628D3D64400559697 /* License.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A0F28D3D64400559697 /* License.graphql.swift */; }; - DE638AF728D3D64400559697 /* ConnectedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1028D3D64400559697 /* ConnectedEvent.graphql.swift */; }; - DE638AF828D3D64400559697 /* OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1128D3D64400559697 /* OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift */; }; - DE638AF928D3D64400559697 /* OrgDisableTwoFactorRequirementAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1228D3D64400559697 /* OrgDisableTwoFactorRequirementAuditEntry.graphql.swift */; }; - DE638AFA28D3D64400559697 /* RepositoryTopic.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1328D3D64400559697 /* RepositoryTopic.graphql.swift */; }; - DE638AFB28D3D64400559697 /* CommitComment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1428D3D64400559697 /* CommitComment.graphql.swift */; }; - DE638AFC28D3D64400559697 /* PackageTag.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1528D3D64400559697 /* PackageTag.graphql.swift */; }; - DE638AFD28D3D64400559697 /* UnmarkedAsDuplicateEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1628D3D64400559697 /* UnmarkedAsDuplicateEvent.graphql.swift */; }; - DE638AFE28D3D64400559697 /* Repository.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1728D3D64400559697 /* Repository.graphql.swift */; }; - DE638AFF28D3D64400559697 /* GistComment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1828D3D64400559697 /* GistComment.graphql.swift */; }; - DE638B0028D3D64400559697 /* PackageFile.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1928D3D64400559697 /* PackageFile.graphql.swift */; }; - DE638B0128D3D64400559697 /* OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1A28D3D64400559697 /* OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift */; }; - DE638B0228D3D64400559697 /* RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1B28D3D64400559697 /* RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift */; }; - DE638B0328D3D64400559697 /* OrgEnableTwoFactorRequirementAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1C28D3D64400559697 /* OrgEnableTwoFactorRequirementAuditEntry.graphql.swift */; }; - DE638B0428D3D64400559697 /* StatusCheckRollup.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1D28D3D64400559697 /* StatusCheckRollup.graphql.swift */; }; - DE638B0528D3D64400559697 /* OrgRemoveMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1E28D3D64400559697 /* OrgRemoveMemberAuditEntry.graphql.swift */; }; - DE638B0628D3D64400559697 /* PushAllowance.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A1F28D3D64400559697 /* PushAllowance.graphql.swift */; }; - DE638B0728D3D64400559697 /* RepoRemoveTopicAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2028D3D64400559697 /* RepoRemoveTopicAuditEntry.graphql.swift */; }; - DE638B0828D3D64400559697 /* LockedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2128D3D64400559697 /* LockedEvent.graphql.swift */; }; - DE638B0928D3D64400559697 /* OauthApplicationCreateAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2228D3D64400559697 /* OauthApplicationCreateAuditEntry.graphql.swift */; }; - DE638B0A28D3D64400559697 /* MarketplaceCategory.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2328D3D64400559697 /* MarketplaceCategory.graphql.swift */; }; - DE638B0B28D3D64400559697 /* DeploymentStatus.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2428D3D64400559697 /* DeploymentStatus.graphql.swift */; }; - DE638B0C28D3D64400559697 /* RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2528D3D64400559697 /* RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift */; }; - DE638B0D28D3D64400559697 /* Enterprise.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2628D3D64400559697 /* Enterprise.graphql.swift */; }; - DE638B0E28D3D64400559697 /* TeamRemoveMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2728D3D64400559697 /* TeamRemoveMemberAuditEntry.graphql.swift */; }; - DE638B0F28D3D64400559697 /* OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2828D3D64400559697 /* OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift */; }; - DE638B1028D3D64400559697 /* OrgOauthAppAccessApprovedAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2928D3D64400559697 /* OrgOauthAppAccessApprovedAuditEntry.graphql.swift */; }; - DE638B1128D3D64400559697 /* OrgInviteMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2A28D3D64400559697 /* OrgInviteMemberAuditEntry.graphql.swift */; }; - DE638B1228D3D64400559697 /* TeamAddRepositoryAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2B28D3D64400559697 /* TeamAddRepositoryAuditEntry.graphql.swift */; }; - DE638B1328D3D64400559697 /* DisconnectedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2C28D3D64400559697 /* DisconnectedEvent.graphql.swift */; }; - DE638B1428D3D64400559697 /* TeamDiscussionComment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2D28D3D64400559697 /* TeamDiscussionComment.graphql.swift */; }; - DE638B1528D3D64400559697 /* TeamRemoveRepositoryAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2E28D3D64400559697 /* TeamRemoveRepositoryAuditEntry.graphql.swift */; }; - DE638B1628D3D64400559697 /* User.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A2F28D3D64400559697 /* User.graphql.swift */; }; - DE638B1728D3D64400559697 /* MembersCanDeleteReposEnableAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3028D3D64400559697 /* MembersCanDeleteReposEnableAuditEntry.graphql.swift */; }; - DE638B1828D3D64400559697 /* SponsorsTier.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3128D3D64400559697 /* SponsorsTier.graphql.swift */; }; - DE638B1928D3D64400559697 /* PinnedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3228D3D64400559697 /* PinnedEvent.graphql.swift */; }; - DE638B1A28D3D64400559697 /* Status.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3328D3D64400559697 /* Status.graphql.swift */; }; - DE638B1B28D3D64400559697 /* RepoAddTopicAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3428D3D64400559697 /* RepoAddTopicAuditEntry.graphql.swift */; }; - DE638B1C28D3D64400559697 /* RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3528D3D64400559697 /* RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift */; }; - DE638B1D28D3D64400559697 /* Commit.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3628D3D64400559697 /* Commit.graphql.swift */; }; - DE638B1E28D3D64400559697 /* EnterpriseRepositoryInfo.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3728D3D64400559697 /* EnterpriseRepositoryInfo.graphql.swift */; }; - DE638B1F28D3D64400559697 /* SubscribedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3828D3D64400559697 /* SubscribedEvent.graphql.swift */; }; - DE638B2028D3D64400559697 /* DeployKey.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3928D3D64400559697 /* DeployKey.graphql.swift */; }; - DE638B2128D3D64400559697 /* OrgAddBillingManagerAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3A28D3D64400559697 /* OrgAddBillingManagerAuditEntry.graphql.swift */; }; - DE638B2228D3D64400559697 /* PrivateRepositoryForkingDisableAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3B28D3D64400559697 /* PrivateRepositoryForkingDisableAuditEntry.graphql.swift */; }; - DE638B2328D3D64400559697 /* OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3C28D3D64400559697 /* OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift */; }; - DE638B2428D3D64400559697 /* OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3D28D3D64400559697 /* OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift */; }; - DE638B2528D3D64400559697 /* RepoAddMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3E28D3D64400559697 /* RepoAddMemberAuditEntry.graphql.swift */; }; - DE638B2628D3D64400559697 /* ReviewRequestRemovedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A3F28D3D64400559697 /* ReviewRequestRemovedEvent.graphql.swift */; }; - DE638B2728D3D64400559697 /* ReopenedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4028D3D64400559697 /* ReopenedEvent.graphql.swift */; }; - DE638B2828D3D64400559697 /* BranchProtectionRule.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4128D3D64400559697 /* BranchProtectionRule.graphql.swift */; }; - DE638B2928D3D64400559697 /* ConvertedNoteToIssueEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4228D3D64400559697 /* ConvertedNoteToIssueEvent.graphql.swift */; }; - DE638B2A28D3D64400559697 /* PullRequestCommitCommentThread.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4328D3D64400559697 /* PullRequestCommitCommentThread.graphql.swift */; }; - DE638B2B28D3D64400559697 /* RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4428D3D64400559697 /* RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift */; }; - DE638B2C28D3D64400559697 /* IssueCommentConnection.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4528D3D64400559697 /* IssueCommentConnection.graphql.swift */; }; - DE638B2D28D3D64400559697 /* RepositoryVisibilityChangeDisableAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4628D3D64400559697 /* RepositoryVisibilityChangeDisableAuditEntry.graphql.swift */; }; - DE638B2E28D3D64400559697 /* CodeOfConduct.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4728D3D64400559697 /* CodeOfConduct.graphql.swift */; }; - DE638B2F28D3D64400559697 /* UnpinnedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4828D3D64400559697 /* UnpinnedEvent.graphql.swift */; }; - DE638B3028D3D64400559697 /* Mannequin.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4928D3D64400559697 /* Mannequin.graphql.swift */; }; - DE638B3128D3D64400559697 /* EnterpriseIdentityProvider.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4A28D3D64400559697 /* EnterpriseIdentityProvider.graphql.swift */; }; - DE638B3228D3D64400559697 /* DeploymentEnvironmentChangedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4B28D3D64400559697 /* DeploymentEnvironmentChangedEvent.graphql.swift */; }; - DE638B3328D3D64400559697 /* Push.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4C28D3D64400559697 /* Push.graphql.swift */; }; - DE638B3428D3D64400559697 /* PullRequest.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4D28D3D64400559697 /* PullRequest.graphql.swift */; }; - DE638B3528D3D64400559697 /* ReferencedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4E28D3D64400559697 /* ReferencedEvent.graphql.swift */; }; - DE638B3628D3D64400559697 /* RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A4F28D3D64400559697 /* RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift */; }; - DE638B3728D3D64400559697 /* EnterpriseServerUserAccount.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5028D3D64400559697 /* EnterpriseServerUserAccount.graphql.swift */; }; - DE638B3828D3D64400559697 /* OrgOauthAppAccessRequestedAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5128D3D64400559697 /* OrgOauthAppAccessRequestedAuditEntry.graphql.swift */; }; - DE638B3928D3D64400559697 /* Project.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5228D3D64400559697 /* Project.graphql.swift */; }; - DE638B3A28D3D64400559697 /* Ref.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5328D3D64400559697 /* Ref.graphql.swift */; }; - DE638B3B28D3D64400559697 /* OrgRemoveBillingManagerAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5428D3D64400559697 /* OrgRemoveBillingManagerAuditEntry.graphql.swift */; }; - DE638B3C28D3D64400559697 /* Organization.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5528D3D64400559697 /* Organization.graphql.swift */; }; - DE638B3D28D3D64400559697 /* MergedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5628D3D64400559697 /* MergedEvent.graphql.swift */; }; - DE638B3E28D3D64400559697 /* ReviewRequest.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5728D3D64400559697 /* ReviewRequest.graphql.swift */; }; - DE638B3F28D3D64400559697 /* Label.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5828D3D64400559697 /* Label.graphql.swift */; }; - DE638B4028D3D64400559697 /* HeadRefDeletedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5928D3D64400559697 /* HeadRefDeletedEvent.graphql.swift */; }; - DE638B4128D3D64400559697 /* Milestone.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5A28D3D64400559697 /* Milestone.graphql.swift */; }; - DE638B4228D3D64400559697 /* DeployedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5B28D3D64400559697 /* DeployedEvent.graphql.swift */; }; - DE638B4328D3D64400559697 /* EnterpriseUserAccount.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5C28D3D64400559697 /* EnterpriseUserAccount.graphql.swift */; }; - DE638B4428D3D64400559697 /* RepoCreateAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5D28D3D64400559697 /* RepoCreateAuditEntry.graphql.swift */; }; - DE638B4528D3D64400559697 /* CrossReferencedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5E28D3D64400559697 /* CrossReferencedEvent.graphql.swift */; }; - DE638B4628D3D64400559697 /* PinnedIssue.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A5F28D3D64400559697 /* PinnedIssue.graphql.swift */; }; - DE638B4728D3D64400559697 /* RepoAccessAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6028D3D64400559697 /* RepoAccessAuditEntry.graphql.swift */; }; - DE638B4828D3D64400559697 /* OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6128D3D64400559697 /* OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift */; }; - DE638B4928D3D64400559697 /* EnterpriseServerUserAccountsUpload.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6228D3D64400559697 /* EnterpriseServerUserAccountsUpload.graphql.swift */; }; - DE638B4A28D3D64400559697 /* OrgOauthAppAccessDeniedAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6328D3D64400559697 /* OrgOauthAppAccessDeniedAuditEntry.graphql.swift */; }; - DE638B4B28D3D64400559697 /* Query.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6428D3D64400559697 /* Query.graphql.swift */; }; - DE638B4C28D3D64400559697 /* OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6528D3D64400559697 /* OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift */; }; - DE638B4D28D3D64400559697 /* RepoDestroyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6628D3D64400559697 /* RepoDestroyAuditEntry.graphql.swift */; }; - DE638B4E28D3D64400559697 /* Reaction.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6728D3D64400559697 /* Reaction.graphql.swift */; }; - DE638B4F28D3D64400559697 /* EnterpriseAdministratorInvitation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6828D3D64400559697 /* EnterpriseAdministratorInvitation.graphql.swift */; }; - DE638B5028D3D64400559697 /* RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6928D3D64400559697 /* RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift */; }; - DE638B5128D3D64400559697 /* ExternalIdentity.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6A28D3D64400559697 /* ExternalIdentity.graphql.swift */; }; - DE638B5228D3D64400559697 /* Language.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6B28D3D64400559697 /* Language.graphql.swift */; }; - DE638B5328D3D64400559697 /* Team.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6C28D3D64400559697 /* Team.graphql.swift */; }; - DE638B5428D3D64400559697 /* PackageVersion.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6D28D3D64400559697 /* PackageVersion.graphql.swift */; }; - DE638B5528D3D64400559697 /* CommentDeletedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6E28D3D64400559697 /* CommentDeletedEvent.graphql.swift */; }; - DE638B5628D3D64400559697 /* TeamDiscussion.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A6F28D3D64400559697 /* TeamDiscussion.graphql.swift */; }; - DE638B5728D3D64500559697 /* MembersCanDeleteReposClearAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7028D3D64400559697 /* MembersCanDeleteReposClearAuditEntry.graphql.swift */; }; - DE638B5828D3D64500559697 /* RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7128D3D64400559697 /* RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift */; }; - DE638B5928D3D64500559697 /* ClosedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7228D3D64400559697 /* ClosedEvent.graphql.swift */; }; - DE638B5A28D3D64500559697 /* MembersCanDeleteReposDisableAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7328D3D64400559697 /* MembersCanDeleteReposDisableAuditEntry.graphql.swift */; }; - DE638B5B28D3D64500559697 /* PullRequestCommit.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7428D3D64400559697 /* PullRequestCommit.graphql.swift */; }; - DE638B5C28D3D64500559697 /* UserBlockedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7528D3D64400559697 /* UserBlockedEvent.graphql.swift */; }; - DE638B5D28D3D64500559697 /* Topic.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7628D3D64400559697 /* Topic.graphql.swift */; }; - DE638B5E28D3D64500559697 /* CheckSuite.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7728D3D64400559697 /* CheckSuite.graphql.swift */; }; - DE638B5F28D3D64500559697 /* UnsubscribedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7828D3D64400559697 /* UnsubscribedEvent.graphql.swift */; }; - DE638B6028D3D64500559697 /* Tag.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7928D3D64400559697 /* Tag.graphql.swift */; }; - DE638B6128D3D64500559697 /* Gist.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7A28D3D64400559697 /* Gist.graphql.swift */; }; - DE638B6228D3D64500559697 /* Package.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7B28D3D64400559697 /* Package.graphql.swift */; }; - DE638B6328D3D64500559697 /* PullRequestReview.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7C28D3D64400559697 /* PullRequestReview.graphql.swift */; }; - DE638B6428D3D64500559697 /* PrivateRepositoryForkingEnableAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7D28D3D64400559697 /* PrivateRepositoryForkingEnableAuditEntry.graphql.swift */; }; - DE638B6528D3D64500559697 /* OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7E28D3D64400559697 /* OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift */; }; - DE638B6628D3D64500559697 /* ConvertToDraftEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A7F28D3D64400559697 /* ConvertToDraftEvent.graphql.swift */; }; - DE638B6728D3D64500559697 /* RepoRemoveMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8028D3D64400559697 /* RepoRemoveMemberAuditEntry.graphql.swift */; }; - DE638B6828D3D64500559697 /* TeamAddMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8128D3D64400559697 /* TeamAddMemberAuditEntry.graphql.swift */; }; - DE638B6928D3D64500559697 /* Tree.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8228D3D64400559697 /* Tree.graphql.swift */; }; - DE638B6A28D3D64500559697 /* RenamedTitleEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8328D3D64400559697 /* RenamedTitleEvent.graphql.swift */; }; - DE638B6B28D3D64500559697 /* OrgUnblockUserAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8428D3D64400559697 /* OrgUnblockUserAuditEntry.graphql.swift */; }; - DE638B6C28D3D64500559697 /* OrgCreateAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8528D3D64400559697 /* OrgCreateAuditEntry.graphql.swift */; }; - DE638B6D28D3D64500559697 /* ProjectCard.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8628D3D64400559697 /* ProjectCard.graphql.swift */; }; - DE638B6E28D3D64500559697 /* SavedReply.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8728D3D64400559697 /* SavedReply.graphql.swift */; }; - DE638B6F28D3D64500559697 /* OrgBlockUserAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8828D3D64400559697 /* OrgBlockUserAuditEntry.graphql.swift */; }; - DE638B7028D3D64500559697 /* BaseRefChangedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8928D3D64400559697 /* BaseRefChangedEvent.graphql.swift */; }; - DE638B7128D3D64500559697 /* RemovedFromProjectEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8A28D3D64400559697 /* RemovedFromProjectEvent.graphql.swift */; }; - DE638B7228D3D64500559697 /* Issue.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8B28D3D64400559697 /* Issue.graphql.swift */; }; - DE638B7328D3D64500559697 /* SecurityAdvisory.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8C28D3D64400559697 /* SecurityAdvisory.graphql.swift */; }; - DE638B7428D3D64500559697 /* OrgRestoreMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8D28D3D64400559697 /* OrgRestoreMemberAuditEntry.graphql.swift */; }; - DE638B7528D3D64500559697 /* HeadRefForcePushedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8E28D3D64400559697 /* HeadRefForcePushedEvent.graphql.swift */; }; - DE638B7628D3D64500559697 /* OrgUpdateMemberAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A8F28D3D64400559697 /* OrgUpdateMemberAuditEntry.graphql.swift */; }; - DE638B7728D3D64500559697 /* LabeledEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9028D3D64400559697 /* LabeledEvent.graphql.swift */; }; - DE638B7828D3D64500559697 /* SponsorsListing.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9128D3D64400559697 /* SponsorsListing.graphql.swift */; }; - DE638B7928D3D64500559697 /* App.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9228D3D64400559697 /* App.graphql.swift */; }; - DE638B7A28D3D64500559697 /* StatusContext.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9328D3D64400559697 /* StatusContext.graphql.swift */; }; - DE638B7B28D3D64500559697 /* ReviewRequestedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9428D3D64400559697 /* ReviewRequestedEvent.graphql.swift */; }; - DE638B7C28D3D64500559697 /* DemilestonedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9528D3D64400559697 /* DemilestonedEvent.graphql.swift */; }; - DE638B7D28D3D64500559697 /* IssueConnection.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9628D3D64400559697 /* IssueConnection.graphql.swift */; }; - DE638B7E28D3D64500559697 /* UserContentEdit.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9728D3D64400559697 /* UserContentEdit.graphql.swift */; }; - DE638B7F28D3D64500559697 /* MovedColumnsInProjectEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9828D3D64400559697 /* MovedColumnsInProjectEvent.graphql.swift */; }; - DE638B8028D3D64500559697 /* MilestonedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9928D3D64400559697 /* MilestonedEvent.graphql.swift */; }; - DE638B8128D3D64500559697 /* TeamChangeParentTeamAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9A28D3D64400559697 /* TeamChangeParentTeamAuditEntry.graphql.swift */; }; - DE638B8228D3D64500559697 /* UnassignedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9B28D3D64400559697 /* UnassignedEvent.graphql.swift */; }; - DE638B8328D3D64500559697 /* Bot.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9C28D3D64400559697 /* Bot.graphql.swift */; }; - DE638B8428D3D64500559697 /* AddedToProjectEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9D28D3D64400559697 /* AddedToProjectEvent.graphql.swift */; }; - DE638B8528D3D64500559697 /* RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9E28D3D64400559697 /* RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift */; }; - DE638B8628D3D64500559697 /* BaseRefForcePushedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638A9F28D3D64400559697 /* BaseRefForcePushedEvent.graphql.swift */; }; - DE638B8728D3D64500559697 /* RepositoryInvitation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA028D3D64400559697 /* RepositoryInvitation.graphql.swift */; }; - DE638B8828D3D64500559697 /* TransferredEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA128D3D64400559697 /* TransferredEvent.graphql.swift */; }; - DE638B8928D3D64500559697 /* CheckRun.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA228D3D64400559697 /* CheckRun.graphql.swift */; }; - DE638B8A28D3D64500559697 /* HeadRefRestoredEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA328D3D64400559697 /* HeadRefRestoredEvent.graphql.swift */; }; - DE638B8B28D3D64500559697 /* RepoArchivedAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA428D3D64400559697 /* RepoArchivedAuditEntry.graphql.swift */; }; - DE638B8C28D3D64500559697 /* IpAllowListEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA528D3D64400559697 /* IpAllowListEntry.graphql.swift */; }; - DE638B8D28D3D64500559697 /* EnterpriseServerInstallation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA628D3D64400559697 /* EnterpriseServerInstallation.graphql.swift */; }; - DE638B8E28D3D64500559697 /* ReviewDismissedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA728D3D64400559697 /* ReviewDismissedEvent.graphql.swift */; }; - DE638B8F28D3D64500559697 /* CommitCommentThread.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA828D3D64400559697 /* CommitCommentThread.graphql.swift */; }; - DE638B9028D3D64500559697 /* IssueComment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AA928D3D64400559697 /* IssueComment.graphql.swift */; }; - DE638B9128D3D64500559697 /* UnlabeledEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AAA28D3D64400559697 /* UnlabeledEvent.graphql.swift */; }; - DE638B9228D3D64500559697 /* ReviewDismissalAllowance.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AAB28D3D64400559697 /* ReviewDismissalAllowance.graphql.swift */; }; - DE638B9328D3D64500559697 /* AssignedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AAC28D3D64400559697 /* AssignedEvent.graphql.swift */; }; - DE638B9428D3D64500559697 /* PullRequestReviewComment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AAD28D3D64400559697 /* PullRequestReviewComment.graphql.swift */; }; - DE638B9528D3D64500559697 /* RepositoryVisibilityChangeEnableAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AAE28D3D64400559697 /* RepositoryVisibilityChangeEnableAuditEntry.graphql.swift */; }; - DE638B9628D3D64500559697 /* OrganizationIdentityProvider.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AAF28D3D64400559697 /* OrganizationIdentityProvider.graphql.swift */; }; - DE638B9728D3D64500559697 /* MentionedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB028D3D64400559697 /* MentionedEvent.graphql.swift */; }; - DE638B9828D3D64500559697 /* ReleaseAsset.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB128D3D64400559697 /* ReleaseAsset.graphql.swift */; }; - DE638B9928D3D64500559697 /* OrgEnableSamlAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB228D3D64400559697 /* OrgEnableSamlAuditEntry.graphql.swift */; }; - DE638B9A28D3D64500559697 /* UserStatus.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB328D3D64400559697 /* UserStatus.graphql.swift */; }; - DE638B9B28D3D64500559697 /* OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB428D3D64400559697 /* OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift */; }; - DE638B9C28D3D64500559697 /* OrgDisableSamlAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB528D3D64400559697 /* OrgDisableSamlAuditEntry.graphql.swift */; }; - DE638B9D28D3D64500559697 /* Blob.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB628D3D64400559697 /* Blob.graphql.swift */; }; - DE638B9E28D3D64500559697 /* AutomaticBaseChangeFailedEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB728D3D64400559697 /* AutomaticBaseChangeFailedEvent.graphql.swift */; }; - DE638B9F28D3D64500559697 /* Deployment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB828D3D64400559697 /* Deployment.graphql.swift */; }; - DE638BA028D3D64500559697 /* PublicKey.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AB928D3D64400559697 /* PublicKey.graphql.swift */; }; - DE638BA128D3D64500559697 /* ReadyForReviewEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ABA28D3D64400559697 /* ReadyForReviewEvent.graphql.swift */; }; - DE638BA228D3D64500559697 /* ProjectColumn.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ABB28D3D64400559697 /* ProjectColumn.graphql.swift */; }; - DE638BA328D3D64500559697 /* EnterpriseServerUserAccountEmail.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ABC28D3D64400559697 /* EnterpriseServerUserAccountEmail.graphql.swift */; }; - DE638BA428D3D64500559697 /* AutomaticBaseChangeSucceededEvent.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ABD28D3D64400559697 /* AutomaticBaseChangeSucceededEvent.graphql.swift */; }; - DE638BA528D3D64500559697 /* RepositoryVulnerabilityAlert.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ABE28D3D64400559697 /* RepositoryVulnerabilityAlert.graphql.swift */; }; - DE638BA628D3D64500559697 /* RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ABF28D3D64400559697 /* RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift */; }; - DE638BA728D3D64500559697 /* SchemaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC028D3D64400559697 /* SchemaConfiguration.swift */; }; - DE638BA828D3D64500559697 /* SchemaMetadata.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC128D3D64400559697 /* SchemaMetadata.graphql.swift */; }; - DE638BA928D3D64500559697 /* Starrable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC328D3D64400559697 /* Starrable.graphql.swift */; }; - DE638BAA28D3D64500559697 /* TeamAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC428D3D64400559697 /* TeamAuditEntryData.graphql.swift */; }; - DE638BAB28D3D64500559697 /* Labelable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC528D3D64400559697 /* Labelable.graphql.swift */; }; - DE638BAC28D3D64500559697 /* OrganizationAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC628D3D64400559697 /* OrganizationAuditEntryData.graphql.swift */; }; - DE638BAD28D3D64500559697 /* RepositoryNode.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC728D3D64400559697 /* RepositoryNode.graphql.swift */; }; - DE638BAE28D3D64500559697 /* UpdatableComment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC828D3D64400559697 /* UpdatableComment.graphql.swift */; }; - DE638BAF28D3D64500559697 /* Comment.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AC928D3D64400559697 /* Comment.graphql.swift */; }; - DE638BB028D3D64500559697 /* Sponsorable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ACA28D3D64400559697 /* Sponsorable.graphql.swift */; }; - DE638BB128D3D64500559697 /* RepositoryOwner.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ACB28D3D64400559697 /* RepositoryOwner.graphql.swift */; }; - DE638BB228D3D64500559697 /* GitObject.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ACC28D3D64400559697 /* GitObject.graphql.swift */; }; - DE638BB328D3D64500559697 /* ProjectOwner.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ACD28D3D64400559697 /* ProjectOwner.graphql.swift */; }; - DE638BB428D3D64500559697 /* MemberStatusable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ACE28D3D64400559697 /* MemberStatusable.graphql.swift */; }; - DE638BB528D3D64500559697 /* UniformResourceLocatable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ACF28D3D64400559697 /* UniformResourceLocatable.graphql.swift */; }; - DE638BB628D3D64500559697 /* Deletable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD028D3D64400559697 /* Deletable.graphql.swift */; }; - DE638BB728D3D64500559697 /* PackageOwner.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD128D3D64400559697 /* PackageOwner.graphql.swift */; }; - DE638BB828D3D64500559697 /* AuditEntry.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD228D3D64400559697 /* AuditEntry.graphql.swift */; }; - DE638BB928D3D64500559697 /* Closable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD328D3D64400559697 /* Closable.graphql.swift */; }; - DE638BBA28D3D64500559697 /* Actor.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD428D3D64400559697 /* Actor.graphql.swift */; }; - DE638BBB28D3D64500559697 /* Minimizable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD528D3D64400559697 /* Minimizable.graphql.swift */; }; - DE638BBC28D3D64500559697 /* Assignable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD628D3D64400559697 /* Assignable.graphql.swift */; }; - DE638BBD28D3D64500559697 /* TopicAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD728D3D64400559697 /* TopicAuditEntryData.graphql.swift */; }; - DE638BBE28D3D64500559697 /* RepositoryInfo.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD828D3D64400559697 /* RepositoryInfo.graphql.swift */; }; - DE638BBF28D3D64500559697 /* Reactable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AD928D3D64400559697 /* Reactable.graphql.swift */; }; - DE638BC028D3D64500559697 /* OauthApplicationAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ADA28D3D64400559697 /* OauthApplicationAuditEntryData.graphql.swift */; }; - DE638BC128D3D64500559697 /* Updatable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ADB28D3D64400559697 /* Updatable.graphql.swift */; }; - DE638BC228D3D64500559697 /* Subscribable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ADC28D3D64400559697 /* Subscribable.graphql.swift */; }; - DE638BC328D3D64500559697 /* EnterpriseAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ADD28D3D64400559697 /* EnterpriseAuditEntryData.graphql.swift */; }; - DE638BC428D3D64500559697 /* Node.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ADE28D3D64400559697 /* Node.graphql.swift */; }; - DE638BC528D3D64500559697 /* RepositoryAuditEntryData.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638ADF28D3D64400559697 /* RepositoryAuditEntryData.graphql.swift */; }; - DE638BC628D3D64500559697 /* Lockable.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AE028D3D64400559697 /* Lockable.graphql.swift */; }; - DE638BC728D3D64500559697 /* ProfileOwner.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE638AE128D3D64400559697 /* ProfileOwner.graphql.swift */; }; - DE64C1F7284033BA00F64B9D /* LocalCacheMutation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE64C1F6284033BA00F64B9D /* LocalCacheMutation.swift */; }; - DE674D9D261CEEE4000E8FC8 /* c.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9B2061172591B3550020D1E0 /* c.txt */; }; - DE674D9E261CEEE4000E8FC8 /* b.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9B2061182591B3550020D1E0 /* b.txt */; }; - DE674D9F261CEEE4000E8FC8 /* a.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9B2061192591B3550020D1E0 /* a.txt */; }; - DE6B15AF26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6B15AE26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift */; }; - DE6B15B126152BE10068D642 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - DE6B650827C059A800970E4E /* ApolloAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE058621266978A100265760 /* ApolloAPI.framework */; }; - DE6B650C27C4293D00970E4E /* FieldArgumentRendering.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6B650B27C4293D00970E4E /* FieldArgumentRendering.swift */; }; - DE6D07F927BC3B6D009F5F33 /* GraphQLInputField+Rendered.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6D07F827BC3B6D009F5F33 /* GraphQLInputField+Rendered.swift */; }; - DE6D07FD27BC3D53009F5F33 /* OperationDefinition_VariableDefinition_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6D07FA27BC3BE9009F5F33 /* OperationDefinition_VariableDefinition_Tests.swift */; }; - DE6D07FF27BC7F78009F5F33 /* InputVariableRenderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6D07FE27BC7F78009F5F33 /* InputVariableRenderable.swift */; }; - DE71FDBC2853B67C005FA9CC /* LocalCacheMutationDefinitionTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71FDBB2853B67C005FA9CC /* LocalCacheMutationDefinitionTemplate.swift */; }; - DE71FDBE2853B6D3005FA9CC /* LocalCacheMutationDefinitionTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71FDBD2853B6D3005FA9CC /* LocalCacheMutationDefinitionTemplateTests.swift */; }; - DE71FDC02853C242005FA9CC /* OperationTemplateRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71FDBF2853C242005FA9CC /* OperationTemplateRenderer.swift */; }; - DE71FDC22853C4C8005FA9CC /* MockLocalCacheMutation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71FDC12853C4C8005FA9CC /* MockLocalCacheMutation.swift */; }; - DE71FDC42853D681005FA9CC /* SelectionSetTemplate_LocalCacheMutation_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71FDC32853D681005FA9CC /* SelectionSetTemplate_LocalCacheMutation_Tests.swift */; }; - DE736F4626FA6EE6007187F2 /* InflectorKit in Frameworks */ = {isa = PBXBuildFile; productRef = E6E4209126A7DF4200B82624 /* InflectorKit */; }; - DE796429276998B000978A03 /* IR+RootFieldBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE796428276998B000978A03 /* IR+RootFieldBuilder.swift */; }; - DE79642B276999E700978A03 /* IRNamedFragmentBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE79642A276999E700978A03 /* IRNamedFragmentBuilderTests.swift */; }; - DE79642D27699A6A00978A03 /* IR+NamedFragmentBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE79642C27699A6A00978A03 /* IR+NamedFragmentBuilder.swift */; }; - DE79642F2769A1EB00978A03 /* IROperationBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE79642E2769A1EB00978A03 /* IROperationBuilderTests.swift */; }; - DE7C183C272A12EB00727031 /* ScopeDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7C183B272A12EB00727031 /* ScopeDescriptor.swift */; }; - DE7C183E272A154400727031 /* IR.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7C183D272A154400727031 /* IR.swift */; }; - DE80003428B5608E00C827BD /* SchemaMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE80003328B5608E00C827BD /* SchemaMetadata.swift */; }; - DE8C51CA29E8B03700E47A64 /* IRDefinition+RenderingHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE8C51C929E8B03700E47A64 /* IRDefinition+RenderingHelpers.swift */; }; - DE8C51CC29EF454100E47A64 /* GraphQLExecutionSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE8C51CB29EF454100E47A64 /* GraphQLExecutionSource.swift */; }; - DE8F7B6B29F742E1005F3902 /* NetworkResponseExecutionSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE8F7B6A29F742E1005F3902 /* NetworkResponseExecutionSource.swift */; }; - DE8F7B6D29F745DE005F3902 /* CacheDataExecutionSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE8F7B6C29F745DE005F3902 /* CacheDataExecutionSource.swift */; }; - DE8F7B6F29F7478C005F3902 /* SelectionSetModelExecutionSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE8F7B6E29F7478C005F3902 /* SelectionSetModelExecutionSource.swift */; }; - DE8F7B7129FC24A8005F3902 /* SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE8F7B7029FC24A8005F3902 /* SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift */; }; - DE903E1329B7E6D300A74415 /* SelectionSet+JSONInitializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE903E1229B7E6D300A74415 /* SelectionSet+JSONInitializer.swift */; }; - DE903E1729C10B7600A74415 /* FieldSelectionCollector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE903E1629C10B7600A74415 /* FieldSelectionCollector.swift */; }; - DE903E1929CA20FC00A74415 /* TypeCaseConversionPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE903E1829CA20FC00A74415 /* TypeCaseConversionPerformanceTests.swift */; }; - DE903E1D29CA23B200A74415 /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = DE903E1C29CA23B200A74415 /* Nimble */; }; - DE903E1E29CA25A600A74415 /* AnimalKingdomAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE3C7A11260A6B9800D2F4FF /* AnimalKingdomAPI.framework */; }; - DE903E2229CA622E00A74415 /* SelectionSetInitializerPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE903E2129CA622E00A74415 /* SelectionSetInitializerPerformanceTests.swift */; }; - DE903E2529CE59C000A74415 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - DE90FDBA27FE405F0084CC79 /* Selection+Conditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE90FDB927FE405F0084CC79 /* Selection+Conditions.swift */; }; - DE9C04AC26EAAE4400EC35E7 /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC4B91F1D2A6F8D0046A641 /* JSON.swift */; }; - DE9C04AD26EAAE5400EC35E7 /* JSONStandardTypeConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */; }; - DE9C04AF26EAAEE800EC35E7 /* CacheReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9C04AE26EAAEE800EC35E7 /* CacheReference.swift */; }; - DE9C04B226EAB02C00EC35E7 /* JSONDecodingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9C04B026EAAFF900EC35E7 /* JSONDecodingError.swift */; }; - DE9CEAE42829A01C00959AF9 /* ApolloAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE058621266978A100265760 /* ApolloAPI.framework */; }; - DE9CEAE62829A2FE00959AF9 /* TestMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9CEAE52829A2FE00959AF9 /* TestMock.swift */; }; - DE9CEAE92829A3C800959AF9 /* ApolloTestSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE9CEADC28299E8500959AF9 /* ApolloTestSupport.framework */; }; - DE9CEAEA2829A45500959AF9 /* Field.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2FCF2626E8083A0057EA67 /* Field.swift */; }; - DE9CEAEF282C62B700959AF9 /* MockObjectTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9CEAEE282C62B700959AF9 /* MockObjectTemplate.swift */; }; - DE9CEAF1282C632B00959AF9 /* MockObjectTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9CEAF0282C632B00959AF9 /* MockObjectTemplateTests.swift */; }; - DE9CEAF3282C6AC300959AF9 /* TemplateRenderer_TestMockFile_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9CEAF2282C6AC300959AF9 /* TemplateRenderer_TestMockFile_Tests.swift */; }; - DEA6A83426F298660091AF8A /* ParentType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEA6A83326F298660091AF8A /* ParentType.swift */; }; - DEA7604429DF75B60001544B /* TestMockSelectionSetMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEA7604329DF75B60001544B /* TestMockSelectionSetMapper.swift */; }; - DEA9A23027CD990500F96C36 /* IRSelectionSet_IncludeSkip_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEA9A22F27CD990500F96C36 /* IRSelectionSet_IncludeSkip_Tests.swift */; }; - DEA9A23227D822E600F96C36 /* IR+InclusionConditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEA9A23127D822E600F96C36 /* IR+InclusionConditions.swift */; }; - DEAFB77B2706444B00BE02F3 /* IRRootFieldBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEAFB77A2706444B00BE02F3 /* IRRootFieldBuilderTests.swift */; }; - DEAFB77F2706474C00BE02F3 /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = DEAFB77E2706474C00BE02F3 /* Nimble */; }; - DEAFB781270647D400BE02F3 /* MockCompilationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEAFB780270647D400BE02F3 /* MockCompilationResult.swift */; }; - DEAFB78327064F6900BE02F3 /* MockGraphQLType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEAFB78227064F6900BE02F3 /* MockGraphQLType.swift */; }; - DEAFB787270652D100BE02F3 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = DEAFB786270652D100BE02F3 /* OrderedCollections */; }; - DEB05B48289C3B4000170299 /* MockInterfacesFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEB05B47289C3B4000170299 /* MockInterfacesFileGenerator.swift */; }; - DEB05B4A289C3EC300170299 /* MockInterfacesTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEB05B49289C3EC300170299 /* MockInterfacesTemplate.swift */; }; - DEC2EA8A291D5E2E0088D3BB /* TestIsolatedFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2EA89291D5E2E0088D3BB /* TestIsolatedFileManager.swift */; }; - DEC2EA90291ED0F20088D3BB /* ApolloInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */; }; - DEC2EA93291ED3910088D3BB /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - DECD46D0262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECD46CF262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift */; }; - DECD46FB262F659500924527 /* ApolloCodegenLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; }; - DECD4736262F668500924527 /* UploadAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2DFBB624E1FA0D00ED3AE6 /* UploadAPI.framework */; }; - DECD490F262F81BF00924527 /* ApolloCodegenInternalTestHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = DECD490D262F81BF00924527 /* ApolloCodegenInternalTestHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DECD4921262F81CE00924527 /* CodegenTestHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BAEEC11234BBA9200808306 /* CodegenTestHelper.swift */; }; - DECD498F262F840700924527 /* ApolloCodegenInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DECD490B262F81BF00924527 /* ApolloCodegenInternalTestHelpers.framework */; }; - DECD4992262F841600924527 /* ApolloCodegenInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DECD490B262F81BF00924527 /* ApolloCodegenInternalTestHelpers.framework */; }; - DECD49C9262F88FE00924527 /* ApolloCodegenLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; }; - DECD49DB262F8AAA00924527 /* ApolloInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */; }; - DECD53CF26EC0EE50059A639 /* OutputTypeConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECD53CE26EC0EE50059A639 /* OutputTypeConvertible.swift */; }; - DECFEFE4286A3C8900DBE83C /* starwars-graphql in Resources */ = {isa = PBXBuildFile; fileRef = DECFEFE3286A3C8800DBE83C /* starwars-graphql */; settings = {ASSET_TAGS = ("starwars-graphql", ); }; }; - DED45C2A2615319E0086EF63 /* DefaultInterceptorProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED45C292615319E0086EF63 /* DefaultInterceptorProviderTests.swift */; }; - DED45D73261675890086EF63 /* StarWarsServerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6ABC91EC0A9F7000017BE /* StarWarsServerTests.swift */; }; - DED45D852616759C0086EF63 /* TestConfigs.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED45D842616759C0086EF63 /* TestConfigs.swift */; }; - DED45D9626167F020086EF63 /* StarWarsServerCachingRoundtripTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6ABC81EC0A9F7000017BE /* StarWarsServerCachingRoundtripTests.swift */; }; - DED45DE9261B96B70086EF63 /* LoadQueryFromStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6ABC61EC0A9F7000017BE /* LoadQueryFromStoreTests.swift */; }; - DED45DEA261B96B70086EF63 /* WatchQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6ABCB1EC0A9F7000017BE /* WatchQueryTests.swift */; }; - DED45DEB261B96B70086EF63 /* SQLiteCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B60204E23FDFA9F00D0C8E0 /* SQLiteCacheTests.swift */; }; - DED45DEC261B96B70086EF63 /* CacheDependentInterceptorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB4F5B12581AA50004F0BD6 /* CacheDependentInterceptorTests.swift */; }; - DED45DED261B96B70086EF63 /* StoreConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD03C2D25527CE6002227DC /* StoreConcurrencyTests.swift */; }; - DED45DEE261B96B70086EF63 /* FetchQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6ABC51EC0A9F7000017BE /* FetchQueryTests.swift */; }; - DED45DEF261B96B70086EF63 /* ReadWriteFromStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F8622F71EC2004200C38162 /* ReadWriteFromStoreTests.swift */; }; - DED45E30261B972C0086EF63 /* CachePersistenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDAD423FDEC9B00ACD198 /* CachePersistenceTests.swift */; }; - DED45E6B261B9EAC0086EF63 /* SQLiteTestCacheProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDAEC23FDED9700ACD198 /* SQLiteTestCacheProvider.swift */; }; - DED45EC3261BA0ED0086EF63 /* WebSocketTransportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D90F1AF92479DEE5007A1534 /* WebSocketTransportTests.swift */; }; - DED45EC4261BA0ED0086EF63 /* SplitNetworkTransportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA8A23FDE92900ACD198 /* SplitNetworkTransportTests.swift */; }; - DED45EC7261BA0ED0086EF63 /* WebSocketTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA8923FDE92900ACD198 /* WebSocketTests.swift */; }; - DED45EE4261BA1FB0086EF63 /* ApolloSQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7BDABF23FDEBB600ACD198 /* ApolloSQLite.framework */; }; - DED45EE5261BA1FB0086EF63 /* ApolloWebSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7BDA7D23FDE90400ACD198 /* ApolloWebSocket.framework */; }; - DED45EFE261CDA2A0086EF63 /* StarWarsSubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA8823FDE92900ACD198 /* StarWarsSubscriptionTests.swift */; }; - DED45F17261CDA360086EF63 /* StarWarsWebSocketTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA8C23FDE92900ACD198 /* StarWarsWebSocketTests.swift */; }; - DED45F4A261CDBFC0086EF63 /* UploadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED45F49261CDBFC0086EF63 /* UploadTests.swift */; }; - DED45FD0261CE88C0086EF63 /* ApolloSQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7BDABF23FDEBB600ACD198 /* ApolloSQLite.framework */; }; - DED45FE7261CE8C50086EF63 /* ApolloWebSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7BDA7D23FDE90400ACD198 /* ApolloWebSocket.framework */; }; - DED46000261CE9080086EF63 /* HTTPBinAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F4540244A2A9200C2CF7D /* HTTPBinAPI.swift */; }; - DED4600D261CE9260086EF63 /* TestFileHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B21FD762422C8CC00998B5C /* TestFileHelper.swift */; }; - DED4601A261CE9880086EF63 /* MockWebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7BDA8723FDE92900ACD198 /* MockWebSocket.swift */; }; - DED46035261CEA660086EF63 /* ApolloInternalTestHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */; }; - DED46042261CEA8A0086EF63 /* TestServerURLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED45C172615308E0086EF63 /* TestServerURLs.swift */; }; - DED46051261CEAD20086EF63 /* StarWarsAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FCE2CFA1E6C213D00E34457 /* StarWarsAPI.framework */; }; - DED5B355286CCAFF00AE6BFF /* ResponsePath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F7BA89822927A3700999B3B /* ResponsePath.swift */; }; - DED5B357286CD34000AE6BFF /* CompilationResultSchemaDocumentationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED5B356286CD34000AE6BFF /* CompilationResultSchemaDocumentationTests.swift */; }; - DED5B359286CEA0900AE6BFF /* TemplateString_Documentation_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED5B358286CEA0900AE6BFF /* TemplateString_Documentation_Tests.swift */; }; - DED5B35B286CF16600AE6BFF /* TemplateString+CodegenConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED5B35A286CF16600AE6BFF /* TemplateString+CodegenConfiguration.swift */; }; - DEE2060B27E14498002B4B82 /* IR+InclusionConditionsMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEE2060A27E14498002B4B82 /* IR+InclusionConditionsMock.swift */; }; - DEE2DAA227BAF00500EC0607 /* GraphQLType+Rendered.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEE2DAA127BAF00500EC0607 /* GraphQLType+Rendered.swift */; }; - DEF330352A4B6DEE0081883D /* PersistedQueriesOperationManifestTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF330342A4B6DEE0081883D /* PersistedQueriesOperationManifestTemplate.swift */; }; - DEF330372A4B6EAA0081883D /* PersistedQueriesOperationManifestTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF330362A4B6EAA0081883D /* PersistedQueriesOperationManifestTemplateTests.swift */; }; - DEFBBC86273470F70088AABC /* IR+Field.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFBBC85273470F70088AABC /* IR+Field.swift */; }; - DEFE0FC52748822900FFA440 /* IR+EntitySelectionTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFE0FC42748822900FFA440 /* IR+EntitySelectionTree.swift */; }; - DEFE694E280F6CBE001CF4E8 /* IR+FieldCollector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFE694D280F6CBE001CF4E8 /* IR+FieldCollector.swift */; }; - DEFE695128134028001CF4E8 /* IRFieldCollectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFE694F28133E9B001CF4E8 /* IRFieldCollectorTests.swift */; }; - DEFE695B28205321001CF4E8 /* SelectionSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFE695A28205321001CF4E8 /* SelectionSetTests.swift */; }; - E607AD8E27A88F340026742A /* OperationFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E607AD8D27A88F340026742A /* OperationFileGeneratorTests.swift */; }; - E608A5232808E59A001BE656 /* MockWebSocketDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E608A5222808E59A001BE656 /* MockWebSocketDelegate.swift */; }; - E608A529280905C2001BE656 /* GraphqlWsProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E608A526280905C2001BE656 /* GraphqlWsProtocolTests.swift */; }; - E608A52A280905C2001BE656 /* GraphqlTransportWsProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E608A527280905C2001BE656 /* GraphqlTransportWsProtocolTests.swift */; }; - E608A52B280905C2001BE656 /* WSProtocolTestsBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = E608A528280905C2001BE656 /* WSProtocolTestsBase.swift */; }; - E608A52D280905E9001BE656 /* SubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E608A52C280905E9001BE656 /* SubscriptionTests.swift */; }; - E60AE2EE27E3FC6C003C093A /* TemplateRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E60AE2ED27E3FC6C003C093A /* TemplateRenderer.swift */; }; - E60F457A29E4CFB800E60A04 /* TemplateString_DeprecationMessage_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E60F457929E4CFB800E60A04 /* TemplateString_DeprecationMessage_Tests.swift */; }; - E610D8D7278EA2390023E495 /* EnumFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E610D8D6278EA2390023E495 /* EnumFileGenerator.swift */; }; - E610D8D9278EA2560023E495 /* EnumFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E610D8D8278EA2560023E495 /* EnumFileGeneratorTests.swift */; }; - E610D8DB278EB0900023E495 /* InterfaceFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E610D8DA278EB0900023E495 /* InterfaceFileGenerator.swift */; }; - E610D8DD278EB1500023E495 /* InterfaceFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E610D8DC278EB1500023E495 /* InterfaceFileGeneratorTests.swift */; }; - E610D8DF278F8F1E0023E495 /* UnionFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E610D8DE278F8F1E0023E495 /* UnionFileGenerator.swift */; }; - E610D8E1278F8F3D0023E495 /* UnionFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E610D8E0278F8F3D0023E495 /* UnionFileGeneratorTests.swift */; }; - E616B6D126C3335600DB049E /* ClearCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E616B6D026C3335600DB049E /* ClearCacheTests.swift */; }; - E6180AA628093EB7004EC2A3 /* schema.graphqls in Resources */ = {isa = PBXBuildFile; fileRef = E6180AA128093EB7004EC2A3 /* schema.graphqls */; }; - E6180AA828093EB7004EC2A3 /* subscription.graphql in Resources */ = {isa = PBXBuildFile; fileRef = E6180AA328093EB7004EC2A3 /* subscription.graphql */; }; - E61D426A28803F3600C00F97 /* SubscriptionAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E66B836628093D7C001B3F2D /* SubscriptionAPI.framework */; }; - E61DD76526D60C1800C41614 /* SQLiteDotSwiftDatabaseBehaviorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E61DD76426D60C1800C41614 /* SQLiteDotSwiftDatabaseBehaviorTests.swift */; }; - E61EF713275EC99A00191DA7 /* ApolloCodegenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E61EF712275EC99A00191DA7 /* ApolloCodegenTests.swift */; }; - E61F4BF827A8FC8E0049886A /* FragmentFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E61F4BF727A8FC8E0049886A /* FragmentFileGeneratorTests.swift */; }; - E6203342284F1C9600A291D1 /* MockUnionsFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6203341284F1C9600A291D1 /* MockUnionsFileGenerator.swift */; }; - E6203344284F1D1100A291D1 /* MockUnionsTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6203343284F1D1100A291D1 /* MockUnionsTemplate.swift */; }; - E6203346284F252A00A291D1 /* MockUnionsFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6203345284F252A00A291D1 /* MockUnionsFileGeneratorTests.swift */; }; - E6203348284F25DF00A291D1 /* MockUnionsTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6203347284F25DF00A291D1 /* MockUnionsTemplateTests.swift */; }; - E623FD2A2797A6F4008B4CED /* InterfaceTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E623FD292797A6F4008B4CED /* InterfaceTemplate.swift */; }; - E63F0C0328EE0F2A009069EA /* ApolloCodegenFrontendBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E63F0C0028EE099A009069EA /* ApolloCodegenFrontendBundle.swift */; }; - E64F226D28B8B3FE0011292F /* LogLevelSetter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F226C28B8B3FE0011292F /* LogLevelSetter.swift */; }; - E64F227128B8BEE10011292F /* MockLogLevelSetter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F227028B8BEE10011292F /* MockLogLevelSetter.swift */; }; - E64F7EB827A0854E0059C021 /* UnionTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F7EB727A0854E0059C021 /* UnionTemplate.swift */; }; - E64F7EBA27A085D90059C021 /* UnionTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F7EB927A085D90059C021 /* UnionTemplateTests.swift */; }; - E64F7EBC27A11A510059C021 /* GraphQLNamedType+SwiftName.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F7EBB27A11A510059C021 /* GraphQLNamedType+SwiftName.swift */; }; - E64F7EBF27A11B110059C021 /* GraphQLNamedType+SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F7EBE27A11B110059C021 /* GraphQLNamedType+SwiftTests.swift */; }; - E64F7EC127A122300059C021 /* ObjectTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F7EC027A122300059C021 /* ObjectTemplate.swift */; }; - E657CDBA26FD01D4005834D6 /* ApolloSchemaInternalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E657CDB926FD01D4005834D6 /* ApolloSchemaInternalTests.swift */; }; - E660A4D129CA56A4001EA373 /* MockHTTPRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E660A4D029CA56A4001EA373 /* MockHTTPRequest.swift */; }; - E660A4D329CA5890001EA373 /* MockHTTPResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = E660A4D229CA5890001EA373 /* MockHTTPResponse.swift */; }; - E660A4D529CAEA0F001EA373 /* MockInterceptorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E660A4D429CAEA0F001EA373 /* MockInterceptorProvider.swift */; }; - E6630B8C26F0639B002D9E41 /* MockNetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D79AB926EC05290094434A /* MockNetworkSession.swift */; }; - E6630B8E26F071F9002D9E41 /* SchemaRegistryApolloSchemaDownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6630B8D26F071F9002D9E41 /* SchemaRegistryApolloSchemaDownloaderTests.swift */; }; - E66644F129D7D2AE005E9140 /* MockTemplateRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66644EF29D7D27C005E9140 /* MockTemplateRenderer.swift */; }; - E669352B2803EE11004E1FFC /* CustomScalarTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E669352A2803EE11004E1FFC /* CustomScalarTemplate.swift */; }; - E669352D2803EF67004E1FFC /* CustomScalarTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E669352C2803EF67004E1FFC /* CustomScalarTemplateTests.swift */; }; - E669352F2803F09C004E1FFC /* CustomScalarFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E669352E2803F09C004E1FFC /* CustomScalarFileGenerator.swift */; }; - E66935312803F2B0004E1FFC /* CustomScalarFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66935302803F2B0004E1FFC /* CustomScalarFileGeneratorTests.swift */; }; - E66935332804AFE5004E1FFC /* IRCustomScalarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66935322804AFE5004E1FFC /* IRCustomScalarTests.swift */; }; - E66B8342280936B3001B3F2D /* OperationMessageMatchers.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66B8341280936B3001B3F2D /* OperationMessageMatchers.swift */; }; - E66F8897276C136B0000BDA8 /* ObjectFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66F8896276C136B0000BDA8 /* ObjectFileGeneratorTests.swift */; }; - E66F8899276C15580000BDA8 /* ObjectFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66F8898276C15580000BDA8 /* ObjectFileGenerator.swift */; }; - E674DB41274C0A9B009BB90E /* Glob.swift in Sources */ = {isa = PBXBuildFile; fileRef = E674DB40274C0A9B009BB90E /* Glob.swift */; }; - E674DB43274C0AD9009BB90E /* GlobTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E674DB42274C0AD9009BB90E /* GlobTests.swift */; }; - E687B3DC28B398E600A9551C /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3CA28B398E600A9551C /* Constants.swift */; }; - E687B3DD28B398E600A9551C /* InputOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3CC28B398E600A9551C /* InputOptions.swift */; }; - E687B3DE28B398E600A9551C /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3CD28B398E600A9551C /* Error.swift */; }; - E687B3DF28B398E600A9551C /* ParsableCommand+Apollo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3CF28B398E600A9551C /* ParsableCommand+Apollo.swift */; }; - E687B3E028B398E600A9551C /* FileManager+Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3D028B398E600A9551C /* FileManager+Data.swift */; }; - E687B3E128B398E600A9551C /* String+Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3D128B398E600A9551C /* String+Data.swift */; }; - E687B3E328B398E600A9551C /* FetchSchema.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3D428B398E600A9551C /* FetchSchema.swift */; }; - E687B3E428B398E600A9551C /* Initialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3D528B398E600A9551C /* Initialize.swift */; }; - E687B3E528B398E600A9551C /* Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3D628B398E600A9551C /* Generate.swift */; }; - E687B3E728B398E600A9551C /* CodegenProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3D928B398E600A9551C /* CodegenProvider.swift */; }; - E687B3E828B398E600A9551C /* SchemaDownloadProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E687B3DA28B398E600A9551C /* SchemaDownloadProvider.swift */; }; - E687B3EA28B3993000A9551C /* ApolloCodegenLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; }; - E687B3EB28B3993000A9551C /* ApolloCodegenLib.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - E687B3F228B39A5B00A9551C /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = E687B3F128B39A5B00A9551C /* ArgumentParser */; }; - E68D824527A1D8A60040A46F /* ObjectTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64F7EC227A1243A0059C021 /* ObjectTemplateTests.swift */; }; - E68D824727A228A80040A46F /* SchemaModuleFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E68D824627A228A80040A46F /* SchemaModuleFileGenerator.swift */; }; - E6908E55282694630054682B /* ApolloCodegenConfigurationCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6908E54282694630054682B /* ApolloCodegenConfigurationCodableTests.swift */; }; - E6931D4B29CE44EA005DD9E4 /* String+Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6931D4A29CE44EA005DD9E4 /* String+Data.swift */; }; - E6936F162908AD8D0089054C /* PetSearchLocalCacheMutation.graphql.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6936F152908AD8D0089054C /* PetSearchLocalCacheMutation.graphql.swift */; }; - E69BEDA52798B86D00000D10 /* InputObjectTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69BEDA42798B86D00000D10 /* InputObjectTemplate.swift */; }; - E69BEDA72798B89600000D10 /* InputObjectTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69BEDA62798B89600000D10 /* InputObjectTemplateTests.swift */; }; - E69F436C29B81182006FF548 /* InterceptorRequestChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69F436B29B81182006FF548 /* InterceptorRequestChain.swift */; }; - E69F437229BBD958006FF548 /* MultipartResponseParsingInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69F437129BBD958006FF548 /* MultipartResponseParsingInterceptor.swift */; }; - E6A6866427F63AEF008A1D13 /* FileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6866327F63AEF008A1D13 /* FileGeneratorTests.swift */; }; - E6A6866627F63BDC008A1D13 /* FileGenerator_ResolvePath_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A6866527F63BDC008A1D13 /* FileGenerator_ResolvePath_Tests.swift */; }; - E6AAA732286BC58200F4659D /* OperationManifestFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6AAA731286BC58200F4659D /* OperationManifestFileGenerator.swift */; }; - E6AAA737286C11E600F4659D /* OperationManifestFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6AAA735286C0F8E00F4659D /* OperationManifestFileGeneratorTests.swift */; }; - E6AAA739286C87EA00F4659D /* LegacyAPQOperationManifestTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6AAA738286C87EA00F4659D /* LegacyAPQOperationManifestTemplate.swift */; }; - E6AAA73B286CC7EF00F4659D /* LegacyAPQOperationManifestTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6AAA73A286CC7EF00F4659D /* LegacyAPQOperationManifestTemplateTests.swift */; }; - E6B1FEBB29F2FC97003D12E0 /* InterceptorTester.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B1FEBA29F2FC97003D12E0 /* InterceptorTester.swift */; }; - E6B2B26C29C2447F004B16F4 /* MultipartResponseParsingInterceptorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B2B26B29C2447F004B16F4 /* MultipartResponseParsingInterceptorTests.swift */; }; - E6B42D0927A472A700A3BD58 /* SwiftPackageManagerModuleTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B42D0827A472A700A3BD58 /* SwiftPackageManagerModuleTemplate.swift */; }; - E6B42D0B27A4746800A3BD58 /* SchemaModuleFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B42D0A27A4746800A3BD58 /* SchemaModuleFileGeneratorTests.swift */; }; - E6B42D0D27A4749100A3BD58 /* SwiftPackageManagerModuleTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B42D0C27A4749100A3BD58 /* SwiftPackageManagerModuleTemplateTests.swift */; }; - E6B4E9982798A8C6004EC8C4 /* FragmentTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE5FD60C2769711E0033EE23 /* FragmentTemplateTests.swift */; }; - E6B4E9992798A8CB004EC8C4 /* InterfaceTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E623FD2B2797A700008B4CED /* InterfaceTemplateTests.swift */; }; - E6BEEFA627FAB1C700D94FF4 /* MockFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6BEEFA527FAB1C700D94FF4 /* MockFileGenerator.swift */; }; - E6BF98FC272C8FFC00C1FED8 /* MockFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6BF98FB272C8FFC00C1FED8 /* MockFileManager.swift */; }; - E6C2B39B2809409500F4CE13 /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; }; - E6C4267B26F16CB400904AD2 /* introspection_response.json in Resources */ = {isa = PBXBuildFile; fileRef = E6C4267A26F16CB400904AD2 /* introspection_response.json */; }; - E6C9849327929EBE009481BE /* EnumTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6C9849227929EBE009481BE /* EnumTemplate.swift */; }; - E6C9849527929FED009481BE /* EnumTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6C9849427929FED009481BE /* EnumTemplateTests.swift */; }; - E6CD6F4B2887202900DC9F3F /* CacheKeyResolutionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6CD6F4A2887202900DC9F3F /* CacheKeyResolutionTests.swift */; }; - E6D79AB826E9D59C0094434A /* URLDownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D79AB626E97D0D0094434A /* URLDownloaderTests.swift */; }; - E6D90D07278FA595009CAC5D /* InputObjectFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D90D06278FA595009CAC5D /* InputObjectFileGenerator.swift */; }; - E6D90D09278FA5C3009CAC5D /* InputObjectFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D90D08278FA5C3009CAC5D /* InputObjectFileGeneratorTests.swift */; }; - E6D90D0B278FFDDA009CAC5D /* SchemaMetadataFileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D90D0A278FFDDA009CAC5D /* SchemaMetadataFileGenerator.swift */; }; - E6D90D0D278FFE35009CAC5D /* SchemaMetadataFileGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D90D0C278FFE35009CAC5D /* SchemaMetadataFileGeneratorTests.swift */; }; - E6D9212928DA631D00AF12E6 /* ApolloSchemaDownloadConfigurationCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D9212828DA631D00AF12E6 /* ApolloSchemaDownloadConfigurationCodableTests.swift */; }; - E6D9212B28DA66B300AF12E6 /* String+Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D9212A28DA66B300AF12E6 /* String+Data.swift */; }; - E6DC0AC228B3AB890064A68F /* CodegenCLI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E687B3C128B398CB00A9551C /* CodegenCLI.framework */; }; - E6DC0AD728B3AC490064A68F /* MockApolloCodegen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0ACB28B3AC490064A68F /* MockApolloCodegen.swift */; }; - E6DC0AD828B3AC490064A68F /* MockApolloCodegenConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0ACC28B3AC490064A68F /* MockApolloCodegenConfiguration.swift */; }; - E6DC0AD928B3AC490064A68F /* TestSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0ACD28B3AC490064A68F /* TestSupport.swift */; }; - E6DC0ADA28B3AC490064A68F /* MockApolloSchemaDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0ACE28B3AC490064A68F /* MockApolloSchemaDownloader.swift */; }; - E6DC0ADB28B3AC490064A68F /* MockFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0ACF28B3AC490064A68F /* MockFileManager.swift */; }; - E6DC0ADC28B3AC490064A68F /* InitializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0AD128B3AC490064A68F /* InitializeTests.swift */; }; - E6DC0ADD28B3AC490064A68F /* GenerateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0AD228B3AC490064A68F /* GenerateTests.swift */; }; - E6DC0ADE28B3AC490064A68F /* FetchSchemaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0AD328B3AC490064A68F /* FetchSchemaTests.swift */; }; - E6DC0ADF28B3AC490064A68F /* ErrorMatchers.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DC0AD528B3AC490064A68F /* ErrorMatchers.swift */; }; - E6DC0AE228B3AC7E0064A68F /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = E6DC0AE128B3AC7E0064A68F /* Nimble */; }; - E6E3BBE2276A8D6200E5218B /* FileGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6E3BBDD276A8D6200E5218B /* FileGenerator.swift */; }; - E6EE62F127DBE6F200627257 /* SchemaModuleNamespaceTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EE62F027DBE6F200627257 /* SchemaModuleNamespaceTemplate.swift */; }; - E6EE62F327DBE75A00627257 /* SchemaModuleNamespaceTemplateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EE62F227DBE75A00627257 /* SchemaModuleNamespaceTemplateTests.swift */; }; - E6EE6F1229C141A600BDE7A5 /* HTTPURLResponseExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EE6F1129C141A600BDE7A5 /* HTTPURLResponseExtensionTests.swift */; }; - E6EFDD0B27E8328E00B17FE5 /* TemplateRenderer_SchemaFile_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EFDD0A27E8328E00B17FE5 /* TemplateRenderer_SchemaFile_Tests.swift */; }; - E6EFDD0D27E8377200B17FE5 /* MockFileTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EFDD0C27E8377200B17FE5 /* MockFileTemplate.swift */; }; - E6EFDD1527EAB55B00B17FE5 /* TemplateRenderer_OperationFile_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EFDD1327EAB55B00B17FE5 /* TemplateRenderer_OperationFile_Tests.swift */; }; - E6FDD7532880471400BD0ADA /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = E6FDD7522880471400BD0ADA /* Nimble */; }; - E86D8E05214B32FD0028EFE1 /* JSONTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E86D8E03214B32DA0028EFE1 /* JSONTests.swift */; }; - F16D083C21EF6F7300C458B8 /* SelectionSet_JSONInitializerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16D083B21EF6F7300C458B8 /* SelectionSet_JSONInitializerTests.swift */; }; - F82E62E122BCD223000C311B /* AutomaticPersistedQueriesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82E62E022BCD223000C311B /* AutomaticPersistedQueriesTests.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 9B2DFBCB24E201A000ED3AE6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B2DFBB524E1FA0D00ED3AE6; - remoteInfo = UploadAPI; - }; - 9B7BDAF723FDEE8400ACD198 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9B7BDAFB23FDEE9000ACD198 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9BAEEC02234BB8FD00808306 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7B6F46233C26D100F32205; - remoteInfo = ApolloCodegenLib; - }; - 9F54C8BA255D760B0065AFD6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9F54C8DE255D76810065AFD6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9F8A95771EC0FC1200304A2D; - remoteInfo = ApolloTestSupport; - }; - 9F54C8E0255D76810065AFD6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FACA9B71F42E67200AE2DBD; - remoteInfo = GitHubAPI; - }; - 9F65B11F1EC106E80090B25F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9F8A958B1EC0FF9F00304A2D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9F8A95771EC0FC1200304A2D; - remoteInfo = ApolloTestSupport; - }; - 9FA5FBB51EC05CE900304A9D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9FACA9B91F42E67200AE2DBD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9FC750501D2A532D00458D91 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - 9FCE2D071E6C254000E34457 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FCE2CF91E6C213D00E34457; - remoteInfo = StarWarsAPI; - }; - DE05862726697B1D00265760 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE058606266978A100265760; - remoteInfo = ApolloModels; - }; - DE6B15B226152BE10068D642 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - DE6D083427BDAB9E009F5F33 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE058606266978A100265760; - remoteInfo = ApolloAPI; - }; - DE903E1F29CA25AA00A74415 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE3C7A00260A6B9800D2F4FF; - remoteInfo = AnimalKingdomAPI; - }; - DE903E2329CE59BD00A74415 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - DE90FCE627FCC71E0084CC79 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE058606266978A100265760; - remoteInfo = ApolloAPI; - }; - DE9CEAE22829A01A00959AF9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE058606266978A100265760; - remoteInfo = ApolloAPI; - }; - DE9CEAE72829A3C100959AF9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE9CEAB328299E8500959AF9; - remoteInfo = ApolloTestSupport; - }; - DEC2EA8E291ED0DE0088D3BB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9F8A95771EC0FC1200304A2D; - remoteInfo = ApolloInternalTestHelpers; - }; - DEC2EA91291ED3890088D3BB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - DECD46F9262F659100924527 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7B6F46233C26D100F32205; - remoteInfo = ApolloCodegenLib; - }; - DECD4734262F668200924527 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B2DFBB524E1FA0D00ED3AE6; - remoteInfo = UploadAPI; - }; - DECD498D262F840100924527 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DECD490A262F81BF00924527; - remoteInfo = ApolloCodegenTestSupport; - }; - DECD4990262F841300924527 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DECD490A262F81BF00924527; - remoteInfo = ApolloCodegenTestSupport; - }; - DECD49C7262F88FA00924527 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7B6F46233C26D100F32205; - remoteInfo = ApolloCodegenLib; - }; - DECD49D9262F8AA500924527 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9F8A95771EC0FC1200304A2D; - remoteInfo = ApolloTestSupport; - }; - DED45E97261B9EFA0086EF63 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7BDABE23FDEBB600ACD198; - remoteInfo = ApolloSQLite; - }; - DED45E99261B9F000086EF63 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7BDA7C23FDE90400ACD198; - remoteInfo = ApolloWebSocket; - }; - DED45FCE261CE8890086EF63 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7BDABE23FDEBB600ACD198; - remoteInfo = ApolloSQLite; - }; - DED45FD5261CE89C0086EF63 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7BDA7C23FDE90400ACD198; - remoteInfo = ApolloWebSocket; - }; - DED46033261CEA610086EF63 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9F8A95771EC0FC1200304A2D; - remoteInfo = ApolloTestSupport; - }; - DED4606A261CEDD10086EF63 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FCE2CF91E6C213D00E34457; - remoteInfo = StarWarsAPI; - }; - E61D426828803F2E00C00F97 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = E66B836528093D7C001B3F2D; - remoteInfo = SubscriptionAPI; - }; - E687B3EC28B3993000A9551C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9B7B6F46233C26D100F32205; - remoteInfo = ApolloCodegenLib; - }; - E6C2B39C2809409900F4CE13 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9FC750431D2A532C00458D91; - remoteInfo = Apollo; - }; - E6DC0AC328B3AB890064A68F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9FC7503B1D2A532C00458D91 /* Project object */; - proxyType = 1; - remoteGlobalIDString = E687B3C028B398CB00A9551C; - remoteInfo = CodegenCLI; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - E687B3EE28B3993000A9551C /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - E687B3EB28B3993000A9551C /* ApolloCodegenLib.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 07236D322A992498009BFF7B /* RequestContextTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestContextTests.swift; sourceTree = ""; }; - 073D39F42A8AD1AF001BD34A /* RequestContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestContext.swift; sourceTree = ""; }; - 19E9F6A826D5867E003AB80E /* OperationMessageIdCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationMessageIdCreator.swift; sourceTree = ""; }; - 19E9F6AA26D58A92003AB80E /* OperationMessageIdCreatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationMessageIdCreatorTests.swift; sourceTree = ""; }; - 2EE7FFCF276802E30035DC39 /* CacheKeyConstructionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheKeyConstructionTests.swift; sourceTree = ""; }; - 534A754428EB21D6003291BE /* TemplateString+DeprecationMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TemplateString+DeprecationMessage.swift"; sourceTree = ""; }; - 54DDB0911EA045870009DD99 /* InMemoryNormalizedCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InMemoryNormalizedCache.swift; sourceTree = ""; }; - 5AC6CA4222AAF7B200B7C94D /* GraphQLHTTPMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLHTTPMethod.swift; sourceTree = ""; }; - 5BB2C0222380836100774170 /* VersionNumberTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionNumberTests.swift; sourceTree = ""; }; - 6608B3342A7D3FF5006FB655 /* ApolloCodegenConfiguration+OperationManifestConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ApolloCodegenConfiguration+OperationManifestConfiguration.swift"; sourceTree = ""; }; - 662EA65D2A701483008A1931 /* GenerateOperationManifest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateOperationManifest.swift; sourceTree = ""; }; - 662EA65F2A705BD7008A1931 /* GenerateOperationManifestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateOperationManifestTests.swift; sourceTree = ""; }; - 66321AE62A126C4400CC35CB /* IR+Formatting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+Formatting.swift"; sourceTree = ""; }; - 66B18E8E2A16BF9B00525DFB /* MockURLProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockURLProtocol.swift; sourceTree = ""; }; - 90690D05224333DA00FC2E54 /* Apollo-Project-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Project-Debug.xcconfig"; sourceTree = ""; }; - 90690D06224333DA00FC2E54 /* Apollo-Target-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-Framework.xcconfig"; sourceTree = ""; }; - 90690D07224333DA00FC2E54 /* Apollo-Project-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Project-Release.xcconfig"; sourceTree = ""; }; - 90690D08224333DA00FC2E54 /* Apollo-Project-Performance-Testing.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Project-Performance-Testing.xcconfig"; sourceTree = ""; }; - 90690D0B2243345500FC2E54 /* Apollo-Target-Tests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-Tests.xcconfig"; sourceTree = ""; }; - 90690D142243363D00FC2E54 /* Apollo-Target-TestHost-iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-TestHost-iOS.xcconfig"; sourceTree = ""; }; - 90690D2122433C1900FC2E54 /* Apollo-Target-StarWarsAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-StarWarsAPI.xcconfig"; sourceTree = ""; }; - 90690D2222433C2800FC2E54 /* Apollo-Target-GitHubAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-GitHubAPI.xcconfig"; sourceTree = ""; }; - 90690D2422433C8000FC2E54 /* Apollo-Target-PerformanceTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-PerformanceTests.xcconfig"; sourceTree = ""; }; - 90690D2522433CAF00FC2E54 /* Apollo-Target-InternalTestHelpers.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-InternalTestHelpers.xcconfig"; sourceTree = ""; }; - 96F32D3A27CCD16B00F3383C /* animalkingdom-graphql */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "animalkingdom-graphql"; sourceTree = ""; }; - 9B1CCDD82360F02C007C9032 /* Bundle+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Helpers.swift"; sourceTree = ""; }; - 9B2061172591B3550020D1E0 /* c.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = c.txt; sourceTree = ""; }; - 9B2061182591B3550020D1E0 /* b.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = b.txt; sourceTree = ""; }; - 9B2061192591B3550020D1E0 /* a.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = a.txt; sourceTree = ""; }; - 9B20614B2591B3700020D1E0 /* UploadMultipleFiles.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = UploadMultipleFiles.graphql; sourceTree = ""; }; - 9B20614C2591B3700020D1E0 /* operationIDs.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = operationIDs.json; sourceTree = ""; }; - 9B20614D2591B3700020D1E0 /* schema.graphqls */ = {isa = PBXFileReference; lastKnownFileType = text; path = schema.graphqls; sourceTree = ""; }; - 9B20614E2591B3700020D1E0 /* UploadOneFile.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = UploadOneFile.graphql; sourceTree = ""; }; - 9B2061692591B3A50020D1E0 /* IssuesAndCommentsForRepository.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = IssuesAndCommentsForRepository.graphql; sourceTree = ""; }; - 9B20616D2591B3A50020D1E0 /* RepoURL.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = RepoURL.graphql; sourceTree = ""; }; - 9B20616E2591B3A50020D1E0 /* Repository.graphql */ = {isa = PBXFileReference; lastKnownFileType = text; path = Repository.graphql; sourceTree = ""; }; - 9B2061702591B3A50020D1E0 /* operationIDs.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = operationIDs.json; sourceTree = ""; }; - 9B21FD742422C29D00998B5C /* GraphQLFileTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLFileTests.swift; sourceTree = ""; }; - 9B21FD762422C8CC00998B5C /* TestFileHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestFileHelper.swift; sourceTree = ""; }; - 9B260BEA245A020300562176 /* ApolloInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloInterceptor.swift; sourceTree = ""; }; - 9B260BF0245A025400562176 /* HTTPRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPRequest.swift; sourceTree = ""; }; - 9B260BF2245A026F00562176 /* RequestChain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestChain.swift; sourceTree = ""; }; - 9B260BF4245A028D00562176 /* HTTPResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPResponse.swift; sourceTree = ""; }; - 9B260BF8245A030100562176 /* ResponseCodeInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResponseCodeInterceptor.swift; sourceTree = ""; }; - 9B260BFA245A031900562176 /* NetworkFetchInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkFetchInterceptor.swift; sourceTree = ""; }; - 9B260BFE245A054700562176 /* JSONRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONRequest.swift; sourceTree = ""; }; - 9B260C03245A090600562176 /* RequestChainNetworkTransport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestChainNetworkTransport.swift; sourceTree = ""; }; - 9B260C07245A437400562176 /* InterceptorProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterceptorProvider.swift; sourceTree = ""; }; - 9B260C09245A532500562176 /* JSONResponseParsingInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONResponseParsingInterceptor.swift; sourceTree = ""; }; - 9B2B66F32513FAFE00B53ABF /* CancellationHandlingInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CancellationHandlingInterceptor.swift; sourceTree = ""; }; - 9B2DFBB624E1FA0D00ED3AE6 /* UploadAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UploadAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9B2DFBC624E1FA3E00ED3AE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9B2DFBC824E1FA7E00ED3AE6 /* Apollo-Target-UploadAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-UploadAPI.xcconfig"; sourceTree = ""; }; - 9B2DFBCA24E2016800ED3AE6 /* UploadAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UploadAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9B47516D2575AA690001FB87 /* Pluralizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pluralizer.swift; sourceTree = ""; }; - 9B4751AC2575B5070001FB87 /* PluralizerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluralizerTests.swift; sourceTree = ""; }; - 9B4AA8AD239EFDC9003E1300 /* Apollo-Target-CodegenTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-CodegenTests.xcconfig"; sourceTree = ""; }; - 9B4F453E244A27B900C2CF7D /* URLSessionClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionClient.swift; sourceTree = ""; }; - 9B4F4540244A2A9200C2CF7D /* HTTPBinAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPBinAPI.swift; sourceTree = ""; }; - 9B4F4542244A2AD300C2CF7D /* URLSessionClientTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionClientTests.swift; sourceTree = ""; }; - 9B554CC3247DC29A002F452A /* TaskData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskData.swift; sourceTree = ""; }; - 9B5A1EE3243284F300F066BB /* Package.swift */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; tabWidth = 2; }; - 9B60204E23FDFA9F00D0C8E0 /* SQLiteCacheTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteCacheTests.swift; sourceTree = ""; }; - 9B64F6752354D219002D1BB5 /* URL+QueryDict.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+QueryDict.swift"; sourceTree = ""; }; - 9B68F0542416B33300E97318 /* LineByLineComparison.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineByLineComparison.swift; sourceTree = ""; }; - 9B68F06E241C649E00E97318 /* GraphQLNullable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLNullable.swift; sourceTree = ""; }; - 9B6CB23D238077B60007259D /* Atomic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = ""; }; - 9B708AAC2305884500604A11 /* ApolloClientProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloClientProtocol.swift; sourceTree = ""; }; - 9B78C71B2326E859000C8C32 /* ErrorGenerationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorGenerationTests.swift; sourceTree = ""; }; - 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloCodegenLib.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9B7B6F51233C26E400F32205 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9B7B6F55233C27A000F32205 /* Apollo-Target-ApolloCodegenLib.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Apollo-Target-ApolloCodegenLib.xcconfig"; sourceTree = ""; }; - 9B7B6F57233C287100F32205 /* ApolloCodegen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApolloCodegen.swift; sourceTree = ""; }; - 9B7B6F58233C287100F32205 /* ApolloCodegenConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApolloCodegenConfiguration.swift; sourceTree = ""; }; - 9B7B6F68233C2C0C00F32205 /* FileManager+Apollo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileManager+Apollo.swift"; sourceTree = ""; }; - 9B7BDA7D23FDE90400ACD198 /* ApolloWebSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloWebSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9B7BDA8723FDE92900ACD198 /* MockWebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockWebSocket.swift; sourceTree = ""; }; - 9B7BDA8823FDE92900ACD198 /* StarWarsSubscriptionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarWarsSubscriptionTests.swift; sourceTree = ""; }; - 9B7BDA8923FDE92900ACD198 /* WebSocketTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocketTests.swift; sourceTree = ""; }; - 9B7BDA8A23FDE92900ACD198 /* SplitNetworkTransportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplitNetworkTransportTests.swift; sourceTree = ""; }; - 9B7BDA8C23FDE92900ACD198 /* StarWarsWebSocketTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarWarsWebSocketTests.swift; sourceTree = ""; }; - 9B7BDA9423FDE94C00ACD198 /* WebSocketError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocketError.swift; sourceTree = ""; }; - 9B7BDA9523FDE94C00ACD198 /* WebSocketTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocketTask.swift; sourceTree = ""; }; - 9B7BDA9623FDE94C00ACD198 /* SplitNetworkTransport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplitNetworkTransport.swift; sourceTree = ""; }; - 9B7BDA9723FDE94C00ACD198 /* OperationMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationMessage.swift; sourceTree = ""; }; - 9B7BDA9823FDE94C00ACD198 /* WebSocketClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocketClient.swift; sourceTree = ""; }; - 9B7BDA9923FDE94C00ACD198 /* WebSocketTransport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocketTransport.swift; sourceTree = ""; }; - 9B7BDA9A23FDE94C00ACD198 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9B7BDAA323FDE98C00ACD198 /* ApolloWebSocket-Project-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "ApolloWebSocket-Project-Release.xcconfig"; sourceTree = ""; }; - 9B7BDAA423FDE98C00ACD198 /* ApolloWebSocket-Target-Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "ApolloWebSocket-Target-Framework.xcconfig"; sourceTree = ""; }; - 9B7BDAA523FDE98C00ACD198 /* ApolloWebSocket-Project-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "ApolloWebSocket-Project-Debug.xcconfig"; sourceTree = ""; }; - 9B7BDABF23FDEBB600ACD198 /* ApolloSQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloSQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9B7BDACD23FDEBE300ACD198 /* SQLiteSerialization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteSerialization.swift; sourceTree = ""; }; - 9B7BDACE23FDEBE300ACD198 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9B7BDACF23FDEBE300ACD198 /* SQLiteNormalizedCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteNormalizedCache.swift; sourceTree = ""; }; - 9B7BDAD423FDEC9B00ACD198 /* CachePersistenceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CachePersistenceTests.swift; sourceTree = ""; }; - 9B7BDAD823FDECB300ACD198 /* ApolloSQLite-Target-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "ApolloSQLite-Target-Framework.xcconfig"; sourceTree = ""; }; - 9B7BDAD923FDECB400ACD198 /* ApolloSQLite-Project-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "ApolloSQLite-Project-Debug.xcconfig"; sourceTree = ""; }; - 9B7BDADC23FDECB400ACD198 /* ApolloSQLite-Project-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "ApolloSQLite-Project-Release.xcconfig"; sourceTree = ""; }; - 9B7BDAEC23FDED9700ACD198 /* SQLiteTestCacheProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteTestCacheProvider.swift; sourceTree = ""; }; - 9B8110A723A1995D00688AC4 /* .keep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .keep; sourceTree = ""; }; - 9B8C3FB1248DA2EA00707B13 /* URL+Apollo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Apollo.swift"; sourceTree = ""; }; - 9B8C3FB4248DA3E000707B13 /* URLExtensionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLExtensionsTests.swift; sourceTree = ""; }; - 9B95EDBF22CAA0AF00702BB2 /* GETTransformerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GETTransformerTests.swift; sourceTree = ""; }; - 9B96500824BE6201003C29C0 /* RequestChainTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestChainTests.swift; sourceTree = ""; }; - 9B96500B24BE7239003C29C0 /* CacheReadInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheReadInterceptor.swift; sourceTree = ""; }; - 9B9BBAF224DB39D70021C30F /* UploadRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadRequest.swift; sourceTree = ""; }; - 9B9BBAF424DB4F890021C30F /* AutomaticPersistedQueryInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutomaticPersistedQueryInterceptor.swift; sourceTree = ""; }; - 9B9BBB1624DB74720021C30F /* Apollo-Target-UploadAPI.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Apollo-Target-UploadAPI.xcconfig"; sourceTree = ""; }; - 9B9BBB1A24DB75E60021C30F /* UploadRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadRequestTests.swift; sourceTree = ""; }; - 9B9F16A626013DAB00FB2F31 /* SQLiteDatabase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteDatabase.swift; sourceTree = ""; }; - 9B9F16B72601532500FB2F31 /* SQLiteDotSwiftDatabase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteDotSwiftDatabase.swift; sourceTree = ""; }; - 9BA1244922D8A8EA00BF1D24 /* JSONSerialization+Sorting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JSONSerialization+Sorting.swift"; sourceTree = ""; }; - 9BA3130D2302BEA5007B7FC5 /* DispatchQueue+Optional.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+Optional.swift"; sourceTree = ""; }; - 9BAEEBEB234663F200808306 /* ApolloSchemaDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloSchemaDownloader.swift; sourceTree = ""; }; - 9BAEEBED2346644600808306 /* ApolloSchemaDownloadConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloSchemaDownloadConfiguration.swift; sourceTree = ""; }; - 9BAEEBF22346DDAD00808306 /* CodegenLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodegenLogger.swift; sourceTree = ""; }; - 9BAEEBF62346F0A000808306 /* StaticString+Apollo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StaticString+Apollo.swift"; sourceTree = ""; }; - 9BAEEBFC234BB8FD00808306 /* ApolloCodegenTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApolloCodegenTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 9BAEEC0C234BB95B00808306 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9BAEEC0D234BB95B00808306 /* FileManagerExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileManagerExtensionTests.swift; sourceTree = ""; }; - 9BAEEC11234BBA9200808306 /* CodegenTestHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodegenTestHelper.swift; sourceTree = ""; }; - 9BAEEC16234C275600808306 /* ApolloSchemaPublicTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloSchemaPublicTests.swift; sourceTree = ""; }; - 9BAEEC18234C297800808306 /* ApolloCodegenConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloCodegenConfigurationTests.swift; sourceTree = ""; }; - 9BB4F5B12581AA50004F0BD6 /* CacheDependentInterceptorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheDependentInterceptorTests.swift; sourceTree = ""; }; - 9BC139A224EDCA4400876D29 /* MaxRetryInterceptorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaxRetryInterceptorTests.swift; sourceTree = ""; }; - 9BC139A524EDCAD900876D29 /* BlindRetryingTestInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlindRetryingTestInterceptor.swift; sourceTree = ""; }; - 9BC139A724EDCE4F00876D29 /* RetryToCountThenSucceedInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RetryToCountThenSucceedInterceptor.swift; sourceTree = ""; }; - 9BC742AB24CFB2FF0029282C /* ApolloErrorInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloErrorInterceptor.swift; sourceTree = ""; }; - 9BC742AD24CFB6450029282C /* CacheWriteInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheWriteInterceptor.swift; sourceTree = ""; }; - 9BCA8C0826618226004FF2F6 /* UntypedGraphQLRequestBodyCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UntypedGraphQLRequestBodyCreator.swift; sourceTree = ""; }; - 9BCF0CD923FC9CA50031D2A2 /* TestCacheProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestCacheProvider.swift; sourceTree = ""; }; - 9BCF0CDA23FC9CA50031D2A2 /* ApolloInternalTestHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApolloInternalTestHelpers.h; sourceTree = ""; }; - 9BCF0CDC23FC9CA50031D2A2 /* XCTAssertHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTAssertHelpers.swift; sourceTree = ""; }; - 9BCF0CDD23FC9CA50031D2A2 /* MockURLSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockURLSession.swift; sourceTree = ""; }; - 9BCF0CDE23FC9CA50031D2A2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9BCF0CDF23FC9CA50031D2A2 /* MockNetworkTransport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockNetworkTransport.swift; sourceTree = ""; }; - 9BCF0CFF23FC9F060031D2A2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9BDE43D022C6655200FD7C7F /* Cancellable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cancellable.swift; sourceTree = ""; }; - 9BDE43DE22C6708600FD7C7F /* GraphQLHTTPRequestError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLHTTPRequestError.swift; sourceTree = ""; }; - 9BDF201223FDC37600153E2B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9BE071AC2368D08700FA5952 /* Collection+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+Helpers.swift"; sourceTree = ""; }; - 9BE071AE2368D34D00FA5952 /* Matchable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Matchable.swift; sourceTree = ""; }; - 9BE74D3C23FB4A8E006D354F /* FileFinder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileFinder.swift; sourceTree = ""; }; - 9BEDC79D22E5D2CF00549BF6 /* RequestBodyCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestBodyCreator.swift; sourceTree = ""; }; - 9BEEDC2724E351E5001D1294 /* MaxRetryInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaxRetryInterceptor.swift; sourceTree = ""; }; - 9BEEDC2A24E61995001D1294 /* TestURLs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestURLs.swift; sourceTree = ""; }; - 9BF1A95022CA6E71005292C2 /* GraphQLGETTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLGETTransformer.swift; sourceTree = ""; }; - 9BF6C91725194D7B000D5B93 /* MultipartFormData+Testing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MultipartFormData+Testing.swift"; sourceTree = ""; }; - 9BF6C95225194EA5000D5B93 /* MultipartFormDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipartFormDataTests.swift; sourceTree = ""; }; - 9BFE8DA8265D5D8F000BBF81 /* URLDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLDownloader.swift; sourceTree = ""; }; - 9F1A9665258F34BB00A06EEB /* GraphQLJSFrontend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLJSFrontend.swift; sourceTree = ""; }; - 9F1A9667258F34BB00A06EEB /* GraphQLSchema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLSchema.swift; sourceTree = ""; }; - 9F1A9668258F34BB00A06EEB /* CompilationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompilationResult.swift; sourceTree = ""; }; - 9F1A966A258F34BB00A06EEB /* JavaScriptBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JavaScriptBridge.swift; sourceTree = ""; }; - 9F1A96AF258F36B200A06EEB /* SchemaLoadingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaLoadingTests.swift; sourceTree = ""; }; - 9F21735A2568F3E200566121 /* PossiblyDeferredTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PossiblyDeferredTests.swift; sourceTree = ""; }; - 9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONStandardTypeConversions.swift; sourceTree = ""; }; - 9F295E301E27534800A24949 /* GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift; sourceTree = ""; }; - 9F295E371E277B2A00A24949 /* GraphQLResultNormalizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLResultNormalizer.swift; sourceTree = ""; }; - 9F33D6A32566475600A1543F /* PossiblyDeferred.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PossiblyDeferred.swift; sourceTree = ""; }; - 9F3910262549741400AF54A6 /* MockGraphQLServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockGraphQLServer.swift; sourceTree = ""; }; - 9F438D0B1E6C494C007BDC1A /* BatchedLoadTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BatchedLoadTests.swift; sourceTree = ""; }; - 9F54C8B4255D760B0065AFD6 /* ApolloPerformanceTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApolloPerformanceTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 9F54C8B6255D760B0065AFD6 /* ParsingPerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParsingPerformanceTests.swift; sourceTree = ""; }; - 9F54C8B8255D760B0065AFD6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9F55347A1DE1DB2100E54264 /* ApolloStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApolloStore.swift; sourceTree = ""; }; - 9F578D8F1D8D2CB300C0EA36 /* HTTPURLResponse+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "HTTPURLResponse+Helpers.swift"; sourceTree = ""; }; - 9F628E9425935BE600F94F9D /* GraphQLType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLType.swift; sourceTree = ""; }; - 9F628EB42593651B00F94F9D /* GraphQLValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLValue.swift; sourceTree = ""; }; - 9F62DF8D2590539A00E6E808 /* SchemaIntrospectionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaIntrospectionTests.swift; sourceTree = ""; }; - 9F62DFAD2590557F00E6E808 /* DocumentParsingAndValidationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentParsingAndValidationTests.swift; sourceTree = ""; }; - 9F62DFCF2590710E00E6E808 /* GraphQLSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLSource.swift; sourceTree = ""; }; - 9F62E00F2590728000E6E808 /* CompilationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompilationTests.swift; sourceTree = ""; }; - 9F62E03E2590896400E6E808 /* GraphQLError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLError.swift; sourceTree = ""; }; - 9F68F9F025415827004F26D0 /* XCTestCase+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Helpers.swift"; sourceTree = ""; }; - 9F69FFA81D42855900E000B1 /* NetworkTransport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkTransport.swift; sourceTree = ""; }; - 9F7BA89822927A3700999B3B /* ResponsePath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResponsePath.swift; sourceTree = ""; }; - 9F8622F71EC2004200C38162 /* ReadWriteFromStoreTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadWriteFromStoreTests.swift; sourceTree = ""; }; - 9F86B68A1E6438D700B885FF /* GraphQLSelectionSetMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLSelectionSetMapper.swift; sourceTree = ""; }; - 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloInternalTestHelpers.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9F91CF8E1F6C0DB2008DD0BE /* MutatingSelectionSetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutatingSelectionSetTests.swift; sourceTree = ""; }; - 9FA6ABC51EC0A9F7000017BE /* FetchQueryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchQueryTests.swift; sourceTree = ""; }; - 9FA6ABC61EC0A9F7000017BE /* LoadQueryFromStoreTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadQueryFromStoreTests.swift; sourceTree = ""; }; - 9FA6ABC81EC0A9F7000017BE /* StarWarsServerCachingRoundtripTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarWarsServerCachingRoundtripTests.swift; sourceTree = ""; }; - 9FA6ABC91EC0A9F7000017BE /* StarWarsServerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarWarsServerTests.swift; sourceTree = ""; }; - 9FA6ABCB1EC0A9F7000017BE /* WatchQueryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatchQueryTests.swift; sourceTree = ""; }; - 9FA6F3671E65DF4700BF8D73 /* GraphQLResultAccumulator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLResultAccumulator.swift; sourceTree = ""; }; - 9FACA9C61F42E67200AE2DBD /* GitHubAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GitHubAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9FADC84E1E6B865E00C677E6 /* DataLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataLoader.swift; sourceTree = ""; }; - 9FADC8531E6B86D900C677E6 /* DataLoaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataLoaderTests.swift; sourceTree = ""; }; - 9FBE0D3F25407B64002ED0B1 /* AsyncResultObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncResultObserver.swift; sourceTree = ""; }; - 9FC2333C1E66BBF7001E4541 /* GraphQLDependencyTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLDependencyTracker.swift; sourceTree = ""; }; - 9FC4B91F1D2A6F8D0046A641 /* JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSON.swift; sourceTree = ""; }; - 9FC750441D2A532C00458D91 /* Apollo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Apollo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9FC750471D2A532C00458D91 /* Apollo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Apollo.h; sourceTree = ""; }; - 9FC750491D2A532C00458D91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9FC7504E1D2A532D00458D91 /* ApolloTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApolloTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 9FC750551D2A532D00458D91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9FC750601D2A59C300458D91 /* GraphQLOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLOperation.swift; sourceTree = ""; }; - 9FC750621D2A59F600458D91 /* ApolloClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApolloClient.swift; sourceTree = ""; }; - 9FC9A9BC1E2C271C0023C4D5 /* RecordSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordSet.swift; sourceTree = ""; }; - 9FC9A9BE1E2C27FB0023C4D5 /* GraphQLResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLResult.swift; sourceTree = ""; }; - 9FC9A9C11E2D3CAF0023C4D5 /* InputValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputValue.swift; sourceTree = ""; }; - 9FC9A9C71E2EFE6E0023C4D5 /* CacheKeyForFieldTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CacheKeyForFieldTests.swift; sourceTree = ""; }; - 9FC9A9CB1E2FD0760023C4D5 /* Record.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Record.swift; sourceTree = ""; }; - 9FC9A9D21E2FD48B0023C4D5 /* GraphQLError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLError.swift; sourceTree = ""; }; - 9FCDFD281E33D0CE007519DC /* GraphQLQueryWatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLQueryWatcher.swift; sourceTree = ""; }; - 9FCE2CED1E6BE2D800E34457 /* NormalizedCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NormalizedCache.swift; sourceTree = ""; }; - 9FCE2CFA1E6C213D00E34457 /* StarWarsAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = StarWarsAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9FD03C2D25527CE6002227DC /* StoreConcurrencyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreConcurrencyTests.swift; sourceTree = ""; }; - 9FD15199255D7F30003BDAAA /* IssuesAndCommentsForRepository.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = IssuesAndCommentsForRepository.json; sourceTree = ""; }; - 9FEB050C1DB5732300DA3B44 /* JSONSerializationFormat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONSerializationFormat.swift; sourceTree = ""; }; - 9FF90A5B1DDDEB100034C3B6 /* GraphQLResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLResponse.swift; sourceTree = ""; }; - 9FF90A5C1DDDEB100034C3B6 /* GraphQLExecutor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLExecutor.swift; sourceTree = ""; }; - 9FF90A6A1DDDEB420034C3B6 /* GraphQLMapEncodingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLMapEncodingTests.swift; sourceTree = ""; }; - 9FF90A6B1DDDEB420034C3B6 /* GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift; sourceTree = ""; }; - 9FF90A6C1DDDEB420034C3B6 /* ParseQueryResponseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParseQueryResponseTests.swift; sourceTree = ""; }; - B9C00759298308F900855D2B /* ApolloMath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloMath.swift; sourceTree = ""; }; - B9C0075D298312FD00855D2B /* GraphQLFirstReceivedAtTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLFirstReceivedAtTracker.swift; sourceTree = ""; }; - B9C0075F298AB95E00855D2B /* snapshot_0.sqlite3 */ = {isa = PBXFileReference; lastKnownFileType = file; path = snapshot_0.sqlite3; sourceTree = ""; }; - C3279FC52345233000224790 /* TestCustomRequestBodyCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestCustomRequestBodyCreator.swift; sourceTree = ""; }; - C338DF1622DD9DE9006AF33E /* RequestBodyCreatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestBodyCreatorTests.swift; sourceTree = ""; }; - C377CCA822D798BD00572E03 /* GraphQLFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLFile.swift; sourceTree = ""; }; - C377CCAA22D7992E00572E03 /* MultipartFormData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipartFormData.swift; sourceTree = ""; }; - D87AC09E2564D60B0079FAA5 /* ApolloClientOperationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloClientOperationTests.swift; sourceTree = ""; }; - D90F1AF92479DEE5007A1534 /* WebSocketTransportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSocketTransportTests.swift; sourceTree = ""; }; - DE01451128A442BF000F6F18 /* String+SwiftNameEscaping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+SwiftNameEscaping.swift"; sourceTree = ""; }; - DE01451328A5A156000F6F18 /* ValidationOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidationOptions.swift; sourceTree = ""; }; - DE01451528A5A971000F6F18 /* MockValidationOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockValidationOptions.swift; sourceTree = ""; }; - DE03FDDA2784D0B2007425BD /* DataDict.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataDict.swift; sourceTree = ""; }; - DE058621266978A100265760 /* ApolloAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DE0586222669793200265760 /* Apollo-Target-ApolloAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-ApolloAPI.xcconfig"; sourceTree = ""; }; - DE05862426697A8C00265760 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DE0586322669948500265760 /* InputValue+Evaluation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "InputValue+Evaluation.swift"; sourceTree = ""; }; - DE0586382669985000265760 /* Dictionary+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Dictionary+Helpers.swift"; sourceTree = ""; }; - DE071E792899FB7F0089BDAA /* GraphQLCompositeType+SchemaTypeNamespace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLCompositeType+SchemaTypeNamespace.swift"; sourceTree = ""; }; - DE09066E27A4713F00211300 /* OperationDefinitionTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationDefinitionTemplateTests.swift; sourceTree = ""; }; - DE09114D27288B1F000648E5 /* SortedSelections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortedSelections.swift; sourceTree = ""; }; - DE09F9BC27024FEA00795949 /* InputObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputObject.swift; sourceTree = ""; }; - DE09F9C0270269E800795949 /* MockJavaScriptObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockJavaScriptObject.swift; sourceTree = ""; }; - DE09F9C5270269F800795949 /* OperationDefinitionTemplate_DocumentType_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationDefinitionTemplate_DocumentType_Tests.swift; sourceTree = ""; }; - DE0D38EF282ECA6D00AFCC84 /* MockObjectFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockObjectFileGenerator.swift; sourceTree = ""; }; - DE0D38F1282ECF9700AFCC84 /* MockObjectFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockObjectFileGeneratorTests.swift; sourceTree = ""; }; - DE100B17287F3FB100BE11C2 /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = ""; }; - DE100B1928872D0F00BE11C2 /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = ""; }; - DE100B1B28872F4200BE11C2 /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = ""; }; - DE100B1D28873A2500BE11C2 /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = ""; }; - DE100B1F2887415D00BE11C2 /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = ""; }; - DE12B2D6273B204B003371CC /* TestError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestError.swift; sourceTree = ""; }; - DE12B2D8273C4338003371CC /* MockIRSubscripts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockIRSubscripts.swift; sourceTree = ""; }; - DE1540DB2A3A76F700A5A8B6 /* IRInputObjectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRInputObjectTests.swift; sourceTree = ""; }; - DE1696D3298C51CF00345E1A /* SelectionSetTemplate_Initializers_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetTemplate_Initializers_Tests.swift; sourceTree = ""; }; - DE181A2B26C5C0CB000C0B9C /* WebSocket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSocket.swift; sourceTree = ""; }; - DE181A2D26C5C299000C0B9C /* SSLClientCertificate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSLClientCertificate.swift; sourceTree = ""; }; - DE181A2F26C5C38E000C0B9C /* SSLSecurity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSLSecurity.swift; sourceTree = ""; }; - DE181A3126C5C401000C0B9C /* Compression.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Compression.swift; sourceTree = ""; }; - DE181A3326C5D8D4000C0B9C /* CompressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompressionTests.swift; sourceTree = ""; }; - DE181A3526C5DE4F000C0B9C /* WebSocketStream.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSocketStream.swift; sourceTree = ""; }; - DE1C6EFF284161DE0050164B /* AnyHashableConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyHashableConvertible.swift; sourceTree = ""; }; - DE223C1B271F3288004A0148 /* AnimalKingdomIRCreationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalKingdomIRCreationTests.swift; sourceTree = ""; }; - DE223C23271F335D004A0148 /* Resources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Resources.swift; sourceTree = ""; }; - DE223C2A2721FAD6004A0148 /* IRMatchers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRMatchers.swift; sourceTree = ""; }; - DE223C2C2721FCE8004A0148 /* ScopedSelectionSetHashable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScopedSelectionSetHashable.swift; sourceTree = ""; }; - DE2739102769AEBA00B886EF /* SelectionSetTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetTemplate.swift; sourceTree = ""; }; - DE296536279B3B8200BF9B49 /* SelectionSetTemplateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectionSetTemplateTests.swift; sourceTree = ""; }; - DE296BA427A07C37004F571F /* MockMergedSelections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockMergedSelections.swift; sourceTree = ""; }; - DE296BA627A09A11004F571F /* IsEverTrue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IsEverTrue.swift; sourceTree = ""; }; - DE299E912A0D6FD6000F71D2 /* ObjectData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectData.swift; sourceTree = ""; }; - DE299E952A0D7916000F71D2 /* SelectionField_CacheKeyForFieldTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionField_CacheKeyForFieldTests.swift; sourceTree = ""; }; - DE2A20E729032E1F008ADE48 /* VersionChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionChecker.swift; sourceTree = ""; }; - DE2A20EA29033147008ADE48 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - DE2A20EB29033147008ADE48 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; - DE2A20EC29033ABE008ADE48 /* VersionCheckerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = VersionCheckerTests.swift; path = Tests/CodegenCLITests/VersionCheckerTests.swift; sourceTree = SOURCE_ROOT; }; - DE2FCF1C26E806710057EA67 /* SchemaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaConfiguration.swift; sourceTree = ""; }; - DE2FCF2326E8083A0057EA67 /* Union.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Union.swift; sourceTree = ""; }; - DE2FCF2426E8083A0057EA67 /* Interface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Interface.swift; sourceTree = ""; }; - DE2FCF2526E8083A0057EA67 /* Object.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Object.swift; sourceTree = ""; }; - DE2FCF2626E8083A0057EA67 /* Field.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Field.swift; sourceTree = ""; }; - DE2FCF4826E94D150057EA67 /* TestMockTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestMockTests.swift; sourceTree = ""; }; - DE3484612746FF8F0065B77E /* IR+OperationBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+OperationBuilder.swift"; sourceTree = ""; }; - DE363CB227640FBA001EC05B /* GraphQLJSFrontend+TestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLJSFrontend+TestHelpers.swift"; sourceTree = ""; }; - DE3C79AA260A6ACD00D2F4FF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DE3C7A11260A6B9800D2F4FF /* AnimalKingdomAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AnimalKingdomAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DE3C7B10260A6FC900D2F4FF /* SelectionSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectionSet.swift; sourceTree = ""; }; - DE3C7B12260A6FC900D2F4FF /* FragmentProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FragmentProtocols.swift; sourceTree = ""; }; - DE3C7B14260A6FCA00D2F4FF /* GraphQLEnum.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLEnum.swift; sourceTree = ""; }; - DE3C7B15260A6FCA00D2F4FF /* ScalarTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScalarTypes.swift; sourceTree = ""; }; - DE3DAAA828F761CF003FB074 /* Apollo-Codegen-CITestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Apollo-Codegen-CITestPlan.xctestplan"; sourceTree = ""; }; - DE454BA628B40D52009DC80E /* SchemaConfigurationFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaConfigurationFileGeneratorTests.swift; sourceTree = ""; }; - DE454BA828B40DA8009DC80E /* SchemaConfigurationFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaConfigurationFileGenerator.swift; sourceTree = ""; }; - DE454BAA28B40E56009DC80E /* SchemaConfigurationTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaConfigurationTemplate.swift; sourceTree = ""; }; - DE454BB428B43058009DC80E /* SchemaConfigurationTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaConfigurationTemplateTests.swift; sourceTree = ""; }; - DE46A54D26EFE95800357C52 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - DE46A55426F13A0900357C52 /* JSONResponseParsingInterceptorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONResponseParsingInterceptorTests.swift; sourceTree = ""; }; - DE46A55726F13AD000357C52 /* ResponseCodeInterceptorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResponseCodeInterceptorTests.swift; sourceTree = ""; }; - DE4766E726F92F30004622E0 /* MockSchemaMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockSchemaMetadata.swift; sourceTree = ""; }; - DE4841A82745BBF10001E594 /* LinkedList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedList.swift; sourceTree = ""; }; - DE4B1E532889EF330058D1F6 /* EnumType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumType.swift; sourceTree = ""; }; - DE4D54E627A3504B00D26B68 /* OperationFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationFileGenerator.swift; sourceTree = ""; }; - DE4D54E827A3518100D26B68 /* FragmentFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FragmentFileGenerator.swift; sourceTree = ""; }; - DE5144B02A04703F00D991E9 /* NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift; sourceTree = ""; }; - DE56DC222683B2020090D6E4 /* DefaultInterceptorProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultInterceptorProvider.swift; sourceTree = ""; }; - DE5B313F27A482C80051C9D3 /* Resources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Resources.swift; sourceTree = ""; }; - DE5E79BA289DA90600CD0DE5 /* MockInterfacesFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockInterfacesFileGeneratorTests.swift; sourceTree = ""; }; - DE5E79BC289DA97E00CD0DE5 /* MockInterfacesTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockInterfacesTemplateTests.swift; sourceTree = ""; }; - DE5E79BE289DBCE700CD0DE5 /* CacheKeyInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheKeyInfo.swift; sourceTree = ""; }; - DE5EB9BF26EFCB010004176A /* TestObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestObserver.swift; sourceTree = ""; }; - DE5EB9C126EFCBD40004176A /* MockApolloStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockApolloStore.swift; sourceTree = ""; }; - DE5EB9C626EFE0F80004176A /* JSONValueMatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONValueMatcher.swift; sourceTree = ""; }; - DE5EB9CA26EFE5510004176A /* MockOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockOperation.swift; sourceTree = ""; }; - DE5EEC8427988F1A00AF5913 /* IR+SelectionSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+SelectionSet.swift"; sourceTree = ""; }; - DE5FD5FC2769222D0033EE23 /* OperationDefinitionTemplate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationDefinitionTemplate.swift; sourceTree = ""; }; - DE5FD5FE276922AA0033EE23 /* MockApolloCodegenConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockApolloCodegenConfiguration.swift; sourceTree = ""; }; - DE5FD600276923620033EE23 /* TemplateString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplateString.swift; sourceTree = ""; }; - DE5FD602276926EF0033EE23 /* IR+Mocking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+Mocking.swift"; sourceTree = ""; }; - DE5FD60427694FA70033EE23 /* SchemaMetadataTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaMetadataTemplate.swift; sourceTree = ""; }; - DE5FD606276950CC0033EE23 /* IR+Schema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+Schema.swift"; sourceTree = ""; }; - DE5FD608276956C70033EE23 /* SchemaMetadataTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaMetadataTemplateTests.swift; sourceTree = ""; }; - DE5FD60A276970FC0033EE23 /* FragmentTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FragmentTemplate.swift; sourceTree = ""; }; - DE5FD60C2769711E0033EE23 /* FragmentTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FragmentTemplateTests.swift; sourceTree = ""; }; - DE6388DE28CBF38E00559697 /* GraphQLEnumValue+Rendered.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLEnumValue+Rendered.swift"; sourceTree = ""; }; - DE6388E228D3BFBA00559697 /* PetDetails.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetDetails.graphql.swift; sourceTree = ""; }; - DE6388E328D3BFBA00559697 /* HeightInMeters.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightInMeters.graphql.swift; sourceTree = ""; }; - DE6388E428D3BFBA00559697 /* ClassroomPetDetails.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPetDetails.graphql.swift; sourceTree = ""; }; - DE6388E528D3BFBA00559697 /* DogFragment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DogFragment.graphql.swift; sourceTree = ""; }; - DE6388E628D3BFBA00559697 /* ClassroomPetDetailsCCN.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPetDetailsCCN.graphql.swift; sourceTree = ""; }; - DE6388E728D3BFBA00559697 /* WarmBloodedDetails.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WarmBloodedDetails.graphql.swift; sourceTree = ""; }; - DE6388E928D3BFBA00559697 /* PetDetailsMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetDetailsMutation.graphql.swift; sourceTree = ""; }; - DE6388EA28D3BFBA00559697 /* AllAnimalsLocalCacheMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllAnimalsLocalCacheMutation.graphql.swift; sourceTree = ""; }; - DE6388ED28D3BFBA00559697 /* PetAdoptionMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetAdoptionMutation.graphql.swift; sourceTree = ""; }; - DE6388EF28D3BFBA00559697 /* DogQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DogQuery.graphql.swift; sourceTree = ""; }; - DE6388F028D3BFBA00559697 /* AllAnimalsCCNQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllAnimalsCCNQuery.graphql.swift; sourceTree = ""; }; - DE6388F128D3BFBA00559697 /* ClassroomPetsQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPetsQuery.graphql.swift; sourceTree = ""; }; - DE6388F228D3BFBA00559697 /* ClassroomPetsCCNQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPetsCCNQuery.graphql.swift; sourceTree = ""; }; - DE6388F328D3BFBA00559697 /* AllAnimalsQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllAnimalsQuery.graphql.swift; sourceTree = ""; }; - DE6388F428D3BFBA00559697 /* AllAnimalsIncludeSkipQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllAnimalsIncludeSkipQuery.graphql.swift; sourceTree = ""; }; - DE6388F528D3BFBA00559697 /* PetSearchQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetSearchQuery.graphql.swift; sourceTree = ""; }; - DE6388F828D3BFBA00559697 /* ClassroomPet.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassroomPet.graphql.swift; sourceTree = ""; }; - DE6388FA28D3BFBA00559697 /* CustomDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDate.swift; sourceTree = ""; }; - DE6388FC28D3BFBA00559697 /* SkinCovering.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkinCovering.graphql.swift; sourceTree = ""; }; - DE6388FD28D3BFBA00559697 /* RelativeSize.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelativeSize.graphql.swift; sourceTree = ""; }; - DE6388FF28D3BFBA00559697 /* Rat.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Rat.graphql.swift; sourceTree = ""; }; - DE63890028D3BFBA00559697 /* Bird.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bird.graphql.swift; sourceTree = ""; }; - DE63890128D3BFBA00559697 /* PetRock.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetRock.graphql.swift; sourceTree = ""; }; - DE63890228D3BFBA00559697 /* Dog.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dog.graphql.swift; sourceTree = ""; }; - DE63890328D3BFBA00559697 /* Height.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Height.graphql.swift; sourceTree = ""; }; - DE63890428D3BFBA00559697 /* Mutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mutation.graphql.swift; sourceTree = ""; }; - DE63890528D3BFBA00559697 /* Query.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.graphql.swift; sourceTree = ""; }; - DE63890628D3BFBA00559697 /* Cat.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cat.graphql.swift; sourceTree = ""; }; - DE63890728D3BFBA00559697 /* Fish.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fish.graphql.swift; sourceTree = ""; }; - DE63890828D3BFBA00559697 /* Human.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Human.graphql.swift; sourceTree = ""; }; - DE63890928D3BFBA00559697 /* Crocodile.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Crocodile.graphql.swift; sourceTree = ""; }; - DE63890A28D3BFBA00559697 /* SchemaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaConfiguration.swift; sourceTree = ""; }; - DE63890C28D3BFBA00559697 /* PetAdoptionInput.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetAdoptionInput.graphql.swift; sourceTree = ""; }; - DE63890D28D3BFBA00559697 /* PetSearchFilters.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetSearchFilters.graphql.swift; sourceTree = ""; }; - DE63890E28D3BFBA00559697 /* MeasurementsInput.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeasurementsInput.graphql.swift; sourceTree = ""; }; - DE63890F28D3BFBA00559697 /* SchemaMetadata.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaMetadata.graphql.swift; sourceTree = ""; }; - DE63891128D3BFBA00559697 /* HousePet.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HousePet.graphql.swift; sourceTree = ""; }; - DE63891228D3BFBA00559697 /* Pet.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pet.graphql.swift; sourceTree = ""; }; - DE63891328D3BFBA00559697 /* Animal.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animal.graphql.swift; sourceTree = ""; }; - DE63891428D3BFBA00559697 /* WarmBlooded.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WarmBlooded.graphql.swift; sourceTree = ""; }; - DE63894028D3D60600559697 /* IncrementingSubscription.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IncrementingSubscription.graphql.swift; sourceTree = ""; }; - DE63894328D3D60600559697 /* Subscription.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Subscription.graphql.swift; sourceTree = ""; }; - DE63894428D3D60600559697 /* SchemaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaConfiguration.swift; sourceTree = ""; }; - DE63894528D3D60600559697 /* SchemaMetadata.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaMetadata.graphql.swift; sourceTree = ""; }; - DE63894C28D3D62400559697 /* UploadMultipleFilesToTheSameParameterMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadMultipleFilesToTheSameParameterMutation.graphql.swift; sourceTree = ""; }; - DE63894D28D3D62400559697 /* UploadOneFileMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadOneFileMutation.graphql.swift; sourceTree = ""; }; - DE63894E28D3D62400559697 /* UploadMultipleFilesToDifferentParametersMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadMultipleFilesToDifferentParametersMutation.graphql.swift; sourceTree = ""; }; - DE63895128D3D62400559697 /* Upload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Upload.swift; sourceTree = ""; }; - DE63895328D3D62400559697 /* File.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.graphql.swift; sourceTree = ""; }; - DE63895428D3D62400559697 /* Mutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mutation.graphql.swift; sourceTree = ""; }; - DE63895528D3D62400559697 /* SchemaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaConfiguration.swift; sourceTree = ""; }; - DE63895628D3D62400559697 /* SchemaMetadata.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaMetadata.graphql.swift; sourceTree = ""; }; - DE63896128D3D63700559697 /* DroidNameAndPrimaryFunction.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DroidNameAndPrimaryFunction.graphql.swift; sourceTree = ""; }; - DE63896228D3D63700559697 /* HeroDetails.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroDetails.graphql.swift; sourceTree = ""; }; - DE63896328D3D63700559697 /* DroidPrimaryFunction.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DroidPrimaryFunction.graphql.swift; sourceTree = ""; }; - DE63896428D3D63700559697 /* FriendsNames.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FriendsNames.graphql.swift; sourceTree = ""; }; - DE63896528D3D63700559697 /* CharacterName.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterName.graphql.swift; sourceTree = ""; }; - DE63896628D3D63700559697 /* CharacterNameAndAppearsIn.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterNameAndAppearsIn.graphql.swift; sourceTree = ""; }; - DE63896728D3D63700559697 /* DroidName.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DroidName.graphql.swift; sourceTree = ""; }; - DE63896828D3D63700559697 /* CharacterNameAndDroidAppearsIn.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterNameAndDroidAppearsIn.graphql.swift; sourceTree = ""; }; - DE63896928D3D63700559697 /* HumanHeightWithVariable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HumanHeightWithVariable.graphql.swift; sourceTree = ""; }; - DE63896A28D3D63700559697 /* CharacterNameWithInlineFragment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterNameWithInlineFragment.graphql.swift; sourceTree = ""; }; - DE63896B28D3D63700559697 /* CharacterNameAndAppearsInWithNestedFragments.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterNameAndAppearsInWithNestedFragments.graphql.swift; sourceTree = ""; }; - DE63896C28D3D63700559697 /* DroidDetails.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DroidDetails.graphql.swift; sourceTree = ""; }; - DE63896D28D3D63700559697 /* CharacterNameWithNestedAppearsInFragment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterNameWithNestedAppearsInFragment.graphql.swift; sourceTree = ""; }; - DE63896E28D3D63700559697 /* CharacterNameAndDroidPrimaryFunction.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterNameAndDroidPrimaryFunction.graphql.swift; sourceTree = ""; }; - DE63896F28D3D63700559697 /* CharacterAppearsIn.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterAppearsIn.graphql.swift; sourceTree = ""; }; - DE63897228D3D63700559697 /* CreateAwesomeReviewMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateAwesomeReviewMutation.graphql.swift; sourceTree = ""; }; - DE63897328D3D63700559697 /* CreateReviewForEpisodeMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateReviewForEpisodeMutation.graphql.swift; sourceTree = ""; }; - DE63897428D3D63700559697 /* CreateReviewWithNullFieldMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateReviewWithNullFieldMutation.graphql.swift; sourceTree = ""; }; - DE63897628D3D63700559697 /* HeroDetailsQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroDetailsQuery.graphql.swift; sourceTree = ""; }; - DE63897728D3D63700559697 /* HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift; sourceTree = ""; }; - DE63897828D3D63700559697 /* HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift; sourceTree = ""; }; - DE63897928D3D63700559697 /* SearchQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchQuery.graphql.swift; sourceTree = ""; }; - DE63897A28D3D63700559697 /* HeroNameWithIDQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameWithIDQuery.graphql.swift; sourceTree = ""; }; - DE63897B28D3D63700559697 /* HeroAndFriendsNamesWithFragmentQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAndFriendsNamesWithFragmentQuery.graphql.swift; sourceTree = ""; }; - DE63897C28D3D63700559697 /* HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift; sourceTree = ""; }; - DE63897D28D3D63700559697 /* HeroDetailsFragmentConditionalInclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroDetailsFragmentConditionalInclusionQuery.graphql.swift; sourceTree = ""; }; - DE63897E28D3D63700559697 /* HeroAppearsInQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAppearsInQuery.graphql.swift; sourceTree = ""; }; - DE63897F28D3D63700559697 /* HeroNameAndAppearsInWithFragmentQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameAndAppearsInWithFragmentQuery.graphql.swift; sourceTree = ""; }; - DE63898028D3D63700559697 /* DroidDetailsWithFragmentQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DroidDetailsWithFragmentQuery.graphql.swift; sourceTree = ""; }; - DE63898128D3D63700559697 /* HeroDetailsWithFragmentQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroDetailsWithFragmentQuery.graphql.swift; sourceTree = ""; }; - DE63898228D3D63700559697 /* HeroNameWithFragmentAndIDQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameWithFragmentAndIDQuery.graphql.swift; sourceTree = ""; }; - DE63898328D3D63700559697 /* HeroNameConditionalBothSeparateQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameConditionalBothSeparateQuery.graphql.swift; sourceTree = ""; }; - DE63898428D3D63700559697 /* StarshipCoordinatesQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarshipCoordinatesQuery.graphql.swift; sourceTree = ""; }; - DE63898528D3D63700559697 /* HeroNameConditionalBothQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameConditionalBothQuery.graphql.swift; sourceTree = ""; }; - DE63898628D3D63700559697 /* HeroAndFriendsNamesWithIDsQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAndFriendsNamesWithIDsQuery.graphql.swift; sourceTree = ""; }; - DE63898728D3D63700559697 /* HeroNameConditionalExclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameConditionalExclusionQuery.graphql.swift; sourceTree = ""; }; - DE63898828D3D63700559697 /* HeroNameAndAppearsInQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameAndAppearsInQuery.graphql.swift; sourceTree = ""; }; - DE63898928D3D63700559697 /* HeroFriendsDetailsConditionalInclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroFriendsDetailsConditionalInclusionQuery.graphql.swift; sourceTree = ""; }; - DE63898A28D3D63700559697 /* HeroDetailsInlineConditionalInclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroDetailsInlineConditionalInclusionQuery.graphql.swift; sourceTree = ""; }; - DE63898B28D3D63700559697 /* HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift; sourceTree = ""; }; - DE63898C28D3D63700559697 /* StarshipQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarshipQuery.graphql.swift; sourceTree = ""; }; - DE63898D28D3D63700559697 /* HumanQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HumanQuery.graphql.swift; sourceTree = ""; }; - DE63898E28D3D63700559697 /* HeroAndFriendsNamesQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAndFriendsNamesQuery.graphql.swift; sourceTree = ""; }; - DE63898F28D3D63700559697 /* HeroTypeDependentAliasedFieldQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroTypeDependentAliasedFieldQuery.graphql.swift; sourceTree = ""; }; - DE63899028D3D63700559697 /* HeroNameWithFragmentQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameWithFragmentQuery.graphql.swift; sourceTree = ""; }; - DE63899128D3D63800559697 /* HeroParentTypeDependentFieldQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroParentTypeDependentFieldQuery.graphql.swift; sourceTree = ""; }; - DE63899228D3D63800559697 /* TwoHeroesQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TwoHeroesQuery.graphql.swift; sourceTree = ""; }; - DE63899328D3D63800559697 /* HeroNameConditionalInclusionQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameConditionalInclusionQuery.graphql.swift; sourceTree = ""; }; - DE63899428D3D63800559697 /* HeroFriendsOfFriendsNamesQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroFriendsOfFriendsNamesQuery.graphql.swift; sourceTree = ""; }; - DE63899528D3D63800559697 /* HeroNameQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroNameQuery.graphql.swift; sourceTree = ""; }; - DE63899628D3D63800559697 /* SameHeroTwiceQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SameHeroTwiceQuery.graphql.swift; sourceTree = ""; }; - DE63899728D3D63800559697 /* HeroAndFriendsIDsQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAndFriendsIDsQuery.graphql.swift; sourceTree = ""; }; - DE63899828D3D63800559697 /* HeroAppearsInWithFragmentQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeroAppearsInWithFragmentQuery.graphql.swift; sourceTree = ""; }; - DE63899A28D3D63800559697 /* ReviewAddedSubscription.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewAddedSubscription.graphql.swift; sourceTree = ""; }; - DE63899D28D3D63800559697 /* SearchResult.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchResult.graphql.swift; sourceTree = ""; }; - DE63899F28D3D63800559697 /* Episode.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Episode.graphql.swift; sourceTree = ""; }; - DE6389A128D3D63800559697 /* Subscription.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Subscription.graphql.swift; sourceTree = ""; }; - DE6389A228D3D63800559697 /* Droid.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Droid.graphql.swift; sourceTree = ""; }; - DE6389A328D3D63800559697 /* Starship.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Starship.graphql.swift; sourceTree = ""; }; - DE6389A428D3D63800559697 /* Mutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mutation.graphql.swift; sourceTree = ""; }; - DE6389A528D3D63800559697 /* Review.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Review.graphql.swift; sourceTree = ""; }; - DE6389A628D3D63800559697 /* Query.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.graphql.swift; sourceTree = ""; }; - DE6389A728D3D63800559697 /* Human.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Human.graphql.swift; sourceTree = ""; }; - DE6389A828D3D63800559697 /* SchemaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaConfiguration.swift; sourceTree = ""; }; - DE6389AA28D3D63800559697 /* ColorInput.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorInput.graphql.swift; sourceTree = ""; }; - DE6389AB28D3D63800559697 /* ReviewInput.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewInput.graphql.swift; sourceTree = ""; }; - DE6389AC28D3D63800559697 /* SchemaMetadata.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaMetadata.graphql.swift; sourceTree = ""; }; - DE6389AE28D3D63800559697 /* Character.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Character.graphql.swift; sourceTree = ""; }; - DE6389F528D3D64400559697 /* AuthorDetails.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorDetails.graphql.swift; sourceTree = ""; }; - DE6389F828D3D64400559697 /* RepositoryQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryQuery.graphql.swift; sourceTree = ""; }; - DE6389F928D3D64400559697 /* IssuesAndCommentsForRepositoryQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssuesAndCommentsForRepositoryQuery.graphql.swift; sourceTree = ""; }; - DE6389FA28D3D64400559697 /* RepoURLQuery.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoURLQuery.graphql.swift; sourceTree = ""; }; - DE6389FD28D3D64400559697 /* IssueOrPullRequest.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueOrPullRequest.graphql.swift; sourceTree = ""; }; - DE6389FF28D3D64400559697 /* URI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URI.swift; sourceTree = ""; }; - DE638A0128D3D64400559697 /* MarketplaceListing.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarketplaceListing.graphql.swift; sourceTree = ""; }; - DE638A0228D3D64400559697 /* UnlockedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnlockedEvent.graphql.swift; sourceTree = ""; }; - DE638A0328D3D64400559697 /* MarkedAsDuplicateEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkedAsDuplicateEvent.graphql.swift; sourceTree = ""; }; - DE638A0428D3D64400559697 /* OrganizationInvitation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganizationInvitation.graphql.swift; sourceTree = ""; }; - DE638A0528D3D64400559697 /* Release.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Release.graphql.swift; sourceTree = ""; }; - DE638A0628D3D64400559697 /* OrgInviteToBusinessAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgInviteToBusinessAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A0728D3D64400559697 /* PullRequestReviewThread.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullRequestReviewThread.graphql.swift; sourceTree = ""; }; - DE638A0828D3D64400559697 /* RepoChangeMergeSettingAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoChangeMergeSettingAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A0928D3D64400559697 /* Sponsorship.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sponsorship.graphql.swift; sourceTree = ""; }; - DE638A0A28D3D64400559697 /* OrgAddMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgAddMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A0B28D3D64400559697 /* DependencyGraphManifest.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DependencyGraphManifest.graphql.swift; sourceTree = ""; }; - DE638A0C28D3D64400559697 /* OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A0D28D3D64400559697 /* OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638A0E28D3D64400559697 /* RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A0F28D3D64400559697 /* License.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = License.graphql.swift; sourceTree = ""; }; - DE638A1028D3D64400559697 /* ConnectedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectedEvent.graphql.swift; sourceTree = ""; }; - DE638A1128D3D64400559697 /* OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A1228D3D64400559697 /* OrgDisableTwoFactorRequirementAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgDisableTwoFactorRequirementAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A1328D3D64400559697 /* RepositoryTopic.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryTopic.graphql.swift; sourceTree = ""; }; - DE638A1428D3D64400559697 /* CommitComment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommitComment.graphql.swift; sourceTree = ""; }; - DE638A1528D3D64400559697 /* PackageTag.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PackageTag.graphql.swift; sourceTree = ""; }; - DE638A1628D3D64400559697 /* UnmarkedAsDuplicateEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnmarkedAsDuplicateEvent.graphql.swift; sourceTree = ""; }; - DE638A1728D3D64400559697 /* Repository.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.graphql.swift; sourceTree = ""; }; - DE638A1828D3D64400559697 /* GistComment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GistComment.graphql.swift; sourceTree = ""; }; - DE638A1928D3D64400559697 /* PackageFile.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PackageFile.graphql.swift; sourceTree = ""; }; - DE638A1A28D3D64400559697 /* OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A1B28D3D64400559697 /* RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A1C28D3D64400559697 /* OrgEnableTwoFactorRequirementAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgEnableTwoFactorRequirementAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A1D28D3D64400559697 /* StatusCheckRollup.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusCheckRollup.graphql.swift; sourceTree = ""; }; - DE638A1E28D3D64400559697 /* OrgRemoveMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRemoveMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A1F28D3D64400559697 /* PushAllowance.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushAllowance.graphql.swift; sourceTree = ""; }; - DE638A2028D3D64400559697 /* RepoRemoveTopicAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoRemoveTopicAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2128D3D64400559697 /* LockedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockedEvent.graphql.swift; sourceTree = ""; }; - DE638A2228D3D64400559697 /* OauthApplicationCreateAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OauthApplicationCreateAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2328D3D64400559697 /* MarketplaceCategory.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarketplaceCategory.graphql.swift; sourceTree = ""; }; - DE638A2428D3D64400559697 /* DeploymentStatus.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeploymentStatus.graphql.swift; sourceTree = ""; }; - DE638A2528D3D64400559697 /* RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2628D3D64400559697 /* Enterprise.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Enterprise.graphql.swift; sourceTree = ""; }; - DE638A2728D3D64400559697 /* TeamRemoveMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamRemoveMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2828D3D64400559697 /* OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2928D3D64400559697 /* OrgOauthAppAccessApprovedAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgOauthAppAccessApprovedAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2A28D3D64400559697 /* OrgInviteMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgInviteMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2B28D3D64400559697 /* TeamAddRepositoryAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamAddRepositoryAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2C28D3D64400559697 /* DisconnectedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisconnectedEvent.graphql.swift; sourceTree = ""; }; - DE638A2D28D3D64400559697 /* TeamDiscussionComment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamDiscussionComment.graphql.swift; sourceTree = ""; }; - DE638A2E28D3D64400559697 /* TeamRemoveRepositoryAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamRemoveRepositoryAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A2F28D3D64400559697 /* User.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.graphql.swift; sourceTree = ""; }; - DE638A3028D3D64400559697 /* MembersCanDeleteReposEnableAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MembersCanDeleteReposEnableAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3128D3D64400559697 /* SponsorsTier.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SponsorsTier.graphql.swift; sourceTree = ""; }; - DE638A3228D3D64400559697 /* PinnedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinnedEvent.graphql.swift; sourceTree = ""; }; - DE638A3328D3D64400559697 /* Status.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Status.graphql.swift; sourceTree = ""; }; - DE638A3428D3D64400559697 /* RepoAddTopicAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoAddTopicAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3528D3D64400559697 /* RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3628D3D64400559697 /* Commit.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Commit.graphql.swift; sourceTree = ""; }; - DE638A3728D3D64400559697 /* EnterpriseRepositoryInfo.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseRepositoryInfo.graphql.swift; sourceTree = ""; }; - DE638A3828D3D64400559697 /* SubscribedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscribedEvent.graphql.swift; sourceTree = ""; }; - DE638A3928D3D64400559697 /* DeployKey.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeployKey.graphql.swift; sourceTree = ""; }; - DE638A3A28D3D64400559697 /* OrgAddBillingManagerAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgAddBillingManagerAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3B28D3D64400559697 /* PrivateRepositoryForkingDisableAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateRepositoryForkingDisableAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3C28D3D64400559697 /* OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3D28D3D64400559697 /* OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3E28D3D64400559697 /* RepoAddMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoAddMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A3F28D3D64400559697 /* ReviewRequestRemovedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewRequestRemovedEvent.graphql.swift; sourceTree = ""; }; - DE638A4028D3D64400559697 /* ReopenedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReopenedEvent.graphql.swift; sourceTree = ""; }; - DE638A4128D3D64400559697 /* BranchProtectionRule.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BranchProtectionRule.graphql.swift; sourceTree = ""; }; - DE638A4228D3D64400559697 /* ConvertedNoteToIssueEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConvertedNoteToIssueEvent.graphql.swift; sourceTree = ""; }; - DE638A4328D3D64400559697 /* PullRequestCommitCommentThread.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullRequestCommitCommentThread.graphql.swift; sourceTree = ""; }; - DE638A4428D3D64400559697 /* RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A4528D3D64400559697 /* IssueCommentConnection.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueCommentConnection.graphql.swift; sourceTree = ""; }; - DE638A4628D3D64400559697 /* RepositoryVisibilityChangeDisableAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryVisibilityChangeDisableAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A4728D3D64400559697 /* CodeOfConduct.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeOfConduct.graphql.swift; sourceTree = ""; }; - DE638A4828D3D64400559697 /* UnpinnedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnpinnedEvent.graphql.swift; sourceTree = ""; }; - DE638A4928D3D64400559697 /* Mannequin.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mannequin.graphql.swift; sourceTree = ""; }; - DE638A4A28D3D64400559697 /* EnterpriseIdentityProvider.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseIdentityProvider.graphql.swift; sourceTree = ""; }; - DE638A4B28D3D64400559697 /* DeploymentEnvironmentChangedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeploymentEnvironmentChangedEvent.graphql.swift; sourceTree = ""; }; - DE638A4C28D3D64400559697 /* Push.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Push.graphql.swift; sourceTree = ""; }; - DE638A4D28D3D64400559697 /* PullRequest.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullRequest.graphql.swift; sourceTree = ""; }; - DE638A4E28D3D64400559697 /* ReferencedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReferencedEvent.graphql.swift; sourceTree = ""; }; - DE638A4F28D3D64400559697 /* RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A5028D3D64400559697 /* EnterpriseServerUserAccount.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseServerUserAccount.graphql.swift; sourceTree = ""; }; - DE638A5128D3D64400559697 /* OrgOauthAppAccessRequestedAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgOauthAppAccessRequestedAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A5228D3D64400559697 /* Project.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Project.graphql.swift; sourceTree = ""; }; - DE638A5328D3D64400559697 /* Ref.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Ref.graphql.swift; sourceTree = ""; }; - DE638A5428D3D64400559697 /* OrgRemoveBillingManagerAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRemoveBillingManagerAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A5528D3D64400559697 /* Organization.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Organization.graphql.swift; sourceTree = ""; }; - DE638A5628D3D64400559697 /* MergedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MergedEvent.graphql.swift; sourceTree = ""; }; - DE638A5728D3D64400559697 /* ReviewRequest.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewRequest.graphql.swift; sourceTree = ""; }; - DE638A5828D3D64400559697 /* Label.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Label.graphql.swift; sourceTree = ""; }; - DE638A5928D3D64400559697 /* HeadRefDeletedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadRefDeletedEvent.graphql.swift; sourceTree = ""; }; - DE638A5A28D3D64400559697 /* Milestone.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Milestone.graphql.swift; sourceTree = ""; }; - DE638A5B28D3D64400559697 /* DeployedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeployedEvent.graphql.swift; sourceTree = ""; }; - DE638A5C28D3D64400559697 /* EnterpriseUserAccount.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseUserAccount.graphql.swift; sourceTree = ""; }; - DE638A5D28D3D64400559697 /* RepoCreateAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoCreateAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A5E28D3D64400559697 /* CrossReferencedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossReferencedEvent.graphql.swift; sourceTree = ""; }; - DE638A5F28D3D64400559697 /* PinnedIssue.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinnedIssue.graphql.swift; sourceTree = ""; }; - DE638A6028D3D64400559697 /* RepoAccessAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoAccessAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A6128D3D64400559697 /* OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638A6228D3D64400559697 /* EnterpriseServerUserAccountsUpload.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseServerUserAccountsUpload.graphql.swift; sourceTree = ""; }; - DE638A6328D3D64400559697 /* OrgOauthAppAccessDeniedAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgOauthAppAccessDeniedAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A6428D3D64400559697 /* Query.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.graphql.swift; sourceTree = ""; }; - DE638A6528D3D64400559697 /* OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A6628D3D64400559697 /* RepoDestroyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoDestroyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A6728D3D64400559697 /* Reaction.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reaction.graphql.swift; sourceTree = ""; }; - DE638A6828D3D64400559697 /* EnterpriseAdministratorInvitation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseAdministratorInvitation.graphql.swift; sourceTree = ""; }; - DE638A6928D3D64400559697 /* RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A6A28D3D64400559697 /* ExternalIdentity.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExternalIdentity.graphql.swift; sourceTree = ""; }; - DE638A6B28D3D64400559697 /* Language.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Language.graphql.swift; sourceTree = ""; }; - DE638A6C28D3D64400559697 /* Team.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Team.graphql.swift; sourceTree = ""; }; - DE638A6D28D3D64400559697 /* PackageVersion.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PackageVersion.graphql.swift; sourceTree = ""; }; - DE638A6E28D3D64400559697 /* CommentDeletedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentDeletedEvent.graphql.swift; sourceTree = ""; }; - DE638A6F28D3D64400559697 /* TeamDiscussion.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamDiscussion.graphql.swift; sourceTree = ""; }; - DE638A7028D3D64400559697 /* MembersCanDeleteReposClearAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MembersCanDeleteReposClearAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A7128D3D64400559697 /* RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A7228D3D64400559697 /* ClosedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosedEvent.graphql.swift; sourceTree = ""; }; - DE638A7328D3D64400559697 /* MembersCanDeleteReposDisableAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MembersCanDeleteReposDisableAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A7428D3D64400559697 /* PullRequestCommit.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullRequestCommit.graphql.swift; sourceTree = ""; }; - DE638A7528D3D64400559697 /* UserBlockedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserBlockedEvent.graphql.swift; sourceTree = ""; }; - DE638A7628D3D64400559697 /* Topic.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Topic.graphql.swift; sourceTree = ""; }; - DE638A7728D3D64400559697 /* CheckSuite.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckSuite.graphql.swift; sourceTree = ""; }; - DE638A7828D3D64400559697 /* UnsubscribedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnsubscribedEvent.graphql.swift; sourceTree = ""; }; - DE638A7928D3D64400559697 /* Tag.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tag.graphql.swift; sourceTree = ""; }; - DE638A7A28D3D64400559697 /* Gist.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Gist.graphql.swift; sourceTree = ""; }; - DE638A7B28D3D64400559697 /* Package.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.graphql.swift; sourceTree = ""; }; - DE638A7C28D3D64400559697 /* PullRequestReview.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullRequestReview.graphql.swift; sourceTree = ""; }; - DE638A7D28D3D64400559697 /* PrivateRepositoryForkingEnableAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateRepositoryForkingEnableAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A7E28D3D64400559697 /* OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A7F28D3D64400559697 /* ConvertToDraftEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConvertToDraftEvent.graphql.swift; sourceTree = ""; }; - DE638A8028D3D64400559697 /* RepoRemoveMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoRemoveMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A8128D3D64400559697 /* TeamAddMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamAddMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A8228D3D64400559697 /* Tree.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tree.graphql.swift; sourceTree = ""; }; - DE638A8328D3D64400559697 /* RenamedTitleEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RenamedTitleEvent.graphql.swift; sourceTree = ""; }; - DE638A8428D3D64400559697 /* OrgUnblockUserAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgUnblockUserAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A8528D3D64400559697 /* OrgCreateAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgCreateAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A8628D3D64400559697 /* ProjectCard.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectCard.graphql.swift; sourceTree = ""; }; - DE638A8728D3D64400559697 /* SavedReply.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SavedReply.graphql.swift; sourceTree = ""; }; - DE638A8828D3D64400559697 /* OrgBlockUserAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgBlockUserAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A8928D3D64400559697 /* BaseRefChangedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseRefChangedEvent.graphql.swift; sourceTree = ""; }; - DE638A8A28D3D64400559697 /* RemovedFromProjectEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemovedFromProjectEvent.graphql.swift; sourceTree = ""; }; - DE638A8B28D3D64400559697 /* Issue.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Issue.graphql.swift; sourceTree = ""; }; - DE638A8C28D3D64400559697 /* SecurityAdvisory.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecurityAdvisory.graphql.swift; sourceTree = ""; }; - DE638A8D28D3D64400559697 /* OrgRestoreMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRestoreMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A8E28D3D64400559697 /* HeadRefForcePushedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadRefForcePushedEvent.graphql.swift; sourceTree = ""; }; - DE638A8F28D3D64400559697 /* OrgUpdateMemberAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgUpdateMemberAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A9028D3D64400559697 /* LabeledEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabeledEvent.graphql.swift; sourceTree = ""; }; - DE638A9128D3D64400559697 /* SponsorsListing.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SponsorsListing.graphql.swift; sourceTree = ""; }; - DE638A9228D3D64400559697 /* App.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = App.graphql.swift; sourceTree = ""; }; - DE638A9328D3D64400559697 /* StatusContext.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusContext.graphql.swift; sourceTree = ""; }; - DE638A9428D3D64400559697 /* ReviewRequestedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewRequestedEvent.graphql.swift; sourceTree = ""; }; - DE638A9528D3D64400559697 /* DemilestonedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemilestonedEvent.graphql.swift; sourceTree = ""; }; - DE638A9628D3D64400559697 /* IssueConnection.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueConnection.graphql.swift; sourceTree = ""; }; - DE638A9728D3D64400559697 /* UserContentEdit.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserContentEdit.graphql.swift; sourceTree = ""; }; - DE638A9828D3D64400559697 /* MovedColumnsInProjectEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MovedColumnsInProjectEvent.graphql.swift; sourceTree = ""; }; - DE638A9928D3D64400559697 /* MilestonedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MilestonedEvent.graphql.swift; sourceTree = ""; }; - DE638A9A28D3D64400559697 /* TeamChangeParentTeamAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamChangeParentTeamAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A9B28D3D64400559697 /* UnassignedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnassignedEvent.graphql.swift; sourceTree = ""; }; - DE638A9C28D3D64400559697 /* Bot.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bot.graphql.swift; sourceTree = ""; }; - DE638A9D28D3D64400559697 /* AddedToProjectEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddedToProjectEvent.graphql.swift; sourceTree = ""; }; - DE638A9E28D3D64400559697 /* RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift; sourceTree = ""; }; - DE638A9F28D3D64400559697 /* BaseRefForcePushedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseRefForcePushedEvent.graphql.swift; sourceTree = ""; }; - DE638AA028D3D64400559697 /* RepositoryInvitation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryInvitation.graphql.swift; sourceTree = ""; }; - DE638AA128D3D64400559697 /* TransferredEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferredEvent.graphql.swift; sourceTree = ""; }; - DE638AA228D3D64400559697 /* CheckRun.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckRun.graphql.swift; sourceTree = ""; }; - DE638AA328D3D64400559697 /* HeadRefRestoredEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadRefRestoredEvent.graphql.swift; sourceTree = ""; }; - DE638AA428D3D64400559697 /* RepoArchivedAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoArchivedAuditEntry.graphql.swift; sourceTree = ""; }; - DE638AA528D3D64400559697 /* IpAllowListEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IpAllowListEntry.graphql.swift; sourceTree = ""; }; - DE638AA628D3D64400559697 /* EnterpriseServerInstallation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseServerInstallation.graphql.swift; sourceTree = ""; }; - DE638AA728D3D64400559697 /* ReviewDismissedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewDismissedEvent.graphql.swift; sourceTree = ""; }; - DE638AA828D3D64400559697 /* CommitCommentThread.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommitCommentThread.graphql.swift; sourceTree = ""; }; - DE638AA928D3D64400559697 /* IssueComment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueComment.graphql.swift; sourceTree = ""; }; - DE638AAA28D3D64400559697 /* UnlabeledEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnlabeledEvent.graphql.swift; sourceTree = ""; }; - DE638AAB28D3D64400559697 /* ReviewDismissalAllowance.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewDismissalAllowance.graphql.swift; sourceTree = ""; }; - DE638AAC28D3D64400559697 /* AssignedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssignedEvent.graphql.swift; sourceTree = ""; }; - DE638AAD28D3D64400559697 /* PullRequestReviewComment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullRequestReviewComment.graphql.swift; sourceTree = ""; }; - DE638AAE28D3D64400559697 /* RepositoryVisibilityChangeEnableAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryVisibilityChangeEnableAuditEntry.graphql.swift; sourceTree = ""; }; - DE638AAF28D3D64400559697 /* OrganizationIdentityProvider.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganizationIdentityProvider.graphql.swift; sourceTree = ""; }; - DE638AB028D3D64400559697 /* MentionedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MentionedEvent.graphql.swift; sourceTree = ""; }; - DE638AB128D3D64400559697 /* ReleaseAsset.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReleaseAsset.graphql.swift; sourceTree = ""; }; - DE638AB228D3D64400559697 /* OrgEnableSamlAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgEnableSamlAuditEntry.graphql.swift; sourceTree = ""; }; - DE638AB328D3D64400559697 /* UserStatus.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserStatus.graphql.swift; sourceTree = ""; }; - DE638AB428D3D64400559697 /* OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638AB528D3D64400559697 /* OrgDisableSamlAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrgDisableSamlAuditEntry.graphql.swift; sourceTree = ""; }; - DE638AB628D3D64400559697 /* Blob.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Blob.graphql.swift; sourceTree = ""; }; - DE638AB728D3D64400559697 /* AutomaticBaseChangeFailedEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutomaticBaseChangeFailedEvent.graphql.swift; sourceTree = ""; }; - DE638AB828D3D64400559697 /* Deployment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deployment.graphql.swift; sourceTree = ""; }; - DE638AB928D3D64400559697 /* PublicKey.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublicKey.graphql.swift; sourceTree = ""; }; - DE638ABA28D3D64400559697 /* ReadyForReviewEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadyForReviewEvent.graphql.swift; sourceTree = ""; }; - DE638ABB28D3D64400559697 /* ProjectColumn.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectColumn.graphql.swift; sourceTree = ""; }; - DE638ABC28D3D64400559697 /* EnterpriseServerUserAccountEmail.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseServerUserAccountEmail.graphql.swift; sourceTree = ""; }; - DE638ABD28D3D64400559697 /* AutomaticBaseChangeSucceededEvent.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutomaticBaseChangeSucceededEvent.graphql.swift; sourceTree = ""; }; - DE638ABE28D3D64400559697 /* RepositoryVulnerabilityAlert.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryVulnerabilityAlert.graphql.swift; sourceTree = ""; }; - DE638ABF28D3D64400559697 /* RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift; sourceTree = ""; }; - DE638AC028D3D64400559697 /* SchemaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaConfiguration.swift; sourceTree = ""; }; - DE638AC128D3D64400559697 /* SchemaMetadata.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaMetadata.graphql.swift; sourceTree = ""; }; - DE638AC328D3D64400559697 /* Starrable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Starrable.graphql.swift; sourceTree = ""; }; - DE638AC428D3D64400559697 /* TeamAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638AC528D3D64400559697 /* Labelable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Labelable.graphql.swift; sourceTree = ""; }; - DE638AC628D3D64400559697 /* OrganizationAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganizationAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638AC728D3D64400559697 /* RepositoryNode.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryNode.graphql.swift; sourceTree = ""; }; - DE638AC828D3D64400559697 /* UpdatableComment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdatableComment.graphql.swift; sourceTree = ""; }; - DE638AC928D3D64400559697 /* Comment.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Comment.graphql.swift; sourceTree = ""; }; - DE638ACA28D3D64400559697 /* Sponsorable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sponsorable.graphql.swift; sourceTree = ""; }; - DE638ACB28D3D64400559697 /* RepositoryOwner.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryOwner.graphql.swift; sourceTree = ""; }; - DE638ACC28D3D64400559697 /* GitObject.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitObject.graphql.swift; sourceTree = ""; }; - DE638ACD28D3D64400559697 /* ProjectOwner.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectOwner.graphql.swift; sourceTree = ""; }; - DE638ACE28D3D64400559697 /* MemberStatusable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MemberStatusable.graphql.swift; sourceTree = ""; }; - DE638ACF28D3D64400559697 /* UniformResourceLocatable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UniformResourceLocatable.graphql.swift; sourceTree = ""; }; - DE638AD028D3D64400559697 /* Deletable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deletable.graphql.swift; sourceTree = ""; }; - DE638AD128D3D64400559697 /* PackageOwner.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PackageOwner.graphql.swift; sourceTree = ""; }; - DE638AD228D3D64400559697 /* AuditEntry.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuditEntry.graphql.swift; sourceTree = ""; }; - DE638AD328D3D64400559697 /* Closable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Closable.graphql.swift; sourceTree = ""; }; - DE638AD428D3D64400559697 /* Actor.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Actor.graphql.swift; sourceTree = ""; }; - DE638AD528D3D64400559697 /* Minimizable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Minimizable.graphql.swift; sourceTree = ""; }; - DE638AD628D3D64400559697 /* Assignable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Assignable.graphql.swift; sourceTree = ""; }; - DE638AD728D3D64400559697 /* TopicAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopicAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638AD828D3D64400559697 /* RepositoryInfo.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryInfo.graphql.swift; sourceTree = ""; }; - DE638AD928D3D64400559697 /* Reactable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reactable.graphql.swift; sourceTree = ""; }; - DE638ADA28D3D64400559697 /* OauthApplicationAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OauthApplicationAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638ADB28D3D64400559697 /* Updatable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Updatable.graphql.swift; sourceTree = ""; }; - DE638ADC28D3D64400559697 /* Subscribable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Subscribable.graphql.swift; sourceTree = ""; }; - DE638ADD28D3D64400559697 /* EnterpriseAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterpriseAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638ADE28D3D64400559697 /* Node.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Node.graphql.swift; sourceTree = ""; }; - DE638ADF28D3D64400559697 /* RepositoryAuditEntryData.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryAuditEntryData.graphql.swift; sourceTree = ""; }; - DE638AE028D3D64400559697 /* Lockable.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lockable.graphql.swift; sourceTree = ""; }; - DE638AE128D3D64400559697 /* ProfileOwner.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileOwner.graphql.swift; sourceTree = ""; }; - DE64C1F6284033BA00F64B9D /* LocalCacheMutation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalCacheMutation.swift; sourceTree = ""; }; - DE664ED326602AF60054DB4F /* Selection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Selection.swift; sourceTree = ""; }; - DE6B15AC26152BE10068D642 /* ApolloServerIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApolloServerIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DE6B15AE26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultInterceptorProviderIntegrationTests.swift; sourceTree = ""; }; - DE6B15B026152BE10068D642 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DE6B15E826152CD80068D642 /* Apollo-Target-ServerIntegrationTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-ServerIntegrationTests.xcconfig"; sourceTree = ""; }; - DE6B15FA26152D210068D642 /* Workspace-Target-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Target-Application.xcconfig"; sourceTree = ""; }; - DE6B15FB26152D210068D642 /* Workspace-Deployment-Targets.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Deployment-Targets.xcconfig"; sourceTree = ""; }; - DE6B15FC26152D210068D642 /* Workspace-Analysis.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Analysis.xcconfig"; sourceTree = ""; }; - DE6B15FD26152D210068D642 /* Project-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project-Release.xcconfig"; sourceTree = ""; }; - DE6B15FE26152D210068D642 /* Workspace-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Debug.xcconfig"; sourceTree = ""; }; - DE6B15FF26152D210068D642 /* Workspace-Universal-Test.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Universal-Test.xcconfig"; sourceTree = ""; }; - DE6B160026152D210068D642 /* Workspace-Universal-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Universal-Framework.xcconfig"; sourceTree = ""; }; - DE6B160126152D210068D642 /* Workspace-Target-Test.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Target-Test.xcconfig"; sourceTree = ""; }; - DE6B160326152D210068D642 /* Workspace-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Release.xcconfig"; sourceTree = ""; }; - DE6B160426152D210068D642 /* Project-Version.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project-Version.xcconfig"; sourceTree = ""; }; - DE6B160526152D210068D642 /* Workspace-Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Warnings.xcconfig"; sourceTree = ""; }; - DE6B160626152D210068D642 /* Workspace-Target-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Target-Framework.xcconfig"; sourceTree = ""; }; - DE6B160726152D210068D642 /* Workspace-Search-Paths.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Search-Paths.xcconfig"; sourceTree = ""; }; - DE6B160826152D210068D642 /* Workspace-Universal-Target.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Universal-Target.xcconfig"; sourceTree = ""; }; - DE6B160926152D210068D642 /* Workspace-Linking.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Linking.xcconfig"; sourceTree = ""; }; - DE6B160A26152D210068D642 /* Workspace-Language.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Language.xcconfig"; sourceTree = ""; }; - DE6B160B26152D210068D642 /* Project-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project-Debug.xcconfig"; sourceTree = ""; }; - DE6B160C26152D210068D642 /* Workspace-Packaging.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Packaging.xcconfig"; sourceTree = ""; }; - DE6B160D26152D210068D642 /* Workspace-Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Shared.xcconfig"; sourceTree = ""; }; - DE6B650B27C4293D00970E4E /* FieldArgumentRendering.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieldArgumentRendering.swift; sourceTree = ""; }; - DE6D07F827BC3B6D009F5F33 /* GraphQLInputField+Rendered.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLInputField+Rendered.swift"; sourceTree = ""; }; - DE6D07FA27BC3BE9009F5F33 /* OperationDefinition_VariableDefinition_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationDefinition_VariableDefinition_Tests.swift; sourceTree = ""; }; - DE6D07FE27BC7F78009F5F33 /* InputVariableRenderable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputVariableRenderable.swift; sourceTree = ""; }; - DE71FDBB2853B67C005FA9CC /* LocalCacheMutationDefinitionTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalCacheMutationDefinitionTemplate.swift; sourceTree = ""; }; - DE71FDBD2853B6D3005FA9CC /* LocalCacheMutationDefinitionTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalCacheMutationDefinitionTemplateTests.swift; sourceTree = ""; }; - DE71FDBF2853C242005FA9CC /* OperationTemplateRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationTemplateRenderer.swift; sourceTree = ""; }; - DE71FDC12853C4C8005FA9CC /* MockLocalCacheMutation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockLocalCacheMutation.swift; sourceTree = ""; }; - DE71FDC32853D681005FA9CC /* SelectionSetTemplate_LocalCacheMutation_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetTemplate_LocalCacheMutation_Tests.swift; sourceTree = ""; }; - DE796428276998B000978A03 /* IR+RootFieldBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+RootFieldBuilder.swift"; sourceTree = ""; }; - DE79642A276999E700978A03 /* IRNamedFragmentBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRNamedFragmentBuilderTests.swift; sourceTree = ""; }; - DE79642C27699A6A00978A03 /* IR+NamedFragmentBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+NamedFragmentBuilder.swift"; sourceTree = ""; }; - DE79642E2769A1EB00978A03 /* IROperationBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IROperationBuilderTests.swift; sourceTree = ""; }; - DE7C183B272A12EB00727031 /* ScopeDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScopeDescriptor.swift; sourceTree = ""; }; - DE7C183D272A154400727031 /* IR.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IR.swift; sourceTree = ""; }; - DE80003328B5608E00C827BD /* SchemaMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaMetadata.swift; sourceTree = ""; }; - DE8C51C929E8B03700E47A64 /* IRDefinition+RenderingHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IRDefinition+RenderingHelpers.swift"; sourceTree = ""; }; - DE8C51CB29EF454100E47A64 /* GraphQLExecutionSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLExecutionSource.swift; sourceTree = ""; }; - DE8F7B6A29F742E1005F3902 /* NetworkResponseExecutionSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkResponseExecutionSource.swift; sourceTree = ""; }; - DE8F7B6C29F745DE005F3902 /* CacheDataExecutionSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheDataExecutionSource.swift; sourceTree = ""; }; - DE8F7B6E29F7478C005F3902 /* SelectionSetModelExecutionSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetModelExecutionSource.swift; sourceTree = ""; }; - DE8F7B7029FC24A8005F3902 /* SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift; sourceTree = ""; }; - DE903E1229B7E6D300A74415 /* SelectionSet+JSONInitializer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SelectionSet+JSONInitializer.swift"; sourceTree = ""; }; - DE903E1629C10B7600A74415 /* FieldSelectionCollector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieldSelectionCollector.swift; sourceTree = ""; }; - DE903E1829CA20FC00A74415 /* TypeCaseConversionPerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeCaseConversionPerformanceTests.swift; sourceTree = ""; }; - DE903E2129CA622E00A74415 /* SelectionSetInitializerPerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetInitializerPerformanceTests.swift; sourceTree = ""; }; - DE90FDB927FE405F0084CC79 /* Selection+Conditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Selection+Conditions.swift"; sourceTree = ""; }; - DE9C04AE26EAAEE800EC35E7 /* CacheReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheReference.swift; sourceTree = ""; }; - DE9C04B026EAAFF900EC35E7 /* JSONDecodingError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONDecodingError.swift; sourceTree = ""; }; - DE9CEADC28299E8500959AF9 /* ApolloTestSupport.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloTestSupport.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DE9CEAE128299F6900959AF9 /* Apollo-Target-TestSupport.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-TestSupport.xcconfig"; sourceTree = ""; }; - DE9CEAE52829A2FE00959AF9 /* TestMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestMock.swift; sourceTree = ""; }; - DE9CEAED282C207F00959AF9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DE9CEAEE282C62B700959AF9 /* MockObjectTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockObjectTemplate.swift; sourceTree = ""; }; - DE9CEAF0282C632B00959AF9 /* MockObjectTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockObjectTemplateTests.swift; sourceTree = ""; }; - DE9CEAF2282C6AC300959AF9 /* TemplateRenderer_TestMockFile_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateRenderer_TestMockFile_Tests.swift; sourceTree = ""; }; - DEA34AF6260E821F00F95F86 /* Apollo-Target-AnimalKingdomAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-AnimalKingdomAPI.xcconfig"; sourceTree = ""; }; - DEA6A83326F298660091AF8A /* ParentType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParentType.swift; sourceTree = ""; }; - DEA7604329DF75B60001544B /* TestMockSelectionSetMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestMockSelectionSetMapper.swift; sourceTree = ""; }; - DEA9A22F27CD990500F96C36 /* IRSelectionSet_IncludeSkip_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRSelectionSet_IncludeSkip_Tests.swift; sourceTree = ""; }; - DEA9A23127D822E600F96C36 /* IR+InclusionConditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+InclusionConditions.swift"; sourceTree = ""; }; - DEAFB77A2706444B00BE02F3 /* IRRootFieldBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRRootFieldBuilderTests.swift; sourceTree = ""; }; - DEAFB780270647D400BE02F3 /* MockCompilationResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockCompilationResult.swift; sourceTree = ""; }; - DEAFB78227064F6900BE02F3 /* MockGraphQLType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockGraphQLType.swift; sourceTree = ""; }; - DEB05B47289C3B4000170299 /* MockInterfacesFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockInterfacesFileGenerator.swift; sourceTree = ""; }; - DEB05B49289C3EC300170299 /* MockInterfacesTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockInterfacesTemplate.swift; sourceTree = ""; }; - DEC2EA89291D5E2E0088D3BB /* TestIsolatedFileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestIsolatedFileManager.swift; sourceTree = ""; }; - DEC2EA8C291D9C960088D3BB /* Workspace-Test-Deployment-Targets.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Test-Deployment-Targets.xcconfig"; sourceTree = ""; }; - DECD46CF262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarWarsApolloSchemaDownloaderTests.swift; sourceTree = ""; }; - DECD490B262F81BF00924527 /* ApolloCodegenInternalTestHelpers.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApolloCodegenInternalTestHelpers.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DECD490D262F81BF00924527 /* ApolloCodegenInternalTestHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApolloCodegenInternalTestHelpers.h; sourceTree = ""; }; - DECD490E262F81BF00924527 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DECD492F262F820500924527 /* Apollo-Target-CodegenInternalTestHelpers.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-CodegenInternalTestHelpers.xcconfig"; sourceTree = ""; }; - DECD4930262F824B00924527 /* Workspace-Target-TestHelpers.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Target-TestHelpers.xcconfig"; sourceTree = ""; }; - DECD493E262F82D600924527 /* Workspace-Target-Codegen.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Workspace-Target-Codegen.xcconfig"; sourceTree = ""; }; - DECD53CE26EC0EE50059A639 /* OutputTypeConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutputTypeConvertible.swift; sourceTree = ""; }; - DECFEFE3286A3C8800DBE83C /* starwars-graphql */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "starwars-graphql"; sourceTree = ""; }; - DED45C172615308E0086EF63 /* TestServerURLs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestServerURLs.swift; sourceTree = ""; }; - DED45C292615319E0086EF63 /* DefaultInterceptorProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultInterceptorProviderTests.swift; sourceTree = ""; }; - DED45C3B26165DD70086EF63 /* Apollo-IntegrationTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Apollo-IntegrationTestPlan.xctestplan"; sourceTree = ""; }; - DED45D842616759C0086EF63 /* TestConfigs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestConfigs.swift; sourceTree = ""; }; - DED45DC7261682260086EF63 /* Apollo-UnitTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Apollo-UnitTestPlan.xctestplan"; sourceTree = ""; }; - DED45F49261CDBFC0086EF63 /* UploadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadTests.swift; sourceTree = ""; }; - DED45FB1261CDE7D0086EF63 /* Apollo-PerformanceTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Apollo-PerformanceTestPlan.xctestplan"; sourceTree = ""; }; - DED45FB2261CDE980086EF63 /* Apollo-CITestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Apollo-CITestPlan.xctestplan"; sourceTree = ""; }; - DED45FB3261CDEC60086EF63 /* Apollo-CodegenTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Apollo-CodegenTestPlan.xctestplan"; sourceTree = ""; }; - DED5B356286CD34000AE6BFF /* CompilationResultSchemaDocumentationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompilationResultSchemaDocumentationTests.swift; sourceTree = ""; }; - DED5B358286CEA0900AE6BFF /* TemplateString_Documentation_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateString_Documentation_Tests.swift; sourceTree = ""; }; - DED5B35A286CF16600AE6BFF /* TemplateString+CodegenConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TemplateString+CodegenConfiguration.swift"; sourceTree = ""; }; - DEE2060A27E14498002B4B82 /* IR+InclusionConditionsMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+InclusionConditionsMock.swift"; sourceTree = ""; }; - DEE2DAA127BAF00500EC0607 /* GraphQLType+Rendered.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLType+Rendered.swift"; sourceTree = ""; }; - DEF330342A4B6DEE0081883D /* PersistedQueriesOperationManifestTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistedQueriesOperationManifestTemplate.swift; sourceTree = ""; }; - DEF330362A4B6EAA0081883D /* PersistedQueriesOperationManifestTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistedQueriesOperationManifestTemplateTests.swift; sourceTree = ""; }; - DEFBBC85273470F70088AABC /* IR+Field.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+Field.swift"; sourceTree = ""; }; - DEFE0FC42748822900FFA440 /* IR+EntitySelectionTree.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+EntitySelectionTree.swift"; sourceTree = ""; }; - DEFE694D280F6CBE001CF4E8 /* IR+FieldCollector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IR+FieldCollector.swift"; sourceTree = ""; }; - DEFE694F28133E9B001CF4E8 /* IRFieldCollectorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRFieldCollectorTests.swift; sourceTree = ""; }; - DEFE695A28205321001CF4E8 /* SelectionSetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSetTests.swift; sourceTree = ""; }; - E6057F8A287D7E24007D84EC /* ResponsePathTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResponsePathTests.swift; sourceTree = ""; }; - E607AD8D27A88F340026742A /* OperationFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationFileGeneratorTests.swift; sourceTree = ""; }; - E608A5222808E59A001BE656 /* MockWebSocketDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockWebSocketDelegate.swift; sourceTree = ""; }; - E608A526280905C2001BE656 /* GraphqlWsProtocolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphqlWsProtocolTests.swift; sourceTree = ""; }; - E608A527280905C2001BE656 /* GraphqlTransportWsProtocolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphqlTransportWsProtocolTests.swift; sourceTree = ""; }; - E608A528280905C2001BE656 /* WSProtocolTestsBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WSProtocolTestsBase.swift; sourceTree = ""; }; - E608A52C280905E9001BE656 /* SubscriptionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionTests.swift; sourceTree = ""; }; - E60AE2ED27E3FC6C003C093A /* TemplateRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateRenderer.swift; sourceTree = ""; }; - E60F457929E4CFB800E60A04 /* TemplateString_DeprecationMessage_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateString_DeprecationMessage_Tests.swift; sourceTree = ""; }; - E610D8D6278EA2390023E495 /* EnumFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumFileGenerator.swift; sourceTree = ""; }; - E610D8D8278EA2560023E495 /* EnumFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumFileGeneratorTests.swift; sourceTree = ""; }; - E610D8DA278EB0900023E495 /* InterfaceFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceFileGenerator.swift; sourceTree = ""; }; - E610D8DC278EB1500023E495 /* InterfaceFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceFileGeneratorTests.swift; sourceTree = ""; }; - E610D8DE278F8F1E0023E495 /* UnionFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnionFileGenerator.swift; sourceTree = ""; }; - E610D8E0278F8F3D0023E495 /* UnionFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnionFileGeneratorTests.swift; sourceTree = ""; }; - E616B6D026C3335600DB049E /* ClearCacheTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClearCacheTests.swift; sourceTree = ""; }; - E6180A9E28093EB7004EC2A3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E6180AA128093EB7004EC2A3 /* schema.graphqls */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = schema.graphqls; sourceTree = ""; }; - E6180AA328093EB7004EC2A3 /* subscription.graphql */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = subscription.graphql; sourceTree = ""; }; - E6180AA928093F76004EC2A3 /* Apollo-Target-SubscriptionAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-SubscriptionAPI.xcconfig"; sourceTree = ""; }; - E61DD76426D60C1800C41614 /* SQLiteDotSwiftDatabaseBehaviorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteDotSwiftDatabaseBehaviorTests.swift; sourceTree = ""; }; - E61EF712275EC99A00191DA7 /* ApolloCodegenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloCodegenTests.swift; sourceTree = ""; }; - E61F4BF727A8FC8E0049886A /* FragmentFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FragmentFileGeneratorTests.swift; sourceTree = ""; }; - E6203341284F1C9600A291D1 /* MockUnionsFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUnionsFileGenerator.swift; sourceTree = ""; }; - E6203343284F1D1100A291D1 /* MockUnionsTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUnionsTemplate.swift; sourceTree = ""; }; - E6203345284F252A00A291D1 /* MockUnionsFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUnionsFileGeneratorTests.swift; sourceTree = ""; }; - E6203347284F25DF00A291D1 /* MockUnionsTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUnionsTemplateTests.swift; sourceTree = ""; }; - E623FD292797A6F4008B4CED /* InterfaceTemplate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InterfaceTemplate.swift; sourceTree = ""; }; - E623FD2B2797A700008B4CED /* InterfaceTemplateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InterfaceTemplateTests.swift; sourceTree = ""; }; - E63F0C0028EE099A009069EA /* ApolloCodegenFrontendBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloCodegenFrontendBundle.swift; sourceTree = ""; }; - E64F226C28B8B3FE0011292F /* LogLevelSetter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogLevelSetter.swift; sourceTree = ""; }; - E64F227028B8BEE10011292F /* MockLogLevelSetter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockLogLevelSetter.swift; sourceTree = ""; }; - E64F7EB727A0854E0059C021 /* UnionTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnionTemplate.swift; sourceTree = ""; }; - E64F7EB927A085D90059C021 /* UnionTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnionTemplateTests.swift; sourceTree = ""; }; - E64F7EBB27A11A510059C021 /* GraphQLNamedType+SwiftName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLNamedType+SwiftName.swift"; sourceTree = ""; }; - E64F7EBE27A11B110059C021 /* GraphQLNamedType+SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GraphQLNamedType+SwiftTests.swift"; sourceTree = ""; }; - E64F7EC027A122300059C021 /* ObjectTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectTemplate.swift; sourceTree = ""; }; - E64F7EC227A1243A0059C021 /* ObjectTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectTemplateTests.swift; sourceTree = ""; }; - E657CDB926FD01D4005834D6 /* ApolloSchemaInternalTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApolloSchemaInternalTests.swift; sourceTree = ""; }; - E660A4D029CA56A4001EA373 /* MockHTTPRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockHTTPRequest.swift; sourceTree = ""; }; - E660A4D229CA5890001EA373 /* MockHTTPResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockHTTPResponse.swift; sourceTree = ""; }; - E660A4D429CAEA0F001EA373 /* MockInterceptorProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockInterceptorProvider.swift; sourceTree = ""; }; - E6630B8D26F071F9002D9E41 /* SchemaRegistryApolloSchemaDownloaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaRegistryApolloSchemaDownloaderTests.swift; sourceTree = ""; }; - E66644EF29D7D27C005E9140 /* MockTemplateRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTemplateRenderer.swift; sourceTree = ""; }; - E669352A2803EE11004E1FFC /* CustomScalarTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScalarTemplate.swift; sourceTree = ""; }; - E669352C2803EF67004E1FFC /* CustomScalarTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScalarTemplateTests.swift; sourceTree = ""; }; - E669352E2803F09C004E1FFC /* CustomScalarFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScalarFileGenerator.swift; sourceTree = ""; }; - E66935302803F2B0004E1FFC /* CustomScalarFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScalarFileGeneratorTests.swift; sourceTree = ""; }; - E66935322804AFE5004E1FFC /* IRCustomScalarTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRCustomScalarTests.swift; sourceTree = ""; }; - E66B8341280936B3001B3F2D /* OperationMessageMatchers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationMessageMatchers.swift; sourceTree = ""; }; - E66B836628093D7C001B3F2D /* SubscriptionAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SubscriptionAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E66F8896276C136B0000BDA8 /* ObjectFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectFileGeneratorTests.swift; sourceTree = ""; }; - E66F8898276C15580000BDA8 /* ObjectFileGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectFileGenerator.swift; sourceTree = ""; }; - E674DB40274C0A9B009BB90E /* Glob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Glob.swift; sourceTree = ""; }; - E674DB42274C0AD9009BB90E /* GlobTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobTests.swift; sourceTree = ""; }; - E687B3C128B398CB00A9551C /* CodegenCLI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CodegenCLI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E687B3CA28B398E600A9551C /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; - E687B3CC28B398E600A9551C /* InputOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputOptions.swift; sourceTree = ""; }; - E687B3CD28B398E600A9551C /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = ""; }; - E687B3CF28B398E600A9551C /* ParsableCommand+Apollo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ParsableCommand+Apollo.swift"; sourceTree = ""; }; - E687B3D028B398E600A9551C /* FileManager+Data.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FileManager+Data.swift"; sourceTree = ""; }; - E687B3D128B398E600A9551C /* String+Data.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Data.swift"; sourceTree = ""; }; - E687B3D428B398E600A9551C /* FetchSchema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchSchema.swift; sourceTree = ""; }; - E687B3D528B398E600A9551C /* Initialize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Initialize.swift; sourceTree = ""; }; - E687B3D628B398E600A9551C /* Generate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Generate.swift; sourceTree = ""; }; - E687B3D928B398E600A9551C /* CodegenProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodegenProvider.swift; sourceTree = ""; }; - E687B3DA28B398E600A9551C /* SchemaDownloadProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchemaDownloadProvider.swift; sourceTree = ""; }; - E687B3F328B39A9100A9551C /* Apollo-Target-CodegenCLI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-CodegenCLI.xcconfig"; sourceTree = ""; }; - E68D824627A228A80040A46F /* SchemaModuleFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaModuleFileGenerator.swift; sourceTree = ""; }; - E6908E54282694630054682B /* ApolloCodegenConfigurationCodableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloCodegenConfigurationCodableTests.swift; sourceTree = ""; }; - E6931D4A29CE44EA005DD9E4 /* String+Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Data.swift"; sourceTree = ""; }; - E6936F152908AD8D0089054C /* PetSearchLocalCacheMutation.graphql.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetSearchLocalCacheMutation.graphql.swift; sourceTree = ""; }; - E699DE9428B3C20E004ECF19 /* CodegenCLITestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = CodegenCLITestPlan.xctestplan; sourceTree = ""; }; - E69BEDA42798B86D00000D10 /* InputObjectTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputObjectTemplate.swift; sourceTree = ""; }; - E69BEDA62798B89600000D10 /* InputObjectTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputObjectTemplateTests.swift; sourceTree = ""; }; - E69F436B29B81182006FF548 /* InterceptorRequestChain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterceptorRequestChain.swift; sourceTree = ""; }; - E69F437129BBD958006FF548 /* MultipartResponseParsingInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipartResponseParsingInterceptor.swift; sourceTree = ""; }; - E6A6866327F63AEF008A1D13 /* FileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileGeneratorTests.swift; sourceTree = ""; }; - E6A6866527F63BDC008A1D13 /* FileGenerator_ResolvePath_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileGenerator_ResolvePath_Tests.swift; sourceTree = ""; }; - E6AAA731286BC58200F4659D /* OperationManifestFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationManifestFileGenerator.swift; sourceTree = ""; }; - E6AAA735286C0F8E00F4659D /* OperationManifestFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationManifestFileGeneratorTests.swift; sourceTree = ""; }; - E6AAA738286C87EA00F4659D /* LegacyAPQOperationManifestTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyAPQOperationManifestTemplate.swift; sourceTree = ""; }; - E6AAA73A286CC7EF00F4659D /* LegacyAPQOperationManifestTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyAPQOperationManifestTemplateTests.swift; sourceTree = ""; }; - E6B1FEBA29F2FC97003D12E0 /* InterceptorTester.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterceptorTester.swift; sourceTree = ""; }; - E6B2B26B29C2447F004B16F4 /* MultipartResponseParsingInterceptorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipartResponseParsingInterceptorTests.swift; sourceTree = ""; }; - E6B42D0827A472A700A3BD58 /* SwiftPackageManagerModuleTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftPackageManagerModuleTemplate.swift; sourceTree = ""; }; - E6B42D0A27A4746800A3BD58 /* SchemaModuleFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaModuleFileGeneratorTests.swift; sourceTree = ""; }; - E6B42D0C27A4749100A3BD58 /* SwiftPackageManagerModuleTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftPackageManagerModuleTemplateTests.swift; sourceTree = ""; }; - E6BEEFA527FAB1C700D94FF4 /* MockFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockFileGenerator.swift; sourceTree = ""; }; - E6BF98FB272C8FFC00C1FED8 /* MockFileManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockFileManager.swift; sourceTree = ""; }; - E6C4267A26F16CB400904AD2 /* introspection_response.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = introspection_response.json; sourceTree = ""; }; - E6C9849227929EBE009481BE /* EnumTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumTemplate.swift; sourceTree = ""; }; - E6C9849427929FED009481BE /* EnumTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumTemplateTests.swift; sourceTree = ""; }; - E6CD6F4A2887202900DC9F3F /* CacheKeyResolutionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheKeyResolutionTests.swift; sourceTree = ""; }; - E6D08AD128897B9B00D21B13 /* schema.graphqls */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = schema.graphqls; sourceTree = ""; }; - E6D79AB626E97D0D0094434A /* URLDownloaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLDownloaderTests.swift; sourceTree = ""; }; - E6D79AB926EC05290094434A /* MockNetworkSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockNetworkSession.swift; sourceTree = ""; }; - E6D90D06278FA595009CAC5D /* InputObjectFileGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputObjectFileGenerator.swift; sourceTree = ""; }; - E6D90D08278FA5C3009CAC5D /* InputObjectFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputObjectFileGeneratorTests.swift; sourceTree = ""; }; - E6D90D0A278FFDDA009CAC5D /* SchemaMetadataFileGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaMetadataFileGenerator.swift; sourceTree = ""; }; - E6D90D0C278FFE35009CAC5D /* SchemaMetadataFileGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaMetadataFileGeneratorTests.swift; sourceTree = ""; }; - E6D9212828DA631D00AF12E6 /* ApolloSchemaDownloadConfigurationCodableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApolloSchemaDownloadConfigurationCodableTests.swift; sourceTree = ""; }; - E6D9212A28DA66B300AF12E6 /* String+Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Data.swift"; sourceTree = ""; }; - E6DC0ABE28B3AB890064A68F /* CodegenCLITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodegenCLITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - E6DC0ACB28B3AC490064A68F /* MockApolloCodegen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockApolloCodegen.swift; sourceTree = ""; }; - E6DC0ACC28B3AC490064A68F /* MockApolloCodegenConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockApolloCodegenConfiguration.swift; sourceTree = ""; }; - E6DC0ACD28B3AC490064A68F /* TestSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestSupport.swift; sourceTree = ""; }; - E6DC0ACE28B3AC490064A68F /* MockApolloSchemaDownloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockApolloSchemaDownloader.swift; sourceTree = ""; }; - E6DC0ACF28B3AC490064A68F /* MockFileManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockFileManager.swift; sourceTree = ""; }; - E6DC0AD128B3AC490064A68F /* InitializeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InitializeTests.swift; sourceTree = ""; }; - E6DC0AD228B3AC490064A68F /* GenerateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GenerateTests.swift; sourceTree = ""; }; - E6DC0AD328B3AC490064A68F /* FetchSchemaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchSchemaTests.swift; sourceTree = ""; }; - E6DC0AD528B3AC490064A68F /* ErrorMatchers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorMatchers.swift; sourceTree = ""; }; - E6DC0AD628B3AC490064A68F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E6DC0AE328B3ACF20064A68F /* Apollo-Target-CodegenCLITests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apollo-Target-CodegenCLITests.xcconfig"; sourceTree = ""; }; - E6E3BBDD276A8D6200E5218B /* FileGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileGenerator.swift; sourceTree = ""; }; - E6EE62F027DBE6F200627257 /* SchemaModuleNamespaceTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaModuleNamespaceTemplate.swift; sourceTree = ""; }; - E6EE62F227DBE75A00627257 /* SchemaModuleNamespaceTemplateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchemaModuleNamespaceTemplateTests.swift; sourceTree = ""; }; - E6EE6F1129C141A600BDE7A5 /* HTTPURLResponseExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPURLResponseExtensionTests.swift; sourceTree = ""; }; - E6EFDD0A27E8328E00B17FE5 /* TemplateRenderer_SchemaFile_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateRenderer_SchemaFile_Tests.swift; sourceTree = ""; }; - E6EFDD0C27E8377200B17FE5 /* MockFileTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockFileTemplate.swift; sourceTree = ""; }; - E6EFDD1327EAB55B00B17FE5 /* TemplateRenderer_OperationFile_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplateRenderer_OperationFile_Tests.swift; sourceTree = ""; }; - E86D8E03214B32DA0028EFE1 /* JSONTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONTests.swift; sourceTree = ""; }; - F16D083B21EF6F7300C458B8 /* SelectionSet_JSONInitializerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectionSet_JSONInitializerTests.swift; sourceTree = ""; }; - F82E62E022BCD223000C311B /* AutomaticPersistedQueriesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutomaticPersistedQueriesTests.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 9B2DFBB324E1FA0D00ED3AE6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9B2DFBBF24E1FA1A00ED3AE6 /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7B6F44233C26D100F32205 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DE736F4626FA6EE6007187F2 /* InflectorKit in Frameworks */, - DEAFB787270652D100BE02F3 /* OrderedCollections in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDA7A23FDE90400ACD198 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9B7BDAFD23FDEE9300ACD198 /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDABC23FDEBB600ACD198 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9B7BDAFA23FDEE8A00ACD198 /* Apollo.framework in Frameworks */, - 9B7BDAF623FDEE2600ACD198 /* SQLite in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9BAEEBF9234BB8FD00808306 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DEAFB77F2706474C00BE02F3 /* Nimble in Frameworks */, - DECD49DB262F8AAA00924527 /* ApolloInternalTestHelpers.framework in Frameworks */, - DECD4992262F841600924527 /* ApolloCodegenInternalTestHelpers.framework in Frameworks */, - 9BAEEC01234BB8FD00808306 /* ApolloCodegenLib.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F54C8B1255D760B0065AFD6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DE903E1E29CA25A600A74415 /* AnimalKingdomAPI.framework in Frameworks */, - 9F54C90F255D79C80065AFD6 /* ApolloInternalTestHelpers.framework in Frameworks */, - DE903E1D29CA23B200A74415 /* Nimble in Frameworks */, - 9F54C910255D79C80065AFD6 /* GitHubAPI.framework in Frameworks */, - 9F54C8B9255D760B0065AFD6 /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F8A95741EC0FC1200304A2D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F65B1211EC106F30090B25F /* Apollo.framework in Frameworks */, - DED45EE4261BA1FB0086EF63 /* ApolloSQLite.framework in Frameworks */, - DED45EE5261BA1FB0086EF63 /* ApolloWebSocket.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FACA9BD1F42E67200AE2DBD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FACA9BE1F42E67200AE2DBD /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FC7504B1D2A532D00458D91 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DE9CEAE92829A3C800959AF9 /* ApolloTestSupport.framework in Frameworks */, - DE5EB9C526EFD4D10004176A /* Nimble in Frameworks */, - 9B2DFBCD24E201A800ED3AE6 /* UploadAPI.framework in Frameworks */, - 9FC7504F1D2A532D00458D91 /* Apollo.framework in Frameworks */, - 9F8A958D1EC0FFAB00304A2D /* ApolloInternalTestHelpers.framework in Frameworks */, - 9FCE2D091E6C254700E34457 /* StarWarsAPI.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FCE2CF61E6C213D00E34457 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F438D071E6C2FD9007BDC1A /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE05861B266978A100265760 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE3C7A06260A6B9800D2F4FF /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DE6B650827C059A800970E4E /* ApolloAPI.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE6B15A926152BE10068D642 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E61D426A28803F3600C00F97 /* SubscriptionAPI.framework in Frameworks */, - DECD498F262F840700924527 /* ApolloCodegenInternalTestHelpers.framework in Frameworks */, - DECD4736262F668500924527 /* UploadAPI.framework in Frameworks */, - DECD46FB262F659500924527 /* ApolloCodegenLib.framework in Frameworks */, - DED46051261CEAD20086EF63 /* StarWarsAPI.framework in Frameworks */, - E6FDD7532880471400BD0ADA /* Nimble in Frameworks */, - DED46035261CEA660086EF63 /* ApolloInternalTestHelpers.framework in Frameworks */, - DED45FE7261CE8C50086EF63 /* ApolloWebSocket.framework in Frameworks */, - DED45FD0261CE88C0086EF63 /* ApolloSQLite.framework in Frameworks */, - DE6B15B126152BE10068D642 /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE9CEACE28299E8500959AF9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DE903E2529CE59C000A74415 /* Apollo.framework in Frameworks */, - DE9CEAE42829A01C00959AF9 /* ApolloAPI.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DECD4908262F81BF00924527 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DECD49C9262F88FE00924527 /* ApolloCodegenLib.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E66B836328093D7C001B3F2D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E6C2B39B2809409500F4CE13 /* Apollo.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E687B3BE28B398CB00A9551C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E687B3F228B39A5B00A9551C /* ArgumentParser in Frameworks */, - E687B3EA28B3993000A9551C /* ApolloCodegenLib.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E6DC0ABB28B3AB890064A68F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DEC2EA93291ED3910088D3BB /* Apollo.framework in Frameworks */, - DEC2EA90291ED0F20088D3BB /* ApolloInternalTestHelpers.framework in Frameworks */, - E6DC0AC228B3AB890064A68F /* CodegenCLI.framework in Frameworks */, - E6DC0AE228B3AC7E0064A68F /* Nimble in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 6608B3332A7D3FCB006FB655 /* CodegenConfiguration */ = { - isa = PBXGroup; - children = ( - 6608B3342A7D3FF5006FB655 /* ApolloCodegenConfiguration+OperationManifestConfiguration.swift */, - ); - path = CodegenConfiguration; - sourceTree = ""; - }; - 66B18E862A15366400525DFB /* Network */ = { - isa = PBXGroup; - children = ( - 9B4F4542244A2AD300C2CF7D /* URLSessionClientTests.swift */, - ); - path = Network; - sourceTree = ""; - }; - 90690D04224333DA00FC2E54 /* Configuration */ = { - isa = PBXGroup; - children = ( - DE6B15F926152D210068D642 /* Shared */, - 90690D05224333DA00FC2E54 /* Apollo-Project-Debug.xcconfig */, - 90690D08224333DA00FC2E54 /* Apollo-Project-Performance-Testing.xcconfig */, - 90690D07224333DA00FC2E54 /* Apollo-Project-Release.xcconfig */, - 9B7B6F55233C27A000F32205 /* Apollo-Target-ApolloCodegenLib.xcconfig */, - DE0586222669793200265760 /* Apollo-Target-ApolloAPI.xcconfig */, - DEA34AF6260E821F00F95F86 /* Apollo-Target-AnimalKingdomAPI.xcconfig */, - 9B4AA8AD239EFDC9003E1300 /* Apollo-Target-CodegenTests.xcconfig */, - 90690D06224333DA00FC2E54 /* Apollo-Target-Framework.xcconfig */, - 90690D2222433C2800FC2E54 /* Apollo-Target-GitHubAPI.xcconfig */, - 90690D2422433C8000FC2E54 /* Apollo-Target-PerformanceTests.xcconfig */, - 90690D2122433C1900FC2E54 /* Apollo-Target-StarWarsAPI.xcconfig */, - 90690D142243363D00FC2E54 /* Apollo-Target-TestHost-iOS.xcconfig */, - 90690D0B2243345500FC2E54 /* Apollo-Target-Tests.xcconfig */, - DE6B15E826152CD80068D642 /* Apollo-Target-ServerIntegrationTests.xcconfig */, - DECD492F262F820500924527 /* Apollo-Target-CodegenInternalTestHelpers.xcconfig */, - 90690D2522433CAF00FC2E54 /* Apollo-Target-InternalTestHelpers.xcconfig */, - DE9CEAE128299F6900959AF9 /* Apollo-Target-TestSupport.xcconfig */, - 9B2DFBC824E1FA7E00ED3AE6 /* Apollo-Target-UploadAPI.xcconfig */, - E6180AA928093F76004EC2A3 /* Apollo-Target-SubscriptionAPI.xcconfig */, - 9B7BDAD923FDECB400ACD198 /* ApolloSQLite-Project-Debug.xcconfig */, - 9B7BDADC23FDECB400ACD198 /* ApolloSQLite-Project-Release.xcconfig */, - 9B7BDAD823FDECB300ACD198 /* ApolloSQLite-Target-Framework.xcconfig */, - 9B9BBB1624DB74720021C30F /* Apollo-Target-UploadAPI.xcconfig */, - 9B7BDAA523FDE98C00ACD198 /* ApolloWebSocket-Project-Debug.xcconfig */, - 9B7BDAA323FDE98C00ACD198 /* ApolloWebSocket-Project-Release.xcconfig */, - 9B7BDAA423FDE98C00ACD198 /* ApolloWebSocket-Target-Framework.xcconfig */, - E687B3F328B39A9100A9551C /* Apollo-Target-CodegenCLI.xcconfig */, - E6DC0AE328B3ACF20064A68F /* Apollo-Target-CodegenCLITests.xcconfig */, - ); - name = Configuration; - path = Configuration/Apollo; - sourceTree = ""; - }; - 9B0417812390320A00C9EC4E /* TestHelpers */ = { - isa = PBXGroup; - children = ( - 9BC139A524EDCAD900876D29 /* BlindRetryingTestInterceptor.swift */, - 9B2B66F32513FAFE00B53ABF /* CancellationHandlingInterceptor.swift */, - 9BF6C91725194D7B000D5B93 /* MultipartFormData+Testing.swift */, - 9BC139A724EDCE4F00876D29 /* RetryToCountThenSucceedInterceptor.swift */, - C3279FC52345233000224790 /* TestCustomRequestBodyCreator.swift */, - 9B64F6752354D219002D1BB5 /* URL+QueryDict.swift */, - E66B8341280936B3001B3F2D /* OperationMessageMatchers.swift */, - ); - name = TestHelpers; - sourceTree = ""; - }; - 9B2061162591B3550020D1E0 /* Resources */ = { - isa = PBXGroup; - children = ( - 9B2061192591B3550020D1E0 /* a.txt */, - 9B2061182591B3550020D1E0 /* b.txt */, - 9B2061172591B3550020D1E0 /* c.txt */, - ); - path = Resources; - sourceTree = ""; - }; - 9B20614A2591B3700020D1E0 /* graphql */ = { - isa = PBXGroup; - children = ( - 9B20614C2591B3700020D1E0 /* operationIDs.json */, - 9B20614D2591B3700020D1E0 /* schema.graphqls */, - 9B20614B2591B3700020D1E0 /* UploadMultipleFiles.graphql */, - 9B20614E2591B3700020D1E0 /* UploadOneFile.graphql */, - ); - path = graphql; - sourceTree = ""; - }; - 9B2061662591B3A50020D1E0 /* graphql */ = { - isa = PBXGroup; - children = ( - E6D08AD128897B9B00D21B13 /* schema.graphqls */, - 9B2061702591B3A50020D1E0 /* operationIDs.json */, - 9B2061682591B3A50020D1E0 /* Queries */, - ); - path = graphql; - sourceTree = ""; - }; - 9B2061682591B3A50020D1E0 /* Queries */ = { - isa = PBXGroup; - children = ( - 9B2061692591B3A50020D1E0 /* IssuesAndCommentsForRepository.graphql */, - 9B20616A2591B3A50020D1E0 /* TestFolder */, - 9B20616E2591B3A50020D1E0 /* Repository.graphql */, - ); - path = Queries; - sourceTree = ""; - }; - 9B20616A2591B3A50020D1E0 /* TestFolder */ = { - isa = PBXGroup; - children = ( - 9B20616B2591B3A50020D1E0 /* TestFolder2 */, - ); - path = TestFolder; - sourceTree = ""; - }; - 9B20616B2591B3A50020D1E0 /* TestFolder2 */ = { - isa = PBXGroup; - children = ( - 9B20616C2591B3A50020D1E0 /* TestFolder3 */, - ); - path = TestFolder2; - sourceTree = ""; - }; - 9B20616C2591B3A50020D1E0 /* TestFolder3 */ = { - isa = PBXGroup; - children = ( - 9B20616D2591B3A50020D1E0 /* RepoURL.graphql */, - ); - path = TestFolder3; - sourceTree = ""; - }; - 9B260BE9245A01B900562176 /* Interceptor */ = { - isa = PBXGroup; - children = ( - 9BC742AF24D09F880029282C /* DefaultInterceptors */, - 9B260BEA245A020300562176 /* ApolloInterceptor.swift */, - 9BC742AB24CFB2FF0029282C /* ApolloErrorInterceptor.swift */, - 9B260C07245A437400562176 /* InterceptorProvider.swift */, - ); - name = Interceptor; - sourceTree = ""; - }; - 9B260C02245A07C200562176 /* RequestChain */ = { - isa = PBXGroup; - children = ( - 9B260BF0245A025400562176 /* HTTPRequest.swift */, - 9B260BFE245A054700562176 /* JSONRequest.swift */, - 9B9BBAF224DB39D70021C30F /* UploadRequest.swift */, - 9B260BF4245A028D00562176 /* HTTPResponse.swift */, - E69F436B29B81182006FF548 /* InterceptorRequestChain.swift */, - 9B260BF2245A026F00562176 /* RequestChain.swift */, - 073D39F42A8AD1AF001BD34A /* RequestContext.swift */, - 9B260C03245A090600562176 /* RequestChainNetworkTransport.swift */, - ); - name = RequestChain; - sourceTree = ""; - }; - 9B2DFBC424E1FA3E00ED3AE6 /* UploadAPI */ = { - isa = PBXGroup; - children = ( - 9B20614A2591B3700020D1E0 /* graphql */, - DE63894A28D3D62400559697 /* Operations */, - DE63894F28D3D62400559697 /* Schema */, - 9B2DFBC624E1FA3E00ED3AE6 /* Info.plist */, - ); - name = UploadAPI; - path = Sources/UploadAPI; - sourceTree = SOURCE_ROOT; - }; - 9B4751BD2575BAFB0001FB87 /* Naming */ = { - isa = PBXGroup; - children = ( - 9B47516D2575AA690001FB87 /* Pluralizer.swift */, - ); - name = Naming; - sourceTree = ""; - }; - 9B7B6F50233C26E400F32205 /* ApolloCodegenLib */ = { - isa = PBXGroup; - children = ( - DEAFB7772705271D00BE02F3 /* IR */, - 9FE1E54C2588C5E000AA967E /* Frontend */, - 9B4751BD2575BAFB0001FB87 /* Naming */, - 9BCB585D240758B2002F766E /* Extensions */, - 9BD681332405F6BB000874CB /* Codegen */, - 9BD681342405F6D1000874CB /* SchemaDownload */, - 9BAEEBF22346DDAD00808306 /* CodegenLogger.swift */, - DE4841A82745BBF10001E594 /* LinkedList.swift */, - DE296BA627A09A11004F571F /* IsEverTrue.swift */, - 9BE74D3C23FB4A8E006D354F /* FileFinder.swift */, - 9B7B6F51233C26E400F32205 /* Info.plist */, - DE100B1928872D0F00BE11C2 /* Documentation.docc */, - ); - name = ApolloCodegenLib; - path = Sources/ApolloCodegenLib; - sourceTree = ""; - }; - 9B7BDA9323FDE94C00ACD198 /* ApolloWebSocket */ = { - isa = PBXGroup; - children = ( - E676C11F26CB05F90091215A /* DefaultImplementation */, - 9B7BDA9823FDE94C00ACD198 /* WebSocketClient.swift */, - 19E9F6A826D5867E003AB80E /* OperationMessageIdCreator.swift */, - 9B7BDA9723FDE94C00ACD198 /* OperationMessage.swift */, - 9B7BDA9623FDE94C00ACD198 /* SplitNetworkTransport.swift */, - 9B7BDA9423FDE94C00ACD198 /* WebSocketError.swift */, - 9B7BDA9523FDE94C00ACD198 /* WebSocketTask.swift */, - 9B7BDA9923FDE94C00ACD198 /* WebSocketTransport.swift */, - 9B7BDA9A23FDE94C00ACD198 /* Info.plist */, - DE100B1F2887415D00BE11C2 /* Documentation.docc */, - ); - name = ApolloWebSocket; - path = Sources/ApolloWebSocket; - sourceTree = SOURCE_ROOT; - }; - 9B7BDACC23FDEBE300ACD198 /* ApolloSQLite */ = { - isa = PBXGroup; - children = ( - 9B7BDACF23FDEBE300ACD198 /* SQLiteNormalizedCache.swift */, - 9B7BDACD23FDEBE300ACD198 /* SQLiteSerialization.swift */, - 9B7BDACE23FDEBE300ACD198 /* Info.plist */, - 9B9F16A626013DAB00FB2F31 /* SQLiteDatabase.swift */, - 9B9F16B72601532500FB2F31 /* SQLiteDotSwiftDatabase.swift */, - DE100B1D28873A2500BE11C2 /* Documentation.docc */, - ); - name = ApolloSQLite; - path = Sources/ApolloSQLite; - sourceTree = ""; - }; - 9B7BDAF923FDEE8A00ACD198 /* Frameworks */ = { - isa = PBXGroup; - children = ( - DE46A54D26EFE95800357C52 /* XCTest.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9B8110A623A1994000688AC4 /* SourcePackages */ = { - isa = PBXGroup; - children = ( - 9B8110A723A1995D00688AC4 /* .keep */, - ); - path = SourcePackages; - sourceTree = ""; - }; - 9BAEEC0A234BB95B00808306 /* ApolloCodegenTests */ = { - isa = PBXGroup; - children = ( - E64F7EBD27A11AEA0059C021 /* Extensions */, - DE223C3227221116004A0148 /* TestHelpers */, - DEAFB7762705270E00BE02F3 /* CodeGenIR */, - DE09F9C4270269F800795949 /* CodeGeneration */, - DE2FCF3326E809A30057EA67 /* AnimalKingdomAPI */, - 9F1A96AE258F367100A06EEB /* Frontend */, - 9B8110A623A1994000688AC4 /* SourcePackages */, - E6BE04ED26F11B3500CF858D /* Resources */, - E657CDB926FD01D4005834D6 /* ApolloSchemaInternalTests.swift */, - 9BAEEC16234C275600808306 /* ApolloSchemaPublicTests.swift */, - E61EF712275EC99A00191DA7 /* ApolloCodegenTests.swift */, - 9BAEEC18234C297800808306 /* ApolloCodegenConfigurationTests.swift */, - E6908E54282694630054682B /* ApolloCodegenConfigurationCodableTests.swift */, - E6D9212828DA631D00AF12E6 /* ApolloSchemaDownloadConfigurationCodableTests.swift */, - 9BAEEC0D234BB95B00808306 /* FileManagerExtensionTests.swift */, - 9B4751AC2575B5070001FB87 /* PluralizerTests.swift */, - 9B8C3FB4248DA3E000707B13 /* URLExtensionsTests.swift */, - 9BAEEC0C234BB95B00808306 /* Info.plist */, - E6D79AB626E97D0D0094434A /* URLDownloaderTests.swift */, - E674DB42274C0AD9009BB90E /* GlobTests.swift */, - ); - path = ApolloCodegenTests; - sourceTree = ""; - }; - 9BC742AF24D09F880029282C /* DefaultInterceptors */ = { - isa = PBXGroup; - children = ( - DE56DC222683B2020090D6E4 /* DefaultInterceptorProvider.swift */, - 9BEEDC2724E351E5001D1294 /* MaxRetryInterceptor.swift */, - 9B96500B24BE7239003C29C0 /* CacheReadInterceptor.swift */, - 9B260BFA245A031900562176 /* NetworkFetchInterceptor.swift */, - 9B260BF8245A030100562176 /* ResponseCodeInterceptor.swift */, - 9B260C09245A532500562176 /* JSONResponseParsingInterceptor.swift */, - E69F437129BBD958006FF548 /* MultipartResponseParsingInterceptor.swift */, - 9B9BBAF424DB4F890021C30F /* AutomaticPersistedQueryInterceptor.swift */, - 9BC742AD24CFB6450029282C /* CacheWriteInterceptor.swift */, - ); - name = DefaultInterceptors; - sourceTree = ""; - }; - 9BCB585D240758B2002F766E /* Extensions */ = { - isa = PBXGroup; - children = ( - 9B7B6F68233C2C0C00F32205 /* FileManager+Apollo.swift */, - 9BAEEBF62346F0A000808306 /* StaticString+Apollo.swift */, - 9B8C3FB1248DA2EA00707B13 /* URL+Apollo.swift */, - 66321AE62A126C4400CC35CB /* IR+Formatting.swift */, - ); - name = Extensions; - sourceTree = ""; - }; - 9BCF0CD823FC9CA50031D2A2 /* ApolloInternalTestHelpers */ = { - isa = PBXGroup; - children = ( - 9BCF0CDA23FC9CA50031D2A2 /* ApolloInternalTestHelpers.h */, - 9BCF0CDE23FC9CA50031D2A2 /* Info.plist */, - 9BE071AE2368D34D00FA5952 /* Matchable.swift */, - 66B18E8E2A16BF9B00525DFB /* MockURLProtocol.swift */, - 9BCF0CDD23FC9CA50031D2A2 /* MockURLSession.swift */, - 9BCF0CDF23FC9CA50031D2A2 /* MockNetworkTransport.swift */, - DE4766E726F92F30004622E0 /* MockSchemaMetadata.swift */, - DE5EB9C126EFCBD40004176A /* MockApolloStore.swift */, - DE5EB9CA26EFE5510004176A /* MockOperation.swift */, - DE71FDC12853C4C8005FA9CC /* MockLocalCacheMutation.swift */, - DE5EB9BF26EFCB010004176A /* TestObserver.swift */, - 9B7BDA8723FDE92900ACD198 /* MockWebSocket.swift */, - E608A5222808E59A001BE656 /* MockWebSocketDelegate.swift */, - 9F3910262549741400AF54A6 /* MockGraphQLServer.swift */, - E660A4D029CA56A4001EA373 /* MockHTTPRequest.swift */, - E660A4D229CA5890001EA373 /* MockHTTPResponse.swift */, - E660A4D429CAEA0F001EA373 /* MockInterceptorProvider.swift */, - 9B21FD762422C8CC00998B5C /* TestFileHelper.swift */, - 9BCF0CD923FC9CA50031D2A2 /* TestCacheProvider.swift */, - 9B7BDAEC23FDED9700ACD198 /* SQLiteTestCacheProvider.swift */, - 9BEEDC2A24E61995001D1294 /* TestURLs.swift */, - 9BCF0CDC23FC9CA50031D2A2 /* XCTAssertHelpers.swift */, - 9FBE0D3F25407B64002ED0B1 /* AsyncResultObserver.swift */, - 9F68F9F025415827004F26D0 /* XCTestCase+Helpers.swift */, - DE12B2D6273B204B003371CC /* TestError.swift */, - 9B2061162591B3550020D1E0 /* Resources */, - DEC2EA89291D5E2E0088D3BB /* TestIsolatedFileManager.swift */, - E6931D4A29CE44EA005DD9E4 /* String+Data.swift */, - E6B1FEBA29F2FC97003D12E0 /* InterceptorTester.swift */, - ); - name = ApolloInternalTestHelpers; - path = Tests/ApolloInternalTestHelpers; - sourceTree = SOURCE_ROOT; - }; - 9BCF0CE923FC9F060031D2A2 /* StarWarsAPI */ = { - isa = PBXGroup; - children = ( - DE63895F28D3D63700559697 /* Sources */, - DECFEFE3286A3C8800DBE83C /* starwars-graphql */, - 9BCF0CFF23FC9F060031D2A2 /* Info.plist */, - ); - name = StarWarsAPI; - path = Sources/StarWarsAPI; - sourceTree = SOURCE_ROOT; - }; - 9BD681332405F6BB000874CB /* Codegen */ = { - isa = PBXGroup; - children = ( - 6608B3332A7D3FCB006FB655 /* CodegenConfiguration */, - 9B7B6F57233C287100F32205 /* ApolloCodegen.swift */, - 9B7B6F58233C287100F32205 /* ApolloCodegenConfiguration.swift */, - E674DB40274C0A9B009BB90E /* Glob.swift */, - DE5FD600276923620033EE23 /* TemplateString.swift */, - DED5B35A286CF16600AE6BFF /* TemplateString+CodegenConfiguration.swift */, - 534A754428EB21D6003291BE /* TemplateString+DeprecationMessage.swift */, - DE31A437276A78140020DC44 /* Templates */, - E6E3BBDC276A8D6200E5218B /* FileGenerators */, - ); - name = Codegen; - sourceTree = ""; - }; - 9BD681342405F6D1000874CB /* SchemaDownload */ = { - isa = PBXGroup; - children = ( - 9BAEEBEB234663F200808306 /* ApolloSchemaDownloader.swift */, - 9BAEEBED2346644600808306 /* ApolloSchemaDownloadConfiguration.swift */, - 9BCA8C0826618226004FF2F6 /* UntypedGraphQLRequestBodyCreator.swift */, - 9BFE8DA8265D5D8F000BBF81 /* URLDownloader.swift */, - ); - name = SchemaDownload; - sourceTree = ""; - }; - 9BDE43D222C6658D00FD7C7F /* Protocols */ = { - isa = PBXGroup; - children = ( - 9BDE43D022C6655200FD7C7F /* Cancellable.swift */, - ); - name = Protocols; - sourceTree = ""; - }; - 9BDF200723FDC37600153E2B /* GitHubAPI */ = { - isa = PBXGroup; - children = ( - DE6389F328D3D64400559697 /* Sources */, - 9B2061662591B3A50020D1E0 /* graphql */, - 9BDF201223FDC37600153E2B /* Info.plist */, - ); - name = GitHubAPI; - path = Sources/GitHubAPI; - sourceTree = SOURCE_ROOT; - }; - 9F1A96AE258F367100A06EEB /* Frontend */ = { - isa = PBXGroup; - children = ( - 9F1A96AF258F36B200A06EEB /* SchemaLoadingTests.swift */, - 9F62DF8D2590539A00E6E808 /* SchemaIntrospectionTests.swift */, - 9F62DFAD2590557F00E6E808 /* DocumentParsingAndValidationTests.swift */, - 9F62E00F2590728000E6E808 /* CompilationTests.swift */, - DED5B356286CD34000AE6BFF /* CompilationResultSchemaDocumentationTests.swift */, - ); - path = Frontend; - sourceTree = ""; - }; - 9F27D4601D40363A00715680 /* Execution */ = { - isa = PBXGroup; - children = ( - DE903E1629C10B7600A74415 /* FieldSelectionCollector.swift */, - DE8C51CB29EF454100E47A64 /* GraphQLExecutionSource.swift */, - DE8F7B6929F742B4005F3902 /* ExecutionSources */, - 9FA6F3671E65DF4700BF8D73 /* GraphQLResultAccumulator.swift */, - DE9C04AB26EA763E00EC35E7 /* Accumulators */, - 9FF90A5C1DDDEB100034C3B6 /* GraphQLExecutor.swift */, - DE0586322669948500265760 /* InputValue+Evaluation.swift */, - 9F7BA89822927A3700999B3B /* ResponsePath.swift */, - DE903E1229B7E6D300A74415 /* SelectionSet+JSONInitializer.swift */, - ); - name = Execution; - sourceTree = ""; - }; - 9F54C8B5255D760B0065AFD6 /* ApolloPerformanceTests */ = { - isa = PBXGroup; - children = ( - 9FD151B9255D7FAB003BDAAA /* Responses */, - 9F54C8B6255D760B0065AFD6 /* ParsingPerformanceTests.swift */, - DE903E1829CA20FC00A74415 /* TypeCaseConversionPerformanceTests.swift */, - DE903E2129CA622E00A74415 /* SelectionSetInitializerPerformanceTests.swift */, - 9F54C8B8255D760B0065AFD6 /* Info.plist */, - ); - path = ApolloPerformanceTests; - sourceTree = ""; - }; - 9FC4B9231D2BE4F00046A641 /* JSON */ = { - isa = PBXGroup; - children = ( - 9FEB050C1DB5732300DA3B44 /* JSONSerializationFormat.swift */, - 9BA1244922D8A8EA00BF1D24 /* JSONSerialization+Sorting.swift */, - ); - name = JSON; - sourceTree = ""; - }; - 9FC7503A1D2A532C00458D91 = { - isa = PBXGroup; - children = ( - 9B5A1EE3243284F300F066BB /* Package.swift */, - DE05862326697A8C00265760 /* ApolloAPI */, - 9FC750461D2A532C00458D91 /* Apollo */, - 9B7B6F50233C26E400F32205 /* ApolloCodegenLib */, - 9B7BDACC23FDEBE300ACD198 /* ApolloSQLite */, - 9B7BDA9323FDE94C00ACD198 /* ApolloWebSocket */, - DE2A20E929033147008ADE48 /* apollo-ios-cli */, - E687B3C928B398E600A9551C /* CodegenCLI */, - 9FCE2CF41E6C20E000E34457 /* Tests */, - DE9CEADE28299EEE00959AF9 /* ApolloTestSupport */, - 9BDF200723FDC37600153E2B /* GitHubAPI */, - 9BCF0CE923FC9F060031D2A2 /* StarWarsAPI */, - 9B2DFBC424E1FA3E00ED3AE6 /* UploadAPI */, - DE3C79A8260A6ACD00D2F4FF /* AnimalKingdomAPI */, - E66B836728093D7C001B3F2D /* SubscriptionAPI */, - 9B7BDAF923FDEE8A00ACD198 /* Frameworks */, - 90690D04224333DA00FC2E54 /* Configuration */, - 9FC750451D2A532C00458D91 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 9FC750451D2A532C00458D91 /* Products */ = { - isa = PBXGroup; - children = ( - 9FC750441D2A532C00458D91 /* Apollo.framework */, - 9FC7504E1D2A532D00458D91 /* ApolloTests.xctest */, - 9FCE2CFA1E6C213D00E34457 /* StarWarsAPI.framework */, - 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */, - 9FACA9C61F42E67200AE2DBD /* GitHubAPI.framework */, - 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */, - 9BAEEBFC234BB8FD00808306 /* ApolloCodegenTests.xctest */, - 9B7BDA7D23FDE90400ACD198 /* ApolloWebSocket.framework */, - 9B7BDABF23FDEBB600ACD198 /* ApolloSQLite.framework */, - 9B2DFBB624E1FA0D00ED3AE6 /* UploadAPI.framework */, - 9B2DFBCA24E2016800ED3AE6 /* UploadAPI.framework */, - 9F54C8B4255D760B0065AFD6 /* ApolloPerformanceTests.xctest */, - DE3C7A11260A6B9800D2F4FF /* AnimalKingdomAPI.framework */, - DE6B15AC26152BE10068D642 /* ApolloServerIntegrationTests.xctest */, - DECD490B262F81BF00924527 /* ApolloCodegenInternalTestHelpers.framework */, - DE058621266978A100265760 /* ApolloAPI.framework */, - E66B836628093D7C001B3F2D /* SubscriptionAPI.framework */, - DE9CEADC28299E8500959AF9 /* ApolloTestSupport.framework */, - E687B3C128B398CB00A9551C /* CodegenCLI.framework */, - E6DC0ABE28B3AB890064A68F /* CodegenCLITests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 9FC750461D2A532C00458D91 /* Apollo */ = { - isa = PBXGroup; - children = ( - B9C00759298308F900855D2B /* ApolloMath.swift */, - 9FC750621D2A59F600458D91 /* ApolloClient.swift */, - 9B708AAC2305884500604A11 /* ApolloClientProtocol.swift */, - 9FCDFD281E33D0CE007519DC /* GraphQLQueryWatcher.swift */, - B9C0075D298312FD00855D2B /* GraphQLFirstReceivedAtTracker.swift */, - 9FC9A9BE1E2C27FB0023C4D5 /* GraphQLResult.swift */, - 9FC9A9D21E2FD48B0023C4D5 /* GraphQLError.swift */, - 9F27D4601D40363A00715680 /* Execution */, - 9FC4B9231D2BE4F00046A641 /* JSON */, - 9FC9A9CE1E2FD0CC0023C4D5 /* Network */, - 9BDE43D222C6658D00FD7C7F /* Protocols */, - 9FC9A9CA1E2FD05C0023C4D5 /* Store */, - 9FE3F3961DADBD0D0072078F /* Supporting Files */, - 9FCDFD211E33A09F007519DC /* Utilities */, - DE100B17287F3FB100BE11C2 /* Documentation.docc */, - ); - name = Apollo; - path = Sources/Apollo; - sourceTree = ""; - }; - 9FC750521D2A532D00458D91 /* ApolloTests */ = { - isa = PBXGroup; - children = ( - 66B18E862A15366400525DFB /* Network */, - DED45DE8261B969F0086EF63 /* Cache */, - 9B0417812390320A00C9EC4E /* TestHelpers */, - DED45E9B261BA0CA0086EF63 /* WebSocket */, - DE46A55926F13B4100357C52 /* Interceptors */, - DE5144AF2A046F7E00D991E9 /* ExecutionSources */, - D87AC09E2564D60B0079FAA5 /* ApolloClientOperationTests.swift */, - F82E62E022BCD223000C311B /* AutomaticPersistedQueriesTests.swift */, - 9F438D0B1E6C494C007BDC1A /* BatchedLoadTests.swift */, - 9FC9A9C71E2EFE6E0023C4D5 /* CacheKeyForFieldTests.swift */, - DE299E952A0D7916000F71D2 /* SelectionField_CacheKeyForFieldTests.swift */, - E6CD6F4A2887202900DC9F3F /* CacheKeyResolutionTests.swift */, - 9FADC8531E6B86D900C677E6 /* DataLoaderTests.swift */, - DED45C292615319E0086EF63 /* DefaultInterceptorProviderTests.swift */, - 9B78C71B2326E859000C8C32 /* ErrorGenerationTests.swift */, - E616B6D026C3335600DB049E /* ClearCacheTests.swift */, - 9B95EDBF22CAA0AF00702BB2 /* GETTransformerTests.swift */, - 9B21FD742422C29D00998B5C /* GraphQLFileTests.swift */, - 9FF90A6A1DDDEB420034C3B6 /* GraphQLMapEncodingTests.swift */, - E6EE6F1129C141A600BDE7A5 /* HTTPURLResponseExtensionTests.swift */, - E86D8E03214B32DA0028EFE1 /* JSONTests.swift */, - 9BF6C95225194EA5000D5B93 /* MultipartFormDataTests.swift */, - 9F91CF8E1F6C0DB2008DD0BE /* MutatingSelectionSetTests.swift */, - DEFE695A28205321001CF4E8 /* SelectionSetTests.swift */, - 9F295E301E27534800A24949 /* GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift */, - 9FF90A6B1DDDEB420034C3B6 /* GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift */, - 9FF90A6C1DDDEB420034C3B6 /* ParseQueryResponseTests.swift */, - 9F21735A2568F3E200566121 /* PossiblyDeferredTests.swift */, - F16D083B21EF6F7300C458B8 /* SelectionSet_JSONInitializerTests.swift */, - C338DF1622DD9DE9006AF33E /* RequestBodyCreatorTests.swift */, - 9B96500824BE6201003C29C0 /* RequestChainTests.swift */, - 07236D322A992498009BFF7B /* RequestContextTests.swift */, - E61DD76426D60C1800C41614 /* SQLiteDotSwiftDatabaseBehaviorTests.swift */, - 9B9BBB1A24DB75E60021C30F /* UploadRequestTests.swift */, - 5BB2C0222380836100774170 /* VersionNumberTests.swift */, - E6057F8A287D7E24007D84EC /* ResponsePathTests.swift */, - DE2FCF4826E94D150057EA67 /* TestMockTests.swift */, - DE5EB9C626EFE0F80004176A /* JSONValueMatcher.swift */, - 9FC750551D2A532D00458D91 /* Info.plist */, - ); - path = ApolloTests; - sourceTree = ""; - }; - 9FC9A9CA1E2FD05C0023C4D5 /* Store */ = { - isa = PBXGroup; - children = ( - 9F55347A1DE1DB2100E54264 /* ApolloStore.swift */, - 9FADC84E1E6B865E00C677E6 /* DataLoader.swift */, - 54DDB0911EA045870009DD99 /* InMemoryNormalizedCache.swift */, - 9FCE2CED1E6BE2D800E34457 /* NormalizedCache.swift */, - 9FC9A9CB1E2FD0760023C4D5 /* Record.swift */, - 9FC9A9BC1E2C271C0023C4D5 /* RecordSet.swift */, - ); - name = Store; - sourceTree = ""; - }; - 9FC9A9CE1E2FD0CC0023C4D5 /* Network */ = { - isa = PBXGroup; - children = ( - 9B260C02245A07C200562176 /* RequestChain */, - 9B260BE9245A01B900562176 /* Interceptor */, - C377CCA822D798BD00572E03 /* GraphQLFile.swift */, - 9BF1A95022CA6E71005292C2 /* GraphQLGETTransformer.swift */, - 5AC6CA4222AAF7B200B7C94D /* GraphQLHTTPMethod.swift */, - 9BDE43DE22C6708600FD7C7F /* GraphQLHTTPRequestError.swift */, - 9FF90A5B1DDDEB100034C3B6 /* GraphQLResponse.swift */, - C377CCAA22D7992E00572E03 /* MultipartFormData.swift */, - 9F69FFA81D42855900E000B1 /* NetworkTransport.swift */, - 9BEDC79D22E5D2CF00549BF6 /* RequestBodyCreator.swift */, - 9B4F453E244A27B900C2CF7D /* URLSessionClient.swift */, - 9B554CC3247DC29A002F452A /* TaskData.swift */, - ); - name = Network; - sourceTree = ""; - }; - 9FCDFD211E33A09F007519DC /* Utilities */ = { - isa = PBXGroup; - children = ( - 9B6CB23D238077B60007259D /* Atomic.swift */, - 9B1CCDD82360F02C007C9032 /* Bundle+Helpers.swift */, - 9BE071AC2368D08700FA5952 /* Collection+Helpers.swift */, - 9BA3130D2302BEA5007B7FC5 /* DispatchQueue+Optional.swift */, - 9F578D8F1D8D2CB300C0EA36 /* HTTPURLResponse+Helpers.swift */, - 9F33D6A32566475600A1543F /* PossiblyDeferred.swift */, - DE0586382669985000265760 /* Dictionary+Helpers.swift */, - ); - name = Utilities; - sourceTree = ""; - }; - 9FCE2CF41E6C20E000E34457 /* Tests */ = { - isa = PBXGroup; - children = ( - DE4B66B726260EBE00AE90A9 /* TestPlans */, - 9FC750521D2A532D00458D91 /* ApolloTests */, - 9F54C8B5255D760B0065AFD6 /* ApolloPerformanceTests */, - 9BAEEC0A234BB95B00808306 /* ApolloCodegenTests */, - DE6B15AD26152BE10068D642 /* ApolloServerIntegrationTests */, - DECD490C262F81BF00924527 /* ApolloCodegenInternalTestHelpers */, - 9BCF0CD823FC9CA50031D2A2 /* ApolloInternalTestHelpers */, - E6DC0AC928B3AC490064A68F /* CodegenCLITests */, - ); - path = Tests; - sourceTree = ""; - }; - 9FD151B9255D7FAB003BDAAA /* Responses */ = { - isa = PBXGroup; - children = ( - 9FD15199255D7F30003BDAAA /* IssuesAndCommentsForRepository.json */, - ); - path = Responses; - sourceTree = ""; - }; - 9FE1E54C2588C5E000AA967E /* Frontend */ = { - isa = PBXGroup; - children = ( - E63F0C0028EE099A009069EA /* ApolloCodegenFrontendBundle.swift */, - 9F1A9665258F34BB00A06EEB /* GraphQLJSFrontend.swift */, - 9F62DFCF2590710E00E6E808 /* GraphQLSource.swift */, - 9F1A9667258F34BB00A06EEB /* GraphQLSchema.swift */, - 9F628E9425935BE600F94F9D /* GraphQLType.swift */, - 9F628EB42593651B00F94F9D /* GraphQLValue.swift */, - 9F62E03E2590896400E6E808 /* GraphQLError.swift */, - 9F1A9668258F34BB00A06EEB /* CompilationResult.swift */, - DE01451328A5A156000F6F18 /* ValidationOptions.swift */, - 9F1A966A258F34BB00A06EEB /* JavaScriptBridge.swift */, - ); - path = Frontend; - sourceTree = ""; - }; - 9FE3F3961DADBD0D0072078F /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 9FC750471D2A532C00458D91 /* Apollo.h */, - 9FC750491D2A532C00458D91 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - DE05862326697A8C00265760 /* ApolloAPI */ = { - isa = PBXGroup; - children = ( - 9FC9A9C11E2D3CAF0023C4D5 /* InputValue.swift */, - DE3C7B15260A6FCA00D2F4FF /* ScalarTypes.swift */, - 9FC4B91F1D2A6F8D0046A641 /* JSON.swift */, - DE1C6EFF284161DE0050164B /* AnyHashableConvertible.swift */, - 9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */, - DE9C04B026EAAFF900EC35E7 /* JSONDecodingError.swift */, - DE2FCF2226E8082A0057EA67 /* SchemaTypes */, - DE9C04AE26EAAEE800EC35E7 /* CacheReference.swift */, - 9B68F06E241C649E00E97318 /* GraphQLNullable.swift */, - DE3C7B12260A6FC900D2F4FF /* FragmentProtocols.swift */, - DE3C7B14260A6FCA00D2F4FF /* GraphQLEnum.swift */, - DE3C7B10260A6FC900D2F4FF /* SelectionSet.swift */, - DEA6A83326F298660091AF8A /* ParentType.swift */, - DE03FDDA2784D0B2007425BD /* DataDict.swift */, - DE2FCF1C26E806710057EA67 /* SchemaConfiguration.swift */, - DE299E912A0D6FD6000F71D2 /* ObjectData.swift */, - DE80003328B5608E00C827BD /* SchemaMetadata.swift */, - DE5E79BE289DBCE700CD0DE5 /* CacheKeyInfo.swift */, - DE664ED326602AF60054DB4F /* Selection.swift */, - DE90FDB927FE405F0084CC79 /* Selection+Conditions.swift */, - DECD53CE26EC0EE50059A639 /* OutputTypeConvertible.swift */, - 9FC750601D2A59C300458D91 /* GraphQLOperation.swift */, - DE64C1F6284033BA00F64B9D /* LocalCacheMutation.swift */, - DE05862426697A8C00265760 /* Info.plist */, - DE100B1B28872F4200BE11C2 /* Documentation.docc */, - ); - name = ApolloAPI; - path = Sources/ApolloAPI; - sourceTree = ""; - }; - DE09F9C4270269F800795949 /* CodeGeneration */ = { - isa = PBXGroup; - children = ( - E66F8895276C13330000BDA8 /* FileGenerators */, - DE31A438276A789B0020DC44 /* Templates */, - ); - path = CodeGeneration; - sourceTree = ""; - }; - DE223C3227221116004A0148 /* TestHelpers */ = { - isa = PBXGroup; - children = ( - DE223C2A2721FAD6004A0148 /* IRMatchers.swift */, - 9B68F0542416B33300E97318 /* LineByLineComparison.swift */, - ); - path = TestHelpers; - sourceTree = ""; - }; - DE296535279B3B8200BF9B49 /* SelectionSet */ = { - isa = PBXGroup; - children = ( - DE296536279B3B8200BF9B49 /* SelectionSetTemplateTests.swift */, - DE71FDC32853D681005FA9CC /* SelectionSetTemplate_LocalCacheMutation_Tests.swift */, - DE1696D3298C51CF00345E1A /* SelectionSetTemplate_Initializers_Tests.swift */, - ); - path = SelectionSet; - sourceTree = ""; - }; - DE2A20E929033147008ADE48 /* apollo-ios-cli */ = { - isa = PBXGroup; - children = ( - DE2A20EA29033147008ADE48 /* README.md */, - DE2A20EB29033147008ADE48 /* main.swift */, - ); - name = "apollo-ios-cli"; - path = "Sources/apollo-ios-cli"; - sourceTree = SOURCE_ROOT; - }; - DE2FCF2226E8082A0057EA67 /* SchemaTypes */ = { - isa = PBXGroup; - children = ( - DE2FCF2426E8083A0057EA67 /* Interface.swift */, - DE2FCF2526E8083A0057EA67 /* Object.swift */, - DE2FCF2326E8083A0057EA67 /* Union.swift */, - DE09F9BC27024FEA00795949 /* InputObject.swift */, - DE4B1E532889EF330058D1F6 /* EnumType.swift */, - ); - path = SchemaTypes; - sourceTree = ""; - }; - DE2FCF3326E809A30057EA67 /* AnimalKingdomAPI */ = { - isa = PBXGroup; - children = ( - DE223C1B271F3288004A0148 /* AnimalKingdomIRCreationTests.swift */, - ); - path = AnimalKingdomAPI; - sourceTree = ""; - }; - DE31A437276A78140020DC44 /* Templates */ = { - isa = PBXGroup; - children = ( - DE6D07FC27BC3C81009F5F33 /* RenderingHelpers */, - E669352A2803EE11004E1FFC /* CustomScalarTemplate.swift */, - E6C9849227929EBE009481BE /* EnumTemplate.swift */, - DE5FD60A276970FC0033EE23 /* FragmentTemplate.swift */, - E69BEDA42798B86D00000D10 /* InputObjectTemplate.swift */, - E623FD292797A6F4008B4CED /* InterfaceTemplate.swift */, - DE71FDBB2853B67C005FA9CC /* LocalCacheMutationDefinitionTemplate.swift */, - DE9CEAEE282C62B700959AF9 /* MockObjectTemplate.swift */, - E6203343284F1D1100A291D1 /* MockUnionsTemplate.swift */, - DEB05B49289C3EC300170299 /* MockInterfacesTemplate.swift */, - E64F7EC027A122300059C021 /* ObjectTemplate.swift */, - DE5FD5FC2769222D0033EE23 /* OperationDefinitionTemplate.swift */, - E6AAA738286C87EA00F4659D /* LegacyAPQOperationManifestTemplate.swift */, - DEF330342A4B6DEE0081883D /* PersistedQueriesOperationManifestTemplate.swift */, - E6EE62F027DBE6F200627257 /* SchemaModuleNamespaceTemplate.swift */, - DE5FD60427694FA70033EE23 /* SchemaMetadataTemplate.swift */, - DE454BAA28B40E56009DC80E /* SchemaConfigurationTemplate.swift */, - DE2739102769AEBA00B886EF /* SelectionSetTemplate.swift */, - E6B42D0827A472A700A3BD58 /* SwiftPackageManagerModuleTemplate.swift */, - E60AE2ED27E3FC6C003C093A /* TemplateRenderer.swift */, - E64F7EB727A0854E0059C021 /* UnionTemplate.swift */, - ); - path = Templates; - sourceTree = ""; - }; - DE31A438276A789B0020DC44 /* Templates */ = { - isa = PBXGroup; - children = ( - DE296535279B3B8200BF9B49 /* SelectionSet */, - E669352C2803EF67004E1FFC /* CustomScalarTemplateTests.swift */, - E6C9849427929FED009481BE /* EnumTemplateTests.swift */, - DE5FD60C2769711E0033EE23 /* FragmentTemplateTests.swift */, - E69BEDA62798B89600000D10 /* InputObjectTemplateTests.swift */, - E623FD2B2797A700008B4CED /* InterfaceTemplateTests.swift */, - DE71FDBD2853B6D3005FA9CC /* LocalCacheMutationDefinitionTemplateTests.swift */, - DE9CEAF0282C632B00959AF9 /* MockObjectTemplateTests.swift */, - E6203347284F25DF00A291D1 /* MockUnionsTemplateTests.swift */, - DE5E79BC289DA97E00CD0DE5 /* MockInterfacesTemplateTests.swift */, - E64F7EC227A1243A0059C021 /* ObjectTemplateTests.swift */, - DE6D07FA27BC3BE9009F5F33 /* OperationDefinition_VariableDefinition_Tests.swift */, - DE09F9C5270269F800795949 /* OperationDefinitionTemplate_DocumentType_Tests.swift */, - DE09066E27A4713F00211300 /* OperationDefinitionTemplateTests.swift */, - E6AAA73A286CC7EF00F4659D /* LegacyAPQOperationManifestTemplateTests.swift */, - DEF330362A4B6EAA0081883D /* PersistedQueriesOperationManifestTemplateTests.swift */, - E6EE62F227DBE75A00627257 /* SchemaModuleNamespaceTemplateTests.swift */, - DE5FD608276956C70033EE23 /* SchemaMetadataTemplateTests.swift */, - DE454BB428B43058009DC80E /* SchemaConfigurationTemplateTests.swift */, - E6B42D0C27A4749100A3BD58 /* SwiftPackageManagerModuleTemplateTests.swift */, - E6EFDD1327EAB55B00B17FE5 /* TemplateRenderer_OperationFile_Tests.swift */, - E6EFDD0A27E8328E00B17FE5 /* TemplateRenderer_SchemaFile_Tests.swift */, - DE9CEAF2282C6AC300959AF9 /* TemplateRenderer_TestMockFile_Tests.swift */, - E64F7EB927A085D90059C021 /* UnionTemplateTests.swift */, - DED5B358286CEA0900AE6BFF /* TemplateString_Documentation_Tests.swift */, - E60F457929E4CFB800E60A04 /* TemplateString_DeprecationMessage_Tests.swift */, - ); - path = Templates; - sourceTree = ""; - }; - DE3C79A8260A6ACD00D2F4FF /* AnimalKingdomAPI */ = { - isa = PBXGroup; - children = ( - DE6388E028D3BFBA00559697 /* Sources */, - 96F32D3A27CCD16B00F3383C /* animalkingdom-graphql */, - DE3C79AA260A6ACD00D2F4FF /* Info.plist */, - DE223C23271F335D004A0148 /* Resources.swift */, - ); - name = AnimalKingdomAPI; - path = Sources/AnimalKingdomAPI; - sourceTree = ""; - }; - DE46A55926F13B4100357C52 /* Interceptors */ = { - isa = PBXGroup; - children = ( - 9BC139A224EDCA4400876D29 /* MaxRetryInterceptorTests.swift */, - DE46A55726F13AD000357C52 /* ResponseCodeInterceptorTests.swift */, - DE46A55426F13A0900357C52 /* JSONResponseParsingInterceptorTests.swift */, - E6B2B26B29C2447F004B16F4 /* MultipartResponseParsingInterceptorTests.swift */, - ); - path = Interceptors; - sourceTree = ""; - }; - DE4B66B726260EBE00AE90A9 /* TestPlans */ = { - isa = PBXGroup; - children = ( - DED45DC7261682260086EF63 /* Apollo-UnitTestPlan.xctestplan */, - DED45C3B26165DD70086EF63 /* Apollo-IntegrationTestPlan.xctestplan */, - DED45FB1261CDE7D0086EF63 /* Apollo-PerformanceTestPlan.xctestplan */, - DED45FB2261CDE980086EF63 /* Apollo-CITestPlan.xctestplan */, - DED45FB3261CDEC60086EF63 /* Apollo-CodegenTestPlan.xctestplan */, - DE3DAAA828F761CF003FB074 /* Apollo-Codegen-CITestPlan.xctestplan */, - E699DE9428B3C20E004ECF19 /* CodegenCLITestPlan.xctestplan */, - ); - path = TestPlans; - sourceTree = ""; - }; - DE5144AF2A046F7E00D991E9 /* ExecutionSources */ = { - isa = PBXGroup; - children = ( - DE8F7B7029FC24A8005F3902 /* SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift */, - DE5144B02A04703F00D991E9 /* NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift */, - ); - path = ExecutionSources; - sourceTree = ""; - }; - DE6388E028D3BFBA00559697 /* Sources */ = { - isa = PBXGroup; - children = ( - DE6388E128D3BFBA00559697 /* Fragments */, - DE6388E828D3BFBA00559697 /* LocalCacheMutations */, - DE6388EB28D3BFBA00559697 /* Operations */, - DE6388F628D3BFBA00559697 /* Schema */, - ); - name = Sources; - path = AnimalKingdomAPI/Sources; - sourceTree = ""; - }; - DE6388E128D3BFBA00559697 /* Fragments */ = { - isa = PBXGroup; - children = ( - DE6388E228D3BFBA00559697 /* PetDetails.graphql.swift */, - DE6388E328D3BFBA00559697 /* HeightInMeters.graphql.swift */, - DE6388E428D3BFBA00559697 /* ClassroomPetDetails.graphql.swift */, - DE6388E528D3BFBA00559697 /* DogFragment.graphql.swift */, - DE6388E628D3BFBA00559697 /* ClassroomPetDetailsCCN.graphql.swift */, - DE6388E728D3BFBA00559697 /* WarmBloodedDetails.graphql.swift */, - ); - path = Fragments; - sourceTree = ""; - }; - DE6388E828D3BFBA00559697 /* LocalCacheMutations */ = { - isa = PBXGroup; - children = ( - DE6388E928D3BFBA00559697 /* PetDetailsMutation.graphql.swift */, - E6936F152908AD8D0089054C /* PetSearchLocalCacheMutation.graphql.swift */, - DE6388EA28D3BFBA00559697 /* AllAnimalsLocalCacheMutation.graphql.swift */, - ); - path = LocalCacheMutations; - sourceTree = ""; - }; - DE6388EB28D3BFBA00559697 /* Operations */ = { - isa = PBXGroup; - children = ( - DE6388EC28D3BFBA00559697 /* Mutations */, - DE6388EE28D3BFBA00559697 /* Queries */, - ); - path = Operations; - sourceTree = ""; - }; - DE6388EC28D3BFBA00559697 /* Mutations */ = { - isa = PBXGroup; - children = ( - DE6388ED28D3BFBA00559697 /* PetAdoptionMutation.graphql.swift */, - ); - path = Mutations; - sourceTree = ""; - }; - DE6388EE28D3BFBA00559697 /* Queries */ = { - isa = PBXGroup; - children = ( - DE6388EF28D3BFBA00559697 /* DogQuery.graphql.swift */, - DE6388F028D3BFBA00559697 /* AllAnimalsCCNQuery.graphql.swift */, - DE6388F128D3BFBA00559697 /* ClassroomPetsQuery.graphql.swift */, - DE6388F228D3BFBA00559697 /* ClassroomPetsCCNQuery.graphql.swift */, - DE6388F328D3BFBA00559697 /* AllAnimalsQuery.graphql.swift */, - DE6388F428D3BFBA00559697 /* AllAnimalsIncludeSkipQuery.graphql.swift */, - DE6388F528D3BFBA00559697 /* PetSearchQuery.graphql.swift */, - ); - path = Queries; - sourceTree = ""; - }; - DE6388F628D3BFBA00559697 /* Schema */ = { - isa = PBXGroup; - children = ( - DE6388F728D3BFBA00559697 /* Unions */, - DE6388F928D3BFBA00559697 /* CustomScalars */, - DE6388FB28D3BFBA00559697 /* Enums */, - DE6388FE28D3BFBA00559697 /* Objects */, - DE63890A28D3BFBA00559697 /* SchemaConfiguration.swift */, - DE63890B28D3BFBA00559697 /* InputObjects */, - DE63890F28D3BFBA00559697 /* SchemaMetadata.graphql.swift */, - DE63891028D3BFBA00559697 /* Interfaces */, - ); - path = Schema; - sourceTree = ""; - }; - DE6388F728D3BFBA00559697 /* Unions */ = { - isa = PBXGroup; - children = ( - DE6388F828D3BFBA00559697 /* ClassroomPet.graphql.swift */, - ); - path = Unions; - sourceTree = ""; - }; - DE6388F928D3BFBA00559697 /* CustomScalars */ = { - isa = PBXGroup; - children = ( - DE6388FA28D3BFBA00559697 /* CustomDate.swift */, - ); - path = CustomScalars; - sourceTree = ""; - }; - DE6388FB28D3BFBA00559697 /* Enums */ = { - isa = PBXGroup; - children = ( - DE6388FC28D3BFBA00559697 /* SkinCovering.graphql.swift */, - DE6388FD28D3BFBA00559697 /* RelativeSize.graphql.swift */, - ); - path = Enums; - sourceTree = ""; - }; - DE6388FE28D3BFBA00559697 /* Objects */ = { - isa = PBXGroup; - children = ( - DE6388FF28D3BFBA00559697 /* Rat.graphql.swift */, - DE63890028D3BFBA00559697 /* Bird.graphql.swift */, - DE63890128D3BFBA00559697 /* PetRock.graphql.swift */, - DE63890228D3BFBA00559697 /* Dog.graphql.swift */, - DE63890328D3BFBA00559697 /* Height.graphql.swift */, - DE63890428D3BFBA00559697 /* Mutation.graphql.swift */, - DE63890528D3BFBA00559697 /* Query.graphql.swift */, - DE63890628D3BFBA00559697 /* Cat.graphql.swift */, - DE63890728D3BFBA00559697 /* Fish.graphql.swift */, - DE63890828D3BFBA00559697 /* Human.graphql.swift */, - DE63890928D3BFBA00559697 /* Crocodile.graphql.swift */, - ); - path = Objects; - sourceTree = ""; - }; - DE63890B28D3BFBA00559697 /* InputObjects */ = { - isa = PBXGroup; - children = ( - DE63890C28D3BFBA00559697 /* PetAdoptionInput.graphql.swift */, - DE63890D28D3BFBA00559697 /* PetSearchFilters.graphql.swift */, - DE63890E28D3BFBA00559697 /* MeasurementsInput.graphql.swift */, - ); - path = InputObjects; - sourceTree = ""; - }; - DE63891028D3BFBA00559697 /* Interfaces */ = { - isa = PBXGroup; - children = ( - DE63891128D3BFBA00559697 /* HousePet.graphql.swift */, - DE63891228D3BFBA00559697 /* Pet.graphql.swift */, - DE63891328D3BFBA00559697 /* Animal.graphql.swift */, - DE63891428D3BFBA00559697 /* WarmBlooded.graphql.swift */, - ); - path = Interfaces; - sourceTree = ""; - }; - DE63893D28D3D60600559697 /* Sources */ = { - isa = PBXGroup; - children = ( - DE63893E28D3D60600559697 /* Operations */, - DE63894128D3D60600559697 /* Schema */, - ); - name = Sources; - path = SubscriptionAPI/Sources; - sourceTree = ""; - }; - DE63893E28D3D60600559697 /* Operations */ = { - isa = PBXGroup; - children = ( - DE63893F28D3D60600559697 /* Subscriptions */, - ); - path = Operations; - sourceTree = ""; - }; - DE63893F28D3D60600559697 /* Subscriptions */ = { - isa = PBXGroup; - children = ( - DE63894028D3D60600559697 /* IncrementingSubscription.graphql.swift */, - ); - path = Subscriptions; - sourceTree = ""; - }; - DE63894128D3D60600559697 /* Schema */ = { - isa = PBXGroup; - children = ( - DE63894228D3D60600559697 /* Objects */, - DE63894428D3D60600559697 /* SchemaConfiguration.swift */, - DE63894528D3D60600559697 /* SchemaMetadata.graphql.swift */, - ); - path = Schema; - sourceTree = ""; - }; - DE63894228D3D60600559697 /* Objects */ = { - isa = PBXGroup; - children = ( - DE63894328D3D60600559697 /* Subscription.graphql.swift */, - ); - path = Objects; - sourceTree = ""; - }; - DE63894A28D3D62400559697 /* Operations */ = { - isa = PBXGroup; - children = ( - DE63894B28D3D62400559697 /* Mutations */, - ); - name = Operations; - path = UploadAPI/Sources/Operations; - sourceTree = ""; - }; - DE63894B28D3D62400559697 /* Mutations */ = { - isa = PBXGroup; - children = ( - DE63894C28D3D62400559697 /* UploadMultipleFilesToTheSameParameterMutation.graphql.swift */, - DE63894D28D3D62400559697 /* UploadOneFileMutation.graphql.swift */, - DE63894E28D3D62400559697 /* UploadMultipleFilesToDifferentParametersMutation.graphql.swift */, - ); - path = Mutations; - sourceTree = ""; - }; - DE63894F28D3D62400559697 /* Schema */ = { - isa = PBXGroup; - children = ( - DE63895028D3D62400559697 /* CustomScalars */, - DE63895228D3D62400559697 /* Objects */, - DE63895528D3D62400559697 /* SchemaConfiguration.swift */, - DE63895628D3D62400559697 /* SchemaMetadata.graphql.swift */, - ); - name = Schema; - path = UploadAPI/Sources/Schema; - sourceTree = ""; - }; - DE63895028D3D62400559697 /* CustomScalars */ = { - isa = PBXGroup; - children = ( - DE63895128D3D62400559697 /* Upload.swift */, - ); - path = CustomScalars; - sourceTree = ""; - }; - DE63895228D3D62400559697 /* Objects */ = { - isa = PBXGroup; - children = ( - DE63895328D3D62400559697 /* File.graphql.swift */, - DE63895428D3D62400559697 /* Mutation.graphql.swift */, - ); - path = Objects; - sourceTree = ""; - }; - DE63895F28D3D63700559697 /* Sources */ = { - isa = PBXGroup; - children = ( - DE63896028D3D63700559697 /* Fragments */, - DE63897028D3D63700559697 /* Operations */, - DE63899B28D3D63800559697 /* Schema */, - ); - name = Sources; - path = StarWarsAPI/Sources; - sourceTree = ""; - }; - DE63896028D3D63700559697 /* Fragments */ = { - isa = PBXGroup; - children = ( - DE63896128D3D63700559697 /* DroidNameAndPrimaryFunction.graphql.swift */, - DE63896228D3D63700559697 /* HeroDetails.graphql.swift */, - DE63896328D3D63700559697 /* DroidPrimaryFunction.graphql.swift */, - DE63896428D3D63700559697 /* FriendsNames.graphql.swift */, - DE63896528D3D63700559697 /* CharacterName.graphql.swift */, - DE63896628D3D63700559697 /* CharacterNameAndAppearsIn.graphql.swift */, - DE63896728D3D63700559697 /* DroidName.graphql.swift */, - DE63896828D3D63700559697 /* CharacterNameAndDroidAppearsIn.graphql.swift */, - DE63896928D3D63700559697 /* HumanHeightWithVariable.graphql.swift */, - DE63896A28D3D63700559697 /* CharacterNameWithInlineFragment.graphql.swift */, - DE63896B28D3D63700559697 /* CharacterNameAndAppearsInWithNestedFragments.graphql.swift */, - DE63896C28D3D63700559697 /* DroidDetails.graphql.swift */, - DE63896D28D3D63700559697 /* CharacterNameWithNestedAppearsInFragment.graphql.swift */, - DE63896E28D3D63700559697 /* CharacterNameAndDroidPrimaryFunction.graphql.swift */, - DE63896F28D3D63700559697 /* CharacterAppearsIn.graphql.swift */, - ); - path = Fragments; - sourceTree = ""; - }; - DE63897028D3D63700559697 /* Operations */ = { - isa = PBXGroup; - children = ( - DE63897128D3D63700559697 /* Mutations */, - DE63897528D3D63700559697 /* Queries */, - DE63899928D3D63800559697 /* Subscriptions */, - ); - path = Operations; - sourceTree = ""; - }; - DE63897128D3D63700559697 /* Mutations */ = { - isa = PBXGroup; - children = ( - DE63897228D3D63700559697 /* CreateAwesomeReviewMutation.graphql.swift */, - DE63897328D3D63700559697 /* CreateReviewForEpisodeMutation.graphql.swift */, - DE63897428D3D63700559697 /* CreateReviewWithNullFieldMutation.graphql.swift */, - ); - path = Mutations; - sourceTree = ""; - }; - DE63897528D3D63700559697 /* Queries */ = { - isa = PBXGroup; - children = ( - DE63897628D3D63700559697 /* HeroDetailsQuery.graphql.swift */, - DE63897728D3D63700559697 /* HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift */, - DE63897828D3D63700559697 /* HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift */, - DE63897928D3D63700559697 /* SearchQuery.graphql.swift */, - DE63897A28D3D63700559697 /* HeroNameWithIDQuery.graphql.swift */, - DE63897B28D3D63700559697 /* HeroAndFriendsNamesWithFragmentQuery.graphql.swift */, - DE63897C28D3D63700559697 /* HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift */, - DE63897D28D3D63700559697 /* HeroDetailsFragmentConditionalInclusionQuery.graphql.swift */, - DE63897E28D3D63700559697 /* HeroAppearsInQuery.graphql.swift */, - DE63897F28D3D63700559697 /* HeroNameAndAppearsInWithFragmentQuery.graphql.swift */, - DE63898028D3D63700559697 /* DroidDetailsWithFragmentQuery.graphql.swift */, - DE63898128D3D63700559697 /* HeroDetailsWithFragmentQuery.graphql.swift */, - DE63898228D3D63700559697 /* HeroNameWithFragmentAndIDQuery.graphql.swift */, - DE63898328D3D63700559697 /* HeroNameConditionalBothSeparateQuery.graphql.swift */, - DE63898428D3D63700559697 /* StarshipCoordinatesQuery.graphql.swift */, - DE63898528D3D63700559697 /* HeroNameConditionalBothQuery.graphql.swift */, - DE63898628D3D63700559697 /* HeroAndFriendsNamesWithIDsQuery.graphql.swift */, - DE63898728D3D63700559697 /* HeroNameConditionalExclusionQuery.graphql.swift */, - DE63898828D3D63700559697 /* HeroNameAndAppearsInQuery.graphql.swift */, - DE63898928D3D63700559697 /* HeroFriendsDetailsConditionalInclusionQuery.graphql.swift */, - DE63898A28D3D63700559697 /* HeroDetailsInlineConditionalInclusionQuery.graphql.swift */, - DE63898B28D3D63700559697 /* HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift */, - DE63898C28D3D63700559697 /* StarshipQuery.graphql.swift */, - DE63898D28D3D63700559697 /* HumanQuery.graphql.swift */, - DE63898E28D3D63700559697 /* HeroAndFriendsNamesQuery.graphql.swift */, - DE63898F28D3D63700559697 /* HeroTypeDependentAliasedFieldQuery.graphql.swift */, - DE63899028D3D63700559697 /* HeroNameWithFragmentQuery.graphql.swift */, - DE63899128D3D63800559697 /* HeroParentTypeDependentFieldQuery.graphql.swift */, - DE63899228D3D63800559697 /* TwoHeroesQuery.graphql.swift */, - DE63899328D3D63800559697 /* HeroNameConditionalInclusionQuery.graphql.swift */, - DE63899428D3D63800559697 /* HeroFriendsOfFriendsNamesQuery.graphql.swift */, - DE63899528D3D63800559697 /* HeroNameQuery.graphql.swift */, - DE63899628D3D63800559697 /* SameHeroTwiceQuery.graphql.swift */, - DE63899728D3D63800559697 /* HeroAndFriendsIDsQuery.graphql.swift */, - DE63899828D3D63800559697 /* HeroAppearsInWithFragmentQuery.graphql.swift */, - ); - path = Queries; - sourceTree = ""; - }; - DE63899928D3D63800559697 /* Subscriptions */ = { - isa = PBXGroup; - children = ( - DE63899A28D3D63800559697 /* ReviewAddedSubscription.graphql.swift */, - ); - path = Subscriptions; - sourceTree = ""; - }; - DE63899B28D3D63800559697 /* Schema */ = { - isa = PBXGroup; - children = ( - DE63899C28D3D63800559697 /* Unions */, - DE63899E28D3D63800559697 /* Enums */, - DE6389A028D3D63800559697 /* Objects */, - DE6389A828D3D63800559697 /* SchemaConfiguration.swift */, - DE6389A928D3D63800559697 /* InputObjects */, - DE6389AC28D3D63800559697 /* SchemaMetadata.graphql.swift */, - DE6389AD28D3D63800559697 /* Interfaces */, - ); - path = Schema; - sourceTree = ""; - }; - DE63899C28D3D63800559697 /* Unions */ = { - isa = PBXGroup; - children = ( - DE63899D28D3D63800559697 /* SearchResult.graphql.swift */, - ); - path = Unions; - sourceTree = ""; - }; - DE63899E28D3D63800559697 /* Enums */ = { - isa = PBXGroup; - children = ( - DE63899F28D3D63800559697 /* Episode.graphql.swift */, - ); - path = Enums; - sourceTree = ""; - }; - DE6389A028D3D63800559697 /* Objects */ = { - isa = PBXGroup; - children = ( - DE6389A128D3D63800559697 /* Subscription.graphql.swift */, - DE6389A228D3D63800559697 /* Droid.graphql.swift */, - DE6389A328D3D63800559697 /* Starship.graphql.swift */, - DE6389A428D3D63800559697 /* Mutation.graphql.swift */, - DE6389A528D3D63800559697 /* Review.graphql.swift */, - DE6389A628D3D63800559697 /* Query.graphql.swift */, - DE6389A728D3D63800559697 /* Human.graphql.swift */, - ); - path = Objects; - sourceTree = ""; - }; - DE6389A928D3D63800559697 /* InputObjects */ = { - isa = PBXGroup; - children = ( - DE6389AA28D3D63800559697 /* ColorInput.graphql.swift */, - DE6389AB28D3D63800559697 /* ReviewInput.graphql.swift */, - ); - path = InputObjects; - sourceTree = ""; - }; - DE6389AD28D3D63800559697 /* Interfaces */ = { - isa = PBXGroup; - children = ( - DE6389AE28D3D63800559697 /* Character.graphql.swift */, - ); - path = Interfaces; - sourceTree = ""; - }; - DE6389F328D3D64400559697 /* Sources */ = { - isa = PBXGroup; - children = ( - DE6389F428D3D64400559697 /* Fragments */, - DE6389F628D3D64400559697 /* Operations */, - DE6389FB28D3D64400559697 /* Schema */, - ); - name = Sources; - path = GitHubAPI/Sources; - sourceTree = ""; - }; - DE6389F428D3D64400559697 /* Fragments */ = { - isa = PBXGroup; - children = ( - DE6389F528D3D64400559697 /* AuthorDetails.graphql.swift */, - ); - path = Fragments; - sourceTree = ""; - }; - DE6389F628D3D64400559697 /* Operations */ = { - isa = PBXGroup; - children = ( - DE6389F728D3D64400559697 /* Queries */, - ); - path = Operations; - sourceTree = ""; - }; - DE6389F728D3D64400559697 /* Queries */ = { - isa = PBXGroup; - children = ( - DE6389F828D3D64400559697 /* RepositoryQuery.graphql.swift */, - DE6389F928D3D64400559697 /* IssuesAndCommentsForRepositoryQuery.graphql.swift */, - DE6389FA28D3D64400559697 /* RepoURLQuery.graphql.swift */, - ); - path = Queries; - sourceTree = ""; - }; - DE6389FB28D3D64400559697 /* Schema */ = { - isa = PBXGroup; - children = ( - DE6389FC28D3D64400559697 /* Unions */, - DE6389FE28D3D64400559697 /* CustomScalars */, - DE638A0028D3D64400559697 /* Objects */, - DE638AC028D3D64400559697 /* SchemaConfiguration.swift */, - DE638AC128D3D64400559697 /* SchemaMetadata.graphql.swift */, - DE638AC228D3D64400559697 /* Interfaces */, - ); - path = Schema; - sourceTree = ""; - }; - DE6389FC28D3D64400559697 /* Unions */ = { - isa = PBXGroup; - children = ( - DE6389FD28D3D64400559697 /* IssueOrPullRequest.graphql.swift */, - ); - path = Unions; - sourceTree = ""; - }; - DE6389FE28D3D64400559697 /* CustomScalars */ = { - isa = PBXGroup; - children = ( - DE6389FF28D3D64400559697 /* URI.swift */, - ); - path = CustomScalars; - sourceTree = ""; - }; - DE638A0028D3D64400559697 /* Objects */ = { - isa = PBXGroup; - children = ( - DE638A0128D3D64400559697 /* MarketplaceListing.graphql.swift */, - DE638A0228D3D64400559697 /* UnlockedEvent.graphql.swift */, - DE638A0328D3D64400559697 /* MarkedAsDuplicateEvent.graphql.swift */, - DE638A0428D3D64400559697 /* OrganizationInvitation.graphql.swift */, - DE638A0528D3D64400559697 /* Release.graphql.swift */, - DE638A0628D3D64400559697 /* OrgInviteToBusinessAuditEntry.graphql.swift */, - DE638A0728D3D64400559697 /* PullRequestReviewThread.graphql.swift */, - DE638A0828D3D64400559697 /* RepoChangeMergeSettingAuditEntry.graphql.swift */, - DE638A0928D3D64400559697 /* Sponsorship.graphql.swift */, - DE638A0A28D3D64400559697 /* OrgAddMemberAuditEntry.graphql.swift */, - DE638A0B28D3D64400559697 /* DependencyGraphManifest.graphql.swift */, - DE638A0C28D3D64400559697 /* OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift */, - DE638A0D28D3D64400559697 /* OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift */, - DE638A0E28D3D64400559697 /* RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift */, - DE638A0F28D3D64400559697 /* License.graphql.swift */, - DE638A1028D3D64400559697 /* ConnectedEvent.graphql.swift */, - DE638A1128D3D64400559697 /* OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift */, - DE638A1228D3D64400559697 /* OrgDisableTwoFactorRequirementAuditEntry.graphql.swift */, - DE638A1328D3D64400559697 /* RepositoryTopic.graphql.swift */, - DE638A1428D3D64400559697 /* CommitComment.graphql.swift */, - DE638A1528D3D64400559697 /* PackageTag.graphql.swift */, - DE638A1628D3D64400559697 /* UnmarkedAsDuplicateEvent.graphql.swift */, - DE638A1728D3D64400559697 /* Repository.graphql.swift */, - DE638A1828D3D64400559697 /* GistComment.graphql.swift */, - DE638A1928D3D64400559697 /* PackageFile.graphql.swift */, - DE638A1A28D3D64400559697 /* OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift */, - DE638A1B28D3D64400559697 /* RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift */, - DE638A1C28D3D64400559697 /* OrgEnableTwoFactorRequirementAuditEntry.graphql.swift */, - DE638A1D28D3D64400559697 /* StatusCheckRollup.graphql.swift */, - DE638A1E28D3D64400559697 /* OrgRemoveMemberAuditEntry.graphql.swift */, - DE638A1F28D3D64400559697 /* PushAllowance.graphql.swift */, - DE638A2028D3D64400559697 /* RepoRemoveTopicAuditEntry.graphql.swift */, - DE638A2128D3D64400559697 /* LockedEvent.graphql.swift */, - DE638A2228D3D64400559697 /* OauthApplicationCreateAuditEntry.graphql.swift */, - DE638A2328D3D64400559697 /* MarketplaceCategory.graphql.swift */, - DE638A2428D3D64400559697 /* DeploymentStatus.graphql.swift */, - DE638A2528D3D64400559697 /* RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift */, - DE638A2628D3D64400559697 /* Enterprise.graphql.swift */, - DE638A2728D3D64400559697 /* TeamRemoveMemberAuditEntry.graphql.swift */, - DE638A2828D3D64400559697 /* OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift */, - DE638A2928D3D64400559697 /* OrgOauthAppAccessApprovedAuditEntry.graphql.swift */, - DE638A2A28D3D64400559697 /* OrgInviteMemberAuditEntry.graphql.swift */, - DE638A2B28D3D64400559697 /* TeamAddRepositoryAuditEntry.graphql.swift */, - DE638A2C28D3D64400559697 /* DisconnectedEvent.graphql.swift */, - DE638A2D28D3D64400559697 /* TeamDiscussionComment.graphql.swift */, - DE638A2E28D3D64400559697 /* TeamRemoveRepositoryAuditEntry.graphql.swift */, - DE638A2F28D3D64400559697 /* User.graphql.swift */, - DE638A3028D3D64400559697 /* MembersCanDeleteReposEnableAuditEntry.graphql.swift */, - DE638A3128D3D64400559697 /* SponsorsTier.graphql.swift */, - DE638A3228D3D64400559697 /* PinnedEvent.graphql.swift */, - DE638A3328D3D64400559697 /* Status.graphql.swift */, - DE638A3428D3D64400559697 /* RepoAddTopicAuditEntry.graphql.swift */, - DE638A3528D3D64400559697 /* RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift */, - DE638A3628D3D64400559697 /* Commit.graphql.swift */, - DE638A3728D3D64400559697 /* EnterpriseRepositoryInfo.graphql.swift */, - DE638A3828D3D64400559697 /* SubscribedEvent.graphql.swift */, - DE638A3928D3D64400559697 /* DeployKey.graphql.swift */, - DE638A3A28D3D64400559697 /* OrgAddBillingManagerAuditEntry.graphql.swift */, - DE638A3B28D3D64400559697 /* PrivateRepositoryForkingDisableAuditEntry.graphql.swift */, - DE638A3C28D3D64400559697 /* OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift */, - DE638A3D28D3D64400559697 /* OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift */, - DE638A3E28D3D64400559697 /* RepoAddMemberAuditEntry.graphql.swift */, - DE638A3F28D3D64400559697 /* ReviewRequestRemovedEvent.graphql.swift */, - DE638A4028D3D64400559697 /* ReopenedEvent.graphql.swift */, - DE638A4128D3D64400559697 /* BranchProtectionRule.graphql.swift */, - DE638A4228D3D64400559697 /* ConvertedNoteToIssueEvent.graphql.swift */, - DE638A4328D3D64400559697 /* PullRequestCommitCommentThread.graphql.swift */, - DE638A4428D3D64400559697 /* RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift */, - DE638A4528D3D64400559697 /* IssueCommentConnection.graphql.swift */, - DE638A4628D3D64400559697 /* RepositoryVisibilityChangeDisableAuditEntry.graphql.swift */, - DE638A4728D3D64400559697 /* CodeOfConduct.graphql.swift */, - DE638A4828D3D64400559697 /* UnpinnedEvent.graphql.swift */, - DE638A4928D3D64400559697 /* Mannequin.graphql.swift */, - DE638A4A28D3D64400559697 /* EnterpriseIdentityProvider.graphql.swift */, - DE638A4B28D3D64400559697 /* DeploymentEnvironmentChangedEvent.graphql.swift */, - DE638A4C28D3D64400559697 /* Push.graphql.swift */, - DE638A4D28D3D64400559697 /* PullRequest.graphql.swift */, - DE638A4E28D3D64400559697 /* ReferencedEvent.graphql.swift */, - DE638A4F28D3D64400559697 /* RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift */, - DE638A5028D3D64400559697 /* EnterpriseServerUserAccount.graphql.swift */, - DE638A5128D3D64400559697 /* OrgOauthAppAccessRequestedAuditEntry.graphql.swift */, - DE638A5228D3D64400559697 /* Project.graphql.swift */, - DE638A5328D3D64400559697 /* Ref.graphql.swift */, - DE638A5428D3D64400559697 /* OrgRemoveBillingManagerAuditEntry.graphql.swift */, - DE638A5528D3D64400559697 /* Organization.graphql.swift */, - DE638A5628D3D64400559697 /* MergedEvent.graphql.swift */, - DE638A5728D3D64400559697 /* ReviewRequest.graphql.swift */, - DE638A5828D3D64400559697 /* Label.graphql.swift */, - DE638A5928D3D64400559697 /* HeadRefDeletedEvent.graphql.swift */, - DE638A5A28D3D64400559697 /* Milestone.graphql.swift */, - DE638A5B28D3D64400559697 /* DeployedEvent.graphql.swift */, - DE638A5C28D3D64400559697 /* EnterpriseUserAccount.graphql.swift */, - DE638A5D28D3D64400559697 /* RepoCreateAuditEntry.graphql.swift */, - DE638A5E28D3D64400559697 /* CrossReferencedEvent.graphql.swift */, - DE638A5F28D3D64400559697 /* PinnedIssue.graphql.swift */, - DE638A6028D3D64400559697 /* RepoAccessAuditEntry.graphql.swift */, - DE638A6128D3D64400559697 /* OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift */, - DE638A6228D3D64400559697 /* EnterpriseServerUserAccountsUpload.graphql.swift */, - DE638A6328D3D64400559697 /* OrgOauthAppAccessDeniedAuditEntry.graphql.swift */, - DE638A6428D3D64400559697 /* Query.graphql.swift */, - DE638A6528D3D64400559697 /* OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift */, - DE638A6628D3D64400559697 /* RepoDestroyAuditEntry.graphql.swift */, - DE638A6728D3D64400559697 /* Reaction.graphql.swift */, - DE638A6828D3D64400559697 /* EnterpriseAdministratorInvitation.graphql.swift */, - DE638A6928D3D64400559697 /* RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift */, - DE638A6A28D3D64400559697 /* ExternalIdentity.graphql.swift */, - DE638A6B28D3D64400559697 /* Language.graphql.swift */, - DE638A6C28D3D64400559697 /* Team.graphql.swift */, - DE638A6D28D3D64400559697 /* PackageVersion.graphql.swift */, - DE638A6E28D3D64400559697 /* CommentDeletedEvent.graphql.swift */, - DE638A6F28D3D64400559697 /* TeamDiscussion.graphql.swift */, - DE638A7028D3D64400559697 /* MembersCanDeleteReposClearAuditEntry.graphql.swift */, - DE638A7128D3D64400559697 /* RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift */, - DE638A7228D3D64400559697 /* ClosedEvent.graphql.swift */, - DE638A7328D3D64400559697 /* MembersCanDeleteReposDisableAuditEntry.graphql.swift */, - DE638A7428D3D64400559697 /* PullRequestCommit.graphql.swift */, - DE638A7528D3D64400559697 /* UserBlockedEvent.graphql.swift */, - DE638A7628D3D64400559697 /* Topic.graphql.swift */, - DE638A7728D3D64400559697 /* CheckSuite.graphql.swift */, - DE638A7828D3D64400559697 /* UnsubscribedEvent.graphql.swift */, - DE638A7928D3D64400559697 /* Tag.graphql.swift */, - DE638A7A28D3D64400559697 /* Gist.graphql.swift */, - DE638A7B28D3D64400559697 /* Package.graphql.swift */, - DE638A7C28D3D64400559697 /* PullRequestReview.graphql.swift */, - DE638A7D28D3D64400559697 /* PrivateRepositoryForkingEnableAuditEntry.graphql.swift */, - DE638A7E28D3D64400559697 /* OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift */, - DE638A7F28D3D64400559697 /* ConvertToDraftEvent.graphql.swift */, - DE638A8028D3D64400559697 /* RepoRemoveMemberAuditEntry.graphql.swift */, - DE638A8128D3D64400559697 /* TeamAddMemberAuditEntry.graphql.swift */, - DE638A8228D3D64400559697 /* Tree.graphql.swift */, - DE638A8328D3D64400559697 /* RenamedTitleEvent.graphql.swift */, - DE638A8428D3D64400559697 /* OrgUnblockUserAuditEntry.graphql.swift */, - DE638A8528D3D64400559697 /* OrgCreateAuditEntry.graphql.swift */, - DE638A8628D3D64400559697 /* ProjectCard.graphql.swift */, - DE638A8728D3D64400559697 /* SavedReply.graphql.swift */, - DE638A8828D3D64400559697 /* OrgBlockUserAuditEntry.graphql.swift */, - DE638A8928D3D64400559697 /* BaseRefChangedEvent.graphql.swift */, - DE638A8A28D3D64400559697 /* RemovedFromProjectEvent.graphql.swift */, - DE638A8B28D3D64400559697 /* Issue.graphql.swift */, - DE638A8C28D3D64400559697 /* SecurityAdvisory.graphql.swift */, - DE638A8D28D3D64400559697 /* OrgRestoreMemberAuditEntry.graphql.swift */, - DE638A8E28D3D64400559697 /* HeadRefForcePushedEvent.graphql.swift */, - DE638A8F28D3D64400559697 /* OrgUpdateMemberAuditEntry.graphql.swift */, - DE638A9028D3D64400559697 /* LabeledEvent.graphql.swift */, - DE638A9128D3D64400559697 /* SponsorsListing.graphql.swift */, - DE638A9228D3D64400559697 /* App.graphql.swift */, - DE638A9328D3D64400559697 /* StatusContext.graphql.swift */, - DE638A9428D3D64400559697 /* ReviewRequestedEvent.graphql.swift */, - DE638A9528D3D64400559697 /* DemilestonedEvent.graphql.swift */, - DE638A9628D3D64400559697 /* IssueConnection.graphql.swift */, - DE638A9728D3D64400559697 /* UserContentEdit.graphql.swift */, - DE638A9828D3D64400559697 /* MovedColumnsInProjectEvent.graphql.swift */, - DE638A9928D3D64400559697 /* MilestonedEvent.graphql.swift */, - DE638A9A28D3D64400559697 /* TeamChangeParentTeamAuditEntry.graphql.swift */, - DE638A9B28D3D64400559697 /* UnassignedEvent.graphql.swift */, - DE638A9C28D3D64400559697 /* Bot.graphql.swift */, - DE638A9D28D3D64400559697 /* AddedToProjectEvent.graphql.swift */, - DE638A9E28D3D64400559697 /* RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift */, - DE638A9F28D3D64400559697 /* BaseRefForcePushedEvent.graphql.swift */, - DE638AA028D3D64400559697 /* RepositoryInvitation.graphql.swift */, - DE638AA128D3D64400559697 /* TransferredEvent.graphql.swift */, - DE638AA228D3D64400559697 /* CheckRun.graphql.swift */, - DE638AA328D3D64400559697 /* HeadRefRestoredEvent.graphql.swift */, - DE638AA428D3D64400559697 /* RepoArchivedAuditEntry.graphql.swift */, - DE638AA528D3D64400559697 /* IpAllowListEntry.graphql.swift */, - DE638AA628D3D64400559697 /* EnterpriseServerInstallation.graphql.swift */, - DE638AA728D3D64400559697 /* ReviewDismissedEvent.graphql.swift */, - DE638AA828D3D64400559697 /* CommitCommentThread.graphql.swift */, - DE638AA928D3D64400559697 /* IssueComment.graphql.swift */, - DE638AAA28D3D64400559697 /* UnlabeledEvent.graphql.swift */, - DE638AAB28D3D64400559697 /* ReviewDismissalAllowance.graphql.swift */, - DE638AAC28D3D64400559697 /* AssignedEvent.graphql.swift */, - DE638AAD28D3D64400559697 /* PullRequestReviewComment.graphql.swift */, - DE638AAE28D3D64400559697 /* RepositoryVisibilityChangeEnableAuditEntry.graphql.swift */, - DE638AAF28D3D64400559697 /* OrganizationIdentityProvider.graphql.swift */, - DE638AB028D3D64400559697 /* MentionedEvent.graphql.swift */, - DE638AB128D3D64400559697 /* ReleaseAsset.graphql.swift */, - DE638AB228D3D64400559697 /* OrgEnableSamlAuditEntry.graphql.swift */, - DE638AB328D3D64400559697 /* UserStatus.graphql.swift */, - DE638AB428D3D64400559697 /* OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift */, - DE638AB528D3D64400559697 /* OrgDisableSamlAuditEntry.graphql.swift */, - DE638AB628D3D64400559697 /* Blob.graphql.swift */, - DE638AB728D3D64400559697 /* AutomaticBaseChangeFailedEvent.graphql.swift */, - DE638AB828D3D64400559697 /* Deployment.graphql.swift */, - DE638AB928D3D64400559697 /* PublicKey.graphql.swift */, - DE638ABA28D3D64400559697 /* ReadyForReviewEvent.graphql.swift */, - DE638ABB28D3D64400559697 /* ProjectColumn.graphql.swift */, - DE638ABC28D3D64400559697 /* EnterpriseServerUserAccountEmail.graphql.swift */, - DE638ABD28D3D64400559697 /* AutomaticBaseChangeSucceededEvent.graphql.swift */, - DE638ABE28D3D64400559697 /* RepositoryVulnerabilityAlert.graphql.swift */, - DE638ABF28D3D64400559697 /* RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift */, - ); - path = Objects; - sourceTree = ""; - }; - DE638AC228D3D64400559697 /* Interfaces */ = { - isa = PBXGroup; - children = ( - DE638AC328D3D64400559697 /* Starrable.graphql.swift */, - DE638AC428D3D64400559697 /* TeamAuditEntryData.graphql.swift */, - DE638AC528D3D64400559697 /* Labelable.graphql.swift */, - DE638AC628D3D64400559697 /* OrganizationAuditEntryData.graphql.swift */, - DE638AC728D3D64400559697 /* RepositoryNode.graphql.swift */, - DE638AC828D3D64400559697 /* UpdatableComment.graphql.swift */, - DE638AC928D3D64400559697 /* Comment.graphql.swift */, - DE638ACA28D3D64400559697 /* Sponsorable.graphql.swift */, - DE638ACB28D3D64400559697 /* RepositoryOwner.graphql.swift */, - DE638ACC28D3D64400559697 /* GitObject.graphql.swift */, - DE638ACD28D3D64400559697 /* ProjectOwner.graphql.swift */, - DE638ACE28D3D64400559697 /* MemberStatusable.graphql.swift */, - DE638ACF28D3D64400559697 /* UniformResourceLocatable.graphql.swift */, - DE638AD028D3D64400559697 /* Deletable.graphql.swift */, - DE638AD128D3D64400559697 /* PackageOwner.graphql.swift */, - DE638AD228D3D64400559697 /* AuditEntry.graphql.swift */, - DE638AD328D3D64400559697 /* Closable.graphql.swift */, - DE638AD428D3D64400559697 /* Actor.graphql.swift */, - DE638AD528D3D64400559697 /* Minimizable.graphql.swift */, - DE638AD628D3D64400559697 /* Assignable.graphql.swift */, - DE638AD728D3D64400559697 /* TopicAuditEntryData.graphql.swift */, - DE638AD828D3D64400559697 /* RepositoryInfo.graphql.swift */, - DE638AD928D3D64400559697 /* Reactable.graphql.swift */, - DE638ADA28D3D64400559697 /* OauthApplicationAuditEntryData.graphql.swift */, - DE638ADB28D3D64400559697 /* Updatable.graphql.swift */, - DE638ADC28D3D64400559697 /* Subscribable.graphql.swift */, - DE638ADD28D3D64400559697 /* EnterpriseAuditEntryData.graphql.swift */, - DE638ADE28D3D64400559697 /* Node.graphql.swift */, - DE638ADF28D3D64400559697 /* RepositoryAuditEntryData.graphql.swift */, - DE638AE028D3D64400559697 /* Lockable.graphql.swift */, - DE638AE128D3D64400559697 /* ProfileOwner.graphql.swift */, - ); - path = Interfaces; - sourceTree = ""; - }; - DE6B15AD26152BE10068D642 /* ApolloServerIntegrationTests */ = { - isa = PBXGroup; - children = ( - DED45D62261675620086EF63 /* TestHelpers */, - DE6B15AE26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift */, - 9FA6ABC91EC0A9F7000017BE /* StarWarsServerTests.swift */, - 9FA6ABC81EC0A9F7000017BE /* StarWarsServerCachingRoundtripTests.swift */, - 9B7BDA8823FDE92900ACD198 /* StarWarsSubscriptionTests.swift */, - 9B7BDA8C23FDE92900ACD198 /* StarWarsWebSocketTests.swift */, - DE6B15B026152BE10068D642 /* Info.plist */, - DED45F49261CDBFC0086EF63 /* UploadTests.swift */, - DECD46CF262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift */, - E6630B8D26F071F9002D9E41 /* SchemaRegistryApolloSchemaDownloaderTests.swift */, - E608A52C280905E9001BE656 /* SubscriptionTests.swift */, - ); - path = ApolloServerIntegrationTests; - sourceTree = ""; - }; - DE6B15F926152D210068D642 /* Shared */ = { - isa = PBXGroup; - children = ( - DE6B15FA26152D210068D642 /* Workspace-Target-Application.xcconfig */, - DE6B15FB26152D210068D642 /* Workspace-Deployment-Targets.xcconfig */, - DEC2EA8C291D9C960088D3BB /* Workspace-Test-Deployment-Targets.xcconfig */, - DE6B15FC26152D210068D642 /* Workspace-Analysis.xcconfig */, - DE6B15FD26152D210068D642 /* Project-Release.xcconfig */, - DE6B15FE26152D210068D642 /* Workspace-Debug.xcconfig */, - DE6B160826152D210068D642 /* Workspace-Universal-Target.xcconfig */, - DE6B15FF26152D210068D642 /* Workspace-Universal-Test.xcconfig */, - DE6B160026152D210068D642 /* Workspace-Universal-Framework.xcconfig */, - DECD4930262F824B00924527 /* Workspace-Target-TestHelpers.xcconfig */, - DE6B160126152D210068D642 /* Workspace-Target-Test.xcconfig */, - DECD493E262F82D600924527 /* Workspace-Target-Codegen.xcconfig */, - DE6B160326152D210068D642 /* Workspace-Release.xcconfig */, - DE6B160426152D210068D642 /* Project-Version.xcconfig */, - DE6B160526152D210068D642 /* Workspace-Warnings.xcconfig */, - DE6B160626152D210068D642 /* Workspace-Target-Framework.xcconfig */, - DE6B160726152D210068D642 /* Workspace-Search-Paths.xcconfig */, - DE6B160926152D210068D642 /* Workspace-Linking.xcconfig */, - DE6B160A26152D210068D642 /* Workspace-Language.xcconfig */, - DE6B160B26152D210068D642 /* Project-Debug.xcconfig */, - DE6B160C26152D210068D642 /* Workspace-Packaging.xcconfig */, - DE6B160D26152D210068D642 /* Workspace-Shared.xcconfig */, - ); - name = Shared; - path = Configuration/Shared; - sourceTree = SOURCE_ROOT; - }; - DE6D07FC27BC3C81009F5F33 /* RenderingHelpers */ = { - isa = PBXGroup; - children = ( - E64F7EBB27A11A510059C021 /* GraphQLNamedType+SwiftName.swift */, - DE01451128A442BF000F6F18 /* String+SwiftNameEscaping.swift */, - DEE2DAA127BAF00500EC0607 /* GraphQLType+Rendered.swift */, - DE071E792899FB7F0089BDAA /* GraphQLCompositeType+SchemaTypeNamespace.swift */, - DE6D07F827BC3B6D009F5F33 /* GraphQLInputField+Rendered.swift */, - DE6D07FE27BC7F78009F5F33 /* InputVariableRenderable.swift */, - DE6B650B27C4293D00970E4E /* FieldArgumentRendering.swift */, - DE71FDBF2853C242005FA9CC /* OperationTemplateRenderer.swift */, - DE6388DE28CBF38E00559697 /* GraphQLEnumValue+Rendered.swift */, - DE8C51C929E8B03700E47A64 /* IRDefinition+RenderingHelpers.swift */, - ); - path = RenderingHelpers; - sourceTree = ""; - }; - DE8F7B6929F742B4005F3902 /* ExecutionSources */ = { - isa = PBXGroup; - children = ( - DE8F7B6A29F742E1005F3902 /* NetworkResponseExecutionSource.swift */, - DE8F7B6C29F745DE005F3902 /* CacheDataExecutionSource.swift */, - DE8F7B6E29F7478C005F3902 /* SelectionSetModelExecutionSource.swift */, - ); - path = ExecutionSources; - sourceTree = ""; - }; - DE9C04AB26EA763E00EC35E7 /* Accumulators */ = { - isa = PBXGroup; - children = ( - 9FC2333C1E66BBF7001E4541 /* GraphQLDependencyTracker.swift */, - 9F295E371E277B2A00A24949 /* GraphQLResultNormalizer.swift */, - 9F86B68A1E6438D700B885FF /* GraphQLSelectionSetMapper.swift */, - ); - name = Accumulators; - sourceTree = ""; - }; - DE9CEADE28299EEE00959AF9 /* ApolloTestSupport */ = { - isa = PBXGroup; - children = ( - DE9CEAED282C207F00959AF9 /* Info.plist */, - B9C0075F298AB95E00855D2B /* snapshot_0.sqlite3 */, - DE9CEAE52829A2FE00959AF9 /* TestMock.swift */, - DEA7604329DF75B60001544B /* TestMockSelectionSetMapper.swift */, - DE2FCF2626E8083A0057EA67 /* Field.swift */, - ); - name = ApolloTestSupport; - path = Sources/ApolloTestSupport; - sourceTree = ""; - }; - DEAFB7762705270E00BE02F3 /* CodeGenIR */ = { - isa = PBXGroup; - children = ( - DEAFB77A2706444B00BE02F3 /* IRRootFieldBuilderTests.swift */, - DE79642E2769A1EB00978A03 /* IROperationBuilderTests.swift */, - DE79642A276999E700978A03 /* IRNamedFragmentBuilderTests.swift */, - DEA9A22F27CD990500F96C36 /* IRSelectionSet_IncludeSkip_Tests.swift */, - E66935322804AFE5004E1FFC /* IRCustomScalarTests.swift */, - DEFE694F28133E9B001CF4E8 /* IRFieldCollectorTests.swift */, - DE1540DB2A3A76F700A5A8B6 /* IRInputObjectTests.swift */, - ); - path = CodeGenIR; - sourceTree = ""; - }; - DEAFB7772705271D00BE02F3 /* IR */ = { - isa = PBXGroup; - children = ( - DE7C183D272A154400727031 /* IR.swift */, - DE5EEC8427988F1A00AF5913 /* IR+SelectionSet.swift */, - DE5FD606276950CC0033EE23 /* IR+Schema.swift */, - DEFE0FC42748822900FFA440 /* IR+EntitySelectionTree.swift */, - DEFBBC85273470F70088AABC /* IR+Field.swift */, - DEA9A23127D822E600F96C36 /* IR+InclusionConditions.swift */, - DE3484612746FF8F0065B77E /* IR+OperationBuilder.swift */, - DE79642C27699A6A00978A03 /* IR+NamedFragmentBuilder.swift */, - DE796428276998B000978A03 /* IR+RootFieldBuilder.swift */, - DEFE694D280F6CBE001CF4E8 /* IR+FieldCollector.swift */, - DE223C2C2721FCE8004A0148 /* ScopedSelectionSetHashable.swift */, - DE09114D27288B1F000648E5 /* SortedSelections.swift */, - DE7C183B272A12EB00727031 /* ScopeDescriptor.swift */, - ); - path = IR; - sourceTree = ""; - }; - DECD490C262F81BF00924527 /* ApolloCodegenInternalTestHelpers */ = { - isa = PBXGroup; - children = ( - DECD490D262F81BF00924527 /* ApolloCodegenInternalTestHelpers.h */, - 9BAEEC11234BBA9200808306 /* CodegenTestHelper.swift */, - DE363CB227640FBA001EC05B /* GraphQLJSFrontend+TestHelpers.swift */, - E6D79AB926EC05290094434A /* MockNetworkSession.swift */, - DE09F9C0270269E800795949 /* MockJavaScriptObject.swift */, - DEAFB780270647D400BE02F3 /* MockCompilationResult.swift */, - DE296BA427A07C37004F571F /* MockMergedSelections.swift */, - DE12B2D8273C4338003371CC /* MockIRSubscripts.swift */, - DE5FD602276926EF0033EE23 /* IR+Mocking.swift */, - DEE2060A27E14498002B4B82 /* IR+InclusionConditionsMock.swift */, - DEAFB78227064F6900BE02F3 /* MockGraphQLType.swift */, - DE01451528A5A971000F6F18 /* MockValidationOptions.swift */, - E6BF98FB272C8FFC00C1FED8 /* MockFileManager.swift */, - DE5FD5FE276922AA0033EE23 /* MockApolloCodegenConfiguration.swift */, - E6BEEFA527FAB1C700D94FF4 /* MockFileGenerator.swift */, - E6EFDD0C27E8377200B17FE5 /* MockFileTemplate.swift */, - E66644EF29D7D27C005E9140 /* MockTemplateRenderer.swift */, - DE5B313F27A482C80051C9D3 /* Resources.swift */, - DECD490E262F81BF00924527 /* Info.plist */, - ); - path = ApolloCodegenInternalTestHelpers; - sourceTree = ""; - }; - DED45D62261675620086EF63 /* TestHelpers */ = { - isa = PBXGroup; - children = ( - 9B4F4540244A2A9200C2CF7D /* HTTPBinAPI.swift */, - DED45C172615308E0086EF63 /* TestServerURLs.swift */, - DED45D842616759C0086EF63 /* TestConfigs.swift */, - ); - path = TestHelpers; - sourceTree = ""; - }; - DED45DE8261B969F0086EF63 /* Cache */ = { - isa = PBXGroup; - children = ( - DED45E2F261B971F0086EF63 /* SQLite */, - 9BB4F5B12581AA50004F0BD6 /* CacheDependentInterceptorTests.swift */, - 9FA6ABC51EC0A9F7000017BE /* FetchQueryTests.swift */, - 9FA6ABC61EC0A9F7000017BE /* LoadQueryFromStoreTests.swift */, - 9F8622F71EC2004200C38162 /* ReadWriteFromStoreTests.swift */, - 9FD03C2D25527CE6002227DC /* StoreConcurrencyTests.swift */, - 9FA6ABCB1EC0A9F7000017BE /* WatchQueryTests.swift */, - 2EE7FFCF276802E30035DC39 /* CacheKeyConstructionTests.swift */, - ); - path = Cache; - sourceTree = ""; - }; - DED45E2F261B971F0086EF63 /* SQLite */ = { - isa = PBXGroup; - children = ( - 9B60204E23FDFA9F00D0C8E0 /* SQLiteCacheTests.swift */, - 9B7BDAD423FDEC9B00ACD198 /* CachePersistenceTests.swift */, - ); - path = SQLite; - sourceTree = ""; - }; - DED45E9B261BA0CA0086EF63 /* WebSocket */ = { - isa = PBXGroup; - children = ( - E608A527280905C2001BE656 /* GraphqlTransportWsProtocolTests.swift */, - E608A526280905C2001BE656 /* GraphqlWsProtocolTests.swift */, - E608A528280905C2001BE656 /* WSProtocolTestsBase.swift */, - 9B7BDA8923FDE92900ACD198 /* WebSocketTests.swift */, - 9B7BDA8A23FDE92900ACD198 /* SplitNetworkTransportTests.swift */, - D90F1AF92479DEE5007A1534 /* WebSocketTransportTests.swift */, - DE181A3326C5D8D4000C0B9C /* CompressionTests.swift */, - 19E9F6AA26D58A92003AB80E /* OperationMessageIdCreatorTests.swift */, - ); - path = WebSocket; - sourceTree = ""; - }; - E6180AA028093EB7004EC2A3 /* graphql */ = { - isa = PBXGroup; - children = ( - E6180AA128093EB7004EC2A3 /* schema.graphqls */, - E6180AA328093EB7004EC2A3 /* subscription.graphql */, - ); - path = graphql; - sourceTree = ""; - }; - E64F7EBD27A11AEA0059C021 /* Extensions */ = { - isa = PBXGroup; - children = ( - E64F7EBE27A11B110059C021 /* GraphQLNamedType+SwiftTests.swift */, - E6D9212A28DA66B300AF12E6 /* String+Data.swift */, - ); - path = Extensions; - sourceTree = ""; - }; - E66B836728093D7C001B3F2D /* SubscriptionAPI */ = { - isa = PBXGroup; - children = ( - DE63893D28D3D60600559697 /* Sources */, - E6180AA028093EB7004EC2A3 /* graphql */, - E6180A9E28093EB7004EC2A3 /* Info.plist */, - ); - name = SubscriptionAPI; - path = Sources/SubscriptionAPI; - sourceTree = SOURCE_ROOT; - }; - E66F8895276C13330000BDA8 /* FileGenerators */ = { - isa = PBXGroup; - children = ( - E66935302803F2B0004E1FFC /* CustomScalarFileGeneratorTests.swift */, - E610D8D8278EA2560023E495 /* EnumFileGeneratorTests.swift */, - E6A6866527F63BDC008A1D13 /* FileGenerator_ResolvePath_Tests.swift */, - E6A6866327F63AEF008A1D13 /* FileGeneratorTests.swift */, - E61F4BF727A8FC8E0049886A /* FragmentFileGeneratorTests.swift */, - E6D90D08278FA5C3009CAC5D /* InputObjectFileGeneratorTests.swift */, - E610D8DC278EB1500023E495 /* InterfaceFileGeneratorTests.swift */, - DE0D38F1282ECF9700AFCC84 /* MockObjectFileGeneratorTests.swift */, - E6203345284F252A00A291D1 /* MockUnionsFileGeneratorTests.swift */, - DE5E79BA289DA90600CD0DE5 /* MockInterfacesFileGeneratorTests.swift */, - E66F8896276C136B0000BDA8 /* ObjectFileGeneratorTests.swift */, - E607AD8D27A88F340026742A /* OperationFileGeneratorTests.swift */, - E6AAA735286C0F8E00F4659D /* OperationManifestFileGeneratorTests.swift */, - E6D90D0C278FFE35009CAC5D /* SchemaMetadataFileGeneratorTests.swift */, - DE454BA628B40D52009DC80E /* SchemaConfigurationFileGeneratorTests.swift */, - E6B42D0A27A4746800A3BD58 /* SchemaModuleFileGeneratorTests.swift */, - E610D8E0278F8F3D0023E495 /* UnionFileGeneratorTests.swift */, - ); - path = FileGenerators; - sourceTree = ""; - }; - E676C11F26CB05F90091215A /* DefaultImplementation */ = { - isa = PBXGroup; - children = ( - DE181A3126C5C401000C0B9C /* Compression.swift */, - DE181A2B26C5C0CB000C0B9C /* WebSocket.swift */, - DE181A3526C5DE4F000C0B9C /* WebSocketStream.swift */, - DE181A2D26C5C299000C0B9C /* SSLClientCertificate.swift */, - DE181A2F26C5C38E000C0B9C /* SSLSecurity.swift */, - ); - path = DefaultImplementation; - sourceTree = ""; - }; - E687B3C928B398E600A9551C /* CodegenCLI */ = { - isa = PBXGroup; - children = ( - E687B3D328B398E600A9551C /* Commands */, - E687B3CE28B398E600A9551C /* Extensions */, - E687B3CB28B398E600A9551C /* OptionGroups */, - E687B3D828B398E600A9551C /* Protocols */, - E687B3CA28B398E600A9551C /* Constants.swift */, - E687B3CD28B398E600A9551C /* Error.swift */, - ); - name = CodegenCLI; - path = Sources/CodegenCLI; - sourceTree = ""; - }; - E687B3CB28B398E600A9551C /* OptionGroups */ = { - isa = PBXGroup; - children = ( - E687B3CC28B398E600A9551C /* InputOptions.swift */, - ); - path = OptionGroups; - sourceTree = ""; - }; - E687B3CE28B398E600A9551C /* Extensions */ = { - isa = PBXGroup; - children = ( - E687B3CF28B398E600A9551C /* ParsableCommand+Apollo.swift */, - DE2A20E729032E1F008ADE48 /* VersionChecker.swift */, - E687B3D028B398E600A9551C /* FileManager+Data.swift */, - E687B3D128B398E600A9551C /* String+Data.swift */, - ); - path = Extensions; - sourceTree = ""; - }; - E687B3D328B398E600A9551C /* Commands */ = { - isa = PBXGroup; - children = ( - E687B3D428B398E600A9551C /* FetchSchema.swift */, - E687B3D528B398E600A9551C /* Initialize.swift */, - E687B3D628B398E600A9551C /* Generate.swift */, - 662EA65D2A701483008A1931 /* GenerateOperationManifest.swift */, - ); - path = Commands; - sourceTree = ""; - }; - E687B3D828B398E600A9551C /* Protocols */ = { - isa = PBXGroup; - children = ( - E687B3D928B398E600A9551C /* CodegenProvider.swift */, - E64F226C28B8B3FE0011292F /* LogLevelSetter.swift */, - E687B3DA28B398E600A9551C /* SchemaDownloadProvider.swift */, - ); - path = Protocols; - sourceTree = ""; - }; - E6BE04ED26F11B3500CF858D /* Resources */ = { - isa = PBXGroup; - children = ( - E6C4267A26F16CB400904AD2 /* introspection_response.json */, - ); - path = Resources; - sourceTree = ""; - }; - E6DC0AC928B3AC490064A68F /* CodegenCLITests */ = { - isa = PBXGroup; - children = ( - E6DC0AD028B3AC490064A68F /* Commands */, - E6DC0AD428B3AC490064A68F /* Matchers */, - E6DC0ACA28B3AC490064A68F /* Support */, - E6DC0AD628B3AC490064A68F /* Info.plist */, - ); - path = CodegenCLITests; - sourceTree = ""; - }; - E6DC0ACA28B3AC490064A68F /* Support */ = { - isa = PBXGroup; - children = ( - E6DC0ACB28B3AC490064A68F /* MockApolloCodegen.swift */, - E6DC0ACC28B3AC490064A68F /* MockApolloCodegenConfiguration.swift */, - E6DC0ACD28B3AC490064A68F /* TestSupport.swift */, - E6DC0ACE28B3AC490064A68F /* MockApolloSchemaDownloader.swift */, - E6DC0ACF28B3AC490064A68F /* MockFileManager.swift */, - E64F227028B8BEE10011292F /* MockLogLevelSetter.swift */, - ); - path = Support; - sourceTree = ""; - }; - E6DC0AD028B3AC490064A68F /* Commands */ = { - isa = PBXGroup; - children = ( - E6DC0AD128B3AC490064A68F /* InitializeTests.swift */, - E6DC0AD228B3AC490064A68F /* GenerateTests.swift */, - DE2A20EC29033ABE008ADE48 /* VersionCheckerTests.swift */, - E6DC0AD328B3AC490064A68F /* FetchSchemaTests.swift */, - 662EA65F2A705BD7008A1931 /* GenerateOperationManifestTests.swift */, - ); - path = Commands; - sourceTree = ""; - }; - E6DC0AD428B3AC490064A68F /* Matchers */ = { - isa = PBXGroup; - children = ( - E6DC0AD528B3AC490064A68F /* ErrorMatchers.swift */, - ); - path = Matchers; - sourceTree = ""; - }; - E6E3BBDC276A8D6200E5218B /* FileGenerators */ = { - isa = PBXGroup; - children = ( - E6E3BBDD276A8D6200E5218B /* FileGenerator.swift */, - E669352E2803F09C004E1FFC /* CustomScalarFileGenerator.swift */, - E610D8D6278EA2390023E495 /* EnumFileGenerator.swift */, - DE4D54E827A3518100D26B68 /* FragmentFileGenerator.swift */, - E6D90D06278FA595009CAC5D /* InputObjectFileGenerator.swift */, - E610D8DA278EB0900023E495 /* InterfaceFileGenerator.swift */, - DE0D38EF282ECA6D00AFCC84 /* MockObjectFileGenerator.swift */, - E6203341284F1C9600A291D1 /* MockUnionsFileGenerator.swift */, - DEB05B47289C3B4000170299 /* MockInterfacesFileGenerator.swift */, - E66F8898276C15580000BDA8 /* ObjectFileGenerator.swift */, - DE4D54E627A3504B00D26B68 /* OperationFileGenerator.swift */, - E6AAA731286BC58200F4659D /* OperationManifestFileGenerator.swift */, - E6D90D0A278FFDDA009CAC5D /* SchemaMetadataFileGenerator.swift */, - DE454BA828B40DA8009DC80E /* SchemaConfigurationFileGenerator.swift */, - E68D824627A228A80040A46F /* SchemaModuleFileGenerator.swift */, - E610D8DE278F8F1E0023E495 /* UnionFileGenerator.swift */, - ); - path = FileGenerators; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 9B2DFBB124E1FA0D00ED3AE6 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7B6F42233C26D100F32205 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDA7823FDE90400ACD198 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDABA23FDEBB600ACD198 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F8A95751EC0FC1200304A2D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9BCF0CE623FC9D7B0031D2A2 /* ApolloInternalTestHelpers.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FACA9BF1F42E67200AE2DBD /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FC750411D2A532C00458D91 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FC750481D2A532C00458D91 /* Apollo.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FCE2CF71E6C213D00E34457 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE058607266978A100265760 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE3C7A08260A6B9800D2F4FF /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE9CEAD228299E8500959AF9 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DECD4906262F81BF00924527 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DECD490F262F81BF00924527 /* ApolloCodegenInternalTestHelpers.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E66B836128093D7C001B3F2D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E687B3BC28B398CB00A9551C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 9B2DFBB524E1FA0D00ED3AE6 /* UploadAPI */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9B2DFBBE24E1FA0D00ED3AE6 /* Build configuration list for PBXNativeTarget "UploadAPI" */; - buildPhases = ( - 9B2DFBB124E1FA0D00ED3AE6 /* Headers */, - 9B2DFBB224E1FA0D00ED3AE6 /* Sources */, - 9B2DFBB324E1FA0D00ED3AE6 /* Frameworks */, - 9B2DFBB424E1FA0D00ED3AE6 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE90FCE727FCC71E0084CC79 /* PBXTargetDependency */, - ); - name = UploadAPI; - productName = UploadAPI; - productReference = 9B2DFBB624E1FA0D00ED3AE6 /* UploadAPI.framework */; - productType = "com.apple.product-type.framework"; - }; - 9B7B6F46233C26D100F32205 /* ApolloCodegenLib */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9B7B6F4F233C26D200F32205 /* Build configuration list for PBXNativeTarget "ApolloCodegenLib" */; - buildPhases = ( - 9B7B6F42233C26D100F32205 /* Headers */, - 9B7B6F43233C26D100F32205 /* Sources */, - 9B7B6F44233C26D100F32205 /* Frameworks */, - 9B7B6F45233C26D100F32205 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - E6E4209426A7DF5800B82624 /* PBXTargetDependency */, - ); - name = ApolloCodegenLib; - packageProductDependencies = ( - E6E4209126A7DF4200B82624 /* InflectorKit */, - DEAFB786270652D100BE02F3 /* OrderedCollections */, - ); - productName = ApolloCodegenLib; - productReference = 9B7B6F47233C26D100F32205 /* ApolloCodegenLib.framework */; - productType = "com.apple.product-type.framework"; - }; - 9B7BDA7C23FDE90400ACD198 /* ApolloWebSocket */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9B7BDA8223FDE90400ACD198 /* Build configuration list for PBXNativeTarget "ApolloWebSocket" */; - buildPhases = ( - 9B7BDA7823FDE90400ACD198 /* Headers */, - 9B7BDA7923FDE90400ACD198 /* Sources */, - 9B7BDA7A23FDE90400ACD198 /* Frameworks */, - 9B7BDA7B23FDE90400ACD198 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9B7BDAFC23FDEE9000ACD198 /* PBXTargetDependency */, - ); - name = ApolloWebSocket; - packageProductDependencies = ( - ); - productName = ApolloWebSocket; - productReference = 9B7BDA7D23FDE90400ACD198 /* ApolloWebSocket.framework */; - productType = "com.apple.product-type.framework"; - }; - 9B7BDABE23FDEBB600ACD198 /* ApolloSQLite */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9B7BDAC823FDEBB600ACD198 /* Build configuration list for PBXNativeTarget "ApolloSQLite" */; - buildPhases = ( - 9B7BDABA23FDEBB600ACD198 /* Headers */, - 9B7BDABB23FDEBB600ACD198 /* Sources */, - 9B7BDABC23FDEBB600ACD198 /* Frameworks */, - 9B7BDABD23FDEBB600ACD198 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9B7BDB1723FDF10300ACD198 /* PBXTargetDependency */, - 9B7BDAF823FDEE8400ACD198 /* PBXTargetDependency */, - ); - name = ApolloSQLite; - packageProductDependencies = ( - 9B7BDAF523FDEE2600ACD198 /* SQLite */, - ); - productName = ApolloSQLite; - productReference = 9B7BDABF23FDEBB600ACD198 /* ApolloSQLite.framework */; - productType = "com.apple.product-type.framework"; - }; - 9BAEEBFB234BB8FD00808306 /* ApolloCodegenTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9BAEEC07234BB8FD00808306 /* Build configuration list for PBXNativeTarget "ApolloCodegenTests" */; - buildPhases = ( - 9BAEEBF8234BB8FD00808306 /* Sources */, - 9BAEEBF9234BB8FD00808306 /* Frameworks */, - 9BAEEBFA234BB8FD00808306 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9BAEEC03234BB8FD00808306 /* PBXTargetDependency */, - DECD49DA262F8AA500924527 /* PBXTargetDependency */, - DECD4991262F841300924527 /* PBXTargetDependency */, - ); - name = ApolloCodegenTests; - packageProductDependencies = ( - DEAFB77E2706474C00BE02F3 /* Nimble */, - ); - productName = ApolloCodegenTests; - productReference = 9BAEEBFC234BB8FD00808306 /* ApolloCodegenTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 9F54C8B3255D760B0065AFD6 /* ApolloPerformanceTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9F54C8BC255D760B0065AFD6 /* Build configuration list for PBXNativeTarget "ApolloPerformanceTests" */; - buildPhases = ( - 9F54C8B0255D760B0065AFD6 /* Sources */, - 9F54C8B1255D760B0065AFD6 /* Frameworks */, - 9F54C8B2255D760B0065AFD6 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE903E2029CA25AA00A74415 /* PBXTargetDependency */, - DE903E1B29CA23AA00A74415 /* PBXTargetDependency */, - 9F54C8DF255D76810065AFD6 /* PBXTargetDependency */, - 9F54C8E1255D76810065AFD6 /* PBXTargetDependency */, - 9F54C8BB255D760B0065AFD6 /* PBXTargetDependency */, - ); - name = ApolloPerformanceTests; - packageProductDependencies = ( - DE903E1C29CA23B200A74415 /* Nimble */, - ); - productName = ApolloPerformanceTests; - productReference = 9F54C8B4255D760B0065AFD6 /* ApolloPerformanceTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9F8A95801EC0FC1200304A2D /* Build configuration list for PBXNativeTarget "ApolloInternalTestHelpers" */; - buildPhases = ( - 9F8A95751EC0FC1200304A2D /* Headers */, - 9F8A95731EC0FC1200304A2D /* Sources */, - 9F8A95741EC0FC1200304A2D /* Frameworks */, - DE674D9C261CEEDA000E8FC8 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9F65B1201EC106E80090B25F /* PBXTargetDependency */, - DED45E98261B9EFA0086EF63 /* PBXTargetDependency */, - DED45E96261B9EE30086EF63 /* PBXTargetDependency */, - DED45E9A261B9F000086EF63 /* PBXTargetDependency */, - ); - name = ApolloInternalTestHelpers; - packageProductDependencies = ( - ); - productName = ApolloTestSupport; - productReference = 9F8A95781EC0FC1200304A2D /* ApolloInternalTestHelpers.framework */; - productType = "com.apple.product-type.framework"; - }; - 9FACA9B71F42E67200AE2DBD /* GitHubAPI */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9FACA9C21F42E67200AE2DBD /* Build configuration list for PBXNativeTarget "GitHubAPI" */; - buildPhases = ( - 9FACA9BF1F42E67200AE2DBD /* Headers */, - 9FACA9BB1F42E67200AE2DBD /* Sources */, - 9FACA9BD1F42E67200AE2DBD /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 9FACA9B81F42E67200AE2DBD /* PBXTargetDependency */, - ); - name = GitHubAPI; - productName = StarWarsAPI; - productReference = 9FACA9C61F42E67200AE2DBD /* GitHubAPI.framework */; - productType = "com.apple.product-type.framework"; - }; - 9FC750431D2A532C00458D91 /* Apollo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9FC750581D2A532D00458D91 /* Build configuration list for PBXNativeTarget "Apollo" */; - buildPhases = ( - 9FC750411D2A532C00458D91 /* Headers */, - 90690D322243442F00FC2E54 /* Ensure no build settings are in the Xcode project */, - 9FC7503F1D2A532C00458D91 /* Sources */, - 9FC750421D2A532C00458D91 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE05862826697B1D00265760 /* PBXTargetDependency */, - ); - name = Apollo; - packageProductDependencies = ( - DEAFB785270652AF00BE02F3 /* OrderedCollections */, - E687B3F028B39A0F00A9551C /* ArgumentParser */, - ); - productName = Apollo; - productReference = 9FC750441D2A532C00458D91 /* Apollo.framework */; - productType = "com.apple.product-type.framework"; - }; - 9FC7504D1D2A532D00458D91 /* ApolloTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9FC7505B1D2A532D00458D91 /* Build configuration list for PBXNativeTarget "ApolloTests" */; - buildPhases = ( - 9FC7504A1D2A532D00458D91 /* Sources */, - 9FC7504B1D2A532D00458D91 /* Frameworks */, - C304EBD522DDC87800748F72 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE9CEAE82829A3C100959AF9 /* PBXTargetDependency */, - 9B2DFBCC24E201A000ED3AE6 /* PBXTargetDependency */, - 9FC750511D2A532D00458D91 /* PBXTargetDependency */, - 9F8A958C1EC0FF9F00304A2D /* PBXTargetDependency */, - 9FCE2D081E6C254000E34457 /* PBXTargetDependency */, - ); - name = ApolloTests; - packageProductDependencies = ( - DE5EB9C426EFD4D10004176A /* Nimble */, - ); - productName = ApolloTests; - productReference = 9FC7504E1D2A532D00458D91 /* ApolloTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 9FCE2CF91E6C213D00E34457 /* StarWarsAPI */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9FCE2D031E6C213D00E34457 /* Build configuration list for PBXNativeTarget "StarWarsAPI" */; - buildPhases = ( - 9FCE2CF71E6C213D00E34457 /* Headers */, - 9FCE2CF51E6C213D00E34457 /* Sources */, - 9FCE2CF61E6C213D00E34457 /* Frameworks */, - 9F62DF3F258F45BF00E6E808 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9FA5FBB61EC05CE900304A9D /* PBXTargetDependency */, - ); - name = StarWarsAPI; - productName = StarWarsAPI; - productReference = 9FCE2CFA1E6C213D00E34457 /* StarWarsAPI.framework */; - productType = "com.apple.product-type.framework"; - }; - DE058606266978A100265760 /* ApolloAPI */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE05861D266978A100265760 /* Build configuration list for PBXNativeTarget "ApolloAPI" */; - buildPhases = ( - DE058607266978A100265760 /* Headers */, - DE058608266978A100265760 /* Sources */, - DE05861B266978A100265760 /* Frameworks */, - DE05861C266978A100265760 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ApolloAPI; - productName = ApolloCore; - productReference = DE058621266978A100265760 /* ApolloAPI.framework */; - productType = "com.apple.product-type.framework"; - }; - DE3C7A00260A6B9800D2F4FF /* AnimalKingdomAPI */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE3C7A0D260A6B9800D2F4FF /* Build configuration list for PBXNativeTarget "AnimalKingdomAPI" */; - buildPhases = ( - DE3C7A08260A6B9800D2F4FF /* Headers */, - DE3C7A04260A6B9800D2F4FF /* Sources */, - DE3C7A06260A6B9800D2F4FF /* Frameworks */, - DE3C7A0A260A6B9800D2F4FF /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE6D083527BDAB9E009F5F33 /* PBXTargetDependency */, - ); - name = AnimalKingdomAPI; - productName = StarWarsAPI; - productReference = DE3C7A11260A6B9800D2F4FF /* AnimalKingdomAPI.framework */; - productType = "com.apple.product-type.framework"; - }; - DE6B15AB26152BE10068D642 /* ApolloServerIntegrationTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE6B15B726152BE10068D642 /* Build configuration list for PBXNativeTarget "ApolloServerIntegrationTests" */; - buildPhases = ( - DE6B15A826152BE10068D642 /* Sources */, - DE6B15A926152BE10068D642 /* Frameworks */, - DE6B15AA26152BE10068D642 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - E61D426928803F2E00C00F97 /* PBXTargetDependency */, - DECD498E262F840100924527 /* PBXTargetDependency */, - DECD4735262F668200924527 /* PBXTargetDependency */, - DECD46FA262F659100924527 /* PBXTargetDependency */, - DED46034261CEA610086EF63 /* PBXTargetDependency */, - DED45FCF261CE8890086EF63 /* PBXTargetDependency */, - DED45FD6261CE89C0086EF63 /* PBXTargetDependency */, - DE6B15B326152BE10068D642 /* PBXTargetDependency */, - DED4606B261CEDD10086EF63 /* PBXTargetDependency */, - ); - name = ApolloServerIntegrationTests; - packageProductDependencies = ( - E6FDD7522880471400BD0ADA /* Nimble */, - ); - productName = ApolloServerIntegrationTests; - productReference = DE6B15AC26152BE10068D642 /* ApolloServerIntegrationTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - DE9CEAB328299E8500959AF9 /* ApolloTestSupport */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE9CEAD828299E8500959AF9 /* Build configuration list for PBXNativeTarget "ApolloTestSupport" */; - buildPhases = ( - DE9CEAD228299E8500959AF9 /* Headers */, - DE9CEABB28299E8500959AF9 /* Sources */, - DE9CEACE28299E8500959AF9 /* Frameworks */, - DE9CEAD428299E8500959AF9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE903E2429CE59BD00A74415 /* PBXTargetDependency */, - DE9CEAE32829A01A00959AF9 /* PBXTargetDependency */, - ); - name = ApolloTestSupport; - packageProductDependencies = ( - ); - productName = ApolloTestSupport; - productReference = DE9CEADC28299E8500959AF9 /* ApolloTestSupport.framework */; - productType = "com.apple.product-type.framework"; - }; - DECD490A262F81BF00924527 /* ApolloCodegenInternalTestHelpers */ = { - isa = PBXNativeTarget; - buildConfigurationList = DECD4910262F81BF00924527 /* Build configuration list for PBXNativeTarget "ApolloCodegenInternalTestHelpers" */; - buildPhases = ( - DECD4906262F81BF00924527 /* Headers */, - DECD4907262F81BF00924527 /* Sources */, - DECD4908262F81BF00924527 /* Frameworks */, - DECD4909262F81BF00924527 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DECD49C8262F88FA00924527 /* PBXTargetDependency */, - ); - name = ApolloCodegenInternalTestHelpers; - packageProductDependencies = ( - ); - productName = ApolloCodegenTestSupport; - productReference = DECD490B262F81BF00924527 /* ApolloCodegenInternalTestHelpers.framework */; - productType = "com.apple.product-type.framework"; - }; - E66B836528093D7C001B3F2D /* SubscriptionAPI */ = { - isa = PBXNativeTarget; - buildConfigurationList = E66B836D28093D7C001B3F2D /* Build configuration list for PBXNativeTarget "SubscriptionAPI" */; - buildPhases = ( - E66B836128093D7C001B3F2D /* Headers */, - E66B836228093D7C001B3F2D /* Sources */, - E66B836328093D7C001B3F2D /* Frameworks */, - E66B836428093D7C001B3F2D /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - E6C2B39D2809409900F4CE13 /* PBXTargetDependency */, - ); - name = SubscriptionAPI; - productName = SubscriptionAPI; - productReference = E66B836628093D7C001B3F2D /* SubscriptionAPI.framework */; - productType = "com.apple.product-type.framework"; - }; - E687B3C028B398CB00A9551C /* CodegenCLI */ = { - isa = PBXNativeTarget; - buildConfigurationList = E687B3C828B398CC00A9551C /* Build configuration list for PBXNativeTarget "CodegenCLI" */; - buildPhases = ( - E687B3BC28B398CB00A9551C /* Headers */, - E687B3BD28B398CB00A9551C /* Sources */, - E687B3BE28B398CB00A9551C /* Frameworks */, - E687B3BF28B398CB00A9551C /* Resources */, - E687B3EE28B3993000A9551C /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - E687B3ED28B3993000A9551C /* PBXTargetDependency */, - ); - name = CodegenCLI; - packageProductDependencies = ( - E687B3F128B39A5B00A9551C /* ArgumentParser */, - ); - productName = CodegenCLI; - productReference = E687B3C128B398CB00A9551C /* CodegenCLI.framework */; - productType = "com.apple.product-type.framework"; - }; - E6DC0ABD28B3AB890064A68F /* CodegenCLITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = E6DC0AC828B3AB890064A68F /* Build configuration list for PBXNativeTarget "CodegenCLITests" */; - buildPhases = ( - E6DC0ABA28B3AB890064A68F /* Sources */, - E6DC0ABB28B3AB890064A68F /* Frameworks */, - E6DC0ABC28B3AB890064A68F /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DEC2EA92291ED3890088D3BB /* PBXTargetDependency */, - DEC2EA8F291ED0DE0088D3BB /* PBXTargetDependency */, - E6DC0AC428B3AB890064A68F /* PBXTargetDependency */, - ); - name = CodegenCLITests; - packageProductDependencies = ( - E6DC0AE128B3AC7E0064A68F /* Nimble */, - ); - productName = CodegenCLITests; - productReference = E6DC0ABE28B3AB890064A68F /* CodegenCLITests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 9FC7503B1D2A532C00458D91 /* Project object */ = { - isa = PBXProject; - attributes = { - KnownAssetTags = ( - "starwars-graphql", - ); - LastSwiftUpdateCheck = 1340; - LastUpgradeCheck = 1430; - ORGANIZATIONNAME = "Apollo GraphQL"; - TargetAttributes = { - 9B2DFBB524E1FA0D00ED3AE6 = { - CreatedOnToolsVersion = 11.6; - LastSwiftMigration = 1160; - }; - 9B7B6F46233C26D100F32205 = { - CreatedOnToolsVersion = 11.0; - LastSwiftMigration = 1100; - }; - 9B7BDA7C23FDE90400ACD198 = { - CreatedOnToolsVersion = 11.3.1; - }; - 9B7BDABE23FDEBB600ACD198 = { - CreatedOnToolsVersion = 11.3.1; - }; - 9BAEEBFB234BB8FD00808306 = { - CreatedOnToolsVersion = 11.0; - }; - 9F54C8B3255D760B0065AFD6 = { - CreatedOnToolsVersion = 12.1.1; - }; - 9F8A95771EC0FC1200304A2D = { - CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 1020; - ProvisioningStyle = Manual; - }; - 9FACA9B71F42E67200AE2DBD = { - ProvisioningStyle = Manual; - }; - 9FC750431D2A532C00458D91 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeamName = "Martijn Walraven"; - LastSwiftMigration = 1020; - ProvisioningStyle = Manual; - }; - 9FC7504D1D2A532D00458D91 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeamName = "Martijn Walraven"; - LastSwiftMigration = 1020; - ProvisioningStyle = Manual; - }; - 9FCE2CF91E6C213D00E34457 = { - CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 1020; - ProvisioningStyle = Manual; - }; - DE3C7A00260A6B9800D2F4FF = { - LastSwiftMigration = 1300; - }; - DE6B15AB26152BE10068D642 = { - CreatedOnToolsVersion = 12.4; - }; - DE9CEAB328299E8500959AF9 = { - LastSwiftMigration = 1330; - }; - DECD490A262F81BF00924527 = { - CreatedOnToolsVersion = 12.4; - }; - E66B836528093D7C001B3F2D = { - CreatedOnToolsVersion = 13.3; - LastSwiftMigration = 1330; - }; - E687B3C028B398CB00A9551C = { - CreatedOnToolsVersion = 13.4.1; - }; - E6DC0ABD28B3AB890064A68F = { - CreatedOnToolsVersion = 13.4.1; - }; - }; - }; - buildConfigurationList = 9FC7503E1D2A532C00458D91 /* Build configuration list for PBXProject "Apollo" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 9FC7503A1D2A532C00458D91; - packageReferences = ( - 9B7BDAF423FDEE2600ACD198 /* XCRemoteSwiftPackageReference "SQLite.swift" */, - E6E4209026A7DF4200B82624 /* XCRemoteSwiftPackageReference "InflectorKit" */, - DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */, - DEAFB784270652AF00BE02F3 /* XCRemoteSwiftPackageReference "swift-collections" */, - E687B3EF28B39A0F00A9551C /* XCRemoteSwiftPackageReference "swift-argument-parser" */, - ); - productRefGroup = 9FC750451D2A532C00458D91 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 9FC750431D2A532C00458D91 /* Apollo */, - DE058606266978A100265760 /* ApolloAPI */, - 9B7BDABE23FDEBB600ACD198 /* ApolloSQLite */, - 9B7BDA7C23FDE90400ACD198 /* ApolloWebSocket */, - 9FC7504D1D2A532D00458D91 /* ApolloTests */, - 9F54C8B3255D760B0065AFD6 /* ApolloPerformanceTests */, - DE6B15AB26152BE10068D642 /* ApolloServerIntegrationTests */, - 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */, - DE3C7A00260A6B9800D2F4FF /* AnimalKingdomAPI */, - 9FCE2CF91E6C213D00E34457 /* StarWarsAPI */, - 9FACA9B71F42E67200AE2DBD /* GitHubAPI */, - 9B2DFBB524E1FA0D00ED3AE6 /* UploadAPI */, - E66B836528093D7C001B3F2D /* SubscriptionAPI */, - 9B7B6F46233C26D100F32205 /* ApolloCodegenLib */, - 9BAEEBFB234BB8FD00808306 /* ApolloCodegenTests */, - DECD490A262F81BF00924527 /* ApolloCodegenInternalTestHelpers */, - DE9CEAB328299E8500959AF9 /* ApolloTestSupport */, - E687B3C028B398CB00A9551C /* CodegenCLI */, - E6DC0ABD28B3AB890064A68F /* CodegenCLITests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 9B2DFBB424E1FA0D00ED3AE6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7B6F45233C26D100F32205 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDA7B23FDE90400ACD198 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDABD23FDEBB600ACD198 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9BAEEBFA234BB8FD00808306 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E6C4267B26F16CB400904AD2 /* introspection_response.json in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F54C8B2255D760B0065AFD6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FD1519A255D7F30003BDAAA /* IssuesAndCommentsForRepository.json in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F62DF3F258F45BF00E6E808 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FC750421D2A532C00458D91 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C304EBD522DDC87800748F72 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE05861C266978A100265760 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE3C7A0A260A6B9800D2F4FF /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 96F32D3B27CCD16B00F3383C /* animalkingdom-graphql in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE674D9C261CEEDA000E8FC8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE674D9F261CEEE4000E8FC8 /* a.txt in Resources */, - DE674D9E261CEEE4000E8FC8 /* b.txt in Resources */, - DE674D9D261CEEE4000E8FC8 /* c.txt in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE6B15AA26152BE10068D642 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE9CEAD428299E8500959AF9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DECD4909262F81BF00924527 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DECFEFE4286A3C8900DBE83C /* starwars-graphql in Resources */, - 96F32D3C27CCD16D00F3383C /* animalkingdom-graphql in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E66B836428093D7C001B3F2D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E6180AA628093EB7004EC2A3 /* schema.graphqls in Resources */, - E6180AA828093EB7004EC2A3 /* subscription.graphql in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E687B3BF28B398CB00A9551C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E6DC0ABC28B3AB890064A68F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 90690D322243442F00FC2E54 /* Ensure no build settings are in the Xcode project */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Ensure no build settings are in the Xcode project"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"$SRCROOT\"/scripts/ensure-no-build-settings-in-pbxproj.sh \"${PROJECT_FILE_PATH}\"\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 9B2DFBB224E1FA0D00ED3AE6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE63895A28D3D62400559697 /* Upload.swift in Sources */, - DE63895728D3D62400559697 /* UploadMultipleFilesToTheSameParameterMutation.graphql.swift in Sources */, - DE63895B28D3D62400559697 /* File.graphql.swift in Sources */, - DE63895928D3D62400559697 /* UploadMultipleFilesToDifferentParametersMutation.graphql.swift in Sources */, - DE63895D28D3D62400559697 /* SchemaConfiguration.swift in Sources */, - DE63895828D3D62400559697 /* UploadOneFileMutation.graphql.swift in Sources */, - DE63895E28D3D62400559697 /* SchemaMetadata.graphql.swift in Sources */, - DE63895C28D3D62400559697 /* Mutation.graphql.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7B6F43233C26D100F32205 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E610D8D7278EA2390023E495 /* EnumFileGenerator.swift in Sources */, - DE4B1E592891D5FE0058D1F6 /* IsEverTrue.swift in Sources */, - 9BAEEBEE2346644600808306 /* ApolloSchemaDownloadConfiguration.swift in Sources */, - DE0D38F0282ECA6D00AFCC84 /* MockObjectFileGenerator.swift in Sources */, - 9B8C3FB3248DA2FE00707B13 /* URL+Apollo.swift in Sources */, - DEFE694E280F6CBE001CF4E8 /* IR+FieldCollector.swift in Sources */, - E66F8899276C15580000BDA8 /* ObjectFileGenerator.swift in Sources */, - 9BAEEBEF2346644B00808306 /* ApolloSchemaDownloader.swift in Sources */, - DE5FD601276923620033EE23 /* TemplateString.swift in Sources */, - DE01451428A5A156000F6F18 /* ValidationOptions.swift in Sources */, - E669352B2803EE11004E1FFC /* CustomScalarTemplate.swift in Sources */, - E6EE62F127DBE6F200627257 /* SchemaModuleNamespaceTemplate.swift in Sources */, - DE6D07FF27BC7F78009F5F33 /* InputVariableRenderable.swift in Sources */, - DE796429276998B000978A03 /* IR+RootFieldBuilder.swift in Sources */, - DE9CEAEF282C62B700959AF9 /* MockObjectTemplate.swift in Sources */, - DE6388DF28CBF38E00559697 /* GraphQLEnumValue+Rendered.swift in Sources */, - E64F7EC127A122300059C021 /* ObjectTemplate.swift in Sources */, - 9F1A966F258F34BB00A06EEB /* JavaScriptBridge.swift in Sources */, - 9BAEEBF72346F0A000808306 /* StaticString+Apollo.swift in Sources */, - E623FD2A2797A6F4008B4CED /* InterfaceTemplate.swift in Sources */, - DE4D54E727A3504B00D26B68 /* OperationFileGenerator.swift in Sources */, - E6B42D0927A472A700A3BD58 /* SwiftPackageManagerModuleTemplate.swift in Sources */, - DE100B1A28872D0F00BE11C2 /* Documentation.docc in Sources */, - E6D90D07278FA595009CAC5D /* InputObjectFileGenerator.swift in Sources */, - 534A754528EB21D6003291BE /* TemplateString+DeprecationMessage.swift in Sources */, - E64F7EB827A0854E0059C021 /* UnionTemplate.swift in Sources */, - E60AE2EE27E3FC6C003C093A /* TemplateRenderer.swift in Sources */, - 9BCA8C0926618226004FF2F6 /* UntypedGraphQLRequestBodyCreator.swift in Sources */, - DEF330352A4B6DEE0081883D /* PersistedQueriesOperationManifestTemplate.swift in Sources */, - DE5FD60527694FA70033EE23 /* SchemaMetadataTemplate.swift in Sources */, - DEFBBC86273470F70088AABC /* IR+Field.swift in Sources */, - 9F62DFD02590710E00E6E808 /* GraphQLSource.swift in Sources */, - E63F0C0328EE0F2A009069EA /* ApolloCodegenFrontendBundle.swift in Sources */, - DE4B1E582891D5F10058D1F6 /* LinkedList.swift in Sources */, - DE5FD60B276970FC0033EE23 /* FragmentTemplate.swift in Sources */, - 9BAEEBF32346DDAD00808306 /* CodegenLogger.swift in Sources */, - 9F628EB52593651B00F94F9D /* GraphQLValue.swift in Sources */, - DE5FD5FD2769222D0033EE23 /* OperationDefinitionTemplate.swift in Sources */, - DE6B650C27C4293D00970E4E /* FieldArgumentRendering.swift in Sources */, - DE5EEC8527988F1A00AF5913 /* IR+SelectionSet.swift in Sources */, - DE8C51CA29E8B03700E47A64 /* IRDefinition+RenderingHelpers.swift in Sources */, - E6AAA739286C87EA00F4659D /* LegacyAPQOperationManifestTemplate.swift in Sources */, - DE3484622746FF8F0065B77E /* IR+OperationBuilder.swift in Sources */, - E669352F2803F09C004E1FFC /* CustomScalarFileGenerator.swift in Sources */, - E610D8DF278F8F1E0023E495 /* UnionFileGenerator.swift in Sources */, - DED5B35B286CF16600AE6BFF /* TemplateString+CodegenConfiguration.swift in Sources */, - DEE2DAA227BAF00500EC0607 /* GraphQLType+Rendered.swift in Sources */, - DE223C2D2721FCE8004A0148 /* ScopedSelectionSetHashable.swift in Sources */, - E6203344284F1D1100A291D1 /* MockUnionsTemplate.swift in Sources */, - DE79642D27699A6A00978A03 /* IR+NamedFragmentBuilder.swift in Sources */, - 9B47518D2575AA850001FB87 /* Pluralizer.swift in Sources */, - E6D90D0B278FFDDA009CAC5D /* SchemaMetadataFileGenerator.swift in Sources */, - DE7C183C272A12EB00727031 /* ScopeDescriptor.swift in Sources */, - DE7C183E272A154400727031 /* IR.swift in Sources */, - 9F628E9525935BE600F94F9D /* GraphQLType.swift in Sources */, - 9BFE8DA9265D5D8F000BBF81 /* URLDownloader.swift in Sources */, - E6C9849327929EBE009481BE /* EnumTemplate.swift in Sources */, - DE01451228A442BF000F6F18 /* String+SwiftNameEscaping.swift in Sources */, - E68D824727A228A80040A46F /* SchemaModuleFileGenerator.swift in Sources */, - 9F1A966D258F34BB00A06EEB /* CompilationResult.swift in Sources */, - DE4D54E927A3518100D26B68 /* FragmentFileGenerator.swift in Sources */, - E610D8DB278EB0900023E495 /* InterfaceFileGenerator.swift in Sources */, - 9B7B6F69233C2C0C00F32205 /* FileManager+Apollo.swift in Sources */, - DE071E7A2899FB7F0089BDAA /* GraphQLCompositeType+SchemaTypeNamespace.swift in Sources */, - E674DB41274C0A9B009BB90E /* Glob.swift in Sources */, - DE71FDC02853C242005FA9CC /* OperationTemplateRenderer.swift in Sources */, - E6203342284F1C9600A291D1 /* MockUnionsFileGenerator.swift in Sources */, - DE6D07F927BC3B6D009F5F33 /* GraphQLInputField+Rendered.swift in Sources */, - 9F1A966C258F34BB00A06EEB /* GraphQLSchema.swift in Sources */, - 6608B3362A7D402B006FB655 /* ApolloCodegenConfiguration+OperationManifestConfiguration.swift in Sources */, - 9BE74D3D23FB4A8E006D354F /* FileFinder.swift in Sources */, - E64F7EBC27A11A510059C021 /* GraphQLNamedType+SwiftName.swift in Sources */, - 9B7B6F59233C287200F32205 /* ApolloCodegen.swift in Sources */, - DE2739112769AEBA00B886EF /* SelectionSetTemplate.swift in Sources */, - DEA9A23227D822E600F96C36 /* IR+InclusionConditions.swift in Sources */, - DE454BA928B40DA8009DC80E /* SchemaConfigurationFileGenerator.swift in Sources */, - E6E3BBE2276A8D6200E5218B /* FileGenerator.swift in Sources */, - DEFE0FC52748822900FFA440 /* IR+EntitySelectionTree.swift in Sources */, - 9F62E03F2590896400E6E808 /* GraphQLError.swift in Sources */, - E6AAA732286BC58200F4659D /* OperationManifestFileGenerator.swift in Sources */, - 9B7B6F5A233C287200F32205 /* ApolloCodegenConfiguration.swift in Sources */, - 66321AE72A126C4400CC35CB /* IR+Formatting.swift in Sources */, - 9F1A966B258F34BB00A06EEB /* GraphQLJSFrontend.swift in Sources */, - DEB05B48289C3B4000170299 /* MockInterfacesFileGenerator.swift in Sources */, - DE09114E27288B1F000648E5 /* SortedSelections.swift in Sources */, - DE5FD607276950CC0033EE23 /* IR+Schema.swift in Sources */, - E69BEDA52798B86D00000D10 /* InputObjectTemplate.swift in Sources */, - DE454BAB28B40E56009DC80E /* SchemaConfigurationTemplate.swift in Sources */, - DEB05B4A289C3EC300170299 /* MockInterfacesTemplate.swift in Sources */, - DE71FDBC2853B67C005FA9CC /* LocalCacheMutationDefinitionTemplate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDA7923FDE90400ACD198 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9B7BDA9F23FDE94C00ACD198 /* WebSocketClient.swift in Sources */, - DE181A2C26C5C0CB000C0B9C /* WebSocket.swift in Sources */, - DE181A2E26C5C299000C0B9C /* SSLClientCertificate.swift in Sources */, - 9B7BDAA023FDE94C00ACD198 /* WebSocketTransport.swift in Sources */, - 9B7BDA9C23FDE94C00ACD198 /* WebSocketTask.swift in Sources */, - DE181A3026C5C38E000C0B9C /* SSLSecurity.swift in Sources */, - 9B7BDA9B23FDE94C00ACD198 /* WebSocketError.swift in Sources */, - 9B7BDA9D23FDE94C00ACD198 /* SplitNetworkTransport.swift in Sources */, - 9B7BDA9E23FDE94C00ACD198 /* OperationMessage.swift in Sources */, - 19E9F6B526D6BF25003AB80E /* OperationMessageIdCreator.swift in Sources */, - DE100B202887415D00BE11C2 /* Documentation.docc in Sources */, - DE181A3626C5DE4F000C0B9C /* WebSocketStream.swift in Sources */, - DE181A3226C5C401000C0B9C /* Compression.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9B7BDABB23FDEBB600ACD198 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9B7BDAD023FDEBE300ACD198 /* SQLiteSerialization.swift in Sources */, - 9B7BDAD223FDEBE300ACD198 /* SQLiteNormalizedCache.swift in Sources */, - 9B9F16B82601532500FB2F31 /* SQLiteDotSwiftDatabase.swift in Sources */, - DE100B1E28873A2500BE11C2 /* Documentation.docc in Sources */, - 9B9F16A726013DAB00FB2F31 /* SQLiteDatabase.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9BAEEBF8234BB8FD00808306 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E669352D2803EF67004E1FFC /* CustomScalarTemplateTests.swift in Sources */, - 9BAEEC10234BB95B00808306 /* FileManagerExtensionTests.swift in Sources */, - DE454BA728B40D52009DC80E /* SchemaConfigurationFileGeneratorTests.swift in Sources */, - DE5E79BB289DA90600CD0DE5 /* MockInterfacesFileGeneratorTests.swift in Sources */, - E6AAA737286C11E600F4659D /* OperationManifestFileGeneratorTests.swift in Sources */, - E6D90D09278FA5C3009CAC5D /* InputObjectFileGeneratorTests.swift in Sources */, - E674DB43274C0AD9009BB90E /* GlobTests.swift in Sources */, - DE223C1C271F3288004A0148 /* AnimalKingdomIRCreationTests.swift in Sources */, - 9BAEEC17234C275600808306 /* ApolloSchemaPublicTests.swift in Sources */, - E66935312803F2B0004E1FFC /* CustomScalarFileGeneratorTests.swift in Sources */, - E610D8DD278EB1500023E495 /* InterfaceFileGeneratorTests.swift in Sources */, - DE0D38F2282ECF9700AFCC84 /* MockObjectFileGeneratorTests.swift in Sources */, - DE5E79BD289DA97E00CD0DE5 /* MockInterfacesTemplateTests.swift in Sources */, - 9F62DFAE2590557F00E6E808 /* DocumentParsingAndValidationTests.swift in Sources */, - E66935332804AFE5004E1FFC /* IRCustomScalarTests.swift in Sources */, - DED5B357286CD34000AE6BFF /* CompilationResultSchemaDocumentationTests.swift in Sources */, - 9F62E0102590728000E6E808 /* CompilationTests.swift in Sources */, - DEAFB77B2706444B00BE02F3 /* IRRootFieldBuilderTests.swift in Sources */, - E6EFDD1527EAB55B00B17FE5 /* TemplateRenderer_OperationFile_Tests.swift in Sources */, - DE454BB528B43058009DC80E /* SchemaConfigurationTemplateTests.swift in Sources */, - E6D9212B28DA66B300AF12E6 /* String+Data.swift in Sources */, - E6B42D0D27A4749100A3BD58 /* SwiftPackageManagerModuleTemplateTests.swift in Sources */, - DE296539279B3B8200BF9B49 /* SelectionSetTemplateTests.swift in Sources */, - E66F8897276C136B0000BDA8 /* ObjectFileGeneratorTests.swift in Sources */, - DE1540DC2A3A76F700A5A8B6 /* IRInputObjectTests.swift in Sources */, - DE79642B276999E700978A03 /* IRNamedFragmentBuilderTests.swift in Sources */, - E69BEDA72798B89600000D10 /* InputObjectTemplateTests.swift in Sources */, - E6EE62F327DBE75A00627257 /* SchemaModuleNamespaceTemplateTests.swift in Sources */, - 9B8C3FB5248DA3E000707B13 /* URLExtensionsTests.swift in Sources */, - E64F7EBA27A085D90059C021 /* UnionTemplateTests.swift in Sources */, - E610D8D9278EA2560023E495 /* EnumFileGeneratorTests.swift in Sources */, - E6203348284F25DF00A291D1 /* MockUnionsTemplateTests.swift in Sources */, - 9FDE0731258F3AA100DC0CA5 /* SchemaLoadingTests.swift in Sources */, - E6203346284F252A00A291D1 /* MockUnionsFileGeneratorTests.swift in Sources */, - E6908E55282694630054682B /* ApolloCodegenConfigurationCodableTests.swift in Sources */, - DE223C3327221144004A0148 /* IRMatchers.swift in Sources */, - DEF330372A4B6EAA0081883D /* PersistedQueriesOperationManifestTemplateTests.swift in Sources */, - E64F7EBF27A11B110059C021 /* GraphQLNamedType+SwiftTests.swift in Sources */, - DE79642F2769A1EB00978A03 /* IROperationBuilderTests.swift in Sources */, - DEA9A23027CD990500F96C36 /* IRSelectionSet_IncludeSkip_Tests.swift in Sources */, - DE9CEAF3282C6AC300959AF9 /* TemplateRenderer_TestMockFile_Tests.swift in Sources */, - E68D824527A1D8A60040A46F /* ObjectTemplateTests.swift in Sources */, - E6A6866427F63AEF008A1D13 /* FileGeneratorTests.swift in Sources */, - E61F4BF827A8FC8E0049886A /* FragmentFileGeneratorTests.swift in Sources */, - E657CDBA26FD01D4005834D6 /* ApolloSchemaInternalTests.swift in Sources */, - DEFE695128134028001CF4E8 /* IRFieldCollectorTests.swift in Sources */, - DED5B359286CEA0900AE6BFF /* TemplateString_Documentation_Tests.swift in Sources */, - E6D79AB826E9D59C0094434A /* URLDownloaderTests.swift in Sources */, - E607AD8E27A88F340026742A /* OperationFileGeneratorTests.swift in Sources */, - E6C9849527929FED009481BE /* EnumTemplateTests.swift in Sources */, - DE5FD609276956C70033EE23 /* SchemaMetadataTemplateTests.swift in Sources */, - E61EF713275EC99A00191DA7 /* ApolloCodegenTests.swift in Sources */, - DE6D07FD27BC3D53009F5F33 /* OperationDefinition_VariableDefinition_Tests.swift in Sources */, - E6B4E9992798A8CB004EC8C4 /* InterfaceTemplateTests.swift in Sources */, - E6AAA73B286CC7EF00F4659D /* LegacyAPQOperationManifestTemplateTests.swift in Sources */, - DE71FDBE2853B6D3005FA9CC /* LocalCacheMutationDefinitionTemplateTests.swift in Sources */, - E6EFDD0B27E8328E00B17FE5 /* TemplateRenderer_SchemaFile_Tests.swift in Sources */, - E6A6866627F63BDC008A1D13 /* FileGenerator_ResolvePath_Tests.swift in Sources */, - 9F62DF8E2590539A00E6E808 /* SchemaIntrospectionTests.swift in Sources */, - DE1696D4298C51CF00345E1A /* SelectionSetTemplate_Initializers_Tests.swift in Sources */, - DE71FDC42853D681005FA9CC /* SelectionSetTemplate_LocalCacheMutation_Tests.swift in Sources */, - E6D90D0D278FFE35009CAC5D /* SchemaMetadataFileGeneratorTests.swift in Sources */, - E6B42D0B27A4746800A3BD58 /* SchemaModuleFileGeneratorTests.swift in Sources */, - 9B68F0552416B33300E97318 /* LineByLineComparison.swift in Sources */, - E60F457A29E4CFB800E60A04 /* TemplateString_DeprecationMessage_Tests.swift in Sources */, - DE09066F27A4713F00211300 /* OperationDefinitionTemplateTests.swift in Sources */, - DE09F9C6270269F800795949 /* OperationDefinitionTemplate_DocumentType_Tests.swift in Sources */, - 9B4751AD2575B5070001FB87 /* PluralizerTests.swift in Sources */, - E6B4E9982798A8C6004EC8C4 /* FragmentTemplateTests.swift in Sources */, - 9BAEEC19234C297800808306 /* ApolloCodegenConfigurationTests.swift in Sources */, - E6D9212928DA631D00AF12E6 /* ApolloSchemaDownloadConfigurationCodableTests.swift in Sources */, - DE9CEAF1282C632B00959AF9 /* MockObjectTemplateTests.swift in Sources */, - E610D8E1278F8F3D0023E495 /* UnionFileGeneratorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F54C8B0255D760B0065AFD6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE903E1929CA20FC00A74415 /* TypeCaseConversionPerformanceTests.swift in Sources */, - 9F54C8B7255D760B0065AFD6 /* ParsingPerformanceTests.swift in Sources */, - DE903E2229CA622E00A74415 /* SelectionSetInitializerPerformanceTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9F8A95731EC0FC1200304A2D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E660A4D329CA5890001EA373 /* MockHTTPResponse.swift in Sources */, - DE5EB9C026EFCB010004176A /* TestObserver.swift in Sources */, - DED4601A261CE9880086EF63 /* MockWebSocket.swift in Sources */, - E608A5232808E59A001BE656 /* MockWebSocketDelegate.swift in Sources */, - 9BCF0CE423FC9CA50031D2A2 /* MockURLSession.swift in Sources */, - DE12B2D7273B204B003371CC /* TestError.swift in Sources */, - E660A4D129CA56A4001EA373 /* MockHTTPRequest.swift in Sources */, - 66B18E902A16BF9B00525DFB /* MockURLProtocol.swift in Sources */, - 9FBE0D4025407B64002ED0B1 /* AsyncResultObserver.swift in Sources */, - 9F3910272549741400AF54A6 /* MockGraphQLServer.swift in Sources */, - E6B1FEBB29F2FC97003D12E0 /* InterceptorTester.swift in Sources */, - DE71FDC22853C4C8005FA9CC /* MockLocalCacheMutation.swift in Sources */, - DEC2EA8A291D5E2E0088D3BB /* TestIsolatedFileManager.swift in Sources */, - DED45E6B261B9EAC0086EF63 /* SQLiteTestCacheProvider.swift in Sources */, - DE5EB9C226EFCBD40004176A /* MockApolloStore.swift in Sources */, - E660A4D529CAEA0F001EA373 /* MockInterceptorProvider.swift in Sources */, - 9BEEDC2B24E61995001D1294 /* TestURLs.swift in Sources */, - DED4600D261CE9260086EF63 /* TestFileHelper.swift in Sources */, - E6931D4B29CE44EA005DD9E4 /* String+Data.swift in Sources */, - DE5EB9CB26EFE5510004176A /* MockOperation.swift in Sources */, - 9BCF0CE023FC9CA50031D2A2 /* TestCacheProvider.swift in Sources */, - DE4766E826F92F30004622E0 /* MockSchemaMetadata.swift in Sources */, - 9BCF0CE323FC9CA50031D2A2 /* XCTAssertHelpers.swift in Sources */, - 9F68F9F125415827004F26D0 /* XCTestCase+Helpers.swift in Sources */, - 9BCF0CE523FC9CA50031D2A2 /* MockNetworkTransport.swift in Sources */, - DE05862D2669800000265760 /* Matchable.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FACA9BB1F42E67200AE2DBD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE638BBB28D3D64500559697 /* Minimizable.graphql.swift in Sources */, - DE638B2D28D3D64400559697 /* RepositoryVisibilityChangeDisableAuditEntry.graphql.swift in Sources */, - DE638B1428D3D64400559697 /* TeamDiscussionComment.graphql.swift in Sources */, - DE638B5B28D3D64500559697 /* PullRequestCommit.graphql.swift in Sources */, - DE638AEB28D3D64400559697 /* OrganizationInvitation.graphql.swift in Sources */, - DE638B0028D3D64400559697 /* PackageFile.graphql.swift in Sources */, - DE638B1B28D3D64400559697 /* RepoAddTopicAuditEntry.graphql.swift in Sources */, - DE638B6428D3D64500559697 /* PrivateRepositoryForkingEnableAuditEntry.graphql.swift in Sources */, - DE638B7328D3D64500559697 /* SecurityAdvisory.graphql.swift in Sources */, - DE638BBA28D3D64500559697 /* Actor.graphql.swift in Sources */, - DE638BA028D3D64500559697 /* PublicKey.graphql.swift in Sources */, - DE638BB228D3D64500559697 /* GitObject.graphql.swift in Sources */, - DE638B4828D3D64400559697 /* OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift in Sources */, - DE638B5C28D3D64500559697 /* UserBlockedEvent.graphql.swift in Sources */, - DE638B9228D3D64500559697 /* ReviewDismissalAllowance.graphql.swift in Sources */, - DE638BAF28D3D64500559697 /* Comment.graphql.swift in Sources */, - DE638B7928D3D64500559697 /* App.graphql.swift in Sources */, - DE638AEA28D3D64400559697 /* MarkedAsDuplicateEvent.graphql.swift in Sources */, - DE638B2528D3D64400559697 /* RepoAddMemberAuditEntry.graphql.swift in Sources */, - DE638B5428D3D64400559697 /* PackageVersion.graphql.swift in Sources */, - DE638BA328D3D64500559697 /* EnterpriseServerUserAccountEmail.graphql.swift in Sources */, - DE638B9328D3D64500559697 /* AssignedEvent.graphql.swift in Sources */, - DE638B2C28D3D64400559697 /* IssueCommentConnection.graphql.swift in Sources */, - DE638B4328D3D64400559697 /* EnterpriseUserAccount.graphql.swift in Sources */, - DE638B0328D3D64400559697 /* OrgEnableTwoFactorRequirementAuditEntry.graphql.swift in Sources */, - DE638B7C28D3D64500559697 /* DemilestonedEvent.graphql.swift in Sources */, - DE638AF328D3D64400559697 /* OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift in Sources */, - DE638B3E28D3D64400559697 /* ReviewRequest.graphql.swift in Sources */, - DE638BC328D3D64500559697 /* EnterpriseAuditEntryData.graphql.swift in Sources */, - DE638AF228D3D64400559697 /* DependencyGraphManifest.graphql.swift in Sources */, - DE638BB928D3D64500559697 /* Closable.graphql.swift in Sources */, - DE638B5528D3D64400559697 /* CommentDeletedEvent.graphql.swift in Sources */, - DE638AED28D3D64400559697 /* OrgInviteToBusinessAuditEntry.graphql.swift in Sources */, - DE638B0628D3D64400559697 /* PushAllowance.graphql.swift in Sources */, - DE638B5A28D3D64500559697 /* MembersCanDeleteReposDisableAuditEntry.graphql.swift in Sources */, - DE638AE628D3D64400559697 /* IssueOrPullRequest.graphql.swift in Sources */, - DE638B2028D3D64400559697 /* DeployKey.graphql.swift in Sources */, - DE638B1528D3D64400559697 /* TeamRemoveRepositoryAuditEntry.graphql.swift in Sources */, - DE638B8D28D3D64500559697 /* EnterpriseServerInstallation.graphql.swift in Sources */, - DE638B4C28D3D64400559697 /* OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */, - DE638B3328D3D64400559697 /* Push.graphql.swift in Sources */, - DE638B7028D3D64500559697 /* BaseRefChangedEvent.graphql.swift in Sources */, - DE638BBD28D3D64500559697 /* TopicAuditEntryData.graphql.swift in Sources */, - DE638B9B28D3D64500559697 /* OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift in Sources */, - DE638B9528D3D64500559697 /* RepositoryVisibilityChangeEnableAuditEntry.graphql.swift in Sources */, - DE638BBC28D3D64500559697 /* Assignable.graphql.swift in Sources */, - DE638BBE28D3D64500559697 /* RepositoryInfo.graphql.swift in Sources */, - DE638B7628D3D64500559697 /* OrgUpdateMemberAuditEntry.graphql.swift in Sources */, - DE638B7E28D3D64500559697 /* UserContentEdit.graphql.swift in Sources */, - DE638B9128D3D64500559697 /* UnlabeledEvent.graphql.swift in Sources */, - DE638AFD28D3D64400559697 /* UnmarkedAsDuplicateEvent.graphql.swift in Sources */, - DE638AF028D3D64400559697 /* Sponsorship.graphql.swift in Sources */, - DE638BAA28D3D64500559697 /* TeamAuditEntryData.graphql.swift in Sources */, - DE638BC528D3D64500559697 /* RepositoryAuditEntryData.graphql.swift in Sources */, - DE638B7228D3D64500559697 /* Issue.graphql.swift in Sources */, - DE638B9628D3D64500559697 /* OrganizationIdentityProvider.graphql.swift in Sources */, - DE638AE228D3D64400559697 /* AuthorDetails.graphql.swift in Sources */, - DE638B8028D3D64500559697 /* MilestonedEvent.graphql.swift in Sources */, - DE638B9E28D3D64500559697 /* AutomaticBaseChangeFailedEvent.graphql.swift in Sources */, - DE638B4D28D3D64400559697 /* RepoDestroyAuditEntry.graphql.swift in Sources */, - DE638B2228D3D64400559697 /* PrivateRepositoryForkingDisableAuditEntry.graphql.swift in Sources */, - DE638BB528D3D64500559697 /* UniformResourceLocatable.graphql.swift in Sources */, - DE638B9428D3D64500559697 /* PullRequestReviewComment.graphql.swift in Sources */, - DE638AE928D3D64400559697 /* UnlockedEvent.graphql.swift in Sources */, - DE638B5328D3D64400559697 /* Team.graphql.swift in Sources */, - DE638B6128D3D64500559697 /* Gist.graphql.swift in Sources */, - DE638B1628D3D64400559697 /* User.graphql.swift in Sources */, - DE638BC128D3D64500559697 /* Updatable.graphql.swift in Sources */, - DE638B4E28D3D64400559697 /* Reaction.graphql.swift in Sources */, - DE638AE728D3D64400559697 /* URI.swift in Sources */, - DE638AE828D3D64400559697 /* MarketplaceListing.graphql.swift in Sources */, - DE638B3228D3D64400559697 /* DeploymentEnvironmentChangedEvent.graphql.swift in Sources */, - DE638B1228D3D64400559697 /* TeamAddRepositoryAuditEntry.graphql.swift in Sources */, - DE638BA128D3D64500559697 /* ReadyForReviewEvent.graphql.swift in Sources */, - DE638B9A28D3D64500559697 /* UserStatus.graphql.swift in Sources */, - DE638B9828D3D64500559697 /* ReleaseAsset.graphql.swift in Sources */, - DE638BA228D3D64500559697 /* ProjectColumn.graphql.swift in Sources */, - DE638BA528D3D64500559697 /* RepositoryVulnerabilityAlert.graphql.swift in Sources */, - DE638B7728D3D64500559697 /* LabeledEvent.graphql.swift in Sources */, - DE638B0428D3D64400559697 /* StatusCheckRollup.graphql.swift in Sources */, - DE638B5928D3D64500559697 /* ClosedEvent.graphql.swift in Sources */, - DE638B2628D3D64400559697 /* ReviewRequestRemovedEvent.graphql.swift in Sources */, - DE638B2328D3D64400559697 /* OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift in Sources */, - DE638B1A28D3D64400559697 /* Status.graphql.swift in Sources */, - DE638B0928D3D64400559697 /* OauthApplicationCreateAuditEntry.graphql.swift in Sources */, - DE638B8228D3D64500559697 /* UnassignedEvent.graphql.swift in Sources */, - DE638BA628D3D64500559697 /* RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift in Sources */, - DE638AF828D3D64400559697 /* OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift in Sources */, - DE638B2B28D3D64400559697 /* RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift in Sources */, - DE638AEE28D3D64400559697 /* PullRequestReviewThread.graphql.swift in Sources */, - DE638B2128D3D64400559697 /* OrgAddBillingManagerAuditEntry.graphql.swift in Sources */, - DE638B2F28D3D64400559697 /* UnpinnedEvent.graphql.swift in Sources */, - DE638B1828D3D64400559697 /* SponsorsTier.graphql.swift in Sources */, - DE638BAB28D3D64500559697 /* Labelable.graphql.swift in Sources */, - DE638BAD28D3D64500559697 /* RepositoryNode.graphql.swift in Sources */, - DE638AEF28D3D64400559697 /* RepoChangeMergeSettingAuditEntry.graphql.swift in Sources */, - DE638B3D28D3D64400559697 /* MergedEvent.graphql.swift in Sources */, - DE638B4A28D3D64400559697 /* OrgOauthAppAccessDeniedAuditEntry.graphql.swift in Sources */, - DE638B0128D3D64400559697 /* OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift in Sources */, - DE638BC228D3D64500559697 /* Subscribable.graphql.swift in Sources */, - DE638B5228D3D64400559697 /* Language.graphql.swift in Sources */, - DE638B7A28D3D64500559697 /* StatusContext.graphql.swift in Sources */, - DE638B2428D3D64400559697 /* OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift in Sources */, - DE638BAE28D3D64500559697 /* UpdatableComment.graphql.swift in Sources */, - DE638B0E28D3D64400559697 /* TeamRemoveMemberAuditEntry.graphql.swift in Sources */, - DE638B3B28D3D64400559697 /* OrgRemoveBillingManagerAuditEntry.graphql.swift in Sources */, - DE638BAC28D3D64500559697 /* OrganizationAuditEntryData.graphql.swift in Sources */, - DE638AF728D3D64400559697 /* ConnectedEvent.graphql.swift in Sources */, - DE638B6028D3D64500559697 /* Tag.graphql.swift in Sources */, - DE638B9728D3D64500559697 /* MentionedEvent.graphql.swift in Sources */, - DE638B3A28D3D64400559697 /* Ref.graphql.swift in Sources */, - DE638BB328D3D64500559697 /* ProjectOwner.graphql.swift in Sources */, - DE638B8828D3D64500559697 /* TransferredEvent.graphql.swift in Sources */, - DE638B6E28D3D64500559697 /* SavedReply.graphql.swift in Sources */, - DE638B8128D3D64500559697 /* TeamChangeParentTeamAuditEntry.graphql.swift in Sources */, - DE638BC428D3D64500559697 /* Node.graphql.swift in Sources */, - DE638BB028D3D64500559697 /* Sponsorable.graphql.swift in Sources */, - DE638B1328D3D64400559697 /* DisconnectedEvent.graphql.swift in Sources */, - DE638B2828D3D64400559697 /* BranchProtectionRule.graphql.swift in Sources */, - DE638B8E28D3D64500559697 /* ReviewDismissedEvent.graphql.swift in Sources */, - DE638B9928D3D64500559697 /* OrgEnableSamlAuditEntry.graphql.swift in Sources */, - DE638B1128D3D64400559697 /* OrgInviteMemberAuditEntry.graphql.swift in Sources */, - DE638B5028D3D64400559697 /* RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift in Sources */, - DE638B6F28D3D64500559697 /* OrgBlockUserAuditEntry.graphql.swift in Sources */, - DE638B0828D3D64400559697 /* LockedEvent.graphql.swift in Sources */, - DE638AFB28D3D64400559697 /* CommitComment.graphql.swift in Sources */, - DE638B6328D3D64500559697 /* PullRequestReview.graphql.swift in Sources */, - DE638B4728D3D64400559697 /* RepoAccessAuditEntry.graphql.swift in Sources */, - DE638B6628D3D64500559697 /* ConvertToDraftEvent.graphql.swift in Sources */, - DE638B4428D3D64400559697 /* RepoCreateAuditEntry.graphql.swift in Sources */, - DE638B6928D3D64500559697 /* Tree.graphql.swift in Sources */, - DE638B8C28D3D64500559697 /* IpAllowListEntry.graphql.swift in Sources */, - DE638AFA28D3D64400559697 /* RepositoryTopic.graphql.swift in Sources */, - DE638B1928D3D64400559697 /* PinnedEvent.graphql.swift in Sources */, - DE638B7528D3D64500559697 /* HeadRefForcePushedEvent.graphql.swift in Sources */, - DE638B3028D3D64400559697 /* Mannequin.graphql.swift in Sources */, - DE638B4528D3D64400559697 /* CrossReferencedEvent.graphql.swift in Sources */, - DE638B1728D3D64400559697 /* MembersCanDeleteReposEnableAuditEntry.graphql.swift in Sources */, - DE638B2928D3D64400559697 /* ConvertedNoteToIssueEvent.graphql.swift in Sources */, - DE638B0528D3D64400559697 /* OrgRemoveMemberAuditEntry.graphql.swift in Sources */, - DE638BA928D3D64500559697 /* Starrable.graphql.swift in Sources */, - DE638B6D28D3D64500559697 /* ProjectCard.graphql.swift in Sources */, - DE638BB628D3D64500559697 /* Deletable.graphql.swift in Sources */, - DE638B9D28D3D64500559697 /* Blob.graphql.swift in Sources */, - DE638B3828D3D64400559697 /* OrgOauthAppAccessRequestedAuditEntry.graphql.swift in Sources */, - DE638AF628D3D64400559697 /* License.graphql.swift in Sources */, - DE638B8328D3D64500559697 /* Bot.graphql.swift in Sources */, - DE638BBF28D3D64500559697 /* Reactable.graphql.swift in Sources */, - DE638B1C28D3D64400559697 /* RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift in Sources */, - DE638B9C28D3D64500559697 /* OrgDisableSamlAuditEntry.graphql.swift in Sources */, - DE638AEC28D3D64400559697 /* Release.graphql.swift in Sources */, - DE638B8728D3D64500559697 /* RepositoryInvitation.graphql.swift in Sources */, - DE638B1E28D3D64400559697 /* EnterpriseRepositoryInfo.graphql.swift in Sources */, - DE638B6528D3D64500559697 /* OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */, - DE638B8B28D3D64500559697 /* RepoArchivedAuditEntry.graphql.swift in Sources */, - DE638B9F28D3D64500559697 /* Deployment.graphql.swift in Sources */, - DE638B3F28D3D64400559697 /* Label.graphql.swift in Sources */, - DE638B8528D3D64500559697 /* RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift in Sources */, - DE638B5828D3D64500559697 /* RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */, - DE638B4228D3D64400559697 /* DeployedEvent.graphql.swift in Sources */, - DE638BB128D3D64500559697 /* RepositoryOwner.graphql.swift in Sources */, - DE638B3628D3D64400559697 /* RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift in Sources */, - DE638B3528D3D64400559697 /* ReferencedEvent.graphql.swift in Sources */, - DE638B5728D3D64500559697 /* MembersCanDeleteReposClearAuditEntry.graphql.swift in Sources */, - DE638B7D28D3D64500559697 /* IssueConnection.graphql.swift in Sources */, - DE638B1D28D3D64400559697 /* Commit.graphql.swift in Sources */, - DE638B8628D3D64500559697 /* BaseRefForcePushedEvent.graphql.swift in Sources */, - DE638B3C28D3D64400559697 /* Organization.graphql.swift in Sources */, - DE638AF428D3D64400559697 /* OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift in Sources */, - DE638B2728D3D64400559697 /* ReopenedEvent.graphql.swift in Sources */, - DE638B4F28D3D64400559697 /* EnterpriseAdministratorInvitation.graphql.swift in Sources */, - DE638BB828D3D64500559697 /* AuditEntry.graphql.swift in Sources */, - DE638B6228D3D64500559697 /* Package.graphql.swift in Sources */, - DE638B1028D3D64400559697 /* OrgOauthAppAccessApprovedAuditEntry.graphql.swift in Sources */, - DE638B5128D3D64400559697 /* ExternalIdentity.graphql.swift in Sources */, - DE638B7828D3D64500559697 /* SponsorsListing.graphql.swift in Sources */, - DE638AFF28D3D64400559697 /* GistComment.graphql.swift in Sources */, - DE638AFC28D3D64400559697 /* PackageTag.graphql.swift in Sources */, - DE638B7428D3D64500559697 /* OrgRestoreMemberAuditEntry.graphql.swift in Sources */, - DE638B7F28D3D64500559697 /* MovedColumnsInProjectEvent.graphql.swift in Sources */, - DE638B1F28D3D64400559697 /* SubscribedEvent.graphql.swift in Sources */, - DE638B0B28D3D64400559697 /* DeploymentStatus.graphql.swift in Sources */, - DE638B6728D3D64500559697 /* RepoRemoveMemberAuditEntry.graphql.swift in Sources */, - DE638B6828D3D64500559697 /* TeamAddMemberAuditEntry.graphql.swift in Sources */, - DE638B6A28D3D64500559697 /* RenamedTitleEvent.graphql.swift in Sources */, - DE638B0728D3D64400559697 /* RepoRemoveTopicAuditEntry.graphql.swift in Sources */, - DE638B3728D3D64400559697 /* EnterpriseServerUserAccount.graphql.swift in Sources */, - DE638B4628D3D64400559697 /* PinnedIssue.graphql.swift in Sources */, - DE638AE528D3D64400559697 /* RepoURLQuery.graphql.swift in Sources */, - DE638BA428D3D64500559697 /* AutomaticBaseChangeSucceededEvent.graphql.swift in Sources */, - DE638B6C28D3D64500559697 /* OrgCreateAuditEntry.graphql.swift in Sources */, - DE638B5D28D3D64500559697 /* Topic.graphql.swift in Sources */, - DE638BC028D3D64500559697 /* OauthApplicationAuditEntryData.graphql.swift in Sources */, - DE638B0228D3D64400559697 /* RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift in Sources */, - DE638B5F28D3D64500559697 /* UnsubscribedEvent.graphql.swift in Sources */, - DE638BC628D3D64500559697 /* Lockable.graphql.swift in Sources */, - DE638AE328D3D64400559697 /* RepositoryQuery.graphql.swift in Sources */, - DE638B2E28D3D64400559697 /* CodeOfConduct.graphql.swift in Sources */, - DE638BC728D3D64500559697 /* ProfileOwner.graphql.swift in Sources */, - DE638B4B28D3D64400559697 /* Query.graphql.swift in Sources */, - DE638AF128D3D64400559697 /* OrgAddMemberAuditEntry.graphql.swift in Sources */, - DE638BB728D3D64500559697 /* PackageOwner.graphql.swift in Sources */, - DE638B7B28D3D64500559697 /* ReviewRequestedEvent.graphql.swift in Sources */, - DE638B3928D3D64400559697 /* Project.graphql.swift in Sources */, - DE638B3128D3D64400559697 /* EnterpriseIdentityProvider.graphql.swift in Sources */, - DE638B0F28D3D64400559697 /* OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift in Sources */, - DE638B5E28D3D64500559697 /* CheckSuite.graphql.swift in Sources */, - DE638B4028D3D64400559697 /* HeadRefDeletedEvent.graphql.swift in Sources */, - DE638B3428D3D64400559697 /* PullRequest.graphql.swift in Sources */, - DE638B8928D3D64500559697 /* CheckRun.graphql.swift in Sources */, - DE638B8A28D3D64500559697 /* HeadRefRestoredEvent.graphql.swift in Sources */, - DE638BA828D3D64500559697 /* SchemaMetadata.graphql.swift in Sources */, - DE638B0D28D3D64400559697 /* Enterprise.graphql.swift in Sources */, - DE638B2A28D3D64400559697 /* PullRequestCommitCommentThread.graphql.swift in Sources */, - DE638B9028D3D64500559697 /* IssueComment.graphql.swift in Sources */, - DE638BB428D3D64500559697 /* MemberStatusable.graphql.swift in Sources */, - DE638B8F28D3D64500559697 /* CommitCommentThread.graphql.swift in Sources */, - DE638B0A28D3D64400559697 /* MarketplaceCategory.graphql.swift in Sources */, - DE638AF928D3D64400559697 /* OrgDisableTwoFactorRequirementAuditEntry.graphql.swift in Sources */, - DE638B8428D3D64500559697 /* AddedToProjectEvent.graphql.swift in Sources */, - DE638B0C28D3D64400559697 /* RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift in Sources */, - DE638AFE28D3D64400559697 /* Repository.graphql.swift in Sources */, - DE638B4928D3D64400559697 /* EnterpriseServerUserAccountsUpload.graphql.swift in Sources */, - DE638AF528D3D64400559697 /* RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift in Sources */, - DE638AE428D3D64400559697 /* IssuesAndCommentsForRepositoryQuery.graphql.swift in Sources */, - DE638B7128D3D64500559697 /* RemovedFromProjectEvent.graphql.swift in Sources */, - DE638B5628D3D64400559697 /* TeamDiscussion.graphql.swift in Sources */, - DE638B6B28D3D64500559697 /* OrgUnblockUserAuditEntry.graphql.swift in Sources */, - DE638B4128D3D64400559697 /* Milestone.graphql.swift in Sources */, - DE638BA728D3D64500559697 /* SchemaConfiguration.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FC7503F1D2A532C00458D91 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - B9C0075A298308F900855D2B /* ApolloMath.swift in Sources */, - C377CCAB22D7992E00572E03 /* MultipartFormData.swift in Sources */, - 9B260C08245A437400562176 /* InterceptorProvider.swift in Sources */, - 9B9BBAF324DB39D70021C30F /* UploadRequest.swift in Sources */, - 9FCE2CEE1E6BE2D900E34457 /* NormalizedCache.swift in Sources */, - 9B260C0A245A532500562176 /* JSONResponseParsingInterceptor.swift in Sources */, - DE903E1729C10B7600A74415 /* FieldSelectionCollector.swift in Sources */, - 9B96500C24BE7239003C29C0 /* CacheReadInterceptor.swift in Sources */, - DE0586392669985000265760 /* Dictionary+Helpers.swift in Sources */, - DE4B1E572891D2F40058D1F6 /* Atomic.swift in Sources */, - E69F437229BBD958006FF548 /* MultipartResponseParsingInterceptor.swift in Sources */, - 9F295E381E277B2A00A24949 /* GraphQLResultNormalizer.swift in Sources */, - DE8C51CC29EF454100E47A64 /* GraphQLExecutionSource.swift in Sources */, - DED5B355286CCAFF00AE6BFF /* ResponsePath.swift in Sources */, - 9F8E0BE325668559000D9FA5 /* PossiblyDeferred.swift in Sources */, - 9F86B68B1E6438D700B885FF /* GraphQLSelectionSetMapper.swift in Sources */, - 9F55347B1DE1DB2100E54264 /* ApolloStore.swift in Sources */, - 9BDE43D122C6655300FD7C7F /* Cancellable.swift in Sources */, - 9F69FFA91D42855900E000B1 /* NetworkTransport.swift in Sources */, - 073D39F52A8AD1AF001BD34A /* RequestContext.swift in Sources */, - 9F8E0BD325668552000D9FA5 /* DataLoader.swift in Sources */, - 9FCDFD291E33D0CE007519DC /* GraphQLQueryWatcher.swift in Sources */, - DE56DC232683B2020090D6E4 /* DefaultInterceptorProvider.swift in Sources */, - 9FC2333D1E66BBF7001E4541 /* GraphQLDependencyTracker.swift in Sources */, - 9FC9A9BF1E2C27FB0023C4D5 /* GraphQLResult.swift in Sources */, - 9FEB050D1DB5732300DA3B44 /* JSONSerializationFormat.swift in Sources */, - 9B260BEB245A020300562176 /* ApolloInterceptor.swift in Sources */, - DE903E1329B7E6D300A74415 /* SelectionSet+JSONInitializer.swift in Sources */, - 54DDB0921EA045870009DD99 /* InMemoryNormalizedCache.swift in Sources */, - 9B554CC4247DC29A002F452A /* TaskData.swift in Sources */, - 9B9BBAF524DB4F890021C30F /* AutomaticPersistedQueryInterceptor.swift in Sources */, - 9BA1244A22D8A8EA00BF1D24 /* JSONSerialization+Sorting.swift in Sources */, - DE8F7B6B29F742E1005F3902 /* NetworkResponseExecutionSource.swift in Sources */, - 9B260BF1245A025400562176 /* HTTPRequest.swift in Sources */, - 9B708AAD2305884500604A11 /* ApolloClientProtocol.swift in Sources */, - C377CCA922D798BD00572E03 /* GraphQLFile.swift in Sources */, - 9BEEDC2824E351E5001D1294 /* MaxRetryInterceptor.swift in Sources */, - 9FC9A9CC1E2FD0760023C4D5 /* Record.swift in Sources */, - 9B260BFB245A031900562176 /* NetworkFetchInterceptor.swift in Sources */, - 9F578D901D8D2CB300C0EA36 /* HTTPURLResponse+Helpers.swift in Sources */, - 9B260C04245A090600562176 /* RequestChainNetworkTransport.swift in Sources */, - 9FC9A9BD1E2C271C0023C4D5 /* RecordSet.swift in Sources */, - 9BF1A95122CA6E71005292C2 /* GraphQLGETTransformer.swift in Sources */, - 9B260BFF245A054700562176 /* JSONRequest.swift in Sources */, - 9B260BF9245A030100562176 /* ResponseCodeInterceptor.swift in Sources */, - 9B260BF3245A026F00562176 /* RequestChain.swift in Sources */, - DE8F7B6D29F745DE005F3902 /* CacheDataExecutionSource.swift in Sources */, - E69F436C29B81182006FF548 /* InterceptorRequestChain.swift in Sources */, - 9FF90A611DDDEB100034C3B6 /* GraphQLResponse.swift in Sources */, - 9BEDC79E22E5D2CF00549BF6 /* RequestBodyCreator.swift in Sources */, - 9BE071AD2368D08700FA5952 /* Collection+Helpers.swift in Sources */, - DE100B18287F3FB100BE11C2 /* Documentation.docc in Sources */, - 9FA6F3681E65DF4700BF8D73 /* GraphQLResultAccumulator.swift in Sources */, - 9FF90A651DDDEB100034C3B6 /* GraphQLExecutor.swift in Sources */, - 9BDE43DF22C6708600FD7C7F /* GraphQLHTTPRequestError.swift in Sources */, - B9C0075E298312FD00855D2B /* GraphQLFirstReceivedAtTracker.swift in Sources */, - 9B1CCDD92360F02C007C9032 /* Bundle+Helpers.swift in Sources */, - 9B260BF5245A028D00562176 /* HTTPResponse.swift in Sources */, - 5AC6CA4322AAF7B200B7C94D /* GraphQLHTTPMethod.swift in Sources */, - 9BC742AE24CFB6450029282C /* CacheWriteInterceptor.swift in Sources */, - 9B4F453F244A27B900C2CF7D /* URLSessionClient.swift in Sources */, - DE0586332669948500265760 /* InputValue+Evaluation.swift in Sources */, - DE0586372669958F00265760 /* GraphQLError.swift in Sources */, - 9BC742AC24CFB2FF0029282C /* ApolloErrorInterceptor.swift in Sources */, - 9FC750631D2A59F600458D91 /* ApolloClient.swift in Sources */, - 9BA3130E2302BEA5007B7FC5 /* DispatchQueue+Optional.swift in Sources */, - DE8F7B6F29F7478C005F3902 /* SelectionSetModelExecutionSource.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FC7504A1D2A532D00458D91 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE5144B12A04703F00D991E9 /* NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift in Sources */, - 5BB2C0232380836100774170 /* VersionNumberTests.swift in Sources */, - DED45EC3261BA0ED0086EF63 /* WebSocketTransportTests.swift in Sources */, - DE8F7B7129FC24A8005F3902 /* SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift in Sources */, - DE299E962A0D7916000F71D2 /* SelectionField_CacheKeyForFieldTests.swift in Sources */, - 9B78C71E2326E86E000C8C32 /* ErrorGenerationTests.swift in Sources */, - DED45EC7261BA0ED0086EF63 /* WebSocketTests.swift in Sources */, - 9FC9A9C81E2EFE6E0023C4D5 /* CacheKeyForFieldTests.swift in Sources */, - DED45DEF261B96B70086EF63 /* ReadWriteFromStoreTests.swift in Sources */, - 9F91CF8F1F6C0DB2008DD0BE /* MutatingSelectionSetTests.swift in Sources */, - DE46A55626F13A7400357C52 /* JSONResponseParsingInterceptorTests.swift in Sources */, - E616B6D126C3335600DB049E /* ClearCacheTests.swift in Sources */, - 9B9BBB1C24DB760B0021C30F /* UploadRequestTests.swift in Sources */, - E61DD76526D60C1800C41614 /* SQLiteDotSwiftDatabaseBehaviorTests.swift in Sources */, - 9BC139A424EDCA6C00876D29 /* MaxRetryInterceptorTests.swift in Sources */, - DE46A55126EFEB6900357C52 /* JSONValueMatcher.swift in Sources */, - F82E62E122BCD223000C311B /* AutomaticPersistedQueriesTests.swift in Sources */, - 9BC139A824EDCE4F00876D29 /* RetryToCountThenSucceedInterceptor.swift in Sources */, - 9F533AB31E6C4A4200CBE097 /* BatchedLoadTests.swift in Sources */, - DED45DEE261B96B70086EF63 /* FetchQueryTests.swift in Sources */, - C3279FC72345234D00224790 /* TestCustomRequestBodyCreator.swift in Sources */, - DED45DED261B96B70086EF63 /* StoreConcurrencyTests.swift in Sources */, - 9B95EDC022CAA0B000702BB2 /* GETTransformerTests.swift in Sources */, - 66B18E872A15367300525DFB /* URLSessionClientTests.swift in Sources */, - 9FF90A6F1DDDEB420034C3B6 /* GraphQLMapEncodingTests.swift in Sources */, - E66B8342280936B3001B3F2D /* OperationMessageMatchers.swift in Sources */, - E608A52B280905C2001BE656 /* WSProtocolTestsBase.swift in Sources */, - D87AC09F2564D60B0079FAA5 /* ApolloClientOperationTests.swift in Sources */, - 9B64F6762354D219002D1BB5 /* URL+QueryDict.swift in Sources */, - E6CD6F4B2887202900DC9F3F /* CacheKeyResolutionTests.swift in Sources */, - E6B2B26C29C2447F004B16F4 /* MultipartResponseParsingInterceptorTests.swift in Sources */, - 9B2B66F42513FAFE00B53ABF /* CancellationHandlingInterceptor.swift in Sources */, - 9BC139A624EDCAD900876D29 /* BlindRetryingTestInterceptor.swift in Sources */, - E608A52A280905C2001BE656 /* GraphqlTransportWsProtocolTests.swift in Sources */, - 9B96500A24BE62B7003C29C0 /* RequestChainTests.swift in Sources */, - DED45DEA261B96B70086EF63 /* WatchQueryTests.swift in Sources */, - DED45E30261B972C0086EF63 /* CachePersistenceTests.swift in Sources */, - DED45EC4261BA0ED0086EF63 /* SplitNetworkTransportTests.swift in Sources */, - 9B21FD752422C29D00998B5C /* GraphQLFileTests.swift in Sources */, - DE2FCF4926E94D150057EA67 /* TestMockTests.swift in Sources */, - E86D8E05214B32FD0028EFE1 /* JSONTests.swift in Sources */, - 2EE7FFD0276802E30035DC39 /* CacheKeyConstructionTests.swift in Sources */, - DED45C2A2615319E0086EF63 /* DefaultInterceptorProviderTests.swift in Sources */, - E6EE6F1229C141A600BDE7A5 /* HTTPURLResponseExtensionTests.swift in Sources */, - 9F21730E2567E6F000566121 /* DataLoaderTests.swift in Sources */, - 07236D332A992498009BFF7B /* RequestContextTests.swift in Sources */, - DED45DEC261B96B70086EF63 /* CacheDependentInterceptorTests.swift in Sources */, - DED45DEB261B96B70086EF63 /* SQLiteCacheTests.swift in Sources */, - C338DF1722DD9DE9006AF33E /* RequestBodyCreatorTests.swift in Sources */, - F16D083C21EF6F7300C458B8 /* SelectionSet_JSONInitializerTests.swift in Sources */, - 9BF6C97025194ED7000D5B93 /* MultipartFormDataTests.swift in Sources */, - 9FF90A711DDDEB420034C3B6 /* GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift in Sources */, - 9F295E311E27534800A24949 /* GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift in Sources */, - 9FF90A731DDDEB420034C3B6 /* ParseQueryResponseTests.swift in Sources */, - E608A529280905C2001BE656 /* GraphqlWsProtocolTests.swift in Sources */, - DED45DE9261B96B70086EF63 /* LoadQueryFromStoreTests.swift in Sources */, - 9BF6C94325194DE2000D5B93 /* MultipartFormData+Testing.swift in Sources */, - DE181A3426C5D8D4000C0B9C /* CompressionTests.swift in Sources */, - 19E9F6AC26D58A9A003AB80E /* OperationMessageIdCreatorTests.swift in Sources */, - 9F21735B2568F3E200566121 /* PossiblyDeferredTests.swift in Sources */, - DE46A55826F13AD000357C52 /* ResponseCodeInterceptorTests.swift in Sources */, - DEFE695B28205321001CF4E8 /* SelectionSetTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9FCE2CF51E6C213D00E34457 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE6389F228D3D63800559697 /* Character.graphql.swift in Sources */, - DE6389C628D3D63800559697 /* HeroAndFriendsNamesWithFragmentQuery.graphql.swift in Sources */, - DE6389DB28D3D63800559697 /* HeroNameWithFragmentQuery.graphql.swift in Sources */, - DE6389F128D3D63800559697 /* SchemaMetadata.graphql.swift in Sources */, - DE6389C128D3D63800559697 /* HeroDetailsQuery.graphql.swift in Sources */, - DE6389AF28D3D63800559697 /* DroidNameAndPrimaryFunction.graphql.swift in Sources */, - DE6389DE28D3D63800559697 /* HeroNameConditionalInclusionQuery.graphql.swift in Sources */, - DE6389CF28D3D63800559697 /* StarshipCoordinatesQuery.graphql.swift in Sources */, - DE6389C928D3D63800559697 /* HeroAppearsInQuery.graphql.swift in Sources */, - DE6389D828D3D63800559697 /* HumanQuery.graphql.swift in Sources */, - DE6389E928D3D63800559697 /* Starship.graphql.swift in Sources */, - DE6389D128D3D63800559697 /* HeroAndFriendsNamesWithIDsQuery.graphql.swift in Sources */, - DE6389DD28D3D63800559697 /* TwoHeroesQuery.graphql.swift in Sources */, - DE6389EF28D3D63800559697 /* ColorInput.graphql.swift in Sources */, - DE6389B928D3D63800559697 /* CharacterNameAndAppearsInWithNestedFragments.graphql.swift in Sources */, - DE6389E328D3D63800559697 /* HeroAppearsInWithFragmentQuery.graphql.swift in Sources */, - DE6389E128D3D63800559697 /* SameHeroTwiceQuery.graphql.swift in Sources */, - DE6389CE28D3D63800559697 /* HeroNameConditionalBothSeparateQuery.graphql.swift in Sources */, - DE6389BB28D3D63800559697 /* CharacterNameWithNestedAppearsInFragment.graphql.swift in Sources */, - DE6389CA28D3D63800559697 /* HeroNameAndAppearsInWithFragmentQuery.graphql.swift in Sources */, - DE6389E428D3D63800559697 /* ReviewAddedSubscription.graphql.swift in Sources */, - DE6389BD28D3D63800559697 /* CharacterAppearsIn.graphql.swift in Sources */, - DE6389D628D3D63800559697 /* HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift in Sources */, - DE6389CB28D3D63800559697 /* DroidDetailsWithFragmentQuery.graphql.swift in Sources */, - DE6389B228D3D63800559697 /* FriendsNames.graphql.swift in Sources */, - DE6389CC28D3D63800559697 /* HeroDetailsWithFragmentQuery.graphql.swift in Sources */, - DE6389EC28D3D63800559697 /* Query.graphql.swift in Sources */, - DE6389C028D3D63800559697 /* CreateReviewWithNullFieldMutation.graphql.swift in Sources */, - DE6389B628D3D63800559697 /* CharacterNameAndDroidAppearsIn.graphql.swift in Sources */, - DE6389C228D3D63800559697 /* HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift in Sources */, - DE6389D528D3D63800559697 /* HeroDetailsInlineConditionalInclusionQuery.graphql.swift in Sources */, - DE6389D928D3D63800559697 /* HeroAndFriendsNamesQuery.graphql.swift in Sources */, - DE6389EE28D3D63800559697 /* SchemaConfiguration.swift in Sources */, - DE6389D328D3D63800559697 /* HeroNameAndAppearsInQuery.graphql.swift in Sources */, - DE6389D028D3D63800559697 /* HeroNameConditionalBothQuery.graphql.swift in Sources */, - DE6389E828D3D63800559697 /* Droid.graphql.swift in Sources */, - DE6389BC28D3D63800559697 /* CharacterNameAndDroidPrimaryFunction.graphql.swift in Sources */, - DE6389B328D3D63800559697 /* CharacterName.graphql.swift in Sources */, - DE6389CD28D3D63800559697 /* HeroNameWithFragmentAndIDQuery.graphql.swift in Sources */, - DE6389E728D3D63800559697 /* Subscription.graphql.swift in Sources */, - DE6389EA28D3D63800559697 /* Mutation.graphql.swift in Sources */, - DE6389D428D3D63800559697 /* HeroFriendsDetailsConditionalInclusionQuery.graphql.swift in Sources */, - DE6389B428D3D63800559697 /* CharacterNameAndAppearsIn.graphql.swift in Sources */, - DE6389F028D3D63800559697 /* ReviewInput.graphql.swift in Sources */, - DE6389BE28D3D63800559697 /* CreateAwesomeReviewMutation.graphql.swift in Sources */, - DE6389C728D3D63800559697 /* HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift in Sources */, - DE6389C528D3D63800559697 /* HeroNameWithIDQuery.graphql.swift in Sources */, - DE6389DF28D3D63800559697 /* HeroFriendsOfFriendsNamesQuery.graphql.swift in Sources */, - DE6389BF28D3D63800559697 /* CreateReviewForEpisodeMutation.graphql.swift in Sources */, - DE6389DA28D3D63800559697 /* HeroTypeDependentAliasedFieldQuery.graphql.swift in Sources */, - DE6389DC28D3D63800559697 /* HeroParentTypeDependentFieldQuery.graphql.swift in Sources */, - DE6389BA28D3D63800559697 /* DroidDetails.graphql.swift in Sources */, - DE6389C828D3D63800559697 /* HeroDetailsFragmentConditionalInclusionQuery.graphql.swift in Sources */, - DE6389C328D3D63800559697 /* HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift in Sources */, - DE6389B128D3D63800559697 /* DroidPrimaryFunction.graphql.swift in Sources */, - DE6389D228D3D63800559697 /* HeroNameConditionalExclusionQuery.graphql.swift in Sources */, - DE6389E628D3D63800559697 /* Episode.graphql.swift in Sources */, - DE6389B028D3D63800559697 /* HeroDetails.graphql.swift in Sources */, - DE6389ED28D3D63800559697 /* Human.graphql.swift in Sources */, - DE6389E528D3D63800559697 /* SearchResult.graphql.swift in Sources */, - DE6389B528D3D63800559697 /* DroidName.graphql.swift in Sources */, - DE6389E228D3D63800559697 /* HeroAndFriendsIDsQuery.graphql.swift in Sources */, - DE6389EB28D3D63800559697 /* Review.graphql.swift in Sources */, - DE6389B828D3D63800559697 /* CharacterNameWithInlineFragment.graphql.swift in Sources */, - DE6389D728D3D63800559697 /* StarshipQuery.graphql.swift in Sources */, - DE6389B728D3D63800559697 /* HumanHeightWithVariable.graphql.swift in Sources */, - DE6389E028D3D63800559697 /* HeroNameQuery.graphql.swift in Sources */, - DE6389C428D3D63800559697 /* SearchQuery.graphql.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE058608266978A100265760 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE058609266978A100265760 /* Selection.swift in Sources */, - DE64C1F7284033BA00F64B9D /* LocalCacheMutation.swift in Sources */, - DE05860B266978A100265760 /* SelectionSet.swift in Sources */, - DE80003428B5608E00C827BD /* SchemaMetadata.swift in Sources */, - DE9C04AC26EAAE4400EC35E7 /* JSON.swift in Sources */, - DE2FCF1D26E806710057EA67 /* SchemaConfiguration.swift in Sources */, - DE2FCF4526E80CF10057EA67 /* GraphQLOperation.swift in Sources */, - DE5E79BF289DBCE700CD0DE5 /* CacheKeyInfo.swift in Sources */, - DE05860C266978A100265760 /* FragmentProtocols.swift in Sources */, - DE05860D266978A100265760 /* ScalarTypes.swift in Sources */, - DE9C04AF26EAAEE800EC35E7 /* CacheReference.swift in Sources */, - DE1C6F00284161DE0050164B /* AnyHashableConvertible.swift in Sources */, - DE05860E266978A100265760 /* GraphQLNullable.swift in Sources */, - DECD53CF26EC0EE50059A639 /* OutputTypeConvertible.swift in Sources */, - DEA6A83426F298660091AF8A /* ParentType.swift in Sources */, - DE03FDDB2784D0B2007425BD /* DataDict.swift in Sources */, - DE2FCF2826E8083A0057EA67 /* Interface.swift in Sources */, - DE09F9BD27024FEA00795949 /* InputObject.swift in Sources */, - DE9C04B226EAB02C00EC35E7 /* JSONDecodingError.swift in Sources */, - DE4B1E542889EF330058D1F6 /* EnumType.swift in Sources */, - DE2FCF2926E8083A0057EA67 /* Object.swift in Sources */, - DE058610266978A100265760 /* InputValue.swift in Sources */, - DE100B1C28872F4200BE11C2 /* Documentation.docc in Sources */, - DE9C04AD26EAAE5400EC35E7 /* JSONStandardTypeConversions.swift in Sources */, - DE299E922A0D6FD6000F71D2 /* ObjectData.swift in Sources */, - DE058616266978A100265760 /* GraphQLEnum.swift in Sources */, - DE2FCF2726E8083A0057EA67 /* Union.swift in Sources */, - DE90FDBA27FE405F0084CC79 /* Selection+Conditions.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE3C7A04260A6B9800D2F4FF /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE63893628D3BFBA00559697 /* PetSearchFilters.graphql.swift in Sources */, - DE63893828D3BFBA00559697 /* SchemaMetadata.graphql.swift in Sources */, - DE63893128D3BFBA00559697 /* Fish.graphql.swift in Sources */, - DE63891C28D3BFBA00559697 /* AllAnimalsLocalCacheMutation.graphql.swift in Sources */, - DE63892628D3BFBA00559697 /* CustomDate.swift in Sources */, - DE63893928D3BFBA00559697 /* HousePet.graphql.swift in Sources */, - DE63893728D3BFBA00559697 /* MeasurementsInput.graphql.swift in Sources */, - DE63893328D3BFBA00559697 /* Crocodile.graphql.swift in Sources */, - DE63892428D3BFBA00559697 /* PetSearchQuery.graphql.swift in Sources */, - DE63891B28D3BFBA00559697 /* PetDetailsMutation.graphql.swift in Sources */, - DE63892728D3BFBA00559697 /* SkinCovering.graphql.swift in Sources */, - DE63891628D3BFBA00559697 /* HeightInMeters.graphql.swift in Sources */, - DE63891728D3BFBA00559697 /* ClassroomPetDetails.graphql.swift in Sources */, - DE63891A28D3BFBA00559697 /* WarmBloodedDetails.graphql.swift in Sources */, - DE63893B28D3BFBA00559697 /* Animal.graphql.swift in Sources */, - DE63891928D3BFBA00559697 /* ClassroomPetDetailsCCN.graphql.swift in Sources */, - E6936F162908AD8D0089054C /* PetSearchLocalCacheMutation.graphql.swift in Sources */, - DE63892128D3BFBA00559697 /* ClassroomPetsCCNQuery.graphql.swift in Sources */, - DE63891E28D3BFBA00559697 /* DogQuery.graphql.swift in Sources */, - DE63892E28D3BFBA00559697 /* Mutation.graphql.swift in Sources */, - DE63893C28D3BFBA00559697 /* WarmBlooded.graphql.swift in Sources */, - DE223C24271F335D004A0148 /* Resources.swift in Sources */, - DE63892F28D3BFBA00559697 /* Query.graphql.swift in Sources */, - DE63892928D3BFBA00559697 /* Rat.graphql.swift in Sources */, - DE63893028D3BFBA00559697 /* Cat.graphql.swift in Sources */, - DE63892D28D3BFBA00559697 /* Height.graphql.swift in Sources */, - DE63892B28D3BFBA00559697 /* PetRock.graphql.swift in Sources */, - DE63892228D3BFBA00559697 /* AllAnimalsQuery.graphql.swift in Sources */, - DE63892C28D3BFBA00559697 /* Dog.graphql.swift in Sources */, - DE63891F28D3BFBA00559697 /* AllAnimalsCCNQuery.graphql.swift in Sources */, - DE63891828D3BFBA00559697 /* DogFragment.graphql.swift in Sources */, - DE63891528D3BFBA00559697 /* PetDetails.graphql.swift in Sources */, - DE63892528D3BFBA00559697 /* ClassroomPet.graphql.swift in Sources */, - DE63892028D3BFBA00559697 /* ClassroomPetsQuery.graphql.swift in Sources */, - DE63893A28D3BFBA00559697 /* Pet.graphql.swift in Sources */, - DE63891D28D3BFBA00559697 /* PetAdoptionMutation.graphql.swift in Sources */, - DE63893228D3BFBA00559697 /* Human.graphql.swift in Sources */, - DE63892A28D3BFBA00559697 /* Bird.graphql.swift in Sources */, - DE63892828D3BFBA00559697 /* RelativeSize.graphql.swift in Sources */, - DE63893528D3BFBA00559697 /* PetAdoptionInput.graphql.swift in Sources */, - DE63892328D3BFBA00559697 /* AllAnimalsIncludeSkipQuery.graphql.swift in Sources */, - DE63893428D3BFBA00559697 /* SchemaConfiguration.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE6B15A826152BE10068D642 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DED46042261CEA8A0086EF63 /* TestServerURLs.swift in Sources */, - DED45EFE261CDA2A0086EF63 /* StarWarsSubscriptionTests.swift in Sources */, - DED45D852616759C0086EF63 /* TestConfigs.swift in Sources */, - DED45D9626167F020086EF63 /* StarWarsServerCachingRoundtripTests.swift in Sources */, - DECD46D0262F64D000924527 /* StarWarsApolloSchemaDownloaderTests.swift in Sources */, - E608A52D280905E9001BE656 /* SubscriptionTests.swift in Sources */, - DE6B15AF26152BE10068D642 /* DefaultInterceptorProviderIntegrationTests.swift in Sources */, - DED46000261CE9080086EF63 /* HTTPBinAPI.swift in Sources */, - DED45F4A261CDBFC0086EF63 /* UploadTests.swift in Sources */, - E6630B8E26F071F9002D9E41 /* SchemaRegistryApolloSchemaDownloaderTests.swift in Sources */, - DED45F17261CDA360086EF63 /* StarWarsWebSocketTests.swift in Sources */, - DED45D73261675890086EF63 /* StarWarsServerTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE9CEABB28299E8500959AF9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DEA7604429DF75B60001544B /* TestMockSelectionSetMapper.swift in Sources */, - DE9CEAEA2829A45500959AF9 /* Field.swift in Sources */, - DE9CEAE62829A2FE00959AF9 /* TestMock.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DECD4907262F81BF00924527 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE296BA527A07C37004F571F /* MockMergedSelections.swift in Sources */, - DE5FD603276926EF0033EE23 /* IR+Mocking.swift in Sources */, - E6EFDD0D27E8377200B17FE5 /* MockFileTemplate.swift in Sources */, - DE5EEC83279796EA00AF5913 /* MockApolloCodegenConfiguration.swift in Sources */, - DE363CB327640FBA001EC05B /* GraphQLJSFrontend+TestHelpers.swift in Sources */, - DE09F9C3270269E800795949 /* MockJavaScriptObject.swift in Sources */, - DEE2060B27E14498002B4B82 /* IR+InclusionConditionsMock.swift in Sources */, - DE01451628A5A971000F6F18 /* MockValidationOptions.swift in Sources */, - E6BF98FC272C8FFC00C1FED8 /* MockFileManager.swift in Sources */, - E66644F129D7D2AE005E9140 /* MockTemplateRenderer.swift in Sources */, - E6BEEFA627FAB1C700D94FF4 /* MockFileGenerator.swift in Sources */, - DECD4921262F81CE00924527 /* CodegenTestHelper.swift in Sources */, - DEAFB78327064F6900BE02F3 /* MockGraphQLType.swift in Sources */, - DE12B2D9273C4338003371CC /* MockIRSubscripts.swift in Sources */, - DE5B314027A482C80051C9D3 /* Resources.swift in Sources */, - E6630B8C26F0639B002D9E41 /* MockNetworkSession.swift in Sources */, - DEAFB781270647D400BE02F3 /* MockCompilationResult.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E66B836228093D7C001B3F2D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE63894628D3D60600559697 /* IncrementingSubscription.graphql.swift in Sources */, - DE63894728D3D60700559697 /* Subscription.graphql.swift in Sources */, - DE63894928D3D60700559697 /* SchemaMetadata.graphql.swift in Sources */, - DE63894828D3D60700559697 /* SchemaConfiguration.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E687B3BD28B398CB00A9551C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E687B3E328B398E600A9551C /* FetchSchema.swift in Sources */, - E687B3DC28B398E600A9551C /* Constants.swift in Sources */, - E687B3E528B398E600A9551C /* Generate.swift in Sources */, - E687B3DE28B398E600A9551C /* Error.swift in Sources */, - DE2A20E829032E1F008ADE48 /* VersionChecker.swift in Sources */, - E687B3DF28B398E600A9551C /* ParsableCommand+Apollo.swift in Sources */, - E687B3E028B398E600A9551C /* FileManager+Data.swift in Sources */, - E687B3E828B398E600A9551C /* SchemaDownloadProvider.swift in Sources */, - E64F226D28B8B3FE0011292F /* LogLevelSetter.swift in Sources */, - 662EA65E2A701483008A1931 /* GenerateOperationManifest.swift in Sources */, - E687B3E428B398E600A9551C /* Initialize.swift in Sources */, - E687B3E128B398E600A9551C /* String+Data.swift in Sources */, - E687B3DD28B398E600A9551C /* InputOptions.swift in Sources */, - E687B3E728B398E600A9551C /* CodegenProvider.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E6DC0ABA28B3AB890064A68F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E6DC0ADF28B3AC490064A68F /* ErrorMatchers.swift in Sources */, - E6DC0ADD28B3AC490064A68F /* GenerateTests.swift in Sources */, - E64F227128B8BEE10011292F /* MockLogLevelSetter.swift in Sources */, - E6DC0ADA28B3AC490064A68F /* MockApolloSchemaDownloader.swift in Sources */, - E6DC0AD928B3AC490064A68F /* TestSupport.swift in Sources */, - 662EA6602A705BD7008A1931 /* GenerateOperationManifestTests.swift in Sources */, - E6DC0AD728B3AC490064A68F /* MockApolloCodegen.swift in Sources */, - E6DC0ADC28B3AC490064A68F /* InitializeTests.swift in Sources */, - E6DC0AD828B3AC490064A68F /* MockApolloCodegenConfiguration.swift in Sources */, - DE2A20ED29033ABE008ADE48 /* VersionCheckerTests.swift in Sources */, - E6DC0ADB28B3AC490064A68F /* MockFileManager.swift in Sources */, - E6DC0ADE28B3AC490064A68F /* FetchSchemaTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 9B2DFBCC24E201A000ED3AE6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B2DFBB524E1FA0D00ED3AE6 /* UploadAPI */; - targetProxy = 9B2DFBCB24E201A000ED3AE6 /* PBXContainerItemProxy */; - }; - 9B7BDAF823FDEE8400ACD198 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9B7BDAF723FDEE8400ACD198 /* PBXContainerItemProxy */; - }; - 9B7BDAFC23FDEE9000ACD198 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9B7BDAFB23FDEE9000ACD198 /* PBXContainerItemProxy */; - }; - 9B7BDB1723FDF10300ACD198 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - productRef = 9B7BDB1623FDF10300ACD198 /* SQLite */; - }; - 9BAEEC03234BB8FD00808306 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7B6F46233C26D100F32205 /* ApolloCodegenLib */; - targetProxy = 9BAEEC02234BB8FD00808306 /* PBXContainerItemProxy */; - }; - 9F54C8BB255D760B0065AFD6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9F54C8BA255D760B0065AFD6 /* PBXContainerItemProxy */; - }; - 9F54C8DF255D76810065AFD6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */; - targetProxy = 9F54C8DE255D76810065AFD6 /* PBXContainerItemProxy */; - }; - 9F54C8E1255D76810065AFD6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FACA9B71F42E67200AE2DBD /* GitHubAPI */; - targetProxy = 9F54C8E0255D76810065AFD6 /* PBXContainerItemProxy */; - }; - 9F65B1201EC106E80090B25F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9F65B11F1EC106E80090B25F /* PBXContainerItemProxy */; - }; - 9F8A958C1EC0FF9F00304A2D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */; - targetProxy = 9F8A958B1EC0FF9F00304A2D /* PBXContainerItemProxy */; - }; - 9FA5FBB61EC05CE900304A9D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9FA5FBB51EC05CE900304A9D /* PBXContainerItemProxy */; - }; - 9FACA9B81F42E67200AE2DBD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9FACA9B91F42E67200AE2DBD /* PBXContainerItemProxy */; - }; - 9FC750511D2A532D00458D91 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = 9FC750501D2A532D00458D91 /* PBXContainerItemProxy */; - }; - 9FCE2D081E6C254000E34457 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FCE2CF91E6C213D00E34457 /* StarWarsAPI */; - targetProxy = 9FCE2D071E6C254000E34457 /* PBXContainerItemProxy */; - }; - DE05862826697B1D00265760 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE058606266978A100265760 /* ApolloAPI */; - targetProxy = DE05862726697B1D00265760 /* PBXContainerItemProxy */; - }; - DE6B15B326152BE10068D642 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = DE6B15B226152BE10068D642 /* PBXContainerItemProxy */; - }; - DE6D083527BDAB9E009F5F33 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE058606266978A100265760 /* ApolloAPI */; - targetProxy = DE6D083427BDAB9E009F5F33 /* PBXContainerItemProxy */; - }; - DE903E1B29CA23AA00A74415 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - productRef = DE903E1A29CA23AA00A74415 /* Nimble */; - }; - DE903E2029CA25AA00A74415 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE3C7A00260A6B9800D2F4FF /* AnimalKingdomAPI */; - targetProxy = DE903E1F29CA25AA00A74415 /* PBXContainerItemProxy */; - }; - DE903E2429CE59BD00A74415 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = DE903E2329CE59BD00A74415 /* PBXContainerItemProxy */; - }; - DE90FCE727FCC71E0084CC79 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE058606266978A100265760 /* ApolloAPI */; - targetProxy = DE90FCE627FCC71E0084CC79 /* PBXContainerItemProxy */; - }; - DE9CEAE32829A01A00959AF9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE058606266978A100265760 /* ApolloAPI */; - targetProxy = DE9CEAE22829A01A00959AF9 /* PBXContainerItemProxy */; - }; - DE9CEAE82829A3C100959AF9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE9CEAB328299E8500959AF9 /* ApolloTestSupport */; - targetProxy = DE9CEAE72829A3C100959AF9 /* PBXContainerItemProxy */; - }; - DEC2EA8F291ED0DE0088D3BB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */; - targetProxy = DEC2EA8E291ED0DE0088D3BB /* PBXContainerItemProxy */; - }; - DEC2EA92291ED3890088D3BB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = DEC2EA91291ED3890088D3BB /* PBXContainerItemProxy */; - }; - DECD46FA262F659100924527 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7B6F46233C26D100F32205 /* ApolloCodegenLib */; - targetProxy = DECD46F9262F659100924527 /* PBXContainerItemProxy */; - }; - DECD4735262F668200924527 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B2DFBB524E1FA0D00ED3AE6 /* UploadAPI */; - targetProxy = DECD4734262F668200924527 /* PBXContainerItemProxy */; - }; - DECD498E262F840100924527 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DECD490A262F81BF00924527 /* ApolloCodegenInternalTestHelpers */; - targetProxy = DECD498D262F840100924527 /* PBXContainerItemProxy */; - }; - DECD4991262F841300924527 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DECD490A262F81BF00924527 /* ApolloCodegenInternalTestHelpers */; - targetProxy = DECD4990262F841300924527 /* PBXContainerItemProxy */; - }; - DECD49C8262F88FA00924527 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7B6F46233C26D100F32205 /* ApolloCodegenLib */; - targetProxy = DECD49C7262F88FA00924527 /* PBXContainerItemProxy */; - }; - DECD49DA262F8AA500924527 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */; - targetProxy = DECD49D9262F8AA500924527 /* PBXContainerItemProxy */; - }; - DED45E96261B9EE30086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - productRef = DED45E95261B9EE30086EF63 /* SQLite */; - }; - DED45E98261B9EFA0086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7BDABE23FDEBB600ACD198 /* ApolloSQLite */; - targetProxy = DED45E97261B9EFA0086EF63 /* PBXContainerItemProxy */; - }; - DED45E9A261B9F000086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7BDA7C23FDE90400ACD198 /* ApolloWebSocket */; - targetProxy = DED45E99261B9F000086EF63 /* PBXContainerItemProxy */; - }; - DED45FCF261CE8890086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7BDABE23FDEBB600ACD198 /* ApolloSQLite */; - targetProxy = DED45FCE261CE8890086EF63 /* PBXContainerItemProxy */; - }; - DED45FD6261CE89C0086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7BDA7C23FDE90400ACD198 /* ApolloWebSocket */; - targetProxy = DED45FD5261CE89C0086EF63 /* PBXContainerItemProxy */; - }; - DED46034261CEA610086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9F8A95771EC0FC1200304A2D /* ApolloInternalTestHelpers */; - targetProxy = DED46033261CEA610086EF63 /* PBXContainerItemProxy */; - }; - DED4606B261CEDD10086EF63 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FCE2CF91E6C213D00E34457 /* StarWarsAPI */; - targetProxy = DED4606A261CEDD10086EF63 /* PBXContainerItemProxy */; - }; - E61D426928803F2E00C00F97 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = E66B836528093D7C001B3F2D /* SubscriptionAPI */; - targetProxy = E61D426828803F2E00C00F97 /* PBXContainerItemProxy */; - }; - E687B3ED28B3993000A9551C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9B7B6F46233C26D100F32205 /* ApolloCodegenLib */; - targetProxy = E687B3EC28B3993000A9551C /* PBXContainerItemProxy */; - }; - E6C2B39D2809409900F4CE13 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9FC750431D2A532C00458D91 /* Apollo */; - targetProxy = E6C2B39C2809409900F4CE13 /* PBXContainerItemProxy */; - }; - E6DC0AC428B3AB890064A68F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = E687B3C028B398CB00A9551C /* CodegenCLI */; - targetProxy = E6DC0AC328B3AB890064A68F /* PBXContainerItemProxy */; - }; - E6E4209426A7DF5800B82624 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - productRef = E6E4209326A7DF5800B82624 /* InflectorKit */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 9B2DFBBB24E1FA0D00ED3AE6 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B2DFBC824E1FA7E00ED3AE6 /* Apollo-Target-UploadAPI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9B2DFBBC24E1FA0D00ED3AE6 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B2DFBC824E1FA7E00ED3AE6 /* Apollo-Target-UploadAPI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9B2DFBBD24E1FA0D00ED3AE6 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B2DFBC824E1FA7E00ED3AE6 /* Apollo-Target-UploadAPI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9B7B6F4C233C26D100F32205 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7B6F55233C27A000F32205 /* Apollo-Target-ApolloCodegenLib.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9B7B6F4D233C26D100F32205 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7B6F55233C27A000F32205 /* Apollo-Target-ApolloCodegenLib.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9B7B6F4E233C26D100F32205 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7B6F55233C27A000F32205 /* Apollo-Target-ApolloCodegenLib.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9B7BDA8323FDE90400ACD198 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7BDAA423FDE98C00ACD198 /* ApolloWebSocket-Target-Framework.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9B7BDA8423FDE90400ACD198 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7BDAA423FDE98C00ACD198 /* ApolloWebSocket-Target-Framework.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9B7BDA8523FDE90400ACD198 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7BDAA423FDE98C00ACD198 /* ApolloWebSocket-Target-Framework.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9B7BDAC923FDEBB600ACD198 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7BDAD823FDECB300ACD198 /* ApolloSQLite-Target-Framework.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9B7BDACA23FDEBB600ACD198 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7BDAD823FDECB300ACD198 /* ApolloSQLite-Target-Framework.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9B7BDACB23FDEBB600ACD198 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B7BDAD823FDECB300ACD198 /* ApolloSQLite-Target-Framework.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9BAEEC04234BB8FD00808306 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B4AA8AD239EFDC9003E1300 /* Apollo-Target-CodegenTests.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9BAEEC05234BB8FD00808306 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B4AA8AD239EFDC9003E1300 /* Apollo-Target-CodegenTests.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9BAEEC06234BB8FD00808306 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B4AA8AD239EFDC9003E1300 /* Apollo-Target-CodegenTests.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9F54C8BD255D760B0065AFD6 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2422433C8000FC2E54 /* Apollo-Target-PerformanceTests.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9F54C8BE255D760B0065AFD6 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2422433C8000FC2E54 /* Apollo-Target-PerformanceTests.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9F54C8BF255D760B0065AFD6 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2422433C8000FC2E54 /* Apollo-Target-PerformanceTests.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9F8A957D1EC0FC1200304A2D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2522433CAF00FC2E54 /* Apollo-Target-InternalTestHelpers.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9F8A957E1EC0FC1200304A2D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2522433CAF00FC2E54 /* Apollo-Target-InternalTestHelpers.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9F8A957F1EC0FC1200304A2D /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2522433CAF00FC2E54 /* Apollo-Target-InternalTestHelpers.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9FACA9C31F42E67200AE2DBD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2222433C2800FC2E54 /* Apollo-Target-GitHubAPI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9FACA9C41F42E67200AE2DBD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2222433C2800FC2E54 /* Apollo-Target-GitHubAPI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9FACA9C51F42E67200AE2DBD /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2222433C2800FC2E54 /* Apollo-Target-GitHubAPI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9FC750561D2A532D00458D91 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D05224333DA00FC2E54 /* Apollo-Project-Debug.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9FC750571D2A532D00458D91 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D07224333DA00FC2E54 /* Apollo-Project-Release.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9FC750591D2A532D00458D91 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D06224333DA00FC2E54 /* Apollo-Target-Framework.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9FC7505A1D2A532D00458D91 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D06224333DA00FC2E54 /* Apollo-Target-Framework.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9FC7505C1D2A532D00458D91 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D0B2243345500FC2E54 /* Apollo-Target-Tests.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9FC7505D1D2A532D00458D91 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D0B2243345500FC2E54 /* Apollo-Target-Tests.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9FCE2D041E6C213D00E34457 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2122433C1900FC2E54 /* Apollo-Target-StarWarsAPI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 9FCE2D051E6C213D00E34457 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2122433C1900FC2E54 /* Apollo-Target-StarWarsAPI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 9FEFCFCD1E6C65CE0061834C /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D08224333DA00FC2E54 /* Apollo-Project-Performance-Testing.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9FEFCFCE1E6C65CE0061834C /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D06224333DA00FC2E54 /* Apollo-Target-Framework.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9FEFCFD01E6C65CE0061834C /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D0B2243345500FC2E54 /* Apollo-Target-Tests.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - 9FEFCFD61E6C65CE0061834C /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 90690D2122433C1900FC2E54 /* Apollo-Target-StarWarsAPI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - DE05861E266978A100265760 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE0586222669793200265760 /* Apollo-Target-ApolloAPI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - DE05861F266978A100265760 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE0586222669793200265760 /* Apollo-Target-ApolloAPI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - DE058620266978A100265760 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE0586222669793200265760 /* Apollo-Target-ApolloAPI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - DE3C7A0E260A6B9800D2F4FF /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DEA34AF6260E821F00F95F86 /* Apollo-Target-AnimalKingdomAPI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - DE3C7A0F260A6B9800D2F4FF /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DEA34AF6260E821F00F95F86 /* Apollo-Target-AnimalKingdomAPI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - DE3C7A10260A6B9800D2F4FF /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DEA34AF6260E821F00F95F86 /* Apollo-Target-AnimalKingdomAPI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - DE6B15B426152BE10068D642 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE6B15E826152CD80068D642 /* Apollo-Target-ServerIntegrationTests.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - DE6B15B526152BE10068D642 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE6B15E826152CD80068D642 /* Apollo-Target-ServerIntegrationTests.xcconfig */; - buildSettings = { - }; - name = Release; - }; - DE6B15B626152BE10068D642 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE6B15E826152CD80068D642 /* Apollo-Target-ServerIntegrationTests.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - DE9CEAD928299E8500959AF9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE9CEAE128299F6900959AF9 /* Apollo-Target-TestSupport.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - DE9CEADA28299E8500959AF9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE9CEAE128299F6900959AF9 /* Apollo-Target-TestSupport.xcconfig */; - buildSettings = { - }; - name = Release; - }; - DE9CEADB28299E8500959AF9 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DE9CEAE128299F6900959AF9 /* Apollo-Target-TestSupport.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - DECD4911262F81BF00924527 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DECD492F262F820500924527 /* Apollo-Target-CodegenInternalTestHelpers.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - DECD4912262F81BF00924527 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DECD492F262F820500924527 /* Apollo-Target-CodegenInternalTestHelpers.xcconfig */; - buildSettings = { - }; - name = Release; - }; - DECD4913262F81BF00924527 /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = DECD492F262F820500924527 /* Apollo-Target-CodegenInternalTestHelpers.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - E66B836A28093D7C001B3F2D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E6180AA928093F76004EC2A3 /* Apollo-Target-SubscriptionAPI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - E66B836B28093D7C001B3F2D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E6180AA928093F76004EC2A3 /* Apollo-Target-SubscriptionAPI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - E66B836C28093D7C001B3F2D /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E6180AA928093F76004EC2A3 /* Apollo-Target-SubscriptionAPI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - E687B3C528B398CC00A9551C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E687B3F328B39A9100A9551C /* Apollo-Target-CodegenCLI.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - E687B3C628B398CC00A9551C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E687B3F328B39A9100A9551C /* Apollo-Target-CodegenCLI.xcconfig */; - buildSettings = { - }; - name = Release; - }; - E687B3C728B398CC00A9551C /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E687B3F328B39A9100A9551C /* Apollo-Target-CodegenCLI.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; - E6DC0AC528B3AB890064A68F /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E6DC0AE328B3ACF20064A68F /* Apollo-Target-CodegenCLITests.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - E6DC0AC628B3AB890064A68F /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E6DC0AE328B3ACF20064A68F /* Apollo-Target-CodegenCLITests.xcconfig */; - buildSettings = { - }; - name = Release; - }; - E6DC0AC728B3AB890064A68F /* PerformanceTesting */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E6DC0AE328B3ACF20064A68F /* Apollo-Target-CodegenCLITests.xcconfig */; - buildSettings = { - }; - name = PerformanceTesting; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 9B2DFBBE24E1FA0D00ED3AE6 /* Build configuration list for PBXNativeTarget "UploadAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9B2DFBBB24E1FA0D00ED3AE6 /* Debug */, - 9B2DFBBC24E1FA0D00ED3AE6 /* Release */, - 9B2DFBBD24E1FA0D00ED3AE6 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9B7B6F4F233C26D200F32205 /* Build configuration list for PBXNativeTarget "ApolloCodegenLib" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9B7B6F4C233C26D100F32205 /* Debug */, - 9B7B6F4D233C26D100F32205 /* Release */, - 9B7B6F4E233C26D100F32205 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9B7BDA8223FDE90400ACD198 /* Build configuration list for PBXNativeTarget "ApolloWebSocket" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9B7BDA8323FDE90400ACD198 /* Debug */, - 9B7BDA8423FDE90400ACD198 /* Release */, - 9B7BDA8523FDE90400ACD198 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9B7BDAC823FDEBB600ACD198 /* Build configuration list for PBXNativeTarget "ApolloSQLite" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9B7BDAC923FDEBB600ACD198 /* Debug */, - 9B7BDACA23FDEBB600ACD198 /* Release */, - 9B7BDACB23FDEBB600ACD198 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9BAEEC07234BB8FD00808306 /* Build configuration list for PBXNativeTarget "ApolloCodegenTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9BAEEC04234BB8FD00808306 /* Debug */, - 9BAEEC05234BB8FD00808306 /* Release */, - 9BAEEC06234BB8FD00808306 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9F54C8BC255D760B0065AFD6 /* Build configuration list for PBXNativeTarget "ApolloPerformanceTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9F54C8BD255D760B0065AFD6 /* Debug */, - 9F54C8BE255D760B0065AFD6 /* Release */, - 9F54C8BF255D760B0065AFD6 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9F8A95801EC0FC1200304A2D /* Build configuration list for PBXNativeTarget "ApolloInternalTestHelpers" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9F8A957D1EC0FC1200304A2D /* Debug */, - 9F8A957E1EC0FC1200304A2D /* Release */, - 9F8A957F1EC0FC1200304A2D /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9FACA9C21F42E67200AE2DBD /* Build configuration list for PBXNativeTarget "GitHubAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9FACA9C31F42E67200AE2DBD /* Debug */, - 9FACA9C41F42E67200AE2DBD /* Release */, - 9FACA9C51F42E67200AE2DBD /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9FC7503E1D2A532C00458D91 /* Build configuration list for PBXProject "Apollo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9FC750561D2A532D00458D91 /* Debug */, - 9FC750571D2A532D00458D91 /* Release */, - 9FEFCFCD1E6C65CE0061834C /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9FC750581D2A532D00458D91 /* Build configuration list for PBXNativeTarget "Apollo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9FC750591D2A532D00458D91 /* Debug */, - 9FC7505A1D2A532D00458D91 /* Release */, - 9FEFCFCE1E6C65CE0061834C /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9FC7505B1D2A532D00458D91 /* Build configuration list for PBXNativeTarget "ApolloTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9FC7505C1D2A532D00458D91 /* Debug */, - 9FC7505D1D2A532D00458D91 /* Release */, - 9FEFCFD01E6C65CE0061834C /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9FCE2D031E6C213D00E34457 /* Build configuration list for PBXNativeTarget "StarWarsAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9FCE2D041E6C213D00E34457 /* Debug */, - 9FCE2D051E6C213D00E34457 /* Release */, - 9FEFCFD61E6C65CE0061834C /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE05861D266978A100265760 /* Build configuration list for PBXNativeTarget "ApolloAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE05861E266978A100265760 /* Debug */, - DE05861F266978A100265760 /* Release */, - DE058620266978A100265760 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE3C7A0D260A6B9800D2F4FF /* Build configuration list for PBXNativeTarget "AnimalKingdomAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE3C7A0E260A6B9800D2F4FF /* Debug */, - DE3C7A0F260A6B9800D2F4FF /* Release */, - DE3C7A10260A6B9800D2F4FF /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE6B15B726152BE10068D642 /* Build configuration list for PBXNativeTarget "ApolloServerIntegrationTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE6B15B426152BE10068D642 /* Debug */, - DE6B15B526152BE10068D642 /* Release */, - DE6B15B626152BE10068D642 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE9CEAD828299E8500959AF9 /* Build configuration list for PBXNativeTarget "ApolloTestSupport" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE9CEAD928299E8500959AF9 /* Debug */, - DE9CEADA28299E8500959AF9 /* Release */, - DE9CEADB28299E8500959AF9 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DECD4910262F81BF00924527 /* Build configuration list for PBXNativeTarget "ApolloCodegenInternalTestHelpers" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DECD4911262F81BF00924527 /* Debug */, - DECD4912262F81BF00924527 /* Release */, - DECD4913262F81BF00924527 /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E66B836D28093D7C001B3F2D /* Build configuration list for PBXNativeTarget "SubscriptionAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E66B836A28093D7C001B3F2D /* Debug */, - E66B836B28093D7C001B3F2D /* Release */, - E66B836C28093D7C001B3F2D /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E687B3C828B398CC00A9551C /* Build configuration list for PBXNativeTarget "CodegenCLI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E687B3C528B398CC00A9551C /* Debug */, - E687B3C628B398CC00A9551C /* Release */, - E687B3C728B398CC00A9551C /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E6DC0AC828B3AB890064A68F /* Build configuration list for PBXNativeTarget "CodegenCLITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E6DC0AC528B3AB890064A68F /* Debug */, - E6DC0AC628B3AB890064A68F /* Release */, - E6DC0AC728B3AB890064A68F /* PerformanceTesting */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - 9B7BDAF423FDEE2600ACD198 /* XCRemoteSwiftPackageReference "SQLite.swift" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/stephencelis/SQLite.swift.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 0.13.1; - }; - }; - DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/Quick/Nimble.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 10.0.0; - }; - }; - DEAFB784270652AF00BE02F3 /* XCRemoteSwiftPackageReference "swift-collections" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/apple/swift-collections.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.0.0; - }; - }; - E687B3EF28B39A0F00A9551C /* XCRemoteSwiftPackageReference "swift-argument-parser" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/apple/swift-argument-parser.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.2.0; - }; - }; - E6E4209026A7DF4200B82624 /* XCRemoteSwiftPackageReference "InflectorKit" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/mattt/InflectorKit.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.0.0; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - 9B7BDAF523FDEE2600ACD198 /* SQLite */ = { - isa = XCSwiftPackageProductDependency; - package = 9B7BDAF423FDEE2600ACD198 /* XCRemoteSwiftPackageReference "SQLite.swift" */; - productName = SQLite; - }; - 9B7BDB1623FDF10300ACD198 /* SQLite */ = { - isa = XCSwiftPackageProductDependency; - package = 9B7BDAF423FDEE2600ACD198 /* XCRemoteSwiftPackageReference "SQLite.swift" */; - productName = SQLite; - }; - DE5EB9C426EFD4D10004176A /* Nimble */ = { - isa = XCSwiftPackageProductDependency; - package = DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */; - productName = Nimble; - }; - DE903E1A29CA23AA00A74415 /* Nimble */ = { - isa = XCSwiftPackageProductDependency; - productName = Nimble; - }; - DE903E1C29CA23B200A74415 /* Nimble */ = { - isa = XCSwiftPackageProductDependency; - package = DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */; - productName = Nimble; - }; - DEAFB77E2706474C00BE02F3 /* Nimble */ = { - isa = XCSwiftPackageProductDependency; - package = DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */; - productName = Nimble; - }; - DEAFB785270652AF00BE02F3 /* OrderedCollections */ = { - isa = XCSwiftPackageProductDependency; - package = DEAFB784270652AF00BE02F3 /* XCRemoteSwiftPackageReference "swift-collections" */; - productName = OrderedCollections; - }; - DEAFB786270652D100BE02F3 /* OrderedCollections */ = { - isa = XCSwiftPackageProductDependency; - package = DEAFB784270652AF00BE02F3 /* XCRemoteSwiftPackageReference "swift-collections" */; - productName = OrderedCollections; - }; - DED45E95261B9EE30086EF63 /* SQLite */ = { - isa = XCSwiftPackageProductDependency; - package = 9B7BDAF423FDEE2600ACD198 /* XCRemoteSwiftPackageReference "SQLite.swift" */; - productName = SQLite; - }; - E687B3F028B39A0F00A9551C /* ArgumentParser */ = { - isa = XCSwiftPackageProductDependency; - package = E687B3EF28B39A0F00A9551C /* XCRemoteSwiftPackageReference "swift-argument-parser" */; - productName = ArgumentParser; - }; - E687B3F128B39A5B00A9551C /* ArgumentParser */ = { - isa = XCSwiftPackageProductDependency; - package = E687B3EF28B39A0F00A9551C /* XCRemoteSwiftPackageReference "swift-argument-parser" */; - productName = ArgumentParser; - }; - E6DC0AE128B3AC7E0064A68F /* Nimble */ = { - isa = XCSwiftPackageProductDependency; - package = DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */; - productName = Nimble; - }; - E6E4209126A7DF4200B82624 /* InflectorKit */ = { - isa = XCSwiftPackageProductDependency; - package = E6E4209026A7DF4200B82624 /* XCRemoteSwiftPackageReference "InflectorKit" */; - productName = InflectorKit; - }; - E6E4209326A7DF5800B82624 /* InflectorKit */ = { - isa = XCSwiftPackageProductDependency; - package = E6E4209026A7DF4200B82624 /* XCRemoteSwiftPackageReference "InflectorKit" */; - productName = InflectorKit; - }; - E6FDD7522880471400BD0ADA /* Nimble */ = { - isa = XCSwiftPackageProductDependency; - package = DE5EB9C326EFD4D10004176A /* XCRemoteSwiftPackageReference "Nimble" */; - productName = Nimble; - }; -/* End XCSwiftPackageProductDependency section */ - }; - rootObject = 9FC7503B1D2A532C00458D91 /* Project object */; -} diff --git a/Apollo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Apollo.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a625..0000000000 --- a/Apollo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Apollo.xcodeproj/project.xcworkspace/xcshareddata/Apollo.xcscmblueprint b/Apollo.xcodeproj/project.xcworkspace/xcshareddata/Apollo.xcscmblueprint deleted file mode 100644 index 4468a2aee6..0000000000 --- a/Apollo.xcodeproj/project.xcworkspace/xcshareddata/Apollo.xcscmblueprint +++ /dev/null @@ -1,30 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "11467B891B05E74285D0FDA7F262E859A9337C82", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "FF5E57E11CB20B5623A697D8A51544D5E81FBD84" : 9223372036854775807, - "11467B891B05E74285D0FDA7F262E859A9337C82" : 9223372036854775807 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "3C9A0C1C-4254-4350-9916-D2A90026CA42", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "FF5E57E11CB20B5623A697D8A51544D5E81FBD84" : "", - "11467B891B05E74285D0FDA7F262E859A9337C82" : "apollo-ios\/" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "Apollo", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Apollo.xcodeproj", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/apollostack\/apollo-ios", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "11467B891B05E74285D0FDA7F262E859A9337C82" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/apollostack\/apollo-ios-quickstart.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "FF5E57E11CB20B5623A697D8A51544D5E81FBD84" - } - ] -} \ No newline at end of file diff --git a/Apollo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Apollo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/Apollo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Apollo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Apollo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 687461c618..0000000000 --- a/Apollo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,68 +0,0 @@ -{ - "pins" : [ - { - "identity" : "cwlcatchexception", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattgallagher/CwlCatchException.git", - "state" : { - "revision" : "35f9e770f54ce62dd8526470f14c6e137cef3eea", - "version" : "2.1.1" - } - }, - { - "identity" : "cwlpreconditiontesting", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git", - "state" : { - "revision" : "c21f7bab5ca8eee0a9998bbd17ca1d0eb45d4688", - "version" : "2.1.0" - } - }, - { - "identity" : "inflectorkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattt/InflectorKit.git", - "state" : { - "revision" : "d8cbcc04972690aaa5fc760a2b9ddb3e9f0decd7", - "version" : "1.0.0" - } - }, - { - "identity" : "nimble", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Quick/Nimble.git", - "state" : { - "revision" : "1f3bde57bde12f5e7b07909848c071e9b73d6edc", - "version" : "10.0.0" - } - }, - { - "identity" : "sqlite.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/stephencelis/SQLite.swift.git", - "state" : { - "revision" : "7a2e3cd27de56f6d396e84f63beefd0267b55ccb", - "version" : "0.14.1" - } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "4ad606ba5d7673ea60679a61ff867cc1ff8c8e86", - "version" : "1.2.1" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections.git", - "state" : { - "revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2", - "version" : "1.0.4" - } - } - ], - "version" : 2 -} diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/338A066C-BE46-4734-9F59-1E548A68950C.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/338A066C-BE46-4734-9F59-1E548A68950C.plist deleted file mode 100644 index c7b8d6509d..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/338A066C-BE46-4734-9F59-1E548A68950C.plist +++ /dev/null @@ -1,78 +0,0 @@ - - - - - classNames - - ParsingPerformanceTests - - testMultipartResponseParsingInterceptor() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.018400 - baselineIntegrationDisplayName - Local Baseline - - - testParseResult() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.044000 - baselineIntegrationDisplayName - Local Baseline - - - testParseResultFast() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.024300 - baselineIntegrationDisplayName - Local Baseline - - - - SelectionSetInitializerPerformanceTests - - testPerformance_selectionSetInitialization_concreteObjectTypeCaseWithMultipleFulfilledFragments() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.037100 - baselineIntegrationDisplayName - Local Baseline - - - - TypeCaseConversionPerformanceTests - - testPerformance_typeConversion_checkTypeConformsToInterface() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.031000 - baselineIntegrationDisplayName - Local Baseline - - - testPerformance_typeConversion_inclusionCondition() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.019700 - baselineIntegrationDisplayName - Local Baseline - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/50A052D5-C270-4C3E-823B-FCBB6C3E6539.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/50A052D5-C270-4C3E-823B-FCBB6C3E6539.plist deleted file mode 100644 index 66cd6a0ec4..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/50A052D5-C270-4C3E-823B-FCBB6C3E6539.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - classNames - - ParsingPerformanceTests - - testParseResult() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.068066 - baselineIntegrationDisplayName - Local Baseline - - - testParseResultFast() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.016656 - baselineIntegrationDisplayName - Local Baseline - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/7A4A2454-7A24-425D-84C2-116320B87F1E.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/7A4A2454-7A24-425D-84C2-116320B87F1E.plist deleted file mode 100644 index 0943718296..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/7A4A2454-7A24-425D-84C2-116320B87F1E.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - classNames - - ParsingPerformanceTests - - testParseResult() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.075663 - baselineIntegrationDisplayName - 17 Nov 2020 at 14:11:59 - - - testParseResultFast() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.016628 - baselineIntegrationDisplayName - 17 Nov 2020 at 14:11:59 - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/B07DC9C5-A477-43FC-8906-C01C8B98086A.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/B07DC9C5-A477-43FC-8906-C01C8B98086A.plist deleted file mode 100644 index ceb71f7ee2..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/B07DC9C5-A477-43FC-8906-C01C8B98086A.plist +++ /dev/null @@ -1,78 +0,0 @@ - - - - - classNames - - ParsingPerformanceTests - - testMultipartResponseParsingInterceptor() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.020300 - baselineIntegrationDisplayName - Local Baseline - - - testParseResult() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.045500 - baselineIntegrationDisplayName - Local Baseline - - - testParseResultFast() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.023300 - baselineIntegrationDisplayName - Local Baseline - - - - SelectionSetInitializerPerformanceTests - - testPerformance_selectionSetInitialization_concreteObjectTypeCaseWithMultipleFulfilledFragments() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.041800 - baselineIntegrationDisplayName - Local Baseline - - - - TypeCaseConversionPerformanceTests - - testPerformance_typeConversion_checkTypeConformsToInterface() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.034200 - baselineIntegrationDisplayName - Local Baseline - - - testPerformance_typeConversion_inclusionCondition() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.023600 - baselineIntegrationDisplayName - Local Baseline - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/FA3A7E89-3F08-4E7F-890A-B0903F68A94C.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/FA3A7E89-3F08-4E7F-890A-B0903F68A94C.plist deleted file mode 100644 index 3404104db4..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/FA3A7E89-3F08-4E7F-890A-B0903F68A94C.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - classNames - - ParsingPerformanceTests - - testParseResult() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.095090 - baselineIntegrationDisplayName - 17 Nov 2020 at 13:47:48 - - - testParseResultFast() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.017559 - baselineIntegrationDisplayName - 17 Nov 2020 at 13:47:48 - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/Info.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/Info.plist deleted file mode 100644 index 45efbf97c7..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9F54C8B3255D760B0065AFD6.xcbaseline/Info.plist +++ /dev/null @@ -1,136 +0,0 @@ - - - - - runDestinationsByUUID - - 338A066C-BE46-4734-9F59-1E548A68950C - - localComputer - - busSpeedInMHz - 0 - cpuCount - 1 - cpuKind - Apple M1 Pro - cpuSpeedInMHz - 0 - logicalCPUCoresPerPackage - 8 - modelCode - MacBookPro18,3 - physicalCPUCoresPerPackage - 8 - platformIdentifier - com.apple.platform.macosx - - targetArchitecture - arm64 - - 50A052D5-C270-4C3E-823B-FCBB6C3E6539 - - localComputer - - busSpeedInMHz - 400 - cpuCount - 1 - cpuKind - 6-Core Intel Core i7 - cpuSpeedInMHz - 2600 - logicalCPUCoresPerPackage - 12 - modelCode - MacBookPro16,1 - physicalCPUCoresPerPackage - 6 - platformIdentifier - com.apple.platform.macosx - - targetArchitecture - x86_64 - - 7A4A2454-7A24-425D-84C2-116320B87F1E - - localComputer - - busSpeedInMHz - 100 - cpuCount - 1 - cpuKind - Quad-Core Intel Core i7 - cpuSpeedInMHz - 2700 - logicalCPUCoresPerPackage - 8 - modelCode - MacBookPro13,3 - physicalCPUCoresPerPackage - 4 - platformIdentifier - com.apple.platform.macosx - - targetArchitecture - x86_64 - targetDevice - - modelCode - iPhone12,3 - platformIdentifier - com.apple.platform.iphonesimulator - - - B07DC9C5-A477-43FC-8906-C01C8B98086A - - localComputer - - busSpeedInMHz - 0 - cpuCount - 1 - cpuKind - Apple M1 - cpuSpeedInMHz - 0 - logicalCPUCoresPerPackage - 8 - modelCode - MacBookPro17,1 - physicalCPUCoresPerPackage - 8 - platformIdentifier - com.apple.platform.macosx - - targetArchitecture - arm64 - - FA3A7E89-3F08-4E7F-890A-B0903F68A94C - - localComputer - - busSpeedInMHz - 100 - cpuCount - 1 - cpuKind - Quad-Core Intel Core i7 - cpuSpeedInMHz - 2700 - logicalCPUCoresPerPackage - 8 - modelCode - MacBookPro13,3 - physicalCPUCoresPerPackage - 4 - platformIdentifier - com.apple.platform.macosx - - targetArchitecture - x86_64 - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/09B0B19E-F5A6-42CF-AD3D-082A3B8B31B3.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/09B0B19E-F5A6-42CF-AD3D-082A3B8B31B3.plist deleted file mode 100644 index dac628f3f6..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/09B0B19E-F5A6-42CF-AD3D-082A3B8B31B3.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - classNames - - ParsingTests - - testLargeResponse() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 0.88797 - baselineIntegrationDisplayName - Local Baseline - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/22F19570-674E-47F1-A426-4EFB879DC0E3.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/22F19570-674E-47F1-A426-4EFB879DC0E3.plist deleted file mode 100644 index 8a9640db1e..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/22F19570-674E-47F1-A426-4EFB879DC0E3.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - classNames - - ParsingTests - - testLargeResponse() - - com.apple.XCTPerformanceMetric_WallClockTime - - baselineAverage - 1.1037 - baselineIntegrationDisplayName - Local Baseline - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/Info.plist b/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/Info.plist deleted file mode 100644 index b1d57c292e..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcbaselines/9FC631321E6AE2080062707E.xcbaseline/Info.plist +++ /dev/null @@ -1,52 +0,0 @@ - - - - - runDestinationsByUUID - - 09B0B19E-F5A6-42CF-AD3D-082A3B8B31B3 - - targetArchitecture - arm64e - targetDevice - - modelCode - iPhone11,2 - platformIdentifier - com.apple.platform.iphoneos - - - 22F19570-674E-47F1-A426-4EFB879DC0E3 - - localComputer - - busSpeedInMHz - 100 - cpuCount - 1 - cpuKind - Intel Core i7 - cpuSpeedInMHz - 2700 - logicalCPUCoresPerPackage - 8 - modelCode - MacBookPro13,3 - physicalCPUCoresPerPackage - 4 - platformIdentifier - com.apple.platform.macosx - - targetArchitecture - x86_64 - targetDevice - - modelCode - iPhone11,2 - platformIdentifier - com.apple.platform.iphonesimulator - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/AnimalKingdomAPI.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/AnimalKingdomAPI.xcscheme deleted file mode 100644 index 3124a27228..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/AnimalKingdomAPI.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo.xcscheme deleted file mode 100644 index fa40aa6794..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo.xcscheme +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloAPI.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloAPI.xcscheme deleted file mode 100644 index 626e77bd67..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloAPI.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloCodegenLib.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloCodegenLib.xcscheme deleted file mode 100644 index 36ba5f651a..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloCodegenLib.xcscheme +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloPerformanceTests.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloPerformanceTests.xcscheme deleted file mode 100644 index 550bba8d3c..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloPerformanceTests.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloSQLite.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloSQLite.xcscheme deleted file mode 100644 index bc7b22d23d..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloSQLite.xcscheme +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloServerIntegrationTests.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloServerIntegrationTests.xcscheme deleted file mode 100644 index 73e3766ab8..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloServerIntegrationTests.xcscheme +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloUtils.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloUtils.xcscheme deleted file mode 100644 index 0f4dc821cb..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloUtils.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloWebSocket.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloWebSocket.xcscheme deleted file mode 100644 index ef452d72db..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/ApolloWebSocket.xcscheme +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/CodegenCLI.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/CodegenCLI.xcscheme deleted file mode 100644 index 23ae7442a2..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/CodegenCLI.xcscheme +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Apollo.xcodeproj/xcshareddata/xcschemes/CodegenCLITests.xcscheme b/Apollo.xcodeproj/xcshareddata/xcschemes/CodegenCLITests.xcscheme deleted file mode 100644 index b2cd024594..0000000000 --- a/Apollo.xcodeproj/xcshareddata/xcschemes/CodegenCLITests.xcscheme +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/ApolloTestSupport.podspec b/ApolloTestSupport.podspec new file mode 100644 index 0000000000..ac22c314fe --- /dev/null +++ b/ApolloTestSupport.podspec @@ -0,0 +1,20 @@ +Pod::Spec.new do |s| + version = `scripts/get-version.sh` + s.name = 'ApolloTestSupport' + s.version = version + s.author = 'Apollo GraphQL' + s.homepage = 'https://github.com/apollographql/apollo-ios' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.summary = "TODO" + s.source = { :git => 'https://github.com/apollographql/apollo-ios.git', :tag => s.version } + s.requires_arc = true + s.swift_version = '5.6' + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '12.0' + s.watchos.deployment_target = '5.0' + + s.source_files = 'Sources/ApolloTestSupport/*.swift' + s.dependency 'Apollo', '= ' + version + +end diff --git a/CHANGELOG.md b/CHANGELOG.md index e611a1e82d..db1c5803e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,52 @@ # Change Log +## v1.7.1 + +### Fixed + +- **Fixed inconsistent ordering of fragments in generated operation definitions ([#130](https://github.com/apollographql/apollo-ios-dev/pull/130)):** In order to make the ordering of fragments consistent, they are now alphabetized. This is a change to the data that gets sent over the wire when making a network request for an operation with fragments. **[Persisted Queries](https://www.apollographql.com/docs/ios/fetching/persisted-queries) users should re-register their queries when upgrading to this version.** _Thank you to [@scottasoutherland](https://github.com/scottasoutherland) for reporting the issue._ + +### Improvement + +- **Add initializer for `SelectionSet` that takes a `[String: Any]` JSON object ([#102](https://github.com/apollographql/apollo-ios-dev/pull/102)):** _Thank you to [@Cookiezby](https://github.com/Cookiezby) for the contribution._ + + +## v1.7.0 + +**`ApolloCodegenLib` Now Uses Swift Concurrency** +To improve the performance of the code generation, the `ApolloCodegenLib` now uses `async/await`. Code generation is now parallelized and should complete much faster for users with a large number of GraphQL files. +This means that the entry point function, `ApolloCodegen.build(with configuration:)` is now an `async` function. For users using the `ApolloCodegenLib` directly, you will need to make your call sites into this function use `async/await`. In most cases, this requires minimal code changes. Please see the [1.7.0 migration guide](https://www.apollographql.com/docs/ios/migrations/1.7) for information on how to upgrade. + +See PR [#57](https://github.com/apollographql/apollo-ios-dev/pull/57). + +### Fixed + +- **Fixed a bug with ApolloAPI.Object clashing with custom objects name Object ([#94](https://github.com/apollographql/apollo-ios-dev/pull/94)):** _Thank you to [215eight](https://github.com/215eight) for reporting the issue._ + +## v1.6.1 + +### Fixed + +- **Fix bug with AnyHashable coercion ([#68](https://github.com/apollographql/apollo-ios-dev/pull/68)):** This is an additional fix for the crashes on iOS 14.4.1. + +## v1.6.0 + +The Apollo iOS ecosystem is changing in the 1.6.0 release in order to provide a better development experience for users. For most users nothing will change, while some users will see a minor difference. The biggest change is that the `ApolloCodegenLib` is now in a separate repo/package that will need to be included as its own dependency from [apollo-ios-codegen](https://github.com/apollographql/apollo-ios-codegen) if you are doing your code generation through Swift. If you are using the codegen CLI then no changes are necessary. + +For a detailed breakdown of the changes please see this [GitHub Issue](https://github.com/apollographql/apollo-ios/issues/3240). + +### Fixed + +- **Fixed crashes in iOS 14.4 and below ([#61](https://github.com/apollographql/apollo-ios-dev/pull/61)):** _Thank you to [matijakregarGH](https://github.com/matijakregarGH) for reporting the issue._ + +## v1.5.2 + +The purpose of this release is to provide a deprecation message to users of `ApolloCodegenLib` who are scripting their code generation in advance of an upcoming change to our libraries and repo structure. Beginning with the upcoming 1.6.0 release the code generation libraries will be their own SPM package in their own repo which will require you to add a new dependency to you project in order for your code generation scripting to compile. More information can be found in our [announcement](https://github.com/apollographql/apollo-ios/issues/3240) of this change. + +**If you would like to avoid this deprecation warning in your builds feel free to stay on 1.5.1 or earlier, this warning will be gone in the 1.6.0 release** + +PR containing deprecation warning for reference: [#3243](https://github.com/apollographql/apollo-ios/pull/3243). + ## v1.5.1 ### Improvement diff --git a/CLI/apollo-ios-cli.tar.gz b/CLI/apollo-ios-cli.tar.gz new file mode 100644 index 0000000000..2a6cb535df Binary files /dev/null and b/CLI/apollo-ios-cli.tar.gz differ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 78f1454145..5da25b5625 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,88 +1 @@ -# Apollo iOS Contributor Guide - -Excited about Apollo iOS and want to make it better? We’re excited too! - -Apollo is a community of developers just like you, striving to create the best tools and libraries around GraphQL. We welcome anyone who wants to contribute or provide constructive feedback, no matter your age or level of experience. If you want to help but don't know where to start, let us know, and we'll find something for you. - -Oh, and if you haven't already, stop by our [community forums!](https://community.apollographql.com)! - -Here are some ways to contribute to the project: - -* [Reporting bugs](#reporting-bugs) -* [Responding to issues](#responding-to-issues) -* [Improving the documentation](#improving-the-documentation) -* [Suggesting features](#suggesting-features) - -* [Submitting pull requests](#pull-requests) -* [Code review](#review) - -* [Unit tests](#unit-tests) -* [Integration tests](#integration-tests) -* [Code generation test projects](#code-generation-test-projects) - -## Issues - -### Reporting bugs - -If you encounter a bug, please file an issue here on GitHub, and make sure you note which library is causing the problem. If an issue you have is already reported, please add additional information or add a "+1" comment to indicate you're affected by the issue too and this will help us prioritize the issue. - -While we will try to be as helpful as we can on any issue reported, please include as many details as requested in the [Bug Report issue template](https://github.com/apollographql/apollo-ios/issues/new?assignees=&labels=bug%2Cneeds+investigation&projects=&template=bug_report.yaml). Having reproducible steps or sample code for the issue will greatly speed up the time in which we can narrow down on the root cause and find a solution. - -At Apollo, we consider the security of our projects a top priority. No matter how much effort we put into system security, there can still be vulnerabilities present. To report a security vulnerability please review our [security policy](https://github.com/apollographql/apollo-ios/security/policy) for more details. - -### Responding to issues - -In addition to reporting issues, a great way to contribute to Apollo iOS is to respond to other peoples' issues and try to identify the problem or help them work around it. If you’re interested in taking a more active role in this process, please go ahead and respond to issues. Don't forget to say "Hi" on our [community forums](https://community.apollographql.com/tag/mobile) and [Discord server](https://discord.com/invite/graphos)! - -### Improving the documentation - -Improving the documentation, examples, and other open source content can be the easiest way to contribute to the library. If you see a piece of content that can be better, open a PR with an improvement, no matter how small! If you would like to suggest a big change or major rewrite, we’d love to hear your ideas but please open an issue for discussion before writing the PR. - -### Suggesting features - -Most of the features in Apollo came from suggestions by you, the community! We welcome any ideas about how to make Apollo better for your use case. Unless there is overwhelming demand for a feature, it might not get implemented immediately, but please include as much information as requested in the [Feature Request template](https://github.com/apollographql/apollo-ios/issues/new?assignees=&labels=feature&projects=&template=feature_request.yaml) that will help people have a discussion about your proposal. - -Feature requests will be labeled as such, and we encourage using GitHub issues as a place to discuss new features and possible implementation designs. Please refrain from submitting a pull request to implement a proposed feature until there is consensus that it should be included. This way, you can avoid putting in work that can’t be merged in. - -## Pull requests - -### Submitting - -For a small bug fix change (less than 20 lines of code changed), feel free to open a pull request. We’ll try to review and merge it as fast as possible. The only requirement is, make sure you also add a test that verifies the bug you are trying to fix. - -For significant changes to a repository, it’s important to settle on a design before starting on the implementation. This way, we can ensure that major improvements get the care and attention they deserve. Since big changes can be risky and might not always get merged, it’s good to reduce the amount of possible wasted effort by agreeing on an implementation design/plan first. - -A good way to propose a design or implementation, and have discussion about it, is with a Request for Comments (RFC) pull request. This is a pull request in which you describe the changes to be made with enough technical detail that suggestions, comments and updates can be made. The approved pull request can then be merged as a technical document or closed for posterity and referenced to in the actual code implementation. - -### Review - -It’s important that every piece of code in Apollo packages is reviewed by at least one core contributor familiar with that codebase. If you want to expedite the code being merged, try to review your own code first! Here are some things we look for: - -1. **All GitHub checks pass.** This is a prerequisite for the review, and it is the PR author's responsibility. The PR will not be reviewed until all the author has signed the Apollo CLA and all tests pass. -2. **Simplicity.** Is this the simplest way to achieve the intended goal? If there are too many files, redundant functions, or complex lines of code, suggest a simpler way to do the same thing. In particular, avoid implementing an overly general solution when a simple, small, and pragmatic fix will do. Please also note that large pull requests take additional time to review. If your PR could be broken down into several smaller, more focused changes, please do that instead. -3. **Testing.** Do the tests ensure this code won’t break when other stuff changes around it? When it does break, will the tests added help us identify which part of the library has the problem? Did we cover an appropriate set of edge cases? Look at the test coverage report if there is one. Are all significant code paths in the new code exercised at least once? -4. **No unnecessary or unrelated changes.** PRs shouldn’t come with random formatting changes, especially in unrelated parts of the code. If there is some refactoring that needs to be done, it should be in a separate PR from a bug fix or feature, if possible. -5. **Code has appropriate comments.** Code should be commented for *why* things are happening, not *what* is happening. *What* is happening should be clear from the names of your functions and variables. This is sometimes called "self-documenting code", but you may still need to add comments to explain why a workaround is necessary so other developers can better understand your code. -6. **Idiomatic use of the language.** Make sure to use idiomatic Swift when working with this repository. We don't presently use SwiftLint or any other linter, but please use your common sense and follow the style of the surrounding code. - -## Testing - -We do not aim for 100% test coverage but we do require that all new code be thoroughly tested. If you find code that is not being tested, or you want to improve the existing tests, please submit a pull request for it. - -Apollo iOS makes extensive use of [Xcode test plans](https://developer.apple.com/documentation/xcode/organizing-tests-to-improve-feedback?changes=_8). All targets have a related scheme and schemes execute one or more of the test plans. - -### Unit tests - -These are the bulk of tests in Apollo iOS and ensure we cover as much of the logic and edge cases as possible. You can find supporting test infrastructure in the `ApolloInternalTestHelpers` and `ApolloCodegenInternalTestHelpers` modules. Please note that these are _not_ intended to be used for testing your own code that utilizes Apollo iOS. - -### Integration tests - -There are a number of local services in the repo that are used by CI jobs when the test suite requires interaction that cannot be stubbed with mock data. If the test you're adding is an integration test please ask yourself whether it really _needs_ to be. These tests are a more 'expensive' type of test as they can take longer to execute and be difficult to debug. - -### Code generation test projects - -The folder [`TestCodeGenConfigurations`](https://github.com/apollographql/apollo-ios/tree/main/Tests/TestCodeGenConfigurations) contains test projects that test the many different codegen configurations of the schema module, operation models and test mocks. - -## License - -By contributing to Apollo iOS you agree that your contributions will be licensed under its [MIT license](https://github.com/apollographql/apollo-ios/blob/main/LICENSE) +If you would like to contribute to this library, you should make your code modifications and pull requests in the the [apollo-ios-dev](https://github.com/apollographql/apollo-ios-dev) repository. For more information, see the contributor guide in the `apollo-ios-dev` repo [here](https://github.com/apollographql/apollo-ios-dev/tree/main/CONTRIBUTING.md) diff --git a/Configuration/Apollo/Apollo-Project-Debug.xcconfig b/Configuration/Apollo/Apollo-Project-Debug.xcconfig deleted file mode 100644 index 96f6ca2629..0000000000 --- a/Configuration/Apollo/Apollo-Project-Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../Shared/Project-Debug.xcconfig" diff --git a/Configuration/Apollo/Apollo-Project-Performance-Testing.xcconfig b/Configuration/Apollo/Apollo-Project-Performance-Testing.xcconfig deleted file mode 100644 index 642cf691b3..0000000000 --- a/Configuration/Apollo/Apollo-Project-Performance-Testing.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ -#include "../Shared/Project-Release.xcconfig" - -ONLY_ACTIVE_ARCH = YES - -COPY_PHASE_STRIP = NO -ENABLE_TESTABILITY = YES diff --git a/Configuration/Apollo/Apollo-Project-Release.xcconfig b/Configuration/Apollo/Apollo-Project-Release.xcconfig deleted file mode 100644 index 364f240d89..0000000000 --- a/Configuration/Apollo/Apollo-Project-Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../Shared/Project-Release.xcconfig" diff --git a/Configuration/Apollo/Apollo-Target-AnimalKingdomAPI.xcconfig b/Configuration/Apollo/Apollo-Target-AnimalKingdomAPI.xcconfig deleted file mode 100644 index 255516d68d..0000000000 --- a/Configuration/Apollo/Apollo-Target-AnimalKingdomAPI.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/AnimalKingdomAPI/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-ApolloAPI.xcconfig b/Configuration/Apollo/Apollo-Target-ApolloAPI.xcconfig deleted file mode 100644 index d8891077fa..0000000000 --- a/Configuration/Apollo/Apollo-Target-ApolloAPI.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/ApolloAPI/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-ApolloCodegenLib.xcconfig b/Configuration/Apollo/Apollo-Target-ApolloCodegenLib.xcconfig deleted file mode 100644 index cf7e182e14..0000000000 --- a/Configuration/Apollo/Apollo-Target-ApolloCodegenLib.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -#include "../Shared/Workspace-Target-Framework.xcconfig" -#include "../Shared/Workspace-Target-Codegen.xcconfig" - -INFOPLIST_FILE = Sources/ApolloCodegenLib/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-CodegenCLI.xcconfig b/Configuration/Apollo/Apollo-Target-CodegenCLI.xcconfig deleted file mode 100644 index d668ddd971..0000000000 --- a/Configuration/Apollo/Apollo-Target-CodegenCLI.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -#include "../Shared/Workspace-Target-Framework.xcconfig" -#include "../Shared/Workspace-Target-Codegen.xcconfig" - -INFOPLIST_FILE = Sources/CodegenCLI/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-CodegenCLITests.xcconfig b/Configuration/Apollo/Apollo-Target-CodegenCLITests.xcconfig deleted file mode 100644 index 86c336599d..0000000000 --- a/Configuration/Apollo/Apollo-Target-CodegenCLITests.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -#include "../Shared/Workspace-Target-Codegen.xcconfig" -#include "../Shared/Workspace-Target-Test.xcconfig" - -INFOPLIST_FILE = Tests/CodegenCLITests/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-CodegenInternalTestHelpers.xcconfig b/Configuration/Apollo/Apollo-Target-CodegenInternalTestHelpers.xcconfig deleted file mode 100644 index bbd240903c..0000000000 --- a/Configuration/Apollo/Apollo-Target-CodegenInternalTestHelpers.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -#include "../Shared/Workspace-Target-Codegen.xcconfig" -#include "../Shared/Workspace-Target-TestHelpers.xcconfig" - -INFOPLIST_FILE = Tests/ApolloCodegenInternalTestHelpers/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-CodegenTests.xcconfig b/Configuration/Apollo/Apollo-Target-CodegenTests.xcconfig deleted file mode 100644 index 114ec72b9a..0000000000 --- a/Configuration/Apollo/Apollo-Target-CodegenTests.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -#include "../Shared/Workspace-Target-Codegen.xcconfig" -#include "../Shared/Workspace-Target-Test.xcconfig" - -INFOPLIST_FILE = Tests/ApolloCodegenTests/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-Framework.xcconfig b/Configuration/Apollo/Apollo-Target-Framework.xcconfig deleted file mode 100644 index e99c60a3ab..0000000000 --- a/Configuration/Apollo/Apollo-Target-Framework.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/Apollo/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-GitHubAPI.xcconfig b/Configuration/Apollo/Apollo-Target-GitHubAPI.xcconfig deleted file mode 100644 index 70d0c0205b..0000000000 --- a/Configuration/Apollo/Apollo-Target-GitHubAPI.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/GitHubAPI/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-InternalTestHelpers.xcconfig b/Configuration/Apollo/Apollo-Target-InternalTestHelpers.xcconfig deleted file mode 100644 index 0810a3d17b..0000000000 --- a/Configuration/Apollo/Apollo-Target-InternalTestHelpers.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Target-TestHelpers.xcconfig" - -INFOPLIST_FILE = Tests/ApolloInternalTestHelpers/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-PerformanceTests.xcconfig b/Configuration/Apollo/Apollo-Target-PerformanceTests.xcconfig deleted file mode 100644 index e34b142a5d..0000000000 --- a/Configuration/Apollo/Apollo-Target-PerformanceTests.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -#include "../Shared/Workspace-Target-Test.xcconfig" - -INFOPLIST_FILE = Tests/ApolloPerformanceTests/Info.plist -TREAT_MISSING_BASELINES_AS_TEST_FAILURES = YES diff --git a/Configuration/Apollo/Apollo-Target-ServerIntegrationTests.xcconfig b/Configuration/Apollo/Apollo-Target-ServerIntegrationTests.xcconfig deleted file mode 100644 index c503a59d4a..0000000000 --- a/Configuration/Apollo/Apollo-Target-ServerIntegrationTests.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -#include "../Shared/Workspace-Target-Test.xcconfig" - -INFOPLIST_FILE = Tests/ApolloServerIntegrationTests/Info.plist - -SUPPORTED_PLATFORMS = macosx diff --git a/Configuration/Apollo/Apollo-Target-StarWarsAPI.xcconfig b/Configuration/Apollo/Apollo-Target-StarWarsAPI.xcconfig deleted file mode 100644 index dd499beef2..0000000000 --- a/Configuration/Apollo/Apollo-Target-StarWarsAPI.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/StarWarsAPI/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-SubscriptionAPI.xcconfig b/Configuration/Apollo/Apollo-Target-SubscriptionAPI.xcconfig deleted file mode 100644 index 8da079e221..0000000000 --- a/Configuration/Apollo/Apollo-Target-SubscriptionAPI.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/SubscriptionAPI/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-TestHost-iOS.xcconfig b/Configuration/Apollo/Apollo-Target-TestHost-iOS.xcconfig deleted file mode 100644 index bfb1742c9c..0000000000 --- a/Configuration/Apollo/Apollo-Target-TestHost-iOS.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -#include "../Shared/Workspace-Target-Application.xcconfig" - -SDKROOT = iphoneos -SUPPORTED_PLATFORMS = iphonesimulator iphoneos - -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES - -INFOPLIST_FILE = Tests/TestHost iOS/Info.plist -PRODUCT_BUNDLE_IDENTIFIER = com.apollographql.$(PRODUCT_NAME:rfc1034identifier) -PRODUCT_NAME = $(TARGET_NAME) - -ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon diff --git a/Configuration/Apollo/Apollo-Target-TestSupport.xcconfig b/Configuration/Apollo/Apollo-Target-TestSupport.xcconfig deleted file mode 100644 index fb7894ba14..0000000000 --- a/Configuration/Apollo/Apollo-Target-TestSupport.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/ApolloTestSupport/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-Tests.xcconfig b/Configuration/Apollo/Apollo-Target-Tests.xcconfig deleted file mode 100644 index 83f979af1e..0000000000 --- a/Configuration/Apollo/Apollo-Target-Tests.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Test.xcconfig" - -INFOPLIST_FILE = Tests/ApolloTests/Info.plist diff --git a/Configuration/Apollo/Apollo-Target-UploadAPI.xcconfig b/Configuration/Apollo/Apollo-Target-UploadAPI.xcconfig deleted file mode 100644 index 86be4a4c1c..0000000000 --- a/Configuration/Apollo/Apollo-Target-UploadAPI.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/UploadAPI/Info.plist diff --git a/Configuration/Apollo/ApolloSQLite-Project-Debug.xcconfig b/Configuration/Apollo/ApolloSQLite-Project-Debug.xcconfig deleted file mode 100644 index 96f6ca2629..0000000000 --- a/Configuration/Apollo/ApolloSQLite-Project-Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../Shared/Project-Debug.xcconfig" diff --git a/Configuration/Apollo/ApolloSQLite-Project-Release.xcconfig b/Configuration/Apollo/ApolloSQLite-Project-Release.xcconfig deleted file mode 100644 index 364f240d89..0000000000 --- a/Configuration/Apollo/ApolloSQLite-Project-Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../Shared/Project-Release.xcconfig" diff --git a/Configuration/Apollo/ApolloSQLite-Target-Framework.xcconfig b/Configuration/Apollo/ApolloSQLite-Target-Framework.xcconfig deleted file mode 100644 index 1634591778..0000000000 --- a/Configuration/Apollo/ApolloSQLite-Target-Framework.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/ApolloSQLite/Info.plist diff --git a/Configuration/Apollo/ApolloWebSocket-Project-Debug.xcconfig b/Configuration/Apollo/ApolloWebSocket-Project-Debug.xcconfig deleted file mode 100644 index 96f6ca2629..0000000000 --- a/Configuration/Apollo/ApolloWebSocket-Project-Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../Shared/Project-Debug.xcconfig" diff --git a/Configuration/Apollo/ApolloWebSocket-Project-Release.xcconfig b/Configuration/Apollo/ApolloWebSocket-Project-Release.xcconfig deleted file mode 100644 index 364f240d89..0000000000 --- a/Configuration/Apollo/ApolloWebSocket-Project-Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../Shared/Project-Release.xcconfig" diff --git a/Configuration/Apollo/ApolloWebSocket-Target-Framework.xcconfig b/Configuration/Apollo/ApolloWebSocket-Target-Framework.xcconfig deleted file mode 100644 index bf6d204cb8..0000000000 --- a/Configuration/Apollo/ApolloWebSocket-Target-Framework.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" - -INFOPLIST_FILE = Sources/ApolloWebSocket/Info.plist diff --git a/Configuration/Shared/Project-Debug.xcconfig b/Configuration/Shared/Project-Debug.xcconfig deleted file mode 100644 index ae03656ce4..0000000000 --- a/Configuration/Shared/Project-Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Workspace-Debug.xcconfig" diff --git a/Configuration/Shared/Project-Release.xcconfig b/Configuration/Shared/Project-Release.xcconfig deleted file mode 100644 index b266f89403..0000000000 --- a/Configuration/Shared/Project-Release.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -#include "Workspace-Release.xcconfig" - -COPY_PHASE_STRIP = YES -DEPLOYMENT_POSTPROCESSING = YES -STRIP_INSTALLED_PRODUCT = YES diff --git a/Configuration/Shared/Project-Version.xcconfig b/Configuration/Shared/Project-Version.xcconfig deleted file mode 100644 index 7b0169bb80..0000000000 --- a/Configuration/Shared/Project-Version.xcconfig +++ /dev/null @@ -1 +0,0 @@ -CURRENT_PROJECT_VERSION = 1.5.1 diff --git a/Configuration/Shared/Workspace-Analysis.xcconfig b/Configuration/Shared/Workspace-Analysis.xcconfig deleted file mode 100644 index f75a82686f..0000000000 --- a/Configuration/Shared/Workspace-Analysis.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -CLANG_ANALYZER_NONNULL = YES -CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE diff --git a/Configuration/Shared/Workspace-Debug.xcconfig b/Configuration/Shared/Workspace-Debug.xcconfig deleted file mode 100644 index 5ee2a21b77..0000000000 --- a/Configuration/Shared/Workspace-Debug.xcconfig +++ /dev/null @@ -1,23 +0,0 @@ -#include "Workspace-Shared.xcconfig" - -// Architectures -ONLY_ACTIVE_ARCH = YES - -// Build Options -ENABLE_TESTABILITY = YES -VALIDATE_PRODUCT = NO - -// Deployment -COPY_PHASE_STRIP = NO - -// Code Generation -GCC_OPTIMIZATION_LEVEL = 0 -SWIFT_OPTIMIZATION_LEVEL = -Onone -LLVM_LTO = NO -SWIFT_COMPILATION_MODE = singlefile - -// Build Options -DEBUG_INFORMATION_FORMAT = dwarf - -ENABLE_NS_ASSERTIONS = YES -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES diff --git a/Configuration/Shared/Workspace-Deployment-Targets.xcconfig b/Configuration/Shared/Workspace-Deployment-Targets.xcconfig deleted file mode 100644 index 7b044dd483..0000000000 --- a/Configuration/Shared/Workspace-Deployment-Targets.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -// Base Deployment Targets -IPHONEOS_DEPLOYMENT_TARGET = 12.0 -MACOSX_DEPLOYMENT_TARGET = 10.14.6 -TVOS_DEPLOYMENT_TARGET = 12.0 -WATCHOS_DEPLOYMENT_TARGET = 5.0 - -WARNING_CFLAGS[sdk=iphone*] = $(inherited) -DAPI_TO_BE_DEPRECATED=12_0 -WARNING_CFLAGS[sdk=macosx*] = $(inherited) -DAPI_TO_BE_DEPRECATED=10_14 -WARNING_CFLAGS[sdk=tvos*] = $(inherited) -DAPI_TO_BE_DEPRECATED=12_0 -WARNING_CFLAGS[sdk=watchos*] = $(inherited) -DAPI_TO_BE_DEPRECATED=5_0 - -// macOS-specific default settings -COMBINE_HIDPI_IMAGES[sdk=macosx*] = YES diff --git a/Configuration/Shared/Workspace-Language.xcconfig b/Configuration/Shared/Workspace-Language.xcconfig deleted file mode 100644 index 523640345f..0000000000 --- a/Configuration/Shared/Workspace-Language.xcconfig +++ /dev/null @@ -1,25 +0,0 @@ -// Language -GCC_C_LANGUAGE_STANDARD = gnu99 -GCC_ENABLE_OBJC_EXCEPTIONS = YES -GCC_ENABLE_ASM_KEYWORD = YES -CLANG_LINK_OBJC_RUNTIME = YES -CLANG_ENABLE_OBJC_WEAK = YES - -// ARC enabled -CLANG_ENABLE_OBJC_ARC = YES - -// Enable @import modules support -CLANG_ENABLE_MODULES = YES -CLANG_MODULES_AUTOLINK = YES - -CLANG_CXX_LANGUAGE_STANDARD = gnu++11 -CLANG_CXX_LIBRARY = libc++ -CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES - -ENABLE_STRICT_OBJC_MSGSEND = YES - -// Swift -SWIFT_VERSION = 5.0 -SWIFT_PRECOMPILE_BRIDGING_HEADER = YES -SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(CONFIGURATION:upper) -SWIFT_SWIFT3_OBJC_INFERENCE = Off diff --git a/Configuration/Shared/Workspace-Linking.xcconfig b/Configuration/Shared/Workspace-Linking.xcconfig deleted file mode 100644 index 14d45fba1e..0000000000 --- a/Configuration/Shared/Workspace-Linking.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -// Dynamic linking uses different default copy paths. Reset LD_RUNPATH_SEARCH_PATHS for each SDK. -LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = '@executable_path/../Frameworks' '@loader_path/../Frameworks' -LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = '@executable_path/Frameworks' '@loader_path/Frameworks' -LD_RUNPATH_SEARCH_PATHS[sdk=watch*] = '@executable_path/Frameworks' '@loader_path/Frameworks' -LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = '@executable_path/Frameworks' '@loader_path/Frameworks' diff --git a/Configuration/Shared/Workspace-Packaging.xcconfig b/Configuration/Shared/Workspace-Packaging.xcconfig deleted file mode 100644 index f8e5532d2a..0000000000 --- a/Configuration/Shared/Workspace-Packaging.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -PRODUCT_NAME = $(TARGET_NAME) -PRODUCT_BUNDLE_IDENTIFIER = com.apollographql.$(TARGET_NAME:rfc1034identifier).$(PLATFORM_NAME) - -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO diff --git a/Configuration/Shared/Workspace-Release.xcconfig b/Configuration/Shared/Workspace-Release.xcconfig deleted file mode 100644 index 2b2ebb3b7a..0000000000 --- a/Configuration/Shared/Workspace-Release.xcconfig +++ /dev/null @@ -1,22 +0,0 @@ -#include "Workspace-Shared.xcconfig" - -// Architectures -ONLY_ACTIVE_ARCH = NO - -// Build Options -VALIDATE_PRODUCT = YES - -// Deployment Options -COPY_PHASE_STRIP = YES - -// Code Generation -GCC_OPTIMIZATION_LEVEL = s -SWIFT_OPTIMIZATION_LEVEL = -O -SWIFT_COMPILATION_MODE = wholemodule -LLVM_LTO = YES - -// Build Options -DEBUG_INFORMATION_FORMAT = dwarf-with-dsym - -ENABLE_NS_ASSERTIONS = NO -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES diff --git a/Configuration/Shared/Workspace-Search-Paths.xcconfig b/Configuration/Shared/Workspace-Search-Paths.xcconfig deleted file mode 100644 index c6078a25d1..0000000000 --- a/Configuration/Shared/Workspace-Search-Paths.xcconfig +++ /dev/null @@ -1,4 +0,0 @@ -// Search Paths -ALWAYS_SEARCH_USER_PATHS = NO -HEADER_SEARCH_PATHS = $(inherited) $(CONFIGURATION_BUILD_DIR) -FRAMEWORK_SEARCH_PATHS = $(inherited) $(CONFIGURATION_BUILD_DIR) diff --git a/Configuration/Shared/Workspace-Shared.xcconfig b/Configuration/Shared/Workspace-Shared.xcconfig deleted file mode 100644 index 35009aa6d5..0000000000 --- a/Configuration/Shared/Workspace-Shared.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -#include "Workspace-Analysis.xcconfig" -#include "Workspace-Deployment-Targets.xcconfig" -#include "Workspace-Language.xcconfig" -#include "Workspace-Linking.xcconfig" -#include "Workspace-Packaging.xcconfig" -#include "Workspace-Search-Paths.xcconfig" -#include "Workspace-Warnings.xcconfig" -#include "Project-Version.xcconfig" - -GCC_NO_COMMON_BLOCKS = YES -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(CONFIGURATION:upper)=1 -SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) $(CONFIGURATION:upper) -VERSIONING_SYSTEM = apple-generic -DEAD_CODE_STRIPPING = YES diff --git a/Configuration/Shared/Workspace-Target-Application.xcconfig b/Configuration/Shared/Workspace-Target-Application.xcconfig deleted file mode 100644 index 688b7be118..0000000000 --- a/Configuration/Shared/Workspace-Target-Application.xcconfig +++ /dev/null @@ -1 +0,0 @@ -WRAPPER_EXTENSION = app diff --git a/Configuration/Shared/Workspace-Target-Codegen.xcconfig b/Configuration/Shared/Workspace-Target-Codegen.xcconfig deleted file mode 100644 index 4d7c317ccd..0000000000 --- a/Configuration/Shared/Workspace-Target-Codegen.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -SDKROOT = macosx -SUPPORTED_PLATFORMS = macosx -MACOSX_DEPLOYMENT_TARGET = 10.15 diff --git a/Configuration/Shared/Workspace-Target-Framework.xcconfig b/Configuration/Shared/Workspace-Target-Framework.xcconfig deleted file mode 100644 index f02138d8d1..0000000000 --- a/Configuration/Shared/Workspace-Target-Framework.xcconfig +++ /dev/null @@ -1,15 +0,0 @@ -WRAPPER_EXTENSION = framework - -INSTALL_PATH = @rpath -LD_DYLIB_INSTALL_NAME = @rpath/$(PRODUCT_NAME).$(WRAPPER_EXTENSION)/$(PRODUCT_NAME) -SKIP_INSTALL = YES - -DYLIB_COMPATIBILITY_VERSION = 1 -DYLIB_CURRENT_VERSION = 1 -DYLIB_INSTALL_NAME_BASE = @rpath - -FRAMEWORK_VERSION[sdk=macosx*] = A - -APPLICATION_EXTENSION_API_ONLY = YES - -DEFINES_MODULE = YES diff --git a/Configuration/Shared/Workspace-Target-Test.xcconfig b/Configuration/Shared/Workspace-Target-Test.xcconfig deleted file mode 100644 index 0681369253..0000000000 --- a/Configuration/Shared/Workspace-Target-Test.xcconfig +++ /dev/null @@ -1,7 +0,0 @@ -#include "Workspace-Universal-Test.xcconfig" - -// Packaging -WRAPPER_EXTENSION = xctest - -// Disable some known troublesome warnings for the test target, as -Weverything without these exceptions causes errors when importing XCTest -WARNING_CFLAGS = $(inherited) -Wno-documentation-unknown-command -Wno-incomplete-module -Wno-disabled-macro-expansion -Wno-shadow diff --git a/Configuration/Shared/Workspace-Target-TestHelpers.xcconfig b/Configuration/Shared/Workspace-Target-TestHelpers.xcconfig deleted file mode 100644 index 7a2d05bd77..0000000000 --- a/Configuration/Shared/Workspace-Target-TestHelpers.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ -#include "../Shared/Workspace-Universal-Framework.xcconfig" -#include "../Shared/Workspace-Test-Deployment-Targets.xcconfig" - -APPLICATION_EXTENSION_API_ONLY = NO -FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_FRAMEWORKS_DIR) $(PLATFORM_DIR)/Developer/Library/Frameworks -OTHER_LDFLAGS = -weak_framework XCTest diff --git a/Configuration/Shared/Workspace-Test-Deployment-Targets.xcconfig b/Configuration/Shared/Workspace-Test-Deployment-Targets.xcconfig deleted file mode 100644 index 6fe60fc74e..0000000000 --- a/Configuration/Shared/Workspace-Test-Deployment-Targets.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -/// Test Target Deployment Target -IPHONEOS_DEPLOYMENT_TARGET = 15.5 -MACOSX_DEPLOYMENT_TARGET = 12.5 -TVOS_DEPLOYMENT_TARGET = 16.0 -WATCHOS_DEPLOYMENT_TARGET = 9.0 diff --git a/Configuration/Shared/Workspace-Universal-Framework.xcconfig b/Configuration/Shared/Workspace-Universal-Framework.xcconfig deleted file mode 100644 index 79ed2ecebb..0000000000 --- a/Configuration/Shared/Workspace-Universal-Framework.xcconfig +++ /dev/null @@ -1,16 +0,0 @@ -#include "Workspace-Universal-Target.xcconfig" -#include "Workspace-Target-Framework.xcconfig" - -SUPPORTED_PLATFORMS = iphoneos iphonesimulator appletvsimulator appletvos watchsimulator watchos macosx - -// iOS-specific default settings -TARGETED_DEVICE_FAMILY[sdk=iphone*] = 1,2 - -// TV-specific default settings -TARGETED_DEVICE_FAMILY[sdk=appletv*] = 3 - -// Watch-specific default settings -TARGETED_DEVICE_FAMILY[sdk=watch*] = 4 - -// macOS-specific default settings -SUPPORTS_MACCATALYST = YES diff --git a/Configuration/Shared/Workspace-Universal-Target.xcconfig b/Configuration/Shared/Workspace-Universal-Target.xcconfig deleted file mode 100644 index c1870b6d68..0000000000 --- a/Configuration/Shared/Workspace-Universal-Target.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include "Workspace-Deployment-Targets.xcconfig" - -SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos watchos watchsimulator appletvos appletvsimulator diff --git a/Configuration/Shared/Workspace-Universal-Test.xcconfig b/Configuration/Shared/Workspace-Universal-Test.xcconfig deleted file mode 100644 index 8c1632fa82..0000000000 --- a/Configuration/Shared/Workspace-Universal-Test.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Workspace-Universal-Target.xcconfig" -#include "../Shared/Workspace-Test-Deployment-Targets.xcconfig" diff --git a/Configuration/Shared/Workspace-Warnings.xcconfig b/Configuration/Shared/Workspace-Warnings.xcconfig deleted file mode 100644 index 75f73f2245..0000000000 --- a/Configuration/Shared/Workspace-Warnings.xcconfig +++ /dev/null @@ -1,27 +0,0 @@ -CLANG_ANALYZER_NONNULL = YES -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES -CLANG_WARN_BOOL_CONVERSION = YES -CLANG_WARN_COMMA = YES -CLANG_WARN_CONSTANT_CONVERSION = YES -CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES -CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR -CLANG_WARN_DOCUMENTATION_COMMENTS = YES -CLANG_WARN_EMPTY_BODY = YES -CLANG_WARN_ENUM_CONVERSION = YES -CLANG_WARN_INFINITE_RECURSION = YES -CLANG_WARN_INT_CONVERSION = YES -CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -CLANG_WARN_OBJC_LITERAL_CONVERSION = YES -CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR -CLANG_WARN_RANGE_LOOP_ANALYSIS = YES -CLANG_WARN_STRICT_PROTOTYPES = YES -CLANG_WARN_SUSPICIOUS_MOVE = YES -CLANG_WARN_UNREACHABLE_CODE = YES -GCC_WARN_64_TO_32_BIT_CONVERSION = YES -GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR -GCC_WARN_UNDECLARED_SELECTOR = YES -GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_VARIABLE = YES diff --git a/Design/3093-graphql-defer.md b/Design/3093-graphql-defer.md new file mode 100644 index 0000000000..44fcc70a25 --- /dev/null +++ b/Design/3093-graphql-defer.md @@ -0,0 +1,471 @@ +* Feature Name: GraphQL `@defer` +* Start Date: 2023-06-26 +* RFC PR: [3093](https://github.com/apollographql/apollo-ios/pull/3093) + +# Summary + +The specification for `@defer`/`@stream` is slowly making it's way through the GraphQL Foundation approval process and once formally merged into the GraphQL specification Apollo iOS will need to support it. However, Apollo already has a public implementation of `@defer` in the other OSS offerings, namely Apollo Server, Apollo Client, and Apollo Kotlin. The goal of this project is to implement support for `@defer` that matches the other Apollo OSS clients which, based on the commit history, we believe is [the specification as dated at `2022-08-24`](https://github.com/graphql/graphql-spec/tree/48cf7263a71a683fab03d45d309fd42d8d9a6659/spec). This project will not include support for the `@stream` directive. + +Based on the progress of `@defer`/`@stream` through the approval process there may be some differences in the final specification vs. what is currently implemented in Apollo's OSS. This project does not attempt to preemptively anticipate those changes nor comply with the potentially merged specification. Any client affecting-changes in the merged specification will be implemented into Apollo iOS. + +# Proposed Changes + +## Update graphql-js dependency + +Apollo iOS uses [graphql-js](https://github.com/graphql/graphql-js) for validation of the GraphQL schema and operation documents as the first step in the code generation workflow. The version of this [dependency](https://github.com/apollographql/apollo-ios/blob/spike/defer/Sources/ApolloCodegenLib/Frontend/JavaScript/package.json#L16) is fixed at [`16.3.0-canary.pr.3510.5099f4491dc2a35a3e4a0270a55e2a228c15f13b`](https://www.npmjs.com/package/graphql/v/16.3.0-canary.pr.3510.5099f4491dc2a35a3e4a0270a55e2a228c15f13b?activeTab=versions). This is a version of graphql-js that supports the experimental [Client Controlled Nullability](https://github.com/graphql/graphql-wg/blob/main/rfcs/ClientControlledNullability.md) feature but does not support the `@defer` directive. + +The latest `16.x` release of graphql-js with support for the `@defer` directive is [`16.1.0-experimental-stream-defer.6`](https://www.npmjs.com/package/graphql/v/16.1.0-experimental-stream-defer.6) but it looks like the 'experimental' named releases for `@defer` have been discontinued and the recommendation is to use [`17.0.0-alpha.2`](https://www.npmjs.com/package/graphql/v/17.0.0-alpha.2). This is further validated by the fact that [`16.7.0` does not](https://github.com/graphql/graphql-js/blob/v16.7.0/src/type/directives.ts#L167) include the `@defer` directive whereas [`17.0.0-alpha.2` does](https://github.com/graphql/graphql-js/blob/v17.0.0-alpha.2/src/type/directives.ts#L159). + +**Preferred solution (see the end of this document for discarded solutions)** + +We will take a staggered approach where we adopt `17.0.0-alpha.2`, or the latest 17.0.0 alpha release, limiting the changes to our frontend javascript only and at a later stage bring the CCN changes from [PR `#3510`](https://github.com/graphql/graphql-js/pull/3510) to the `17.x` release path and reintroduce support for CCN to Apollo iOS. This would also require the experiemental CCN feature to be removed, with no committment to when it would be reintroduced. + +_The work to port the CCN PRs to `17.0.0-alpha.2` is being done externally as part of the renewed interest in the CCN proposal._ + +## Rename `PossiblyDeferred` types/functions + +Adding support for `@defer` brings new meaning of the word 'deferred' to the codebase. There is an enum type named [`PossiblyDeferred`](https://github.com/apollographql/apollo-ios/blob/spike/defer/Sources/Apollo/PossiblyDeferred.swift#L47) which would cause confusion when trying to understand it’s intent. This type and its related functions should be renamed to disambiguate it from the incoming `@defer` related types and functions. + +`PossiblyDeferred` is an internal type so this should have no adverse effect on users’ code. + +## Generated models + +Generated models will need to adapt with the introduction of `@defer` statements in operations. Ideally there is easy-to-read annotation indicating something is deferred by simply reading the generated model code but more importantly it must be easy when using the generated models in code to detect whether something is able to be deferred and it's current state when receiving a response. + +**Preferred solution (see the end of this document for discarded solutions)** + +These are the key changes: + +**All deferred fragments including inline fragments are treated as isolated fragments** + +This is necessary because they are delivered separately in the incremental response, therefore they cannot be merged together. This means that inline fragments, even on the same typecase with matching arguments, will be treated as separate fragments in the same way that named fragments are. They will be placed into the `Fragments` container along with an accessor. + +This is still undecided but we may require that _all_ deferred fragments be named with the `label` argument. This provides us with a naming paradigm and aids us in identifying the fulfilled fragments in the incremental responses. At a minimum any fragments on the same typecase will need to be uniquely identifable with at least one having an associated label. + +**Deferred fragment accessors are stored properties** + +This is different to data fields which are computed properties that use a subscript on the underlying data dictionary to return the value. We decided to do this so that we can use a property wrapper, which are not available for computed properties. The property wrapper is an easy-to-read annotation on the accessor to aid in identifying a deferred fragment from other named fragments in the fragment container. + +It's worth noting though that the fragment accessors are not true stored properties but rather a pseudo stored-property because the property wrapper is still initialized with a data dictionary that holds the data. This is also made possible by the underlying data dictionary having copy-on-write semantics. + +**`@Deferred` property wrapper** + +Aside from being a conveinent annotation the property wrapper also unlocks both deferred value and state. The wrapped value is used to access the returned value and the projected value is used to determine the state of the fragment in the response, i.e.: pending, fulfilled or a not-executed. + +The not-executed case is used to indicate when a merged deferred fragment could never be fulfilled, such as when the response type is different from the deferred fragment typecase. + +Here is a snippet of a generated model to illustrate the above three points: +```swift +public struct Fragments: FragmentContainer { + public let __data: DataDict + public init(_dataDict: DataDict) { + __data = _dataDict + _root = Deferred(_dataDict: _dataDict) + } + + @Deferred public var deferredFragmentFoo: DeferredFragmentFoo? +} + +public struct DeferredFragmentFoo: AnimalKingdomAPI.InlineFragment, ApolloAPI.Deferrable { +} +``` + +Below is the expected property wrapper: +```swift +public protocol Deferrable: SelectionSet { } + +@propertyWrapper +public struct Deferred { + public enum State { // the naming of these cases is not final + case pending + case notExecuted + case fulfilled(Fragment) + } + + public init(_dataDict: DataDict) { + __data = _dataDict + } + + public var state: State { + let fragment = ObjectIdentifier(Fragment.self) + if __data._fulfilledFragments.contains(fragment) { + return .fulfilled(Fragment.init(_dataDict: __data)) + } + else if __data._deferredFragments.contains(fragment) { + return .pending + } else { + return .notExecuted + } + } + + private let __data: DataDict + public var projectedValue: State { state } + public var wrappedValue: Fragment? { + guard case let .fulfilled(value) = state else { + return nil + } + return value + } +} +``` + +`DataDict`, the underlying data dictionary to data fields will now need to keep track of deferred fragments in a new property, as it does for fulfilled fragments: +```swift +public struct DataDict: Hashable { + // initializer and other properties not shown + + @inlinable public var _deferredFragments: Set { + _storage.deferredFragments + } + + // functions not shown +} +``` + +**A new `deferred(if:type:label:)` case in `Selection`** + +This is necessary for the field selection collector to be able to handle both inline and named fragments the same, which is different from the separate case logic that exists for them today. + +Here is a snippet of a generated model to illustrate the selection: +```swift +public static var __selections: [ApolloAPI.Selection] { [ + .deferred(if: "a", DeferredFragmentFoo.self, label: "deferredFragmentFoo") +] } +``` + +**Field merging** + +Field merging is a feature in Apollo iOS where fields from fragments that have the same `__parentType` as the enclosing `SelectionSet` are automatically merged into the enclosing `SelectionSet`. This makes it easier to consume fragment fields instead of having to access the fragment first. + +Deferred fragment fields will **not** be merged into the enclosing selection set. Merging in the fields of a deferred fragment would require the field types to become optional or use another wrapper-type solution where the field value and state can be represented. We decided it would be better to treat deferred fragments as an isolated selection set with clearer sementics on the collective state and values. + +**Selection set initializers** + +In the preview release of `@defer`, operations with deferred fragments will **not** be able to have generated selection set initializers. This is due to the complexities of field merging which is dependent on work being done by other members of the team. Once we can support this the fields will be optional properties on the initializer and fragment fulfillment will be determined at access time, in a lightweight version of the GraphQL executor, to determine if all deferred fragment field values were provided. + +## Networking + +### Request header + +If an operation can support an incremental delivery response it must add an `Accept` header to the HTTP request specifying the protocol version that can be parsed. An [example](https://github.com/apollographql/apollo-ios/blob/spike/defer/Sources/Apollo/RequestChainNetworkTransport.swift#L115) is HTTP subscription requests that include the `subscriptionSpec=1.0` specification. `@defer` would introduce another operation feature that would request an incremental delivery response. + +This should not be sent with all requests though so operations will need to be identifiable as having deferred fragments to signal inclusion of the request header. + +```swift +// Sample code for RequestChainNetworkTransport +open func constructRequest( + for operation: Operation, + cachePolicy: CachePolicy, + contextIdentifier: UUID? = nil +) -> HTTPRequest { + let request = ... // build request + + if Operation.hasDeferredFragments { + request.addHeader( + name: "Accept", + value: "multipart/mixed;boundary=\"graphql\";deferSpec=20220824,application/json" + ) + } + + return request +} + +// Sample of new property on GraphQLOperation +public protocol GraphQLOperation: AnyObject, Hashable { + // other properties not shown + + static var hasDeferredFragments: Bool { get } // computed for each operation during codegen +} +``` + +### Response parsing + +Apollo iOS already has support for parsing incremental delivery responses. That provides a great foundation to build on however there are some changes needed. + +#### Multipart parsing protocol + +The current `MultipartResponseParsingInterceptor` implementation is specific to the `subscriptionSpec` version `1.0` specification. Adopting a protocol with implementations for each of the supported specifications will enable us to support any number of incremental delivery specifications in the future. + +These would be registered with the `MultipartResponseParsingInterceptor` each with a unique specification string, to be used as a lookup key. When a response is received the specification string is extracted from the response `content-type` header, and the correct specification parser can be used to parse the response data. + +```swift +// Sample code in MultipartResponseParsingInterceptor +public struct MultipartResponseParsingInterceptor: ApolloInterceptor { + private static let responseParsers: [String: MultipartResponseSpecificationParser.Type] = [ + MultipartResponseSubscriptionParser.protocolSpec: MultipartResponseSubscriptionParser.self, + MultipartResponseDeferParser.protocolSpec: MultipartResponseDeferParser.self, + ] + + public func interceptAsync( + chain: RequestChain, + request: HTTPRequest, + response: HTTPResponse?, + completion: @escaping (Result, Error>) -> Void + ) where Operation : GraphQLOperation { + // response validators not shown + + guard + let multipartBoundary = response.httpResponse.multipartBoundary, + let protocolSpec = response.httpResponse.multipartProtocolSpec, + let protocolParser = Self.responseParsers[protocolSpec], + let dataString = String(data: response.rawData, encoding: .utf8) + else { + // call request chain error handler + + return + } + + let dataHandler: ((Data) -> Void) = { data in + // proceed ahead on the request chain + } + + let errorHandler: (() -> Void) = { + // call request chain error handler + } + + for chunk in dataString.components(separatedBy: "--\(boundary)") { + if chunk.isEmpty || chunk.isBoundaryMarker { continue } + + parser.parse(chunk: chunk, dataHandler: dataHandler, errorHandler: errorHandler) + } + } +} + +// Sample protocol for multipart specification parsing +protocol MultipartResponseSpecificationParser { + static var protocolSpec: String { get } + + static func parse( + chunk: String, + dataHandler: ((Data) -> Void), + errorHandler: ((Error) -> Void) + ) +} + +// Sample implementations of multipart specification parsers + +struct MultipartResponseSubscriptionParser: MultipartResponseSpecificationParser { + static let protocolSpec: String = "subscriptionSpec=1.0" + + static func parse( + chunk: String, + dataHandler: ((Data) -> Void), + errorHandler: ((Error) -> Void) + ) { + // parsing code currently in MultipartResponseParsingInterceptor + } +} + +struct MultipartResponseDeferParser: MultipartResponseSpecificationParser { + static let protocolSpec: String = "deferSpec=20220824" + + static func parse( + chunk: String, + dataHandler: ((Data) -> Void), + errorHandler: ((Error) -> Void) + ) { + // new code to parse the defer specification + } +} +``` + +#### Response data + +The initial response data and data received in each incremental response will need to be retained and combined so that each incremental response can insert the latest received incremental response data at the correct path and return an up-to-date response to the request callback. + +The data being retained and combined will be passed through the GraphQL executor on each response, initial and incremental. + +### Completion handler + +`GraphQLResult` should be modified to provide query completion blocks with a high-level abstraction of whether the request has been fulfilled or is still in progress. This prevents clients from having to dig into the deferred fragments to identify the state of the overall request. + +**Preferred solution (see the end of this document for discarded solutions)** + +Introduce a new property on the `GraphQLResult` type that can be used to express the state of the request. + +```swift +// New Response type and property +public struct GraphQLResult { + // other properties and types not shown + + public enum Response { + case partial + case complete + } + + public let response: Response +} + +// Sample usage in an app completion block +client.fetch(query: ExampleQuery()) { result in + switch (result) { + case let .success(data): + switch (data.response) { + case .complete: + case .partial: + } + case let .failure(error): + } +} +``` + +## GraphQL execution + +The executor currently executes on an entire operation selection set. It will need to be adapted to be able to execute on a partial response when deferred fragments have not been received. Each response will be passed to the GraphQL executor. + +There is an oustanding question about whether the Apollo Router has implemented early execution of deferred fragments, potentially returning them in the initial response. If it does then that could have an outsided impact on the changes to the executor. This problem does appear to have been addressed in GraphQL spec edits after `2022-08-24`. + +## Caching + +Similarly to GraphQL execution the cache write interceptor is designed to work holistically on the operation and write cache records for a single response. This approach still works for HTTP-based subscriptions because each incremental response contains a selection set for the entire operation. + +This approach is not going to work for the incremental responses of `@defer` though and partial responses cannot be written to the cache for the operation. Instead all deferred responses will need to be fulfilled before the record is written to the cache. + +```swift +// Only write cache records for complete responses +public struct CacheWriteInterceptor: ApolloInterceptor { + // other code not shown + + public func interceptAsync( + chain: RequestChain, + request: HTTPRequest, + response: HTTPResponse?, + completion: @escaping (Result, Error>) -> Void + ) { + // response validators not shown + + guard + let createdResponse = response, + let parsedResponse = createdResponse.parsedResponse, + parsedResponse.source == .server(.complete) + else { + // a partial response must have been received and should not be written to the cache + return + } + + // cache write code not shown + } +} +``` + +There is a bunch of complexity in writing partial records to the cache such as: query watchers without deferred fragments; how would we handle failed requests; race conditions to fulfil deferred data; amongst others. These problems need careful, thoughtful solutions and this project will not include them in the scope for initial implementation. + +# Discarded solutions + +## Update graphql-js dependency +1. Add support for Client Controlled Nullability to `17.0.0-alpha.2`, or the latest 17.0.0 alpha release, and publish that to NPM. The level of effort for this is unknown but it would allow us to maintain support for CCN. +2. Use `17.0.0-alpha.2`, or the latest 17.0.0 alpha release, as-is and remove the experimental Client Controlled Nullability feature. We do not know how many users rely on the CCN functionality so this may be a controversial decision. This path doesn’t necessarily imply an easier dependency update because there will be changes needed to our frontend javascript to adapt to the changes in graphql-js. + +## Generated models +1. Property wrappers - I explored Swift's property wrappers but they suffer from the limitation of not being able to be applied to a computed property. All GraphQL fields in the generated models are computed properties because they simply route access to the value in the underlying data dictionary storage. It would be nice to be able to simply annotate fragments and fields with something like `@Deferred` but unfortunately that is not possible. +2. Optional types - this solution would change the deferred property type to an optional version of that type. This may not seem necessary when considering that only fragments can be marked as deferred but it would be required to cater for the way that Apollo iOS does field merging in the generated model fragments. Field merging is non-optional at the moment but there is an issue ([#2560](https://github.com/apollographql/apollo-ios/issues/2560)) that would make this a configuration option. This solution hides detail though because you wouldn't be able to tell whether the field value is `nil` because the response data hasn't been received yet (i.e.: deferred) or whether the data was returned and it was explicitly `null`. It also gets more complicated when a field type is already optional; would that result in a Swift double-optional type? As we learnt with the legacy implementation of GraphQL nullability, double-optionals are difficult to interpret and easily lead to mistakes. +3. `Enum` wrapper - an idea that was suggested by [`@Iron-Ham`](https://github.com/apollographql/apollo-ios/issues/2395#issuecomment-1433628466) is to wrap the type in a Swift enum that can expose the deferred state as well as the underlying value once it has been received. This is an improvement to option 2 where the state of the deferred value can be determined. + +```swift +// Sample enum to wrap deferred properties +enum DeferredValue { + case loading + case result(Result) +} + +// Sample model with a deferred property +public struct ModelSelectionSet: GraphAPI.SelectionSet { + // other properties not shown + + public var name: DeferredValue { __data["name"] } +} +``` + +4. Optional fragments (disabling field merging) - optional types are only needed when fragment fields are merged into entity selection sets. If field merging were disabled automatically for deferred fragments then the solution is simplified and we only need to alter the deferred fragments to be optional. Consuming the result data is intuitive too where a `nil` fragment value would indicate that the fragment data has not yet been received (i.e.: deferred) and when the complete response is received the fragment value is populated and the result sent to the client. This seems a more elegant and ergonimic way to indicate the status of deferred data but complicates the understanding of field merging. + +```swift +// Sample usage in a generated model +public class ExampleQuery: GraphQLQuery { + // other properties and types not shown + + public struct Data: ExampleSchema.SelectionSet { + public static var __selections: [ApolloAPI.Selection] { [ + .fragment(EntityFragment?.self, deferred: true) + ] } + } +} + +// Sample usage in an app completion block +client.fetch(query: ExampleQuery()) { result in + switch (result) { + case let .success(data): + client.fetch(query: ExampleQuery()) { result in + switch (result) { + case let .success(data): + guard let fragment = data.data?.item.fragments.entityFragment else { + // partial result + } + + // complete result + case let .failure(error): + print("Query Failure! \(error)") + } + } + case let .failure(error): + } +} + +``` + +Regardless of the fragment/field solution chosen all deferred fragment definitions in generated models `__selections` will get an additional property to indicate they are deferred. This helps to understand the models when reading them as well as being used by internal code. + +```swift +// Updated Selection enum +public enum Selection { + // other cases not shown + case fragment(any Fragment.Type, deferred: Bool) + case inlineFragment(any InlineFragment.Type, deferred: Bool) + + // other properties and types not shown +} + +// Sample usage in a generated model +public class ExampleQuery: GraphQLQuery { + // other properties and types not shown + + public struct Data: ExampleSchema.SelectionSet { + public static var __selections: [ApolloAPI.Selection] { [ + .fragment(EntityFragment.self, deferred: true), + .inlineFragment(AsEntity.self, deferred: true), + ] } + } +} +``` +## Networking + +1. Another way which may be a bit more intuitive is to make the `server` case on `Source` have an associated value since `cache` sources will always be complete. The cache could return partial responses for deferred operations but for the initial implementation we will probably only write the cache record once all deferred fragments have been received. This solution becomes invalid though once the cache can return partial responses, with that in mind maybe option 1 is better. + +```swift +// Updated server case on Source with associated value of Response type +public struct GraphQLResult { + // other properties and types not shown + + public enum Response { + case partial + case complete + } + + public enum Source: Hashable { + case cache + case server(_ response: Response) + } +} + +// Sample usage in an app +client.fetch(query: ExampleQuery()) { result in + switch (result) { + case let .success(data): + switch (data.source) { + case .server(.complete): + case .server(.partial): + case .cache: + } + case let .failure(error): + } +} +``` diff --git a/Package.resolved b/Package.resolved index f797781b79..cb4b75775e 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,14 +1,5 @@ { "pins" : [ - { - "identity" : "inflectorkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattt/InflectorKit", - "state" : { - "revision" : "d8cbcc04972690aaa5fc760a2b9ddb3e9f0decd7", - "version" : "1.0.0" - } - }, { "identity" : "sqlite.swift", "kind" : "remoteSourceControl", @@ -17,24 +8,6 @@ "revision" : "7a2e3cd27de56f6d396e84f63beefd0267b55ccb", "version" : "0.14.1" } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "fddd1c00396eed152c45a46bea9f47b98e59301d", - "version" : "1.2.0" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections", - "state" : { - "revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2", - "version" : "1.0.4" - } } ], "version" : 2 diff --git a/Package.swift b/Package.swift index 6afecc1ba7..7597fbd361 100644 --- a/Package.swift +++ b/Package.swift @@ -15,96 +15,47 @@ let package = Package( .library(name: "Apollo", targets: ["Apollo"]), .library(name: "ApolloAPI", targets: ["ApolloAPI"]), .library(name: "Apollo-Dynamic", type: .dynamic, targets: ["Apollo"]), - .library(name: "ApolloCodegenLib", targets: ["ApolloCodegenLib"]), .library(name: "ApolloSQLite", targets: ["ApolloSQLite"]), .library(name: "ApolloWebSocket", targets: ["ApolloWebSocket"]), .library(name: "ApolloTestSupport", targets: ["ApolloTestSupport"]), - .executable(name: "apollo-ios-cli", targets: ["apollo-ios-cli"]), - .plugin(name: "InstallCLI", targets: ["Install CLI"]), + .plugin(name: "InstallCLI", targets: ["Install CLI"]) ], dependencies: [ .package( url: "https://github.com/stephencelis/SQLite.swift.git", .upToNextMajor(from: "0.13.1")), - .package( - url: "https://github.com/mattt/InflectorKit", - .upToNextMajor(from: "1.0.0")), - .package( - url: "https://github.com/apple/swift-collections", - .upToNextMajor(from: "1.0.0")), - .package( - url: "https://github.com/apple/swift-argument-parser.git", - .upToNextMajor(from: "1.2.0")), ], targets: [ .target( name: "Apollo", dependencies: [ "ApolloAPI" - ], - exclude: [ - "Info.plist" - ]), + ] + ), .target( name: "ApolloAPI", - dependencies: [], - exclude: [ - "Info.plist" - ]), - .target( - name: "ApolloCodegenLib", - dependencies: [ - .product(name: "InflectorKit", package: "InflectorKit"), - .product(name: "OrderedCollections", package: "swift-collections") - ], - exclude: [ - "Info.plist", - "Frontend/JavaScript", - "Frontend/auto_rollup.sh", - ]), + dependencies: [] + ), .target( name: "ApolloSQLite", dependencies: [ "Apollo", .product(name: "SQLite", package: "SQLite.swift"), - ], - exclude: [ - "Info.plist" - ]), + ] + ), .target( name: "ApolloWebSocket", dependencies: [ "Apollo" - ], - exclude: [ - "Info.plist" - ]), + ] + ), .target( name: "ApolloTestSupport", dependencies: [ "Apollo", "ApolloAPI" - ], - exclude: [ - "Info.plist" - ]), - .executableTarget( - name: "apollo-ios-cli", - dependencies: [ - "CodegenCLI", - ], - exclude: [ - "README.md", - ]), - .target( - name: "CodegenCLI", - dependencies: [ - "ApolloCodegenLib", - .product(name: "ArgumentParser", package: "swift-argument-parser"), - ], - exclude: [ - "Info.plist", - ]), + ] + ), .plugin( name: "Install CLI", capability: .command( @@ -112,11 +63,10 @@ let package = Package( verb: "apollo-cli-install", description: "Installs the Apollo iOS Command line interface."), permissions: [ - .writeToPackageDirectory(reason: "Creates a symbolic link to the CLI executable in your project directory.") + .writeToPackageDirectory(reason: "Creates a symbolic link to the CLI executable in your project directory."), ]), - dependencies: [ - "apollo-ios-cli" - ], - path: "Plugins/InstallCLI"), + dependencies: [], + path: "Plugins/InstallCLI" + ) ] ) diff --git a/Plugins/InstallCLI/InstallCLIPluginCommand.swift b/Plugins/InstallCLI/InstallCLIPluginCommand.swift index 6d536940b5..d3f0af0c20 100644 --- a/Plugins/InstallCLI/InstallCLIPluginCommand.swift +++ b/Plugins/InstallCLI/InstallCLIPluginCommand.swift @@ -5,8 +5,24 @@ import PackagePlugin struct InstallCLIPluginCommand: CommandPlugin { func performCommand(context: PackagePlugin.PluginContext, arguments: [String]) async throws { - let pathToCLI = try context.tool(named: "apollo-ios-cli").path - try createSymbolicLink(from: pathToCLI, to: context.package.directory) + var apolloDirectoryPath: Path? = nil + let dependencies = context.package.dependencies + dependencies.forEach { dep in + if dep.package.displayName == "Apollo" { + apolloDirectoryPath = dep.package.directory + } + } + + guard let apolloPath = apolloDirectoryPath else { + fatalError("No Apollo dependency directory path") + } + + let process = Process() + let tarPath = try context.tool(named: "tar").path + process.executableURL = URL(fileURLWithPath: tarPath.string) + process.arguments = ["-xvf", "\(apolloPath)/CLI/apollo-ios-cli.tar.gz"] + try process.run() + process.waitUntilExit() } func createSymbolicLink(from: PackagePlugin.Path, to: PackagePlugin.Path) throws { @@ -29,8 +45,13 @@ extension InstallCLIPluginCommand: XcodeCommandPlugin { /// 👇 This entry point is called when operating on an Xcode project. func performCommand(context: XcodePluginContext, arguments: [String]) throws { print("Installing Apollo CLI Plugin to Xcode project \(context.xcodeProject.displayName)") - let pathToCLI = try context.tool(named: "apollo-ios-cli").path - try createSymbolicLink(from: pathToCLI, to: context.xcodeProject.directory) + let apolloPath = "\(context.pluginWorkDirectory)/../../checkouts/apollo-ios" + let process = Process() + let tarPath = try context.tool(named: "tar").path + process.executableURL = URL(fileURLWithPath: tarPath.string) + process.arguments = ["-xvf", "\(apolloPath)/CLI/apollo-ios-cli.tar.gz"] + try process.run() + process.waitUntilExit() } } diff --git a/README.md b/README.md index 260d1526be..71c0dc5dc9 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@

- - CircleCI build status + + GitHub Action Status MIT license @@ -42,6 +42,10 @@ If you are new to Apollo iOS we recommend our [Getting Started](https://www.apol There is also [comprehensive documentation](https://www.apollographql.com/docs/ios/) including an [API reference](https://www.apollographql.com/docs/ios/docc/documentation/index). +### Carthage/XCFramework Support + +The Apollo iOS repo no longer contains an Xcode project, as a result if you are using Carthage or need to build XCFrameworks for use in your development environment you will want to use the [apollo-ios-xcframework](https://github.com/apollographql/apollo-ios-xcframework) repo we have created that contains an Xcode project generated with Tuist that can be used for this purpose and is tagged to match the releases of Apollo iOS. + ## Releases and changelog [All releases](https://github.com/apollographql/apollo-ios/releases) are catalogued and we maintain a [changelog](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md) which details all changes to the library. @@ -52,13 +56,7 @@ The [roadmap](https://github.com/apollographql/apollo-ios/blob/main/ROADMAP.md) ## Contributing -This project is being developed using Xcode 14 and Swift 5.7. - -If you open `Apollo.xcodeproj`, you should be able to run the tests of the `Apollo`, `ApolloSQLite`, and `ApolloWebSocket` frameworks on your Mac or an iOS Simulator. `ApolloCodegenLib` tests can only be run on macOS. - -Some of the tests run against [a simple GraphQL server serving the Star Wars example schema](https://github.com/apollographql/starwars-server) (see installation instructions there). - -If you'd like to contribute, please refer to the [Apollo Contributor Guide](https://github.com/apollographql/apollo-ios/blob/main/CONTRIBUTING.md). +If you'd like to contribute, please refer to the [Apollo Contributor Guide](https://github.com/apollographql/apollo-ios-dev/blob/main/CONTRIBUTING.md). ## Maintainers diff --git a/RELEASE_CHECKLIST.md b/RELEASE_CHECKLIST.md deleted file mode 100644 index 4b16ffc88b..0000000000 --- a/RELEASE_CHECKLIST.md +++ /dev/null @@ -1 +0,0 @@ -The release checklist has been moved to a [Pull Request template](https://github.com/apollographql/apollo-ios/blob/main/.github/PULL_REQUEST_TEMPLATE/pull-request-template-release.md). Unfortunately Pull Request templates aren't offered as a selection list when creating a new Pull Request, nor can a static link be used. To get the template contents in your new Pull Request you need to manually append the query parameter `template=pull-request-template-release.md` in the address bar once you've selected the compare branches. diff --git a/ROADMAP.md b/ROADMAP.md index d1f6a8e39a..f83bddf387 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,6 +1,6 @@ # 🔮 Apollo iOS Roadmap -**Last updated: 2023-09-07** +**Last updated: 2023-11-02** For up to date release notes, refer to the project's [Changelog](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md). @@ -28,23 +28,28 @@ _Approximate Date: TBD - PR from an external contributor is in review_ - Support for Relay-style (cursor-based), offset-based, and arbitrary pagination patterns - `@connection` directive support - This feature will be considered experimental, meaning that the public API could change in backwards-incompatible ways until it is declared stable in a future release +- This package will be versioned independently from Apollo iOS, beginning with `0.1.0` ### [`@defer` support](https://github.com/apollographql/apollo-ios/issues/2395) -_Approximate Date: October 2023_ +_Approximate Date: 2023-11-10_ The `@defer` directive enables your queries to receive data for specific fields asynchronously. This is helpful whenever some fields in a query take much longer to resolve than others. [Apollo Kotlin](https://www.apollographql.com/docs/kotlin/fetching/defer/) and [Apollo Client (web)](https://www.apollographql.com/docs/react/data/defer/) currently support this syntax, so if you're interested in learning more check out their documentation. Apollo iOS will release support for this directive in a `1.x` minor version. This will be released as an experimental feature. -### [Improve fragment merging and code generation performance](https://github.com/apollographql/apollo-ios/milestone/67) +We plan to release `@defer` support in a feature branch first, then will move it into our regular release pipeline behind an experimental flag later on. -_Approximate Date: 2023-10-06_ +### [Improvements to code generation configuration and performance](https://github.com/apollographql/apollo-ios/milestone/67) -- Add configuration for disabling merging of fragment fields -- Fix retain cycles and memory issues causing code generation to take very long on certain large, complex schemas with deeply nested fragment composition +_Approximate Date: to be released incrementally_ + +- This effort encompasses several smaller features: + - ✅ Make codegen support Swift concurrency (`async`/`await`): available in v1.7.0 + - Add configuration for disabling merging of fragment fields + - Fix retain cycles and memory issues causing code generation to take very long on certain large, complex schemas with deeply nested fragment composition ### [Reduce generated schema types](https://github.com/apollographql/apollo-ios/milestone/71) -_Approximate Date: Late October 2023_ +_Approximate Date: February 2024_ - Right now we are naively generating schema types that we don't always need. A smarter algorithm can reduce generated code for certain large schemas that are currently having every type in their schema generated - Create configuration for manually indicating schema types you would like to have schema types and TestMocks generated for diff --git a/SimpleUploadServer/.gitignore b/SimpleUploadServer/.gitignore deleted file mode 100644 index 98f86d8507..0000000000 --- a/SimpleUploadServer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -uploads -node_modules -db.json \ No newline at end of file diff --git a/SimpleUploadServer/.nvmrc b/SimpleUploadServer/.nvmrc deleted file mode 100644 index 7814f7d060..0000000000 --- a/SimpleUploadServer/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v12.22.10 \ No newline at end of file diff --git a/SimpleUploadServer/file-utils.js b/SimpleUploadServer/file-utils.js deleted file mode 100644 index 4ec0a29268..0000000000 --- a/SimpleUploadServer/file-utils.js +++ /dev/null @@ -1,50 +0,0 @@ -const fs = require("fs"); -const lowdb = require("lowdb"); -const FileSync = require("lowdb/adapters/FileSync"); -const mkdirp = require("mkdirp"); -const shortid = require("shortid"); - -const UPLOAD_DIR = "./uploads"; -const db = lowdb(new FileSync("db.json")); - -// Seed an empty DB. -db.defaults({ uploads: [] }).write(); - -// Ensure upload directory exists. -mkdirp.sync(UPLOAD_DIR); - -const storeFS = ({ stream, filename }) => { - const id = shortid.generate(); - const path = `${UPLOAD_DIR}/${id}-${filename}`; - return new Promise((resolve, reject) => - stream - .on("error", error => { - if (stream.truncated) - // Delete the truncated file. - fs.unlinkSync(path); - reject(error); - }) - .pipe(fs.createWriteStream(path)) - .on("error", error => reject(error)) - .on("finish", () => resolve({ id, path })) - ); -}; - -const storeDB = file => - db - .get("uploads") - .push(file) - .last() - .write(); - -const processUpload = async upload => { - const { createReadStream, filename, mimetype } = await upload; - const stream = createReadStream(); - const { id, path } = await storeFS({ stream, filename }); - return storeDB({ id, filename, mimetype, path }); -}; - -module.exports = { - db, - processUpload -}; diff --git a/SimpleUploadServer/index.js b/SimpleUploadServer/index.js deleted file mode 100644 index fed3f0b44c..0000000000 --- a/SimpleUploadServer/index.js +++ /dev/null @@ -1,71 +0,0 @@ -const { ApolloServer, gql, GraphQLUpload } = require("apollo-server"); -const promisesAll = require("promises-all"); -const { db, processUpload } = require("./file-utils"); - -const typeDefs = gql` - type File { - id: ID! - path: String! - filename: String! - mimetype: String! - } - type Query { - uploads: [File] - } - type Mutation { - singleUpload(file: Upload!): File! - multipleUpload(files: [Upload!]!): [File!]! - multipleParameterUpload(singleFile: Upload!, multipleFiles: [Upload!]!): [File!]! - } -`; - -const resolvers = { - Upload: GraphQLUpload, - Query: { - uploads: () => db.get("uploads").value() - }, - Mutation: { - singleUpload: (obj, { file }) => processUpload(file), - async multipleUpload(obj, { files }) { - const { resolve, reject } = await promisesAll.all( - files.map(processUpload) - ); - - if (reject.length) - reject.forEach(({ name, message }) => - // eslint-disable-next-line no-console - console.error(`${name}: ${message}`) - ); - - return resolve; - }, - async multipleParameterUpload(obj, { singleFile, multipleFiles }) { - const { resolve, reject } = await promisesAll.all( - [singleFile, ...multipleFiles].map(processUpload) - ); - - if (reject.length) - reject.forEach(({ name, message }) => - // eslint-disable-next-line no-console - console.error(`${name}: ${message}`) - ); - - return resolve; - } - } -}; - -const server = new ApolloServer({ - typeDefs, - resolvers, - uploads: { - maxFileSize: 10000000, // 10 MB - maxFiles: 20 - } -}); - -server.listen({ - port: 4001 -}).then(({ url }) => { - console.info(`Upload server started at ${url}`); -}); diff --git a/SimpleUploadServer/package-lock.json b/SimpleUploadServer/package-lock.json deleted file mode 100644 index 4810a5dd72..0000000000 --- a/SimpleUploadServer/package-lock.json +++ /dev/null @@ -1,1615 +0,0 @@ -{ - "name": "uploads", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@apollo/protobufjs": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@apollo/protobufjs/-/protobufjs-1.2.2.tgz", - "integrity": "sha512-vF+zxhPiLtkwxONs6YanSt1EpwpGilThpneExUN5K3tCymuxNnVq2yojTvnpRjv2QfsEIt/n7ozPIIzBLwGIDQ==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "@types/node": "^10.1.0", - "long": "^4.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" - } - } - }, - "@apollographql/apollo-tools": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@apollographql/apollo-tools/-/apollo-tools-0.5.2.tgz", - "integrity": "sha512-KxZiw0Us3k1d0YkJDhOpVH5rJ+mBfjXcgoRoCcslbgirjgLotKMzOcx4PZ7YTEvvEROmvG7X3Aon41GvMmyGsw==" - }, - "@apollographql/graphql-playground-html": { - "version": "1.6.27", - "resolved": "https://registry.npmjs.org/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.27.tgz", - "integrity": "sha512-tea2LweZvn6y6xFV11K0KC8ETjmm52mQrW+ezgB2O/aTQf8JGyFmMcRPFgUaQZeHbWdm8iisDC6EjOKsXu0nfw==", - "requires": { - "xss": "^1.0.8" - } - }, - "@apollographql/graphql-upload-8-fork": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@apollographql/graphql-upload-8-fork/-/graphql-upload-8-fork-8.1.3.tgz", - "integrity": "sha512-ssOPUT7euLqDXcdVv3Qs4LoL4BPtfermW1IOouaqEmj36TpHYDmYDIbKoSQxikd9vtMumFnP87OybH7sC9fJ6g==", - "requires": { - "@types/express": "*", - "@types/fs-capacitor": "*", - "@types/koa": "*", - "busboy": "^0.3.1", - "fs-capacitor": "^2.0.4", - "http-errors": "^1.7.3", - "object-path": "^0.11.4" - } - }, - "@josephg/resolvable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@josephg/resolvable/-/resolvable-1.0.1.tgz", - "integrity": "sha512-CtzORUwWTTOTqfVtHaKRJ0I1kNQd1bpn3sUh8I3nJDVY+5/M/Oe1DnEWzPQvqq/xPIIkzzzIP7mfCoAjFRvDhg==" - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "@types/accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/body-parser": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.1.tgz", - "integrity": "sha512-a6bTJ21vFOGIkwM0kzh9Yr89ziVxq4vYH2fQ6N8AeipEzai/cFK6aGMArIkUeIdRIgpwQa+2bXiLuUJCpSf2Cg==", - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==" - }, - "@types/cookies": { - "version": "0.7.7", - "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz", - "integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==", - "requires": { - "@types/connect": "*", - "@types/express": "*", - "@types/keygrip": "*", - "@types/node": "*" - } - }, - "@types/cors": { - "version": "2.8.10", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", - "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" - }, - "@types/express": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.18", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.24", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.24.tgz", - "integrity": "sha512-3UJuW+Qxhzwjq3xhwXm2onQcFHn76frIYVbTu+kn24LFxI+dEhdfISDFovPB8VpEgW8oQCTpRuCe+0zJxB7NEA==", - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "@types/fs-capacitor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/fs-capacitor/-/fs-capacitor-2.0.0.tgz", - "integrity": "sha512-FKVPOCFbhCvZxpVAMhdBdTfVfXUpsh15wFHgqOKxh9N9vzWZVuWCSijZ5T4U34XYNnuj2oduh6xcs1i+LPI+BQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/http-assert": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", - "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==" - }, - "@types/http-errors": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.1.tgz", - "integrity": "sha512-e+2rjEwK6KDaNOm5Aa9wNGgyS9oSZU/4pfSMMPYNOfjvFI0WVXm29+ITRFr6aKDvvKo7uU1jV68MW4ScsfDi7Q==" - }, - "@types/keygrip": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", - "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==" - }, - "@types/koa": { - "version": "2.13.4", - "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", - "integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==", - "requires": { - "@types/accepts": "*", - "@types/content-disposition": "*", - "@types/cookies": "*", - "@types/http-assert": "*", - "@types/http-errors": "*", - "@types/keygrip": "*", - "@types/koa-compose": "*", - "@types/node": "*" - } - }, - "@types/koa-compose": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz", - "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==", - "requires": { - "@types/koa": "*" - } - }, - "@types/long": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", - "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" - }, - "@types/mime": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", - "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==" - }, - "@types/node": { - "version": "16.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", - "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==" - }, - "@types/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" - }, - "@types/range-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", - "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" - }, - "@types/serve-static": { - "version": "1.13.10", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", - "integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==", - "requires": { - "@types/mime": "^1", - "@types/node": "*" - } - }, - "@types/ws": { - "version": "7.4.7", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", - "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", - "requires": { - "@types/node": "*" - } - }, - "@wry/equality": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.11.tgz", - "integrity": "sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA==", - "requires": { - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", - "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - } - }, - "apollo-cache-control": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/apollo-cache-control/-/apollo-cache-control-0.14.0.tgz", - "integrity": "sha512-qN4BCq90egQrgNnTRMUHikLZZAprf3gbm8rC5Vwmc6ZdLolQ7bFsa769Hqi6Tq/lS31KLsXBLTOsRbfPHph12w==", - "requires": { - "apollo-server-env": "^3.1.0", - "apollo-server-plugin-base": "^0.13.0" - } - }, - "apollo-datasource": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/apollo-datasource/-/apollo-datasource-0.9.0.tgz", - "integrity": "sha512-y8H99NExU1Sk4TvcaUxTdzfq2SZo6uSj5dyh75XSQvbpH6gdAXIW9MaBcvlNC7n0cVPsidHmOcHOWxJ/pTXGjA==", - "requires": { - "apollo-server-caching": "^0.7.0", - "apollo-server-env": "^3.1.0" - } - }, - "apollo-graphql": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/apollo-graphql/-/apollo-graphql-0.9.5.tgz", - "integrity": "sha512-RGt5k2JeBqrmnwRM0VOgWFiGKlGJMfmiif/4JvdaEqhMJ+xqe/9cfDYzXfn33ke2eWixsAbjEbRfy8XbaN9nTw==", - "requires": { - "core-js-pure": "^3.10.2", - "lodash.sortby": "^4.7.0", - "sha.js": "^2.4.11" - } - }, - "apollo-link": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.14.tgz", - "integrity": "sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg==", - "requires": { - "apollo-utilities": "^1.3.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.9.3", - "zen-observable-ts": "^0.8.21" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "apollo-reporting-protobuf": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/apollo-reporting-protobuf/-/apollo-reporting-protobuf-0.8.0.tgz", - "integrity": "sha512-B3XmnkH6Y458iV6OsA7AhfwvTgeZnFq9nPVjbxmLKnvfkEl8hYADtz724uPa0WeBiD7DSFcnLtqg9yGmCkBohg==", - "requires": { - "@apollo/protobufjs": "1.2.2" - } - }, - "apollo-server": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/apollo-server/-/apollo-server-2.25.3.tgz", - "integrity": "sha512-+eUY2//DLkU7RkJLn6CTl1P89/ZMHuUQnWqv8La2iJ2hLT7Me+nMx+hgHl3LqlT/qDstQ8qA45T85FuCayplmQ==", - "requires": { - "apollo-server-core": "^2.25.3", - "apollo-server-express": "^2.25.3", - "express": "^4.0.0", - "graphql-subscriptions": "^1.0.0", - "graphql-tools": "^4.0.8", - "stoppable": "^1.1.0" - } - }, - "apollo-server-caching": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.7.0.tgz", - "integrity": "sha512-MsVCuf/2FxuTFVhGLK13B+TZH9tBd2qkyoXKKILIiGcZ5CDUEBO14vIV63aNkMkS1xxvK2U4wBcuuNj/VH2Mkw==", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "apollo-server-core": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.25.3.tgz", - "integrity": "sha512-Midow3uZoJ9TjFNeCNSiWElTVZlvmB7G7tG6PPoxIR9Px90/v16Q6EzunDIO0rTJHRC3+yCwZkwtf8w2AcP0sA==", - "requires": { - "@apollographql/apollo-tools": "^0.5.0", - "@apollographql/graphql-playground-html": "1.6.27", - "@apollographql/graphql-upload-8-fork": "^8.1.3", - "@josephg/resolvable": "^1.0.0", - "@types/ws": "^7.0.0", - "apollo-cache-control": "^0.14.0", - "apollo-datasource": "^0.9.0", - "apollo-graphql": "^0.9.0", - "apollo-reporting-protobuf": "^0.8.0", - "apollo-server-caching": "^0.7.0", - "apollo-server-env": "^3.1.0", - "apollo-server-errors": "^2.5.0", - "apollo-server-plugin-base": "^0.13.0", - "apollo-server-types": "^0.9.0", - "apollo-tracing": "^0.15.0", - "async-retry": "^1.2.1", - "fast-json-stable-stringify": "^2.0.0", - "graphql-extensions": "^0.15.0", - "graphql-tag": "^2.11.0", - "graphql-tools": "^4.0.8", - "loglevel": "^1.6.7", - "lru-cache": "^6.0.0", - "sha.js": "^2.4.11", - "subscriptions-transport-ws": "^0.9.19", - "uuid": "^8.0.0" - } - }, - "apollo-server-env": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/apollo-server-env/-/apollo-server-env-3.1.0.tgz", - "integrity": "sha512-iGdZgEOAuVop3vb0F2J3+kaBVi4caMoxefHosxmgzAbbSpvWehB8Y1QiSyyMeouYC38XNVk5wnZl+jdGSsWsIQ==", - "requires": { - "node-fetch": "^2.6.1", - "util.promisify": "^1.0.0" - } - }, - "apollo-server-errors": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-2.5.0.tgz", - "integrity": "sha512-lO5oTjgiC3vlVg2RKr3RiXIIQ5pGXBFxYGGUkKDhTud3jMIhs+gel8L8zsEjKaKxkjHhCQAA/bcEfYiKkGQIvA==" - }, - "apollo-server-express": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.25.3.tgz", - "integrity": "sha512-tTFYn0oKH2qqLwVj7Ez2+MiKleXACODiGh5IxsB7VuYCPMAi9Yl8iUSlwTjQUvgCWfReZjnf0vFL2k5YhDlrtQ==", - "requires": { - "@apollographql/graphql-playground-html": "1.6.27", - "@types/accepts": "^1.3.5", - "@types/body-parser": "1.19.0", - "@types/cors": "2.8.10", - "@types/express": "^4.17.12", - "@types/express-serve-static-core": "^4.17.21", - "accepts": "^1.3.5", - "apollo-server-core": "^2.25.3", - "apollo-server-types": "^0.9.0", - "body-parser": "^1.18.3", - "cors": "^2.8.5", - "express": "^4.17.1", - "graphql-subscriptions": "^1.0.0", - "graphql-tools": "^4.0.8", - "parseurl": "^1.3.2", - "subscriptions-transport-ws": "^0.9.19", - "type-is": "^1.6.16" - }, - "dependencies": { - "@types/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==", - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - } - } - }, - "apollo-server-plugin-base": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/apollo-server-plugin-base/-/apollo-server-plugin-base-0.13.0.tgz", - "integrity": "sha512-L3TMmq2YE6BU6I4Tmgygmd0W55L+6XfD9137k+cWEBFu50vRY4Re+d+fL5WuPkk5xSPKd/PIaqzidu5V/zz8Kg==", - "requires": { - "apollo-server-types": "^0.9.0" - } - }, - "apollo-server-types": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/apollo-server-types/-/apollo-server-types-0.9.0.tgz", - "integrity": "sha512-qk9tg4Imwpk732JJHBkhW0jzfG0nFsLqK2DY6UhvJf7jLnRePYsPxWfPiNkxni27pLE2tiNlCwoDFSeWqpZyBg==", - "requires": { - "apollo-reporting-protobuf": "^0.8.0", - "apollo-server-caching": "^0.7.0", - "apollo-server-env": "^3.1.0" - } - }, - "apollo-tracing": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.15.0.tgz", - "integrity": "sha512-UP0fztFvaZPHDhIB/J+qGuy6hWO4If069MGC98qVs0I8FICIGu4/8ykpX3X3K6RtaQ56EDAWKykCxFv4ScxMeA==", - "requires": { - "apollo-server-env": "^3.1.0", - "apollo-server-plugin-base": "^0.13.0" - } - }, - "apollo-utilities": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz", - "integrity": "sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==", - "requires": { - "@wry/equality": "^0.1.2", - "fast-json-stable-stringify": "^2.0.0", - "ts-invariant": "^0.4.0", - "tslib": "^1.10.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "async-retry": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", - "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", - "requires": { - "retry": "0.13.1" - } - }, - "backo2": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" - }, - "bluebird": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz", - "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==" - }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - }, - "dependencies": { - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - } - } - }, - "busboy": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz", - "integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==", - "requires": { - "dicer": "0.3.0" - } - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "requires": { - "safe-buffer": "5.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-js-pure": { - "version": "3.19.1", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.19.1.tgz", - "integrity": "sha512-Q0Knr8Es84vtv62ei6/6jXH/7izKmOrtrxH9WJTHLCMAVeU+8TF8z8Nr08CsH4Ot0oJKzBzJJL9SJBYIv7WlfQ==" - }, - "cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "cssfilter": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz", - "integrity": "sha1-xtJnJjKi5cg+AT5oZKQs6N79IK4=" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" - } - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "deprecated-decorator": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz", - "integrity": "sha1-AJZjF7ehL+kvPMgx91g68ym4bDc=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "dicer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz", - "integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==", - "requires": { - "streamsearch": "0.1.2" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "eventemitter3": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" - }, - "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "requires": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - } - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - } - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "requires": { - "is-callable": "^1.1.3" - } - }, - "forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "fs-capacitor": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/fs-capacitor/-/fs-capacitor-2.0.4.tgz", - "integrity": "sha512-8S4f4WsCryNw2mJJchi46YgB6CR5Ze+4L1h8ewl9tEpL4SJ3ZO+c/bS4BWhB8bK+O3TMqhuZarTitd0S0eh2pA==" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, - "graceful-fs": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.1.tgz", - "integrity": "sha512-b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw==" - }, - "graphql": { - "version": "14.7.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.7.0.tgz", - "integrity": "sha512-l0xWZpoPKpppFzMfvVyFmp9vLN7w/ZZJPefUicMCepfJeQ8sMcztloGYY9DfjVPo6tIUDzU5Hw3MUbIjj9AVVA==", - "requires": { - "iterall": "^1.2.2" - } - }, - "graphql-extensions": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.15.0.tgz", - "integrity": "sha512-bVddVO8YFJPwuACn+3pgmrEg6I8iBuYLuwvxiE+lcQQ7POotVZxm2rgGw0PvVYmWWf3DT7nTVDZ5ROh/ALp8mA==", - "requires": { - "@apollographql/apollo-tools": "^0.5.0", - "apollo-server-env": "^3.1.0", - "apollo-server-types": "^0.9.0" - } - }, - "graphql-subscriptions": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/graphql-subscriptions/-/graphql-subscriptions-1.2.1.tgz", - "integrity": "sha512-95yD/tKi24q8xYa7Q9rhQN16AYj5wPbrb8tmHGM3WRc9EBmWrG/0kkMl+tQG8wcEuE9ibR4zyOM31p5Sdr2v4g==", - "requires": { - "iterall": "^1.3.0" - } - }, - "graphql-tag": { - "version": "2.12.6", - "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", - "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", - "requires": { - "tslib": "^2.1.0" - } - }, - "graphql-tools": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/graphql-tools/-/graphql-tools-4.0.8.tgz", - "integrity": "sha512-MW+ioleBrwhRjalKjYaLQbr+920pHBgy9vM/n47sswtns8+96sRn5M/G+J1eu7IMeKWiN/9p6tmwCHU7552VJg==", - "requires": { - "apollo-link": "^1.2.14", - "apollo-utilities": "^1.0.1", - "deprecated-decorator": "^0.1.6", - "iterall": "^1.1.3", - "uuid": "^3.1.0" - }, - "dependencies": { - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - } - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==" - }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "requires": { - "has-symbols": "^1.0.2" - } - }, - "http-errors": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", - "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" - }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "requires": { - "has-bigints": "^1.0.1" - } - }, - "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" - }, - "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==" - }, - "is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" - }, - "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==" - }, - "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "requires": { - "has-symbols": "^1.0.2" - } - }, - "is-weakref": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", - "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", - "requires": { - "call-bind": "^1.0.0" - } - }, - "iterall": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", - "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==" - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" - }, - "loglevel": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz", - "integrity": "sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==" - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "lowdb": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz", - "integrity": "sha512-2+x8esE/Wb9SQ1F9IHaYWfsC9FIecLOPrK4g17FGEayjUWH172H6nwicRovGvSE2CPZouc2MCIqCI7h9d+GftQ==", - "requires": { - "graceful-fs": "^4.1.3", - "is-promise": "^2.1.0", - "lodash": "4", - "pify": "^3.0.0", - "steno": "^0.4.1" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, - "mime-db": { - "version": "1.50.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz", - "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==" - }, - "mime-types": { - "version": "2.1.33", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz", - "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==", - "requires": { - "mime-db": "1.50.0" - } - }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, - "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==" - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" - }, - "object-path": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.8.tgz", - "integrity": "sha512-YJjNZrlXJFM42wTBn6zgOJVar9KFJvzx6sTWDte8sWZF//cnjl0BxHNpfZx+ZffXX63A9q0b1zsFiBX4g4X5KA==" - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.3.tgz", - "integrity": "sha512-VdDoCwvJI4QdC6ndjpqFmoL3/+HxffFBbcJzKi5hwLLqqx3mdbedRpfZDdK0SrOSauj8X4GzBvnDZl4vTN7dOw==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - }, - "promises-all": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/promises-all/-/promises-all-1.0.0.tgz", - "integrity": "sha1-pDGMuNRWifZzkE4hVg8DI5cCgg8=", - "requires": { - "bluebird": "^3.4.7" - } - }, - "proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "dependencies": { - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - } - } - }, - "retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==" - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - } - } - }, - "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - } - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shortid": { - "version": "2.2.15", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.15.tgz", - "integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==", - "requires": { - "nanoid": "^2.1.0" - } - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "steno": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/steno/-/steno-0.4.4.tgz", - "integrity": "sha1-BxEFvfwobmYVwEA8J+nXtdy4Vcs=", - "requires": { - "graceful-fs": "^4.1.3" - } - }, - "stoppable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", - "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==" - }, - "streamsearch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" - }, - "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "subscriptions-transport-ws": { - "version": "0.9.19", - "resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.19.tgz", - "integrity": "sha512-dxdemxFFB0ppCLg10FTtRqH/31FNRL1y1BQv8209MK5I4CwALb7iihQg+7p65lFcIl8MHatINWBLOqpgU4Kyyw==", - "requires": { - "backo2": "^1.0.2", - "eventemitter3": "^3.1.0", - "iterall": "^1.2.1", - "symbol-observable": "^1.0.4", - "ws": "^5.2.0 || ^6.0.0 || ^7.0.0" - } - }, - "symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" - }, - "ts-invariant": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", - "integrity": "sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA==", - "requires": { - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", - "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "util.promisify": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.1.1.tgz", - "integrity": "sha512-/s3UsZUrIfa6xDhr7zZhnE9SLQ5RIXyYfiVnMMyMDzOc8WhWN4Nbh36H842OyurKbCDAesZOJaVyvmSl6fhGQw==", - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "for-each": "^0.3.3", - "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.1" - } - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, - "ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==" - }, - "xss": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.10.tgz", - "integrity": "sha512-qmoqrRksmzqSKvgqzN0055UFWY7OKx1/9JWeRswwEVX9fCG5jcYRxa/A2DHcmZX6VJvjzHRQ2STeeVcQkrmLSw==", - "requires": { - "commander": "^2.20.3", - "cssfilter": "0.0.10" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "zen-observable": { - "version": "0.8.15", - "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", - "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" - }, - "zen-observable-ts": { - "version": "0.8.21", - "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz", - "integrity": "sha512-Yj3yXweRc8LdRMrCC8nIc4kkjWecPAUVh0TI0OUrWXx6aX790vLcDlWca6I4vsyCGH3LpWxq0dJRcMOFoVqmeg==", - "requires": { - "tslib": "^1.9.3", - "zen-observable": "^0.8.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - } - } -} diff --git a/SimpleUploadServer/package.json b/SimpleUploadServer/package.json deleted file mode 100644 index 5c6a5f40ad..0000000000 --- a/SimpleUploadServer/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "uploads", - "version": "1.0.0", - "description": "", - "main": "index.js", - "dependencies": { - "apollo-server": "^2.16.1", - "graphql": "^14.7.0", - "lowdb": "^1.0.0", - "mkdirp": "^0.5.5", - "promises-all": "^1.0.0", - "shortid": "^2.2.15" - }, - "devDependencies": {}, - "scripts": { - "start": "node index.js" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Package.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Package.swift deleted file mode 100644 index d65c7955e4..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Package.swift +++ /dev/null @@ -1,37 +0,0 @@ -// swift-tools-version:5.7 - -import PackageDescription - -let package = Package( - name: "AnimalKingdomAPI", - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - products: [ - .library(name: "AnimalKingdomAPI", targets: ["AnimalKingdomAPI"]), - .library(name: "AnimalKingdomAPITestMocks", targets: ["AnimalKingdomAPITestMocks"]), - ], - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - targets: [ - .target( - name: "AnimalKingdomAPI", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - .target( - name: "AnimalKingdomAPITestMocks", - dependencies: [ - .product(name: "ApolloTestSupport", package: "apollo-ios"), - .target(name: "AnimalKingdomAPI"), - ], - path: "./TestMocks" - ), - ] -) diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/ClassroomPetDetails.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/ClassroomPetDetails.graphql.swift deleted file mode 100644 index b59fb9378f..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/ClassroomPetDetails.graphql.swift +++ /dev/null @@ -1,269 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct ClassroomPetDetails: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment ClassroomPetDetails on ClassroomPet { __typename ... on Animal { species } ... on Pet { humanName } ... on WarmBlooded { laysEggs } ... on Cat { bodyTemperature isJellicle } ... on Bird { wingspan } ... on PetRock { favoriteToy } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Unions.ClassroomPet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsAnimal.self), - .inlineFragment(AsPet.self), - .inlineFragment(AsWarmBlooded.self), - .inlineFragment(AsCat.self), - .inlineFragment(AsBird.self), - .inlineFragment(AsPetRock.self), - ] } - - public var asAnimal: AsAnimal? { _asInlineFragment() } - public var asPet: AsPet? { _asInlineFragment() } - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - public var asCat: AsCat? { _asInlineFragment() } - public var asBird: AsBird? { _asInlineFragment() } - public var asPetRock: AsPetRock? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self) - ] - )) - } - - /// AsAnimal - /// - /// Parent Type: `Animal` - public struct AsAnimal: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetails - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("species", String.self), - ] } - - public var species: String { __data["species"] } - - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self) - ] - )) - } - } - - /// AsPet - /// - /// Parent Type: `Pet` - public struct AsPet: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetails - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("humanName", String?.self), - ] } - - public var humanName: String? { __data["humanName"] } - - public init( - __typename: String, - humanName: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "humanName": humanName, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self) - ] - )) - } - } - - /// AsWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetails - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .field("laysEggs", Bool.self), - ] } - - public var laysEggs: Bool { __data["laysEggs"] } - public var species: String { __data["species"] } - - public init( - __typename: String, - laysEggs: Bool, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "laysEggs": laysEggs, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsWarmBlooded.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self) - ] - )) - } - } - - /// AsCat - /// - /// Parent Type: `Cat` - public struct AsCat: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetails - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Cat } - public static var __selections: [ApolloAPI.Selection] { [ - .field("bodyTemperature", Int.self), - .field("isJellicle", Bool.self), - ] } - - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var isJellicle: Bool { __data["isJellicle"] } - public var species: String { __data["species"] } - public var humanName: String? { __data["humanName"] } - public var laysEggs: Bool { __data["laysEggs"] } - - public init( - bodyTemperature: Int, - isJellicle: Bool, - species: String, - humanName: String? = nil, - laysEggs: Bool - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Cat.typename, - "bodyTemperature": bodyTemperature, - "isJellicle": isJellicle, - "species": species, - "humanName": humanName, - "laysEggs": laysEggs, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsCat.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self), - ObjectIdentifier(ClassroomPetDetails.AsWarmBlooded.self) - ] - )) - } - } - - /// AsBird - /// - /// Parent Type: `Bird` - public struct AsBird: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetails - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Bird } - public static var __selections: [ApolloAPI.Selection] { [ - .field("wingspan", Double.self), - ] } - - public var wingspan: Double { __data["wingspan"] } - public var species: String { __data["species"] } - public var humanName: String? { __data["humanName"] } - public var laysEggs: Bool { __data["laysEggs"] } - - public init( - wingspan: Double, - species: String, - humanName: String? = nil, - laysEggs: Bool - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Bird.typename, - "wingspan": wingspan, - "species": species, - "humanName": humanName, - "laysEggs": laysEggs, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsBird.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self), - ObjectIdentifier(ClassroomPetDetails.AsWarmBlooded.self) - ] - )) - } - } - - /// AsPetRock - /// - /// Parent Type: `PetRock` - public struct AsPetRock: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetails - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.PetRock } - public static var __selections: [ApolloAPI.Selection] { [ - .field("favoriteToy", String.self), - ] } - - public var favoriteToy: String { __data["favoriteToy"] } - public var humanName: String? { __data["humanName"] } - - public init( - favoriteToy: String, - humanName: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.PetRock.typename, - "favoriteToy": favoriteToy, - "humanName": humanName, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsPetRock.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self) - ] - )) - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/ClassroomPetDetailsCCN.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/ClassroomPetDetailsCCN.graphql.swift deleted file mode 100644 index d449cea199..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/ClassroomPetDetailsCCN.graphql.swift +++ /dev/null @@ -1,96 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct ClassroomPetDetailsCCN: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment ClassroomPetDetailsCCN on ClassroomPet { __typename ... on Animal { height { __typename inches! } } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Unions.ClassroomPet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsAnimal.self), - ] } - - public var asAnimal: AsAnimal? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetailsCCN.self) - ] - )) - } - - /// AsAnimal - /// - /// Parent Type: `Animal` - public struct AsAnimal: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetDetailsCCN - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Height.self), - ] } - - public var height: Height { __data["height"] } - - public init( - __typename: String, - height: Height - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetailsCCN.self), - ObjectIdentifier(ClassroomPetDetailsCCN.AsAnimal.self) - ] - )) - } - - /// AsAnimal.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("inches", Int.self), - ] } - - public var inches: Int { __data["inches"] } - - public init( - inches: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "inches": inches, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetDetailsCCN.AsAnimal.Height.self) - ] - )) - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/CrocodileFragment.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/CrocodileFragment.graphql.swift deleted file mode 100644 index 5634292260..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/CrocodileFragment.graphql.swift +++ /dev/null @@ -1,43 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CrocodileFragment: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CrocodileFragment on Crocodile { __typename species age tag(id: "albino") }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Crocodile } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("species", String.self), - .field("age", Int.self), - .field("tag", String?.self, arguments: ["id": "albino"]), - ] } - - public var species: String { __data["species"] } - public var age: Int { __data["age"] } - public var tag: String? { __data["tag"] } - - public init( - species: String, - age: Int, - tag: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Crocodile.typename, - "species": species, - "age": age, - "tag": tag, - ], - fulfilledFragments: [ - ObjectIdentifier(CrocodileFragment.self) - ] - )) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/DogFragment.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/DogFragment.graphql.swift deleted file mode 100644 index a8a4d8636a..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/DogFragment.graphql.swift +++ /dev/null @@ -1,35 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct DogFragment: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment DogFragment on Dog { __typename species }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Dog } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("species", String.self), - ] } - - public var species: String { __data["species"] } - - public init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Dog.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(DogFragment.self) - ] - )) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/HeightInMeters.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/HeightInMeters.graphql.swift deleted file mode 100644 index 2b449eeee2..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/HeightInMeters.graphql.swift +++ /dev/null @@ -1,66 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct HeightInMeters: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment HeightInMeters on Animal { __typename height { __typename meters } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("height", Height.self), - ] } - - public var height: Height { __data["height"] } - - public init( - __typename: String, - height: Height - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("meters", Int.self), - ] } - - public var meters: Int { __data["meters"] } - - public init( - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/PetDetails.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/PetDetails.graphql.swift deleted file mode 100644 index fa42bc8444..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/PetDetails.graphql.swift +++ /dev/null @@ -1,74 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct PetDetails: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment PetDetails on Pet { __typename humanName favoriteToy owner { __typename firstName } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("humanName", String?.self), - .field("favoriteToy", String.self), - .field("owner", Owner?.self), - ] } - - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: Owner? { __data["owner"] } - - public init( - __typename: String, - humanName: String? = nil, - favoriteToy: String, - owner: Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(PetDetails.self) - ] - )) - } - - /// Owner - /// - /// Parent Type: `Human` - public struct Owner: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("firstName", String.self), - ] } - - public var firstName: String { __data["firstName"] } - - public init( - firstName: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Human.typename, - "firstName": firstName, - ], - fulfilledFragments: [ - ObjectIdentifier(PetDetails.Owner.self) - ] - )) - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/WarmBloodedDetails.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/WarmBloodedDetails.graphql.swift deleted file mode 100644 index aaa52c994b..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Fragments/WarmBloodedDetails.graphql.swift +++ /dev/null @@ -1,48 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct WarmBloodedDetails: AnimalKingdomAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment WarmBloodedDetails on WarmBlooded { __typename bodyTemperature ...HeightInMeters }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("bodyTemperature", Int.self), - .fragment(HeightInMeters.self), - ] } - - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var height: HeightInMeters.Height { __data["height"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - bodyTemperature: Int, - height: HeightInMeters.Height - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "bodyTemperature": bodyTemperature, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift deleted file mode 100644 index 8f33cbf447..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift +++ /dev/null @@ -1,132 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class AllAnimalsLocalCacheMutation: LocalCacheMutation { - public static let operationType: GraphQLOperationType = .query - - public init() {} - - public struct Data: AnimalKingdomAPI.MutableSelectionSet { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal].self), - ] } - - public var allAnimals: [AllAnimal] { - get { __data["allAnimals"] } - set { __data["allAnimals"] = newValue } - } - - public init( - allAnimals: [AllAnimal] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "allAnimals": allAnimals._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsLocalCacheMutation.Data.self) - ] - )) - } - - /// AllAnimal - /// - /// Parent Type: `Animal` - public struct AllAnimal: AnimalKingdomAPI.MutableSelectionSet { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("species", String.self), - .field("skinCovering", GraphQLEnum?.self), - .inlineFragment(AsBird.self), - ] } - - public var species: String { - get { __data["species"] } - set { __data["species"] = newValue } - } - public var skinCovering: GraphQLEnum? { - get { __data["skinCovering"] } - set { __data["skinCovering"] = newValue } - } - - public var asBird: AsBird? { - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - - public init( - __typename: String, - species: String, - skinCovering: GraphQLEnum? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - "skinCovering": skinCovering, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsLocalCacheMutation.Data.AllAnimal.self) - ] - )) - } - - /// AllAnimal.AsBird - /// - /// Parent Type: `Bird` - public struct AsBird: AnimalKingdomAPI.MutableInlineFragment { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsLocalCacheMutation.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Bird } - public static var __selections: [ApolloAPI.Selection] { [ - .field("wingspan", Double.self), - ] } - - public var wingspan: Double { - get { __data["wingspan"] } - set { __data["wingspan"] = newValue } - } - public var species: String { - get { __data["species"] } - set { __data["species"] = newValue } - } - public var skinCovering: GraphQLEnum? { - get { __data["skinCovering"] } - set { __data["skinCovering"] = newValue } - } - - public init( - wingspan: Double, - species: String, - skinCovering: GraphQLEnum? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Bird.typename, - "wingspan": wingspan, - "species": species, - "skinCovering": skinCovering, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsLocalCacheMutation.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsLocalCacheMutation.Data.AllAnimal.AsBird.self) - ] - )) - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/PetDetailsMutation.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/PetDetailsMutation.graphql.swift deleted file mode 100644 index ea4b22664b..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/PetDetailsMutation.graphql.swift +++ /dev/null @@ -1,72 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct PetDetailsMutation: AnimalKingdomAPI.MutableSelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment PetDetailsMutation on Pet { __typename owner { __typename firstName } }"# - } - - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("owner", Owner?.self), - ] } - - public var owner: Owner? { - get { __data["owner"] } - set { __data["owner"] = newValue } - } - - public init( - __typename: String, - owner: Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(PetDetailsMutation.self) - ] - )) - } - - /// Owner - /// - /// Parent Type: `Human` - public struct Owner: AnimalKingdomAPI.MutableSelectionSet { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("firstName", String.self), - ] } - - public var firstName: String { - get { __data["firstName"] } - set { __data["firstName"] = newValue } - } - - public init( - firstName: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Human.typename, - "firstName": firstName, - ], - fulfilledFragments: [ - ObjectIdentifier(PetDetailsMutation.Owner.self) - ] - )) - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift deleted file mode 100644 index f11ffcef5c..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift +++ /dev/null @@ -1,97 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class PetSearchLocalCacheMutation: LocalCacheMutation { - public static let operationType: GraphQLOperationType = .query - - public var filters: GraphQLNullable - - public init(filters: GraphQLNullable = .init( - PetSearchFilters( - species: ["Dog", "Cat"], - size: .init(.small), - measurements: .init( - MeasurementsInput( - height: 10.5, - weight: 5.0 - ) - ) - ) - )) { - self.filters = filters - } - - public var __variables: GraphQLOperation.Variables? { ["filters": filters] } - - public struct Data: AnimalKingdomAPI.MutableSelectionSet { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("pets", [Pet].self, arguments: ["filters": .variable("filters")]), - ] } - - public var pets: [Pet] { - get { __data["pets"] } - set { __data["pets"] = newValue } - } - - public init( - pets: [Pet] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "pets": pets._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(PetSearchLocalCacheMutation.Data.self) - ] - )) - } - - /// Pet - /// - /// Parent Type: `Pet` - public struct Pet: AnimalKingdomAPI.MutableSelectionSet { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", AnimalKingdomAPI.ID.self), - .field("humanName", String?.self), - ] } - - public var id: AnimalKingdomAPI.ID { - get { __data["id"] } - set { __data["id"] = newValue } - } - public var humanName: String? { - get { __data["humanName"] } - set { __data["humanName"] = newValue } - } - - public init( - __typename: String, - id: AnimalKingdomAPI.ID, - humanName: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "humanName": humanName, - ], - fulfilledFragments: [ - ObjectIdentifier(PetSearchLocalCacheMutation.Data.Pet.self) - ] - )) - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Mutations/PetAdoptionMutation.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Mutations/PetAdoptionMutation.graphql.swift deleted file mode 100644 index 69295b24c3..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Mutations/PetAdoptionMutation.graphql.swift +++ /dev/null @@ -1,81 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class PetAdoptionMutation: GraphQLMutation { - public static let operationName: String = "PetAdoptionMutation" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"mutation PetAdoptionMutation($input: PetAdoptionInput!) { adoptPet(input: $input) { __typename id humanName } }"# - )) - - public var input: PetAdoptionInput - - public init(input: PetAdoptionInput) { - self.input = input - } - - public var __variables: Variables? { ["input": input] } - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("adoptPet", AdoptPet.self, arguments: ["input": .variable("input")]), - ] } - - public var adoptPet: AdoptPet { __data["adoptPet"] } - - public init( - adoptPet: AdoptPet - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Mutation.typename, - "adoptPet": adoptPet._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(PetAdoptionMutation.Data.self) - ] - )) - } - - /// AdoptPet - /// - /// Parent Type: `Pet` - public struct AdoptPet: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", AnimalKingdomAPI.ID.self), - .field("humanName", String?.self), - ] } - - public var id: AnimalKingdomAPI.ID { __data["id"] } - public var humanName: String? { __data["humanName"] } - - public init( - __typename: String, - id: AnimalKingdomAPI.ID, - humanName: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "humanName": humanName, - ], - fulfilledFragments: [ - ObjectIdentifier(PetAdoptionMutation.Data.AdoptPet.self) - ] - )) - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsCCNQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsCCNQuery.graphql.swift deleted file mode 100644 index ae791edd10..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsCCNQuery.graphql.swift +++ /dev/null @@ -1,105 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class AllAnimalsCCNQuery: GraphQLQuery { - public static let operationName: String = "AllAnimalsCCN" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query AllAnimalsCCN { allAnimals { __typename height? { __typename feet? inches! } } }"# - )) - - public init() {} - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal].self), - ] } - - public var allAnimals: [AllAnimal] { __data["allAnimals"] } - - public init( - allAnimals: [AllAnimal] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "allAnimals": allAnimals._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsCCNQuery.Data.self) - ] - )) - } - - /// AllAnimal - /// - /// Parent Type: `Animal` - public struct AllAnimal: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("height", Height?.self), - ] } - - public var height: Height? { __data["height"] } - - public init( - __typename: String, - height: Height? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsCCNQuery.Data.AllAnimal.self) - ] - )) - } - - /// AllAnimal.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("feet", Int?.self), - .field("inches", Int.self), - ] } - - public var feet: Int? { __data["feet"] } - public var inches: Int { __data["inches"] } - - public init( - feet: Int? = nil, - inches: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsCCNQuery.Data.AllAnimal.Height.self) - ] - )) - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift deleted file mode 100644 index b8e9d947af..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift +++ /dev/null @@ -1,904 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class AllAnimalsIncludeSkipQuery: GraphQLQuery { - public static let operationName: String = "AllAnimalsIncludeSkipQuery" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query AllAnimalsIncludeSkipQuery($includeSpecies: Boolean!, $skipHeightInMeters: Boolean!, $getCat: Boolean!, $getWarmBlooded: Boolean!, $varA: Boolean!) { allAnimals { __typename height { __typename feet inches } ...HeightInMeters @skip(if: $skipHeightInMeters) ...WarmBloodedDetails @include(if: $getWarmBlooded) species @include(if: $includeSpecies) skinCovering ... on Pet { ...PetDetails ...WarmBloodedDetails ... on Animal { height { __typename relativeSize @include(if: $varA) centimeters @include(if: $varA) } } } ... on Cat @include(if: $getCat) { isJellicle } ... on ClassroomPet { ... on Bird { wingspan } } predators { __typename species @include(if: $includeSpecies) ... on WarmBlooded @include(if: $getWarmBlooded) { species ...WarmBloodedDetails laysEggs @include(if: $getWarmBlooded) } } } }"#, - fragments: [HeightInMeters.self, WarmBloodedDetails.self, PetDetails.self] - )) - - public var includeSpecies: Bool - public var skipHeightInMeters: Bool - public var getCat: Bool - public var getWarmBlooded: Bool - public var varA: Bool - - public init( - includeSpecies: Bool, - skipHeightInMeters: Bool, - getCat: Bool, - getWarmBlooded: Bool, - varA: Bool - ) { - self.includeSpecies = includeSpecies - self.skipHeightInMeters = skipHeightInMeters - self.getCat = getCat - self.getWarmBlooded = getWarmBlooded - self.varA = varA - } - - public var __variables: Variables? { [ - "includeSpecies": includeSpecies, - "skipHeightInMeters": skipHeightInMeters, - "getCat": getCat, - "getWarmBlooded": getWarmBlooded, - "varA": varA - ] } - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal].self), - ] } - - public var allAnimals: [AllAnimal] { __data["allAnimals"] } - - public init( - allAnimals: [AllAnimal] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "allAnimals": allAnimals._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.self) - ] - )) - } - - /// AllAnimal - /// - /// Parent Type: `Animal` - public struct AllAnimal: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("height", Height.self), - .field("skinCovering", GraphQLEnum?.self), - .field("predators", [Predator].self), - .inlineFragment(AsPet.self), - .inlineFragment(AsClassroomPet.self), - .include(if: "includeSpecies", .field("species", String.self)), - .include(if: !"skipHeightInMeters", .inlineFragment(IfNotSkipHeightInMeters.self)), - .include(if: "getWarmBlooded", .inlineFragment(AsWarmBloodedIfGetWarmBlooded.self)), - .include(if: "getCat", .inlineFragment(AsCatIfGetCat.self)), - ] } - - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - - public var ifNotSkipHeightInMeters: IfNotSkipHeightInMeters? { _asInlineFragment() } - public var asWarmBloodedIfGetWarmBlooded: AsWarmBloodedIfGetWarmBlooded? { _asInlineFragment() } - public var asPet: AsPet? { _asInlineFragment() } - public var asCatIfGetCat: AsCatIfGetCat? { _asInlineFragment() } - public var asClassroomPet: AsClassroomPet? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters? { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self) - ] - )) - } - - /// AllAnimal.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("feet", Int.self), - .field("inches", Int?.self), - ] } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - - public init( - feet: Int, - inches: Int? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self) - ] - )) - } - } - - /// AllAnimal.Predator - /// - /// Parent Type: `Animal` - public struct Predator: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "includeSpecies", .field("species", String.self)), - .include(if: "getWarmBlooded", .inlineFragment(AsWarmBloodedIfGetWarmBlooded.self)), - ] } - - public var species: String? { __data["species"] } - - public var asWarmBloodedIfGetWarmBlooded: AsWarmBloodedIfGetWarmBlooded? { _asInlineFragment() } - - public init( - __typename: String, - species: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Predator.self) - ] - )) - } - - /// AllAnimal.Predator.AsWarmBloodedIfGetWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBloodedIfGetWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal.Predator - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .field("species", String.self), - .fragment(WarmBloodedDetails.self), - .field("laysEggs", Bool.self), - ] } - - public var species: String { __data["species"] } - public var laysEggs: Bool { __data["laysEggs"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var height: HeightInMeters.Height { __data["height"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - species: String, - laysEggs: Bool, - bodyTemperature: Int, - height: HeightInMeters.Height - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - "laysEggs": laysEggs, - "bodyTemperature": bodyTemperature, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Predator.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Predator.AsWarmBloodedIfGetWarmBlooded.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - } - } - - /// AllAnimal.IfNotSkipHeightInMeters - /// - /// Parent Type: `Animal` - public struct IfNotSkipHeightInMeters: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(HeightInMeters.self), - ] } - - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.IfNotSkipHeightInMeters.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.IfNotSkipHeightInMeters.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.IfNotSkipHeightInMeters.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - } - - /// AllAnimal.AsWarmBloodedIfGetWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBloodedIfGetWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(WarmBloodedDetails.self), - ] } - - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - bodyTemperature: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "bodyTemperature": bodyTemperature, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsWarmBloodedIfGetWarmBlooded.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.AsWarmBloodedIfGetWarmBlooded.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsWarmBloodedIfGetWarmBlooded.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - } - - /// AllAnimal.AsPet - /// - /// Parent Type: `Pet` - public struct AsPet: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Height.self), - .inlineFragment(AsWarmBlooded.self), - .fragment(PetDetails.self), - ] } - - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var petDetails: PetDetails { _toFragment() } - public var heightInMeters: HeightInMeters? { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(PetDetails.self) - ] - )) - } - - /// AllAnimal.AsPet.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "varA", [ - .field("relativeSize", GraphQLEnum.self), - .field("centimeters", Double.self), - ]), - ] } - - public var relativeSize: GraphQLEnum? { __data["relativeSize"] } - public var centimeters: Double? { __data["centimeters"] } - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - - public init( - relativeSize: GraphQLEnum? = nil, - centimeters: Double? = nil, - feet: Int, - inches: Int? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "relativeSize": relativeSize, - "centimeters": centimeters, - "feet": feet, - "inches": inches, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self) - ] - )) - } - } - - /// AllAnimal.AsPet.AsWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(WarmBloodedDetails.self), - ] } - - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil, - bodyTemperature: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - "bodyTemperature": bodyTemperature, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self), - ObjectIdentifier(PetDetails.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.AsPet.AsWarmBlooded.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var relativeSize: GraphQLEnum? { __data["relativeSize"] } - public var centimeters: Double? { __data["centimeters"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - relativeSize: GraphQLEnum? = nil, - centimeters: Double? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "relativeSize": relativeSize, - "centimeters": centimeters, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.AsWarmBlooded.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - } - } - - /// AllAnimal.AsCatIfGetCat - /// - /// Parent Type: `Cat` - public struct AsCatIfGetCat: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Cat } - public static var __selections: [ApolloAPI.Selection] { [ - .field("isJellicle", Bool.self), - ] } - - public var isJellicle: Bool { __data["isJellicle"] } - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - } - - public init( - isJellicle: Bool, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil, - bodyTemperature: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Cat.typename, - "isJellicle": isJellicle, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - "bodyTemperature": bodyTemperature, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsCatIfGetCat.self), - ObjectIdentifier(PetDetails.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.AsCatIfGetCat.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var relativeSize: GraphQLEnum? { __data["relativeSize"] } - public var centimeters: Double? { __data["centimeters"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - relativeSize: GraphQLEnum? = nil, - centimeters: Double? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "relativeSize": relativeSize, - "centimeters": centimeters, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsCatIfGetCat.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - } - - /// AllAnimal.AsClassroomPet - /// - /// Parent Type: `ClassroomPet` - public struct AsClassroomPet: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Unions.ClassroomPet } - public static var __selections: [ApolloAPI.Selection] { [ - .inlineFragment(AsBird.self), - ] } - - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - - public var asBird: AsBird? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters? { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsClassroomPet.self) - ] - )) - } - - /// AllAnimal.AsClassroomPet.AsBird - /// - /// Parent Type: `Bird` - public struct AsBird: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsIncludeSkipQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Bird } - public static var __selections: [ApolloAPI.Selection] { [ - .field("wingspan", Double.self), - ] } - - public var wingspan: Double { __data["wingspan"] } - public var height: Height { __data["height"] } - public var species: String? { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - } - - public init( - wingspan: Double, - height: Height, - species: String? = nil, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil, - bodyTemperature: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Bird.typename, - "wingspan": wingspan, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - "bodyTemperature": bodyTemperature, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsClassroomPet.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsClassroomPet.AsBird.self), - ObjectIdentifier(PetDetails.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.AsClassroomPet.AsBird.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var relativeSize: GraphQLEnum? { __data["relativeSize"] } - public var centimeters: Double? { __data["centimeters"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - relativeSize: GraphQLEnum? = nil, - centimeters: Double? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "relativeSize": relativeSize, - "centimeters": centimeters, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsClassroomPet.AsBird.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(AllAnimalsIncludeSkipQuery.Data.AllAnimal.AsPet.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsQuery.graphql.swift deleted file mode 100644 index cd6cbaabed..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/AllAnimalsQuery.graphql.swift +++ /dev/null @@ -1,985 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class AllAnimalsQuery: GraphQLQuery { - public static let operationName: String = "AllAnimalsQuery" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query AllAnimalsQuery { allAnimals { __typename height { __typename feet inches } ...HeightInMeters ...WarmBloodedDetails species skinCovering ... on Pet { ...PetDetails ...WarmBloodedDetails ... on Animal { height { __typename relativeSize centimeters } } } ... on Cat { isJellicle } ... on ClassroomPet { ... on Bird { wingspan } } ... on Dog { favoriteToy birthdate } predators { __typename species ... on WarmBlooded { predators { __typename species } ...WarmBloodedDetails laysEggs } } } }"#, - fragments: [HeightInMeters.self, WarmBloodedDetails.self, PetDetails.self] - )) - - public init() {} - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal].self), - ] } - - public var allAnimals: [AllAnimal] { __data["allAnimals"] } - - public init( - allAnimals: [AllAnimal] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "allAnimals": allAnimals._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.self) - ] - )) - } - - /// AllAnimal - /// - /// Parent Type: `Animal` - public struct AllAnimal: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("height", Height.self), - .field("species", String.self), - .field("skinCovering", GraphQLEnum?.self), - .field("predators", [Predator].self), - .inlineFragment(AsWarmBlooded.self), - .inlineFragment(AsPet.self), - .inlineFragment(AsCat.self), - .inlineFragment(AsClassroomPet.self), - .inlineFragment(AsDog.self), - .fragment(HeightInMeters.self), - ] } - - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - public var asPet: AsPet? { _asInlineFragment() } - public var asCat: AsCat? { _asInlineFragment() } - public var asClassroomPet: AsClassroomPet? { _asInlineFragment() } - public var asDog: AsDog? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self) - ] - )) - } - - /// AllAnimal.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("feet", Int.self), - .field("inches", Int?.self), - ] } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - - /// AllAnimal.Predator - /// - /// Parent Type: `Animal` - public struct Predator: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("species", String.self), - .inlineFragment(AsWarmBlooded.self), - ] } - - public var species: String { __data["species"] } - - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Predator.self) - ] - )) - } - - /// AllAnimal.Predator.AsWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal.Predator - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .field("predators", [Predator].self), - .field("laysEggs", Bool.self), - .fragment(WarmBloodedDetails.self), - ] } - - public var predators: [Predator] { __data["predators"] } - public var laysEggs: Bool { __data["laysEggs"] } - public var species: String { __data["species"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var height: HeightInMeters.Height { __data["height"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - predators: [Predator], - laysEggs: Bool, - species: String, - bodyTemperature: Int, - height: HeightInMeters.Height - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "predators": predators._fieldData, - "laysEggs": laysEggs, - "species": species, - "bodyTemperature": bodyTemperature, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Predator.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Predator.AsWarmBlooded.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.Predator.AsWarmBlooded.Predator - /// - /// Parent Type: `Animal` - public struct Predator: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("species", String.self), - ] } - - public var species: String { __data["species"] } - - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Predator.AsWarmBlooded.Predator.self) - ] - )) - } - } - } - } - - /// AllAnimal.AsWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(WarmBloodedDetails.self), - ] } - - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - bodyTemperature: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "bodyTemperature": bodyTemperature, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsWarmBlooded.self), - ObjectIdentifier(HeightInMeters.self), - ObjectIdentifier(WarmBloodedDetails.self) - ] - )) - } - - /// AllAnimal.AsWarmBlooded.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsWarmBlooded.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - } - - /// AllAnimal.AsPet - /// - /// Parent Type: `Pet` - public struct AsPet: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Height.self), - .inlineFragment(AsWarmBlooded.self), - .fragment(PetDetails.self), - ] } - - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var petDetails: PetDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(PetDetails.self) - ] - )) - } - - /// AllAnimal.AsPet.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("relativeSize", GraphQLEnum.self), - .field("centimeters", Double.self), - ] } - - public var relativeSize: GraphQLEnum { __data["relativeSize"] } - public var centimeters: Double { __data["centimeters"] } - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - - public init( - relativeSize: GraphQLEnum, - centimeters: Double, - feet: Int, - inches: Int? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "relativeSize": relativeSize, - "centimeters": centimeters, - "feet": feet, - "inches": inches, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - - /// AllAnimal.AsPet.AsWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBlooded: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(WarmBloodedDetails.self), - ] } - - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - bodyTemperature: Int, - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "bodyTemperature": bodyTemperature, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self), - ObjectIdentifier(HeightInMeters.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(PetDetails.self) - ] - )) - } - - /// AllAnimal.AsPet.AsWarmBlooded.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - public var relativeSize: GraphQLEnum { __data["relativeSize"] } - public var centimeters: Double { __data["centimeters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int, - relativeSize: GraphQLEnum, - centimeters: Double - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - "relativeSize": relativeSize, - "centimeters": centimeters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.AsWarmBlooded.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.Height.self) - ] - )) - } - } - } - } - - /// AllAnimal.AsCat - /// - /// Parent Type: `Cat` - public struct AsCat: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Cat } - public static var __selections: [ApolloAPI.Selection] { [ - .field("isJellicle", Bool.self), - ] } - - public var isJellicle: Bool { __data["isJellicle"] } - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - } - - public init( - isJellicle: Bool, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - bodyTemperature: Int, - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Cat.typename, - "isJellicle": isJellicle, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "bodyTemperature": bodyTemperature, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsCat.self), - ObjectIdentifier(HeightInMeters.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsWarmBlooded.self), - ObjectIdentifier(PetDetails.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self) - ] - )) - } - - /// AllAnimal.AsCat.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - public var relativeSize: GraphQLEnum { __data["relativeSize"] } - public var centimeters: Double { __data["centimeters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int, - relativeSize: GraphQLEnum, - centimeters: Double - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - "relativeSize": relativeSize, - "centimeters": centimeters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsCat.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.Height.self) - ] - )) - } - } - } - - /// AllAnimal.AsClassroomPet - /// - /// Parent Type: `ClassroomPet` - public struct AsClassroomPet: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Unions.ClassroomPet } - public static var __selections: [ApolloAPI.Selection] { [ - .inlineFragment(AsBird.self), - ] } - - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - - public var asBird: AsBird? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - } - - public init( - __typename: String, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsClassroomPet.self), - ObjectIdentifier(HeightInMeters.self) - ] - )) - } - - /// AllAnimal.AsClassroomPet.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsClassroomPet.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self) - ] - )) - } - } - - /// AllAnimal.AsClassroomPet.AsBird - /// - /// Parent Type: `Bird` - public struct AsBird: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Bird } - public static var __selections: [ApolloAPI.Selection] { [ - .field("wingspan", Double.self), - ] } - - public var wingspan: Double { __data["wingspan"] } - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - public var owner: PetDetails.Owner? { __data["owner"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - } - - public init( - wingspan: Double, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - bodyTemperature: Int, - humanName: String? = nil, - favoriteToy: String, - owner: PetDetails.Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Bird.typename, - "wingspan": wingspan, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "bodyTemperature": bodyTemperature, - "humanName": humanName, - "favoriteToy": favoriteToy, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsClassroomPet.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsClassroomPet.AsBird.self), - ObjectIdentifier(HeightInMeters.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsWarmBlooded.self), - ObjectIdentifier(PetDetails.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self) - ] - )) - } - - /// AllAnimal.AsClassroomPet.AsBird.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - public var relativeSize: GraphQLEnum { __data["relativeSize"] } - public var centimeters: Double { __data["centimeters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int, - relativeSize: GraphQLEnum, - centimeters: Double - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - "relativeSize": relativeSize, - "centimeters": centimeters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsClassroomPet.AsBird.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.Height.self) - ] - )) - } - } - } - } - - /// AllAnimal.AsDog - /// - /// Parent Type: `Dog` - public struct AsDog: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AllAnimalsQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Dog } - public static var __selections: [ApolloAPI.Selection] { [ - .field("favoriteToy", String.self), - .field("birthdate", AnimalKingdomAPI.CustomDate?.self), - ] } - - public var favoriteToy: String { __data["favoriteToy"] } - public var birthdate: AnimalKingdomAPI.CustomDate? { __data["birthdate"] } - public var height: Height { __data["height"] } - public var species: String { __data["species"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var predators: [Predator] { __data["predators"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var humanName: String? { __data["humanName"] } - public var owner: PetDetails.Owner? { __data["owner"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heightInMeters: HeightInMeters { _toFragment() } - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var petDetails: PetDetails { _toFragment() } - } - - public init( - favoriteToy: String, - birthdate: AnimalKingdomAPI.CustomDate? = nil, - height: Height, - species: String, - skinCovering: GraphQLEnum? = nil, - predators: [Predator], - bodyTemperature: Int, - humanName: String? = nil, - owner: PetDetails.Owner? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Dog.typename, - "favoriteToy": favoriteToy, - "birthdate": birthdate, - "height": height._fieldData, - "species": species, - "skinCovering": skinCovering, - "predators": predators._fieldData, - "bodyTemperature": bodyTemperature, - "humanName": humanName, - "owner": owner._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsDog.self), - ObjectIdentifier(HeightInMeters.self), - ObjectIdentifier(WarmBloodedDetails.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsWarmBlooded.self), - ObjectIdentifier(PetDetails.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self) - ] - )) - } - - /// AllAnimal.AsDog.Height - /// - /// Parent Type: `Height` - public struct Height: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Height } - - public var feet: Int { __data["feet"] } - public var inches: Int? { __data["inches"] } - public var meters: Int { __data["meters"] } - public var relativeSize: GraphQLEnum { __data["relativeSize"] } - public var centimeters: Double { __data["centimeters"] } - - public init( - feet: Int, - inches: Int? = nil, - meters: Int, - relativeSize: GraphQLEnum, - centimeters: Double - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Height.typename, - "feet": feet, - "inches": inches, - "meters": meters, - "relativeSize": relativeSize, - "centimeters": centimeters, - ], - fulfilledFragments: [ - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsDog.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(HeightInMeters.Height.self), - ObjectIdentifier(AllAnimalsQuery.Data.AllAnimal.AsPet.Height.self) - ] - )) - } - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/ClassroomPetsCCNQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/ClassroomPetsCCNQuery.graphql.swift deleted file mode 100644 index c826ce719e..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/ClassroomPetsCCNQuery.graphql.swift +++ /dev/null @@ -1,119 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class ClassroomPetsCCNQuery: GraphQLQuery { - public static let operationName: String = "ClassroomPetsCCN" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query ClassroomPetsCCN { classroomPets[!]? { __typename ...ClassroomPetDetailsCCN } }"#, - fragments: [ClassroomPetDetailsCCN.self] - )) - - public init() {} - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("classroomPets", [ClassroomPet]?.self), - ] } - - public var classroomPets: [ClassroomPet]? { __data["classroomPets"] } - - public init( - classroomPets: [ClassroomPet]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "classroomPets": classroomPets._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsCCNQuery.Data.self) - ] - )) - } - - /// ClassroomPet - /// - /// Parent Type: `ClassroomPet` - public struct ClassroomPet: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Unions.ClassroomPet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(ClassroomPetDetailsCCN.self), - ] } - - public var asAnimal: AsAnimal? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetailsCCN: ClassroomPetDetailsCCN { _toFragment() } - } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsCCNQuery.Data.ClassroomPet.self) - ] - )) - } - - /// ClassroomPet.AsAnimal - /// - /// Parent Type: `Animal` - public struct AsAnimal: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsCCNQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsCCNQuery.Data.ClassroomPet.self, - ClassroomPetDetailsCCN.AsAnimal.self - ] } - - public var height: ClassroomPetDetailsCCN.AsAnimal.Height { __data["height"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetailsCCN: ClassroomPetDetailsCCN { _toFragment() } - } - - public init( - __typename: String, - height: ClassroomPetDetailsCCN.AsAnimal.Height - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "height": height._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsCCNQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsCCNQuery.Data.ClassroomPet.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetailsCCN.self), - ObjectIdentifier(ClassroomPetDetailsCCN.AsAnimal.self) - ] - )) - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/ClassroomPetsQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/ClassroomPetsQuery.graphql.swift deleted file mode 100644 index a3c5f18665..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/ClassroomPetsQuery.graphql.swift +++ /dev/null @@ -1,374 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class ClassroomPetsQuery: GraphQLQuery { - public static let operationName: String = "ClassroomPets" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query ClassroomPets { classroomPets { __typename ...ClassroomPetDetails } }"#, - fragments: [ClassroomPetDetails.self] - )) - - public init() {} - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("classroomPets", [ClassroomPet?]?.self), - ] } - - public var classroomPets: [ClassroomPet?]? { __data["classroomPets"] } - - public init( - classroomPets: [ClassroomPet?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "classroomPets": classroomPets._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.self) - ] - )) - } - - /// ClassroomPet - /// - /// Parent Type: `ClassroomPet` - public struct ClassroomPet: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Unions.ClassroomPet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(ClassroomPetDetails.self), - ] } - - public var asAnimal: AsAnimal? { _asInlineFragment() } - public var asPet: AsPet? { _asInlineFragment() } - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - public var asCat: AsCat? { _asInlineFragment() } - public var asBird: AsBird? { _asInlineFragment() } - public var asPetRock: AsPetRock? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self) - ] - )) - } - - /// ClassroomPet.AsAnimal - /// - /// Parent Type: `Animal` - public struct AsAnimal: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsQuery.Data.ClassroomPet.self, - ClassroomPetDetails.AsAnimal.self - ] } - - public var species: String { __data["species"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self) - ] - )) - } - } - - /// ClassroomPet.AsPet - /// - /// Parent Type: `Pet` - public struct AsPet: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsQuery.Data.ClassroomPet.self, - ClassroomPetDetails.AsPet.self - ] } - - public var humanName: String? { __data["humanName"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - __typename: String, - humanName: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "humanName": humanName, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.AsPet.self), - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self) - ] - )) - } - } - - /// ClassroomPet.AsWarmBlooded - /// - /// Parent Type: `WarmBlooded` - public struct AsWarmBlooded: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.WarmBlooded } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsQuery.Data.ClassroomPet.self, - ClassroomPetDetails.AsAnimal.self, - ClassroomPetDetails.AsWarmBlooded.self - ] } - - public var species: String { __data["species"] } - public var laysEggs: Bool { __data["laysEggs"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - __typename: String, - species: String, - laysEggs: Bool - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - "laysEggs": laysEggs, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.AsWarmBlooded.self), - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetails.AsWarmBlooded.self) - ] - )) - } - } - - /// ClassroomPet.AsCat - /// - /// Parent Type: `Cat` - public struct AsCat: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Cat } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsQuery.Data.ClassroomPet.self, - ClassroomPetDetails.AsAnimal.self, - ClassroomPetDetails.AsPet.self, - ClassroomPetDetails.AsWarmBlooded.self, - ClassroomPetDetails.AsCat.self - ] } - - public var species: String { __data["species"] } - public var humanName: String? { __data["humanName"] } - public var laysEggs: Bool { __data["laysEggs"] } - public var bodyTemperature: Int { __data["bodyTemperature"] } - public var isJellicle: Bool { __data["isJellicle"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - species: String, - humanName: String? = nil, - laysEggs: Bool, - bodyTemperature: Int, - isJellicle: Bool - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Cat.typename, - "species": species, - "humanName": humanName, - "laysEggs": laysEggs, - "bodyTemperature": bodyTemperature, - "isJellicle": isJellicle, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.AsCat.self), - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self), - ObjectIdentifier(ClassroomPetDetails.AsWarmBlooded.self), - ObjectIdentifier(ClassroomPetDetails.AsCat.self) - ] - )) - } - } - - /// ClassroomPet.AsBird - /// - /// Parent Type: `Bird` - public struct AsBird: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Bird } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsQuery.Data.ClassroomPet.self, - ClassroomPetDetails.AsAnimal.self, - ClassroomPetDetails.AsPet.self, - ClassroomPetDetails.AsWarmBlooded.self, - ClassroomPetDetails.AsBird.self - ] } - - public var species: String { __data["species"] } - public var humanName: String? { __data["humanName"] } - public var laysEggs: Bool { __data["laysEggs"] } - public var wingspan: Double { __data["wingspan"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - species: String, - humanName: String? = nil, - laysEggs: Bool, - wingspan: Double - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Bird.typename, - "species": species, - "humanName": humanName, - "laysEggs": laysEggs, - "wingspan": wingspan, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.AsBird.self), - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsAnimal.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self), - ObjectIdentifier(ClassroomPetDetails.AsWarmBlooded.self), - ObjectIdentifier(ClassroomPetDetails.AsBird.self) - ] - )) - } - } - - /// ClassroomPet.AsPetRock - /// - /// Parent Type: `PetRock` - public struct AsPetRock: AnimalKingdomAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = ClassroomPetsQuery.Data.ClassroomPet - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.PetRock } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - ClassroomPetsQuery.Data.ClassroomPet.self, - ClassroomPetDetails.AsPet.self, - ClassroomPetDetails.AsPetRock.self - ] } - - public var humanName: String? { __data["humanName"] } - public var favoriteToy: String { __data["favoriteToy"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var classroomPetDetails: ClassroomPetDetails { _toFragment() } - } - - public init( - humanName: String? = nil, - favoriteToy: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.PetRock.typename, - "humanName": humanName, - "favoriteToy": favoriteToy, - ], - fulfilledFragments: [ - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.self), - ObjectIdentifier(ClassroomPetsQuery.Data.ClassroomPet.AsPetRock.self), - ObjectIdentifier(ClassroomPetDetails.self), - ObjectIdentifier(ClassroomPetDetails.AsPet.self), - ObjectIdentifier(ClassroomPetDetails.AsPetRock.self) - ] - )) - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/DogQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/DogQuery.graphql.swift deleted file mode 100644 index 29f6cfcc69..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/DogQuery.graphql.swift +++ /dev/null @@ -1,124 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class DogQuery: GraphQLQuery { - public static let operationName: String = "DogQuery" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query DogQuery { allAnimals { __typename id skinCovering ... on Dog { ...DogFragment } } }"#, - fragments: [DogFragment.self] - )) - - public init() {} - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal].self), - ] } - - public var allAnimals: [AllAnimal] { __data["allAnimals"] } - - public init( - allAnimals: [AllAnimal] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "allAnimals": allAnimals._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(DogQuery.Data.self) - ] - )) - } - - /// AllAnimal - /// - /// Parent Type: `Animal` - public struct AllAnimal: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Animal } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", AnimalKingdomAPI.ID.self), - .field("skinCovering", GraphQLEnum?.self), - .inlineFragment(AsDog.self), - ] } - - public var id: AnimalKingdomAPI.ID { __data["id"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - - public var asDog: AsDog? { _asInlineFragment() } - - public init( - __typename: String, - id: AnimalKingdomAPI.ID, - skinCovering: GraphQLEnum? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "skinCovering": skinCovering, - ], - fulfilledFragments: [ - ObjectIdentifier(DogQuery.Data.AllAnimal.self) - ] - )) - } - - /// AllAnimal.AsDog - /// - /// Parent Type: `Dog` - public struct AsDog: AnimalKingdomAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = DogQuery.Data.AllAnimal - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Dog } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(DogFragment.self), - ] } - - public var id: AnimalKingdomAPI.ID { __data["id"] } - public var skinCovering: GraphQLEnum? { __data["skinCovering"] } - public var species: String { __data["species"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var dogFragment: DogFragment { _toFragment() } - } - - public init( - id: AnimalKingdomAPI.ID, - skinCovering: GraphQLEnum? = nil, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Dog.typename, - "id": id, - "skinCovering": skinCovering, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(DogQuery.Data.AllAnimal.self), - ObjectIdentifier(DogQuery.Data.AllAnimal.AsDog.self), - ObjectIdentifier(DogFragment.self) - ] - )) - } - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/PetSearchQuery.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/PetSearchQuery.graphql.swift deleted file mode 100644 index f1afefb48f..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Operations/Queries/PetSearchQuery.graphql.swift +++ /dev/null @@ -1,92 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class PetSearchQuery: GraphQLQuery { - public static let operationName: String = "PetSearch" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query PetSearch($filters: PetSearchFilters = {species: ["Dog", "Cat"], size: SMALL, measurements: {height: 10.5, weight: 5.0}}) { pets(filters: $filters) { __typename id humanName } }"# - )) - - public var filters: GraphQLNullable - - public init(filters: GraphQLNullable = .init( - PetSearchFilters( - species: ["Dog", "Cat"], - size: .init(.small), - measurements: .init( - MeasurementsInput( - height: 10.5, - weight: 5.0 - ) - ) - ) - )) { - self.filters = filters - } - - public var __variables: Variables? { ["filters": filters] } - - public struct Data: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("pets", [Pet].self, arguments: ["filters": .variable("filters")]), - ] } - - public var pets: [Pet] { __data["pets"] } - - public init( - pets: [Pet] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": AnimalKingdomAPI.Objects.Query.typename, - "pets": pets._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(PetSearchQuery.Data.self) - ] - )) - } - - /// Pet - /// - /// Parent Type: `Pet` - public struct Pet: AnimalKingdomAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Interfaces.Pet } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", AnimalKingdomAPI.ID.self), - .field("humanName", String?.self), - ] } - - public var id: AnimalKingdomAPI.ID { __data["id"] } - public var humanName: String? { __data["humanName"] } - - public init( - __typename: String, - id: AnimalKingdomAPI.ID, - humanName: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "humanName": humanName, - ], - fulfilledFragments: [ - ObjectIdentifier(PetSearchQuery.Data.Pet.self) - ] - )) - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/CustomScalars/CustomDate.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/CustomScalars/CustomDate.swift deleted file mode 100644 index ed3ce664c1..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/CustomScalars/CustomDate.swift +++ /dev/null @@ -1,10 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// implement advanced custom scalar functionality. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -public typealias CustomDate = String diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Enums/RelativeSize.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Enums/RelativeSize.graphql.swift deleted file mode 100644 index 9bfbe7c500..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Enums/RelativeSize.graphql.swift +++ /dev/null @@ -1,10 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public enum RelativeSize: String, EnumType { - case large = "LARGE" - case average = "AVERAGE" - case small = "SMALL" -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Enums/SkinCovering.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Enums/SkinCovering.graphql.swift deleted file mode 100644 index 95d5689361..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Enums/SkinCovering.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public enum SkinCovering: String, EnumType { - case fur = "FUR" - case hair = "HAIR" - case feathers = "FEATHERS" - case scales = "SCALES" -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/MeasurementsInput.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/MeasurementsInput.graphql.swift deleted file mode 100644 index 4479e2bd3b..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/MeasurementsInput.graphql.swift +++ /dev/null @@ -1,51 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public struct MeasurementsInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - height: Double, - weight: Double - ) { - __data = InputDict([ - "height": height, - "weight": weight - ]) - } - - @available(*, deprecated, message: "Argument 'wingspan' is deprecated.") - public init( - height: Double, - weight: Double, - wingspan: GraphQLNullable = nil - ) { - __data = InputDict([ - "height": height, - "weight": weight, - "wingspan": wingspan - ]) - } - - public var height: Double { - get { __data["height"] } - set { __data["height"] = newValue } - } - - public var weight: Double { - get { __data["weight"] } - set { __data["weight"] = newValue } - } - - @available(*, deprecated, message: "No longer valid.") - public var wingspan: GraphQLNullable { - get { __data["wingspan"] } - set { __data["wingspan"] = newValue } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/PetAdoptionInput.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/PetAdoptionInput.graphql.swift deleted file mode 100644 index 06a7b63b95..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/PetAdoptionInput.graphql.swift +++ /dev/null @@ -1,61 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public struct PetAdoptionInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - ownerID: ID, - petID: ID, - humanName: GraphQLNullable = nil, - favoriteToy: String, - isSpayedOrNeutered: Bool?, - measurements: GraphQLNullable = nil - ) { - __data = InputDict([ - "ownerID": ownerID, - "petID": petID, - "humanName": humanName, - "favoriteToy": favoriteToy, - "isSpayedOrNeutered": isSpayedOrNeutered, - "measurements": measurements - ]) - } - - public var ownerID: ID { - get { __data["ownerID"] } - set { __data["ownerID"] = newValue } - } - - public var petID: ID { - get { __data["petID"] } - set { __data["petID"] = newValue } - } - - /// The given name the pet is called by its human. - public var humanName: GraphQLNullable { - get { __data["humanName"] } - set { __data["humanName"] = newValue } - } - - public var favoriteToy: String { - get { __data["favoriteToy"] } - set { __data["favoriteToy"] = newValue } - } - - public var isSpayedOrNeutered: Bool? { - get { __data["isSpayedOrNeutered"] } - set { __data["isSpayedOrNeutered"] = newValue } - } - - public var measurements: GraphQLNullable { - get { __data["measurements"] } - set { __data["measurements"] = newValue } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/PetSearchFilters.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/PetSearchFilters.graphql.swift deleted file mode 100644 index 86fe0ee92f..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/InputObjects/PetSearchFilters.graphql.swift +++ /dev/null @@ -1,39 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public struct PetSearchFilters: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - species: [String], - size: GraphQLNullable> = nil, - measurements: GraphQLNullable = nil - ) { - __data = InputDict([ - "species": species, - "size": size, - "measurements": measurements - ]) - } - - public var species: [String] { - get { __data["species"] } - set { __data["species"] = newValue } - } - - public var size: GraphQLNullable> { - get { __data["size"] } - set { __data["size"] = newValue } - } - - public var measurements: GraphQLNullable { - get { __data["measurements"] } - set { __data["measurements"] = newValue } - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/Animal.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/Animal.graphql.swift deleted file mode 100644 index d6b00b00c4..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/Animal.graphql.swift +++ /dev/null @@ -1,8 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - static let Animal = Interface(name: "Animal") -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/HousePet.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/HousePet.graphql.swift deleted file mode 100644 index 642b78753d..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/HousePet.graphql.swift +++ /dev/null @@ -1,8 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - static let HousePet = Interface(name: "HousePet") -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/Pet.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/Pet.graphql.swift deleted file mode 100644 index 70bef98b7f..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/Pet.graphql.swift +++ /dev/null @@ -1,8 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - static let Pet = Interface(name: "Pet") -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/WarmBlooded.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/WarmBlooded.graphql.swift deleted file mode 100644 index 5d41172a2f..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Interfaces/WarmBlooded.graphql.swift +++ /dev/null @@ -1,8 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - static let WarmBlooded = Interface(name: "WarmBlooded") -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Bird.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Bird.graphql.swift deleted file mode 100644 index 317b9d687b..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Bird.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Bird = Object( - typename: "Bird", - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.Pet.self, - Interfaces.WarmBlooded.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Cat.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Cat.graphql.swift deleted file mode 100644 index a7118bf23a..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Cat.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Cat = Object( - typename: "Cat", - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.Pet.self, - Interfaces.WarmBlooded.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Crocodile.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Crocodile.graphql.swift deleted file mode 100644 index a150722d70..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Crocodile.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Crocodile = Object( - typename: "Crocodile", - implementedInterfaces: [Interfaces.Animal.self] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Dog.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Dog.graphql.swift deleted file mode 100644 index f9e4e7ab02..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Dog.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Dog = Object( - typename: "Dog", - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.Pet.self, - Interfaces.HousePet.self, - Interfaces.WarmBlooded.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Fish.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Fish.graphql.swift deleted file mode 100644 index ac42567fc1..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Fish.graphql.swift +++ /dev/null @@ -1,14 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Fish = Object( - typename: "Fish", - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.Pet.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Height.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Height.graphql.swift deleted file mode 100644 index a12bbc3024..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Height.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Height = Object( - typename: "Height", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Human.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Human.graphql.swift deleted file mode 100644 index 24958c33e8..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Human.graphql.swift +++ /dev/null @@ -1,14 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Human = Object( - typename: "Human", - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.WarmBlooded.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Mutation.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Mutation.graphql.swift deleted file mode 100644 index 7358d341ca..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Mutation.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Mutation = Object( - typename: "Mutation", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/PetRock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/PetRock.graphql.swift deleted file mode 100644 index 9013e3736d..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/PetRock.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let PetRock = Object( - typename: "PetRock", - implementedInterfaces: [Interfaces.Pet.self] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Query.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Query.graphql.swift deleted file mode 100644 index f3f311f04a..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Query.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Query = Object( - typename: "Query", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Rat.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Rat.graphql.swift deleted file mode 100644 index b78fa73ea4..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Objects/Rat.graphql.swift +++ /dev/null @@ -1,14 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Rat = Object( - typename: "Rat", - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.Pet.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/SchemaConfiguration.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/SchemaConfiguration.swift deleted file mode 100644 index 7976ecf827..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/SchemaConfiguration.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// provide custom configuration for a generated GraphQL schema. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/SchemaMetadata.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/SchemaMetadata.graphql.swift deleted file mode 100644 index 4c11977237..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/SchemaMetadata.graphql.swift +++ /dev/null @@ -1,43 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public typealias ID = String - -public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet -where Schema == AnimalKingdomAPI.SchemaMetadata {} - -public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment -where Schema == AnimalKingdomAPI.SchemaMetadata {} - -public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet -where Schema == AnimalKingdomAPI.SchemaMetadata {} - -public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment -where Schema == AnimalKingdomAPI.SchemaMetadata {} - -public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - - public static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "Query": return AnimalKingdomAPI.Objects.Query - case "Human": return AnimalKingdomAPI.Objects.Human - case "Cat": return AnimalKingdomAPI.Objects.Cat - case "Dog": return AnimalKingdomAPI.Objects.Dog - case "Bird": return AnimalKingdomAPI.Objects.Bird - case "Fish": return AnimalKingdomAPI.Objects.Fish - case "Rat": return AnimalKingdomAPI.Objects.Rat - case "PetRock": return AnimalKingdomAPI.Objects.PetRock - case "Crocodile": return AnimalKingdomAPI.Objects.Crocodile - case "Height": return AnimalKingdomAPI.Objects.Height - case "Mutation": return AnimalKingdomAPI.Objects.Mutation - default: return nil - } - } -} - -public enum Objects {} -public enum Interfaces {} -public enum Unions {} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Unions/ClassroomPet.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Unions/ClassroomPet.graphql.swift deleted file mode 100644 index 488ed2f3dd..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/Sources/Schema/Unions/ClassroomPet.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Unions { - static let ClassroomPet = Union( - name: "ClassroomPet", - possibleTypes: [ - Objects.Cat.self, - Objects.Bird.self, - Objects.Rat.self, - Objects.PetRock.self - ] - ) -} \ No newline at end of file diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Bird+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Bird+Mock.graphql.swift deleted file mode 100644 index 54dcfa7025..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Bird+Mock.graphql.swift +++ /dev/null @@ -1,54 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Bird: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Bird - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("bodyTemperature") public var bodyTemperature - @Field("favoriteToy") public var favoriteToy - @Field("height") public var height - @Field("humanName") public var humanName - @Field("id") public var id - @Field("laysEggs") public var laysEggs - @Field("owner") public var owner - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - @Field("wingspan") public var wingspan - } -} - -public extension Mock where O == Bird { - convenience init( - bodyTemperature: Int? = nil, - favoriteToy: String? = nil, - height: Mock? = nil, - humanName: String? = nil, - id: AnimalKingdomAPI.ID? = nil, - laysEggs: Bool? = nil, - owner: Mock? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil, - wingspan: Double? = nil - ) { - self.init() - _setScalar(bodyTemperature, for: \.bodyTemperature) - _setScalar(favoriteToy, for: \.favoriteToy) - _setEntity(height, for: \.height) - _setScalar(humanName, for: \.humanName) - _setScalar(id, for: \.id) - _setScalar(laysEggs, for: \.laysEggs) - _setEntity(owner, for: \.owner) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - _setScalar(wingspan, for: \.wingspan) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Cat+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Cat+Mock.graphql.swift deleted file mode 100644 index 12e51402e0..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Cat+Mock.graphql.swift +++ /dev/null @@ -1,54 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Cat: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Cat - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("bodyTemperature") public var bodyTemperature - @Field("favoriteToy") public var favoriteToy - @Field("height") public var height - @Field("humanName") public var humanName - @Field("id") public var id - @Field("isJellicle") public var isJellicle - @Field("laysEggs") public var laysEggs - @Field("owner") public var owner - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - } -} - -public extension Mock where O == Cat { - convenience init( - bodyTemperature: Int? = nil, - favoriteToy: String? = nil, - height: Mock? = nil, - humanName: String? = nil, - id: AnimalKingdomAPI.ID? = nil, - isJellicle: Bool? = nil, - laysEggs: Bool? = nil, - owner: Mock? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil - ) { - self.init() - _setScalar(bodyTemperature, for: \.bodyTemperature) - _setScalar(favoriteToy, for: \.favoriteToy) - _setEntity(height, for: \.height) - _setScalar(humanName, for: \.humanName) - _setScalar(id, for: \.id) - _setScalar(isJellicle, for: \.isJellicle) - _setScalar(laysEggs, for: \.laysEggs) - _setEntity(owner, for: \.owner) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Crocodile+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Crocodile+Mock.graphql.swift deleted file mode 100644 index 07442e8339..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Crocodile+Mock.graphql.swift +++ /dev/null @@ -1,42 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Crocodile: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Crocodile - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("age") public var age - @Field("height") public var height - @Field("id") public var id - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - @Field("tag") public var tag - } -} - -public extension Mock where O == Crocodile { - convenience init( - age: Int? = nil, - height: Mock? = nil, - id: AnimalKingdomAPI.ID? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil, - tag: String? = nil - ) { - self.init() - _setScalar(age, for: \.age) - _setEntity(height, for: \.height) - _setScalar(id, for: \.id) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - _setScalar(tag, for: \.tag) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Dog+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Dog+Mock.graphql.swift deleted file mode 100644 index 9334ab3cfb..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Dog+Mock.graphql.swift +++ /dev/null @@ -1,54 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Dog: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Dog - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("birthdate") public var birthdate - @Field("bodyTemperature") public var bodyTemperature - @Field("favoriteToy") public var favoriteToy - @Field("height") public var height - @Field("humanName") public var humanName - @Field("id") public var id - @Field("laysEggs") public var laysEggs - @Field("owner") public var owner - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - } -} - -public extension Mock where O == Dog { - convenience init( - birthdate: AnimalKingdomAPI.CustomDate? = nil, - bodyTemperature: Int? = nil, - favoriteToy: String? = nil, - height: Mock? = nil, - humanName: String? = nil, - id: AnimalKingdomAPI.ID? = nil, - laysEggs: Bool? = nil, - owner: Mock? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil - ) { - self.init() - _setScalar(birthdate, for: \.birthdate) - _setScalar(bodyTemperature, for: \.bodyTemperature) - _setScalar(favoriteToy, for: \.favoriteToy) - _setEntity(height, for: \.height) - _setScalar(humanName, for: \.humanName) - _setScalar(id, for: \.id) - _setScalar(laysEggs, for: \.laysEggs) - _setEntity(owner, for: \.owner) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Fish+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Fish+Mock.graphql.swift deleted file mode 100644 index 0e88282396..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Fish+Mock.graphql.swift +++ /dev/null @@ -1,45 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Fish: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Fish - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("favoriteToy") public var favoriteToy - @Field("height") public var height - @Field("humanName") public var humanName - @Field("id") public var id - @Field("owner") public var owner - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - } -} - -public extension Mock where O == Fish { - convenience init( - favoriteToy: String? = nil, - height: Mock? = nil, - humanName: String? = nil, - id: AnimalKingdomAPI.ID? = nil, - owner: Mock? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil - ) { - self.init() - _setScalar(favoriteToy, for: \.favoriteToy) - _setEntity(height, for: \.height) - _setScalar(humanName, for: \.humanName) - _setScalar(id, for: \.id) - _setEntity(owner, for: \.owner) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Height+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Height+Mock.graphql.swift deleted file mode 100644 index daab3b8ec0..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Height+Mock.graphql.swift +++ /dev/null @@ -1,36 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Height: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Height - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("centimeters") public var centimeters - @Field("feet") public var feet - @Field("inches") public var inches - @Field("meters") public var meters - @Field>("relativeSize") public var relativeSize - } -} - -public extension Mock where O == Height { - convenience init( - centimeters: Double? = nil, - feet: Int? = nil, - inches: Int? = nil, - meters: Int? = nil, - relativeSize: GraphQLEnum? = nil - ) { - self.init() - _setScalar(centimeters, for: \.centimeters) - _setScalar(feet, for: \.feet) - _setScalar(inches, for: \.inches) - _setScalar(meters, for: \.meters) - _setScalar(relativeSize, for: \.relativeSize) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Human+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Human+Mock.graphql.swift deleted file mode 100644 index c96eaa9206..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Human+Mock.graphql.swift +++ /dev/null @@ -1,45 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Human: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Human - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("bodyTemperature") public var bodyTemperature - @Field("firstName") public var firstName - @Field("height") public var height - @Field("id") public var id - @Field("laysEggs") public var laysEggs - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - } -} - -public extension Mock where O == Human { - convenience init( - bodyTemperature: Int? = nil, - firstName: String? = nil, - height: Mock? = nil, - id: AnimalKingdomAPI.ID? = nil, - laysEggs: Bool? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil - ) { - self.init() - _setScalar(bodyTemperature, for: \.bodyTemperature) - _setScalar(firstName, for: \.firstName) - _setEntity(height, for: \.height) - _setScalar(id, for: \.id) - _setScalar(laysEggs, for: \.laysEggs) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/MockObject+Interfaces.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/MockObject+Interfaces.graphql.swift deleted file mode 100644 index 069d9f380a..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/MockObject+Interfaces.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public extension MockObject { - typealias Animal = Interface - typealias WarmBlooded = Interface - typealias Pet = Interface - typealias HousePet = Interface -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/MockObject+Unions.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/MockObject+Unions.graphql.swift deleted file mode 100644 index d0935b93f2..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/MockObject+Unions.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public extension MockObject { - typealias ClassroomPet = Union -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Mutation+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Mutation+Mock.graphql.swift deleted file mode 100644 index 378837c70c..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Mutation+Mock.graphql.swift +++ /dev/null @@ -1,24 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Mutation: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Mutation - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("adoptPet") public var adoptPet - } -} - -public extension Mock where O == Mutation { - convenience init( - adoptPet: AnyMock? = nil - ) { - self.init() - _setEntity(adoptPet, for: \.adoptPet) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/PetRock+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/PetRock+Mock.graphql.swift deleted file mode 100644 index 926a867a43..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/PetRock+Mock.graphql.swift +++ /dev/null @@ -1,33 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class PetRock: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.PetRock - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("favoriteToy") public var favoriteToy - @Field("humanName") public var humanName - @Field("id") public var id - @Field("owner") public var owner - } -} - -public extension Mock where O == PetRock { - convenience init( - favoriteToy: String? = nil, - humanName: String? = nil, - id: AnimalKingdomAPI.ID? = nil, - owner: Mock? = nil - ) { - self.init() - _setScalar(favoriteToy, for: \.favoriteToy) - _setScalar(humanName, for: \.humanName) - _setScalar(id, for: \.id) - _setEntity(owner, for: \.owner) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Query+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Query+Mock.graphql.swift deleted file mode 100644 index f47bc5bdb5..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Query+Mock.graphql.swift +++ /dev/null @@ -1,30 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Query: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Query - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field<[Animal]>("allAnimals") public var allAnimals - @Field<[ClassroomPet?]>("classroomPets") public var classroomPets - @Field<[Pet]>("pets") public var pets - } -} - -public extension Mock where O == Query { - convenience init( - allAnimals: [AnyMock]? = nil, - classroomPets: [AnyMock?]? = nil, - pets: [AnyMock]? = nil - ) { - self.init() - _setList(allAnimals, for: \.allAnimals) - _setList(classroomPets, for: \.classroomPets) - _setList(pets, for: \.pets) - } -} diff --git a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Rat+Mock.graphql.swift b/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Rat+Mock.graphql.swift deleted file mode 100644 index 76e9a82e37..0000000000 --- a/Sources/AnimalKingdomAPI/AnimalKingdomAPI/TestMocks/Rat+Mock.graphql.swift +++ /dev/null @@ -1,45 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloTestSupport -import AnimalKingdomAPI - -public class Rat: MockObject { - public static let objectType: Object = AnimalKingdomAPI.Objects.Rat - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("favoriteToy") public var favoriteToy - @Field("height") public var height - @Field("humanName") public var humanName - @Field("id") public var id - @Field("owner") public var owner - @Field<[Animal]>("predators") public var predators - @Field>("skinCovering") public var skinCovering - @Field("species") public var species - } -} - -public extension Mock where O == Rat { - convenience init( - favoriteToy: String? = nil, - height: Mock? = nil, - humanName: String? = nil, - id: AnimalKingdomAPI.ID? = nil, - owner: Mock? = nil, - predators: [AnyMock]? = nil, - skinCovering: GraphQLEnum? = nil, - species: String? = nil - ) { - self.init() - _setScalar(favoriteToy, for: \.favoriteToy) - _setEntity(height, for: \.height) - _setScalar(humanName, for: \.humanName) - _setScalar(id, for: \.id) - _setEntity(owner, for: \.owner) - _setList(predators, for: \.predators) - _setScalar(skinCovering, for: \.skinCovering) - _setScalar(species, for: \.species) - } -} diff --git a/Sources/AnimalKingdomAPI/Info.plist b/Sources/AnimalKingdomAPI/Info.plist deleted file mode 100644 index 9bcb244429..0000000000 --- a/Sources/AnimalKingdomAPI/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - - diff --git a/Sources/AnimalKingdomAPI/Resources.swift b/Sources/AnimalKingdomAPI/Resources.swift deleted file mode 100644 index 845371298b..0000000000 --- a/Sources/AnimalKingdomAPI/Resources.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -private class BundleFinder {} - -public struct Resources { - static let Bundle = Foundation.Bundle.init(for: BundleFinder.self) - - public static let GraphQLOperations: [URL] = Bundle.urls( - forResourcesWithExtension: "graphql", - subdirectory: nil - )! - - public static let Schema = Bundle.url( - forResource: "AnimalSchema", - withExtension: "graphqls" - )! -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsIncludeSkipQuery.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsIncludeSkipQuery.graphql deleted file mode 100644 index 0efba8e453..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsIncludeSkipQuery.graphql +++ /dev/null @@ -1,44 +0,0 @@ -query AllAnimalsIncludeSkipQuery( - $includeSpecies: Boolean!, - $skipHeightInMeters: Boolean!, - $getCat: Boolean!, - $getWarmBlooded: Boolean!, - $varA: Boolean!, -) { - allAnimals { - height { - feet - inches - } - ...HeightInMeters @skip(if: $skipHeightInMeters) - ...WarmBloodedDetails @include(if: $getWarmBlooded) - species @include(if: $includeSpecies) - skinCovering - ... on Pet { - ...PetDetails - ...WarmBloodedDetails - ... on Animal { - height { - relativeSize @include(if: $varA) - centimeters @include(if: $varA) - } - } - } - ... on Cat @include(if: $getCat) { - isJellicle - } - ... on ClassroomPet { - ... on Bird { - wingspan - } - } - predators { - species @include(if: $includeSpecies) - ... on WarmBlooded @include(if: $getWarmBlooded) { - species - ...WarmBloodedDetails - laysEggs @include(if: $getWarmBlooded) - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsLocalCacheMutation.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsLocalCacheMutation.graphql deleted file mode 100644 index b9dc7be5f2..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsLocalCacheMutation.graphql +++ /dev/null @@ -1,10 +0,0 @@ -query AllAnimalsLocalCacheMutation -@apollo_client_ios_localCacheMutation { - allAnimals { - species - skinCovering - ... on Bird { - wingspan - } - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsQuery.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsQuery.graphql deleted file mode 100644 index c183ad2af3..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AllAnimalsQuery.graphql +++ /dev/null @@ -1,45 +0,0 @@ -query AllAnimalsQuery { - allAnimals { - __typename - height { - feet - inches - } - ...HeightInMeters - ...WarmBloodedDetails - species - skinCovering - ... on Pet { - ...PetDetails - ...WarmBloodedDetails - ... on Animal { - height { - relativeSize - centimeters - } - } - } - ... on Cat { - isJellicle - } - ... on ClassroomPet { - ... on Bird { - wingspan - } - } - ... on Dog { - favoriteToy - birthdate - } - predators { - species - ... on WarmBlooded { - predators { - species - } - ...WarmBloodedDetails - laysEggs - } - } - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AnimalSchema.graphqls b/Sources/AnimalKingdomAPI/animalkingdom-graphql/AnimalSchema.graphqls deleted file mode 100644 index cb8f0cb474..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/AnimalSchema.graphqls +++ /dev/null @@ -1,192 +0,0 @@ -type Query { - allAnimals: [Animal!]! - classroomPets: [ClassroomPet] - pets(filters: PetSearchFilters!): [Pet!]! -} - -type Mutation { - adoptPet(input: PetAdoptionInput!): Pet! -} - -scalar CustomDate - -input PetAdoptionInput { - ownerID: ID! - petID: ID! - "The given name the pet is called by its human." - humanName: String - favoriteToy: String! - isSpayedOrNeutered: Boolean! = false - measurements: MeasurementsInput -} - -input MeasurementsInput { - height: Float! - weight: Float! - wingspan: Float @deprecated(reason: "No longer valid.") -} - -input PetSearchFilters { - species: [String!]! - size: RelativeSize - measurements: MeasurementsInput -} - -interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering -} - -interface Pet { - id: ID! - humanName: String - favoriteToy: String! - owner: Human -} - -interface HousePet implements Animal & Pet { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - humanName: String - favoriteToy: String! - owner: Human - bestFriend: Pet - rival: Pet - livesWith: ClassroomPet - birthdate: CustomDate -} - -interface WarmBlooded implements Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - bodyTemperature: Int! - laysEggs: Boolean! -} - -type Height { - relativeSize: RelativeSize! - centimeters: Float! - meters: Int! - feet: Int! - inches: Int - yards: Int! -} - -type Human implements Animal & WarmBlooded { - id: ID! - firstName: String! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - bodyTemperature: Int! - laysEggs: Boolean! -} - -type Cat implements Animal & Pet & WarmBlooded { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - humanName: String - favoriteToy: String! - owner: Human - bodyTemperature: Int! - laysEggs: Boolean! - isJellicle: Boolean! -} - -type Dog implements Animal & Pet & HousePet & WarmBlooded { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - humanName: String - favoriteToy: String! - owner: Human - bodyTemperature: Int! - laysEggs: Boolean! - bestFriend: HousePet - rival: Cat - livesWith: Bird - birthdate: CustomDate -} - -type Bird implements Animal & Pet & WarmBlooded { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - humanName: String - favoriteToy: String! - owner: Human - bodyTemperature: Int! - laysEggs: Boolean! - wingspan: Float! -} - -type Fish implements Animal & Pet { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - humanName: String - favoriteToy: String! - owner: Human -} - -type Rat implements Animal & Pet { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - humanName: String - favoriteToy: String! - owner: Human -} - -type Crocodile implements Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - skinCovering: SkinCovering - age: Int! - tag(id: String): String -} - -type PetRock implements Pet { - id: ID! - humanName: String - favoriteToy: String! - owner: Human -} - -union ClassroomPet = Cat | Bird | Rat | PetRock - -enum RelativeSize { - LARGE - AVERAGE - SMALL -} - -enum SkinCovering { - FUR - HAIR - FEATHERS - SCALES -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/ClassroomPets.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/ClassroomPets.graphql deleted file mode 100644 index 495711d0bd..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/ClassroomPets.graphql +++ /dev/null @@ -1,27 +0,0 @@ -query ClassroomPets { - classroomPets { - ...ClassroomPetDetails - } -} - -fragment ClassroomPetDetails on ClassroomPet { - ... on Animal { - species - } - ... on Pet { - humanName - } - ... on WarmBlooded { - laysEggs - } - ... on Cat { - bodyTemperature - isJellicle - } - ... on Bird { - wingspan - } - ... on PetRock { - favoriteToy - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/CrocodileFragment.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/CrocodileFragment.graphql deleted file mode 100644 index 1f6a4a8009..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/CrocodileFragment.graphql +++ /dev/null @@ -1,5 +0,0 @@ -fragment CrocodileFragment on Crocodile { - species - age - tag(id: "albino") -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/DogFragment.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/DogFragment.graphql deleted file mode 100644 index 92e7f4ba48..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/DogFragment.graphql +++ /dev/null @@ -1,3 +0,0 @@ -fragment DogFragment on Dog { - species -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/DogQuery.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/DogQuery.graphql deleted file mode 100644 index d9d7a690e2..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/DogQuery.graphql +++ /dev/null @@ -1,9 +0,0 @@ -query DogQuery { - allAnimals { - id - skinCovering - ... on Dog { - ... DogFragment - } - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/HeightInMeters.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/HeightInMeters.graphql deleted file mode 100644 index 0a288ebb8f..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/HeightInMeters.graphql +++ /dev/null @@ -1,5 +0,0 @@ -fragment HeightInMeters on Animal { - height { - meters - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetAdoptionMutation.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetAdoptionMutation.graphql deleted file mode 100644 index fbfddebe72..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetAdoptionMutation.graphql +++ /dev/null @@ -1,6 +0,0 @@ -mutation PetAdoptionMutation($input: PetAdoptionInput!) { - adoptPet(input: $input) { - id - humanName - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetDetails.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetDetails.graphql deleted file mode 100644 index 43f5eeed3c..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetDetails.graphql +++ /dev/null @@ -1,7 +0,0 @@ -fragment PetDetails on Pet { - humanName - favoriteToy - owner { - firstName - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetDetailsMutation.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetDetailsMutation.graphql deleted file mode 100644 index e3e719b06e..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetDetailsMutation.graphql +++ /dev/null @@ -1,5 +0,0 @@ -fragment PetDetailsMutation on Pet @apollo_client_ios_localCacheMutation { - owner { - firstName - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetSearchLocalCacheMutation.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetSearchLocalCacheMutation.graphql deleted file mode 100644 index 50d287151d..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetSearchLocalCacheMutation.graphql +++ /dev/null @@ -1,14 +0,0 @@ -query PetSearchLocalCacheMutation($filters: PetSearchFilters = { - species: ["Dog", "Cat"], - size: SMALL, - measurements: { - height: 10.5, - weight: 5.0 - } - } -) @apollo_client_ios_localCacheMutation { - pets(filters: $filters) { - id - humanName - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetSearchQuery.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetSearchQuery.graphql deleted file mode 100644 index 6a65134cdf..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/PetSearchQuery.graphql +++ /dev/null @@ -1,14 +0,0 @@ -query PetSearch($filters: PetSearchFilters = { - species: ["Dog", "Cat"], - size: SMALL, - measurements: { - height: 10.5, - weight: 5.0 - } - } -) { - pets(filters: $filters) { - id - humanName - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/WarmBloodedDetails.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/WarmBloodedDetails.graphql deleted file mode 100644 index e961713508..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/WarmBloodedDetails.graphql +++ /dev/null @@ -1,4 +0,0 @@ -fragment WarmBloodedDetails on WarmBlooded { - bodyTemperature - ...HeightInMeters -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/ccnGraphql/AllAnimalsCCN.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/ccnGraphql/AllAnimalsCCN.graphql deleted file mode 100644 index 5d85c589e7..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/ccnGraphql/AllAnimalsCCN.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query AllAnimalsCCN { - allAnimals { - height? { - feet? - inches! - } - } -} diff --git a/Sources/AnimalKingdomAPI/animalkingdom-graphql/ccnGraphql/ClassroomPetsCCN.graphql b/Sources/AnimalKingdomAPI/animalkingdom-graphql/ccnGraphql/ClassroomPetsCCN.graphql deleted file mode 100644 index 41d16b593f..0000000000 --- a/Sources/AnimalKingdomAPI/animalkingdom-graphql/ccnGraphql/ClassroomPetsCCN.graphql +++ /dev/null @@ -1,14 +0,0 @@ -query ClassroomPetsCCN { - classroomPets[!]? { - ...ClassroomPetDetailsCCN - } -} - -fragment ClassroomPetDetailsCCN on ClassroomPet { - ... on Animal { - height { - inches! - } - } -} - diff --git a/Sources/Apollo/Apollo.h b/Sources/Apollo/Apollo.h deleted file mode 100644 index efcebde284..0000000000 --- a/Sources/Apollo/Apollo.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -//! Project version number for Apollo. -FOUNDATION_EXPORT double ApolloVersionNumber; - -//! Project version string for Apollo. -FOUNDATION_EXPORT const unsigned char ApolloVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import diff --git a/Sources/Apollo/Constants.swift b/Sources/Apollo/Constants.swift new file mode 100644 index 0000000000..4f7c801b40 --- /dev/null +++ b/Sources/Apollo/Constants.swift @@ -0,0 +1,5 @@ +import Foundation + +public enum Constants { + public static let ApolloVersion: String = "1.7.1" +} diff --git a/Sources/Apollo/FieldSelectionCollector.swift b/Sources/Apollo/FieldSelectionCollector.swift index 8260e93140..47e82e2b32 100644 --- a/Sources/Apollo/FieldSelectionCollector.swift +++ b/Sources/Apollo/FieldSelectionCollector.swift @@ -77,6 +77,8 @@ struct DefaultFieldSelectionCollector: FieldSelectionCollector { info: info) } + case .deferred(_, _, _): + assertionFailure("Defer execution must be implemented (#3145).") case let .fragment(fragment): groupedFields.addFulfilledFragment(fragment) try collectFields(from: fragment.__selections, @@ -84,6 +86,7 @@ struct DefaultFieldSelectionCollector: FieldSelectionCollector { for: object, info: info) + // TODO: _ is fine for now but will need to be handled in #3145 case let .inlineFragment(typeCase): if let runtimeType = info.runtimeObjectType(for: object), typeCase.__parentType.canBeConverted(from: runtimeType) { @@ -145,7 +148,8 @@ struct CustomCacheDataWritingFieldSelectionCollector: FieldSelectionCollector { for: object, info: info, asConditionalFields: true) - + case .deferred(_, _, _): + assertionFailure("Defer execution must be implemented (#3145).") case let .fragment(fragment): if groupedFields.fulfilledFragments.contains(type: fragment) { try collectFields(from: fragment.__selections, diff --git a/Sources/Apollo/GraphQLResponse.swift b/Sources/Apollo/GraphQLResponse.swift index e477e09b66..ff4dee1774 100644 --- a/Sources/Apollo/GraphQLResponse.swift +++ b/Sources/Apollo/GraphQLResponse.swift @@ -99,6 +99,6 @@ extension GraphQLResponse: Hashable where Data: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(body) hasher.combine(rootKey) - hasher.combine(variables?._jsonEncodableValue?._jsonValue) + hasher.combine(variables?._jsonEncodableObject._jsonValue) } } diff --git a/Sources/Apollo/GraphQLSelectionSetMapper.swift b/Sources/Apollo/GraphQLSelectionSetMapper.swift index 5d30763729..39a8bda861 100644 --- a/Sources/Apollo/GraphQLSelectionSetMapper.swift +++ b/Sources/Apollo/GraphQLSelectionSetMapper.swift @@ -46,7 +46,7 @@ final class GraphQLSelectionSetMapper: GraphQLResultAccumulator } func acceptNullValue(firstReceivedAt: Date, info: FieldExecutionInfo) -> AnyHashable? { - return DataDict.NullValue + return DataDict._NullValue } func acceptMissingValue(firstReceivedAt: Date, info: FieldExecutionInfo) throws -> AnyHashable? { @@ -87,11 +87,3 @@ final class GraphQLSelectionSetMapper: GraphQLResultAccumulator return T.init(_dataDict: rootValue) } } - -// MARK: - Null Value Definition -extension DataDict { - /// A common value used to represent a null value in a `DataDict`. - /// - /// This value can be cast to `NSNull` and will bridge automatically. - static let NullValue = AnyHashable(Optional.none) -} diff --git a/Sources/Apollo/HTTPURLResponse+Helpers.swift b/Sources/Apollo/HTTPURLResponse+Helpers.swift index 5ae54bcae1..05f298ad45 100644 --- a/Sources/Apollo/HTTPURLResponse+Helpers.swift +++ b/Sources/Apollo/HTTPURLResponse+Helpers.swift @@ -1,23 +1,50 @@ import Foundation +// MARK: Status extensions extension HTTPURLResponse { var isSuccessful: Bool { return (200..<300).contains(statusCode) } +} +// MARK: Multipart extensions +extension HTTPURLResponse { + /// Returns true if the `Content-Type` HTTP header contains the `multipart/mixed` MIME type. var isMultipart: Bool { return (allHeaderFields["Content-Type"] as? String)?.contains("multipart/mixed") ?? false } - var multipartBoundary: String? { - guard let contentType = allHeaderFields["Content-Type"] as? String else { return nil } + struct MultipartHeaderComponents { + let media: String? + let boundary: String? + let `protocol`: String? + + init(media: String? = nil, boundary: String? = nil, protocol: String? = nil) { + self.media = media + self.boundary = boundary + self.protocol = `protocol` + } + } + + /// Components of the `Content-Type` header specifically related to the `multipart` media type. + var multipartHeaderComponents: MultipartHeaderComponents { + guard let contentType = allHeaderFields["Content-Type"] as? String else { + return MultipartHeaderComponents() + } - let marker = "boundary=" - let markerLength = marker.count + var media: String? = nil + var boundary: String? = nil + var `protocol`: String? = nil for component in contentType.components(separatedBy: ";") { let directive = component.trimmingCharacters(in: .whitespaces) - if directive.prefix(markerLength) == marker { + + if directive.starts(with: "multipart/") { + media = directive.components(separatedBy: "/").last + continue + } + + if directive.starts(with: "boundary=") { if let markerEndIndex = directive.firstIndex(of: "=") { var startIndex = directive.index(markerEndIndex, offsetBy: 1) if directive[startIndex] == "\"" { @@ -28,11 +55,17 @@ extension HTTPURLResponse { endIndex = directive.index(before: endIndex) } - return String(directive[startIndex...endIndex]) + boundary = String(directive[startIndex...endIndex]) } + continue + } + + if directive.contains("Spec=") { + `protocol` = directive + continue } } - return nil + return MultipartHeaderComponents(media: media, boundary: boundary, protocol: `protocol`) } } diff --git a/Sources/Apollo/Info.plist b/Sources/Apollo/Info.plist deleted file mode 100644 index 0e600e67e7..0000000000 --- a/Sources/Apollo/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/Apollo/MultipartResponseDeferParser.swift b/Sources/Apollo/MultipartResponseDeferParser.swift new file mode 100644 index 0000000000..f39a9e05e7 --- /dev/null +++ b/Sources/Apollo/MultipartResponseDeferParser.swift @@ -0,0 +1,17 @@ +import Foundation +#if !COCOAPODS +import ApolloAPI +#endif + +struct MultipartResponseDeferParser: MultipartResponseSpecificationParser { + static let protocolSpec: String = "deferSpec=20220824" + + static func parse( + data: Data, + boundary: String, + dataHandler: ((Data) -> Void), + errorHandler: ((Error) -> Void) + ) { + // TODO: Will be implemented in #3146 + } +} diff --git a/Sources/Apollo/MultipartResponseParsingInterceptor.swift b/Sources/Apollo/MultipartResponseParsingInterceptor.swift index 66a4f26179..0c20e274b6 100644 --- a/Sources/Apollo/MultipartResponseParsingInterceptor.swift +++ b/Sources/Apollo/MultipartResponseParsingInterceptor.swift @@ -6,42 +6,23 @@ import ApolloAPI /// Parses multipart response data into chunks and forwards each on to the next interceptor. public struct MultipartResponseParsingInterceptor: ApolloInterceptor { - public enum MultipartResponseParsingError: Error, LocalizedError, Equatable { + public enum ParsingError: Error, LocalizedError, Equatable { case noResponseToParse - case cannotParseResponseData - case unsupportedContentType(type: String) - case cannotParseChunkData - case irrecoverableError(message: String?) - case cannotParsePayloadData + case cannotParseResponse public var errorDescription: String? { switch self { case .noResponseToParse: return "There is no response to parse. Check the order of your interceptors." - case .cannotParseResponseData: + case .cannotParseResponse: return "The response data could not be parsed." - case let .unsupportedContentType(type): - return "Unsupported content type: application/json is required but got \(type)." - case .cannotParseChunkData: - return "The chunk data could not be parsed." - case let .irrecoverableError(message): - return "An irrecoverable error occured: \(message ?? "unknown")." - case .cannotParsePayloadData: - return "The payload data could not be parsed." } } } - private enum ChunkedDataLine { - case heartbeat - case contentHeader(type: String) - case json(object: JSONObject) - case unknown - } - - private static let dataLineSeparator: StaticString = "\r\n\r\n" - private static let contentTypeHeader: StaticString = "content-type:" - private static let heartbeat: StaticString = "{}" + private static let responseParsers: [String: MultipartResponseSpecificationParser.Type] = [ + MultipartResponseSubscriptionParser.protocolSpec: MultipartResponseSubscriptionParser.self + ] public var id: String = UUID().uuidString @@ -56,7 +37,7 @@ public struct MultipartResponseParsingInterceptor: ApolloInterceptor { guard let response else { chain.handleErrorAsync( - MultipartResponseParsingError.noResponseToParse, + ParsingError.noResponseToParse, request: request, response: response, completion: completion @@ -74,12 +55,15 @@ public struct MultipartResponseParsingInterceptor: ApolloInterceptor { return } + let multipartComponents = response.httpResponse.multipartHeaderComponents + guard - let boundaryString = response.httpResponse.multipartBoundary, - let dataString = String(data: response.rawData, encoding: .utf8) + let boundary = multipartComponents.boundary, + let `protocol` = multipartComponents.protocol, + let parser = Self.responseParsers[`protocol`] else { chain.handleErrorAsync( - MultipartResponseParsingError.cannotParseResponseData, + ParsingError.cannotParseResponse, request: request, response: response, completion: completion @@ -87,116 +71,51 @@ public struct MultipartResponseParsingInterceptor: ApolloInterceptor { return } - for chunk in dataString.components(separatedBy: "--\(boundaryString)") { - if chunk.isEmpty || chunk.isBoundaryPrefix { continue } - - for dataLine in chunk.components(separatedBy: Self.dataLineSeparator.description) { - switch (parse(dataLine: dataLine.trimmingCharacters(in: .newlines))) { - case .heartbeat: - // Periodically sent by the router - noop - continue - - case let .contentHeader(type): - guard type == "application/json" else { - chain.handleErrorAsync( - MultipartResponseParsingError.unsupportedContentType(type: type), - request: request, - response: response, - completion: completion - ) - return - } - - case let .json(object): - if let errors = object["errors"] as? [JSONObject] { - let message = errors.first?["message"] as? String - - chain.handleErrorAsync( - MultipartResponseParsingError.irrecoverableError(message: message), - request: request, - response: response, - completion: completion - ) - - // These are fatal-level transport errors, don't process anything else. - return - } - - guard let payload = object["payload"] else { - chain.handleErrorAsync( - MultipartResponseParsingError.cannotParsePayloadData, - request: request, - response: response, - completion: completion - ) - return - } - - if payload is NSNull { - // `payload` can be null such as in the case of a transport error - continue - } - - guard - let payload = payload as? JSONObject, - let data: Data = try? JSONSerializationFormat.serialize(value: payload) - else { - chain.handleErrorAsync( - MultipartResponseParsingError.cannotParsePayloadData, - request: request, - response: response, - completion: completion - ) - return - } - - let response = HTTPResponse( - response: response.httpResponse, - rawData: data, - parsedResponse: nil - ) - chain.proceedAsync( - request: request, - response: response, - interceptor: self, - completion: completion - ) - - case .unknown: - chain.handleErrorAsync( - MultipartResponseParsingError.cannotParseChunkData, - request: request, - response: response, - completion: completion - ) - } - } - } - } - - /// Parses the data line of a multipart response chunk - private func parse(dataLine: String) -> ChunkedDataLine { - if dataLine == Self.heartbeat.description { - return .heartbeat - } + let dataHandler: ((Data) -> Void) = { data in + let response = HTTPResponse( + response: response.httpResponse, + rawData: data, + parsedResponse: nil + ) - if dataLine.starts(with: Self.contentTypeHeader.description) { - return .contentHeader(type: (dataLine.components(separatedBy: ":").last ?? dataLine) - .trimmingCharacters(in: .whitespaces) + chain.proceedAsync( + request: request, + response: response, + interceptor: self, + completion: completion ) } - if - let data = dataLine.data(using: .utf8), - let jsonObject = try? JSONSerializationFormat.deserialize(data: data) as? JSONObject - { - return .json(object: jsonObject) + let errorHandler: ((Error) -> Void) = { parserError in + chain.handleErrorAsync( + parserError, + request: request, + response: response, + completion: completion + ) } - return .unknown + parser.parse( + data: response.rawData, + boundary: boundary, + dataHandler: dataHandler, + errorHandler: errorHandler + ) } } -fileprivate extension String { - var isBoundaryPrefix: Bool { self == "--" } +/// A protocol that multipart response parsers must conform to in order to be added to the list of +/// available response specification parsers. +protocol MultipartResponseSpecificationParser { + /// The specification string matching what is expected to be received in the `Content-Type` header + /// in an HTTP response. + static var protocolSpec: String { get } + + /// Function that will be called to process the response data. + static func parse( + data: Data, + boundary: String, + dataHandler: ((Data) -> Void), + errorHandler: ((Error) -> Void) + ) } diff --git a/Sources/Apollo/MultipartResponseSubscriptionParser.swift b/Sources/Apollo/MultipartResponseSubscriptionParser.swift new file mode 100644 index 0000000000..dec316522f --- /dev/null +++ b/Sources/Apollo/MultipartResponseSubscriptionParser.swift @@ -0,0 +1,129 @@ +import Foundation +#if !COCOAPODS +import ApolloAPI +#endif + +struct MultipartResponseSubscriptionParser: MultipartResponseSpecificationParser { + public enum ParsingError: Swift.Error, LocalizedError, Equatable { + case cannotParseResponseData + case unsupportedContentType(type: String) + case cannotParseChunkData + case irrecoverableError(message: String?) + case cannotParsePayloadData + + public var errorDescription: String? { + switch self { + case .cannotParseResponseData: + return "The response data could not be parsed." + case let .unsupportedContentType(type): + return "Unsupported content type: application/json is required but got \(type)." + case .cannotParseChunkData: + return "The chunk data could not be parsed." + case let .irrecoverableError(message): + return "An irrecoverable error occured: \(message ?? "unknown")." + case .cannotParsePayloadData: + return "The payload data could not be parsed." + } + } + } + + private enum ChunkedDataLine { + case heartbeat + case contentHeader(type: String) + case json(object: JSONObject) + case unknown + } + + static let protocolSpec: String = "subscriptionSpec=1.0" + + private static let dataLineSeparator: StaticString = "\r\n\r\n" + private static let contentTypeHeader: StaticString = "content-type:" + private static let heartbeat: StaticString = "{}" + + static func parse( + data: Data, + boundary: String, + dataHandler: ((Data) -> Void), + errorHandler: ((Error) -> Void) + ) { + guard let dataString = String(data: data, encoding: .utf8) else { + errorHandler(ParsingError.cannotParseResponseData) + return + } + + for chunk in dataString.components(separatedBy: "--\(boundary)") { + if chunk.isEmpty || chunk.isBoundaryPrefix { continue } + + for dataLine in chunk.components(separatedBy: Self.dataLineSeparator.description) { + switch (parse(dataLine: dataLine.trimmingCharacters(in: .newlines))) { + case .heartbeat: + // Periodically sent by the router - noop + continue + + case let .contentHeader(type): + guard type == "application/json" else { + errorHandler(ParsingError.unsupportedContentType(type: type)) + return + } + + case let .json(object): + if let errors = object["errors"] as? [JSONObject] { + let message = errors.first?["message"] as? String + + errorHandler(ParsingError.irrecoverableError(message: message)) + return + } + + guard let payload = object["payload"] else { + errorHandler(ParsingError.cannotParsePayloadData) + return + } + + if payload is NSNull { + // `payload` can be null such as in the case of a transport error + continue + } + + guard + let payload = payload as? JSONObject, + let data: Data = try? JSONSerializationFormat.serialize(value: payload) + else { + errorHandler(ParsingError.cannotParsePayloadData) + return + } + + dataHandler(data) + + case .unknown: + errorHandler(ParsingError.cannotParseChunkData) + } + } + } + } + + /// Parses the data line of a multipart response chunk + private static func parse(dataLine: String) -> ChunkedDataLine { + if dataLine == Self.heartbeat.description { + return .heartbeat + } + + if dataLine.starts(with: Self.contentTypeHeader.description) { + return .contentHeader(type: (dataLine.components(separatedBy: ":").last ?? dataLine) + .trimmingCharacters(in: .whitespaces) + ) + } + + if + let data = dataLine.data(using: .utf8), + let jsonObject = try? JSONSerializationFormat.deserialize(data: data) as? JSONObject + { + return .json(object: jsonObject) + } + + return .unknown + } +} + +fileprivate extension String { + var isBoundaryPrefix: Bool { self == "--" } +} diff --git a/Sources/Apollo/RequestChainNetworkTransport.swift b/Sources/Apollo/RequestChainNetworkTransport.swift index 3d5e958137..89984f25d6 100644 --- a/Sources/Apollo/RequestChainNetworkTransport.swift +++ b/Sources/Apollo/RequestChainNetworkTransport.swift @@ -69,7 +69,7 @@ open class RequestChainNetworkTransport: NetworkTransport { self.useGETForPersistedQueryRetry = useGETForPersistedQueryRetry } - /// Constructs a default (ie, non-multipart) GraphQL request. + /// Constructs a GraphQL request for the given operation. /// /// Override this method if you need to use a custom subclass of `HTTPRequest`. /// @@ -85,18 +85,36 @@ open class RequestChainNetworkTransport: NetworkTransport { contextIdentifier: UUID? = nil, context: RequestContext? = nil ) -> HTTPRequest { - JSONRequest(operation: operation, - graphQLEndpoint: self.endpointURL, - contextIdentifier: contextIdentifier, - clientName: self.clientName, - clientVersion: self.clientVersion, - additionalHeaders: self.additionalHeaders, - cachePolicy: cachePolicy, - context: context, - autoPersistQueries: self.autoPersistQueries, - useGETForQueries: self.useGETForQueries, - useGETForPersistedQueryRetry: self.useGETForPersistedQueryRetry, - requestBodyCreator: self.requestBodyCreator) + let request = JSONRequest( + operation: operation, + graphQLEndpoint: self.endpointURL, + contextIdentifier: contextIdentifier, + clientName: self.clientName, + clientVersion: self.clientVersion, + additionalHeaders: self.additionalHeaders, + cachePolicy: cachePolicy, + context: context, + autoPersistQueries: self.autoPersistQueries, + useGETForQueries: self.useGETForQueries, + useGETForPersistedQueryRetry: self.useGETForPersistedQueryRetry, + requestBodyCreator: self.requestBodyCreator + ) + + if Operation.operationType == .subscription { + request.addHeader( + name: "Accept", + value: "multipart/mixed;boundary=\"graphql\";\(MultipartResponseSubscriptionParser.protocolSpec),application/json" + ) + } + + if Operation.hasDeferredFragments { + request.addHeader( + name: "Accept", + value: "multipart/mixed;boundary=\"graphql\";\(MultipartResponseDeferParser.protocolSpec),application/json" + ) + } + + return request } // MARK: - NetworkTransport Conformance @@ -113,17 +131,11 @@ open class RequestChainNetworkTransport: NetworkTransport { completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable { let chain = makeChain(operation: operation, callbackQueue: callbackQueue) - let request = self.constructRequest(for: operation, - cachePolicy: cachePolicy, - contextIdentifier: contextIdentifier, - context: context) - - if Operation.operationType == .subscription { - request.addHeader( - name: "Accept", - value: "multipart/mixed;boundary=\"graphql\";subscriptionSpec=1.0,application/json" - ) - } + let request = self.constructRequest( + for: operation, + cachePolicy: cachePolicy, + contextIdentifier: contextIdentifier, + context: context) chain.kickoff(request: request, completion: completionHandler) return chain diff --git a/Sources/Apollo/SelectionSet+DictionaryIntializer.swift b/Sources/Apollo/SelectionSet+DictionaryIntializer.swift new file mode 100644 index 0000000000..dd9b90c0a2 --- /dev/null +++ b/Sources/Apollo/SelectionSet+DictionaryIntializer.swift @@ -0,0 +1,69 @@ +#if !COCOAPODS +import ApolloAPI +#endif + +public enum RootSelectionSetInitializeError: Error { + case hasNonHashableValue +} + +extension RootSelectionSet { + /// Initializes a `SelectionSet` with a raw JSON response object. + /// + /// The process of converting a JSON response into `SelectionSetData` is done by using a + /// `GraphQLExecutor` with a`GraphQLSelectionSetMapper` to parse, validate, and transform + /// the JSON response data into the format expected by `SelectionSet`. + /// + /// - Parameters: + /// - data: A dictionary representing a JSON response object for a GraphQL object. + /// - variables: [Optional] The operation variables that would be used to obtain + /// the given JSON response data. + @_disfavoredOverload + public init( + data: [String: Any], + variables: GraphQLOperation.Variables? = nil + ) throws { + let jsonObject = try Self.convertToAnyHashableValueDict(dict: data) + try self.init(data: jsonObject, variables: variables) + } + + /// Convert dictionary type [String: Any] to [String: AnyHashable] + /// - Parameter dict: [String: Any] type dictionary + /// - Returns: converted [String: AnyHashable] type dictionary + private static func convertToAnyHashableValueDict(dict: [String: Any]) throws -> [String: AnyHashable] { + var result = [String: AnyHashable]() + + for (key, value) in dict { + if let arrayValue = value as? [Any] { + result[key] = try convertToAnyHashableArray(array: arrayValue) + } else { + if let dictValue = value as? [String: Any] { + result[key] = try convertToAnyHashableValueDict(dict: dictValue) + } else if let hashableValue = value as? AnyHashable { + result[key] = hashableValue + } else { + throw RootSelectionSetInitializeError.hasNonHashableValue + } + } + } + return result + } + + /// Convert Any type Array type to AnyHashable type Array + /// - Parameter array: Any type Array + /// - Returns: AnyHashable type Array + private static func convertToAnyHashableArray(array: [Any]) throws -> [AnyHashable] { + var result: [AnyHashable] = [] + for value in array { + if let array = value as? [Any] { + result.append(try convertToAnyHashableArray(array: array)) + } else if let dict = value as? [String: Any] { + result.append(try convertToAnyHashableValueDict(dict: dict)) + } else if let hashable = value as? AnyHashable { + result.append(hashable) + } else { + throw RootSelectionSetInitializeError.hasNonHashableValue + } + } + return result + } +} diff --git a/Sources/Apollo/URLSessionClient.swift b/Sources/Apollo/URLSessionClient.swift index c4954434a2..ba9e6ce3a2 100644 --- a/Sources/Apollo/URLSessionClient.swift +++ b/Sources/Apollo/URLSessionClient.swift @@ -271,7 +271,8 @@ open class URLSessionClient: NSObject, URLSessionDelegate, URLSessionTaskDelegat taskData.append(additionalData: data) if let httpResponse = dataTask.response as? HTTPURLResponse, httpResponse.isMultipart { - guard let boundaryString = httpResponse.multipartBoundary else { + let multipartHeaderComponents = httpResponse.multipartHeaderComponents + guard let boundaryString = multipartHeaderComponents.boundary else { taskData.completionBlock(.failure(URLSessionClientError.missingMultipartBoundary)) return } diff --git a/Sources/ApolloAPI/DataDict.swift b/Sources/ApolloAPI/DataDict.swift index d5e458df26..1f2ba67196 100644 --- a/Sources/ApolloAPI/DataDict.swift +++ b/Sources/ApolloAPI/DataDict.swift @@ -1,3 +1,5 @@ +import Foundation + /// A structure that wraps the underlying data for a ``SelectionSet``. public struct DataDict: Hashable { @usableFromInline var _storage: _Storage @@ -42,20 +44,35 @@ public struct DataDict: Hashable { _storage.fulfilledFragments } + @inlinable public var _deferredFragments: Set { + _storage.deferredFragments + } + + #warning("TODO, remove deferredFragments default value when we set these up in executor") public init( data: [String: AnyHashable], - fulfilledFragments: Set + fulfilledFragments: Set, + deferredFragments: Set = [] ) { - self._storage = .init(data: data, fulfilledFragments: fulfilledFragments) + self._storage = .init( + data: data, + fulfilledFragments: fulfilledFragments, + deferredFragments: deferredFragments + ) } @inlinable public subscript(_ key: String) -> T { get { -#if swift(>=5.4) - _data[key] as! T -#else - _data[key]?.base as! T -#endif + if DataDict._AnyHashableCanBeCoerced { + return _data[key] as! T + } else { + let value = _data[key] + if value == DataDict._NullValue { + return (Optional.none as Any) as! T + } else { + return (value?.base as? T) ?? (value._asAnyHashable as! T) + } + } } set { _data[key] = newValue @@ -66,7 +83,7 @@ public struct DataDict: Hashable { yield &value } } - + @inlinable public subscript(_ key: String) -> T { get { T.init(_fieldData: _data[key]) } set { @@ -101,31 +118,68 @@ public struct DataDict: Hashable { @usableFromInline class _Storage: Hashable { @usableFromInline var data: [String: AnyHashable] @usableFromInline let fulfilledFragments: Set + @usableFromInline let deferredFragments: Set init( data: [String: AnyHashable], - fulfilledFragments: Set + fulfilledFragments: Set, + deferredFragments: Set ) { self.data = data self.fulfilledFragments = fulfilledFragments + self.deferredFragments = deferredFragments } @usableFromInline static func ==(lhs: DataDict._Storage, rhs: DataDict._Storage) -> Bool { lhs.data == rhs.data && - lhs.fulfilledFragments == rhs.fulfilledFragments + lhs.fulfilledFragments == rhs.fulfilledFragments && + lhs.deferredFragments == rhs.deferredFragments } @usableFromInline func hash(into hasher: inout Hasher) { hasher.combine(data) hasher.combine(fulfilledFragments) + hasher.combine(deferredFragments) } @usableFromInline func copy() -> _Storage { - _Storage(data: self.data, fulfilledFragments: self.fulfilledFragments) + _Storage( + data: self.data, + fulfilledFragments: self.fulfilledFragments, + deferredFragments: self.deferredFragments + ) } } } +// MARK: - Null Value Definition +extension DataDict { + /// A common value used to represent a null value in a `DataDict`. + /// + /// This value can be cast to `NSNull` and will bridge automatically. + public static let _NullValue = { + if DataDict._AnyHashableCanBeCoerced { + return AnyHashable(Optional.none) + } else { + return NSNull() + } + }() + + /// Indicates if `AnyHashable` can be coerced via casting into its underlying type. + /// + /// In iOS versions 14.4 and lower, `AnyHashable` coercion does not work. On these platforms, + /// we need to do some additional unwrapping and casting of the values to avoid crashes and other + /// run time bugs. + public static let _AnyHashableCanBeCoerced: Bool = { + if #available(iOS 14.5, *) { + return true + } else { + return false + } + }() + +} + // MARK: - Value Conversion Helpers public protocol SelectionSetEntityValue { @@ -160,11 +214,13 @@ extension Optional: SelectionSetEntityValue where Wrapped: SelectionSetEntityVal case .none: self = .none case .some(let hashable): - if let optional = hashable.base as? Optional, optional == nil { - self = .none - return - } + if !DataDict._AnyHashableCanBeCoerced && hashable == DataDict._NullValue { + self = .none + } else if let optional = hashable.base as? Optional, optional == nil { + self = .none + } else { self = .some(Wrapped.init(_fieldData: data)) + } } } @@ -179,11 +235,11 @@ extension Array: SelectionSetEntityValue where Element: SelectionSetEntityValue fatalError("\(Self.self) expected list of data for entity.") } self = data.map { -#if swift(>=5.4) - Element.init(_fieldData:$0) -#else - Element.init(_fieldData:$0?.base as? AnyHashable) -#endif + if DataDict._AnyHashableCanBeCoerced { + return Element.init(_fieldData:$0) + } else { + return Element.init(_fieldData:$0?.base as? AnyHashable) + } } } diff --git a/Sources/ApolloAPI/Deferred.swift b/Sources/ApolloAPI/Deferred.swift new file mode 100644 index 0000000000..e9310c8d11 --- /dev/null +++ b/Sources/ApolloAPI/Deferred.swift @@ -0,0 +1,40 @@ +public protocol Deferrable: SelectionSet { } + +/// Wraps a deferred selection set (either an inline fragment or fragment spread) to expose the +/// fulfilled value as well as the fulfilled state through the projected value. +@propertyWrapper +public struct Deferred { + public enum State { + /// The deferred selection set has not been received yet. + case pending + /// The deferred value can never be fulfilled, such as in the case of a type case mismatch. + case notExecuted + /// The deferred value has been received. + case fulfilled(Fragment) + } + + public init(_dataDict: DataDict) { + __data = _dataDict + } + + public var state: State { + let fragment = ObjectIdentifier(Fragment.self) + if __data._fulfilledFragments.contains(fragment) { + return .fulfilled(Fragment.init(_dataDict: __data)) + } + else if __data._deferredFragments.contains(fragment) { + return .pending + } else { + return .notExecuted + } + } + + private let __data: DataDict + public var projectedValue: State { state } + public var wrappedValue: Fragment? { + guard case let .fulfilled(value) = state else { + return nil + } + return value + } +} diff --git a/Sources/ApolloAPI/FragmentProtocols.swift b/Sources/ApolloAPI/FragmentProtocols.swift index 5895e74c29..88e8e0d576 100644 --- a/Sources/ApolloAPI/FragmentProtocols.swift +++ b/Sources/ApolloAPI/FragmentProtocols.swift @@ -4,7 +4,7 @@ /// /// A ``SelectionSet`` can be converted to any ``Fragment`` included in it's /// `Fragments` object via its ``SelectionSet/fragments-swift.property`` property. -public protocol Fragment: SelectionSet { +public protocol Fragment: SelectionSet, Deferrable { /// The definition of the fragment in GraphQL syntax. static var fragmentDefinition: StaticString { get } } diff --git a/Sources/ApolloAPI/GraphQLOperation.swift b/Sources/ApolloAPI/GraphQLOperation.swift index f31ba287bf..afbd733997 100644 --- a/Sources/ApolloAPI/GraphQLOperation.swift +++ b/Sources/ApolloAPI/GraphQLOperation.swift @@ -59,6 +59,7 @@ public protocol GraphQLOperation: AnyObject, Hashable { static var operationName: String { get } static var operationType: GraphQLOperationType { get } static var operationDocument: OperationDocument { get } + static var hasDeferredFragments: Bool { get } var __variables: Variables? { get } @@ -70,6 +71,12 @@ public extension GraphQLOperation { return nil } + /// `True` if any selection set, or nested selection set, within the operation contains any + /// fragment marked with the `@defer` directive. + static var hasDeferredFragments: Bool { + false + } + static var definition: OperationDefinition? { operationDocument.definition } diff --git a/Sources/ApolloAPI/Info.plist b/Sources/ApolloAPI/Info.plist deleted file mode 100644 index 0e600e67e7..0000000000 --- a/Sources/ApolloAPI/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/ApolloAPI/Selection+Conditions.swift b/Sources/ApolloAPI/Selection+Conditions.swift index ca3ae6919c..f19756c22e 100644 --- a/Sources/ApolloAPI/Selection+Conditions.swift +++ b/Sources/ApolloAPI/Selection+Conditions.swift @@ -30,25 +30,40 @@ public extension Selection { } } - struct Condition: ExpressibleByStringLiteral, Hashable { - public let variableName: String - public let inverted: Bool + enum Condition: ExpressibleByStringLiteral, ExpressibleByBooleanLiteral, Hashable { + case value(Bool) + case variable(name: String, inverted: Bool) public init( variableName: String, inverted: Bool ) { - self.variableName = variableName - self.inverted = inverted; + self = .variable(name: variableName, inverted: inverted) } public init(stringLiteral value: StringLiteralType) { - self.variableName = value - self.inverted = false + self = .variable(name: value, inverted: false) } - @inlinable public static prefix func !(value: Condition) -> Condition { - .init(variableName: value.variableName, inverted: !value.inverted) + public init(booleanLiteral value: BooleanLiteralType) { + self = .value(value) + } + + @inlinable public static func `if`(_ condition: StringLiteralType) -> Condition { + .variable(name: condition, inverted: false) + } + + @inlinable public static func `if`(_ condition: Condition) -> Condition { + condition + } + + @inlinable public static prefix func !(condition: Condition) -> Condition { + switch condition { + case let .value(value): + return .value(!value) + case let .variable(name, inverted): + return .init(variableName: name, inverted: !inverted) + } } @inlinable public static func &&(_ lhs: Condition, rhs: Condition) -> [Condition] { @@ -101,19 +116,24 @@ fileprivate extension Array where Element == Selection.Condition { // MARK: Conditions - Individual fileprivate extension Selection.Condition { func evaluate(with variables: GraphQLOperation.Variables?) -> Bool { - switch variables?[variableName] { - case let boolValue as Bool: - return inverted ? !boolValue : boolValue - - case let nullable as GraphQLNullable: - let evaluated = nullable.unwrapped ?? false - return inverted ? !evaluated : evaluated - - case .none: - return false + switch self { + case let .value(value): + return value + case let .variable(variableName, inverted): + switch variables?[variableName] { + case let boolValue as Bool: + return inverted ? !boolValue : boolValue + + case let nullable as GraphQLNullable: + let evaluated = nullable.unwrapped ?? false + return inverted ? !evaluated : evaluated + + case .none: + return false - case let .some(wrapped): - fatalError("Expected Bool for \(variableName), got \(wrapped)") + case let .some(wrapped): + fatalError("Expected Bool for \(variableName), got \(wrapped)") + } } } } diff --git a/Sources/ApolloAPI/Selection.swift b/Sources/ApolloAPI/Selection.swift index e574c64684..46c62c4e37 100644 --- a/Sources/ApolloAPI/Selection.swift +++ b/Sources/ApolloAPI/Selection.swift @@ -5,6 +5,8 @@ public enum Selection { case fragment(any Fragment.Type) /// An inline fragment with a child selection set nested in a parent selection set. case inlineFragment(any InlineFragment.Type) + /// A fragment spread or inline fragment marked with the `@defer` directive. + case deferred(if: Condition? = nil, any Deferrable.Type, label: String?) /// A group of selections that have `@include/@skip` directives. case conditional(Conditions, [Selection]) @@ -129,14 +131,18 @@ extension Selection: Hashable { switch (lhs, rhs) { case let (.field(lhs), .field(rhs)): return lhs == rhs - case let (.fragment(lhs), .fragment(rhs)): - return lhs == rhs - case let (.inlineFragment(lhs), .inlineFragment(rhs)): - return lhs == rhs + case let (.fragment(lhsFragment), .fragment(rhsFragment)): + return lhsFragment == rhsFragment + case let (.inlineFragment(lhsFragment), .inlineFragment(rhsFragment)): + return lhsFragment == rhsFragment + case let (.deferred(lhsCondition, lhsFragment, lhsLabel), + .deferred(rhsCondition, rhsFragment, rhsLabel)): + return lhsCondition == rhsCondition && + lhsFragment == rhsFragment && + lhsLabel == rhsLabel case let (.conditional(lhsConditions, lhsSelections), .conditional(rhsConditions, rhsSelections)): - return lhsConditions == rhsConditions && - lhsSelections == rhsSelections + return lhsConditions == rhsConditions && lhsSelections == rhsSelections default: return false } } diff --git a/Sources/ApolloCodegenLib/ApolloCodegen.swift b/Sources/ApolloCodegenLib/ApolloCodegen.swift deleted file mode 100644 index 56aa9a742c..0000000000 --- a/Sources/ApolloCodegenLib/ApolloCodegen.swift +++ /dev/null @@ -1,611 +0,0 @@ -import Foundation -import OrderedCollections - -// Only available on macOS -#if os(macOS) - -/// A class to facilitate running code generation -public class ApolloCodegen { - - // MARK: Public - - /// Errors that can occur during code generation. - public enum Error: Swift.Error, LocalizedError { - /// An error occured during validation of the GraphQL schema or operations. - case graphQLSourceValidationFailure(atLines: [String]) - case testMocksInvalidSwiftPackageConfiguration - case inputSearchPathInvalid(path: String) - case schemaNameConflict(name: String) - case cannotLoadSchema - case cannotLoadOperations - case invalidConfiguration(message: String) - case invalidSchemaName(_ name: String, message: String) - case targetNameConflict(name: String) - case typeNameConflict(name: String, conflictingName: String, containingObject: String) - - public var errorDescription: String? { - switch self { - case let .graphQLSourceValidationFailure(lines): - return """ - An error occured during validation of the GraphQL schema or operations! Check \(lines) - """ - case .testMocksInvalidSwiftPackageConfiguration: - return """ - Schema Types must be generated with module type 'swiftPackageManager' to generate a \ - swift package for test mocks. - """ - case let .inputSearchPathInvalid(path): - return """ - Input search path '\(path)' is invalid. Input search paths must include a file \ - extension component. (eg. '.graphql') - """ - case let .schemaNameConflict(name): - return """ - Schema namespace '\(name)' conflicts with name of a type in the generated code. Please \ - choose a different schema name. Suggestions: \(name)Schema, \(name)GraphQL, \(name)API. - """ - case .cannotLoadSchema: - return "A GraphQL schema could not be found. Please verify the schema search paths." - case .cannotLoadOperations: - return "No GraphQL operations could be found. Please verify the operation search paths." - case let .invalidConfiguration(message): - return "The codegen configuration has conflicting values: \(message)" - case let .invalidSchemaName(name, message): - return "The schema namespace `\(name)` is invalid: \(message)" - case let .targetNameConflict(name): - return """ - Target name '\(name)' conflicts with a reserved library name. Please choose a different \ - target name. - """ - case let .typeNameConflict(name, conflictingName, containingObject): - return """ - TypeNameConflict - \ - Field '\(conflictingName)' conflicts with field '\(name)' in operation/fragment `\(containingObject)`. \ - Recommend using a field alias for one of these fields to resolve this conflict. \ - For more info see: https://www.apollographql.com/docs/ios/troubleshooting/codegen-troubleshooting#typenameconflict - """ - } - } - } - - /// OptionSet used to configure what items should be generated during code generation. - public struct ItemsToGenerate: OptionSet { - public var rawValue: Int - - /// Only generate your code (Operations, Fragments, Enums, etc), this option maintains the codegen functionality - /// from before this option set was created. - public static let code = ItemsToGenerate(rawValue: 1 << 0) - - /// Only generate the operation manifest used for persisted queries and automatic persisted queries. - public static let operationManifest = ItemsToGenerate(rawValue: 1 << 1) - - /// Generate all available items during code generation. - public static let all: ItemsToGenerate = [ - .code, - .operationManifest - ] - - public init(rawValue: Int) { - self.rawValue = rawValue - } - - } - - /// Executes the code generation engine with a specified configuration. - /// - /// - Parameters: - /// - configuration: A configuration object that specifies inputs, outputs and behaviours used - /// during code generation. - /// - rootURL: The root `URL` to resolve relative `URL`s in the configuration's paths against. - /// If `nil`, the current working directory of the executing process will be used. - /// - itemsToGenerate: Uses the `ItemsToGenerate` option set to determine what items should be generated during codegen. - /// By default this will use [.code] which maintains how codegen functioned prior to these options being added. - public static func build( - with configuration: ApolloCodegenConfiguration, - withRootURL rootURL: URL? = nil, - itemsToGenerate: ItemsToGenerate = [.code] - ) throws { - try build(with: configuration, rootURL: rootURL, itemsToGenerate: itemsToGenerate) - } - - internal static func build( - with configuration: ApolloCodegenConfiguration, - rootURL: URL? = nil, - fileManager: ApolloFileManager = .default, - itemsToGenerate: ItemsToGenerate - ) throws { - - let configContext = ConfigurationContext( - config: configuration, - rootURL: rootURL - ) - - try validate(configContext) - - let compilationResult = try compileGraphQLResult( - configContext, - experimentalFeatures: configuration.experimentalFeatures - ) - - try validate(configContext, with: compilationResult) - - let ir = IR(compilationResult: compilationResult) - - if itemsToGenerate.contains(.code) { - var existingGeneratedFilePaths = configuration.options.pruneGeneratedFiles ? - try findExistingGeneratedFilePaths( - config: configContext, - fileManager: fileManager - ) : [] - - try generateFiles( - compilationResult: compilationResult, - ir: ir, - config: configContext, - fileManager: fileManager, - itemsToGenerate: itemsToGenerate - ) - - if configuration.options.pruneGeneratedFiles { - try deleteExtraneousGeneratedFiles( - from: &existingGeneratedFilePaths, - afterCodeGenerationUsing: fileManager - ) - } - } else if itemsToGenerate.contains(.operationManifest) { - var operationIDsFileGenerator = OperationManifestFileGenerator(config: configContext) - for operation in compilationResult.operations { - autoreleasepool { - let irOperation = ir.build(operation: operation) - operationIDsFileGenerator?.collectOperationIdentifier(irOperation) - } - } - try operationIDsFileGenerator?.generate(fileManager: fileManager) - } - } - - // MARK: Internal - - @dynamicMemberLookup - class ConfigurationContext { - let config: ApolloCodegenConfiguration - let pluralizer: Pluralizer - let rootURL: URL? - - init( - config: ApolloCodegenConfiguration, - rootURL: URL? = nil - ) { - self.config = config - self.pluralizer = Pluralizer(rules: config.options.additionalInflectionRules) - self.rootURL = rootURL?.standardizedFileURL - } - - subscript(dynamicMember keyPath: KeyPath) -> T { - config[keyPath: keyPath] - } - } - - /// Validates the configuration against deterministic errors that will cause code generation to - /// fail. This validation step does not take into account schema and operation specific types, it - /// is only a static analysis of the configuration. - /// - /// - Parameter config: Code generation configuration settings. - public static func _validate(config: ApolloCodegenConfiguration) throws { - try validate(ConfigurationContext(config: config)) - } - - static private func validate(_ context: ConfigurationContext) throws { - guard - !context.schemaNamespace.isEmpty, - !context.schemaNamespace.contains(where: { $0.isWhitespace }) - else { - throw Error.invalidSchemaName(context.schemaNamespace, message: """ - Cannot be empty nor contain spaces. If your schema namespace has spaces consider \ - replacing them with the underscore character. - """) - } - - guard - !SwiftKeywords.DisallowedSchemaNamespaceNames.contains(context.schemaNamespace.lowercased()) - else { - throw Error.schemaNameConflict(name: context.schemaNamespace) - } - - if case .swiftPackage = context.output.testMocks, - context.output.schemaTypes.moduleType != .swiftPackageManager { - throw Error.testMocksInvalidSwiftPackageConfiguration - } - - if case .swiftPackageManager = context.output.schemaTypes.moduleType, - context.options.cocoapodsCompatibleImportStatements == true { - throw Error.invalidConfiguration(message: """ - cocoapodsCompatibleImportStatements cannot be set to 'true' when the output schema types \ - module type is Swift Package Manager. Change the cocoapodsCompatibleImportStatements \ - value to 'false', or choose a different module type, to resolve the conflict. - """) - } - - if case let .embeddedInTarget(targetName, _) = context.output.schemaTypes.moduleType, - SwiftKeywords.DisallowedEmbeddedTargetNames.contains(targetName.lowercased()) { - throw Error.targetNameConflict(name: targetName) - } - - for searchPath in context.input.schemaSearchPaths { - try validate(inputSearchPath: searchPath) - } - for searchPath in context.input.operationSearchPaths { - try validate(inputSearchPath: searchPath) - } - } - - static private func validate(inputSearchPath: String) throws { - guard inputSearchPath.contains(".") && !inputSearchPath.hasSuffix(".") else { - throw Error.inputSearchPathInvalid(path: inputSearchPath) - } - } - - /// Validates the configuration context against the GraphQL compilation result, checking for - /// configuration errors that are dependent on the schema and operations. - static func validate(_ context: ConfigurationContext, with compilationResult: CompilationResult) throws { - guard - !compilationResult.referencedTypes.contains(where: { namedType in - namedType.swiftName == context.schemaNamespace.firstUppercased - }), - !compilationResult.fragments.contains(where: { fragmentDefinition in - fragmentDefinition.name == context.schemaNamespace.firstUppercased - }) - else { - throw Error.schemaNameConflict(name: context.schemaNamespace) - } - } - - /// Validates that there are no type conflicts within a SelectionSet - static private func validateTypeConflicts( - for selectionSet: IR.SelectionSet, - with context: ConfigurationContext, - in containingObject: String, - including parentTypes: [String: String] = [:] - ) throws { - // Check for type conflicts resulting from singularization/pluralization of fields - var typeNamesByFormattedTypeName = [String: String]() - - var fields: [IR.EntityField] = selectionSet.selections.direct?.fields.values.compactMap { $0 as? IR.EntityField } ?? [] - fields.append(contentsOf: selectionSet.selections.merged.fields.values.compactMap { $0 as? IR.EntityField } ) - - try fields.forEach { field in - let formattedTypeName = field.formattedSelectionSetName(with: context.pluralizer) - if let existingFieldName = typeNamesByFormattedTypeName[formattedTypeName] { - throw Error.typeNameConflict( - name: existingFieldName, - conflictingName: field.name, - containingObject: containingObject - ) - } - typeNamesByFormattedTypeName[formattedTypeName] = field.name - } - - // Combine `parentTypes` and `typeNamesByFormattedTypeName` to check against fragment names and - // pass into recursive function calls - var combinedTypeNames = parentTypes - combinedTypeNames.merge(typeNamesByFormattedTypeName) { (current, _) in current } - - // passing each fields selection set for validation after we have fully built our `typeNamesByFormattedTypeName` dictionary - try fields.forEach { field in - try validateTypeConflicts( - for: field.selectionSet, - with: context, - in: containingObject, - including: combinedTypeNames - ) - } - - var namedFragments: [IR.NamedFragment] = selectionSet.selections.direct?.namedFragments.values.map(\.fragment) ?? [] - namedFragments.append(contentsOf: selectionSet.selections.merged.namedFragments.values.map(\.fragment)) - - try namedFragments.forEach { fragment in - if let existingTypeName = combinedTypeNames[fragment.generatedDefinitionName] { - throw Error.typeNameConflict( - name: existingTypeName, - conflictingName: fragment.name, - containingObject: containingObject - ) - } - } - - // gather nested fragments to loop through and check as well - var nestedSelectionSets: [IR.SelectionSet] = selectionSet.selections.direct?.inlineFragments.values.map(\.selectionSet) ?? [] - nestedSelectionSets.append(contentsOf: selectionSet.selections.merged.inlineFragments.values.map(\.selectionSet)) - - try nestedSelectionSets.forEach { nestedSet in - try validateTypeConflicts( - for: nestedSet, - with: context, - in: containingObject, - including: combinedTypeNames - ) - } - } - - /// Performs GraphQL source validation and compiles the schema and operation source documents. - static func compileGraphQLResult( - _ config: ConfigurationContext, - experimentalFeatures: ApolloCodegenConfiguration.ExperimentalFeatures = .init() - ) throws -> CompilationResult { - let frontend = try GraphQLJSFrontend() - let graphQLSchema = try createSchema(config, frontend) - let operationsDocument = try createOperationsDocument(config, frontend, experimentalFeatures) - let validationOptions = ValidationOptions(config: config) - - let graphqlErrors = try frontend.validateDocument( - schema: graphQLSchema, - document: operationsDocument, - validationOptions: validationOptions - ) - - guard graphqlErrors.isEmpty else { - let errorlines = graphqlErrors.flatMap({ - if let logLines = $0.logLines { - return logLines - } else { - return ["\($0.name ?? "unknown"): \($0.message ?? "")"] - } - }) - CodegenLogger.log(errorlines.joined(separator: "\n"), logLevel: .error) - throw Error.graphQLSourceValidationFailure(atLines: errorlines) - } - - return try frontend.compile( - schema: graphQLSchema, - document: operationsDocument, - experimentalLegacySafelistingCompatibleOperations: experimentalFeatures.legacySafelistingCompatibleOperations, - validationOptions: validationOptions - ) - } - - static func createSchema( - _ config: ConfigurationContext, - _ frontend: GraphQLJSFrontend - ) throws -> GraphQLSchema { - - let matches = try match( - searchPaths: config.input.schemaSearchPaths, - relativeTo: config.rootURL - ) - - guard !matches.isEmpty else { - throw Error.cannotLoadSchema - } - - let sources = try matches.map { try frontend.makeSource(from: URL(fileURLWithPath: $0)) } - return try frontend.loadSchema(from: sources) - } - - static func createOperationsDocument( - _ config: ConfigurationContext, - _ frontend: GraphQLJSFrontend, - _ experimentalFeatures: ApolloCodegenConfiguration.ExperimentalFeatures - ) throws -> GraphQLDocument { - - let matches = try match( - searchPaths: config.input.operationSearchPaths, - relativeTo: config.rootURL) - - guard !matches.isEmpty else { - throw Error.cannotLoadOperations - } - - let documents = try matches.map({ path in - return try frontend.parseDocument( - from: URL(fileURLWithPath: path), - experimentalClientControlledNullability: experimentalFeatures.clientControlledNullability - ) - }) - return try frontend.mergeDocuments(documents) - } - - static func match(searchPaths: [String], relativeTo relativeURL: URL?) throws -> OrderedSet { - let excludedDirectories = [ - ".build", - ".swiftpm", - ".Pods"] - - return try Glob(searchPaths, relativeTo: relativeURL) - .match(excludingDirectories: excludedDirectories) - } - - /// Generates Swift files for the compiled schema, ir and configured output structure. - static func generateFiles( - compilationResult: CompilationResult, - ir: IR, - config: ConfigurationContext, - fileManager: ApolloFileManager = .default, - itemsToGenerate: ItemsToGenerate - ) throws { - for fragment in compilationResult.fragments { - try autoreleasepool { - let irFragment = ir.build(fragment: fragment) - try validateTypeConflicts(for: irFragment.rootField.selectionSet, with: config, in: irFragment.definition.name) - try FragmentFileGenerator(irFragment: irFragment, config: config) - .generate(forConfig: config, fileManager: fileManager) - } - } - - var operationIDsFileGenerator: OperationManifestFileGenerator? - if itemsToGenerate.contains(.operationManifest) { - operationIDsFileGenerator = OperationManifestFileGenerator(config: config) - } - - for operation in compilationResult.operations { - try autoreleasepool { - let irOperation = ir.build(operation: operation) - try validateTypeConflicts(for: irOperation.rootField.selectionSet, with: config, in: irOperation.definition.name) - try OperationFileGenerator(irOperation: irOperation, config: config) - .generate(forConfig: config, fileManager: fileManager) - - if itemsToGenerate.contains(.operationManifest) { - operationIDsFileGenerator?.collectOperationIdentifier(irOperation) - } - } - } - - if itemsToGenerate.contains(.operationManifest) { - try operationIDsFileGenerator?.generate(fileManager: fileManager) - } - - for graphQLObject in ir.schema.referencedTypes.objects { - try autoreleasepool { - try ObjectFileGenerator( - graphqlObject: graphQLObject, - config: config - ).generate( - forConfig: config, - fileManager: fileManager - ) - - if config.output.testMocks != .none { - try MockObjectFileGenerator( - graphqlObject: graphQLObject, - ir: ir, - config: config - ).generate( - forConfig: config, - fileManager: fileManager - ) - } - } - } - - for graphQLEnum in ir.schema.referencedTypes.enums { - try autoreleasepool { - try EnumFileGenerator(graphqlEnum: graphQLEnum, config: config) - .generate(forConfig: config, fileManager: fileManager) - } - } - - for graphQLInterface in ir.schema.referencedTypes.interfaces { - try autoreleasepool { - try InterfaceFileGenerator(graphqlInterface: graphQLInterface, config: config) - .generate(forConfig: config, fileManager: fileManager) - } - } - - for graphQLUnion in ir.schema.referencedTypes.unions { - try autoreleasepool { - try UnionFileGenerator( - graphqlUnion: graphQLUnion, - config: config - ).generate( - forConfig: config, - fileManager: fileManager - ) - } - } - - for graphQLInputObject in ir.schema.referencedTypes.inputObjects { - try autoreleasepool { - try InputObjectFileGenerator( - graphqlInputObject: graphQLInputObject, - config: config - ).generate( - forConfig: config, - fileManager: fileManager - ) - } - } - - for graphQLScalar in ir.schema.referencedTypes.customScalars { - try autoreleasepool { - try CustomScalarFileGenerator(graphqlScalar: graphQLScalar, config: config) - .generate(forConfig: config, fileManager: fileManager) - } - } - - if config.output.testMocks != .none { - try MockUnionsFileGenerator( - ir: ir, - config: config - )?.generate( - forConfig: config, - fileManager: fileManager - ) - try MockInterfacesFileGenerator( - ir: ir, - config: config - )?.generate( - forConfig: config, - fileManager: fileManager - ) - } - - try SchemaMetadataFileGenerator(schema: ir.schema, config: config) - .generate(forConfig: config, fileManager: fileManager) - try SchemaConfigurationFileGenerator(config: config) - .generate(forConfig: config, fileManager: fileManager) - - try SchemaModuleFileGenerator.generate(config, fileManager: fileManager) - } - - private static func findExistingGeneratedFilePaths( - config: ConfigurationContext, - fileManager: ApolloFileManager = .default - ) throws -> Set { - var globs: [Glob] = [] - globs.append(Glob( - ["\(config.output.schemaTypes.path)/**/*.graphql.swift"], - relativeTo: config.rootURL - )) - - switch config.output.operations { - case .inSchemaModule: break - - case let .absolute(operationsPath, _): - globs.append(Glob( - ["\(operationsPath)/**/*.graphql.swift"], - relativeTo: config.rootURL - )) - - case let .relative(subpath, _): - let searchPaths = config.input.operationSearchPaths.map { searchPath -> String in - let startOfLastPathComponent = searchPath.lastIndex(of: "/") ?? searchPath.firstIndex(of: ".")! - var path = searchPath.prefix(upTo: startOfLastPathComponent) - if let subpath = subpath { - path += "/\(subpath)" - } - path += "/*.graphql.swift" - return path.description - } - - globs.append(Glob( - searchPaths, - relativeTo: config.rootURL - )) - } - - switch config.output.testMocks { - case let .absolute(testMocksPath, _): - globs.append(Glob( - ["\(testMocksPath)/**/*.graphql.swift"], - relativeTo: config.rootURL - )) - default: break - } - - return try globs.reduce(into: []) { partialResult, glob in - partialResult.formUnion(try glob.match()) - } - } - - static func deleteExtraneousGeneratedFiles( - from oldGeneratedFilePaths: inout Set, - afterCodeGenerationUsing fileManager: ApolloFileManager - ) throws { - oldGeneratedFilePaths.subtract(fileManager.writtenFiles) - for path in oldGeneratedFilePaths { - try fileManager.deleteFile(atPath: path) - } - } - -} - -#endif diff --git a/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift b/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift deleted file mode 100644 index aec366c51e..0000000000 --- a/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift +++ /dev/null @@ -1,1521 +0,0 @@ -import Foundation - -/// A configuration object that defines behavior for code generation. -public struct ApolloCodegenConfiguration: Codable, Equatable { - - // MARK: Input Types - - /// The input paths and files required for code generation. - public struct FileInput: Codable, Equatable { - /// An array of path matching pattern strings used to find GraphQL schema - /// files to be included for code generation. - /// - /// Schema files may contain only spec-compliant - /// [`TypeSystemDocument`](https://spec.graphql.org/draft/#sec-Type-System) or - /// [`TypeSystemExtension`](https://spec.graphql.org/draft/#sec-Type-System-Extensions) - /// definitions in SDL or JSON format. - /// This includes: - /// - [Schema Definitions](https://spec.graphql.org/draft/#SchemaDefinition) - /// - [Type Definitions](https://spec.graphql.org/draft/#TypeDefinition) - /// - [Directive Definitions](https://spec.graphql.org/draft/#DirectiveDefinition) - /// - [Schema Extensions](https://spec.graphql.org/draft/#SchemaExtension) - /// - [Type Extensions](https://spec.graphql.org/draft/#TypeExtension) - /// - /// You can use absolute or relative paths in path matching patterns. Relative paths will be - /// based off the current working directory from `FileManager`. - /// - /// Each path matching pattern can include the following characters: - /// - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - /// - `?` matches any single character, eg: `file-?.graphql` - /// - `**` matches all subdirectories (deep), eg: `**/*.graphql` - /// - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - /// - /// - Precondition: JSON format schema files must have the file extension ".json". - /// When using a JSON format schema file, only a single JSON schema can be provided with any - /// number of additional SDL schema extension files. - public let schemaSearchPaths: [String] - - /// An array of path matching pattern strings used to find GraphQL - /// operation files to be included for code generation. - /// - /// Operation files may contain only spec-compliant - /// [`ExecutableDocument`](https://spec.graphql.org/draft/#ExecutableDocument) - /// definitions in SDL format. - /// This includes: - /// - [Operation Definitions](https://spec.graphql.org/draft/#sec-Language.Operations) - /// (ie. `query`, `mutation`, or `subscription`) - /// - [Fragment Definitions](https://spec.graphql.org/draft/#sec-Language.Fragments) - /// - /// You can use absolute or relative paths in path matching patterns. Relative paths will be - /// based off the current working directory from `FileManager`. - /// - /// Each path matching pattern can include the following characters: - /// - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - /// - `?` matches any single character, eg: `file-?.graphql` - /// - `**` matches all subdirectories (deep), eg: `**/*.graphql` - /// - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - public let operationSearchPaths: [String] - - /// Designated initializer. - /// - /// - Parameters: - /// - schemaSearchPaths: An array of path matching pattern strings used to find GraphQL schema - /// files to be included for code generation. - /// Schema files may contain only spec-compliant - /// [`TypeSystemDocument`](https://spec.graphql.org/draft/#sec-Type-System) or - /// [`TypeSystemExtension`](https://spec.graphql.org/draft/#sec-Type-System-Extensions) - /// definitions in SDL or JSON format. - /// This includes: - /// - [Schema Definitions](https://spec.graphql.org/draft/#SchemaDefinition) - /// - [Type Definitions](https://spec.graphql.org/draft/#TypeDefinition) - /// - [Directive Definitions](https://spec.graphql.org/draft/#DirectiveDefinition) - /// - [Schema Extensions](https://spec.graphql.org/draft/#SchemaExtension) - /// - [Type Extensions](https://spec.graphql.org/draft/#TypeExtension) - /// - /// Defaults to `["**/*.graphqls"]`. - /// - /// - operationSearchPaths: An array of path matching pattern strings used to find GraphQL - /// operation files to be included for code generation. - /// Operation files may contain only spec-compliant - /// [`ExecutableDocument`](https://spec.graphql.org/draft/#ExecutableDocument) - /// definitions in SDL format. - /// This includes: - /// - [Operation Definitions](https://spec.graphql.org/draft/#sec-Language.Operations) - /// (ie. `query`, `mutation`, or `subscription`) - /// - [Fragment Definitions](https://spec.graphql.org/draft/#sec-Language.Fragments) - /// - /// Defaults to `["**/*.graphql"]`. - /// - /// You can use absolute or relative paths in path matching patterns. Relative paths will be - /// based off the current working directory from `FileManager`. - /// - /// Each path matching pattern can include the following characters: - /// - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - /// - `?` matches any single character, eg: `file-?.graphql` - /// - `**` matches all subdirectories (deep), eg: `**/*.graphql` - /// - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - /// - /// - Precondition: JSON format schema files must have the file extension ".json". - /// When using a JSON format schema file, only a single JSON schema can be provided with any - /// number of additional SDL schema extension files. - public init( - schemaSearchPaths: [String] = ["**/*.graphqls"], - operationSearchPaths: [String] = ["**/*.graphql"] - ) { - self.schemaSearchPaths = schemaSearchPaths - self.operationSearchPaths = operationSearchPaths - } - - /// Convenience initializer. - /// - /// - Parameters: - /// - schemaPath: The path to a local GraphQL schema file to be used for code generation. - /// Schema files may contain only spec-compliant - /// [`TypeSystemDocument`](https://spec.graphql.org/draft/#sec-Type-System) or - /// [`TypeSystemExtension`](https://spec.graphql.org/draft/#sec-Type-System-Extensions) - /// definitions in SDL or JSON format. - /// This includes: - /// - [Schema Definitions](https://spec.graphql.org/draft/#SchemaDefinition) - /// - [Type Definitions](https://spec.graphql.org/draft/#TypeDefinition) - /// - [Directive Definitions](https://spec.graphql.org/draft/#DirectiveDefinition) - /// - [Schema Extensions](https://spec.graphql.org/draft/#SchemaExtension) - /// - [Type Extensions](https://spec.graphql.org/draft/#TypeExtension) - /// - /// - operationSearchPaths: An array of path matching pattern strings used to find GraphQL - /// operation files to be included for code generation. - /// Operation files may contain only spec-compliant - /// [`ExecutableDocument`](https://spec.graphql.org/draft/#ExecutableDocument) - /// definitions in SDL format. - /// This includes: - /// - [Operation Definitions](https://spec.graphql.org/draft/#sec-Language.Operations) - /// (ie. `query`, `mutation`, or `subscription`) - /// - [Fragment Definitions](https://spec.graphql.org/draft/#sec-Language.Fragments) - /// - /// Defaults to `["**/*.graphql"]`. - /// - /// You can use absolute or relative paths in path matching patterns. Relative paths will be - /// based off the current working directory from `FileManager`. - /// - /// Each path matching pattern can include the following characters: - /// - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - /// - `?` matches any single character, eg: `file-?.graphql` - /// - `**` matches all subdirectories (deep), eg: `**/*.graphql` - /// - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - /// - /// - Precondition: JSON format schema files must have the file extension ".json". - /// When using a JSON format schema file, only a single JSON schema can be provided with any - /// number of additional SDL schema extension files. - public init( - schemaPath: String, - operationSearchPaths: [String] = ["**/*.graphql"] - ) { - self.schemaSearchPaths = [schemaPath] - self.operationSearchPaths = operationSearchPaths - } - } - - // MARK: Output Types - - /// The paths and files output by code generation. - public struct FileOutput: Codable, Equatable { - /// The local path structure for the generated schema types files. - public let schemaTypes: SchemaTypesFileOutput - /// The local path structure for the generated operation object files. - public let operations: OperationsFileOutput - /// The local path structure for the test mock operation object files. - public let testMocks: TestMockFileOutput - - /// This var helps maintain backwards compatibility with legacy operation manifest generation - /// with the new `OperationManifestConfiguration` and will be fully removed in v2.0 - fileprivate let operationIDsPath: String? - - /// Default property values - public struct Default { - public static let operations: OperationsFileOutput = .inSchemaModule - public static let testMocks: TestMockFileOutput = .none - } - - /// Designated initializer. - /// - /// - Parameters: - /// - schemaTypes: The local path structure for the generated schema types files. - /// - operations: The local path structure for the generated operation object files. - /// Defaults to `.inSchemaModule`. - /// - testMocks: The local path structure for the test mock operation object files. - /// If `.none`, test mocks will not be generated. Defaults to `.none`. - /// - operationManifest: Configures the generation of an operation manifest JSON file for use - /// with persisted queries or - /// [Automatic Persisted Queries (APQs)](https://www.apollographql.com/docs/apollo-server/performance/apq). - /// Defaults to `nil`. - public init( - schemaTypes: SchemaTypesFileOutput, - operations: OperationsFileOutput = Default.operations, - testMocks: TestMockFileOutput = Default.testMocks - ) { - self.schemaTypes = schemaTypes - self.operations = operations - self.testMocks = testMocks - self.operationIDsPath = nil - } - - // MARK: Codable - - enum CodingKeys: CodingKey, CaseIterable { - case schemaTypes - case operations - case testMocks - case operationIdentifiersPath - } - - /// `Decodable` implementation to allow for properties to be optional in the encoded JSON with - /// specified defaults when not present. - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - try throwIfContainsUnexpectedKey(container: values, type: Self.self, decoder: decoder) - schemaTypes = try values.decode( - SchemaTypesFileOutput.self, - forKey: .schemaTypes - ) - operations = try values.decode( - OperationsFileOutput.self, - forKey: .operations - ) - testMocks = try values.decode( - TestMockFileOutput.self, - forKey: .testMocks - ) - - operationIDsPath = try values.decodeIfPresent( - String.self, - forKey: .operationIdentifiersPath - ) - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - - try container.encode(self.schemaTypes, forKey: .schemaTypes) - try container.encode(self.operations, forKey: .operations) - try container.encode(self.testMocks, forKey: .testMocks) - } - } - - /// Swift access control configuration. - public enum AccessModifier: String, Codable, Equatable { - /// Enable entities to be used within any source file from their defining module, and also in - /// a source file from another module that imports the defining module. - case `public` - /// Enable entities to be used within any source file from their defining module, but not in - /// any source file outside of that module. - case `internal` - } - - /// The local path structure for the generated schema types files. - public struct SchemaTypesFileOutput: Codable, Equatable { - /// Local path where the generated schema types files should be stored. - public let path: String - /// How to package the schema types for dependency management. - public let moduleType: ModuleType - - /// Designated initializer. - /// - /// - Parameters: - /// - path: Local path where the generated schema type files should be stored. - /// - moduleType: Type of module that will be created for the schema types files. - public init( - path: String, - moduleType: ModuleType - ) { - self.path = path - self.moduleType = moduleType - } - - /// Compatible dependency manager automation. - public enum ModuleType: Codable, Equatable { - /// Generated schema types will be manually embedded in a target with the specified `name`. - /// No module will be created for the generated schema types. Use `accessModifier` to control - /// the visibility of generated code, defaults to `.internal`. - /// - /// - Note: Generated files must be manually added to your application target. The generated - /// schema types files will be namespaced with the value of your configuration's - /// `schemaNamespace` to prevent naming conflicts. - case embeddedInTarget(name: String, accessModifier: AccessModifier = .internal) - /// Generates a `Package.swift` file that is suitable for linking the generated schema types - /// files to your project using Swift Package Manager. - case swiftPackageManager - /// No module will be created for the generated types and you are required to create the - /// module to support your preferred dependency manager. You must specify the name of the - /// module you will create in the `schemaNamespace` property as this will be used in `import` - /// statements of generated operation files. - /// - /// Use this option for dependency managers, such as CocoaPods. Example usage would be to - /// create the podspec file that is expecting the generated files in the configured output - /// location. - case other - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - - guard let key = container.allKeys.first else { - throw DecodingError.typeMismatch(Self.self, DecodingError.Context.init( - codingPath: container.codingPath, - debugDescription: "Invalid number of keys found, expected one.", - underlyingError: nil - )) - } - - switch key { - case .embeddedInTarget: - let nestedContainer = try container.nestedContainer( - keyedBy: EmbeddedInTargetCodingKeys.self, - forKey: .embeddedInTarget - ) - - let name = try nestedContainer.decode(String.self, forKey: .name) - let accessModifier = try nestedContainer.decodeIfPresent( - AccessModifier.self, - forKey: .accessModifier - ) ?? .internal - - self = .embeddedInTarget(name: name, accessModifier: accessModifier) - - case .swiftPackageManager: - self = .swiftPackageManager - - case .other: - self = .other - } - } - } - } - - /// The local path structure for the generated operation object files. - public enum OperationsFileOutput: Codable, Equatable { - /// All operation object files will be located in the module with the schema types. - case inSchemaModule - /// Operation object files will be co-located relative to the defining operation `.graphql` - /// file. If `subpath` is specified a subfolder will be created relative to the `.graphql` file - /// and the operation object files will be generated there. If no `subpath` is defined then all - /// operation object files will be generated alongside the `.graphql` file. Use `accessModifier` - /// to control the visibility of generated code, defaults to `.public`. - case relative(subpath: String? = nil, accessModifier: AccessModifier = .public) - /// All operation object files will be located in the specified `path`. Use `accessModifier` to - /// control the visibility of generated code, defaults to `.public`. - case absolute(path: String, accessModifier: AccessModifier = .public) - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - - guard let key = container.allKeys.first else { - throw DecodingError.typeMismatch(Self.self, DecodingError.Context.init( - codingPath: container.codingPath, - debugDescription: "Invalid number of keys found, expected one.", - underlyingError: nil - )) - } - - switch key { - case .inSchemaModule: - self = .inSchemaModule - - case .relative: - let nestedContainer = try container.nestedContainer( - keyedBy: RelativeCodingKeys.self, - forKey: .relative - ) - - let subpath = try nestedContainer.decodeIfPresent(String.self, forKey: .subpath) - let accessModifier = try nestedContainer.decodeIfPresent( - AccessModifier.self, - forKey: .accessModifier - ) ?? .public - - self = .relative(subpath: subpath, accessModifier: accessModifier) - - case .absolute: - let nestedContainer = try container.nestedContainer( - keyedBy: AbsoluteCodingKeys.self, - forKey: .absolute - ) - - let path = try nestedContainer.decode(String.self, forKey: .path) - let accessModifier = try nestedContainer.decodeIfPresent( - AccessModifier.self, - forKey: .accessModifier - ) ?? .public - - self = .absolute(path: path, accessModifier: accessModifier) - } - } - } - - /// The local path structure for the generated test mock object files. - public enum TestMockFileOutput: Codable, Equatable { - /// Test mocks will not be generated. This is the default value. - case none - /// Generated test mock files will be located in the specified `path`. Use `accessModifier` to - /// control the visibility of generated code, defaults to `.public`. - /// No module will be created for the generated test mocks. - /// - /// - Note: Generated files must be manually added to your test target. Test mocks generated - /// this way may also be manually embedded in a test utility module that is imported by your - /// test target. - case absolute(path: String, accessModifier: AccessModifier = .public) - /// Generated test mock files will be included in a target defined in the generated - /// `Package.swift` file that is suitable for linking the generated test mock files to your - /// test target using Swift Package Manager. - /// - /// The name of the test mock target can be specified with the `targetName` value. - /// If no target name is provided, the target name defaults to "\(schemaNamespace)TestMocks". - /// - /// - Note: This requires your `SchemaTypesFileOutput.ModuleType` to be `.swiftPackageManager`. - /// If this option is provided without the `.swiftPackageManager` module type, code generation - /// will fail. - case swiftPackage(targetName: String? = nil) - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - - guard let key = container.allKeys.first else { - throw DecodingError.typeMismatch(Self.self, DecodingError.Context.init( - codingPath: container.codingPath, - debugDescription: "Invalid number of keys found, expected one.", - underlyingError: nil - )) - } - - switch key { - case .none: - self = .none - - case .absolute: - let nestedContainer = try container.nestedContainer( - keyedBy: AbsoluteCodingKeys.self, - forKey: .absolute - ) - - let path = try nestedContainer.decode(String.self, forKey: .path) - let accessModifier = try nestedContainer.decodeIfPresent( - AccessModifier.self, - forKey: .accessModifier - ) ?? .public - - self = .absolute(path: path, accessModifier: accessModifier) - - case .swiftPackage: - let nestedContainer = try container.nestedContainer( - keyedBy: SwiftPackageCodingKeys.self, - forKey: .swiftPackage - ) - - let targetName = try nestedContainer.decode(String.self, forKey: .targetName) - - self = .swiftPackage(targetName: targetName) - } - } - } - - // MARK: - Other Types - public struct OutputOptions: Codable, Equatable { - /// Any non-default rules for pluralization or singularization you wish to include. - public let additionalInflectionRules: [InflectionRule] - /// How deprecated enum cases from the schema should be handled. - public let deprecatedEnumCases: Composition - /// Whether schema documentation is added to the generated files. - public let schemaDocumentation: Composition - /// Which generated selection sets should include generated initializers. - public let selectionSetInitializers: SelectionSetInitializers - /// How to generate the operation documents for your generated operations. - public let operationDocumentFormat: OperationDocumentFormat - /// Generate import statements that are compatible with including `Apollo` via Cocoapods. - /// - /// Cocoapods bundles all files from subspecs into the main target for a pod. This means that - /// when including `Apollo` via Cocoapods, the files in `ApolloAPI` will be added to the - /// `Apollo` target. In order for the generated code to compile, all `import ApolloAPI` - /// statements must be generated as `import Apollo` instead. Setting this option to `true` - /// configures the import statements to be compatible with Cocoapods. - /// - /// Defaults to `false`. - public let cocoapodsCompatibleImportStatements: Bool - /// Annotate generated Swift code with the Swift `available` attribute and `deprecated` - /// argument for parts of the GraphQL schema annotated with the built-in `@deprecated` - /// directive. - public let warningsOnDeprecatedUsage: Composition - /// Rules for how to convert the names of values from the schema in generated code. - public let conversionStrategies: ConversionStrategies - /// Whether unused generated files will be automatically deleted. - /// - /// This will automatically delete any previously generated files that no longer - /// would be generated. - /// - /// This includes: - /// - Operations whose definitions do not exist - /// - `Query`, `Mutation`, `Subscription`, `LocalCacheMutation` - /// - `Fragments` whose definitions do not exist - /// - Schema Types that are no longer referenced - /// - `Object`, `Interface`, `Union` - /// - `TestMocks` for schema types that are no longer referenced - /// - `InputObjects` that are no longer referenced - /// - /// This only prunes files in directories that would have been generated given the current ``ApolloCodegenConfiguration/FileInput`` and ``ApolloCodegenConfiguration/FileOutput`` - /// options. Generated files that are no longer in the search paths of the - /// ``ApolloCodegenConfiguration`` will not be pruned. - /// - /// Defaults to `true`. - public let pruneGeneratedFiles: Bool - /// Whether generated GraphQL operation and local cache mutation class types will be marked as `final`. - public let markOperationDefinitionsAsFinal: Bool - - /// Default property values - public struct Default { - public static let additionalInflectionRules: [InflectionRule] = [] - public static let deprecatedEnumCases: Composition = .include - public static let schemaDocumentation: Composition = .include - public static let selectionSetInitializers: SelectionSetInitializers = [.localCacheMutations] - public static let operationDocumentFormat: OperationDocumentFormat = .definition - public static let cocoapodsCompatibleImportStatements: Bool = false - public static let warningsOnDeprecatedUsage: Composition = .include - public static let conversionStrategies: ConversionStrategies = .init() - public static let pruneGeneratedFiles: Bool = true - public static let markOperationDefinitionsAsFinal: Bool = false - } - - /// Designated initializer. - /// - /// - Parameters: - /// - additionalInflectionRules: Any non-default rules for pluralization or singularization - /// you wish to include. - /// - deprecatedEnumCases: How deprecated enum cases from the schema should be handled. - /// - schemaDocumentation: Whether schema documentation is added to the generated files. - /// - selectionSetInitializers: Which generated selection sets should include - /// generated initializers. - /// - operationDocumentFormat: How to generate the operation documents for your generated operations. - /// - cocoapodsCompatibleImportStatements: Generate import statements that are compatible with - /// including `Apollo` via Cocoapods. - /// - warningsOnDeprecatedUsage: Annotate generated Swift code with the Swift `available` - /// attribute and `deprecated` argument for parts of the GraphQL schema annotated with the - /// built-in `@deprecated` directive. - /// - conversionStrategies: Rules for how to convert the names of values from the schema in - /// generated code. - /// - pruneGeneratedFiles: Whether unused generated files will be automatically deleted. - /// - markOperationDefinitionsAsFinal: Whether generated GraphQL operation and local cache mutation class types will be marked as `final`. - public init( - additionalInflectionRules: [InflectionRule] = Default.additionalInflectionRules, - deprecatedEnumCases: Composition = Default.deprecatedEnumCases, - schemaDocumentation: Composition = Default.schemaDocumentation, - selectionSetInitializers: SelectionSetInitializers = Default.selectionSetInitializers, - operationDocumentFormat: OperationDocumentFormat = Default.operationDocumentFormat, - cocoapodsCompatibleImportStatements: Bool = Default.cocoapodsCompatibleImportStatements, - warningsOnDeprecatedUsage: Composition = Default.warningsOnDeprecatedUsage, - conversionStrategies: ConversionStrategies = Default.conversionStrategies, - pruneGeneratedFiles: Bool = Default.pruneGeneratedFiles, - markOperationDefinitionsAsFinal: Bool = Default.markOperationDefinitionsAsFinal - ) { - self.additionalInflectionRules = additionalInflectionRules - self.deprecatedEnumCases = deprecatedEnumCases - self.schemaDocumentation = schemaDocumentation - self.selectionSetInitializers = selectionSetInitializers - self.operationDocumentFormat = operationDocumentFormat - self.cocoapodsCompatibleImportStatements = cocoapodsCompatibleImportStatements - self.warningsOnDeprecatedUsage = warningsOnDeprecatedUsage - self.conversionStrategies = conversionStrategies - self.pruneGeneratedFiles = pruneGeneratedFiles - self.markOperationDefinitionsAsFinal = markOperationDefinitionsAsFinal - } - - // MARK: Codable - - enum CodingKeys: CodingKey, CaseIterable { - case additionalInflectionRules - case queryStringLiteralFormat - case deprecatedEnumCases - case schemaDocumentation - case selectionSetInitializers - case apqs - case operationDocumentFormat - case cocoapodsCompatibleImportStatements - case warningsOnDeprecatedUsage - case conversionStrategies - case pruneGeneratedFiles - case markOperationDefinitionsAsFinal - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - try throwIfContainsUnexpectedKey(container: values, type: Self.self, decoder: decoder) - - additionalInflectionRules = try values.decodeIfPresent( - [InflectionRule].self, - forKey: .additionalInflectionRules - ) ?? Default.additionalInflectionRules - - deprecatedEnumCases = try values.decodeIfPresent( - Composition.self, - forKey: .deprecatedEnumCases - ) ?? Default.deprecatedEnumCases - - schemaDocumentation = try values.decodeIfPresent( - Composition.self, - forKey: .schemaDocumentation - ) ?? Default.schemaDocumentation - - selectionSetInitializers = try values.decodeIfPresent( - SelectionSetInitializers.self, - forKey: .selectionSetInitializers - ) ?? Default.selectionSetInitializers - - operationDocumentFormat = try values.decodeIfPresent( - OperationDocumentFormat.self, - forKey: .operationDocumentFormat - ) ?? - values.decodeIfPresent( - APQConfig.self, - forKey: .apqs - )?.operationDocumentFormat ?? - Default.operationDocumentFormat - - cocoapodsCompatibleImportStatements = try values.decodeIfPresent( - Bool.self, - forKey: .cocoapodsCompatibleImportStatements - ) ?? Default.cocoapodsCompatibleImportStatements - - warningsOnDeprecatedUsage = try values.decodeIfPresent( - Composition.self, - forKey: .warningsOnDeprecatedUsage - ) ?? Default.warningsOnDeprecatedUsage - - conversionStrategies = try values.decodeIfPresent( - ConversionStrategies.self, - forKey: .conversionStrategies - ) ?? Default.conversionStrategies - - pruneGeneratedFiles = try values.decodeIfPresent( - Bool.self, - forKey: .pruneGeneratedFiles - ) ?? Default.pruneGeneratedFiles - - markOperationDefinitionsAsFinal = try values.decodeIfPresent( - Bool.self, - forKey: .markOperationDefinitionsAsFinal - ) ?? Default.markOperationDefinitionsAsFinal - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - - try container.encode(self.additionalInflectionRules, forKey: .additionalInflectionRules) - try container.encode(self.deprecatedEnumCases, forKey: .deprecatedEnumCases) - try container.encode(self.schemaDocumentation, forKey: .schemaDocumentation) - try container.encode(self.selectionSetInitializers, forKey: .selectionSetInitializers) - try container.encode(self.operationDocumentFormat, forKey: .operationDocumentFormat) - try container.encode(self.cocoapodsCompatibleImportStatements, forKey: .cocoapodsCompatibleImportStatements) - try container.encode(self.warningsOnDeprecatedUsage, forKey: .warningsOnDeprecatedUsage) - try container.encode(self.conversionStrategies, forKey: .conversionStrategies) - try container.encode(self.pruneGeneratedFiles, forKey: .pruneGeneratedFiles) - try container.encode(self.markOperationDefinitionsAsFinal, forKey: .markOperationDefinitionsAsFinal) - } - } - - /// Composition is used as a substitute for a boolean where context is better placed in the value - /// instead of the parameter name, e.g.: `includeDeprecatedEnumCases = true` vs. - /// `deprecatedEnumCases = .include`. - public enum Composition: String, Codable, Equatable { - case include - case exclude - } - - /// ``ConversionStrategies`` configures rules for how to convert the names of values from the - /// schema in generated code. - public struct ConversionStrategies: Codable, Equatable { - - /// ``ApolloCodegenConfiguration/ConversionStrategies/EnumCase`` is used to specify the strategy - /// used to convert the casing of enum cases in a GraphQL schema into generated Swift code. - public enum EnumCases: String, Codable, Equatable { - /// Generates swift code using the exact name provided in the GraphQL schema - /// performing no conversion. - case none - /// Convert to lower camel case from `snake_case`, `UpperCamelCase`, or `UPPERCASE`. - case camelCase - } - - /// ``ApolloCodegenConfiguration/ConversionStrategies/FieldAccessors`` is used to specify the - /// strategy used to convert the casing of fields on GraphQL selection sets into field accessors - /// on the response models in generated Swift code. - public enum FieldAccessors: String, Codable, Equatable { - /// This conversion strategy will: - /// - Lowercase the first letter of all fields. - /// - Convert field names that are all `UPPERCASE` to all `lowercase`. - case idiomatic - /// This conversion strategy will: - /// - Convert to `lowerCamelCase` from `snake_case`, or `UpperCamelCase`. - /// - Convert field names that are all `UPPERCASE` to all `lowercase`. - case camelCase - } - - /// Determines how the names of enum cases in the GraphQL schema will be converted into - /// cases on the generated Swift enums. - /// Defaultss to ``ApolloCodegenConfiguration/CaseConversionStrategy/camelCase`` - public let enumCases: EnumCases - - /// Determines how the names of fields in the GraphQL schema will be converted into - /// properties in the generated Swift code. - /// Defaults to ``ApolloCodegenConfiguration/CaseConversionStrategy/camelCase`` - public let fieldAccessors: FieldAccessors - - /// Default property values - public struct Default { - public static let enumCases: EnumCases = .camelCase - public static let fieldAccessors: FieldAccessors = .idiomatic - } - - public init( - enumCases: EnumCases = Default.enumCases, - fieldAccessors: FieldAccessors = Default.fieldAccessors - ) { - self.enumCases = enumCases - self.fieldAccessors = fieldAccessors - } - - // MARK: Codable - - public enum CodingKeys: CodingKey { - case enumCases - case fieldAccessors - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - guard values.allKeys.first != nil else { - throw DecodingError.typeMismatch(Self.self, DecodingError.Context.init( - codingPath: values.codingPath, - debugDescription: "Invalid value found.", - underlyingError: nil - )) - } - - if let deprecatedEnumCase = try? values.decodeIfPresent( - CaseConversionStrategy.self, - forKey: .enumCases - ) { - switch deprecatedEnumCase { - case .none: - enumCases = .none - case .camelCase: - enumCases = .camelCase - } - } else { - enumCases = try values.decodeIfPresent( - EnumCases.self, - forKey: .enumCases - ) ?? Default.enumCases - } - - fieldAccessors = try values.decodeIfPresent( - FieldAccessors.self, - forKey: .fieldAccessors - ) ?? Default.fieldAccessors - } - } - - // MARK: - OperationDocumentFormat - - public struct OperationDocumentFormat: OptionSet, Codable, Equatable { - /// Include the GraphQL source document for the operation in the generated operation models. - public static let definition = Self(rawValue: 1) - /// Include the computed operation identifier hash for use with persisted queries - /// or [Automatic Persisted Queries (APQs)](https://www.apollographql.com/docs/apollo-server/performance/apq). - public static let operationId = Self(rawValue: 1 << 1) - - public var rawValue: UInt8 - public init(rawValue: UInt8) { - self.rawValue = rawValue - } - - // MARK: Codable - - public enum CodingKeys: String, CodingKey { - case definition - case operationId - } - - public init(from decoder: Decoder) throws { - self = OperationDocumentFormat(rawValue: 0) - - var container = try decoder.unkeyedContainer() - while !container.isAtEnd { - let value = try container.decode(String.self) - switch CodingKeys(rawValue: value) { - case .definition: - self.insert(.definition) - case .operationId: - self.insert(.operationId) - default: continue - } - } - guard self.rawValue != 0 else { - throw DecodingError.valueNotFound( - OperationDocumentFormat.self, - .init(codingPath: [ - ApolloCodegenConfiguration.CodingKeys.options, - OutputOptions.CodingKeys.operationDocumentFormat - ], debugDescription: "operationDocumentFormat configuration cannot be empty.")) - } - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.unkeyedContainer() - if self.contains(.definition) { - try container.encode(CodingKeys.definition.rawValue) - } - if self.contains(.operationId) { - try container.encode(CodingKeys.operationId.rawValue) - } - } - } - - /// The ``SelectionSetInitializers`` configuration is used to determine if you would like - /// initializers to be generated for your generated selection set models. - /// - /// There are three categories of selection set models that initializers can be generated for: - /// - Operations - /// - Named fragments - /// - Local cache mutations - /// - /// By default, initializers are only generated for local cache mutations. - /// - /// ``SelectionSetInitializers`` functions like an `OptionSet`, allowing you to combine multiple - /// different instances together to indicate all the types you would like to generate - /// initializers for. - public struct SelectionSetInitializers: Codable, Equatable, ExpressibleByArrayLiteral { - private var options: SelectionSetInitializers.Options - private var definitions: Set - - /// Option to generate initializers for all named fragments. - public static let namedFragments: SelectionSetInitializers = .init(.namedFragments) - - /// Option to generate initializers for all operations (queries, mutations, subscriptions) - /// that are not local cache mutations. - public static let operations: SelectionSetInitializers = .init(.operations) - - /// Option to generate initializers for all local cache mutations. - public static let localCacheMutations: SelectionSetInitializers = .init(.localCacheMutations) - - /// Option to generate initializers for all models. - /// This includes named fragments, operations, and local cache mutations. - public static let all: SelectionSetInitializers = [ - .namedFragments, .operations, .localCacheMutations - ] - - /// An option to generate initializers for a single operation with a given name. - public static func operation(named: String) -> SelectionSetInitializers { - .init(definitionName: named) - } - - /// An option to generate initializers for a single fragment with a given name. - public static func fragment(named: String) -> SelectionSetInitializers { - .init(definitionName: named) - } - - /// Initializes a `SelectionSetInitializer` with an array of values. - public init(arrayLiteral elements: SelectionSetInitializers...) { - guard var options = elements.first else { - self.options = [] - self.definitions = [] - return - } - for element in elements.suffix(from: 1) { - options.insert(element) - } - self = options - } - - /// Inserts a `SelectionSetInitializer` into the receiver. - public mutating func insert(_ member: SelectionSetInitializers) { - self.options = self.options.union(member.options) - self.definitions = self.definitions.union(member.definitions) - } - } - - public struct ExperimentalFeatures: Codable, Equatable { - /** - * **EXPERIMENTAL**: If enabled, the parser will understand and parse Client Controlled Nullability - * Designators contained in Fields. They'll be represented in the - * `required` field of the FieldNode. - * - * The syntax looks like the following: - * - * ```graphql - * { - * nullableField! - * nonNullableField? - * nonNullableSelectionSet? { - * childField! - * } - * } - * ``` - * - Note: This feature is experimental and may change or be removed in the - * future. - */ - public let clientControlledNullability: Bool - - /** - * **EXPERIMENTAL**: If enabled, the generated operations will be transformed using a method - * that attempts to maintain compatibility with the legacy behavior from - * [`apollo-tooling`](https://github.com/apollographql/apollo-tooling) - * for registering persisted operation to a safelist. - * - * - Note: Safelisting queries is a deprecated feature of Apollo Server that has reduced - * support for legacy use cases. This option may not work as intended in all situations. - */ - public let legacySafelistingCompatibleOperations: Bool - - /// Default property values - public struct Default { - public static let clientControlledNullability: Bool = false - public static let legacySafelistingCompatibleOperations: Bool = false - } - - public init( - clientControlledNullability: Bool = Default.clientControlledNullability, - legacySafelistingCompatibleOperations: Bool = Default.legacySafelistingCompatibleOperations - ) { - self.clientControlledNullability = clientControlledNullability - self.legacySafelistingCompatibleOperations = legacySafelistingCompatibleOperations - } - - // MARK: Codable - - public enum CodingKeys: CodingKey, CaseIterable { - case clientControlledNullability - case legacySafelistingCompatibleOperations - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - - clientControlledNullability = try values.decodeIfPresent( - Bool.self, - forKey: .clientControlledNullability - ) ?? Default.clientControlledNullability - - legacySafelistingCompatibleOperations = try values.decodeIfPresent( - Bool.self, - forKey: .legacySafelistingCompatibleOperations - ) ?? Default.legacySafelistingCompatibleOperations - } - } - - // MARK: - Properties - - /// Name used to scope the generated schema type files. - public let schemaNamespace: String - /// The input files required for code generation. - public let input: FileInput - /// The paths and files output by code generation. - public var output: FileOutput - /// Rules and options to customize the generated code. - public let options: OutputOptions - /// Allows users to enable experimental features. - /// - /// Note: These features could change at any time and they are not guaranteed to always be - /// available. - public let experimentalFeatures: ExperimentalFeatures - /// Schema download configuration. - public let schemaDownload: ApolloSchemaDownloadConfiguration? - /// Configuration for generating an operation manifest for use with persisted queries. - public let operationManifest: OperationManifestConfiguration? - - public struct Default { - public static let options: OutputOptions = OutputOptions() - public static let experimentalFeatures: ExperimentalFeatures = ExperimentalFeatures() - public static let schemaDownload: ApolloSchemaDownloadConfiguration? = nil - public static let operationManifest: OperationManifestConfiguration? = nil - } - - // MARK: - Helper Properties - - let ApolloAPITargetName: String - - // MARK: Initializers - - /// Designated initializer. - /// - /// - Parameters: - /// - schemaNamespace: Name used to scope the generated schema type files. - /// - input: The input files required for code generation. - /// - output: The paths and files output by code generation. - /// - options: Rules and options to customize the generated code. - /// - experimentalFeatures: Allows users to enable experimental features. - public init( - schemaNamespace: String, - input: FileInput, - output: FileOutput, - options: OutputOptions = Default.options, - experimentalFeatures: ExperimentalFeatures = Default.experimentalFeatures, - schemaDownload: ApolloSchemaDownloadConfiguration? = Default.schemaDownload, - operationManifest: OperationManifestConfiguration? = Default.operationManifest - ) { - self.schemaNamespace = schemaNamespace - self.input = input - self.output = output - self.options = options - self.experimentalFeatures = experimentalFeatures - self.schemaDownload = schemaDownload - self.operationManifest = operationManifest - self.ApolloAPITargetName = options.cocoapodsCompatibleImportStatements ? "Apollo" : "ApolloAPI" - } - - // MARK: Codable - - enum CodingKeys: CodingKey, CaseIterable { - case schemaName - case schemaNamespace - case input - case output - case options - case experimentalFeatures - case schemaDownloadConfiguration - case schemaDownload - case operationManifest - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - - try container.encode(self.schemaNamespace, forKey: .schemaNamespace) - try container.encode(self.input, forKey: .input) - try container.encode(self.output, forKey: .output) - try container.encode(self.options, forKey: .options) - try container.encode(experimentalFeatures, forKey: .experimentalFeatures) - - if let schemaDownload { - try container.encode(schemaDownload, forKey: .schemaDownload) - } - - if let operationManifest { - try container.encode(operationManifest, forKey: .operationManifest) - } - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - try throwIfContainsUnexpectedKey(container: values, type: Self.self, decoder: decoder) - - func getSchemaNamespaceValue() throws -> String { - if let value = try values.decodeIfPresent(String.self, forKey: .schemaNamespace) { - return value - } - if let value = try values.decodeIfPresent(String.self, forKey: .schemaName) { - return value - } - - throw DecodingError.keyNotFound( - CodingKeys.schemaNamespace, - .init( - codingPath: [CodingKeys.schemaNamespace], - debugDescription: "Cannot find value for 'schemaNamespace' key" - ) - ) - } - - let fileOutput = try values.decode(FileOutput.self, forKey: .output) - let options = try values.decodeIfPresent( - OutputOptions.self, - forKey: .options - ) ?? Default.options - - var operationManifest = try values.decodeIfPresent(OperationManifestConfiguration.self, forKey: .operationManifest) - if operationManifest == nil { - if let operationIDsPath = fileOutput.operationIDsPath { - operationManifest = OperationManifestConfiguration( - path: operationIDsPath, - version: .legacy - ) - } - } - - var schemaDownload = try values.decodeIfPresent(ApolloSchemaDownloadConfiguration.self, forKey: .schemaDownload) - if schemaDownload == nil { - schemaDownload = try values.decodeIfPresent(ApolloSchemaDownloadConfiguration.self, forKey: .schemaDownloadConfiguration) - } - - self.init( - schemaNamespace: try getSchemaNamespaceValue(), - input: try values.decode(FileInput.self, forKey: .input), - output: fileOutput, - options: options, - experimentalFeatures: try values.decodeIfPresent( - ExperimentalFeatures.self, - forKey: .experimentalFeatures - ) ?? Default.experimentalFeatures, - schemaDownload: schemaDownload ?? Default.schemaDownload, - operationManifest: operationManifest ?? Default.operationManifest - ) - } -} - -// MARK: - Helpers - -extension ApolloCodegenConfiguration.SchemaTypesFileOutput { - /// Determine whether the schema types files are output to a module. - var isInModule: Bool { - switch moduleType { - case .embeddedInTarget: return false - case .swiftPackageManager, .other: return true - } - } -} - -extension ApolloCodegenConfiguration.OperationsFileOutput { - /// Determine whether the operations files are output to the schema types module. - var isInModule: Bool { - switch self { - case .inSchemaModule: return true - case .absolute, .relative: return false - } - } -} - -extension ApolloCodegenConfiguration.OutputOptions { - /// Determine whether the operations files are output to the schema types module. - func shouldGenerateSelectionSetInitializers(for operation: IR.Operation) -> Bool { - switch operation.definition.isLocalCacheMutation { - case true where selectionSetInitializers.contains(.localCacheMutations): - return true - - case false where selectionSetInitializers.contains(.operations): - return true - - default: - return selectionSetInitializers.contains(definitionNamed: operation.definition.name) - } - } - - /// Determine whether the operations files are output to the schema types module. - func shouldGenerateSelectionSetInitializers(for fragment: IR.NamedFragment) -> Bool { - if selectionSetInitializers.contains(.namedFragments) { return true } - - if fragment.definition.isLocalCacheMutation && - selectionSetInitializers.contains(.localCacheMutations) { - return true - } - - return selectionSetInitializers.contains(definitionNamed: fragment.definition.name) - } -} - -// MARK: - SelectionSetInitializers - Private Implementation - -extension ApolloCodegenConfiguration.SelectionSetInitializers { - struct Options: OptionSet, Codable, Equatable { - let rawValue: Int - static let localCacheMutations = Options(rawValue: 1 << 0) - static let namedFragments = Options(rawValue: 1 << 1) - static let operations = Options(rawValue: 1 << 2) - } - - private init(_ options: Options) { - self.options = options - self.definitions = [] - } - - private init(definitionName: String) { - self.options = [] - self.definitions = [definitionName] - } - - func contains(_ options: Self.Options) -> Bool { - self.options.contains(options) - } - - func contains(definitionNamed definitionName: String) -> Bool { - self.definitions.contains(definitionName) - } - - // MARK: Codable - - enum CodingKeys: CodingKey, CaseIterable { - case operations - case namedFragments - case localCacheMutations - case definitionsNamed - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - try throwIfContainsUnexpectedKey(container: values, type: Self.self, decoder: decoder) - var options: Options = [] - - func decode(option: @autoclosure () -> Options, forKey key: CodingKeys) throws { - if let value = try values.decodeIfPresent(Bool.self, forKey: key), value { - options.insert(option()) - } - } - - try decode(option: .operations, forKey: .operations) - try decode(option: .namedFragments, forKey: .namedFragments) - try decode(option: .localCacheMutations, forKey: .localCacheMutations) - - self.options = options - self.definitions = try values.decodeIfPresent( - Set.self, - forKey: .definitionsNamed) ?? [] - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - - func encodeIfPresent(option: Options, forKey key: CodingKeys) throws { - if options.contains(option) { - try container.encode(true, forKey: key) - } - } - - try encodeIfPresent(option: .operations, forKey: .operations) - try encodeIfPresent(option: .namedFragments, forKey: .namedFragments) - try encodeIfPresent(option: .localCacheMutations, forKey: .localCacheMutations) - - if !definitions.isEmpty { - try container.encode(definitions.sorted(), forKey: .definitionsNamed) - } - } -} - -// MARK: - Deprecations - -extension ApolloCodegenConfiguration { - /// Name used to scope the generated schema type files. - @available(*, deprecated, renamed: "schemaNamespace") - public var schemaName: String { schemaNamespace } - - /// Deprecated initializer - use `init(schemaNamespace:input:output:options:experimentalFeatures:schemaDownload:operationManifest:)` - /// instead. - /// - /// - Parameters: - /// - schemaName: Name used to scope the generated schema type files. - /// - input: The input files required for code generation. - /// - output: The paths and files output by code generation. - /// - options: Rules and options to customize the generated code. - /// - experimentalFeatures: Allows users to enable experimental features. - @available(*, deprecated, renamed: "init(schemaNamespace:input:output:options:experimentalFeatures:schemaDownload:operationManifest:)") - public init( - schemaName: String, - input: FileInput, - output: FileOutput, - options: OutputOptions = Default.options, - experimentalFeatures: ExperimentalFeatures = Default.experimentalFeatures, - schemaDownloadConfiguration: ApolloSchemaDownloadConfiguration? = Default.schemaDownload - ) { - self.init( - schemaNamespace: schemaName, - input: input, - output: output, - options: options, - experimentalFeatures: experimentalFeatures, - schemaDownload: schemaDownloadConfiguration) - } - - /// Enum to enable using - /// [Automatic Persisted Queries (APQs)](https://www.apollographql.com/docs/apollo-server/performance/apq) - /// with your generated operations. - /// - /// APQs are a feature of Apollo Server/Router. When using Apollo iOS to connect to any other GraphQL server, - /// `APQConfig` should be set to `.disabled` - public enum APQConfig: String, Decodable { - /// The default value. Disables APQs. - /// The operation document is sent to the server with each operation request. - @available(*, deprecated, message: "Use OperationDocumentFormat instead.") - case disabled - - /// Automatically persists your operations using Apollo Server/Router's - /// [APQs](https://www.apollographql.com/docs/apollo-server/performance/apq). - @available(*, deprecated, message: "Use OperationDocumentFormat instead.") - case automaticallyPersist - - /// Provides only the `operationIdentifier` for operations that have been previously persisted - /// to an Apollo Server/Router using - /// [APQs](https://www.apollographql.com/docs/apollo-server/performance/apq). - /// - /// If the server does not recognize the `operationIdentifier`, the operation will fail. This - /// method should only be used if you are manually persisting your queries to an - /// Apollo Server/Router. - @available(*, deprecated, message: "Use OperationDocumentFormat instead.") - case persistedOperationsOnly - - var operationDocumentFormat: ApolloCodegenConfiguration.OperationDocumentFormat { - switch self { - case .disabled: - return .definition - case .automaticallyPersist: - return [.definition, .operationId] - case .persistedOperationsOnly: - return .operationId - } - } - } -} - -extension ApolloCodegenConfiguration.FileOutput { - /// Deprecated initializer. - /// - /// - Parameters: - /// - schemaTypes: The local path structure for the generated schema types files. - /// - operations: The local path structure for the generated operation object files. - /// Defaults to `.inSchemaModule`. - /// - testMocks: The local path structure for the test mock operation object files. - /// If `.none`, test mocks will not be generated. Defaults to `.none`. - /// - operationIdentifiersPath: An absolute location to an operation id JSON map file - /// for use with APQ registration. Defaults to `nil`. - @available(*, deprecated, renamed: "init(schemaTypes:operations:testMocks:)") - public init( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput, - operations: ApolloCodegenConfiguration.OperationsFileOutput = Default.operations, - testMocks: ApolloCodegenConfiguration.TestMockFileOutput = Default.testMocks, - operationIdentifiersPath: String? - ) { - self.schemaTypes = schemaTypes - self.operations = operations - self.testMocks = testMocks - self.operationIDsPath = operationIdentifiersPath - } - - /// An absolute location to an operation id JSON map file. - @available(*, deprecated, message: "Moved to ApolloCodegenConfiguration.OperationManifestConfiguration.OperationManifest.path") - public var operationIdentifiersPath: String? { operationIDsPath } -} - -extension ApolloCodegenConfiguration.OutputOptions { - /// Deprecated initializer. - /// - /// - Parameters: - /// - additionalInflectionRules: Any non-default rules for pluralization or singularization - /// you wish to include. - /// - queryStringLiteralFormat: Formatting of the GraphQL query string literal that is - /// included in each generated operation object. - /// - deprecatedEnumCases: How deprecated enum cases from the schema should be handled. - /// - schemaDocumentation: Whether schema documentation is added to the generated files. - /// - selectionSetInitializers: Which generated selection sets should include - /// generated initializers. - /// - apqs: Whether the generated operations should use Automatic Persisted Queries. - /// - cocoapodsCompatibleImportStatements: Generate import statements that are compatible with - /// including `Apollo` via Cocoapods. - /// - warningsOnDeprecatedUsage: Annotate generated Swift code with the Swift `available` - /// attribute and `deprecated` argument for parts of the GraphQL schema annotated with the - /// built-in `@deprecated` directive. - /// - conversionStrategies: Rules for how to convert the names of values from the schema in - /// generated code. - /// - pruneGeneratedFiles: Whether unused generated files will be automatically deleted. - /// - markOperationDefinitionsAsFinal: Whether generated GraphQL operation and local cache mutation class types will be marked as `final`. - @available(*, deprecated, - renamed: "init(additionalInflectionRules:queryStringLiteralFormat:deprecatedEnumCases:schemaDocumentation:selectionSetInitializers:operationDocumentFormat:cocoapodsCompatibleImportStatements:warningsOnDeprecatedUsage:conversionStrategies:pruneGeneratedFiles:markOperationDefinitionsAsFinal:)" - ) - public init( - additionalInflectionRules: [InflectionRule] = Default.additionalInflectionRules, - queryStringLiteralFormat: QueryStringLiteralFormat = .singleLine, - deprecatedEnumCases: ApolloCodegenConfiguration.Composition = Default.deprecatedEnumCases, - schemaDocumentation: ApolloCodegenConfiguration.Composition = Default.schemaDocumentation, - selectionSetInitializers: ApolloCodegenConfiguration.SelectionSetInitializers = Default.selectionSetInitializers, - apqs: ApolloCodegenConfiguration.APQConfig, - cocoapodsCompatibleImportStatements: Bool = Default.cocoapodsCompatibleImportStatements, - warningsOnDeprecatedUsage: ApolloCodegenConfiguration.Composition = Default.warningsOnDeprecatedUsage, - conversionStrategies: ApolloCodegenConfiguration.ConversionStrategies = Default.conversionStrategies, - pruneGeneratedFiles: Bool = Default.pruneGeneratedFiles, - markOperationDefinitionsAsFinal: Bool = Default.markOperationDefinitionsAsFinal - ) { - self.additionalInflectionRules = additionalInflectionRules - self.deprecatedEnumCases = deprecatedEnumCases - self.schemaDocumentation = schemaDocumentation - self.selectionSetInitializers = selectionSetInitializers - self.operationDocumentFormat = apqs.operationDocumentFormat - self.cocoapodsCompatibleImportStatements = cocoapodsCompatibleImportStatements - self.warningsOnDeprecatedUsage = warningsOnDeprecatedUsage - self.conversionStrategies = conversionStrategies - self.pruneGeneratedFiles = pruneGeneratedFiles - self.markOperationDefinitionsAsFinal = markOperationDefinitionsAsFinal - } - - /// Deprecated initializer. - /// - /// - Parameters: - /// - additionalInflectionRules: Any non-default rules for pluralization or singularization - /// you wish to include. - /// - queryStringLiteralFormat: Formatting of the GraphQL query string literal that is - /// included in each generated operation object. - /// - deprecatedEnumCases: How deprecated enum cases from the schema should be handled. - /// - schemaDocumentation: Whether schema documentation is added to the generated files. - /// - selectionSetInitializers: Which generated selection sets should include - /// generated initializers. - /// - operationDocumentFormat: How to generate the operation documents for your generated operations. - /// - cocoapodsCompatibleImportStatements: Generate import statements that are compatible with - /// including `Apollo` via Cocoapods. - /// - warningsOnDeprecatedUsage: Annotate generated Swift code with the Swift `available` - /// attribute and `deprecated` argument for parts of the GraphQL schema annotated with the - /// built-in `@deprecated` directive. - /// - conversionStrategies: Rules for how to convert the names of values from the schema in - /// generated code. - /// - pruneGeneratedFiles: Whether unused generated files will be automatically deleted. - /// - markOperationDefinitionsAsFinal: Whether generated GraphQL operation and local cache mutation class types will be marked as `final`. - @available(*, deprecated, - renamed: "init(additionalInflectionRules:deprecatedEnumCases:schemaDocumentation:selectionSetInitializers:operationDocumentFormat:cocoapodsCompatibleImportStatements:warningsOnDeprecatedUsage:conversionStrategies:pruneGeneratedFiles:markOperationDefinitionsAsFinal:)" - ) - public init( - additionalInflectionRules: [InflectionRule] = Default.additionalInflectionRules, - queryStringLiteralFormat: QueryStringLiteralFormat, - deprecatedEnumCases: ApolloCodegenConfiguration.Composition = Default.deprecatedEnumCases, - schemaDocumentation: ApolloCodegenConfiguration.Composition = Default.schemaDocumentation, - selectionSetInitializers: ApolloCodegenConfiguration.SelectionSetInitializers = Default.selectionSetInitializers, - operationDocumentFormat: ApolloCodegenConfiguration.OperationDocumentFormat = Default.operationDocumentFormat, - cocoapodsCompatibleImportStatements: Bool = Default.cocoapodsCompatibleImportStatements, - warningsOnDeprecatedUsage: ApolloCodegenConfiguration.Composition = Default.warningsOnDeprecatedUsage, - conversionStrategies: ApolloCodegenConfiguration.ConversionStrategies = Default.conversionStrategies, - pruneGeneratedFiles: Bool = Default.pruneGeneratedFiles, - markOperationDefinitionsAsFinal: Bool = Default.markOperationDefinitionsAsFinal - ) { - self.additionalInflectionRules = additionalInflectionRules - self.deprecatedEnumCases = deprecatedEnumCases - self.schemaDocumentation = schemaDocumentation - self.selectionSetInitializers = selectionSetInitializers - self.operationDocumentFormat = operationDocumentFormat - self.cocoapodsCompatibleImportStatements = cocoapodsCompatibleImportStatements - self.warningsOnDeprecatedUsage = warningsOnDeprecatedUsage - self.conversionStrategies = conversionStrategies - self.pruneGeneratedFiles = pruneGeneratedFiles - self.markOperationDefinitionsAsFinal = markOperationDefinitionsAsFinal - } - - /// Whether the generated operations should use Automatic Persisted Queries. - /// - /// See `APQConfig` for more information on Automatic Persisted Queries. - @available(*, deprecated, message: "Use OperationDocumentFormat instead.") - public var apqs: ApolloCodegenConfiguration.APQConfig { - switch self.operationDocumentFormat { - case .definition: - return .disabled - case .operationId: - return .persistedOperationsOnly - case [.operationId, .definition]: - return .automaticallyPersist - default: - return .disabled - } - } - - /// Formatting of the GraphQL query string literal that is included in each - /// generated operation object. - @available(*, deprecated, message: "Query strings are now always in single line format.") - public var queryStringLiteralFormat: QueryStringLiteralFormat { - return .singleLine - } - - /// Specify the formatting of the GraphQL query string literal. - public enum QueryStringLiteralFormat: String, Codable, Equatable { - /// The query string will be copied into the operation object with all line break formatting removed. - @available(*, deprecated, message: "Query strings are now always in single line format.") - case singleLine - /// The query string will be copied with original formatting into the operation object. - @available(*, deprecated, message: "Query strings are now always in single line format.") - case multiline - } -} - -extension ApolloCodegenConfiguration.ConversionStrategies { - - @available(*, deprecated, renamed: "init(enumCases:fieldAccessors:)") - public init( - enumCases: CaseConversionStrategy - ) { - switch enumCases { - case .none: - self.enumCases = .none - case .camelCase: - self.enumCases = .camelCase - } - self.fieldAccessors = Default.fieldAccessors - } - - /// ``CaseConversionStrategy`` is used to specify the strategy used to convert the casing of - /// GraphQL schema values into generated Swift code. - @available(*, deprecated, message: "Use EnumCaseConversionStrategy instead.") - public enum CaseConversionStrategy: String, Codable, Equatable { - /// Generates swift code using the exact name provided in the GraphQL schema - /// performing no conversion. - case none - /// Convert to lower camel case from `snake_case`, `UpperCamelCase`, or `UPPERCASE`. - case camelCase - } - -} - -private struct AnyCodingKey: CodingKey { - var stringValue: String - - init?(stringValue: String) { - self.stringValue = stringValue - } - - var intValue: Int? - - init?(intValue: Int) { - self.intValue = intValue - self.stringValue = "\(intValue)" - } -} - -func throwIfContainsUnexpectedKey( - container: KeyedDecodingContainer, - type: T.Type, - decoder: Decoder -) throws { - // Map all keys from the input object - let allKeys = Set(try decoder.container(keyedBy: AnyCodingKey.self).allKeys.map(\.stringValue)) - // Map all valid keys from the given `CodingKey` enum - let validKeys = Set(C.allCases.map(\.stringValue)) - guard allKeys.isSubset(of: validKeys) else { - let invalidKeys = allKeys.subtracting(validKeys).sorted() - throw DecodingError.typeMismatch(type, DecodingError.Context.init( - codingPath: container.codingPath, - debugDescription: "Unrecognized \(invalidKeys.count > 1 ? "keys" : "key") found: \(invalidKeys.joined(separator: ", "))", - underlyingError: nil - )) - } -} diff --git a/Sources/ApolloCodegenLib/ApolloSchemaDownloadConfiguration.swift b/Sources/ApolloCodegenLib/ApolloSchemaDownloadConfiguration.swift deleted file mode 100644 index b4b7f146ff..0000000000 --- a/Sources/ApolloCodegenLib/ApolloSchemaDownloadConfiguration.swift +++ /dev/null @@ -1,248 +0,0 @@ -import Foundation - -/// A configuration object that defines behavior for schema download. -public struct ApolloSchemaDownloadConfiguration: Equatable, Codable { - - // MARK: Types - - /// How to attempt to download your schema - public enum DownloadMethod: Equatable, Codable { - - /// The Apollo Schema Registry, which serves as a central hub for managing your graph. - case apolloRegistry(_ settings: ApolloRegistrySettings) - /// GraphQL Introspection connecting to the specified URL. - case introspection( - endpointURL: URL, - httpMethod: HTTPMethod = .POST, - outputFormat: OutputFormat = .SDL, - includeDeprecatedInputValues: Bool = false - ) - - public struct ApolloRegistrySettings: Equatable, Codable { - /// The API key to use when retrieving your schema from the Apollo Registry. - public let apiKey: String - /// The identifier of the graph to fetch. Can be found in Apollo Studio. - public let graphID: String - /// The variant of the graph in the registry. - public let variant: String? - - public struct Default { - public static let variant: String = "current" - } - - /// Designated initializer - /// - /// - Parameters: - /// - apiKey: The API key to use when retrieving your schema. - /// - graphID: The identifier of the graph to fetch. Can be found in Apollo Studio. - /// - variant: The variant of the graph to fetch. Defaults to "current", which will return - /// whatever is set to the current variant. - public init( - apiKey: String, - graphID: String, - variant: String = Default.variant - ) { - self.apiKey = apiKey - self.graphID = graphID - self.variant = variant - } - - enum CodingKeys: CodingKey { - case apiKey - case graphID - case variant - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - - self.apiKey = try container.decode(String.self, forKey: .apiKey) - self.graphID = try container.decode(String.self, forKey: .graphID) - - self.variant = try container.decodeIfPresent( - String.self, - forKey: .variant - ) ?? Default.variant - } - } - - /// The HTTP request method. This is an option on Introspection schema downloads only. - /// Apollo Registry downloads are always POST requests. - public enum HTTPMethod: Equatable, CustomStringConvertible, Codable { - /// Use POST for HTTP requests. This is the default for GraphQL. - case POST - /// Use GET for HTTP requests with the GraphQL query being sent in the query string - /// parameter named in `queryParameterName`. - case GET(queryParameterName: String) - - public var description: String { - switch self { - case .POST: - return "POST" - case .GET: - return "GET" - } - } - } - - /// The output format for the downloaded schema. This is an option on Introspection schema - /// downloads only. For Apollo Registry schema downloads, the schema will always be output as - /// an SDL document - public enum OutputFormat: String, Equatable, CustomStringConvertible, Codable { - /// A Schema Definition Language (SDL) document defining the schema as described in - /// the [GraphQL Specification](https://spec.graphql.org/draft/#sec-Schema) - case SDL - /// A JSON schema definition provided as the result of a schema introspection query. - case JSON - - public var description: String { return rawValue } - } - - public static func == (lhs: DownloadMethod, rhs: DownloadMethod) -> Bool { - switch (lhs, rhs) { - case let (.introspection(lhsURL, lhsHTTPMethod, lhsOutputFormat, lhsIncludeDeprecatedInputValues), - .introspection(rhsURL, rhsHTTPMethod, rhsOutputFormat, rhsIncludeDeprecatedInputValues)): - return lhsURL == rhsURL && - lhsHTTPMethod == rhsHTTPMethod && - lhsOutputFormat == rhsOutputFormat && - lhsIncludeDeprecatedInputValues == rhsIncludeDeprecatedInputValues - - case let (.apolloRegistry(lhsSettings), .apolloRegistry(rhsSettings)): - return lhsSettings == rhsSettings - default: - return false - } - } - - } - - /// An HTTP header that will be sent in the schema download request. - public struct HTTPHeader: Equatable, CustomDebugStringConvertible, Codable { - /// The name of the header field. HTTP header field names are case insensitive. - let key: String - /// The value for the header field. - let value: String - - public var debugDescription: String { - "\(key): \(value)" - } - - public init(key: String, value: String) { - self.key = key - self.value = value - } - } - - /// Dictionary used to extract header fields without needing the HTTPHeader "key" and "value" keys. - private typealias HTTPHeaderDictionary = [String: String] - - // MARK: - Properties - - /// How to download your schema. Supports the Apollo Registry and GraphQL Introspection methods. - public let downloadMethod: DownloadMethod - /// The maximum time (in seconds) to wait before indicating that the download timed out. - /// Defaults to 30 seconds. - public let downloadTimeout: Double - /// Any additional HTTP headers to include when retrieving your schema. Defaults to nil. - public let headers: [HTTPHeader] - /// The local path where the downloaded schema should be written to. - public let outputPath: String - - public struct Default { - public static let downloadTimeout: Double = 30.0 - public static let headers: [HTTPHeader] = [] - } - - // MARK: Initializers - - /// Designated Initializer - /// - /// - Parameters: - /// - downloadMethod: How to download your schema. - /// - downloadTimeout: The maximum time (in seconds) to wait before indicating that the - /// download timed out. Defaults to 30 seconds. - /// - headers: [optional] Any additional HTTP headers to include when retrieving your schema. - /// Defaults to nil - /// - outputPath: The local path where the downloaded schema should be written to. - public init( - using downloadMethod: DownloadMethod, - timeout downloadTimeout: Double = Default.downloadTimeout, - headers: [HTTPHeader] = Default.headers, - outputPath: String - ) { - self.downloadMethod = downloadMethod - self.downloadTimeout = downloadTimeout - self.headers = headers - self.outputPath = outputPath - } - - // MARK: Codable - - enum CodingKeys: CodingKey { - case downloadMethod - case downloadTimeout - case headers - case outputPath - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - - self.downloadMethod = try container.decode(DownloadMethod.self, forKey: .downloadMethod) - self.outputPath = try container.decode(String.self, forKey: .outputPath) - - self.downloadTimeout = try container.decodeIfPresent( - Double.self, - forKey: .downloadTimeout - ) ?? Default.downloadTimeout - - self.headers = try Self.decode(headers: container) ?? Default.headers - } - - private static func decode( - headers container: KeyedDecodingContainer - ) throws -> [HTTPHeader]? { - - do { - let headers = try container.decodeIfPresent( - [HTTPHeader].self, - forKey: .headers - ) - return headers - - } catch { - do { - let headers = try container.decodeIfPresent( - HTTPHeaderDictionary.self, - forKey: .headers - ) - return headers? - .sorted(by: { $0.key < $1.key }) - .map({ HTTPHeader(key: $0, value: $1) }) - - } catch { - return nil - } - } - } - - public var outputFormat: DownloadMethod.OutputFormat { - switch self.downloadMethod { - case .apolloRegistry: return .SDL - case let .introspection(_, _, outputFormat, _): return outputFormat - } - } -} - -// MARK: - Helpers - -extension ApolloSchemaDownloadConfiguration: CustomDebugStringConvertible { - public var debugDescription: String { - return """ - downloadMethod: \(self.downloadMethod) - downloadTimeout: \(self.downloadTimeout) - headers: \(self.headers) - outputPath: \(self.outputPath) - """ - } -} diff --git a/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift b/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift deleted file mode 100644 index 295198d64e..0000000000 --- a/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift +++ /dev/null @@ -1,453 +0,0 @@ -import Foundation -// Only available on macOS -#if os(macOS) - -/// A wrapper to facilitate downloading a GraphQL schema. -public struct ApolloSchemaDownloader { - - public enum SchemaDownloadError: Error, LocalizedError { - case downloadedRegistryJSONFileNotFound(underlying: Error) - case downloadedIntrospectionJSONFileNotFound(underlying: Error) - case couldNotParseRegistryJSON(underlying: Error) - case unexpectedRegistryJSONType - case couldNotExtractSDLFromRegistryJSON - case couldNotCreateSDLDataToWrite(schema: String) - case couldNotConvertIntrospectionJSONToSDL(underlying: Error) - case couldNotCreateURLComponentsFromEndpointURL(url: URL) - case couldNotGetURLFromURLComponents(components: URLComponents) - - public var errorDescription: String? { - switch self { - case .downloadedRegistryJSONFileNotFound(let underlying): - return "Could not load the JSON file downloaded from the registry. Underlying error: \(underlying)" - case .downloadedIntrospectionJSONFileNotFound(let underlying): - return "Could not load the JSON file downloaded from your server via introspection. Underlying error: \(underlying)" - case .couldNotParseRegistryJSON(let underlying): - return "Could not parse JSON returned by the registry. Underlying error: \(underlying)" - case .unexpectedRegistryJSONType: - return "Root type in the registry JSON was not a dictionary." - case .couldNotExtractSDLFromRegistryJSON: - return "Could not extract the SDL schema from JSON sent by the registry." - case .couldNotCreateSDLDataToWrite(let schema): - return "Could not convert SDL schema into data to write to the filesystem. Schema: \(schema)" - case .couldNotConvertIntrospectionJSONToSDL(let underlying): - return "Could not convert downloaded introspection JSON into SDL format. Underlying error: \(underlying)" - case .couldNotCreateURLComponentsFromEndpointURL(let url): - return "Could not create URLComponents from \(url) for Introspection." - case .couldNotGetURLFromURLComponents(let components): - return "Could not get URL from \(components)." - } - } - } - - /// Downloads your schema using the specified configuration object. - /// - /// - Parameters: - /// - configuration: The `ApolloSchemaDownloadConfiguration` used to download the schema. - /// - rootURL: The root `URL` to resolve relative `URL`s in the configuration's paths against. - /// If `nil`, the current working directory of the executing process will be used. - /// - Returns: Output from a successful fetch or throws an error. - /// - Throws: Any error which occurs during the fetch. - public static func fetch( - configuration: ApolloSchemaDownloadConfiguration, - withRootURL rootURL: URL? = nil - ) throws { - try ApolloFileManager.default.createContainingDirectoryIfNeeded( - forPath: configuration.outputPath - ) - - switch configuration.downloadMethod { - case .introspection(let endpointURL, let httpMethod, _, let includeDeprecatedInputValues): - try self.downloadFrom( - introspection: endpointURL, - httpMethod: httpMethod, - includeDeprecatedInputValues: includeDeprecatedInputValues, - configuration: configuration, - withRootURL: rootURL - ) - - case .apolloRegistry(let settings): - try self.downloadFrom( - registry: settings, - configuration: configuration, - withRootURL: rootURL - ) - } - } - - private static func request( - url: URL, - httpMethod: ApolloSchemaDownloadConfiguration.DownloadMethod.HTTPMethod, - headers: [ApolloSchemaDownloadConfiguration.HTTPHeader], - bodyData: Data? = nil - ) -> URLRequest { - var request = URLRequest(url: url) - - request.addValue("application/json", forHTTPHeaderField: "Content-Type") - for header in headers { - request.addValue(header.value, forHTTPHeaderField: header.key) - } - - request.httpMethod = String(describing: httpMethod) - request.httpBody = bodyData - - return request - } - - static func write( - _ string: String, - path: String, - rootURL: URL?, - fileManager: ApolloFileManager = .default - ) throws { - - let outputURL: URL - if let rootURL = rootURL { - outputURL = URL(fileURLWithPath: path, relativeTo: rootURL) - } else { - outputURL = URL(fileURLWithPath: path).standardizedFileURL - } - - guard let data = string.data(using: .utf8) else { - throw SchemaDownloadError.couldNotCreateSDLDataToWrite(schema: string) - } - - try fileManager.createFile(atPath: outputURL.path, data: data, overwrite: true) - } - - // MARK: - Schema Registry - - static let RegistryEndpoint = URL(string: "https://graphql.api.apollographql.com/api/graphql")! - - static let RegistryDownloadQuery = """ - query DownloadSchema($graphID: ID!, $variant: String!) { - service(id: $graphID) { - variant(name: $variant) { - activeSchemaPublish { - schema { - document - } - } - } - } - } - """ - - static func downloadFrom( - registry: ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings, - configuration: ApolloSchemaDownloadConfiguration, - withRootURL rootURL: URL? - ) throws { - CodegenLogger.log("Downloading schema from registry", logLevel: .debug) - - let urlRequest = try registryRequest(with: registry, headers: configuration.headers) - let jsonOutputURL = URL(fileURLWithPath: configuration.outputPath, relativeTo: rootURL) - .parentFolderURL() - .appendingPathComponent("registry_response.json") - - try URLDownloader().downloadSynchronously( - urlRequest, - to: jsonOutputURL, - timeout: configuration.downloadTimeout - ) - - try self.convertFromRegistryJSONToSDLFile( - jsonFileURL: jsonOutputURL, - configuration: configuration, - withRootURL: rootURL - ) - - CodegenLogger.log("Successfully downloaded schema from registry", logLevel: .debug) - } - - static func registryRequest( - with settings: ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings, - headers: [ApolloSchemaDownloadConfiguration.HTTPHeader] - ) throws -> URLRequest { - var variables = [String: String]() - variables["graphID"] = settings.graphID - if let variant = settings.variant { - variables["variant"] = variant - } - - let requestBody = UntypedGraphQLRequestBodyCreator.requestBody( - for: self.RegistryDownloadQuery, - variables: variables, - operationName: "DownloadSchema" - ) - let bodyData = try JSONSerialization.data(withJSONObject: requestBody, options: [.sortedKeys]) - - var allHeaders = headers - allHeaders.append(ApolloSchemaDownloadConfiguration.HTTPHeader( - key: "x-api-key", - value: settings.apiKey - )) - - let urlRequest = request( - url: self.RegistryEndpoint, - httpMethod: .POST, - headers: allHeaders, - bodyData: bodyData - ) - - return urlRequest - } - - static func convertFromRegistryJSONToSDLFile( - jsonFileURL: URL, - configuration: ApolloSchemaDownloadConfiguration, - withRootURL rootURL: URL? - ) throws { - let jsonData: Data - - do { - jsonData = try Data(contentsOf: jsonFileURL) - } catch { - throw SchemaDownloadError.downloadedRegistryJSONFileNotFound(underlying: error) - } - - let json: Any - do { - json = try JSONSerialization.jsonObject(with: jsonData) - } catch { - throw SchemaDownloadError.couldNotParseRegistryJSON(underlying: error) - } - - guard let dict = json as? [String: Any] else { - throw SchemaDownloadError.unexpectedRegistryJSONType - } - - guard - let data = dict["data"] as? [String: Any], - let service = data["service"] as? [String: Any], - let variant = service["variant"] as? [String: Any], - let asp = variant["activeSchemaPublish"] as? [String: Any], - let schemaDict = asp["schema"] as? [String: Any], - let sdlSchema = schemaDict["document"] as? String - else { - throw SchemaDownloadError.couldNotExtractSDLFromRegistryJSON - } - - try write(sdlSchema, path: configuration.outputPath, rootURL: rootURL) - } - - // MARK: - Schema Introspection - - static func introspectionQuery(includeDeprecatedInputValues: Bool) -> String { - let inputDeprecationArgs = includeDeprecatedInputValues ? "(includeDeprecated: true)" : "" - let inputValueDeprecationFields = includeDeprecatedInputValues ? - """ - isDeprecated - deprecationReason - """ : "" - - return """ - query IntrospectionQuery { - __schema { - queryType { name } - mutationType { name } - subscriptionType { name } - types { - ...FullType - } - directives { - name - description - locations - args { - ...InputValue - } - } - } - } - fragment FullType on __Type { - kind - name - description - fields(includeDeprecated: true) { - name - description - args\(inputDeprecationArgs) { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields\(inputDeprecationArgs) { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - description - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - fragment InputValue on __InputValue { - name - description - type { ...TypeRef } - defaultValue - \(inputValueDeprecationFields) - } - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } - """ - } - - static func downloadFrom( - introspection endpoint: URL, - httpMethod: ApolloSchemaDownloadConfiguration.DownloadMethod.HTTPMethod, - includeDeprecatedInputValues: Bool, - configuration: ApolloSchemaDownloadConfiguration, - withRootURL: URL? - ) throws { - - CodegenLogger.log("Downloading schema via introspection from \(endpoint)", logLevel: .debug) - - let urlRequest = try introspectionRequest( - from: endpoint, - httpMethod: httpMethod, - headers: configuration.headers, - includeDeprecatedInputValues: includeDeprecatedInputValues - ) - - let jsonOutputURL: URL = { - switch configuration.outputFormat { - case .SDL: return URL(fileURLWithPath: configuration.outputPath, relativeTo: withRootURL) - .parentFolderURL() - .appendingPathComponent("introspection_response.json") - - case .JSON: return URL(fileURLWithPath: configuration.outputPath, relativeTo: withRootURL) - } - }() - - - try URLDownloader().downloadSynchronously( - urlRequest, - to: jsonOutputURL, - timeout: configuration.downloadTimeout - ) - - if configuration.outputFormat == .SDL { - try convertFromIntrospectionJSONToSDLFile( - jsonFileURL: jsonOutputURL, - configuration: configuration, - withRootURL: withRootURL - ) - } - - CodegenLogger.log("Successfully downloaded schema via introspection", logLevel: .debug) - } - - static func introspectionRequest( - from endpointURL: URL, - httpMethod: ApolloSchemaDownloadConfiguration.DownloadMethod.HTTPMethod, - headers: [ApolloSchemaDownloadConfiguration.HTTPHeader], - includeDeprecatedInputValues: Bool - ) throws -> URLRequest { - let urlRequest: URLRequest - - switch httpMethod { - case .POST: - let requestBody = UntypedGraphQLRequestBodyCreator.requestBody( - for: introspectionQuery(includeDeprecatedInputValues: includeDeprecatedInputValues), - variables: nil, - operationName: "IntrospectionQuery" - ) - let bodyData = try JSONSerialization.data( - withJSONObject: requestBody, - options: [.sortedKeys] - ) - urlRequest = request( - url: endpointURL, - httpMethod: httpMethod, - headers: headers, - bodyData: bodyData - ) - - case let .GET(queryParameterName): - guard var components = URLComponents(url: endpointURL, resolvingAgainstBaseURL: true) else { - throw SchemaDownloadError.couldNotCreateURLComponentsFromEndpointURL(url: endpointURL) - } - components.queryItems = [URLQueryItem(name: queryParameterName, value: introspectionQuery(includeDeprecatedInputValues: includeDeprecatedInputValues))] - - guard let url = components.url else { - throw SchemaDownloadError.couldNotGetURLFromURLComponents(components: components) - } - urlRequest = request(url: url, httpMethod: httpMethod, headers: headers) - } - - return urlRequest - } - - static func convertFromIntrospectionJSONToSDLFile( - jsonFileURL: URL, - configuration: ApolloSchemaDownloadConfiguration, - withRootURL rootURL: URL? - ) throws { - - defer { - try? FileManager.default.removeItem(at: jsonFileURL) - } - - let frontend = try GraphQLJSFrontend() - let schema: GraphQLSchema - - do { - schema = try frontend.loadSchema(from: [try frontend.makeSource(from: jsonFileURL)]) - } catch { - throw SchemaDownloadError.downloadedIntrospectionJSONFileNotFound(underlying: error) - } - - let sdlSchema: String - - do { - sdlSchema = try frontend.printSchemaAsSDL(schema: schema) - } catch { - throw SchemaDownloadError.couldNotConvertIntrospectionJSONToSDL(underlying: error) - } - - try write(sdlSchema, path: configuration.outputPath, rootURL: rootURL) - } -} -#endif diff --git a/Sources/ApolloCodegenLib/CodegenConfiguration/ApolloCodegenConfiguration+OperationManifestConfiguration.swift b/Sources/ApolloCodegenLib/CodegenConfiguration/ApolloCodegenConfiguration+OperationManifestConfiguration.swift deleted file mode 100644 index fef96343b7..0000000000 --- a/Sources/ApolloCodegenLib/CodegenConfiguration/ApolloCodegenConfiguration+OperationManifestConfiguration.swift +++ /dev/null @@ -1,91 +0,0 @@ -import Foundation - -extension ApolloCodegenConfiguration { - - public struct OperationManifestConfiguration: Codable, Equatable { - - // MARK: - Properties - - /// Local path where the generated operation manifest file should be written. - public let path: String - /// The version format to use when generating the operation manifest. Defaults to `.persistedQueries`. - public let version: Version - - public enum Version: String, Codable, Equatable { - /// Generates an operation manifest for use with persisted queries. - case persistedQueries - /// Generates an operation manifest in the legacy safelisting format used prior to the - /// [Persisted Queries](https://www.apollographql.com/docs/ios/fetching/persisted-queries) feature. - case legacy - } - - /// If set to `true` will generate the operation manifest every time code generation is run. Defaults to `false` - public let generateManifestOnCodeGeneration: Bool - - /// Default property values - public struct Default { - public static let version: Version = .persistedQueries - public static let generateManifestOnCodeGeneration: Bool = false - } - - // MARK: - Initializers - - /// Designated initializer - /// - /// - Parameters: - /// - path: Local path where the generated operation manifest file should be written. - /// - version: The version format to use when generating the operation manifest. Defaults to `.persistedQueries`. - /// - generateManifestOnCodeGeneration: Whether or nor the operation manifest should be generated whenever code generation is run. Defaults to `false`. - public init( - path: String, - version: Version = Default.version, - generateManifestOnCodeGeneration: Bool = Default.generateManifestOnCodeGeneration - ) { - self.path = path - self.version = version - self.generateManifestOnCodeGeneration = generateManifestOnCodeGeneration - } - - // MARK: - Codable - - enum CodingKeys: CodingKey, CaseIterable { - case path - case version - case generateManifestOnCodeGeneration - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - try throwIfContainsUnexpectedKey( - container: values, - type: Self.self, - decoder: decoder - ) - - path = try values.decode( - String.self, - forKey: .path - ) - - version = try values.decode( - Version.self, - forKey: .version - ) - - generateManifestOnCodeGeneration = try values.decode( - Bool.self, - forKey: .generateManifestOnCodeGeneration - ) - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - - try container.encode(self.path, forKey: .path) - try container.encode(self.version, forKey: .version) - try container.encode(self.generateManifestOnCodeGeneration, forKey: .generateManifestOnCodeGeneration) - } - - } - -} diff --git a/Sources/ApolloCodegenLib/CodegenLogger.swift b/Sources/ApolloCodegenLib/CodegenLogger.swift deleted file mode 100644 index 6d577b98b4..0000000000 --- a/Sources/ApolloCodegenLib/CodegenLogger.swift +++ /dev/null @@ -1,52 +0,0 @@ -import Foundation - -/// Helper to get logs printing to stdout so they can be read from the command line. -public struct CodegenLogger { - public enum LogLevel: Int { - case error - case warning - case debug - - var name: String { - switch self { - case .error: - return "ERROR" - case .warning: - return "WARNING" - case .debug: - return "DEBUG" - } - } - } - - /// The `LogLevel` at which to print logs. Higher raw values than this will - /// be ignored. Defaults to `debug`. - public static var level = LogLevel.debug - - /// Logs the given string if its `logLevel` is at or above `CodegenLogger.level`, otherwise ignores it. - /// - /// - Parameter logString: The string to log out, as an autoclosure - /// - Parameter logLevel: The log level at which to print this specific log. Defaults to `debug`. - /// - Parameter file: The file where this function was called. Defaults to the direct caller. - /// - Parameter line: The line where this function was called. Defaults to the direct caller. - public static func log(_ logString: @autoclosure () -> String, - logLevel: LogLevel = .debug, - file: StaticString = #file, - line: UInt = #line) { - guard logLevel.rawValue <= CodegenLogger.level.rawValue else { - // We're not logging anything at this level. - return - } - - var standardOutput = FileHandle.standardOutput - print("[\(logLevel.name) - ApolloCodegenLib:\(file.lastPathComponent):\(line)] - \(logString())", to: &standardOutput) - } -} - -// Extension which allows `print` to output to a FileHandle -extension FileHandle: TextOutputStream { - public func write(_ string: String) { - guard let data = string.data(using: .utf8) else { return } - self.write(data) - } -} diff --git a/Sources/ApolloCodegenLib/Documentation.docc/Documentation.md b/Sources/ApolloCodegenLib/Documentation.docc/Documentation.md deleted file mode 100644 index c9c2468436..0000000000 --- a/Sources/ApolloCodegenLib/Documentation.docc/Documentation.md +++ /dev/null @@ -1,9 +0,0 @@ -# ``ApolloCodegenLib`` - -A robust code generation engine for GraphQL operations. - -## Overview - -The code generation engine used to generate model objects for an application from a GraphQL schema and operation set. - -The `ApolloCodegenLib` is exposed through a CLI that supports most code generation needs. It can also be included in a Swift executable target for more advanced use cases. diff --git a/Sources/ApolloCodegenLib/FileFinder.swift b/Sources/ApolloCodegenLib/FileFinder.swift deleted file mode 100644 index b754b630c5..0000000000 --- a/Sources/ApolloCodegenLib/FileFinder.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation - -public struct FileFinder { - - #if compiler(>=5.3) - /// Version that works if you're using the 5.3 compiler or above - /// - Parameter filePath: The full file path of the file to find. Defaults to the `#filePath` of the caller. - /// - Returns: The file URL for the parent folder. - public static func findParentFolder(from filePath: StaticString = #filePath) -> URL { - self.findParentFolder(from: filePath.description) - } - - /// The URL of a file at a given path - /// - Parameter filePath: The full file path of the file to find - /// - Returns: The file's URL - public static func fileURL(from filePath: StaticString = #filePath) -> URL { - URL(fileURLWithPath: filePath.description) - } - #else - /// Version that works if you're using the 5.2 compiler or below - /// - Parameter file: The full file path of the file to find. Defaults to the `#file` of the caller. - /// - Returns: The file URL for the parent folder. - public static func findParentFolder(from filePath: StaticString = #file) -> URL { - self.findParentFolder(from: filePath.description) - } - - /// The URL of a file at a given path - /// - Parameter filePath: The full file path of the file to find - /// - Returns: The file's URL - public static func fileURL(from filePath: StaticString = #file) -> URL { - URL(fileURLWithPath: filePath.toString) - } - #endif - - /// Finds the parent folder from a given file path. - /// - Parameter filePath: The full file path, as a string - /// - Returns: The file URL for the parent folder. - public static func findParentFolder(from filePath: String) -> URL { - let url = URL(fileURLWithPath: filePath) - return url.deletingLastPathComponent() - } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/CustomScalarFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/CustomScalarFileGenerator.swift deleted file mode 100644 index d527993755..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/CustomScalarFileGenerator.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Custom Scalar](https://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars). -struct CustomScalarFileGenerator: FileGenerator { - /// Source GraphQL Custom Scalar.. - let graphqlScalar: GraphQLScalarType - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - CustomScalarTemplate(graphqlScalar: graphqlScalar, config: config) - } - - var target: FileTarget { .customScalar } - var fileName: String { graphqlScalar.name } - var overwrite: Bool { false } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/EnumFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/EnumFileGenerator.swift deleted file mode 100644 index 0fd394e093..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/EnumFileGenerator.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Enum](https://spec.graphql.org/draft/#sec-Enums). -struct EnumFileGenerator: FileGenerator { - /// Source GraphQL enum. - let graphqlEnum: GraphQLEnumType - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - EnumTemplate(graphqlEnum: graphqlEnum, config: config) - } - - var target: FileTarget { .enum } - var fileName: String { graphqlEnum.name } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/FileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/FileGenerator.swift deleted file mode 100644 index 31cdc1909f..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/FileGenerator.swift +++ /dev/null @@ -1,203 +0,0 @@ -import Foundation - -// MARK: FileGenerator (protocol and extension) - -/// The methods to conform to when building a code generation Swift file generator. -protocol FileGenerator { - var fileName: String { get } - var fileExtension: String { get } - var overwrite: Bool { get } - var template: TemplateRenderer { get } - var target: FileTarget { get } -} - -extension FileGenerator { - var overwrite: Bool { true } - var fileExtension: String { overwrite ? "graphql.swift" : "swift" } - - /// Generates the file writing the template content to the specified config output paths. - /// - /// - Parameters: - /// - config: Shared codegen configuration. - /// - fileManager: The `ApolloFileManager` object used to create the file. Defaults to `ApolloFileManager.default`. - func generate( - forConfig config: ApolloCodegen.ConfigurationContext, - fileManager: ApolloFileManager = .default - ) throws { - let directoryPath = target.resolvePath(forConfig: config) - let filePath = URL(fileURLWithPath: directoryPath) - .resolvingSymlinksInPath() - .appendingPathComponent(fileName.firstUppercased) - .appendingPathExtension(fileExtension) - .path - - let rendered: String = template.render() - - try fileManager.createFile( - atPath: filePath, - data: rendered.data(using: .utf8), - overwrite: self.overwrite - ) - } -} - -// MARK: - FileTarget (path resolver) - -enum FileTarget: Equatable { - case object - case `enum` - case interface - case union - case inputObject - case customScalar - case fragment(CompilationResult.FragmentDefinition) - case operation(CompilationResult.OperationDefinition) - case schema - case testMock - - private var subpath: String { - switch self { - case .object: return "Objects" - case .enum: return "Enums" - case .interface: return "Interfaces" - case .union: return "Unions" - case .inputObject: return "InputObjects" - case .customScalar: return "CustomScalars" - - case let .operation(operation) where operation.isLocalCacheMutation: - return "LocalCacheMutations" - case let .fragment(fragment) where fragment.isLocalCacheMutation: - return "LocalCacheMutations" - - case .fragment: return "Fragments" - case let .operation(operation): - switch operation.operationType { - case .query: return "Queries" - case .mutation: return "Mutations" - case .subscription: return "Subscriptions" - } - - case .schema, .testMock: return "" - } - } - - func resolvePath( - forConfig config: ApolloCodegen.ConfigurationContext - ) -> String { - switch self { - case .object, .enum, .interface, .union, .inputObject, .customScalar, .schema: - return resolveSchemaPath(forConfig: config) - - case let .fragment(fragmentDefinition): - return resolveFragmentPath( - forConfig: config, - fragment: fragmentDefinition - ) - - case let .operation(operationDefinition): - return resolveOperationPath( - forConfig: config, - operation: operationDefinition - ) - - case .testMock: - return resolveTestMockPath(forConfig: config) - } - } - - private func resolveSchemaPath( - forConfig config: ApolloCodegen.ConfigurationContext - ) -> String { - var moduleSubpath: String = "/" - if config.output.schemaTypes.moduleType == .swiftPackageManager { - moduleSubpath += "Sources/" - } - if config.output.operations.isInModule { - moduleSubpath += "Schema/" - } - - let base = URL(fileURLWithPath: config.output.schemaTypes.path, relativeTo: config.rootURL) - - return base - .appendingPathComponent("\(moduleSubpath)\(subpath)").standardizedFileURL.path - } - - private func resolveFragmentPath( - forConfig config: ApolloCodegen.ConfigurationContext, - fragment: CompilationResult.FragmentDefinition - ) -> String { - switch config.output.operations { - case .inSchemaModule: - var url = URL(fileURLWithPath: config.output.schemaTypes.path, relativeTo: config.rootURL) - if config.output.schemaTypes.moduleType == .swiftPackageManager { - url = url.appendingPathComponent("Sources") - } - - return url.appendingPathComponent(subpath).path - - case let .absolute(path, _): - return URL(fileURLWithPath: path, relativeTo: config.rootURL) - .appendingPathComponent(subpath).path - - case let .relative(subpath, _): - return resolveRelativePath( - sourceURL: URL(fileURLWithPath: fragment.filePath), - withSubpath: subpath - ) - } - } - - private func resolveRelativePath(sourceURL: URL, withSubpath subpath: String?) -> String { - let relativeURL = sourceURL.deletingLastPathComponent() - - if let subpath = subpath { - return relativeURL.appendingPathComponent(subpath).path - } - - return relativeURL.path - } - - private func resolveOperationPath( - forConfig config: ApolloCodegen.ConfigurationContext, - operation: CompilationResult.OperationDefinition - ) -> String { - switch config.output.operations { - case .inSchemaModule: - var url = URL(fileURLWithPath: config.output.schemaTypes.path, relativeTo: config.rootURL) - if config.output.schemaTypes.moduleType == .swiftPackageManager { - url = url.appendingPathComponent("Sources") - } - if !operation.isLocalCacheMutation { - url = url.appendingPathComponent("Operations") - } - - return url - .appendingPathComponent(subpath) - .path - - case let .absolute(path, _): - return URL(fileURLWithPath: path, relativeTo: config.rootURL) - .appendingPathComponent(subpath).path - - case let .relative(subpath, _): - return resolveRelativePath( - sourceURL: URL(fileURLWithPath: operation.filePath), - withSubpath: subpath - ) - } - } - - private func resolveTestMockPath( - forConfig config: ApolloCodegen.ConfigurationContext - ) -> String { - switch config.output.testMocks { - case .none: - return "" - case let .swiftPackage(targetName): - return URL(fileURLWithPath: config.output.schemaTypes.path, relativeTo: config.rootURL) - .appendingPathComponent(targetName ?? "TestMocks").path - case let .absolute(path, _): - return URL(fileURLWithPath: path, relativeTo: config.rootURL).path - } - } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/FragmentFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/FragmentFileGenerator.swift deleted file mode 100644 index 0b23f061e7..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/FragmentFileGenerator.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Fragment](https://spec.graphql.org/draft/#sec-Language.Fragments). -struct FragmentFileGenerator: FileGenerator { - /// Source IR fragment. - let irFragment: IR.NamedFragment - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { FragmentTemplate( - fragment: irFragment, - config: config - ) } - var target: FileTarget { .fragment(irFragment.definition) } - var fileName: String { irFragment.definition.name } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/InputObjectFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/InputObjectFileGenerator.swift deleted file mode 100644 index 73e13511f2..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/InputObjectFileGenerator.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a -/// [GraphQL Input Object](https://spec.graphql.org/draft/#sec-Input-Objects). -struct InputObjectFileGenerator: FileGenerator { - /// Source GraphQL input object. - let graphqlInputObject: GraphQLInputObjectType - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - InputObjectTemplate(graphqlInputObject: graphqlInputObject, config: config) - } - var target: FileTarget { .inputObject } - var fileName: String { graphqlInputObject.name } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/InterfaceFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/InterfaceFileGenerator.swift deleted file mode 100644 index 6d07e58f56..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/InterfaceFileGenerator.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Interface](https://spec.graphql.org/draft/#sec-Interfaces). -struct InterfaceFileGenerator: FileGenerator { - /// Source GraphQL interface. - let graphqlInterface: GraphQLInterfaceType - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - InterfaceTemplate(graphqlInterface: graphqlInterface, config: config) - } - - var target: FileTarget { .interface } - var fileName: String { graphqlInterface.name } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/MockInterfacesFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/MockInterfacesFileGenerator.swift deleted file mode 100644 index 9e54714389..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/MockInterfacesFileGenerator.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import OrderedCollections - -/// Generates a file providing the ability to mock the GraphQLInterfaceTypes in a schema -/// for testing purposes. -struct MockInterfacesFileGenerator: FileGenerator { - - let graphQLInterfaces: OrderedSet - - let config: ApolloCodegen.ConfigurationContext - - init?(ir: IR, config: ApolloCodegen.ConfigurationContext) { - let interfaces = ir.schema.referencedTypes.interfaces - guard !interfaces.isEmpty else { return nil } - self.graphQLInterfaces = interfaces - self.config = config - } - - var template: TemplateRenderer { - MockInterfacesTemplate( - graphQLInterfaces: graphQLInterfaces, - config: config - ) - } - - var target: FileTarget { .testMock } - var fileName: String { "MockObject+Interfaces" } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/MockObjectFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/MockObjectFileGenerator.swift deleted file mode 100644 index ce6faa9461..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/MockObjectFileGenerator.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation - -/// Generates a file providing the ability to mock a GraphQLObject for testing purposes. -struct MockObjectFileGenerator: FileGenerator { - /// Source GraphQL object. - let graphqlObject: GraphQLObjectType - - let ir: IR - - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - MockObjectTemplate( - graphqlObject: graphqlObject, - config: config, - ir: ir - ) - } - - var target: FileTarget { .testMock } - var fileName: String { "\(graphqlObject.name)+Mock" } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/MockUnionsFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/MockUnionsFileGenerator.swift deleted file mode 100644 index 27ccdfef73..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/MockUnionsFileGenerator.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import OrderedCollections - -/// Generates a file providing the ability to mock the GraphQLUnionTypes in a schema -/// for testing purposes. -struct MockUnionsFileGenerator: FileGenerator { - - let graphQLUnions: OrderedSet - - let config: ApolloCodegen.ConfigurationContext - - init?(ir: IR, config: ApolloCodegen.ConfigurationContext) { - let unions = ir.schema.referencedTypes.unions - guard !unions.isEmpty else { return nil } - self.graphQLUnions = unions - self.config = config - } - - var template: TemplateRenderer { - MockUnionsTemplate( - graphQLUnions: graphQLUnions, - config: config - ) - } - - var target: FileTarget { .testMock } - var fileName: String { "MockObject+Unions" } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/ObjectFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/ObjectFileGenerator.swift deleted file mode 100644 index 6bb63b489f..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/ObjectFileGenerator.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Object](https://spec.graphql.org/draft/#sec-Objects). -struct ObjectFileGenerator: FileGenerator { - /// Source GraphQL object. - let graphqlObject: GraphQLObjectType - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - ObjectTemplate(graphqlObject: graphqlObject, config: config) - } - - var target: FileTarget { .object } - var fileName: String { graphqlObject.name } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/OperationFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/OperationFileGenerator.swift deleted file mode 100644 index 613d76dc25..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/OperationFileGenerator.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Operation](https://spec.graphql.org/draft/#sec-Language.Operations). -struct OperationFileGenerator: FileGenerator { - /// Source IR operation. - let irOperation: IR.Operation - /// Shared codegen configuration - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { - irOperation.definition.isLocalCacheMutation ? - LocalCacheMutationDefinitionTemplate( - operation: irOperation, - config: config - ) : - OperationDefinitionTemplate( - operation: irOperation, - config: config - ) - } - - var target: FileTarget { .operation(irOperation.definition) } - var fileName: String { irOperation.definition.nameWithSuffix } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/OperationManifestFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/OperationManifestFileGenerator.swift deleted file mode 100644 index 6db47952e1..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/OperationManifestFileGenerator.swift +++ /dev/null @@ -1,90 +0,0 @@ -import Foundation - -/// Representation of an operation that supports Automatic Persisted Queries -struct OperationManifestItem { - let name: String - let identifier: String - let source: String - let type: CompilationResult.OperationType - - init(operation: IR.Operation) { - self.name = operation.definition.name - self.identifier = operation.operationIdentifier - self.type = operation.definition.operationType - - var source = operation.definition.source.convertedToSingleLine() - for fragment in operation.referencedFragments { - source += #"\n\#(fragment.definition.source.convertedToSingleLine())"# - } - self.source = source - } -} - -protocol OperationManifestTemplate { - func render(operations: [OperationManifestItem]) throws -> String -} - -/// File generator to create an operation manifest file. -struct OperationManifestFileGenerator { - /// The `OperationManifestFileOutput` used to generated the operation manifest file. - let config: ApolloCodegen.ConfigurationContext - - /// Collection of operation identifiers to be serialized. - private var operationManifest: [OperationManifestItem] = [] - - /// Designated initializer. - /// - /// Parameters: - /// - config: A configuration object specifying output behavior. - init?(config: ApolloCodegen.ConfigurationContext) { - guard config.operationManifest != nil else { - return nil - } - - self.config = config - } - - /// Appends the operation to the collection of identifiers to be written to be serialized. - mutating func collectOperationIdentifier(_ operation: IR.Operation) { - operationManifest.append(OperationManifestItem(operation: operation)) - } - - /// Generates a file containing the operation identifiers. - /// - /// Parameters: - /// - fileManager: `ApolloFileManager` object used to create the file. Defaults to - /// `ApolloFileManager.default`. - func generate(fileManager: ApolloFileManager = .default) throws { - let rendered: String = try template.render(operations: operationManifest) - - var manifestPath = config.operationManifest.unsafelyUnwrapped.path - let relativePrefix = "./" - - // if path begins with './' the path should be relative to the config.rootURL - if manifestPath.hasPrefix(relativePrefix) { - let fileURL = URL(fileURLWithPath: String(manifestPath.dropFirst(relativePrefix.count)), relativeTo: config.rootURL) - manifestPath = fileURL - .resolvingSymlinksInPath() - .path - } - - if !manifestPath.hasSuffix(".json") { - manifestPath.append(".json") - } - - try fileManager.createFile( - atPath: manifestPath, - data: rendered.data(using: .utf8), - overwrite: true - ) - } - - var template: any OperationManifestTemplate { - switch config.operationManifest.unsafelyUnwrapped.version { - case .persistedQueries: - return PersistedQueriesOperationManifestTemplate(config: config) - case .legacy: - return LegacyAPQOperationManifestTemplate() - } - } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/SchemaConfigurationFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/SchemaConfigurationFileGenerator.swift deleted file mode 100644 index feccd14bbb..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/SchemaConfigurationFileGenerator.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation -import OrderedCollections - -/// Generates a file containing schema metadata used by the GraphQL executor at runtime. -struct SchemaConfigurationFileGenerator: FileGenerator { - /// Shared codegen configuration - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { SchemaConfigurationTemplate(config: config) } - var overwrite: Bool { false } - var target: FileTarget { .schema } - var fileName: String { "SchemaConfiguration" } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/SchemaMetadataFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/SchemaMetadataFileGenerator.swift deleted file mode 100644 index 2025c8fc31..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/SchemaMetadataFileGenerator.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation -import OrderedCollections - -/// Generates a file containing schema metadata used by the GraphQL executor at runtime. -struct SchemaMetadataFileGenerator: FileGenerator { - /// Source IR schema. - let schema: IR.Schema - /// Shared codegen configuration - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { SchemaMetadataTemplate(schema: schema, config: config) } - var target: FileTarget { .schema } - var fileName: String { "SchemaMetadata" } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/SchemaModuleFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/SchemaModuleFileGenerator.swift deleted file mode 100644 index 5aeff4ee53..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/SchemaModuleFileGenerator.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation - -struct SchemaModuleFileGenerator { - /// Generates a module for the chosen dependency manager. - /// - /// - Parameters: - /// - config: A configuration object specifying output behavior. - /// - fileManager: `FileManager` object used to create the file. Defaults to `FileManager.default`. - static func generate( - _ config: ApolloCodegen.ConfigurationContext, - fileManager: ApolloFileManager = .default - ) throws { - - let pathURL: URL = URL( - fileURLWithPath: config.output.schemaTypes.path, - relativeTo: config.rootURL - ) - let filePath: String - let rendered: String - - switch config.output.schemaTypes.moduleType { - case .swiftPackageManager: - filePath = pathURL.appendingPathComponent("Package.swift").path - rendered = SwiftPackageManagerModuleTemplate( - testMockConfig: config.output.testMocks, - config: config - ).render() - - case .embeddedInTarget: - filePath = pathURL - .appendingPathComponent("\(config.schemaNamespace.firstUppercased).graphql.swift").path - rendered = SchemaModuleNamespaceTemplate( - config: config - ).render() - - case .other: - // no-op - the implementation is import statements in the generated operation files - return - } - - try fileManager.createFile( - atPath: filePath, - data: rendered.data(using: .utf8) - ) - } -} diff --git a/Sources/ApolloCodegenLib/FileGenerators/UnionFileGenerator.swift b/Sources/ApolloCodegenLib/FileGenerators/UnionFileGenerator.swift deleted file mode 100644 index efdf9c4a55..0000000000 --- a/Sources/ApolloCodegenLib/FileGenerators/UnionFileGenerator.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Generates a file containing the Swift representation of a [GraphQL Union](https://spec.graphql.org/draft/#sec-Unions). -struct UnionFileGenerator: FileGenerator { - /// Source GraphQL union. - let graphqlUnion: GraphQLUnionType - /// Shared codegen configuration. - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateRenderer { UnionTemplate( - graphqlUnion: graphqlUnion, - config: config - ) } - var target: FileTarget { .union } - var fileName: String { graphqlUnion.name } -} diff --git a/Sources/ApolloCodegenLib/FileManager+Apollo.swift b/Sources/ApolloCodegenLib/FileManager+Apollo.swift deleted file mode 100644 index 389dbed35e..0000000000 --- a/Sources/ApolloCodegenLib/FileManager+Apollo.swift +++ /dev/null @@ -1,131 +0,0 @@ -import Foundation - -public typealias FileAttributes = [FileAttributeKey : Any] - -public class ApolloFileManager { - - public static var `default` = ApolloFileManager(base: FileManager.default) - - /// The paths for the files written to by the ``ApolloFileManager``. - public private(set) var writtenFiles: Set = [] - - public let base: FileManager - - init(base: FileManager) { - self.base = base - } - - // MARK: Presence - - /// Checks if the path exists and is a file, not a directory. - /// - /// - Parameter path: The path to check. - /// - Returns: `true` if there is something at the path and it is a file, not a directory. - public func doesFileExist(atPath path: String) -> Bool { - var isDirectory = ObjCBool(false) - let exists = base.fileExists(atPath: path, isDirectory: &isDirectory) - - return exists && !isDirectory.boolValue - } - - /// Checks if the path exists and is a directory, not a file. - /// - /// - Parameter path: The path to check. - /// - Returns: `true` if there is something at the path and it is a directory, not a file. - public func doesDirectoryExist(atPath path: String) -> Bool { - var isDirectory = ObjCBool(false) - let exists = base.fileExists(atPath: path, isDirectory: &isDirectory) - - return exists && isDirectory.boolValue - } - - // MARK: Manipulation - - /// Verifies that a file exists at the path and then attempts to delete it. An error is thrown if the path is for a directory. - /// - /// - Parameter path: The path of the file to delete. - public func deleteFile(atPath path: String) throws { - var isDirectory = ObjCBool(false) - let exists = base.fileExists(atPath: path, isDirectory: &isDirectory) - - if exists && isDirectory.boolValue { - throw FileManagerPathError.notAFile(path: path) - } - - guard exists else { return } - try base.removeItem(atPath: path) - } - - /// Verifies that a directory exists at the path and then attempts to delete it. An error is thrown if the path is for a file. - /// - /// - Parameter path: The path of the directory to delete. - public func deleteDirectory(atPath path: String) throws { - var isDirectory = ObjCBool(false) - let exists = base.fileExists(atPath: path, isDirectory: &isDirectory) - - if exists && !isDirectory.boolValue { - throw FileManagerPathError.notADirectory(path: path) - } - - guard exists else { return } - try base.removeItem(atPath: path) - } - - /// Creates a file at the specified path and writes any given data to it. If a file already exists at `path`, this method overwrites the - /// contents of that file if the current process has the appropriate privileges to do so. - /// - /// - Parameters: - /// - path: Path to the file. - /// - data: [optional] Data to write to the file path. - /// - overwrite: Indicates if the contents of an existing file should be overwritten. - /// If `false` the function will exit without writing the file if it already exists. - /// This will not throw an error. - /// Defaults to `false. - public func createFile(atPath path: String, data: Data? = nil, overwrite: Bool = true) throws { - try createContainingDirectoryIfNeeded(forPath: path) - - if !overwrite && doesFileExist(atPath: path) { return } - - guard base.createFile(atPath: path, contents: data, attributes: nil) else { - throw FileManagerPathError.cannotCreateFile(at: path) - } - writtenFiles.insert(path) - } - - /// Creates the containing directory (including all intermediate directories) for the given file URL if necessary. This method will not - /// overwrite any existing directory. - /// - /// - Parameter fileURL: The URL of the file to create a containing directory for if necessary. - public func createContainingDirectoryIfNeeded(forPath path: String) throws { - let parent = URL(fileURLWithPath: path).deletingLastPathComponent() - try createDirectoryIfNeeded(atPath: parent.path) - } - - /// Creates the directory (including all intermediate directories) for the given URL if necessary. This method will not overwrite any - /// existing directory. - /// - /// - Parameter path: The path of the directory to create if necessary. - public func createDirectoryIfNeeded(atPath path: String) throws { - if doesDirectoryExist(atPath: path) { return } - try base.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) - } -} - -// MARK: - FileManagerPathError - -public enum FileManagerPathError: Swift.Error, LocalizedError, Equatable { - case notAFile(path: String) - case notADirectory(path: String) - case cannotCreateFile(at: String) - - public var errorDescription: String { - switch self { - case .notAFile(let path): - return "\(path) is not a file!" - case .notADirectory(let path): - return "\(path) is not a directory!" - case .cannotCreateFile(let path): - return "Cannot create file at \(path)" - } - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift b/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift deleted file mode 100644 index 789133845e..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift +++ /dev/null @@ -1 +0,0 @@ -let ApolloCodegenFrontendBundle: String = #"var ApolloCodegenFrontend=function(e){"use strict";function t(e,t){if(!Boolean(e))throw new Error(t)}function n(e){return"object"==typeof e&&null!==e}function i(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const r=/\r\n|[\n\r]/g;function o(e,t){let n=0,o=1;for(const s of e.body.matchAll(r)){if("number"==typeof s.index||i(!1),s.index>=t)break;n=s.index+s[0].length,o+=1}return{line:o,column:t+1-n}}function s(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=1===t.line?n:0,u=t.column+c,l=`${e.name}:${s}:${u}\n`,p=i.split(/\r\n|[\n\r]/g),d=p[r];if(d.length>120){const e=Math.floor(u/80),t=u%80,n=[];for(let e=0;e["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return l+a([[s-1+" |",p[r-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,p[r+1]]])}function a(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class GraphQLError extends Error{constructor(e,...t){var i,r,s;const{nodes:a,source:u,positions:l,path:p,originalError:d,extensions:f}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=p?p:void 0,this.originalError=null!=d?d:void 0,this.nodes=c(Array.isArray(a)?a:a?[a]:void 0);const h=c(null===(i=this.nodes)||void 0===i?void 0:i.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=u?u:null==h||null===(r=h[0])||void 0===r?void 0:r.source,this.positions=null!=l?l:null==h?void 0:h.map((e=>e.start)),this.locations=l&&u?l.map((e=>o(u,e))):null==h?void 0:h.map((e=>o(e.source,e.start)));const m=n(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(s=null!=f?f:m)&&void 0!==s?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+s((t=n.loc).source,o(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+s(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function c(e){return void 0===e||0===e.length?void 0:e}function u(e,t,n){return new GraphQLError(`Syntax Error: ${n}`,void 0,e,[t])}class Location{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Token{constructor(e,t,n,i,r,o){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const l={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet","required"],ListNullability:["element"],RequiredDesignator:["element"],OptionalDesignator:["element"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},p=new Set(Object.keys(l));function d(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&p.has(t)}let f,h,m,v;function y(e){return 9===e||32===e}function E(e){return e>=48&&e<=57}function T(e){return e>=97&&e<=122||e>=65&&e<=90}function N(e){return T(e)||95===e}function I(e){return T(e)||E(e)||95===e}function g(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function _(e){let t=0;for(;t",e.EOF="",e.BANG="!",e.QUESTION_MARK="?",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(v||(v={}));class Lexer{constructor(e){const t=new Token(v.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==v.EOF)do{if(e.next)e=e.next;else{const t=k(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===v.COMMENT);return e}}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function L(e,t){return S(e.charCodeAt(t))&&A(e.charCodeAt(t+1))}function S(e){return e>=55296&&e<=56319}function A(e){return e>=56320&&e<=57343}function D(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return v.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function w(e,t,n,i,r){const o=e.line,s=1+n-e.lineStart;return new Token(t,n,i,o,s,r)}function k(e,t){const n=e.source.body,i=n.length;let r=t;for(;r=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function j(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw u(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function V(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,o=t+3,s=o,a="";const c=[];for(;oB)return"[Array]";const n=Math.min(P,e.length),i=e.length-n,r=[];for(let i=0;i1&&r.push(`... ${i} more items`);return"["+r.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>B)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const i=n.map((([e,n])=>e+": "+J(n,t)));return"{ "+i.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const q=function(e,t){return e instanceof t};class Source{constructor(e,n="GraphQL request",i={line:1,column:1}){"string"==typeof e||t(!1,`Body must be a string. Received: ${Y(e)}.`),this.body=e,this.name=n,this.locationOffset=i,this.locationOffset.line>0||t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function K(e,t){return new Parser(e,t).parseDocument()}class Parser{constructor(e,t){const n=function(e){return q(e,Source)}(e)?e:new Source(e);this._lexer=new Lexer(n),this._options=t}parseName(){const e=this.expectToken(v.NAME);return this.node(e,{kind:m.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:m.DOCUMENT,definitions:this.many(v.SOF,this.parseDefinition,v.EOF)})}parseDefinition(){if(this.peek(v.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===v.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw u(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(v.BRACE_L))return this.node(e,{kind:m.OPERATION_DEFINITION,operation:f.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(v.NAME)&&(n=this.parseName()),this.node(e,{kind:m.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(v.NAME);switch(e.value){case"query":return f.QUERY;case"mutation":return f.MUTATION;case"subscription":return f.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(v.PAREN_L,this.parseVariableDefinition,v.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:m.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(v.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(v.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(v.DOLLAR),this.node(e,{kind:m.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:m.SELECTION_SET,selections:this.many(v.BRACE_L,this.parseSelection,v.BRACE_R)})}parseSelection(){return this.peek(v.SPREAD)?this.parseFragment():this.parseField()}parseField(){var e;const t=this._lexer.token,n=this.parseName();let i,r;this.expectOptionalToken(v.COLON)?(i=n,r=this.parseName()):r=n;const o=this.parseArguments(!1),s=null!==(e=this._options)&&void 0!==e&&e.experimentalClientControlledNullability?this.parseRequiredStatus():void 0,a=this.parseDirectives(!1),c=this.peek(v.BRACE_L)?this.parseSelectionSet():void 0;return this.node(t,{kind:m.FIELD,alias:i,name:r,arguments:o,required:s,directives:a,selectionSet:c})}parseRequiredStatus(){const e=this.parseListNullability(),t=this.parseNullabilityDesignatorNode(e);return null!=t?t:e}parseListNullability(){const e=this._lexer.token;if(this.expectOptionalToken(v.BRACKET_L)){const t=this.parseRequiredStatus();return this.expectToken(v.BRACKET_R),this.node(e,{kind:m.LIST_NULLABILITY,element:t})}}parseNullabilityDesignatorNode(e){var t;return null!==(t=this.parseRequiredDesignatorNode(e))&&void 0!==t?t:this.parseOptionalDesignatorNode(e)}parseRequiredDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.BANG))return this.node(t,{kind:m.REQUIRED_DESIGNATOR,element:e})}parseOptionalDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.QUESTION_MARK))return this.node(t,{kind:m.OPTIONAL_DESIGNATOR,element:e})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(v.PAREN_L,t,v.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(v.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(v.NAME)?this.node(e,{kind:m.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:m.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var e;const t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacyFragmentVariables)?this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case v.BRACKET_L:return this.parseList(e);case v.BRACE_L:return this.parseObject(e);case v.INT:return this._lexer.advance(),this.node(t,{kind:m.INT,value:t.value});case v.FLOAT:return this._lexer.advance(),this.node(t,{kind:m.FLOAT,value:t.value});case v.STRING:case v.BLOCK_STRING:return this.parseStringLiteral();case v.NAME:switch(this._lexer.advance(),t.value){case"true":return this.node(t,{kind:m.BOOLEAN,value:!0});case"false":return this.node(t,{kind:m.BOOLEAN,value:!1});case"null":return this.node(t,{kind:m.NULL});default:return this.node(t,{kind:m.ENUM,value:t.value})}case v.DOLLAR:if(e){if(this.expectToken(v.DOLLAR),this._lexer.token.kind===v.NAME){const e=this._lexer.token.value;throw u(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this._lexer.advance(),this.node(e,{kind:m.STRING,value:e.value,block:e.kind===v.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:m.LIST,values:this.any(v.BRACKET_L,(()=>this.parseValueLiteral(e)),v.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:m.OBJECT,fields:this.any(v.BRACE_L,(()=>this.parseObjectField(e)),v.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(v.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(v.AT),this.node(t,{kind:m.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(v.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(v.BRACKET_R),t=this.node(e,{kind:m.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(v.BANG)?this.node(e,{kind:m.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:m.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(v.STRING)||this.peek(v.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);return this.node(e,{kind:m.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(v.COLON);const n=this.parseNamedType();return this.node(e,{kind:m.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:m.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(v.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseFieldDefinition,v.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(v.COLON);const r=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:m.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:o})}parseArgumentDefs(){return this.optionalMany(v.PAREN_L,this.parseInputValueDef,v.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(v.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(v.EQUALS)&&(r=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:m.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(e,{kind:m.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(v.EQUALS)?this.delimitedMany(v.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(e,{kind:m.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(v.BRACE_L,this.parseEnumValueDefinition,v.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:m.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw u(this._lexer.source,this._lexer.token.start,`${X(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseInputValueDef,v.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===v.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(v.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:m.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:o})}parseDirectiveLocations(){return this.delimitedMany(v.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(h,t.value))return t;throw this.unexpected(e)}node(e,t){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(t.loc=new Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw u(this._lexer.source,t.start,`Expected ${z(e)}, found ${X(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this._lexer.advance(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==v.NAME||t.value!==e)throw u(this._lexer.source,t.start,`Expected "${e}", found ${X(t)}.`);this._lexer.advance()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===v.NAME&&t.value===e&&(this._lexer.advance(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return u(this._lexer.source,t.start,`Unexpected ${X(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}}function X(e){const t=e.value;return z(e.kind)+(null!=t?` "${t}"`:"")}function z(e){return function(e){return e===v.BANG||e===v.QUESTION_MARK||e===v.DOLLAR||e===v.AMP||e===v.PAREN_L||e===v.PAREN_R||e===v.SPREAD||e===v.COLON||e===v.EQUALS||e===v.AT||e===v.BRACKET_L||e===v.BRACKET_R||e===v.BRACE_L||e===v.PIPE||e===v.BRACE_R}(e)?`"${e}"`:e}const H=5;function W(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const o=i.map((e=>`"${e}"`));switch(o.length){case 0:return"";case 1:return r+o[0]+"?";case 2:return r+o[0]+" or "+o[1]+"?"}const s=o.slice(0,H),a=s.pop();return r+s.join(", ")+", or "+a+"?"}function Z(e){return e}function ee(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function te(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function ne(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function ie(e,t){let n=0,i=0;for(;n0);let a=0;do{++i,a=10*a+o-re,o=t.charCodeAt(i)}while(se(o)&&a>0);if(sa)return 1}else{if(ro)return 1;++n,++i}}return e.length-t.length}const re=48,oe=57;function se(e){return!isNaN(e)&&re<=e&&e<=oe}function ae(e,t){const n=Object.create(null),i=new LexicalDistance(e),r=Math.floor(.4*e.length)+1;for(const e of t){const t=i.measure(e,r);void 0!==t&&(n[e]=t)}return Object.keys(n).sort(((e,t)=>{const i=n[e]-n[t];return 0!==i?i:ie(e,t)}))}class LexicalDistance{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=ce(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;const n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let i=ce(n),r=this._inputArray;if(i.lengtht)return;const a=this._rows;for(let e=0;e<=s;e++)a[0][e]=e;for(let e=1;e<=o;e++){const n=a[(e-1)%3],o=a[e%3];let c=o[0]=e;for(let t=1;t<=s;t++){const s=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,o[t-1]+1,n[t-1]+s);if(e>1&&t>1&&i[e-1]===r[t-2]&&i[e-2]===r[t-1]){const n=a[(e-2)%3][t-2];u=Math.min(u,n+1)}ut)return}const c=a[o%3][s];return c<=t?c:void 0}}function ce(e){const t=e.length,n=new Array(t);for(let i=0;ie.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Te(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Ie("(",Te(e.variableDefinitions,", "),")"),n=Te([e.operation,Te([e.name,t]),Te(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+Ie(" = ",n)+Ie(" ",Te(i," "))},SelectionSet:{leave:({selections:e})=>Ne(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r,required:o}){const s=Te([Ie("",e,": "),t],"");let a=s+Ie("(",Te(n,", "),")");a.length>80&&(a=s+Ie("(\n",ge(Te(n,"\n")),"\n)"));const c=Te([a,o],"");return Te([c,Te(i," "),r]," ")}},RequiredDesignator:{leave:({element:e})=>(null!=e?e:"")+"!"},OptionalDesignator:{leave:({element:e})=>(null!=e?e:"")+"?"},ListNullability:{leave:({element:e})=>"["+(null!=e?e:"")+"]"},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Ie(" ",Te(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>Te(["...",Ie("on ",e),Te(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${Ie("(",Te(n,", "),")")} on ${t} ${Ie("",Te(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,o=i.length>1&&i.slice(1).every((e=>0===e.length||y(e.charCodeAt(0)))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||o||s);let p="";const d=r&&y(e.charCodeAt(0));return(l&&!d||o)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(le,pe)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Te(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Te(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Ie("(",Te(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>Ie("",e,"\n")+Te(["schema",Te(t," "),Ne(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te(["scalar",t,Te(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["type",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>Ie("",e,"\n")+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+": "+i+Ie(" ",Te(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>Ie("",e,"\n")+Te([t+": "+n,Ie("= ",i),Te(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["interface",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>Ie("",e,"\n")+Te(["union",t,Te(n," "),Ie("= ",Te(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>Ie("",e,"\n")+Te(["enum",t,Te(n," "),Ne(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te([t,Te(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>Ie("",e,"\n")+Te(["input",t,Te(n," "),Ne(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>Ie("",e,"\n")+"directive @"+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+(i?" repeatable":"")+" on "+Te(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Te(["extend schema",Te(e," "),Ne(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Te(["extend scalar",e,Te(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend type",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend interface",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>Te(["extend union",e,Te(t," "),Ie("= ",Te(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>Te(["extend enum",e,Te(t," "),Ne(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>Te(["extend input",e,Te(t," "),Ne(n)]," ")}};function Te(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function Ne(e){return Ie("{\n",ge(Te(e,"\n")),"\n}")}function Ie(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ge(e){return Ie(" ",e.replace(/\n/g,"\n "))}function _e(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function Oe(e,t){switch(e.kind){case m.NULL:return null;case m.INT:return parseInt(e.value,10);case m.FLOAT:return parseFloat(e.value);case m.STRING:case m.ENUM:case m.BOOLEAN:return e.value;case m.LIST:return e.values.map((e=>Oe(e,t)));case m.OBJECT:return te(e.fields,(e=>e.name.value),(e=>Oe(e.value,t)));case m.VARIABLE:return null==t?void 0:t[e.name.value]}}function be(e){if(null!=e||t(!1,"Must provide name."),"string"==typeof e||t(!1,"Expected name to be a string."),0===e.length)throw new GraphQLError("Expected name to be a non-empty string.");for(let t=1;ts(Oe(e,t)),this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(o=e.extensionASTNodes)&&void 0!==o?o:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||t(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${Y(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||t(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||t(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLObjectType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=()=>ze(e),this._interfaces=()=>Xe(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||t(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${Y(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Xe(e){var n;const i=qe(null!==(n=e.interfaces)&&void 0!==n?n:[]);return Array.isArray(i)||t(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),i}function ze(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>{var r;We(n)||t(!1,`${e.name}.${i} field config must be an object.`),null==n.resolve||"function"==typeof n.resolve||t(!1,`${e.name}.${i} field resolver must be a function if provided, but got: ${Y(n.resolve)}.`);const o=null!==(r=n.args)&&void 0!==r?r:{};return We(o)||t(!1,`${e.name}.${i} args must be an object with argument names as keys.`),{name:be(i),description:n.description,type:n.type,args:He(o),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode}}))}function He(e){return Object.entries(e).map((([e,t])=>({name:be(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode})))}function We(e){return n(e)&&!Array.isArray(e)}function Ze(e){return ne(e,(e=>({description:e.description,type:e.type,args:et(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function et(e){return te(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function tt(e){return Ge(e.type)&&void 0===e.defaultValue}class GraphQLInterfaceType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=ze.bind(void 0,e),this._interfaces=Xe.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLUnionType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._types=nt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function nt(e){const n=qe(e.types);return Array.isArray(n)||t(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),n}class GraphQLEnumType{constructor(e){var n,i,r;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._values=(i=this.name,We(r=e.values)||t(!1,`${i} values must be an object with value names as keys.`),Object.entries(r).map((([e,n])=>(We(n)||t(!1,`${i}.${e} must refer to an object with a "value" key representing an internal value but got: ${Y(n)}.`),{name:Le(e),description:n.description,value:void 0!==n.value?n.value:e,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=ee(this._values,(e=>e.name))}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return this._values}getValue(e){return this._nameLookup[e]}serialize(e){const t=this._valueLookup.get(e);if(void 0===t)throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${Y(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=Y(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${t}.`+it(this,t))}const t=this.getValue(e);if(null==t)throw new GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.`+it(this,e));return t.value}parseLiteral(e,t){if(e.kind!==m.ENUM){const t=ye(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+it(this,t),e)}const n=this.getValue(e.value);if(null==n){const t=ye(e);throw new GraphQLError(`Value "${t}" does not exist in "${this.name}" enum.`+it(this,t),e)}return n.value}toConfig(){const e=te(this.getValues(),(e=>e.name),(e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function it(e,t){return W("the enum value",ae(t,e.getValues().map((e=>e.name))))}class GraphQLInputObjectType{constructor(e){var t;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=rt.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=ne(this.getFields(),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rt(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>(!("resolve"in n)||t(!1,`${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`),{name:be(i),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))}function ot(e){return Ge(e.type)&&void 0===e.defaultValue}function st(e,t){return e===t||(Ge(e)&&Ge(t)||!(!Re(e)||!Re(t)))&&st(e.ofType,t.ofType)}function at(e,t,n){return t===n||(Ge(n)?!!Ge(t)&&at(e,t.ofType,n.ofType):Ge(t)?at(e,t.ofType,n):Re(n)?!!Re(t)&&at(e,t.ofType,n.ofType):!Re(t)&&(Ve(n)&&(we(t)||De(t))&&e.isSubType(n,t)))}function ct(e,t,n){return t===n||(Ve(t)?Ve(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!Ve(n)&&e.isSubType(n,t))}const ut=2147483647,lt=-2147483648,pt=new GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const t=Et(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isInteger(n))throw new GraphQLError(`Int cannot represent non-integer value: ${Y(t)}`);if(n>ut||nut||eut||te.name===t))}function Et(e){if(n(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!n(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function Tt(e){return q(e,GraphQLDirective)}class GraphQLDirective{constructor(e){var i,r;this.name=be(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(i=e.isRepeatable)&&void 0!==i&&i,this.extensions=ue(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||t(!1,`@${e.name} locations must be an Array.`);const o=null!==(r=e.args)&&void 0!==r?r:{};n(o)&&!Array.isArray(o)||t(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=He(o)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:et(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Nt=new GraphQLDirective({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Included when true."}}}),It=new GraphQLDirective({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Skipped when true."}}}),gt="No longer supported",_t=new GraphQLDirective({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[h.FIELD_DEFINITION,h.ARGUMENT_DEFINITION,h.INPUT_FIELD_DEFINITION,h.ENUM_VALUE],args:{reason:{type:ft,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:gt}}}),Ot=new GraphQLDirective({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[h.SCALAR],args:{url:{type:new GraphQLNonNull(ft),description:"The URL that specifies the behavior of this scalar."}}}),bt=Object.freeze([Nt,It,_t,Ot]);function Lt(e,t){if(Ge(t)){const n=Lt(e,t.ofType);return(null==n?void 0:n.kind)===m.NULL?null:n}if(null===e)return{kind:m.NULL};if(void 0===e)return null;if(Re(t)){const n=t.ofType;if("object"==typeof(r=e)&&"function"==typeof(null==r?void 0:r[Symbol.iterator])){const t=[];for(const i of e){const e=Lt(i,n);null!=e&&t.push(e)}return{kind:m.LIST,values:t}}return Lt(e,n)}var r;if(Fe(t)){if(!n(e))return null;const i=[];for(const n of Object.values(t.getFields())){const t=Lt(e[n.name],n.type);t&&i.push({kind:m.OBJECT_FIELD,name:{kind:m.NAME,value:n.name},value:t})}return{kind:m.OBJECT,fields:i}}if(Ue(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:m.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return St.test(e)?{kind:m.INT,value:e}:{kind:m.FLOAT,value:e}}if("string"==typeof n)return xe(t)?{kind:m.ENUM,value:n}:t===mt&&St.test(n)?{kind:m.INT,value:n}:{kind:m.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${Y(n)}.`)}i(!1,"Unexpected input type: "+Y(t))}const St=/^-?(?:0|[1-9][0-9]*)$/,At=new GraphQLObjectType({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:ft,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(kt))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new GraphQLNonNull(kt),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:kt,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:kt,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Dt))),resolve:e=>e.getDirectives()}})}),Dt=new GraphQLObjectType({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isRepeatable:{type:new GraphQLNonNull(ht),resolve:e=>e.isRepeatable},locations:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(wt))),resolve:e=>e.locations},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),wt=new GraphQLEnumType({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:h.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:h.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:h.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:h.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:h.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:h.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:h.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:h.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:h.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:h.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:h.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:h.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:h.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:h.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:h.UNION,description:"Location adjacent to a union definition."},ENUM:{value:h.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:h.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:h.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:h.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),kt=new GraphQLObjectType({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new GraphQLNonNull(Gt),resolve:e=>Ae(e)?Ct.SCALAR:De(e)?Ct.OBJECT:we(e)?Ct.INTERFACE:ke(e)?Ct.UNION:xe(e)?Ct.ENUM:Fe(e)?Ct.INPUT_OBJECT:Re(e)?Ct.LIST:Ge(e)?Ct.NON_NULL:void i(!1,`Unexpected type: "${Y(e)}".`)},name:{type:ft,resolve:e=>"name"in e?e.name:void 0},description:{type:ft,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:ft,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new GraphQLList(new GraphQLNonNull(xt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(De(e)||we(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e){if(De(e)||we(e))return e.getInterfaces()}},possibleTypes:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e,t,n,{schema:i}){if(Ve(e))return i.getPossibleTypes(e)}},enumValues:{type:new GraphQLList(new GraphQLNonNull(Rt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(xe(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new GraphQLList(new GraphQLNonNull(Ft)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Fe(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:kt,resolve:e=>"ofType"in e?e.ofType:void 0}})}),xt=new GraphQLObjectType({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Ft=new GraphQLObjectType({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},defaultValue:{type:ft,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=Lt(n,t);return i?ye(i):null}},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Rt=new GraphQLObjectType({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})});let Ct;!function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"}(Ct||(Ct={}));const Gt=new GraphQLEnumType({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Ct.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Ct.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Ct.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Ct.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Ct.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Ct.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Ct.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Ct.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$t={name:"__schema",type:new GraphQLNonNull(At),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Qt={name:"__type",type:kt,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new GraphQLNonNull(ft),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:i})=>i.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Ut={name:"__typename",type:new GraphQLNonNull(ft),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},jt=Object.freeze([At,Dt,wt,kt,xt,Ft,Rt,Gt]);function Vt(e){return jt.some((({name:t})=>e.name===t))}function Mt(e){if(!function(e){return q(e,GraphQLSchema)}(e))throw new Error(`Expected ${Y(e)} to be a GraphQL schema.`);return e}class GraphQLSchema{constructor(e){var i,r;this.__validationErrors=!0===e.assumeValid?[]:void 0,n(e)||t(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||t(!1,`"types" must be Array if provided but got: ${Y(e.types)}.`),!e.directives||Array.isArray(e.directives)||t(!1,`"directives" must be Array if provided but got: ${Y(e.directives)}.`),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(i=e.extensionASTNodes)&&void 0!==i?i:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(r=e.directives)&&void 0!==r?r:bt;const o=new Set(e.types);if(null!=e.types)for(const t of e.types)o.delete(t),Pt(t,o);null!=this._queryType&&Pt(this._queryType,o),null!=this._mutationType&&Pt(this._mutationType,o),null!=this._subscriptionType&&Pt(this._subscriptionType,o);for(const e of this._directives)if(Tt(e))for(const t of e.args)Pt(t.type,o);Pt(At,o),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of o){if(null==e)continue;const n=e.name;if(n||t(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[n])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${n}".`);if(this._typeMap[n]=e,we(e)){for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(De(e))for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.objects.push(e)}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case f.QUERY:return this.getQueryType();case f.MUTATION:return this.getMutationType();case f.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return ke(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap[e.name];if(void 0===n){if(n=Object.create(null),ke(e))for(const t of e.getTypes())n[t.name]=!0;else{const t=this.getImplementations(e);for(const e of t.objects)n[e.name]=!0;for(const e of t.interfaces)n[e.name]=!0}this._subTypeMap[e.name]=n}return void 0!==n[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t=>t.name===e))}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function Pt(e,t){const n=Je(e);if(!t.has(n))if(t.add(n),ke(n))for(const e of n.getTypes())Pt(e,t);else if(De(n)||we(n)){for(const e of n.getInterfaces())Pt(e,t);for(const e of Object.values(n.getFields())){Pt(e.type,t);for(const n of e.args)Pt(n.type,t)}}else if(Fe(n))for(const e of Object.values(n.getFields()))Pt(e.type,t);return t}function Bt(e){if(Mt(e),e.__validationErrors)return e.__validationErrors;const t=new SchemaValidationContext(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!De(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${Y(n)}.`,null!==(i=Yt(t,f.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var o;r&&!De(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${Y(r)}.`,null!==(o=Yt(t,f.MUTATION))&&void 0!==o?o:r.astNode);const s=t.getSubscriptionType();var a;s&&!De(s)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${Y(s)}.`,null!==(a=Yt(t,f.SUBSCRIPTION))&&void 0!==a?a:s.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(Tt(n)){Jt(e,n);for(const i of n.args){var t;if(Jt(e,i),$e(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${Y(i.type)}.`,i.astNode),tt(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[nn(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${Y(n)}.`,null==n?void 0:n.astNode)}(t),function(e){const t=function(e){const t=Object.create(null),n=[],i=Object.create(null);return r;function r(o){if(t[o.name])return;t[o.name]=!0,i[o.name]=n.length;const s=Object.values(o.getFields());for(const t of s)if(Ge(t.type)&&Fe(t.type.ofType)){const o=t.type.ofType,s=i[o.name];if(n.push(t),void 0===s)r(o);else{const t=n.slice(s),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${o.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[o.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ye(i)?(Vt(i)||Jt(e,i),De(i)||we(i)?(qt(e,i),Kt(e,i)):ke(i)?Ht(e,i):xe(i)?Wt(e,i):Fe(i)&&(Zt(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${Y(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}class SchemaValidationContext{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new GraphQLError(e,n))}getErrors(){return this._errors}}function Yt(e,t){var n;return null===(n=[e.astNode,...e.extensionASTNodes].flatMap((e=>{var t;return null!==(t=null==e?void 0:e.operationTypes)&&void 0!==t?t:[]})).find((e=>e.operation===t)))||void 0===n?void 0:n.type}function Jt(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function qt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const s of n){var i;if(Jt(e,s),!Qe(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Output Type but got: ${Y(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);for(const n of s.args){const i=n.name;var r,o;if(Jt(e,n),!$e(n.type))e.reportError(`The type of ${t.name}.${s.name}(${i}:) must be Input Type but got: ${Y(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(tt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${s.name}(${i}:) cannot be deprecated.`,[nn(n.astNode),null===(o=n.astNode)||void 0===o?void 0:o.type])}}}function Kt(e,t){const n=Object.create(null);for(const i of t.getInterfaces())we(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,en(t,i)):(n[i.name]=!0,zt(e,t,i),Xt(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,en(t,i)):e.reportError(`Type ${Y(t)} must only implement Interface types, it cannot implement ${Y(i)}.`,en(t,i))}function Xt(e,t,n){const i=t.getFields();for(const c of Object.values(n.getFields())){const u=c.name,l=i[u];if(l){var r,o;if(!at(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${Y(c.type)} but ${t.name}.${u} is type ${Y(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(o=l.astNode)||void 0===o?void 0:o.type]);for(const i of c.args){const r=i.name,o=l.args.find((e=>e.name===r));var s,a;if(o){if(!st(i.type,o.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${Y(i.type)} but ${t.name}.${u}(${r}:) is type ${Y(o.type)}.`,[null===(s=i.astNode)||void 0===s?void 0:s.type,null===(a=o.astNode)||void 0===a?void 0:a.type])}else e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expected but ${t.name}.${u} does not provide it.`,[i.astNode,l.astNode])}for(const i of l.args){const r=i.name;!c.args.find((e=>e.name===r))&&tt(i)&&e.reportError(`Object field ${t.name}.${u} includes required argument ${r} that is missing from the Interface field ${n.name}.${u}.`,[i.astNode,c.astNode])}}else e.reportError(`Interface field ${n.name}.${u} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes])}}function zt(e,t,n){const i=t.getInterfaces();for(const r of n.getInterfaces())i.includes(r)||e.reportError(r===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${r.name} because it is implemented by ${n.name}.`,[...en(n,r),...en(t,n)])}function Ht(e,t){const n=t.getTypes();0===n.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);const i=Object.create(null);for(const r of n)i[r.name]?e.reportError(`Union type ${t.name} can only include type ${r.name} once.`,tn(t,r.name)):(i[r.name]=!0,De(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${Y(r)}.`,tn(t,String(r))))}function Wt(e,t){const n=t.getValues();0===n.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(const t of n)Jt(e,t)}function Zt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const o of n){var i,r;if(Jt(e,o),!$e(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Input Type but got: ${Y(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);if(ot(o)&&null!=o.deprecationReason)e.reportError(`Required input field ${t.name}.${o.name} cannot be deprecated.`,[nn(o.astNode),null===(r=o.astNode)||void 0===r?void 0:r.type])}}function en(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.interfaces)&&void 0!==t?t:[]})).filter((e=>e.name.value===t.name))}function tn(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.types)&&void 0!==t?t:[]})).filter((e=>e.name.value===t))}function nn(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===_t.name))}function rn(e,t){switch(t.kind){case m.LIST_TYPE:{const n=rn(e,t.type);return n&&new GraphQLList(n)}case m.NON_NULL_TYPE:{const n=rn(e,t.type);return n&&new GraphQLNonNull(n)}case m.NAMED_TYPE:return e.getType(t.name.value)}}class TypeInfo{constructor(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=n?n:on,t&&($e(t)&&this._inputTypeStack.push(t),je(t)&&this._parentTypeStack.push(t),Qe(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){const t=this._schema;switch(e.kind){case m.SELECTION_SET:{const e=Je(this.getType());this._parentTypeStack.push(je(e)?e:void 0);break}case m.FIELD:{const n=this.getParentType();let i,r;n&&(i=this._getFieldDef(t,n,e),i&&(r=i.type)),this._fieldDefStack.push(i),this._typeStack.push(Qe(r)?r:void 0);break}case m.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case m.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(De(n)?n:void 0);break}case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?rn(t,n):Je(this.getType());this._typeStack.push(Qe(i)?i:void 0);break}case m.VARIABLE_DEFINITION:{const n=rn(t,e.type);this._inputTypeStack.push($e(n)?n:void 0);break}case m.ARGUMENT:{var n;let t,i;const r=null!==(n=this.getDirective())&&void 0!==n?n:this.getFieldDef();r&&(t=r.args.find((t=>t.name===e.name.value)),t&&(i=t.type)),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push($e(i)?i:void 0);break}case m.LIST:{const e=Be(this.getInputType()),t=Re(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push($e(t)?t:void 0);break}case m.OBJECT_FIELD:{const t=Je(this.getInputType());let n,i;Fe(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push($e(n)?n:void 0);break}case m.ENUM:{const t=Je(this.getInputType());let n;xe(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case m.SELECTION_SET:this._parentTypeStack.pop();break;case m.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case m.DIRECTIVE:this._directive=null;break;case m.OPERATION_DEFINITION:case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:this._typeStack.pop();break;case m.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case m.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.LIST:case m.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.ENUM:this._enumValue=null}}}function on(e,t,n){const i=n.name.value;return i===$t.name&&e.getQueryType()===t?$t:i===Qt.name&&e.getQueryType()===t?Qt:i===Ut.name&&je(t)?Ut:De(t)||we(t)?t.getFields()[i]:void 0}function sn(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=ve(t,i.kind).enter;if(r){const o=r.apply(t,n);return void 0!==o&&(e.leave(i),d(o)&&e.enter(o)),o}},leave(...n){const i=n[0],r=ve(t,i.kind).leave;let o;return r&&(o=r.apply(t,n)),e.leave(i),o}}}function an(e){return e.kind===m.OPERATION_DEFINITION||e.kind===m.FRAGMENT_DEFINITION}function cn(e){return e.kind===m.SCALAR_TYPE_DEFINITION||e.kind===m.OBJECT_TYPE_DEFINITION||e.kind===m.INTERFACE_TYPE_DEFINITION||e.kind===m.UNION_TYPE_DEFINITION||e.kind===m.ENUM_TYPE_DEFINITION||e.kind===m.INPUT_OBJECT_TYPE_DEFINITION}function un(e){return e.kind===m.SCALAR_TYPE_EXTENSION||e.kind===m.OBJECT_TYPE_EXTENSION||e.kind===m.INTERFACE_TYPE_EXTENSION||e.kind===m.UNION_TYPE_EXTENSION||e.kind===m.ENUM_TYPE_EXTENSION||e.kind===m.INPUT_OBJECT_TYPE_EXTENSION}function ln(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=e.args.map((e=>e.name));const r=e.getDocument().definitions;for(const e of r)if(e.kind===m.DIRECTIVE_DEFINITION){var o;const n=null!==(o=e.arguments)&&void 0!==o?o:[];t[e.name.value]=n.map((e=>e.name.value))}return{Directive(n){const i=n.name.value,r=t[i];if(n.arguments&&r)for(const t of n.arguments){const n=t.name.value;if(!r.includes(n)){const o=ae(n,r);e.reportError(new GraphQLError(`Unknown argument "${n}" on directive "@${i}".`+W(o),t))}}return!1}}}function pn(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():bt;for(const e of r)t[e.name]=e.locations;const o=e.getDocument().definitions;for(const e of o)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,r,o,s,a){const c=n.name.value,u=t[c];if(!u)return void e.reportError(new GraphQLError(`Unknown directive "@${c}".`,n));const l=function(e){const t=e[e.length-1];switch("kind"in t||i(!1),t.kind){case m.OPERATION_DEFINITION:return function(e){switch(e){case f.QUERY:return h.QUERY;case f.MUTATION:return h.MUTATION;case f.SUBSCRIPTION:return h.SUBSCRIPTION}}(t.operation);case m.FIELD:return h.FIELD;case m.FRAGMENT_SPREAD:return h.FRAGMENT_SPREAD;case m.INLINE_FRAGMENT:return h.INLINE_FRAGMENT;case m.FRAGMENT_DEFINITION:return h.FRAGMENT_DEFINITION;case m.VARIABLE_DEFINITION:return h.VARIABLE_DEFINITION;case m.SCHEMA_DEFINITION:case m.SCHEMA_EXTENSION:return h.SCHEMA;case m.SCALAR_TYPE_DEFINITION:case m.SCALAR_TYPE_EXTENSION:return h.SCALAR;case m.OBJECT_TYPE_DEFINITION:case m.OBJECT_TYPE_EXTENSION:return h.OBJECT;case m.FIELD_DEFINITION:return h.FIELD_DEFINITION;case m.INTERFACE_TYPE_DEFINITION:case m.INTERFACE_TYPE_EXTENSION:return h.INTERFACE;case m.UNION_TYPE_DEFINITION:case m.UNION_TYPE_EXTENSION:return h.UNION;case m.ENUM_TYPE_DEFINITION:case m.ENUM_TYPE_EXTENSION:return h.ENUM;case m.ENUM_VALUE_DEFINITION:return h.ENUM_VALUE;case m.INPUT_OBJECT_TYPE_DEFINITION:case m.INPUT_OBJECT_TYPE_EXTENSION:return h.INPUT_OBJECT;case m.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||i(!1),t.kind===m.INPUT_OBJECT_TYPE_DEFINITION?h.INPUT_FIELD_DEFINITION:h.ARGUMENT_DEFINITION}default:i(!1,"Unexpected kind: "+Y(t.kind))}}(a);l&&!u.includes(l)&&e.reportError(new GraphQLError(`Directive "@${c}" may not be used on ${l}.`,n))}}}function dn(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,o,s,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:s,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===m.SCHEMA_DEFINITION||cn(e)||e.kind===m.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===m.SCHEMA_EXTENSION||un(e)}(p)));if(i&&fn.includes(u))return;const o=ae(u,i?fn.concat(r):r);e.reportError(new GraphQLError(`Unknown type "${u}".`+W(o),t))}var p}}}const fn=[...vt,...jt].map((e=>e.name));function hn(e){const t=[],n=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(n.push(e),!1),Document:{leave(){const i=Object.create(null);for(const n of t)for(const t of e.getRecursivelyReferencedFragments(n))i[t.name.value]=!0;for(const t of n){const n=t.name.value;!0!==i[n]&&e.reportError(new GraphQLError(`Fragment "${n}" is never used.`,t))}}}}}function mn(e,t){const n=[e];for(;Re(Be(n[n.length-1]));){const e=Ce(Be(n[n.length-1])).ofType;n.push(e)}if(t){const e=he(t,{RequiredDesignator:{leave({element:e}){if(e)return new GraphQLNonNull(Be(e));const t=n.pop();return new GraphQLNonNull(Be(t))}},OptionalDesignator:{leave({element:e}){if(e)return Be(e);return Be(n.pop())}},ListNullability:{leave({element:e}){let i=n.pop();if(Re(Be(i))||(i=n.pop()),!i)throw new GraphQLError("List nullability modifier is too deep.",t);const r=Ge(i);return e?r?new GraphQLNonNull(new GraphQLList(e)):new GraphQLList(e):i}}});if(n.length>0)throw new GraphQLError("List nullability modifier is too shallow.",t);return e}return e}function vn(e){switch(e.kind){case m.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:vn(e.value)}))).sort(((e,t)=>ie(e.name.value,t.name.value))))};case m.LIST:return{...e,values:e.values.map(vn)};case m.INT:case m.FLOAT:case m.STRING:case m.BOOLEAN:case m.NULL:case m.ENUM:case m.VARIABLE:return e}var t}function yn(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+yn(t))).join(" and "):e}function En(e,t,n,i,r,o,s){const a=e.getFragment(s);if(!a)return;const[c,u]=bn(e,n,a);if(o!==c){Nn(e,t,n,i,r,o,c);for(const a of u)i.has(a,s,r)||(i.add(a,s,r),En(e,t,n,i,r,o,a))}}function Tn(e,t,n,i,r,o,s){if(o===s)return;if(i.has(o,s,r))return;i.add(o,s,r);const a=e.getFragment(o),c=e.getFragment(s);if(!a||!c)return;const[u,l]=bn(e,n,a),[p,d]=bn(e,n,c);Nn(e,t,n,i,r,u,p);for(const s of d)Tn(e,t,n,i,r,o,s);for(const o of l)Tn(e,t,n,i,r,o,s)}function Nn(e,t,n,i,r,o,s){for(const[a,c]of Object.entries(o)){const o=s[a];if(o)for(const s of c)for(const c of o){const o=In(e,n,i,r,a,s,c);o&&t.push(o)}}}function In(e,t,n,i,r,o,s){const[a,c,u]=o,[l,p,d]=s,f=i||a!==l&&De(a)&&De(l);if(!f){const e=c.name.value,t=p.name.value;if(e!==t)return[[r,`"${e}" and "${t}" are different fields`],[c],[p]];if(gn(c)!==gn(p))return[[r,"they have differing arguments"],[c],[p]]}const h=null==u?void 0:u.type,m=null==d?void 0:d.type;if(h&&m){const e=mn(h,c.required),t=mn(m,p.required);if(_n(e,t))return[[r,`they return conflicting types "${Y(e)}" and "${Y(t)}"`],[c],[p]]}const v=c.selectionSet,y=p.selectionSet;if(v&&y){const i=function(e,t,n,i,r,o,s,a){const c=[],[u,l]=On(e,t,r,o),[p,d]=On(e,t,s,a);Nn(e,c,t,n,i,u,p);for(const r of d)En(e,c,t,n,i,u,r);for(const r of l)En(e,c,t,n,i,p,r);for(const r of l)for(const o of d)Tn(e,c,t,n,i,r,o);return c}(e,t,n,f,Je(h),v,Je(m),y);return function(e,t,n,i){if(e.length>0)return[[t,e.map((([e])=>e))],[n,...e.map((([,e])=>e)).flat()],[i,...e.map((([,,e])=>e)).flat()]]}(i,r,c,p)}}function gn(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return ye(vn({kind:m.OBJECT,fields:n.map((e=>({kind:m.OBJECT_FIELD,name:e.name,value:e.value})))}))}function _n(e,t){return Re(e)?!Re(t)||_n(e.ofType,t.ofType):!!Re(t)||(Ge(e)?!Ge(t)||_n(e.ofType,t.ofType):!!Ge(t)||!(!Ue(e)&&!Ue(t))&&e!==t)}function On(e,t,n,i){const r=t.get(i);if(r)return r;const o=Object.create(null),s=Object.create(null);Ln(e,n,i,o,s);const a=[o,Object.keys(s)];return t.set(i,a),a}function bn(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=rn(e.getSchema(),n.typeCondition);return On(e,t,r,n.selectionSet)}function Ln(e,t,n,i,r){for(const o of n.selections)switch(o.kind){case m.FIELD:{const e=o.name.value;let n;(De(t)||we(t))&&(n=t.getFields()[e]);const r=o.alias?o.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,o,n]);break}case m.FRAGMENT_SPREAD:r[o.name.value]=!0;break;case m.INLINE_FRAGMENT:{const n=o.typeCondition,s=n?rn(e.getSchema(),n):t;Ln(e,s,o.selectionSet,i,r);break}}}class PairSet{constructor(){this._data=new Map}has(e,t,n){var i;const[r,o]=ee.name));const o=e.getDocument().definitions;for(const e of o)if(e.kind===m.DIRECTIVE_DEFINITION){var s;const t=null!==(s=e.arguments)&&void 0!==s?s:[];n[e.name.value]=ee(t.filter(Dn),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var o;const n=null!==(o=t.arguments)&&void 0!==o?o:[],s=new Set(n.map((e=>e.name.value)));for(const[n,o]of Object.entries(r))if(!s.has(n)){const r=Se(o.type)?Y(o.type):ye(o.type);e.reportError(new GraphQLError(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,t))}}}}}}function Dn(e){return e.type.kind===m.NON_NULL_TYPE&&null==e.defaultValue}function wn(e,t,n){if(e){if(e.kind===m.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&Ge(t))return;return r}if(Ge(t)){if(e.kind===m.NULL)return;return wn(e,t.ofType,n)}if(e.kind===m.NULL)return null;if(Re(t)){const i=t.ofType;if(e.kind===m.LIST){const t=[];for(const r of e.values)if(kn(r,n)){if(Ge(i))return;t.push(null)}else{const e=wn(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=wn(e,i,n);if(void 0===r)return;return[r]}if(Fe(t)){if(e.kind!==m.OBJECT)return;const i=Object.create(null),r=ee(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||kn(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(Ge(e.type))return;continue}const o=wn(t.value,e.type,n);if(void 0===o)return;i[e.name]=o}return i}if(Ue(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}i(!1,"Unexpected input type: "+Y(t))}}function kn(e,t){return e.kind===m.VARIABLE&&(null==t||void 0===t[e.name.value])}function xn(e,t,n){var i;const r=null===(i=t.directives)||void 0===i?void 0:i.find((t=>t.name.value===e.name));if(r)return function(e,t,n){var i;const r={},o=ee(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,c=i.type,u=o[e];if(!u){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was not provided.`,t);continue}const l=u.value;let p=l.kind===m.NULL;if(l.kind===m.VARIABLE){const t=l.name.value;if(null==n||(s=n,a=t,!Object.prototype.hasOwnProperty.call(s,a))){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was provided the variable "$${t}" which was not provided a runtime value.`,l);continue}p=null==n[t]}if(p&&Ge(c))throw new GraphQLError(`Argument "${e}" of non-null type "${Y(c)}" must not be null.`,l);const d=wn(l,c,n);if(void 0===d)throw new GraphQLError(`Argument "${e}" has invalid value ${ye(l)}.`,l);r[e]=d}var s,a;return r}(e,r,n)}function Fn(e,t,n,i,r){const o=new Map;return Rn(e,t,n,i,r,o,new Set),o}function Rn(e,t,n,i,r,o,s){for(const c of r.selections)switch(c.kind){case m.FIELD:{if(!Cn(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=o.get(e);void 0!==t?t.push(c):o.set(e,[c]);break}case m.INLINE_FRAGMENT:if(!Cn(n,c)||!Gn(e,c,i))continue;Rn(e,t,n,i,c.selectionSet,o,s);break;case m.FRAGMENT_SPREAD:{const r=c.name.value;if(s.has(r)||!Cn(n,c))continue;s.add(r);const a=t[r];if(!a||!Gn(e,a,i))continue;Rn(e,t,n,i,a.selectionSet,o,s);break}}var a}function Cn(e,t){const n=xn(It,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=xn(Nt,t,e);return!1!==(null==i?void 0:i.if)}function Gn(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=rn(e,i);return r===n||!!Ve(r)&&e.isSubType(r,n)}function $n(e,t){const n=new Map;for(const i of e){const e=t(i),r=n.get(e);void 0===r?n.set(e,[i]):r.push(i)}return n}function Qn(e){return{Field:t,Directive:t};function t(t){var n;const i=$n(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one argument named "${t}".`,n.map((e=>e.name))))}}function Un(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const o=Object.create(null),s=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION)i=o;else if(cn(n)||un(n)){const e=n.name.value;i=s[e],void 0===i&&(s[e]=i=Object.create(null))}else i=Object.create(null);for(const r of n.directives){const n=r.name.value;t[n]&&(i[n]?e.reportError(new GraphQLError(`The directive "@${n}" can only be used once at this location.`,[i[n],r])):i[n]=r)}}}}function jn(e,t){return!!(De(e)||we(e)||Fe(e))&&null!=e.getFields()[t]}function Vn(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||i(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new GraphQLError(`There can be only one input field named "${i}".`,[n[i],t.name])):n[i]=t.name}}}function Mn(e,t){const n=e.getInputType();if(!n)return;const i=Je(n);if(Ue(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}catch(i){const r=Y(n);i instanceof GraphQLError?e.reportError(i):e.reportError(new GraphQLError(`Expected value of type "${r}", found ${ye(t)}; `+i.message,t,void 0,void 0,void 0,i))}else{const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}function Pn(e,t,n,i,r){if(Ge(i)&&!Ge(t)){if(!(null!=n&&n.kind!==m.NULL)&&!(void 0!==r))return!1;return at(e,t,i.ofType)}return at(e,t,i)}const Bn=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!an(n)){const t=n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new GraphQLError(`The ${t} definition is not executable.`,n))}return!1}}},function(e){const t=Object.create(null);return{OperationDefinition(n){const i=n.name;return i&&(t[i.value]?e.reportError(new GraphQLError(`There can be only one operation named "${i.value}".`,[t[i.value],i])):t[i.value]=i),!1},FragmentDefinition:()=>!1}},function(e){let t=0;return{Document(e){t=e.definitions.filter((e=>e.kind===m.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new GraphQLError("This anonymous operation must be the only defined operation.",n))}}},function(e){return{OperationDefinition(t){if("subscription"===t.operation){const n=e.getSchema(),i=n.getSubscriptionType();if(i){const r=t.name?t.name.value:null,o=Object.create(null),s=e.getDocument(),a=Object.create(null);for(const e of s.definitions)e.kind===m.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=Fn(n,a,o,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",t))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",t))}}}}}},dn,function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=rn(e.getSchema(),n);if(t&&!je(t)){const t=ye(n);e.reportError(new GraphQLError(`Fragment cannot condition on non composite type "${t}".`,n))}}},FragmentDefinition(t){const n=rn(e.getSchema(),t.typeCondition);if(n&&!je(n)){const n=ye(t.typeCondition);e.reportError(new GraphQLError(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,t.typeCondition))}}}},function(e){return{VariableDefinition(t){const n=rn(e.getSchema(),t.type);if(void 0!==n&&!$e(n)){const n=t.variable.name.value,i=ye(t.type);e.reportError(new GraphQLError(`Variable "$${n}" cannot be non-input type "${i}".`,t.type))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Ue(Je(n))){if(i){const r=t.name.value,o=Y(n);e.reportError(new GraphQLError(`Field "${r}" must not have a selection since type "${o}" has no subfields.`,i))}}else if(!i){const i=t.name.value,r=Y(n);e.reportError(new GraphQLError(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,t))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let o=W("to use an inline fragment on",function(e,t,n){if(!Ve(t))return[];const i=new Set,r=Object.create(null);for(const s of e.getPossibleTypes(t))if(s.getFields()[n]){i.add(s),r[s.name]=1;for(const e of s.getInterfaces()){var o;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(o=r[e.name])&&void 0!==o?o:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:we(t)&&e.isSubType(t,n)?-1:we(n)&&e.isSubType(n,t)?1:ie(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===o&&(o=W(function(e,t){if(De(e)||we(e)){return ae(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new GraphQLError(`Cannot query field "${r}" on type "${n.name}".`+o,t))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new GraphQLError(`There can be only one fragment named "${i}".`,[t[i],n.name])):t[i]=n.name,!1}}},function(e){return{FragmentSpread(t){const n=t.name.value;e.getFragment(n)||e.reportError(new GraphQLError(`Unknown fragment "${n}".`,t.name))}}},hn,function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(je(n)&&je(i)&&!ct(e.getSchema(),n,i)){const r=Y(i),o=Y(n);e.reportError(new GraphQLError(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${o}".`,t))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=rn(e.getSchema(),n.typeCondition);if(je(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!ct(e.getSchema(),i,r)){const o=Y(r),s=Y(i);e.reportError(new GraphQLError(`Fragment "${n}" cannot be spread here as objects of type "${o}" can never be of type "${s}".`,t))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(o){if(t[o.name.value])return;const s=o.name.value;t[s]=!0;const a=e.getFragmentSpreads(o.selectionSet);if(0!==a.length){i[s]=n.length;for(const t of a){const o=t.name.value,s=i[o];if(n.push(t),void 0===s){const t=e.getFragment(o);t&&r(t)}else{const t=n.slice(s),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new GraphQLError(`Cannot spread fragment "${o}" within itself`+(""!==i?` via ${i}.`:"."),t))}n.pop()}i[s]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=$n(null!==(n=t.variableDefinitions)&&void 0!==n?n:[],(e=>e.variable.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one variable named "$${t}".`,n.map((e=>e.variable.name))))}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:r}of i){const i=r.name.value;!0!==t[i]&&e.reportError(new GraphQLError(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,[r,n]))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}},function(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(n){const i=Object.create(null),r=e.getRecursiveVariableUsages(n);for(const{node:e}of r)i[e.name.value]=!0;for(const r of t){const t=r.variable.name.value;!0!==i[t]&&e.reportError(new GraphQLError(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,r))}}},VariableDefinition(e){t.push(e)}}},pn,Un,function(e){return{...ln(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,o=ae(n,i.args.map((e=>e.name)));e.reportError(new GraphQLError(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+W(o),t))}}}},Qn,function(e){return{ListValue(t){if(!Re(Be(e.getParentInputType())))return Mn(e,t),!1},ObjectValue(t){const n=Je(e.getInputType());if(!Fe(n))return Mn(e,t),!1;const i=ee(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&ot(r)){const i=Y(r.type);e.reportError(new GraphQLError(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,t))}}},ObjectField(t){const n=Je(e.getParentInputType());if(!e.getInputType()&&Fe(n)){const i=ae(t.name.value,Object.keys(n.getFields()));e.reportError(new GraphQLError(`Field "${t.name.value}" is not defined by type "${n.name}".`+W(i),t))}},NullValue(t){const n=e.getInputType();Ge(n)&&e.reportError(new GraphQLError(`Expected value of type "${Y(n)}", found ${ye(t)}.`,t))},EnumValue:t=>Mn(e,t),IntValue:t=>Mn(e,t),FloatValue:t=>Mn(e,t),StringValue:t=>Mn(e,t),BooleanValue:t=>Mn(e,t)}},function(e){return{...An(e),Field:{leave(t){var n;const i=e.getFieldDef();if(!i)return!1;const r=new Set(null===(n=t.arguments)||void 0===n?void 0:n.map((e=>e.name.value)));for(const n of i.args)if(!r.has(n.name)&&tt(n)){const r=Y(n.type);e.reportError(new GraphQLError(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,t))}}}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:n,type:r,defaultValue:o}of i){const i=n.name.value,s=t[i];if(s&&r){const t=e.getSchema(),a=rn(t,s.type);if(a&&!Pn(t,a,s.defaultValue,r,o)){const t=Y(a),o=Y(r);e.reportError(new GraphQLError(`Variable "$${i}" of type "${t}" used in position expecting type "${o}".`,[s,n]))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){return{Field(t){const n=e.getFieldDef(),i=t.required;if(n&&i){const r=function(e){let t=e,n=0;for(;Re(Be(t));){t=Ce(Be(t)).ofType,n+=1}return n}(n.type),o=he(i,{RequiredDesignator:{leave:({element:e})=>null!=e?e:0},OptionalDesignator:{leave:({element:e})=>null!=e?e:0},ListNullability:{leave:({element:e})=>(null!=e?e:0)+1}});r>o?e.reportError(new GraphQLError("List nullability modifier is too shallow.",t.required)):r1)for(let r=0;r0&&e.reportError(new GraphQLError("Must provide only one schema definition.",t)),++s)}}},function(e){const t=e.getSchema(),n=Object.create(null),i=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:r,SchemaExtension:r};function r(t){var r;const o=null!==(r=t.operationTypes)&&void 0!==r?r:[];for(const t of o){const r=t.operation,o=n[r];i[r]?e.reportError(new GraphQLError(`Type for ${r} already defined in the schema. It cannot be redefined.`,t)):o?e.reportError(new GraphQLError(`There can be only one ${r} type in schema.`,[o,t])):n[r]=t}return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(i){const r=i.name.value;if(null==n||!n.getType(r))return t[r]?e.reportError(new GraphQLError(`There can be only one type named "${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Type "${r}" already exists in the schema. It cannot also be defined in this type definition.`,i.name))}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:r,EnumTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.values)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value,r=n[o];xe(r)&&r.getValue(i)?e.reportError(new GraphQLError(`Enum value "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Enum value "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:r,InputObjectTypeExtension:r,InterfaceTypeDefinition:r,InterfaceTypeExtension:r,ObjectTypeDefinition:r,ObjectTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.fields)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value;jn(n[o],i)?e.reportError(new GraphQLError(`Field "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Field "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){return{DirectiveDefinition(e){var t;const i=null!==(t=e.arguments)&&void 0!==t?t:[];return n(`@${e.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(e){var t;const i=e.name.value,r=null!==(t=e.fields)&&void 0!==t?t:[];for(const e of r){var o;n(`${i}.${e.name.value}`,null!==(o=e.arguments)&&void 0!==o?o:[])}return!1}function n(t,n){const i=$n(n,(e=>e.name.value));for(const[n,r]of i)r.length>1&&e.reportError(new GraphQLError(`Argument "${t}(${n}:)" can only be defined once.`,r.map((e=>e.name))));return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{DirectiveDefinition(i){const r=i.name.value;if(null==n||!n.getDirective(r))return t[r]?e.reportError(new GraphQLError(`There can be only one directive named "@${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Directive "@${r}" already exists in the schema. It cannot be redefined.`,i.name))}}},dn,pn,Un,function(e){const t=e.getSchema(),n=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(n[t.name.value]=t);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(r){const o=r.name.value,s=n[o],a=null==t?void 0:t.getType(o);let c;if(s?c=Sn[s.kind]:a&&(c=function(e){if(Ae(e))return m.SCALAR_TYPE_EXTENSION;if(De(e))return m.OBJECT_TYPE_EXTENSION;if(we(e))return m.INTERFACE_TYPE_EXTENSION;if(ke(e))return m.UNION_TYPE_EXTENSION;if(xe(e))return m.ENUM_TYPE_EXTENSION;if(Fe(e))return m.INPUT_OBJECT_TYPE_EXTENSION;i(!1,"Unexpected type: "+Y(e))}(a)),c){if(c!==r.kind){const t=function(e){switch(e){case m.SCALAR_TYPE_EXTENSION:return"scalar";case m.OBJECT_TYPE_EXTENSION:return"object";case m.INTERFACE_TYPE_EXTENSION:return"interface";case m.UNION_TYPE_EXTENSION:return"union";case m.ENUM_TYPE_EXTENSION:return"enum";case m.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:i(!1,"Unexpected kind: "+Y(e))}}(r.kind);e.reportError(new GraphQLError(`Cannot extend non-${t} type "${o}".`,s?[s,r]:r))}}else{const i=ae(o,Object.keys({...n,...null==t?void 0:t.getTypeMap()}));e.reportError(new GraphQLError(`Cannot extend type "${o}" because it is not defined.`+W(i),r.name))}}},ln,Qn,Vn,An]);class ASTValidationContext{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const e of this.getDocument().definitions)e.kind===m.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];const n=[e];let i;for(;i=n.pop();)for(const e of i.selections)e.kind===m.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&n.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];const n=Object.create(null),i=[e.selectionSet];let r;for(;r=i.pop();)for(const e of this.getFragmentSpreads(r)){const r=e.name.value;if(!0!==n[r]){n[r]=!0;const e=this.getFragment(r);e&&(t.push(e),i.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class SDLValidationContext extends ASTValidationContext{constructor(e,t,n){super(e,n),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class ValidationContext extends ASTValidationContext{constructor(e,t,n,i){super(t,i),this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){const n=[],i=new TypeInfo(this._schema);he(e,sn(i,{VariableDefinition:()=>!1,Variable(e){n.push({node:e,type:i.getInputType(),defaultValue:i.getDefaultValue()})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(const n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Jn(e,n,i=Bn,r,o=new TypeInfo(e)){var s;const a=null!==(s=null==r?void 0:r.maxErrors)&&void 0!==s?s:100;n||t(!1,"Must provide document."),function(e){const t=Bt(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const c=Object.freeze({}),u=[],l=new ValidationContext(e,n,o,(e=>{if(u.length>=a)throw u.push(new GraphQLError("Too many validation errors, error limit reached. Validation aborted.")),c;u.push(e)})),p=me(i.map((e=>e(l))));try{he(n,sn(o,p))}catch(e){if(e!==c)throw e}return u}function qn(e,t,n=Yn){const i=[],r=new SDLValidationContext(e,t,(e=>{i.push(e)}));return he(e,me(n.map((e=>e(r))))),i}function Kn(e,i){n(e)&&n(e.__schema)||t(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${Y(e)}.`);const r=e.__schema,o=te(r.types,(e=>e.name),(e=>function(e){if(null!=e&&null!=e.name&&null!=e.kind)switch(e.kind){case Ct.SCALAR:return new GraphQLScalarType({name:(i=e).name,description:i.description,specifiedByURL:i.specifiedByURL});case Ct.OBJECT:return new GraphQLObjectType({name:(n=e).name,description:n.description,interfaces:()=>h(n),fields:()=>m(n)});case Ct.INTERFACE:return new GraphQLInterfaceType({name:(t=e).name,description:t.description,interfaces:()=>h(t),fields:()=>m(t)});case Ct.UNION:return function(e){if(!e.possibleTypes){const t=Y(e);throw new Error(`Introspection result missing possibleTypes: ${t}.`)}return new GraphQLUnionType({name:e.name,description:e.description,types:()=>e.possibleTypes.map(d)})}(e);case Ct.ENUM:return function(e){if(!e.enumValues){const t=Y(e);throw new Error(`Introspection result missing enumValues: ${t}.`)}return new GraphQLEnumType({name:e.name,description:e.description,values:te(e.enumValues,(e=>e.name),(e=>({description:e.description,deprecationReason:e.deprecationReason})))})}(e);case Ct.INPUT_OBJECT:return function(e){if(!e.inputFields){const t=Y(e);throw new Error(`Introspection result missing inputFields: ${t}.`)}return new GraphQLInputObjectType({name:e.name,description:e.description,fields:()=>E(e.inputFields)})}(e)}var t;var n;var i;const r=Y(e);throw new Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${r}.`)}(e)));for(const e of[...vt,...jt])o[e.name]&&(o[e.name]=e);const s=r.queryType?d(r.queryType):null,a=r.mutationType?d(r.mutationType):null,c=r.subscriptionType?d(r.subscriptionType):null,u=r.directives?r.directives.map((function(e){if(!e.args){const t=Y(e);throw new Error(`Introspection result missing directive args: ${t}.`)}if(!e.locations){const t=Y(e);throw new Error(`Introspection result missing directive locations: ${t}.`)}return new GraphQLDirective({name:e.name,description:e.description,isRepeatable:e.isRepeatable,locations:e.locations.slice(),args:E(e.args)})})):[];return new GraphQLSchema({description:r.description,query:s,mutation:a,subscription:c,types:Object.values(o),directives:u,assumeValid:null==i?void 0:i.assumeValid});function l(e){if(e.kind===Ct.LIST){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");return new GraphQLList(l(t))}if(e.kind===Ct.NON_NULL){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");const n=l(t);return new GraphQLNonNull(function(e){if(!Pe(e))throw new Error(`Expected ${Y(e)} to be a GraphQL nullable type.`);return e}(n))}return p(e)}function p(e){const t=e.name;if(!t)throw new Error(`Unknown type reference: ${Y(e)}.`);const n=o[t];if(!n)throw new Error(`Invalid or incomplete schema, unknown type: ${t}. Ensure that a full introspection query is used in order to build a client schema.`);return n}function d(e){return function(e){if(!De(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Object type.`);return e}(p(e))}function f(e){return function(e){if(!we(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Interface type.`);return e}(p(e))}function h(e){if(null===e.interfaces&&e.kind===Ct.INTERFACE)return[];if(!e.interfaces){const t=Y(e);throw new Error(`Introspection result missing interfaces: ${t}.`)}return e.interfaces.map(f)}function m(e){if(!e.fields)throw new Error(`Introspection result missing fields: ${Y(e)}.`);return te(e.fields,(e=>e.name),y)}function y(e){const t=l(e.type);if(!Qe(t)){const e=Y(t);throw new Error(`Introspection must provide output type for fields, but received: ${e}.`)}if(!e.args){const t=Y(e);throw new Error(`Introspection result missing field args: ${t}.`)}return{description:e.description,deprecationReason:e.deprecationReason,type:t,args:E(e.args)}}function E(e){return te(e,(e=>e.name),T)}function T(e){const t=l(e.type);if(!$e(t)){const e=Y(t);throw new Error(`Introspection must provide input type for arguments, but received: ${e}.`)}const n=null!=e.defaultValue?wn(function(e,t){const n=new Parser(e,t);n.expectToken(v.SOF);const i=n.parseValueLiteral(!1);return n.expectToken(v.EOF),i}(e.defaultValue),t):void 0;return{description:e.description,type:t,defaultValue:n,deprecationReason:e.deprecationReason}}}function Xn(e,n,i){Mt(e),null!=n&&n.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==i?void 0:i.assumeValid)&&!0!==(null==i?void 0:i.assumeValidSDL)&&function(e,t){const n=qn(e,t);if(0!==n.length)throw new Error(n.map((e=>e.message)).join("\n\n"))}(n,e);const r=e.toConfig(),o=zn(r,n,i);return r===o?e:new GraphQLSchema(o)}function zn(e,t,n){var r,o,s,a;const c=[],u=Object.create(null),l=[];let p;const d=[];for(const e of t.definitions)if(e.kind===m.SCHEMA_DEFINITION)p=e;else if(e.kind===m.SCHEMA_EXTENSION)d.push(e);else if(cn(e))c.push(e);else if(un(e)){const t=e.name.value,n=u[t];u[t]=n?n.concat([e]):[e]}else e.kind===m.DIRECTIVE_DEFINITION&&l.push(e);if(0===Object.keys(u).length&&0===c.length&&0===l.length&&0===d.length&&null==p)return e;const f=Object.create(null);for(const t of e.types)f[t.name]=T(t);for(const e of c){var h;const t=e.name.value;f[t]=null!==(h=Hn[t])&&void 0!==h?h:k(e)}const v={query:e.query&&E(e.query),mutation:e.mutation&&E(e.mutation),subscription:e.subscription&&E(e.subscription),...p&&g([p]),...g(d)};return{description:null===(r=p)||void 0===r||null===(o=r.description)||void 0===o?void 0:o.value,...v,types:Object.values(f),directives:[...e.directives.map((function(e){const t=e.toConfig();return new GraphQLDirective({...t,args:ne(t.args,I)})})),...l.map((function(e){var t;return new GraphQLDirective({name:e.name.value,description:null===(t=e.description)||void 0===t?void 0:t.value,locations:e.locations.map((({value:e})=>e)),isRepeatable:e.repeatable,args:L(e.arguments),astNode:e})}))],extensions:Object.create(null),astNode:null!==(s=p)&&void 0!==s?s:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:null!==(a=null==n?void 0:n.assumeValid)&&void 0!==a&&a};function y(e){return Re(e)?new GraphQLList(y(e.ofType)):Ge(e)?new GraphQLNonNull(y(e.ofType)):E(e)}function E(e){return f[e.name]}function T(e){return Vt(e)||yt(e)?e:Ae(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];let r=n.specifiedByURL;for(const e of i){var o;r=null!==(o=Zn(e))&&void 0!==o?o:r}return new GraphQLScalarType({...n,specifiedByURL:r,extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):De(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLObjectType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):we(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInterfaceType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):ke(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLUnionType({...n,types:()=>[...e.getTypes().map(E),...w(i)],extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):xe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[e.name])&&void 0!==t?t:[];return new GraphQLEnumType({...n,values:{...n.values,...A(i)},extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Fe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInputObjectType({...n,fields:()=>({...ne(n.fields,(e=>({...e,type:y(e.type)}))),...S(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):void i(!1,"Unexpected type: "+Y(e))}function N(e){return{...e,type:y(e.type),args:e.args&&ne(e.args,I)}}function I(e){return{...e,type:y(e.type)}}function g(e){const t={};for(const i of e){var n;const e=null!==(n=i.operationTypes)&&void 0!==n?n:[];for(const n of e)t[n.operation]=_(n.type)}return t}function _(e){var t;const n=e.name.value,i=null!==(t=Hn[n])&&void 0!==t?t:f[n];if(void 0===i)throw new Error(`Unknown type: "${n}".`);return i}function O(e){return e.kind===m.LIST_TYPE?new GraphQLList(O(e.type)):e.kind===m.NON_NULL_TYPE?new GraphQLNonNull(O(e.type)):_(e)}function b(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={type:O(n.type),description:null===(i=n.description)||void 0===i?void 0:i.value,args:L(n.arguments),deprecationReason:Wn(n),astNode:n}}}return t}function L(e){const t=null!=e?e:[],n=Object.create(null);for(const e of t){var i;const t=O(e.type);n[e.name.value]={type:t,description:null===(i=e.description)||void 0===i?void 0:i.value,defaultValue:wn(e.defaultValue,t),deprecationReason:Wn(e),astNode:e}}return n}function S(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;const e=O(n.type);t[n.name.value]={type:e,description:null===(i=n.description)||void 0===i?void 0:i.value,defaultValue:wn(n.defaultValue,e),deprecationReason:Wn(n),astNode:n}}}return t}function A(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.values)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={description:null===(i=n.description)||void 0===i?void 0:i.value,deprecationReason:Wn(n),astNode:n}}}return t}function D(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.interfaces)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function w(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.types)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function k(e){var t;const n=e.name.value,i=null!==(t=u[n])&&void 0!==t?t:[];switch(e.kind){case m.OBJECT_TYPE_DEFINITION:{var r;const t=[e,...i];return new GraphQLObjectType({name:n,description:null===(r=e.description)||void 0===r?void 0:r.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.INTERFACE_TYPE_DEFINITION:{var o;const t=[e,...i];return new GraphQLInterfaceType({name:n,description:null===(o=e.description)||void 0===o?void 0:o.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.ENUM_TYPE_DEFINITION:{var s;const t=[e,...i];return new GraphQLEnumType({name:n,description:null===(s=e.description)||void 0===s?void 0:s.value,values:A(t),astNode:e,extensionASTNodes:i})}case m.UNION_TYPE_DEFINITION:{var a;const t=[e,...i];return new GraphQLUnionType({name:n,description:null===(a=e.description)||void 0===a?void 0:a.value,types:()=>w(t),astNode:e,extensionASTNodes:i})}case m.SCALAR_TYPE_DEFINITION:var c;return new GraphQLScalarType({name:n,description:null===(c=e.description)||void 0===c?void 0:c.value,specifiedByURL:Zn(e),astNode:e,extensionASTNodes:i});case m.INPUT_OBJECT_TYPE_DEFINITION:{var l;const t=[e,...i];return new GraphQLInputObjectType({name:n,description:null===(l=e.description)||void 0===l?void 0:l.value,fields:()=>S(t),astNode:e,extensionASTNodes:i})}}}}const Hn=ee([...vt,...jt],(e=>e.name));function Wn(e){const t=xn(_t,e);return null==t?void 0:t.reason}function Zn(e){const t=xn(Ot,e);return null==t?void 0:t.url}function ei(e,n){null!=e&&e.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==n?void 0:n.assumeValid)&&!0!==(null==n?void 0:n.assumeValidSDL)&&function(e){const t=qn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const i=zn({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},e,n);if(null==i.astNode)for(const e of i.types)switch(e.name){case"Query":i.query=e;break;case"Mutation":i.mutation=e;break;case"Subscription":i.subscription=e}const r=[...i.directives,...bt.filter((e=>i.directives.every((t=>t.name!==e.name))))];return new GraphQLSchema({...i,directives:r})}function ti(e){return function(e,t,n){const r=e.getDirectives().filter(t),o=Object.values(e.getTypeMap()).filter(n);return[ii(e),...r.map((e=>function(e){return li(e)+"directive @"+e.name+ai(e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}(e))),...o.map((e=>function(e){if(Ae(e))return function(e){return li(e)+`scalar ${e.name}`+function(e){if(null==e.specifiedByURL)return"";return` @specifiedBy(url: ${ye({kind:m.STRING,value:e.specifiedByURL})})`}(e)}(e);if(De(e))return function(e){return li(e)+`type ${e.name}`+ri(e)+oi(e)}(e);if(we(e))return function(e){return li(e)+`interface ${e.name}`+ri(e)+oi(e)}(e);if(ke(e))return function(e){const t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return li(e)+"union "+e.name+n}(e);if(xe(e))return function(e){const t=e.getValues().map(((e,t)=>li(e," ",!t)+" "+e.name+ui(e.deprecationReason)));return li(e)+`enum ${e.name}`+si(t)}(e);if(Fe(e))return function(e){const t=Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+ci(e)));return li(e)+`input ${e.name}`+si(t)}(e);i(!1,"Unexpected type: "+Y(e))}(e)))].filter(Boolean).join("\n\n")}(e,(e=>{return t=e,!bt.some((({name:e})=>e===t.name));var t}),ni)}function ni(e){return!yt(e)&&!Vt(e)}function ii(e){if(null==e.description&&function(e){const t=e.getQueryType();if(t&&"Query"!==t.name)return!1;const n=e.getMutationType();if(n&&"Mutation"!==n.name)return!1;const i=e.getSubscriptionType();if(i&&"Subscription"!==i.name)return!1;return!0}(e))return;const t=[],n=e.getQueryType();n&&t.push(` query: ${n.name}`);const i=e.getMutationType();i&&t.push(` mutation: ${i.name}`);const r=e.getSubscriptionType();return r&&t.push(` subscription: ${r.name}`),li(e)+`schema {\n${t.join("\n")}\n}`}function ri(e){const t=e.getInterfaces();return t.length?" implements "+t.map((e=>e.name)).join(" & "):""}function oi(e){return si(Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+e.name+ai(e.args," ")+": "+String(e.type)+ui(e.deprecationReason))))}function si(e){return 0!==e.length?" {\n"+e.join("\n")+"\n}":""}function ai(e,t=""){return 0===e.length?"":e.every((e=>!e.description))?"("+e.map(ci).join(", ")+")":"(\n"+e.map(((e,n)=>li(e," "+t,!n)+" "+t+ci(e))).join("\n")+"\n"+t+")"}function ci(e){const t=Lt(e.defaultValue,e.type);let n=e.name+": "+String(e.type);return t&&(n+=` = ${ye(t)}`),n+ui(e.deprecationReason)}function ui(e){if(null==e)return"";if(e!==gt){return` @deprecated(reason: ${ye({kind:m.STRING,value:e})})`}return" @deprecated"}function li(e,t="",n=!0){const{description:i}=e;if(null==i)return"";return(t&&!n?"\n"+t:t)+ye({kind:m.STRING,value:i,block:O(i)}).replace(/\n/g,"\n"+t)+"\n"}function pi(e){const t=[];for(const n of e)t.push(...n.definitions);return{kind:m.DOCUMENT,definitions:t}}const di=[hn];function fi(e){var t;const n=function(e){if(e)return function(t){const n=e;return{Field(e){var i;const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);n.includes(o)&&t.reportError(new GraphQLError(`Field name "${r}" is not allowed because it conflicts with generated object APIs. Please use an alias to change the field name.`,{nodes:e}))}}};return}(null===(t=e.disallowedFieldNames)||void 0===t?void 0:t.allFields),i=function(e){if(e)return function(t){const n=e;return{VariableDefinition(e){const i=e.variable.name.value,r=i.charAt(0).toLowerCase()+i.slice(1);n.includes(r)&&t.reportError(new GraphQLError(`Input Parameter name "${i}" is not allowed because it conflicts with generated object APIs.`,{nodes:e}))}}};return}(e.disallowedInputParameterNames);return[hi,mi,...n?[n]:[],...i?[i]:[],...Bn.filter((e=>!di.includes(e)))]}function hi(e){return{OperationDefinition:t=>(t.name||e.reportError(new GraphQLError("Apollo does not support anonymous operations because operation names are used during code generation. Please give this operation a name.",t)),!1)}}function mi(e){return{Field(t){"__typename"==(t.alias&&t.alias.value)&&e.reportError(new GraphQLError("Apollo needs to be able to insert __typename when needed, so using it as an alias is not supported.",t))}}}const vi={kind:m.DIRECTIVE_DEFINITION,description:(yi="A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations.",{kind:m.STRING,value:yi}),name:Ei("apollo_client_ios_localCacheMutation"),repeatable:!1,locations:[Ei("QUERY"),Ei("MUTATION"),Ei("SUBSCRIPTION"),Ei("FRAGMENT_DEFINITION")]};var yi;function Ei(e){return{kind:m.NAME,value:e}}const Ti={kind:m.DOCUMENT,definitions:[vi]};const Ni={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};class GraphQLSchemaValidationError extends Error{constructor(e){super(e.map((e=>e.message)).join("\n\n")),this.validationErrors=e,this.name="GraphQLSchemaValidationError"}}function Ii(e){return e.startsWith("__")}const gi={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};function _i(e,t){return t&&(e=function(e){return he(e,{enter:e=>e.kind!==m.SELECTION_SET?void 0:{...e,selections:e.selections.filter((e=>!("Field"===e.kind&&"__typename"===e.name.value)))},leave(e){if((e.kind===m.FIELD||e.kind===m.FRAGMENT_DEFINITION||e.kind===m.INLINE_FRAGMENT)&&e.selectionSet)return{...e,selectionSet:{...e.selectionSet,selections:[Ni,...e.selectionSet.selections]}}}})}(e)),he(e,{SelectionSet:{leave:(e,t,n)=>d(n)&&![m.FIELD,m.FRAGMENT_DEFINITION].includes(n.kind)?e:function(e){const t=e.selections.find((e=>e.kind==gi.kind&&e.name.value==gi.name.value));return t?e:{...e,selections:[gi,...e.selections]}}(e)},Field:{enter:e=>function(e){return e.name.value==gi.name.value?{...e,alias:void 0,directives:void 0}:e}(e)},Directive:{enter:e=>function(e){return e.name.value==vi.name.value?null:e}(e)}})}function Oi(e){return null!=e}function bi(e){switch(e.kind){case m.VARIABLE:return{kind:e.kind,value:e.name.value};case m.LIST:return{kind:e.kind,value:e.values.map(bi)};case m.OBJECT:return{kind:e.kind,value:e.fields.reduce(((e,t)=>(e[t.name.value]=bi(t.value),e)),{})};default:return e}}function Li(e){var t,n;return null===(n=null===(t=e.loc)||void 0===t?void 0:t.source)||void 0===n?void 0:n.name}function Si(e,t,n,i){var r,o,s;const a=new Map;for(const e of t.definitions)e.kind===m.FRAGMENT_DEFINITION&&a.set(e.name.value,e);const c=[],u=new Map,l=new Set,p=e.getQueryType();if(void 0===p)throw new GraphQLError("GraphQL Schema must contain a 'query' root type definition.",{});const d={queryType:p,mutationType:null!==(r=e.getMutationType())&&void 0!==r?r:void 0,subscriptionType:null!==(o=e.getSubscriptionType())&&void 0!==o?o:void 0};for(const e of t.definitions)e.kind===m.OPERATION_DEFINITION&&c.push(h(e));for(const[e,t]of a.entries())u.set(e,v(t));return{rootTypes:d,operations:c,fragments:Array.from(u.values()),referencedTypes:Array.from(l.values()),schemaDocumentation:null!==(s=e.description)&&void 0!==s?s:void 0};function f(t){if(!l.has(t)){if(l.add(t),we(t))for(const n of e.getPossibleTypes(t))f(Je(n));if(ke(t)){const e=t.getTypes();for(t of e)f(Je(t))}if(Fe(t)&&function(e){const t=e.getFields();for(const e in t){f(Je(t[e].type))}}(t),De(t))for(const e of t.getInterfaces())f(Je(e))}}function h(t){var i;if(!t.name)throw new GraphQLError("Operations should be named",{nodes:t});const r=Li(t),o=t.name.value,s=t.operation,a=(t.variableDefinitions||[]).map((t=>{const n=t.variable.name.value,i=t.defaultValue?bi(t.defaultValue):void 0,r=rn(e,t.type);if(!r)throw new GraphQLError(`Couldn't get type from type node "${t.type}"`,{nodes:t});return f(Je(r)),{name:n,type:r,defaultValue:i}})),c=ye(_i(t,n)),u=e.getRootType(s),[l]=null!==(i=T(t.directives))&&void 0!==i?i:[void 0,void 0];return f(u),{name:o,operationType:s,variables:a,rootType:u,selectionSet:y(t.selectionSet,u),directives:l,source:c,filePath:r}}function v(t){var i;const r=t.name.value,o=Li(t),s=ye(_i(t,n)),a=rn(e,t.typeCondition),[c]=null!==(i=T(t.directives))&&void 0!==i?i:[void 0,void 0];return f(Je(a)),{name:r,filePath:o,source:s,typeCondition:a,selectionSet:y(t.selectionSet,a),directives:c}}function y(t,n){return{parentType:n,selections:t.selections.map((t=>function(t,n){var r,o,s,c;const[l,p]=null!==(r=T(t.directives))&&void 0!==r?r:[void 0,void 0];switch(t.kind){case m.FIELD:{const d=t.name.value;if("__typename"==d)return;const h=null===(o=t.alias)||void 0===o?void 0:o.value,N=function(e,t,n){return n===$t.name&&e.getQueryType()===t?$t:n===Qt.name&&e.getQueryType()===t?Qt:n===Ut.name&&(De(t)||we(t)||ke(t))?Ut:De(t)||we(t)?t.getFields()[n]:void 0}(e,n,d);if(!N)throw new GraphQLError(`Cannot query field "${d}" on type "${String(n)}"`,{nodes:t});const I=mn(N.type,t.required),g=Je(I);f(Je(g));const{description:_,deprecationReason:O}=N;let b={kind:"Field",name:d,alias:h,type:I,arguments:E(N,t.arguments),inclusionConditions:p,description:!Ii(d)&&_?_:void 0,deprecationReason:O||void 0,directives:l};function L(e,t,n){var i;if(t&&n){const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);if(null==t?void 0:t.includes(o))throw new GraphQLError(`Schema name "${n}" conflicts with name of a generated object API. Please choose a different schema name. Suggestions: "${n}Schema", "${n}GraphQL", "${n}API"`,{nodes:e})}}if(Re(I)||Ge(I)&&Re(I.ofType)?L(t,null===(s=i.disallowedFieldNames)||void 0===s?void 0:s.entityList,i.schemaNamespace):je(g)&&L(t,null===(c=i.disallowedFieldNames)||void 0===c?void 0:c.entity,i.schemaNamespace),je(g)){const S=t.selectionSet;if(!S)throw new GraphQLError(`Composite field "${d}" on type "${String(n)}" requires selection set`,{nodes:t});b.selectionSet=y(S,g)}return b}case m.INLINE_FRAGMENT:{const A=t.typeCondition,D=A?rn(e,A):n;return f(D),{kind:"InlineFragment",selectionSet:y(t.selectionSet,D),inclusionConditions:p,directives:l}}case m.FRAGMENT_SPREAD:{const w=t.name.value,k=function(e){let t=u.get(e);if(t)return t;const n=a.get(e);return n?(a.delete(e),t=v(n),u.set(e,t),t):void 0}(w);if(!k)throw new GraphQLError(`Unknown fragment "${w}".`,{nodes:t.name});return{kind:"FragmentSpread",fragment:k,inclusionConditions:p,directives:l}}}}(t,n))).filter(Oi)}}function E(...e){const t=e[0].args;return e[1]&&e[1].length>0?e[1].map((e=>{var n;const i=e.name.value,r=t.find((t=>t.name===e.name.value)),o=null==r?void 0:r.type;if(!o)throw new GraphQLError(`Cannot find directive argument type for argument "${i}".`,{nodes:[e]});return{name:i,value:bi(e.value),type:o,deprecationReason:null!==(n=r.deprecationReason)&&void 0!==n?n:void 0}})):void 0}function T(t){if(t&&t.length>0){const n=[],i=[];for(const r of t){const t=r.name.value,o=e.getDirective(t);if(!o)throw new GraphQLError(`Cannot find directive "${t}".`,{nodes:r});n.push({name:t,arguments:E(o,r.arguments)});const s=N(r,o);s&&i.push(s)}return[n,i.length>0?i:void 0]}}function N(e,t){var n;if("include"==t.name||"skip"==t.name){const i=null===(n=e.arguments)||void 0===n?void 0:n[0].value,r="skip"==t.name;switch(null==i?void 0:i.kind){case m.BOOLEAN:return r?i.value?"SKIPPED":"INCLUDED":i.value?"INCLUDED":"SKIPPED";case m.VARIABLE:return{variable:i.name.value,isInverted:r};default:throw new GraphQLError('Conditional inclusion directive has invalid "if" argument.',{nodes:e})}}}}return e.GraphQLEnumType=GraphQLEnumType,e.GraphQLError=GraphQLError,e.GraphQLInputObjectType=GraphQLInputObjectType,e.GraphQLInterfaceType=GraphQLInterfaceType,e.GraphQLObjectType=GraphQLObjectType,e.GraphQLScalarType=GraphQLScalarType,e.GraphQLSchema=GraphQLSchema,e.GraphQLSchemaValidationError=GraphQLSchemaValidationError,e.GraphQLUnionType=GraphQLUnionType,e.Source=Source,e.compileDocument=function(e,t,n,i){return Si(e,t,n,i)},e.loadSchemaFromSources=function(e){var t,n=new Array;for(const i of e)if(i.name.endsWith(".json")){if(t)throw new Error(`Schema search paths can only include one JSON schema definition.\n Found "${t.name} & "${i.name}".`);t=i}else n.push(K(i));var i=function(e){return e.definitions.some((e=>e.kind==m.DIRECTIVE_DEFINITION&&e.name.value==vi.name.value))?e:pi([e,Ti])}(pi(n));t||function(e){const t=qn(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(i);const r=t?Xn(function(e){let t=JSON.parse(e);t.data&&(t=t.data);const n=Kn(t);return n}(t.body),i,{assumeValid:!0,assumeValidSDL:!0}):ei(i,{assumeValid:!0,assumeValidSDL:!0});return function(e){const t=Bt(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(r),r},e.mergeDocuments=function(e){return pi(e)},e.parseOperationDocument=function(e,t){return K(e,{experimentalClientControlledNullability:t})},e.printSchemaToSDL=function(e){return ti(e)},e.validateDocument=function(e,t,n){return Jn(e,t,fi(n))},Object.defineProperty(e,"__esModule",{value:!0}),e}({});"# \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift b/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift deleted file mode 100644 index 335ed22799..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift +++ /dev/null @@ -1,412 +0,0 @@ -import JavaScriptCore - -/// The output of the frontend compiler. -public class CompilationResult: JavaScriptObject { - private enum Constants { - static let LocalCacheMutationDirectiveName = "apollo_client_ios_localCacheMutation" - } - lazy var rootTypes: RootTypeDefinition = self["rootTypes"] - - lazy var referencedTypes: [GraphQLNamedType] = self["referencedTypes"] - - lazy var operations: [OperationDefinition] = self["operations"] - - lazy var fragments: [FragmentDefinition] = self["fragments"] - - lazy var schemaDocumentation: String? = self["schemaDocumentation"] - - public class RootTypeDefinition: JavaScriptObject { - lazy var queryType: GraphQLNamedType = self["queryType"] - - lazy var mutationType: GraphQLNamedType? = self["mutationType"] - - lazy var subscriptionType: GraphQLNamedType? = self["subscriptionType"] - } - - public class OperationDefinition: JavaScriptObject, Hashable { - lazy var name: String = self["name"] - - lazy var operationType: OperationType = self["operationType"] - - lazy var variables: [VariableDefinition] = self["variables"] - - lazy var rootType: GraphQLCompositeType = self["rootType"] - - lazy var selectionSet: SelectionSet = self["selectionSet"] - - lazy var directives: [Directive]? = self["directives"] - - lazy var source: String = self["source"] - - lazy var filePath: String = self["filePath"] - - override public var debugDescription: String { - "\(name) on \(rootType.debugDescription)" - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - } - - public static func ==(lhs: OperationDefinition, rhs: OperationDefinition) -> Bool { - return lhs.name == rhs.name - } - - lazy var isLocalCacheMutation: Bool = { - directives?.contains { $0.name == Constants.LocalCacheMutationDirectiveName } ?? false - }() - - lazy var nameWithSuffix: String = { - func getSuffix() -> String { - if isLocalCacheMutation { - return "LocalCacheMutation" - } - - switch operationType { - case .query: return "Query" - case .mutation: return "Mutation" - case .subscription: return "Subscription" - } - } - - let suffix = getSuffix() - - guard !name.hasSuffix(suffix) else { - return name - } - - return name+suffix - }() - } - - public enum OperationType: String, Equatable, JavaScriptValueDecodable { - case query - case mutation - case subscription - - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - let rawValue: String = .fromJSValue(jsValue, bridge: bridge) - guard let operationType = Self(rawValue: rawValue) else { - preconditionFailure("Unknown GraphQL operation type: \(rawValue)") - } - - self = operationType - } - } - - public class VariableDefinition: JavaScriptObject { - lazy var name: String = self["name"] - - lazy var type: GraphQLType = self["type"] - - lazy var defaultValue: GraphQLValue? = self["defaultValue"] - } - - public class FragmentDefinition: JavaScriptObject, Hashable { - lazy var name: String = self["name"] - - lazy var type: GraphQLCompositeType = self["typeCondition"] - - lazy var selectionSet: SelectionSet = self["selectionSet"] - - lazy var source: String = self["source"] - - lazy var filePath: String = self["filePath"] - - lazy var directives: [Directive]? = self["directives"] - - lazy var isLocalCacheMutation: Bool = { - directives?.contains { $0.name == Constants.LocalCacheMutationDirectiveName } ?? false - }() - - public override var debugDescription: String { - "\(name) on \(type.debugDescription)" - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - } - - public static func ==(lhs: FragmentDefinition, rhs: FragmentDefinition) -> Bool { - return lhs.name == rhs.name - } - } - - public class SelectionSet: JavaScriptWrapper, Hashable, CustomDebugStringConvertible { - lazy var parentType: GraphQLCompositeType = self["parentType"] - - lazy var selections: [Selection] = self["selections"] - - required convenience init( - parentType: GraphQLCompositeType, - selections: [Selection] = [] - ) { - self.init(nil) - self.parentType = parentType - self.selections = selections - } - - public var debugDescription: String { - TemplateString(""" - ... on \(parentType.debugDescription) { - \(selections.map(\.debugDescription), separator: "\n") - } - """).description - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(parentType) - hasher.combine(selections) - } - - public static func ==(lhs: SelectionSet, rhs: SelectionSet) -> Bool { - return lhs.parentType == rhs.parentType && - lhs.selections == rhs.selections - } - } - - public class InlineFragment: JavaScriptObject, Hashable { - lazy var selectionSet: SelectionSet = self["selectionSet"] - - lazy var inclusionConditions: [InclusionCondition]? = self["inclusionConditions"] - - public override var debugDescription: String { - selectionSet.debugDescription - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(selectionSet) - hasher.combine(inclusionConditions) - } - - public static func ==(lhs: InlineFragment, rhs: InlineFragment) -> Bool { - return lhs.selectionSet == rhs.selectionSet && - lhs.inclusionConditions == rhs.inclusionConditions - } - } - - /// Represents an individual selection that includes a named fragment in a selection set. - /// (ie. `...FragmentName`) - public class FragmentSpread: JavaScriptObject, Hashable { - lazy var fragment: FragmentDefinition = self["fragment"] - - lazy var inclusionConditions: [InclusionCondition]? = self["inclusionConditions"] - - lazy var directives: [Directive]? = self["directives"] - - var parentType: GraphQLCompositeType { fragment.type } - - public func hash(into hasher: inout Hasher) { - hasher.combine(fragment) - hasher.combine(inclusionConditions) - hasher.combine(directives) - } - - public static func ==(lhs: FragmentSpread, rhs: FragmentSpread) -> Bool { - return lhs.fragment == rhs.fragment && - lhs.inclusionConditions == rhs.inclusionConditions && - lhs.directives == rhs.directives - } - } - - public enum Selection: JavaScriptValueDecodable, CustomDebugStringConvertible, Hashable { - case field(Field) - case inlineFragment(InlineFragment) - case fragmentSpread(FragmentSpread) - - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isObject, "Expected JavaScript object but found: \(jsValue)") - - let kind: String = jsValue["kind"].toString() - - switch kind { - case "Field": - self = .field(Field(jsValue, bridge: bridge)) - case "InlineFragment": - self = .inlineFragment(InlineFragment(jsValue, bridge: bridge)) - case "FragmentSpread": - self = .fragmentSpread(FragmentSpread(jsValue, bridge: bridge)) - default: - preconditionFailure(""" - Unknown GraphQL selection of kind "\(kind)" - """) - } - } - - var selectionSet: SelectionSet? { - switch self { - case let .field(field): return field.selectionSet - case let .inlineFragment(inlineFragment): return inlineFragment.selectionSet - case let .fragmentSpread(fragmentSpread): return fragmentSpread.fragment.selectionSet - } - } - - public var debugDescription: String { - switch self { - case let .field(field): - return "field - " + field.debugDescription - case let .inlineFragment(fragment): - return "inlineFragment - " + fragment.debugDescription - case let .fragmentSpread(fragment): - return "fragment - " + fragment.debugDescription - } - } - } - - public class Field: JavaScriptWrapper, Hashable, CustomDebugStringConvertible { - lazy var name: String = self["name"]! - - lazy var alias: String? = self["alias"] - - var responseKey: String { - alias ?? name - } - - lazy var type: GraphQLType = self["type"]! - - lazy var arguments: [Argument]? = self["arguments"] - - lazy var inclusionConditions: [InclusionCondition]? = self["inclusionConditions"] - - lazy var directives: [Directive]? = self["directives"] - - lazy var selectionSet: SelectionSet? = self["selectionSet"] - - lazy var deprecationReason: String? = self["deprecationReason"] - - var isDeprecated: Bool { - return deprecationReason != nil - } - - lazy var documentation: String? = self["description"] - - required convenience init( - name: String, - alias: String? = nil, - arguments: [Argument]? = nil, - inclusionConditions: [InclusionCondition]? = nil, - directives: [Directive]? = nil, - type: GraphQLType, - selectionSet: SelectionSet? = nil, - deprecationReason: String? = nil, - documentation: String? = nil - ) { - self.init(nil) - self.name = name - self.alias = alias - self.type = type - self.arguments = arguments - self.inclusionConditions = inclusionConditions - self.directives = directives - self.selectionSet = selectionSet - self.deprecationReason = deprecationReason - self.documentation = documentation - } - - public var debugDescription: String { - TemplateString(""" - \(name): \(type.debugDescription)\(ifLet: directives, { - " \($0.map{"\($0.debugDescription)"}, separator: " ")" - }) - """).description - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - hasher.combine(alias) - hasher.combine(type) - hasher.combine(arguments) - hasher.combine(directives) - hasher.combine(selectionSet) - } - - public static func ==(lhs: Field, rhs: Field) -> Bool { - return lhs.name == rhs.name && - lhs.alias == rhs.alias && - lhs.type == rhs.type && - lhs.arguments == rhs.arguments && - lhs.directives == rhs.directives && - lhs.selectionSet == rhs.selectionSet - } - } - - public class Argument: JavaScriptObject, Hashable { - lazy var name: String = self["name"] - - lazy var type: GraphQLType = self["type"] - - lazy var value: GraphQLValue = self["value"] - - lazy var deprecationReason: String? = self["deprecationReason"] - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - hasher.combine(type) - hasher.combine(value) - } - - public static func ==(lhs: Argument, rhs: Argument) -> Bool { - return lhs.name == rhs.name && - lhs.type == rhs.type && - lhs.value == rhs.value - } - } - - public class Directive: JavaScriptObject, Hashable { - lazy var name: String = self["name"] - - lazy var arguments: [Argument]? = self["arguments"] - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - hasher.combine(arguments) - } - - public static func == (lhs: Directive, rhs: Directive) -> Bool { - return lhs.name == rhs.name && - lhs.arguments == rhs.arguments - } - - public override var debugDescription: String { - TemplateString(""" - "@\(name)\(ifLet: arguments, { - "(\($0.map { "\($0.name): \(String(describing: $0.value))" }, separator: ","))" - }) - """).description - } - } - - public enum InclusionCondition: JavaScriptValueDecodable, Hashable { - case included - case skipped - case variable(String, isInverted: Bool) - - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - if jsValue.isString, let value = jsValue.toString() { - switch value { - case "INCLUDED": - self = .included - return - case "SKIPPED": - self = .skipped - return - default: - preconditionFailure("Unrecognized value for include condition. Got \(value)") - } - } - - precondition(jsValue.isObject, "Expected JavaScript object but found: \(jsValue)") - - self = .variable(jsValue["variable"].toString(), isInverted: jsValue["isInverted"].toBool()) - } - - static func include(if variable: String) -> Self { - .variable(variable, isInverted: false) - } - - static func skip(if variable: String) -> Self { - .variable(variable, isInverted: true) - } - } - -} diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLError.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLError.swift deleted file mode 100644 index da33e5aeaf..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLError.swift +++ /dev/null @@ -1,50 +0,0 @@ -import Foundation -import JavaScriptCore - -/// A GraphQL error. -/// 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 class GraphQLError: JavaScriptError { - private lazy var source: GraphQLSource = self["source"] - - /// The source locations associated with this error. - private(set) lazy var sourceLocations: [GraphQLSourceLocation]? = { - guard let locations: [JavaScriptObject] = self["locations"] else { - return nil - } - - if let nodes: [ASTNode] = self["nodes"] { - // We have AST nodes, so this is a validation error. - // Because errors can be associated with locations from different - // source files, we ignore the `source` property and go through the - // individual nodes instead. - - precondition(locations.count == nodes.count) - - return zip(locations, nodes).map { (location, node) in - return GraphQLSourceLocation(filePath: node.filePath, lineNumber: location["line"].toInt(), columnNumber: location["column"].toInt()) - } - } else { - // We have no AST nodes, so this is a syntax error. Those only apply to a single source file, - // so we can rely on the `source` property. - - return locations.map { - GraphQLSourceLocation(filePath: source.filePath, lineNumber: $0["line"].toInt(), columnNumber: $0["column"].toInt()) - } - } - }() - - /// Log lines for this error in a format that allows Xcode to show errors inline at the correct location. - /// See https://shazronatadobe.wordpress.com/2010/12/04/xcode-shell-build-phase-reporting-of-errors/ - var logLines: [String]? { - return sourceLocations?.map { - return [$0.filePath, String($0.lineNumber), "error", message ?? "?"].joined(separator: ":") - } - } -} - -/// A GraphQL schema validation error. This wraps one or more underlying validation errors. -public class GraphQLSchemaValidationError: JavaScriptError { - private(set) lazy var validationErrors: [GraphQLError] = self["validationErrors"] -} diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLJSFrontend.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLJSFrontend.swift deleted file mode 100644 index ef0e7cd4d3..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLJSFrontend.swift +++ /dev/null @@ -1,116 +0,0 @@ -import Foundation -import JavaScriptCore - -public final class GraphQLJSFrontend { - private let bridge: JavaScriptBridge - private let library: JavaScriptObject - - public init() throws { - let bridge = try JavaScriptBridge() - self.bridge = bridge - - try bridge.throwingJavaScriptErrorIfNeeded { - bridge.context.evaluateScript(ApolloCodegenFrontendBundle) - } - - self.library = bridge.fromJSValue(bridge.context.globalObject["ApolloCodegenFrontend"]) - - bridge.register(GraphQLSource.self, forJavaScriptClass: "Source", from: library) - bridge.register(GraphQLError.self, from: library) - bridge.register(GraphQLSchemaValidationError.self, from: library) - bridge.register(GraphQLSchema.self, from: library) - bridge.register(GraphQLScalarType.self, from: library) - bridge.register(GraphQLEnumType.self, from: library) - bridge.register(GraphQLInputObjectType.self, from: library) - bridge.register(GraphQLObjectType.self, from: library) - bridge.register(GraphQLInterfaceType.self, from: library) - bridge.register(GraphQLUnionType.self, from: library) - } - - /// Load a schema by parsing an introspection result. - public func loadSchema(from sources: [GraphQLSource]) throws -> GraphQLSchema { - return try library.call("loadSchemaFromSources", with: sources) - } - - /// Take a loaded GQL schema and print it as SDL. - public func printSchemaAsSDL(schema: GraphQLSchema) throws -> String { - return try library.call("printSchemaToSDL", with: schema) - } - - private lazy var sourceConstructor: JavaScriptObject = { - self.bridge.fromJSValue(library["Source"]) - }() - - /// Create a `GraphQLSource` object from a string. - public func makeSource(_ body: String, filePath: String) throws -> GraphQLSource { - return try sourceConstructor.construct(with: body, filePath) - } - - /// Create a `GraphQLSource` object by reading from a file. - public func makeSource(from fileURL: URL) throws -> GraphQLSource { - precondition(fileURL.isFileURL) - - let body = try String(contentsOf: fileURL) - return try makeSource(body, filePath: fileURL.path) - } - - /// Parses a GraphQL document from a source, returning a reference to the parsed AST that can be passed on to validation and compilation. - /// Syntax errors will result in throwing a `GraphQLError`. - public func parseDocument( - _ source: GraphQLSource, - experimentalClientControlledNullability: Bool = false - ) throws -> GraphQLDocument { - return try library.call( - "parseOperationDocument", - with: source, - experimentalClientControlledNullability - ) - } - - /// Parses a GraphQL document from a file, returning a reference to the parsed AST that can be passed on to validation and compilation. - /// Syntax errors will result in throwing a `GraphQLError`. - public func parseDocument( - from fileURL: URL, - experimentalClientControlledNullability: Bool = false - ) throws -> GraphQLDocument { - return try parseDocument( - try makeSource(from: fileURL), - experimentalClientControlledNullability: experimentalClientControlledNullability - ) - } - - /// Validation and compilation take a single document, but you can merge documents, and operations and fragments will remember their source. - public func mergeDocuments(_ documents: [GraphQLDocument]) throws -> GraphQLDocument { - return try library.call("mergeDocuments", with: documents) - } - - /// Validate a GraphQL document and return any validation errors as `GraphQLError`s. - public func validateDocument( - schema: GraphQLSchema, - document: GraphQLDocument, - validationOptions: ValidationOptions - ) throws -> [GraphQLError] { - return try library.call( - "validateDocument", - with: schema, - document, - ValidationOptions.Bridged(from: validationOptions, bridge: self.bridge) - ) - } - - /// Compiles a GraphQL document into an intermediate representation that is more suitable for analysis and code generation. - public func compile( - schema: GraphQLSchema, - document: GraphQLDocument, - experimentalLegacySafelistingCompatibleOperations: Bool = false, - validationOptions: ValidationOptions - ) throws -> CompilationResult { - return try library.call( - "compileDocument", - with: schema, - document, - experimentalLegacySafelistingCompatibleOperations, - ValidationOptions.Bridged(from: validationOptions, bridge: self.bridge) - ) - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift deleted file mode 100644 index da673b5068..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift +++ /dev/null @@ -1,256 +0,0 @@ -import JavaScriptCore -import OrderedCollections - -// These classes correspond directly to the ones in -// https://github.com/graphql/graphql-js/tree/master/src/type -// and are partially described in https://graphql.org/graphql-js/type/ - -/// A GraphQL schema. -public class GraphQLSchema: JavaScriptObject { - func getType(named typeName: String) throws -> GraphQLNamedType? { - try invokeMethod("getType", with: typeName) - } - - func getPossibleTypes(_ abstractType: GraphQLAbstractType) throws -> [GraphQLObjectType] { - return try invokeMethod("getPossibleTypes", with: abstractType) - } - - func getImplementations(interfaceType: GraphQLInterfaceType) throws -> InterfaceImplementations { - return try invokeMethod("getImplementations", with: interfaceType) - } - - class InterfaceImplementations: JavaScriptObject { - private(set) lazy var objects: [GraphQLObjectType] = self["objects"] - private(set) lazy var interfaces: [GraphQLInterfaceType] = self["interfaces"] - } - - func isSubType(abstractType: GraphQLAbstractType, maybeSubType: GraphQLNamedType) throws -> Bool { - return try invokeMethod("isSubType", with: abstractType, maybeSubType) - } -} - -public class GraphQLNamedType: JavaScriptObject, Hashable { - lazy var name: String = self["name"] - - var formattedName: String { - swiftName - } - - lazy var documentation: String? = self["description"] - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - } - - public static func ==(lhs: GraphQLNamedType, rhs: GraphQLNamedType) -> Bool { - return lhs.name == rhs.name - } -} - -public class GraphQLScalarType: GraphQLNamedType { - - lazy var specifiedByURL: String? = self["specifiedByUrl"] - - var isCustomScalar: Bool { - guard self.specifiedByURL == nil else { return true } - - switch name { - case "String", "Int", "Float", "Boolean", "ID": - return false - default: - return true - } - } - - var isSwiftType: Bool { - switch name { - case "String", "Int", "Float", "Boolean": - return true - default: - return false - } - } - - override var formattedName: String { - if !isCustomScalar { - return swiftName - } - - let uppercasedName = swiftName.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_Scalar" : uppercasedName - } -} - -public class GraphQLEnumType: GraphQLNamedType { - lazy var values: [GraphQLEnumValue] = try! invokeMethod("getValues") - - override var formattedName: String { - let uppercasedName = swiftName.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_Enum" : uppercasedName - } -} - -public class GraphQLEnumValue: JavaScriptObject { - - struct Name { - let value: String - } - - lazy var name: Name = Name(value: self["name"]) - - lazy var documentation: String? = self["description"] - - lazy var deprecationReason: String? = self["deprecationReason"] - - var isDeprecated: Bool { deprecationReason != nil } -} - -typealias GraphQLInputFieldDictionary = OrderedDictionary - -public class GraphQLInputObjectType: GraphQLNamedType { - lazy var fields: GraphQLInputFieldDictionary = try! invokeMethod("getFields") - - override var formattedName: String { - let uppercasedName = swiftName.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_InputObject" : uppercasedName - } -} - -public class GraphQLInputField: JavaScriptObject { - lazy var name: String = self["name"] - - lazy var type: GraphQLType = self["type"] - - lazy var documentation: String? = self["description"] - - lazy var defaultValue: GraphQLValue? = { - let node: JavaScriptObject? = self["astNode"] - return node?["defaultValue"] - }() - - lazy var deprecationReason: String? = self["deprecationReason"] -} - -public class GraphQLCompositeType: GraphQLNamedType { - public override var debugDescription: String { - "Type - \(name)" - } - - var isRootFieldType: Bool = false - -} - -protocol GraphQLInterfaceImplementingType: GraphQLCompositeType { - var interfaces: [GraphQLInterfaceType] { get } -} - -extension GraphQLInterfaceImplementingType { - func implements(_ interface: GraphQLInterfaceType) -> Bool { - interfaces.contains(interface) - } -} - -public class GraphQLObjectType: GraphQLCompositeType, GraphQLInterfaceImplementingType { - lazy var fields: [String: GraphQLField] = try! invokeMethod("getFields") - - lazy var interfaces: [GraphQLInterfaceType] = try! invokeMethod("getInterfaces") - - override var formattedName: String { - let uppercasedName = swiftName.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_Object" : uppercasedName - } - - public override var debugDescription: String { - "Object - \(name)" - } -} - -public class GraphQLAbstractType: GraphQLCompositeType { -} - -public class GraphQLInterfaceType: GraphQLAbstractType, GraphQLInterfaceImplementingType { - lazy var deprecationReason: String? = self["deprecationReason"] - - lazy var fields: [String: GraphQLField] = try! invokeMethod("getFields") - - lazy var interfaces: [GraphQLInterfaceType] = try! invokeMethod("getInterfaces") - - override var formattedName: String { - let uppercasedName = swiftName.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_Interface" : uppercasedName - } - - public override var debugDescription: String { - "Interface - \(name)" - } -} - -public class GraphQLUnionType: GraphQLAbstractType { - lazy var types: [GraphQLObjectType] = try! invokeMethod("getTypes") - - override var formattedName: String { - let uppercasedName = swiftName.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_Union" : uppercasedName - } - - public override var debugDescription: String { - "Union - \(name)" - } -} - -public class GraphQLField: JavaScriptObject, Hashable { - - lazy var name: String = self["name"] - - lazy var type: GraphQLType = self["type"] - - lazy var arguments: [GraphQLFieldArgument] = self["args"] - - lazy var documentation: String? = self["description"] - - lazy var deprecationReason: String? = self["deprecationReason"] - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - hasher.combine(type) - hasher.combine(arguments) - } - - public static func == (lhs: GraphQLField, rhs: GraphQLField) -> Bool { - lhs.name == rhs.name && - lhs.type == rhs.type && - lhs.arguments == rhs.arguments - } - - public override var debugDescription: String { - "\(name): \(type.debugDescription)" - } -} - -public class GraphQLFieldArgument: JavaScriptObject, Hashable { - - lazy var name: String = self["name"] - - lazy var type: GraphQLType = self["type"] - - lazy var documentation: String? = self["description"] - - lazy var deprecationReason: String? = self["deprecationReason"] - - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - hasher.combine(type) - } - - public static func == (lhs: GraphQLFieldArgument, rhs: GraphQLFieldArgument) -> Bool { - lhs.name == rhs.name && - lhs.type == rhs.type - } - -} diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLSource.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLSource.swift deleted file mode 100644 index 8185ef0ade..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLSource.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation -import JavaScriptCore - -/// A representation of source input to GraphQL parsing. -/// Corresponds to https://github.com/graphql/graphql-js/blob/master/src/language/source.js -public class GraphQLSource: JavaScriptObject { - private(set) lazy var filePath: String = self["name"] - - private(set) lazy var body: String = self["body"] -} - -/// Represents a location in a GraphQL source file. -public struct GraphQLSourceLocation { - let filePath: String - - let lineNumber: Int - let columnNumber: Int -} - -// These classes correspond to the AST node types defined in -// https://github.com/graphql/graphql-js/blob/master/src/language/ast.js -// But since we don't need to access these directly, we haven't defined specific wrapper types except for -// `GraphQLDocument`. - -/// An AST node. -public class ASTNode: JavaScriptObject { - lazy var kind: String = self["kind"] - - private lazy var source: GraphQLSource = bridge.fromJSValue(self["loc"]["source"]) - private(set) lazy var filePath: String = source.filePath -} - -/// A parsed GraphQL document. -public class GraphQLDocument: ASTNode { - private(set) lazy var definitions: [ASTNode] = self["definitions"] - - required init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - super.init(jsValue, bridge: bridge) - - precondition(kind == "Document", "Expected GraphQL DocumentNode but found: \(jsValue)") - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLType.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLType.swift deleted file mode 100644 index 623265c5d9..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLType.swift +++ /dev/null @@ -1,99 +0,0 @@ -import JavaScriptCore - -/// A GraphQL type. -public indirect enum GraphQLType: Hashable { - case entity(GraphQLCompositeType) - case scalar(GraphQLScalarType) - case `enum`(GraphQLEnumType) - case inputObject(GraphQLInputObjectType) - case nonNull(GraphQLType) - case list(GraphQLType) - - public var typeReference: String { - switch self { - case let .entity(type as GraphQLNamedType), - let .scalar(type as GraphQLNamedType), - let .enum(type as GraphQLNamedType), - let .inputObject(type as GraphQLNamedType): - return type.name - - case let .nonNull(ofType): - return "\(ofType.typeReference)!" - - case let .list(ofType): - return "[\(ofType.typeReference)]" - } - } - - public var namedType: GraphQLNamedType { - switch self { - case let .entity(type as GraphQLNamedType), - let .scalar(type as GraphQLNamedType), - let .enum(type as GraphQLNamedType), - let .inputObject(type as GraphQLNamedType): - return type - - case let .nonNull(innerType), - let .list(innerType): - return innerType.namedType - } - } - - public var innerType: GraphQLType { - switch self { - case .entity, .scalar, .enum, .inputObject: - return self - - case let .nonNull(innerType), - let .list(innerType): - return innerType.innerType - } - } - - public var isNullable: Bool { - if case .nonNull = self { return false } - return true - } -} - -extension GraphQLType: CustomDebugStringConvertible { - public var debugDescription: String { - return "\(typeReference)" - } -} - -extension GraphQLType: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isObject, "Expected JavaScript object but found: \(jsValue)") - - let tag = jsValue[jsValue.context.globalObject["Symbol"]["toStringTag"]].toString() - - switch tag { - case "GraphQLNonNull": - let ofType = jsValue["ofType"] - self = .nonNull(GraphQLType(ofType, bridge: bridge)) - case "GraphQLList": - let ofType = jsValue["ofType"] - self = .list(GraphQLType(ofType, bridge: bridge)) - default: - let namedType: GraphQLNamedType = bridge.fromJSValue(jsValue) - - switch namedType { - case let entityType as GraphQLCompositeType: - self = .entity(entityType) - - case let scalarType as GraphQLScalarType: - self = .scalar(scalarType) - - case let enumType as GraphQLEnumType: - self = .enum(enumType) - - case let inputObjectType as GraphQLInputObjectType: - self = .inputObject(inputObjectType) - - default: - fatalError("JSValue: \(jsValue) is not a recognized GraphQLType value.") - } - } - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLValue.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLValue.swift deleted file mode 100644 index 38cedb8ade..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLValue.swift +++ /dev/null @@ -1,67 +0,0 @@ -import Foundation -import JavaScriptCore -import OrderedCollections - -indirect enum GraphQLValue: Hashable { - case variable(String) - case int(Int) - case float(Double) - case string(String) - case boolean(Bool) - case null - case `enum`(String) - case list([GraphQLValue]) - case object(OrderedDictionary) -} - -extension GraphQLValue: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isObject, "Expected JavaScript object but found: \(jsValue)") - - let kind: String = jsValue["kind"].toString() - - switch kind { - case "Variable": - self = .variable(jsValue["value"].toString()) - case "IntValue": - self = .int(jsValue["value"].toInt()) - case "FloatValue": - self = .float(jsValue["value"].toDouble()) - case "StringValue": - self = .string(jsValue["value"].toString()) - case "BooleanValue": - self = .boolean(jsValue["value"].toBool()) - case "NullValue": - self = .null - case "EnumValue": - self = .enum(jsValue["value"].toString()) - case "ListValue": - var value = jsValue["value"] - if value.isUndefined { - value = jsValue["values"] - } - self = .list(.fromJSValue(value, bridge: bridge)) - case "ObjectValue": - let value = jsValue["value"] - - /// The JS frontend does not do value conversions of the default values for input objects, - /// because no other compilation is needed, these are passed through as is from `graphql-js`. - /// We need to handle both converted object values and default values and represented by - /// `graphql-js`. - if !value.isUndefined { - self = .object(.fromJSValue(value, bridge: bridge)) - - } else { - let fields = jsValue["fields"].toOrderedDictionary { field in - (field["name"]["value"].toString(), GraphQLValue(field["value"], bridge: bridge)) - } - self = .object(fields) - } - - default: - preconditionFailure(""" - Unknown GraphQL value of kind "\(kind)" - """) - } - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/.vscode/launch.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/.vscode/launch.json deleted file mode 100644 index 3ebfdfb144..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/.vscode/launch.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "name": "vscode-jest-tests.v2", - "request": "launch", - "args": [ - "--runInBand", - "--watchAll=false", - "--config", - "jest.config.js" - ], - "cwd": "${workspaceFolder}", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "disableOptimisticBPs": true, - "program": "${workspaceFolder}/node_modules/.bin/jest", - "windows": { - "program": "${workspaceFolder}/node_modules/jest/bin/jest" - } - } - ] -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/.vscode/settings.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/.vscode/settings.json deleted file mode 100644 index 7ba84c798e..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "editor.tabSize": 2, -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/jest.config.js b/Sources/ApolloCodegenLib/Frontend/JavaScript/jest.config.js deleted file mode 100644 index 8309f68456..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @typedef {import('ts-jest/dist/types')} */ -/** @type {import('@jest/types').Config.InitialOptions} */ - -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - setupFilesAfterEnv: ["/src/__testUtils__/matchers.ts"], - testPathIgnorePatterns: [ - "/node_modules/", - "/__fixtures__/", - "/__testUtils__/", - ], - globals: { - "ts-jest": { - tsconfig: "./tsconfig.test.json", - }, - }, -}; diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/package.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/package.json deleted file mode 100644 index da926d37d5..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "apollo-codegen-frontend", - "private": true, - "version": "1.0.0", - "description": "Apollo Codegen Frontend", - "license": "MIT", - "author": "Apollo GraphQL ", - "scripts": { - "build": "rollup --config", - "test": "jest" - }, - "engines": { - "npm": ">=7" - }, - "dependencies": { - "graphql": "16.3.0-canary.pr.3510.5099f4491dc2a35a3e4a0270a55e2a228c15f13b", - "tslib": "^2.3.0" - }, - "devDependencies": { - "@rollup/plugin-node-resolve": "^11.0.1", - "@rollup/plugin-replace": "^2.3.4", - "@rollup/plugin-typescript": "^8.1.0", - "@types/common-tags": "^1.8.0", - "@types/jest": "^26.0.19", - "common-tags": "^1.8.0", - "jest": "^26.6.3", - "rollup": "^2.35.1", - "rollup-plugin-terser": "^7.0.2", - "ts-jest": "^26.4.4", - "typescript": "^4.1.3" - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/rollup.config.js b/Sources/ApolloCodegenLib/Frontend/JavaScript/rollup.config.js deleted file mode 100644 index 2a77cd78a6..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/rollup.config.js +++ /dev/null @@ -1,32 +0,0 @@ -import typescript from "@rollup/plugin-typescript"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import replace from "@rollup/plugin-replace"; -import { terser } from "rollup-plugin-terser"; - -/** @type {import('rollup').RollupOptions} */ -const options = { - input: "src/index.ts", - output: { - file: "../dist/ApolloCodegenFrontend.bundle.js", - format: "iife", - name: "ApolloCodegenFrontend", - sourcemap: false, - }, - plugins: [ - typescript({ - tsconfig: "tsconfig.json", - }), - nodeResolve({ - modulesOnly: true, - dedupe: ["graphql"], - }), - replace({ - "process.env.NODE_ENV": JSON.stringify("production"), - }), - terser({ - keep_classnames: true, - }), - ], -}; - -export default options; diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__testUtils__/matchers.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__testUtils__/matchers.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__testUtils__/validationHelpers.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__testUtils__/validationHelpers.ts deleted file mode 100644 index f8ff975ba4..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__testUtils__/validationHelpers.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { DisallowedFieldNames, ValidationOptions } from "../validationRules"; - -const disallowedFieldNames: DisallowedFieldNames = { - allFields: [], - entity: [], - entityList: [] -} - -export const emptyValidationOptions: ValidationOptions = { - schemaNamespace: "TestSchema", - disallowedFieldNames: disallowedFieldNames, - disallowedInputParameterNames: [], -}; diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/deprecatedEnumCasesCompilationTests.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/deprecatedEnumCasesCompilationTests.ts deleted file mode 100644 index 0a31326955..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/deprecatedEnumCasesCompilationTests.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - compileDocument, - parseOperationDocument, - loadSchemaFromSources, -} from "../index" -import { - CompilationResult -} from "../compiler/index" -import { - Source, - GraphQLSchema, - DocumentNode, - GraphQLEnumType, -} from "graphql"; -import { emptyValidationOptions } from "../__testUtils__/validationHelpers"; - -describe("given schema", () => { - const schemaSDL: string = ` - type Query { - allAnimals: [Animal!] - } - - enum Species { - TasmanianTiger @deprecated(reason: "Extinct") - Hippopotamus - Dodo @deprecated(reason: "Extinct") - PolarBear - } - - interface Animal { - species: Species! - friend: Animal! - } - `; - - const schema: GraphQLSchema = loadSchemaFromSources([new Source(schemaSDL, "Test Schema", { line: 1, column: 1 })]); - - describe("query includes enum with deprecated values", () => { - const documentString: string = ` - query Test { - allAnimals { - species - } - } - `; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Query", { line: 1, column: 1 }), - false - ); - - it("should compile enum values with deprecation reason", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const speciesEnum: GraphQLEnumType = compilationResult.referencedTypes.find(function(element) { - return element.name == 'Species' - }) as GraphQLEnumType - - expect(speciesEnum.getValue("TasmanianTiger")!.deprecationReason).toEqual("Extinct") - expect(speciesEnum.getValue("Hippopotamus")!.deprecationReason).toBeUndefined() - expect(speciesEnum.getValue("Dodo")!.deprecationReason).toEqual("Extinct") - expect(speciesEnum.getValue("PolarBear")!.deprecationReason).toBeUndefined() - }); - }); - -}); diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/inclusionConditionCompilationTests.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/inclusionConditionCompilationTests.ts deleted file mode 100644 index 592ec1daef..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/inclusionConditionCompilationTests.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - compileDocument, - parseOperationDocument, - loadSchemaFromSources, -} from "../index" -import { - CompilationResult -} from "../compiler/index" -import { - Field, - InclusionConditionVariable, - InlineFragment -} from "../compiler/ir" -import { - Source, - GraphQLSchema, - DocumentNode -} from "graphql"; -import { emptyValidationOptions } from "../__testUtils__/validationHelpers"; - -describe("given schema", () => { - const schemaSDL: string = ` - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - friend: Animal! - } - `; - - const schema: GraphQLSchema = loadSchemaFromSources([new Source(schemaSDL, "Test Schema", { line: 1, column: 1 })]); - - describe("query has inline fragment with @include directive", () => { - const documentString: string = ` - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - species - } - } - } - `; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Query", { line: 1, column: 1 }), - false - ); - - it("should compile inline fragment with inclusion condition", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const operation = compilationResult.operations[0]; - const allAnimals = operation.selectionSet.selections[0] as Field; - const inlineFragment = allAnimals?.selectionSet?.selections?.[0] as InlineFragment; - - const expected: InclusionConditionVariable = { - variable: "a", - isInverted: false - }; - - expect(inlineFragment.inclusionConditions?.length).toEqual(1); - - expect(inlineFragment.inclusionConditions?.[0]).toEqual(expected); - }); - }); - -}); \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/input-object-enum-test-schema.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/input-object-enum-test-schema.json deleted file mode 100644 index c0e19eca5a..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/input-object-enum-test-schema.json +++ /dev/null @@ -1,1187 +0,0 @@ -{ - "data": { - "__schema": { - "queryType": { - "name": "Query" - }, - "mutationType": { - "name": "Mutation" - }, - "subscriptionType": null, - "types": [ - { - "kind": "OBJECT", - "name": "Query", - "description": null, - "fields": [ - { - "name": "message", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "String", - "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Mutation", - "description": null, - "fields": [ - { - "name": "mutateCar", - "description": null, - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "ReportCarProblemInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Car", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "CarProblem", - "description": null, - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "NO_FUEL", - "description": null, - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ReportCarProblemInput", - "description": null, - "fields": null, - "inputFields": [ - { - "name": "carId", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "UUID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "problem", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CarProblem", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "UUID", - "description": null, - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Car", - "description": null, - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": [] - }, - { - "kind": "SCALAR", - "name": "Boolean", - "description": "The `Boolean` scalar type represents `true` or `false`.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Schema", - "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", - "fields": [ - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "types", - "description": "A list of all types supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "queryType", - "description": "The type that query operations will be rooted at.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mutationType", - "description": "If this server supports mutation, the type that mutation operations will be rooted at.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscriptionType", - "description": "If this server support subscription, the type that subscription operations will be rooted at.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "directives", - "description": "A list of all directives supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Directive", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Type", - "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", - "fields": [ - { - "name": "kind", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "__TypeKind", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "specifiedByURL", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fields", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Field", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "interfaces", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "possibleTypes", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "enumValues", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__EnumValue", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inputFields", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ofType", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__TypeKind", - "description": "An enum describing what kind of type a given `__Type` is.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "SCALAR", - "description": "Indicates this type is a scalar.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Indicates this type is a union. `possibleTypes` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Indicates this type is an enum. `enumValues` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Indicates this type is an input object. `inputFields` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LIST", - "description": "Indicates this type is a list. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NON_NULL", - "description": "Indicates this type is a non-null. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Field", - "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__InputValue", - "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "defaultValue", - "description": "A GraphQL-formatted string representing the default value for this input value.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__EnumValue", - "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Directive", - "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isRepeatable", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "locations", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "__DirectiveLocation", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__DirectiveLocation", - "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "QUERY", - "description": "Location adjacent to a query operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MUTATION", - "description": "Location adjacent to a mutation operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUBSCRIPTION", - "description": "Location adjacent to a subscription operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD", - "description": "Location adjacent to a field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_DEFINITION", - "description": "Location adjacent to a fragment definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_SPREAD", - "description": "Location adjacent to a fragment spread.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INLINE_FRAGMENT", - "description": "Location adjacent to an inline fragment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "VARIABLE_DEFINITION", - "description": "Location adjacent to a variable definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCHEMA", - "description": "Location adjacent to a schema definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCALAR", - "description": "Location adjacent to a scalar definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Location adjacent to an object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD_DEFINITION", - "description": "Location adjacent to a field definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ARGUMENT_DEFINITION", - "description": "Location adjacent to an argument definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Location adjacent to an interface definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Location adjacent to a union definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Location adjacent to an enum definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM_VALUE", - "description": "Location adjacent to an enum value definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Location adjacent to an input object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_FIELD_DEFINITION", - "description": "Location adjacent to an input object field definition.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - } - ], - "directives": [ - { - "name": "include", - "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], - "args": [ - { - "name": "if", - "description": "Included when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null - } - ] - }, - { - "name": "skip", - "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], - "args": [ - { - "name": "if", - "description": "Skipped when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null - } - ] - }, - { - "name": "deprecated", - "description": "Marks an element of a GraphQL schema as no longer supported.", - "locations": [ - "FIELD_DEFINITION", - "ARGUMENT_DEFINITION", - "INPUT_FIELD_DEFINITION", - "ENUM_VALUE" - ], - "args": [ - { - "name": "reason", - "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": "\"No longer supported\"" - } - ] - }, - { - "name": "specifiedBy", - "description": "Exposes a URL that specifies the behavior of this scalar.", - "locations": [ - "SCALAR" - ], - "args": [ - { - "name": "url", - "description": "The URL that specifies the behavior of this scalar.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/referenceTypesTests.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/referenceTypesTests.ts deleted file mode 100644 index 2177136e2d..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/referenceTypesTests.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { - compileDocument, - parseOperationDocument, - loadSchemaFromSources, -} from "../index" -import { - CompilationResult -} from "../compiler/index" -import { - Source, - GraphQLSchema, - DocumentNode, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLInterfaceType, -} from "graphql"; -import { - readFileSync -} from "fs" -import { - join -} from 'path'; -import { emptyValidationOptions } from "../__testUtils__/validationHelpers"; - -describe("mutation defined using ReportCarProblemInput", () => { - const documentString: string = ` - mutation Test($input: ReportCarProblemInput!) { - mutateCar(input: $input) { - name - } - } - `; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Mutation", { line: 1, column: 1 }), - false - ); - - describe("given schema from introspection JSON with mutation using input type with enum field", () => { - const schemaJSON: string = readFileSync(join(__dirname, "./input-object-enum-test-schema.json"), 'utf-8') - const schema: GraphQLSchema = loadSchemaFromSources([new Source(schemaJSON, "TestSchema.json", { line: 1, column: 1 })]); - - it("should compile with referencedTypes including ReportCarProblemInput and CarProblem enum", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const reportCarProblemInput: GraphQLInputObjectType = compilationResult.referencedTypes.find(function(element) { - return element.name == 'ReportCarProblemInput' - }) as GraphQLInputObjectType - const carProblemEnum: GraphQLEnumType = compilationResult.referencedTypes.find(function(element) { - return element.name == 'CarProblem' - }) as GraphQLEnumType - - expect(reportCarProblemInput).not.toBeUndefined() - expect(carProblemEnum).not.toBeUndefined() - }); - }); - - describe("given schema from SDL with mutation using input type with enum field", () => { - const schemaSDL: string = ` - type Query { - cars: [Car!] - } - - type Mutation { - mutateCar(input: ReportCarProblemInput!): Car! - } - - input ReportCarProblemInput { - problem: CarProblem! - } - - enum CarProblem { - RADIATOR - } - - interface Car { - name: String! - } - `; - - const schema: GraphQLSchema = loadSchemaFromSources([new Source(schemaSDL, "Test Schema", { line: 1, column: 1 })]); - - it("should compile with referencedTypes inlcuding InputObject and enum", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const reportCarProblemInput: GraphQLInputObjectType = compilationResult.referencedTypes.find(function(element) { - return element.name == 'ReportCarProblemInput' - }) as GraphQLInputObjectType - const carProblemEnum: GraphQLEnumType = compilationResult.referencedTypes.find(function(element) { - return element.name == 'CarProblem' - }) as GraphQLEnumType - - expect(reportCarProblemInput).not.toBeUndefined() - expect(carProblemEnum).not.toBeUndefined() - }); - }); -}); - -describe("query with selections", () => { - const documentString: string = ` - query fetchMyString { - missingInterfaceString - } - `; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Query", { line: 1, column: 1 }), - false - ); - - describe("given interface on root query", () => { - const schemaSDL: string = ` - interface MissingInterface { - missingInterfaceString: String! - } - - type Query implements MissingInterface { - missingInterfaceString: String! - } - `; - - const schema: GraphQLSchema = loadSchemaFromSources([new Source(schemaSDL, "Test Schema", { line: 1, column: 1 })]); - - it("should compile with referencedTypes including interface", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const validInterface: GraphQLInterfaceType = compilationResult.referencedTypes.find(function(element) { - return element.name == 'MissingInterface' - }) as GraphQLInterfaceType - - expect(validInterface).not.toBeUndefined() - }); - }); -}); diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/sourceDefinitionTransformTests.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/sourceDefinitionTransformTests.ts deleted file mode 100644 index fc09f23e6c..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/__tests__/sourceDefinitionTransformTests.ts +++ /dev/null @@ -1,190 +0,0 @@ - -import { - compileDocument, - parseOperationDocument, - loadSchemaFromSources, -} from "../index" -import { - CompilationResult -} from "../compiler/index" -import { - Source, - GraphQLSchema, - DocumentNode -} from "graphql"; -import { emptyValidationOptions } from "../__testUtils__/validationHelpers"; - -describe("given schema", () => { - const schemaSDL: string = -`type Query { - allAnimals: [Animal!] -} - -interface Animal { - species: String! - friend: Animal! -} - -interface Pet { - name: String! -}`; - - const schema: GraphQLSchema = loadSchemaFromSources([new Source(schemaSDL, "Test Schema", { line: 1, column: 1 })]); - - describe("given query not including __typename fields", () => { - const documentString: string = -`query Test { - allAnimals { - species - ... on Pet { - name - } - } -}`; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Query", { line: 1, column: 1 }), - false - ); - - describe("compile document", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - - it("operation definition should have source including __typename field.", () => { - const operation = compilationResult.operations[0]; - - const expected: string = -`query Test { - allAnimals { - __typename - species - ... on Pet { - name - } - } -}`; - - expect(operation.source).toEqual(expected); - }); - }); - - describe("compile document for legacy compatible safelisting", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, true, emptyValidationOptions); - - it("operation definition should have source including __typename field in each selection set.", () => { - const operation = compilationResult.operations[0]; - - const expected: string = -`query Test { - allAnimals { - __typename - species - ... on Pet { - __typename - name - } - } -}`; - - expect(operation.source).toEqual(expected); - }); - }); - }); - - - describe("given query including __typename field with directive", () => { - const documentString: string = -`query Test { - allAnimals { - __typename @include(if: true) - species - ... on Pet { - name - } - } -}`; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Query", { line: 1, column: 1 }), - false - ); - - it("operation definition should have source including __typename field with no directives.", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const operation = compilationResult.operations[0]; - - const expected: string = -`query Test { - allAnimals { - __typename - species - ... on Pet { - name - } - } -}`; - - expect(operation.source).toEqual(expected); - }); - }); - - describe("given query with local cache mutation directive", () => { - const documentString: string = -`query Test @apollo_client_ios_localCacheMutation { - allAnimals { - species - ... on Pet { - name - } - } -}`; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Query", { line: 1, column: 1 }), - false - ); - - it("operation definition should have source not including local cache mutation directive.", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const operation = compilationResult.operations[0]; - - const expected: string = -`query Test { - allAnimals { - __typename - species - ... on Pet { - name - } - } -}`; - - expect(operation.source).toEqual(expected); - }); - }); - - describe("given fragment not including __typename field", () => { - const documentString: string = -`fragment Test on Animal { - species -}`; - - const document: DocumentNode = parseOperationDocument( - new Source(documentString, "Test Fragment", { line: 1, column: 1 }), - false - ); - - it("fragment definition should have source including __typename field.", () => { - const compilationResult: CompilationResult = compileDocument(schema, document, false, emptyValidationOptions); - const fragment = compilationResult.fragments[0]; - - const expected: string = -`fragment Test on Animal { - __typename - species -}`; - - expect(fragment.source).toEqual(expected); - }); - }); -}); \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts deleted file mode 100644 index 49d888988f..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts +++ /dev/null @@ -1,496 +0,0 @@ -import { - getFieldDef, - isMetaFieldName, - isNotNullOrUndefined, - transformToNetworkRequestSourceDefinition, -} from "../utilities"; -import { - ArgumentNode, - ASTNode, - DocumentNode, - DirectiveNode, - FragmentDefinitionNode, - getNamedType, - GraphQLArgument, - GraphQLCompositeType, - GraphQLDirective, - GraphQLError, - GraphQLField, - GraphQLInputObjectType, - GraphQLNamedType, - GraphQLObjectType, - GraphQLSchema, - GraphQLType, - isCompositeType, - isInputObjectType, - isUnionType, - Kind, - OperationDefinitionNode, - print, - SelectionNode, - SelectionSetNode, - typeFromAST, - isObjectType, - isInterfaceType, - isListType, - isNonNullType, - FieldNode, -} from "graphql"; -import * as ir from "./ir"; -import { valueFromValueNode } from "./values"; -import { applyRequiredStatus } from "graphql/utilities/applyRequiredStatus"; -import { ValidationOptions } from "../validationRules"; - -function filePathForNode(node: ASTNode): string | undefined { - return node.loc?.source?.name; -} - -export interface CompilationResult { - rootTypes: ir.RootTypeDefinition; - operations: ir.OperationDefinition[]; - fragments: ir.FragmentDefinition[]; - referencedTypes: GraphQLNamedType[]; - schemaDocumentation: string | undefined; -} - -export function compileToIR( - schema: GraphQLSchema, - document: DocumentNode, - legacySafelistingCompatibleOperations: boolean, - validationOptions: ValidationOptions -): CompilationResult { - // Collect fragment definition nodes upfront so we can compile these as we encounter them. - const fragmentNodeMap = new Map(); - - for (const definitionNode of document.definitions) { - if (definitionNode.kind !== Kind.FRAGMENT_DEFINITION) continue; - - fragmentNodeMap.set(definitionNode.name.value, definitionNode); - } - - const operations: ir.OperationDefinition[] = []; - const fragmentMap = new Map(); - const referencedTypes = new Set(); - - const queryType = schema.getQueryType() as GraphQLNamedType; - if (queryType === undefined) { - throw new GraphQLError("GraphQL Schema must contain a 'query' root type definition.", { }); - } - - const rootTypes: ir.RootTypeDefinition = { - queryType: queryType, - mutationType: schema.getMutationType() ?? undefined, - subscriptionType: schema.getSubscriptionType() ?? undefined - }; - - for (const definitionNode of document.definitions) { - if (definitionNode.kind !== Kind.OPERATION_DEFINITION) continue; - - operations.push(compileOperation(definitionNode)); - } - - // We should have encountered all fragments because GraphQL validation normally makes sure - // there are no unused fragments in the document. But to allow for situations where you want that - // validation rule removed, we compile the remaining ones separately. - - for (const [name, fragmentNode] of fragmentNodeMap.entries()) { - fragmentMap.set(name, compileFragment(fragmentNode)); - } - - return { - rootTypes: rootTypes, - operations: operations, - fragments: Array.from(fragmentMap.values()), - referencedTypes: Array.from(referencedTypes.values()), - schemaDocumentation: schema.description ?? undefined - }; - - function addReferencedType(type: GraphQLNamedType) { - if (referencedTypes.has(type)) { return } - - referencedTypes.add(type) - - if (isInterfaceType(type)) { - for (const objectType of schema.getPossibleTypes(type)) { - addReferencedType(getNamedType(objectType)) - } - } - - if (isUnionType(type)) { - const unionReferencedTypes = type.getTypes() - for (type of unionReferencedTypes) { - addReferencedType(getNamedType(type)) - } - } - - if (isInputObjectType(type)) { - addReferencedTypesFromInputObject(type) - } - - if (isObjectType(type)) { - for (const interfaceType of type.getInterfaces()) { - addReferencedType(getNamedType(interfaceType)) - } - } - } - - function addReferencedTypesFromInputObject( - inputObject: GraphQLInputObjectType - ) { - const fieldMap = inputObject.getFields() - for (const key in fieldMap) { - const field = fieldMap[key] - addReferencedType(getNamedType(field.type)) - } - } - - function getFragment(name: string): ir.FragmentDefinition | undefined { - let fragment = fragmentMap.get(name); - if (fragment) return fragment; - - const fragmentNode = fragmentNodeMap.get(name); - if (!fragmentNode) return undefined; - - // Remove the fragment node from the map so we know which ones we haven't encountered yet. - fragmentNodeMap.delete(name); - - fragment = compileFragment(fragmentNode); - fragmentMap.set(name, fragment); - return fragment; - } - - function compileOperation( - operationDefinition: OperationDefinitionNode - ): ir.OperationDefinition { - if (!operationDefinition.name) { - throw new GraphQLError("Operations should be named", { nodes: operationDefinition }); - } - - const filePath = filePathForNode(operationDefinition); - const name = operationDefinition.name.value; - const operationType = operationDefinition.operation; - - const variables = (operationDefinition.variableDefinitions || []).map( - (node) => { - const name = node.variable.name.value; - const defaultValue = node.defaultValue ? valueFromValueNode(node.defaultValue) : undefined - - // The casts are a workaround for the lack of support for passing a type union - // to overloaded functions in TypeScript. - // See https://github.com/microsoft/TypeScript/issues/14107 - const type = typeFromAST(schema, node.type as any) as GraphQLType; - - // `typeFromAST` returns `undefined` when a named type is not found - // in the schema. - if (!type) { - throw new GraphQLError( - `Couldn't get type from type node "${node.type}"`, - { nodes: node } - ); - } - - addReferencedType(getNamedType(type)); - - return { - name, - type, - defaultValue - }; - } - ); - - const source = print(transformToNetworkRequestSourceDefinition( - operationDefinition, - legacySafelistingCompatibleOperations - )); - const rootType = schema.getRootType(operationType) as GraphQLObjectType; - const [directives,] = compileDirectives(operationDefinition.directives) ?? [undefined, undefined]; - - addReferencedType(rootType) - - return { - name, - operationType, - variables, - rootType, - selectionSet: compileSelectionSet( - operationDefinition.selectionSet, - rootType - ), - directives: directives, - source, - filePath - }; - } - - function compileFragment( - fragmentDefinition: FragmentDefinitionNode - ): ir.FragmentDefinition { - const name = fragmentDefinition.name.value; - - const filePath = filePathForNode(fragmentDefinition); - const source = print(transformToNetworkRequestSourceDefinition( - fragmentDefinition, - legacySafelistingCompatibleOperations - )); - - const typeCondition = typeFromAST( - schema, - fragmentDefinition.typeCondition - ) as GraphQLCompositeType; - - const [directives,] = compileDirectives(fragmentDefinition.directives) ?? [undefined, undefined]; - - addReferencedType(getNamedType(typeCondition)); - - return { - name, - filePath, - source, - typeCondition, - selectionSet: compileSelectionSet( - fragmentDefinition.selectionSet, - typeCondition - ), - directives: directives - }; - } - - function compileSelectionSet( - selectionSetNode: SelectionSetNode, - parentType: GraphQLCompositeType - ): ir.SelectionSet { - return { - parentType, - selections: selectionSetNode.selections - .map((selectionNode) => - compileSelection(selectionNode, parentType) - ) - .filter(isNotNullOrUndefined), - }; - } - - function compileSelection( - selectionNode: SelectionNode, - parentType: GraphQLCompositeType - ): ir.Selection | undefined { - const [directives, inclusionConditions] = compileDirectives(selectionNode.directives) ?? [undefined, undefined]; - - switch (selectionNode.kind) { - case Kind.FIELD: { - const name = selectionNode.name.value; - if (name == "__typename") { return undefined } - const alias = selectionNode.alias?.value; - - const fieldDef = getFieldDef(schema, parentType, name); - if (!fieldDef) { - throw new GraphQLError( - `Cannot query field "${name}" on type "${String(parentType)}"`, - { nodes: selectionNode } - ); - } - - const fieldType = applyRequiredStatus(fieldDef.type, selectionNode.required); - const unwrappedFieldType = getNamedType(fieldType); - - addReferencedType(getNamedType(unwrappedFieldType)); - - const { description, deprecationReason } = fieldDef; - const args: ir.Field["arguments"] = compileArguments(fieldDef, selectionNode.arguments); - - let field: ir.Field = { - kind: "Field", - name, - alias, - type: fieldType, - arguments: args, - inclusionConditions: inclusionConditions, - description: !isMetaFieldName(name) && description ? description : undefined, - deprecationReason: deprecationReason || undefined, - directives: directives, - }; - - function validateFieldName(node: FieldNode, disallowedNames?: Array, schemaNamespace?: string) { - if (disallowedNames && schemaNamespace) { - const responseKey = (node.alias ?? node.name).value - const responseKeyFirstLowercase = responseKey.charAt(0).toLowerCase() + responseKey.slice(1) - - if (disallowedNames?.includes(responseKeyFirstLowercase)) { - throw new GraphQLError( - `Schema name "${schemaNamespace}" conflicts with name of a generated object API. Please choose a different schema name. Suggestions: "${schemaNamespace}Schema", "${schemaNamespace}GraphQL", "${schemaNamespace}API"`, - { nodes: node } - ); - } - } - } - - if (isListType(fieldType) || (isNonNullType(fieldType) && isListType(fieldType.ofType))) { - validateFieldName(selectionNode, validationOptions.disallowedFieldNames?.entityList, validationOptions.schemaNamespace) - } else if (isCompositeType(unwrappedFieldType)) { - validateFieldName(selectionNode, validationOptions.disallowedFieldNames?.entity, validationOptions.schemaNamespace) - } - - if (isCompositeType(unwrappedFieldType)) { - const selectionSetNode = selectionNode.selectionSet; - - if (!selectionSetNode) { - throw new GraphQLError( - `Composite field "${name}" on type "${String( - parentType - )}" requires selection set`, - { nodes: selectionNode } - ); - } - - field.selectionSet = compileSelectionSet( - selectionSetNode, - unwrappedFieldType - ); - } - return field; - } - case Kind.INLINE_FRAGMENT: { - const typeNode = selectionNode.typeCondition; - const typeCondition = typeNode - ? (typeFromAST(schema, typeNode) as GraphQLCompositeType) - : parentType; - - addReferencedType(typeCondition); - - return { - kind: "InlineFragment", - selectionSet: compileSelectionSet( - selectionNode.selectionSet, - typeCondition - ), - inclusionConditions: inclusionConditions, - directives: directives - }; - } - case Kind.FRAGMENT_SPREAD: { - const fragmentName = selectionNode.name.value; - - const fragment = getFragment(fragmentName); - if (!fragment) { - throw new GraphQLError( - `Unknown fragment "${fragmentName}".`, - { nodes: selectionNode.name } - ); - } - - const fragmentSpread: ir.FragmentSpread = { - kind: "FragmentSpread", - fragment, - inclusionConditions: inclusionConditions, - directives: directives - }; - return fragmentSpread; - } - } - } - - function compileArguments( - ...args: - [fieldDef: GraphQLField, args?: ReadonlyArray] | - [directiveDef: GraphQLDirective, args?: ReadonlyArray] - ): ir.Argument[] | undefined { - const argDefs: ReadonlyArray = args[0].args - return args[1] && args[1].length > 0 - ? args[1].map((arg) => { - const name = arg.name.value; - const argDef = argDefs.find( - (argDef) => argDef.name === arg.name.value - ); - const argDefType = argDef?.type; - - if (!argDefType) { - throw new GraphQLError( - `Cannot find directive argument type for argument "${name}".`, - { nodes: [arg] } - ); - } - - return { - name, - value: valueFromValueNode(arg.value), - type: argDefType, - deprecationReason: argDef.deprecationReason ?? undefined - }; - }) - : undefined; - } - - function compileDirectives( - directives?: ReadonlyArray - ): [ir.Directive[], ir.InclusionCondition[]?] | undefined { - if (directives && directives.length > 0) { - const compiledDirectives: ir.Directive[] = []; - const inclusionConditions: ir.InclusionCondition[] = []; - - for (const directive of directives) { - const name = directive.name.value; - const directiveDef = schema.getDirective(name) - - if (!directiveDef) { - throw new GraphQLError( - `Cannot find directive "${name}".`, - { nodes: directive } - ); - } - - compiledDirectives.push( - { - name: name, - arguments: compileArguments(directiveDef, directive.arguments) - } - ); - - const condition = compileInclusionCondition(directive, directiveDef); - if (condition) { inclusionConditions.push(condition) }; - } - - return [ - compiledDirectives, - inclusionConditions.length > 0 ? inclusionConditions : undefined - ] - - } else { - return undefined; - } - } - - function compileInclusionCondition( - directiveNode: DirectiveNode, - directiveDef: GraphQLDirective - ): ir.InclusionCondition | undefined { - if (directiveDef.name == "include" || directiveDef.name == "skip") { - const condition = directiveNode.arguments?.[0].value; - const isInverted = directiveDef.name == "skip"; - - switch (condition?.kind) { - case Kind.BOOLEAN: - if (isInverted) { - return condition.value ? "SKIPPED" : "INCLUDED"; - } else { - return condition.value ? "INCLUDED" : "SKIPPED"; - } - - case Kind.VARIABLE: - return { - variable: condition.name.value, - isInverted: isInverted - } - - default: - throw new GraphQLError( - `Conditional inclusion directive has invalid "if" argument.`, - { nodes: directiveNode } - ); - break; - } - } else { - return undefined - } - } - -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts deleted file mode 100644 index a876933a1d..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { - GraphQLCompositeType, - GraphQLInputType, - GraphQLNamedType, - GraphQLObjectType, - GraphQLOutputType, - GraphQLType, -} from "graphql"; -import { GraphQLValue } from "./values"; - -export interface RootTypeDefinition { - queryType: GraphQLNamedType; - mutationType: GraphQLNamedType | undefined; - subscriptionType: GraphQLNamedType | undefined; -} - -export interface OperationDefinition { - name: string; - operationType: OperationType; - variables: VariableDefinition[]; - rootType: GraphQLObjectType; - selectionSet: SelectionSet; - directives?: Directive[]; - source: string; - filePath?: string; -} - -export type OperationType = "query" | "mutation" | "subscription"; - -export interface VariableDefinition { - name: string; - type: GraphQLType; - defaultValue?: GraphQLValue; -} - -export interface FragmentDefinition { - name: string; - typeCondition: GraphQLCompositeType; - selectionSet: SelectionSet; - directives?: Directive[]; - source: string; - filePath?: string; -} - -export interface SelectionSet { - parentType: GraphQLCompositeType; - selections: Selection[]; -} - -export type Selection = Field | InlineFragment | FragmentSpread; - -export interface Field { - kind: "Field"; - name: string; - alias?: string; - type: GraphQLOutputType; - arguments?: Argument[]; - inclusionConditions?: InclusionCondition[] - description?: string; - deprecationReason?: string; - selectionSet?: SelectionSet; - directives?: Directive[]; -} - -export interface Argument { - name: string; - value: GraphQLValue; - type: GraphQLInputType; - deprecationReason?: string; -} - -export interface InlineFragment { - kind: "InlineFragment"; - selectionSet: SelectionSet; - inclusionConditions?: InclusionCondition[]; - directives?: Directive[]; -} - -export interface FragmentSpread { - kind: "FragmentSpread"; - fragment: FragmentDefinition; - inclusionConditions?: InclusionCondition[]; - directives?: Directive[]; -} - -export interface Directive { - name: string; - arguments?: Argument[]; -} - -export type InclusionCondition = InclusionConditionIncluded | InclusionConditionSkipped | InclusionConditionVariable; -export type InclusionConditionIncluded = "INCLUDED"; -export type InclusionConditionSkipped = "SKIPPED"; -export interface InclusionConditionVariable { - variable: string; - isInverted: Boolean; -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/values.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/values.ts deleted file mode 100644 index 2537f52d95..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/values.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Kind, ValueNode } from 'graphql'; - -export type GraphQLValue = - | { - kind: - | 'Variable' - | 'IntValue' - | 'FloatValue' - | 'StringValue' - | 'EnumValue'; - value: string; - } - | { kind: 'BooleanValue'; value: boolean } - | { kind: 'NullValue' } - | GraphQLListValue - | GraphQLObjectValue; - -export interface GraphQLListValue { - kind: 'ListValue'; - value: GraphQLValue[]; -} - -export interface GraphQLObjectValue { - kind: 'ObjectValue'; - value: { [name: string]: GraphQLValue }; -} - -export function valueFromValueNode(valueNode: ValueNode): GraphQLValue { - switch (valueNode.kind) { - case Kind.VARIABLE: - return { kind: valueNode.kind, value: valueNode.name.value }; - case Kind.LIST: - return { - kind: valueNode.kind, - value: valueNode.values.map(valueFromValueNode), - }; - case Kind.OBJECT: - return { - kind: valueNode.kind, - value: valueNode.fields.reduce((object, field) => { - object[field.name.value] = valueFromValueNode(field.value); - return object; - }, {} as GraphQLObjectValue['value']), - }; - default: - return valueNode; - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/index.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/index.ts deleted file mode 100644 index a062970cb1..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/index.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - Source, - buildClientSchema, - GraphQLSchema, - parse, - DocumentNode, - concatAST, - GraphQLError, - validate, - buildASTSchema, - printSchema, - extendSchema, -} from "graphql"; -import { defaultValidationRules, ValidationOptions } from "./validationRules"; -import { compileToIR, CompilationResult } from "./compiler"; -import { assertValidSchema, assertValidSDL } from "./utilities/graphql"; -import { - addApolloCodegenSchemaExtensionToDocument, -} from "./utilities/apolloCodegenSchemaExtension"; - -// We need to export all the classes we want to map to native objects, -// so we have access to the constructor functions for type checks. -export { - Source, - GraphQLError, - GraphQLSchema, - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, -} from "graphql"; -export { GraphQLSchemaValidationError } from "./utilities/graphql"; - -export function loadSchemaFromSources(sources: Source[]): GraphQLSchema { - var introspectionJSONResult: Source | undefined - - var documents = new Array() - for (const source of sources) { - if (source.name.endsWith(".json")) { - if (!introspectionJSONResult) { - introspectionJSONResult = source - } else { - throw new Error(`Schema search paths can only include one JSON schema definition. - Found "${introspectionJSONResult.name} & "${source.name}".`) - } - } else { - documents.push(parse(source)) - } - } - - var document = addApolloCodegenSchemaExtensionToDocument(concatAST(documents)) - - if (!introspectionJSONResult) { assertValidSDL(document) } - - const schema = introspectionJSONResult ? - extendSchema(loadSchemaFromIntrospectionResult(introspectionJSONResult.body), document, { assumeValid: true, assumeValidSDL: true }) : - buildASTSchema(document, { assumeValid: true, assumeValidSDL: true }) - - assertValidSchema(schema) - - return schema -} - -function loadSchemaFromIntrospectionResult( - introspectionResult: string -): GraphQLSchema { - let payload = JSON.parse(introspectionResult); - - if (payload.data) { - payload = payload.data; - } - - const schema = buildClientSchema(payload); - - return schema; -} - -export function printSchemaToSDL(schema: GraphQLSchema): string { - return printSchema(schema) -} - -export function parseOperationDocument(source: Source, experimentalClientControlledNullability: boolean): DocumentNode { - return parse(source, {experimentalClientControlledNullability: experimentalClientControlledNullability}); -} - -export function mergeDocuments(documents: DocumentNode[]): DocumentNode { - return concatAST(documents); -} - -export function validateDocument( - schema: GraphQLSchema, - document: DocumentNode, - validationOptions: ValidationOptions, -): readonly GraphQLError[] { - return validate(schema, document, defaultValidationRules(validationOptions)); -} - -export function compileDocument( - schema: GraphQLSchema, - document: DocumentNode, - legacySafelistingCompatibleOperations: boolean, - validationOptions: ValidationOptions -): CompilationResult { - return compileToIR(schema, document, legacySafelistingCompatibleOperations, validationOptions); -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/apolloCodegenSchemaExtension.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/apolloCodegenSchemaExtension.ts deleted file mode 100644 index 9504373909..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/apolloCodegenSchemaExtension.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { DirectiveDefinitionNode, DocumentNode, Kind, NameNode, StringValueNode, concatAST } from "graphql"; - -export const directive_apollo_client_ios_localCacheMutation: DirectiveDefinitionNode = { - kind: Kind.DIRECTIVE_DEFINITION, - description: stringNode("A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations."), - name: nameNode("apollo_client_ios_localCacheMutation"), - repeatable: false, - locations: [nameNode("QUERY"), nameNode("MUTATION"), nameNode("SUBSCRIPTION"), nameNode("FRAGMENT_DEFINITION")] -} - -function nameNode(name :string): NameNode { - return { - kind: Kind.NAME, - value: name - } -} - -function stringNode(value :string): StringValueNode { - return { - kind: Kind.STRING, - value: value - } -} - -export const apolloCodegenSchemaExtension: DocumentNode = { - kind: Kind.DOCUMENT, - definitions: [ - directive_apollo_client_ios_localCacheMutation - ] -} - -export function addApolloCodegenSchemaExtensionToDocument(document: DocumentNode): DocumentNode { - return document.definitions.some(definition => - definition.kind == Kind.DIRECTIVE_DEFINITION && - definition.name.value == directive_apollo_client_ios_localCacheMutation.name.value - ) ? - document : - concatAST([document, apolloCodegenSchemaExtension]) -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/graphql.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/graphql.ts deleted file mode 100644 index 2c6ba89a68..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/graphql.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { - ASTNode, - FieldNode, - GraphQLCompositeType, - GraphQLField, - GraphQLSchema, - isInterfaceType, - isObjectType, - isUnionType, - Kind, - Location, - SchemaMetaFieldDef, - SelectionSetNode, - TypeMetaFieldDef, - TypeNameMetaFieldDef, - validateSchema, - visit, - GraphQLError, - DocumentNode, - DirectiveNode, -} from "graphql"; -import { isNode } from "graphql/language/ast"; -import { validateSDL } from "graphql/validation/validate"; -import { directive_apollo_client_ios_localCacheMutation } from "./apolloCodegenSchemaExtension"; -import { addTypeNameFieldForLegacySafelisting } from "./legacySafelistingTransform"; - -export class GraphQLSchemaValidationError extends Error { - constructor(public validationErrors: readonly GraphQLError[]) { - super(validationErrors.map((error) => error.message).join("\n\n")); - - this.name = "GraphQLSchemaValidationError"; - } -} - -export function assertValidSDL(document: DocumentNode) { - const errors = validateSDL(document); - if (errors.length !== 0) { - throw new GraphQLSchemaValidationError(errors); - } -} - -export function assertValidSchema(schema: GraphQLSchema) { - const errors = validateSchema(schema); - if (errors.length !== 0) { - throw new GraphQLSchemaValidationError(errors); - } -} - -export function sourceAt(location: Location) { - return location.source.body.slice(location.start, location.end); -} - -export function filePathForNode(node: ASTNode): string | undefined { - return node.loc?.source?.name; -} - -export function isMetaFieldName(name: string) { - return name.startsWith("__"); -} - -const typenameField: FieldNode = { - kind: Kind.FIELD, - name: { kind: Kind.NAME, value: "__typename" }, -}; - -export function transformToNetworkRequestSourceDefinition( - ast: ASTNode, - legacySafelistingCompatibleOperations: boolean -) { - if (legacySafelistingCompatibleOperations) { - ast = addTypeNameFieldForLegacySafelisting(ast) - } - - return visit(ast, { - SelectionSet: { - leave(node: SelectionSetNode, _, parent) { - if (isNode(parent) && ![Kind.FIELD, Kind.FRAGMENT_DEFINITION].includes(parent.kind)) { - return node - } - return addTypenameFieldToSelectionSetIfNeeded(node) - } - }, - Field: { - enter(node: FieldNode) { - return transformTypenameFieldIfNeeded(node) - } - }, - Directive: { - enter(node: DirectiveNode) { - return stripLocalCacheMutationCustomClientDirective(node) - } - } - }); -} - -function addTypenameFieldToSelectionSetIfNeeded(node: SelectionSetNode): SelectionSetNode { - const hasTypenameField = node.selections.find((selection) => - selection.kind == typenameField.kind && selection.name.value == typenameField.name.value - ); - - if (hasTypenameField) { - return node - } else { - return { - ...node, - selections: [typenameField, ...node.selections], - }; - } -} - -function transformTypenameFieldIfNeeded(node: FieldNode): FieldNode { - if (node.name.value == typenameField.name.value) { - return { - ...node, - alias: undefined, - directives: undefined - } - } else { - return node; - } -} - -function stripLocalCacheMutationCustomClientDirective(node: DirectiveNode): DirectiveNode | null { - return (node.name.value == directive_apollo_client_ios_localCacheMutation.name.value) ? null : node; -} - -// Utility functions extracted from graphql-js - -/** - * Not exactly the same as the executor's definition of getFieldDef, in this - * statically evaluated environment we do not always have an Object type, - * and need to handle Interface and Union types. - */ -export function getFieldDef( - schema: GraphQLSchema, - parentType: GraphQLCompositeType, - fieldName: string, -): GraphQLField | undefined { - if ( - fieldName === SchemaMetaFieldDef.name && - schema.getQueryType() === parentType - ) { - return SchemaMetaFieldDef; - } - if (fieldName === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return TypeMetaFieldDef; - } - if ( - fieldName === TypeNameMetaFieldDef.name && - (isObjectType(parentType) || - isInterfaceType(parentType) || - isUnionType(parentType)) - ) { - return TypeNameMetaFieldDef; - } - if (isObjectType(parentType) || isInterfaceType(parentType)) { - return parentType.getFields()[fieldName]; - } - - return undefined; -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/index.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/index.ts deleted file mode 100644 index 9e39e0fa89..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./graphql"; -export * from "./predicates"; -export * from "./apolloCodegenSchemaExtension"; \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/legacySafelistingTransform.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/legacySafelistingTransform.ts deleted file mode 100644 index d7584a7339..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/legacySafelistingTransform.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { - ASTNode, - FieldNode, - Kind, - visit, -} from "graphql"; - -// This has been copied from https://github.dev/apollographql/apollo-tooling/blob/cfe529bd83627eda7ea78818d32218af7a4e8f2b/packages/apollo-language-server/src/utilities/graphql.ts#L305-L347 -const typenameField = { - kind: Kind.FIELD, - name: { kind: Kind.NAME, value: "__typename" }, -}; - -export function addTypeNameFieldForLegacySafelisting(ast: ASTNode) { - return visit(ast, { - enter(node: ASTNode) { - if ( - !(node.kind === Kind.SELECTION_SET) - ) { - return undefined; - } else { - return { - ...node, - selections: node.selections.filter( - (selection) => - !( - selection.kind === "Field" && - (selection as FieldNode).name.value === "__typename" - ) - ), - }; - } - }, - leave(node: ASTNode) { - if ( - !( - node.kind === Kind.FIELD || - node.kind === Kind.FRAGMENT_DEFINITION || - node.kind === Kind.INLINE_FRAGMENT - ) - ) { - return undefined; - } - if (!node.selectionSet) return undefined; - - return { - ...node, - selectionSet: { - ...node.selectionSet, - selections: [typenameField, ...node.selectionSet.selections], - }, - }; - }, - }); -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/predicates.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/predicates.ts deleted file mode 100644 index 5769992556..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/predicates.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function isNotNullOrUndefined( - value: T | null | undefined, -): value is T { - return value !== null && typeof value !== 'undefined'; -} - -export function isObject(value: any): value is object { - return ( - value !== undefined && - value !== null && - typeof value === 'object' && - !Array.isArray(value) - ); -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/validationRules.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/validationRules.ts deleted file mode 100644 index c2c605c4c0..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/validationRules.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - NoUnusedFragmentsRule, - ValidationRule, - specifiedRules, - FieldNode, - GraphQLError, - OperationDefinitionNode, - ValidationContext, - VariableDefinitionNode, -} from "graphql"; - -const specifiedRulesToBeRemoved: [ValidationRule] = [NoUnusedFragmentsRule]; - -export interface DisallowedFieldNames { - allFields?: Array - entity?: Array - entityList?: Array -} - -export interface ValidationOptions { - schemaNamespace?: string - disallowedFieldNames?: DisallowedFieldNames - disallowedInputParameterNames?: Array -} - -export function defaultValidationRules(options: ValidationOptions): ValidationRule[] { - const disallowedFieldNamesRule = ApolloIOSDisallowedFieldNames(options.disallowedFieldNames?.allFields) - const disallowedInputParameterNamesRule = ApolloIOSDisallowedInputParameterNames(options.disallowedInputParameterNames) - return [ - NoAnonymousQueries, - NoTypenameAlias, - ...(disallowedFieldNamesRule ? [disallowedFieldNamesRule] : []), - ...(disallowedInputParameterNamesRule ? [disallowedInputParameterNamesRule] : []), - ...specifiedRules.filter((rule) => !specifiedRulesToBeRemoved.includes(rule)), - ]; -} - -export function NoAnonymousQueries(context: ValidationContext) { - return { - OperationDefinition(node: OperationDefinitionNode) { - if (!node.name) { - context.reportError( - new GraphQLError( - "Apollo does not support anonymous operations because operation names are used during code generation. Please give this operation a name.", - node - ) - ); - } - return false; - }, - }; -} - -export function NoTypenameAlias(context: ValidationContext) { - return { - Field(node: FieldNode) { - const aliasName = node.alias && node.alias.value; - if (aliasName == "__typename") { - context.reportError( - new GraphQLError( - "Apollo needs to be able to insert __typename when needed, so using it as an alias is not supported.", - node - ) - ); - } - }, - }; -} - -function ApolloIOSDisallowedFieldNames(fieldNames?: Array) { - if (fieldNames) { - return function ApolloIOSDisallowedFieldNamesValidationRule(context: ValidationContext) { - const disallowedFieldNames = fieldNames - return { - Field(node: FieldNode) { - const responseKey = (node.alias ?? node.name).value - const responseKeyFirstLowercase = responseKey.charAt(0).toLowerCase() + responseKey.slice(1) - if (disallowedFieldNames.includes(responseKeyFirstLowercase)) { - context.reportError( - new GraphQLError(`Field name "${responseKey}" is not allowed because it conflicts with generated object APIs. Please use an alias to change the field name.`, - { nodes: node }) - ); - } - }, - }; - } - } - return undefined -} - -function ApolloIOSDisallowedInputParameterNames(names?: Array) { - if (names) { - return function ApolloIOSDisallowedInputParameterNamesValidationRule(context: ValidationContext) { - const disallowedNames = names - return { - VariableDefinition(node: VariableDefinitionNode) { - const parameterName = node.variable.name.value - const parameterNameFirstLowercase = parameterName.charAt(0).toLowerCase() + parameterName.slice(1) - if (disallowedNames.includes(parameterNameFirstLowercase)) { - context.reportError( - new GraphQLError(`Input Parameter name "${parameterName}" is not allowed because it conflicts with generated object APIs.`, - { nodes: node }) - ); - } - }, - }; - } - } - return undefined -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.base.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.base.json deleted file mode 100644 index f85872ce12..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.base.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es2019", - "lib": ["es2019"], - "module": "es2020", - "moduleResolution": "node", - "preserveSymlinks": true, - "esModuleInterop": true, - "sourceMap": true, - "declaration": false, - "declarationMap": false, - "removeComments": true, - "strict": true, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "forceConsistentCasingInFileNames": true, - }, -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.json deleted file mode 100644 index 07b8af81b9..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.base", - "compilerOptions": { - "types": ["node"], - "rootDir": "./src", - "outDir": "./lib" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "**/__tests__/*", "**/__testUtils__/*"] -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.test.base.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.test.base.json deleted file mode 100644 index 54a491bc86..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.test.base.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.base", - "compilerOptions": { - "types": ["node", "jest"], - }, - "files": ["./src/__testUtils__/matchers.ts"], -} diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.test.json b/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.test.json deleted file mode 100644 index 6148abaca7..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/tsconfig.test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.test.base", - "include": ["**/__tests__/**/*"] -} \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScriptBridge.swift b/Sources/ApolloCodegenLib/Frontend/JavaScriptBridge.swift deleted file mode 100644 index 5ddca52c26..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/JavaScriptBridge.swift +++ /dev/null @@ -1,452 +0,0 @@ -import JavaScriptCore -import OrderedCollections - -// MARK: - JavaScriptError - -// JavaScriptCore APIs haven't been annotated for nullability, but most of its methods will never return `null` -// and can be safely force unwrapped. (Even when an exception is thrown they would still return -// a `JSValue` representing a JavaScript `undefined` value.) - -/// An error thrown during JavaScript execution. -/// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error -public class JavaScriptError: JavaScriptObject, Error, @unchecked Sendable { - // These properties were changed to read-only when `@unchecked Sendable` was added for - // Xcode 13.3. If you make them publicly writable or alter their values within the class - // you will need to do so with thread-safety in mind. - var name: String? { self["name"] } - var message: String? { self["message"] } - var stack: String? { self["stack"] } -} - -extension JavaScriptError: CustomStringConvertible { - public var description: String { - return jsValue.toString() - } -} - -// MARK: - JavaScriptObject - -/// A type that references an underlying JavaScript object. -public class JavaScriptObject: JavaScriptValueDecodable { - let jsValue: JSValue - let bridge: JavaScriptBridge - - static func fromJSValue(_ jsValue: JSValue, bridge: JavaScriptBridge) -> Self { - return bridge.wrap(jsValue) - } - - required init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isObject) - - self.jsValue = jsValue - self.bridge = bridge - } - - subscript(property: Any) -> JSValue { - return jsValue[property] - } - - subscript(property: Any) -> Decodable { - return bridge.fromJSValue(jsValue[property]) - } - - private func call(_ functionName: String, with arguments: [Any]) throws -> JSValue { - return try bridge.throwingJavaScriptErrorIfNeeded { - let function = jsValue[functionName] - - precondition(!function.isUndefined, "Function \(functionName) is undefined") - - return function.call(withArguments: bridge.unwrap(arguments))! - } - } - - func call(_ functionName: String, with arguments: Any...) throws -> JSValue { - try call(functionName, with: arguments) - } - - func call(_ functionName: String, with arguments: Any...) throws -> Decodable { - return bridge.fromJSValue(try call(functionName, with: arguments)) - } - - private func invokeMethod(_ methodName: String, with arguments: [Any]) throws -> JSValue { - return try bridge.throwingJavaScriptErrorIfNeeded { - jsValue.invokeMethod(methodName, withArguments: bridge.unwrap(arguments)) - } - } - - func invokeMethod(_ methodName: String, with arguments: Any...) throws -> JSValue { - try invokeMethod(methodName, with: arguments) - } - - func invokeMethod(_ methodName: String, with arguments: Any...) throws -> Decodable { - return bridge.fromJSValue(try invokeMethod(methodName, with: arguments)) - } - - func construct(with arguments: Any...) throws -> Wrapper { - return bridge.fromJSValue(try bridge.throwingJavaScriptErrorIfNeeded { - jsValue.construct(withArguments: bridge.unwrap(arguments)) - }) - } -} - -extension JavaScriptObject: CustomDebugStringConvertible { - @objc public var debugDescription: String { - return "<\(type(of: self)): \(jsValue.toString()!)>" - } -} - -// MARK: - JavaScriptWrapper - -/// An object that can wrap an underlying `JavaScriptObject`. -/// -/// Can be used as an alternative to subclassing `JavaScriptObject` when you -/// need to be able to create a non-javascript backed version of the class also. -public class JavaScriptWrapper: JavaScriptValueDecodable { - let _underlyingObject: JavaScriptObject! - - required init(_ underlyingObject: JavaScriptObject? = nil) { - self._underlyingObject = underlyingObject - } - - required convenience init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - self.init(JavaScriptObject(jsValue, bridge: bridge)) - } - - static func fromJSValue(_ jsValue: JSValue, bridge: JavaScriptBridge) -> Self { - return Self.init(JavaScriptObject.fromJSValue(jsValue, bridge: bridge)) - } - - subscript(property: Any) -> JSValue? { - return _underlyingObject?[property] - } - - subscript(property: Any) -> Decodable { - return _underlyingObject[property] - } - -} - -// MARK: - JavaScriptBridge - -/// The JavaScript bridge is responsible for converting values to and from type-safe wrapper objects. It also ensures exceptions thrown from JavaScript wrapped and rethrown. -class JavaScriptBridge { - - public enum Error: Swift.Error { - case failedToCreateJSContext - } - - private struct WeakRef { - weak var value: T? - - init(_ value: T) { - self.value = value - } - } - - private let virtualMachine = JSVirtualMachine() - - let context: JSContext - - // In JavaScript, classes are represented by constructor functions. We need access to these when checking - // the type of a received value in `wrap(_)` below. - // We keep a bidirectional mapping between constructors and wrapper types so we can both access the - // corresponding wrapper type, and perform an `instanceof` check based on the corresponding constructor - // for the expected wrapper type in case there isn't a direct match and we are receiving a subtype. - private var constructorToWrapperType: [JSValue /* constructor function */: JavaScriptObject.Type] = [:] - private var wrapperTypeToConstructor: [AnyHashable /* JavaScriptObject.Type */: JSValue] = [:] - - /// We keep a map between `JSValue` objects and wrapper objects, to avoid repeatedly creating new - /// wrappers and to guarantee referential equality. - /// TODO: We may want to consider making the keys weak here, because this does mean we'll be - /// keeping alive all objects that are passed over the bridge in JavaScript. - /// ('JSValue` is an Objective-C object that uses `JSValueProtect` to mark the underlying - /// JavaScript object as ineligible for garbage collection.) - private var wrapperMap: [JSValue: WeakRef] = [:] - - init() throws { - guard let context = JSContext(virtualMachine: virtualMachine) else { - throw Error.failedToCreateJSContext - } - - self.context = context - - register(JavaScriptObject.self, forJavaScriptClass: "Object", from: context.globalObject) - register(JavaScriptError.self, forJavaScriptClass: "Error", from: context.globalObject) - } - - public func register(_ wrapperType: JavaScriptObject.Type, forJavaScriptClass className: String? = nil, from scope: JavaScriptObject) { - register(wrapperType, forJavaScriptClass: className, from: scope.jsValue) - } - - public func register(_ wrapperType: JavaScriptObject.Type, forJavaScriptClass className: String? = nil, from scope: JSValue) { - let className = className ?? String(describing: wrapperType) - - let constructor = scope[className] - precondition(constructor.isObject, "Couldn't find JavaScript constructor function for class \(className). Make sure the class is exported from the library's entry point.") - - constructorToWrapperType[constructor] = wrapperType - wrapperTypeToConstructor[ObjectIdentifier(wrapperType)] = constructor - } - - func fromJSValue(_ jsValue: JSValue) -> Decodable { - return Decodable.fromJSValue(jsValue, bridge: self) - } - - fileprivate func wrap(_ jsValue: JSValue) -> Wrapper { - if let wrapper = wrapperMap[jsValue]?.value { - return checkedDowncast(wrapper) - } - - precondition(jsValue.isObject, "Expected JavaScript object but found: \(jsValue)") - - let wrapperType: JavaScriptObject.Type - - let constructor = jsValue["constructor"] - - // If an object doesn't have a prototype or has `Object` as its direct prototype, - // we assume it is of the expected type and let the wrapper handle further type checks if needed. - // This occurs for pseudo-classes like the AST nodes for example, that rely on a `kind` property - // to indicate their type instead of a prototype. - if constructor.isUndefined || constructor["name"].toString() == "Object" { - wrapperType = Wrapper.self - } else if let registeredType = constructorToWrapperType[constructor] { - // We have a wrapper type registered for the JavaScript class. - wrapperType = registeredType - } else { - // We may have received an unregistered subtype of the expected type, and we don't necessarily - // have a wrapper registered for every subtype (this is likely to happen with - // subtypes of `Error` for example). So if we can verify the value is indeed an instance of - // the expected type we use that as the wrapper. - - guard let expectedConstructor = wrapperTypeToConstructor[ObjectIdentifier(Wrapper.self)] else { - preconditionFailure(""" - Couldn't find JavaScript constructor for wrapper type \(Wrapper.self). \ - Make sure the type is registered with the bridge." - """) - } - - if jsValue.isInstance(of: expectedConstructor) { - wrapperType = Wrapper.self - } else { - preconditionFailure(""" - Object with JavaScript constructor \(constructor["name"]) doesn't seem to be \ - an instance of expected type \(expectedConstructor["name"])" - """) - } - } - - let wrapper = wrapperType.init(jsValue, bridge: self) - wrapperMap[jsValue] = WeakRef(wrapper) - return checkedDowncast(wrapper) - } - - fileprivate func unwrap(_ values: [Any]) -> [Any] { - return values.map { value in - if let unwrappable = value as? CustomJavaScriptValueUnwrappable { - return unwrappable.unwrapJSValue - } else { - return value - } - } - } - - @discardableResult func throwingJavaScriptErrorIfNeeded(body: () -> ReturnValue) throws -> ReturnValue { - let result = body() - - // Errors thrown from JavaScript are stored on the context and ignored by default. - // To surface these to callers, we wrap them in a `JavaScriptError` and throw. - if let exception = context.exception { - throw fromJSValue(exception) as JavaScriptError - } - - return result - } -} - -/// A type that can decode itself from a JavaScript value. -protocol JavaScriptValueDecodable { - // We rely on a static `fromJSValue` method to allow for polymorphic construction and to be able - // to return existing wrappers instead of creating new instances. - static func fromJSValue(_ jsValue: JSValue, bridge: JavaScriptBridge) -> Self - - init(_ jsValue: JSValue, bridge: JavaScriptBridge) -} - -extension JavaScriptValueDecodable { - static func fromJSValue(_ jsValue: JSValue, bridge: JavaScriptBridge) -> Self { - return Self.init(jsValue, bridge: bridge) - } -} - -extension Optional: JavaScriptValueDecodable where Wrapped: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - if jsValue.isUndefined || jsValue.isNull { - self = nil - } else { - self = Wrapped.fromJSValue(jsValue, bridge: bridge) - } - } -} - -extension Array: JavaScriptValueDecodable where Element: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - self = jsValue.toArray { Element.fromJSValue($0, bridge: bridge) } - } -} - -extension Dictionary: JavaScriptValueDecodable where Key == String, Value: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - self = jsValue.toDictionary { Value.fromJSValue($0, bridge: bridge) } - } -} - -extension OrderedDictionary: JavaScriptValueDecodable where Key == String, Value: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - self = jsValue.toOrderedDictionary { Value.fromJSValue($0, bridge: bridge) } - } -} - -extension String: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isString, "Expected JavaScript string but found: \(jsValue)") - self = jsValue.toString() - } -} - -extension Int: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isNumber, "Expected JavaScript number but found: \(jsValue)") - self = jsValue.toInt() - } -} - -extension Bool: JavaScriptValueDecodable { - init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - precondition(jsValue.isBoolean, "Expected JavaScript boolean but found: \(jsValue)") - self = jsValue.toBool() - } -} - -extension JSValue { - subscript(_ property: Any) -> JSValue { - return objectForKeyedSubscript(property) - } - - func toInt() -> Int { - return Int(toInt32()) - } - - // The regular `toArray()` does a deep convert of all elements, which means JavaScript objects - // will be converted to `NSDictionary` and we lose the ability to pass references back to JavaScript. - // That's why we manually construct an array by iterating over the indexes here. - func toArray(_ transform: (JSValue) throws -> Element) rethrows -> [Element] { - precondition(isArray, "Expected JavaScript array but found: \(self)") - - let length = self["length"].toInt() - - var array = [Element]() - array.reserveCapacity(length) - - for index in 0..(_ transform: (JSValue) throws -> Value) rethrows -> [String: Value] { - precondition(isObject, "Expected JavaScript object but found: \(self)") - - guard let keys = context.globalObject["Object"].invokeMethod("keys", withArguments: [self])?.toArray() as? [String] else { - preconditionFailure("Couldn't get keys for object \(self)") - } - - var dictionary = [String: Value]() - - for key in keys { - let element = try transform(self.objectForKeyedSubscript(key)) - dictionary[key] = element - } - - return dictionary - } - - // The regular `toDictionary()` creates an `NSDictionary` that while it preserves the order of - // `keys` from JavaScript during initialization, there is no order afterwards. `OrderedDictionary` - // provides for the preservation and subsequent use of ordering in the collection. - func toOrderedDictionary(_ transform: (JSValue) throws -> Value) rethrows -> OrderedDictionary { - precondition(isObject, "Expected JavaScript object but found: \(self)") - - guard let keys = context.globalObject["Object"].invokeMethod("keys", withArguments: [self])?.toArray() as? [String] else { - preconditionFailure("Couldn't get keys for object \(self)") - } - - var dictionary = OrderedDictionary() - - for key in keys { - let element = try transform(self.objectForKeyedSubscript(key)) - dictionary[key] = element - } - - return dictionary - } - - // The regular `toDictionary()` creates an `NSDictionary` that while it preserves the order of - // `keys` from JavaScript during initialization, there is no order afterwards. `OrderedDictionary` - // provides for the preservation and subsequent use of ordering in the collection. - func toOrderedDictionary(_ transform: (JSValue) throws -> (String, Value)) rethrows -> OrderedDictionary { - precondition(isArray, "Expected JavaScript array but found: \(self)") - - let length = self["length"].toInt() - - var dictionary = OrderedDictionary() - dictionary.reserveCapacity(length) - - for index in 0..(_ object: AnyObject) -> ExpectedType { - guard let expected = object as? ExpectedType else { - preconditionFailure("Expected type to be \(ExpectedType.self), but found \(type(of: object))") - } - - return expected -} - -fileprivate protocol CustomJavaScriptValueUnwrappable { - var unwrapJSValue: Any { get } -} - -extension JavaScriptObject: CustomJavaScriptValueUnwrappable { - var unwrapJSValue: Any { - return jsValue - } -} - -extension Optional: CustomJavaScriptValueUnwrappable where Wrapped: CustomJavaScriptValueUnwrappable { - var unwrapJSValue: Any { - return map(\.unwrapJSValue) as Any - } -} - -extension Array: CustomJavaScriptValueUnwrappable where Element: CustomJavaScriptValueUnwrappable { - var unwrapJSValue: Any { - return map(\.unwrapJSValue) - } -} - -extension Dictionary: CustomJavaScriptValueUnwrappable where Key == String, Value: CustomJavaScriptValueUnwrappable { - var unwrapJSValue: Any { - return mapValues(\.unwrapJSValue) - } -} diff --git a/Sources/ApolloCodegenLib/Frontend/ValidationOptions.swift b/Sources/ApolloCodegenLib/Frontend/ValidationOptions.swift deleted file mode 100644 index 74f5763630..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/ValidationOptions.swift +++ /dev/null @@ -1,72 +0,0 @@ -import Foundation -import JavaScriptCore - -public struct ValidationOptions { - - struct DisallowedFieldNames { - let allFields: Set - let entity: Set - let entityList: Set - - var asDictionary: Dictionary> { - return [ - "allFields": Array(allFields), - "entity": Array(entity), - "entityList": Array(entityList) - ] - } - } - - let schemaNamespace: String - let disallowedFieldNames: DisallowedFieldNames - let disallowedInputParameterNames: Set - - init(config: ApolloCodegen.ConfigurationContext) { - self.schemaNamespace = config.schemaNamespace - - let singularizedSchemaNamespace = config.pluralizer.singularize(config.schemaNamespace) - let pluralizedSchemaNamespace = config.pluralizer.pluralize(config.schemaNamespace) - let disallowedEntityListFieldNames: Set - switch (config.schemaNamespace) { - case singularizedSchemaNamespace: - disallowedEntityListFieldNames = [pluralizedSchemaNamespace.firstLowercased] - case pluralizedSchemaNamespace: - disallowedEntityListFieldNames = [singularizedSchemaNamespace.firstLowercased] - default: - fatalError("Could not derive singular/plural of schema name '\(config.schemaNamespace)'") - } - - self.disallowedFieldNames = DisallowedFieldNames( - allFields: SwiftKeywords.DisallowedFieldNames, - entity: [config.schemaNamespace.firstLowercased], - entityList: disallowedEntityListFieldNames - ) - - self.disallowedInputParameterNames = - SwiftKeywords.DisallowedInputParameterNames.union([config.schemaNamespace.firstLowercased]) - } - - public class Bridged: JavaScriptObject { - convenience init(from options: ValidationOptions, bridge: JavaScriptBridge) { - let jsValue = JSValue(newObjectIn: bridge.context) - - jsValue?.setValue( - JSValue(object: options.schemaNamespace, in: bridge.context), - forProperty: "schemaNamespace" - ) - - jsValue?.setValue( - JSValue(object: options.disallowedFieldNames.asDictionary, in: bridge.context), - forProperty: "disallowedFieldNames" - ) - - jsValue?.setValue( - JSValue(object: Array(options.disallowedInputParameterNames), in: bridge.context), - forProperty: "disallowedInputParameterNames" - ) - - self.init(jsValue!, bridge: bridge) - } - } - -} diff --git a/Sources/ApolloCodegenLib/Frontend/auto_rollup.sh b/Sources/ApolloCodegenLib/Frontend/auto_rollup.sh deleted file mode 100644 index 34b3c4d7fe..0000000000 --- a/Sources/ApolloCodegenLib/Frontend/auto_rollup.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -output_file="$SCRIPT_DIR/ApolloCodegenFrontendBundle.swift" -$( cd "$SCRIPT_DIR/Javascript" && rollup -c ) -minJS=$(cat "$SCRIPT_DIR/dist/ApolloCodegenFrontend.bundle.js") -printf "%s%s%s" "let ApolloCodegenFrontendBundle: String = #\"" "$minJS" "\"#" > $output_file diff --git a/Sources/ApolloCodegenLib/Glob.swift b/Sources/ApolloCodegenLib/Glob.swift deleted file mode 100644 index 635e237a92..0000000000 --- a/Sources/ApolloCodegenLib/Glob.swift +++ /dev/null @@ -1,232 +0,0 @@ -import Foundation -import OrderedCollections - -private extension String { - static let Globstar: String = "**" - - var includesGlobstar: Bool { - return self.contains(Self.Globstar) - } - - var isExclude: Bool { - return self.first == "!" - } - - var containsExclude: Bool { - return self.contains("!") - } -} - -/// A path pattern matcher. -public struct Glob { - let patterns: [String] - let rootURL: URL? - - // GLOB_ERR - Return on error - // GLOB_MARK - Append / to matching directories - // GLOB_NOSORT - Don't sort - // GLOB_TILDE - Expand tilde names from the passwd file - private let flags = GLOB_ERR | GLOB_MARK | GLOB_NOSORT | GLOB_TILDE | GLOB_BRACE - - /// An error object that indicates why pattern matching failed. - public enum MatchError: Error, LocalizedError, Equatable { - case noSpace // GLOB_NOSPACE - case aborted // GLOB_ABORTED - case cannotEnumerate(path: String) - case invalidExclude(path: String) - case unknown(code: Int) - - public var errorDescription: String? { - switch self { - case .noSpace: return "Malloc call failed" // From Darwin.POSIX.glob - case .aborted: return "Unignored error" // From Darwin.POSIX.glob - case .cannotEnumerate(let path): return "Cannot enumerate \(path)" - case .invalidExclude(let path): return "Exclude paths must start with '!' - \(path)" - case .unknown(let code): return "Unknown error: \(code)" - } - } - } - - /// The designated initializer - /// - /// - Parameters: - /// - pattern: An array of path matching pattern strings. - /// - rootURL: The rootURL to search for the patterns relative to. If `nil` searches - /// the process's current working directory. - /// - /// Each path matching pattern can include the following characters: - /// - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - /// - `?` matches any single character, eg: `file-?.graphql` - /// - `**` matches all subdirectories (deep), eg: `**/*.graphql` - /// - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - /// - /// - Discussion: - /// - init(_ patterns: [String], relativeTo rootURL: URL? = nil) { - self.patterns = patterns - self.rootURL = rootURL - } - - /// Executes the pattern match on the underlying file system. - /// - /// - Returns: A set of matched file paths. - func match(excludingDirectories excluded: [String]? = nil) throws -> OrderedSet { - let expandedPatterns = try expand(self.patterns, excludingDirectories: excluded) - - var includeMatches: [String] = [] - var excludeMatches: [String] = [] - - for pattern in expandedPatterns { - if pattern.isExclude { - let patternMatches = try matches(for: String(pattern.dropFirst())) - excludeMatches.append(contentsOf: patternMatches) - - } else { - let patternMatches = try matches(for: pattern) - includeMatches.append(contentsOf: patternMatches) - } - } - - // Resolve symlinks in any included paths - includeMatches = includeMatches.compactMap({ path in - return URL(fileURLWithPath: path).resolvingSymlinksInPath().path - }) - return OrderedSet(includeMatches).subtracting(excludeMatches) - } - - /// Separates a comma-delimited string into paths, expanding any globstars and removes duplicates. - private func expand( - _ patterns: [String], - excludingDirectories excluded: [String]? - ) throws -> OrderedSet { - var paths: OrderedSet = [] - for pattern in patterns { - if pattern.containsExclude && !pattern.isExclude { - // glob and fnmatch do support ! being used elsewhere in the path match pattern but for the - // purposes of Glob we reserve it exclusively for the exclude pattern and it is required to - // be the first character otherwise we throw. - throw MatchError.invalidExclude(path: pattern) - } - - paths.formUnion(try expand(pattern, excludingDirectories: excluded)) - } - - return paths - } - - /// Expands `pattern` including any globstar character (`**`) to find all directory paths to - /// search for the match pattern and removes duplicates. - private func expand( - _ pattern: String, - excludingDirectories excluded: [String]? - ) throws -> OrderedSet { - guard pattern.includesGlobstar else { - return [URL(fileURLWithPath: pattern, relativeTo: rootURL).path] - } - - CodegenLogger.log("Expanding globstar \(pattern)", logLevel: .debug) - - let isExclude = pattern.isExclude - var parts = pattern.components(separatedBy: String.Globstar) - var firstPart = parts.removeFirst() - let lastPart = parts.joined(separator: String.Globstar) - - if isExclude { - // Remove ! here otherwise the Linux glob function would not return any results. Results for - // the exclude path match patterns are needed because match() manually handles exclusion. - firstPart = String(firstPart.dropFirst()) - } - - let fileManager = FileManager.default - - let searchURL: URL = { - if firstPart.isEmpty || firstPart == "./" { - return rootURL ?? URL(fileURLWithPath: fileManager.currentDirectoryPath) - } else { - return URL(fileURLWithPath: firstPart, relativeTo: rootURL) - } - }() - - var directories: [URL] = [searchURL] // include searching the globstar root directory - - do { - let resourceKeys: [URLResourceKey] = [.isDirectoryKey] - var enumeratorError: Error? - - let errorHandler: ((URL, Error) -> Bool) = { url, error in - enumeratorError = error - return false // aborts enumeration - } - - guard let enumerator = fileManager.enumerator( - at: searchURL, - includingPropertiesForKeys: resourceKeys, - errorHandler: errorHandler) - else { - throw MatchError.cannotEnumerate(path: searchURL.path) - } - - if let enumeratorError = enumeratorError { throw enumeratorError } - - var excludedSet: Set = [] - if let excluded = excluded { - excludedSet = Set(excluded) - } - - for case (let url as URL) in enumerator { - guard - let resourceValues = try? url.resourceValues(forKeys: Set(resourceKeys)), - let isDirectory = resourceValues.isDirectory, - isDirectory == true, - excludedSet.intersection(url.pathComponents).isEmpty - else { continue } - - directories.append(url) - } - - } catch(let error) { - throw(error) - } - - return OrderedSet(directories.compactMap({ directory in - var path = directory.appendingPathComponent(lastPart).standardizedFileURL.path - if isExclude { - path.insert("!", at: path.startIndex) - } - - CodegenLogger.log("Expanded to \(path)", logLevel: .debug) - - return path - })) - } - - /// Performs the underlying file system path matching. - private func matches(for pattern: String) throws -> [String] { - var globT = glob_t() - - defer { - globfree(&globT) - } - - CodegenLogger.log("Evaluating \(pattern)", logLevel: .debug) - - let response = glob(pattern, flags, nil, &globT) - - switch response { - case 0: break // SUCCESS - case GLOB_NOMATCH: return [] - case GLOB_NOSPACE: throw MatchError.noSpace - case GLOB_ABORTED: throw MatchError.aborted - default: throw MatchError.unknown(code: Int(response)) - } - - return (0.. String { - IR.Entity.Location.FieldComponent(name: responseKey, type: type) - .formattedSelectionSetName(with: pluralizer) - } - -} - -extension IR.Entity.Location.FieldComponent { - - /// Takes the associated `IR.Entity.Location.FieldComponent` and formats it into a selection set name - func formattedSelectionSetName( - with pluralizer: Pluralizer - ) -> String { - var fieldName = name.firstUppercased - if type.isListType { - fieldName = pluralizer.singularize(fieldName) - } - return fieldName.asSelectionSetName - } - -} - -extension IR.Entity.Location.SourceDefinition { - - /// Takes the associated `IR.Entity.Location.SourceDefinition` and formats it into a selection set name - func formattedSelectionSetName() -> String { - switch self { - case .operation: return "Data" - case let .namedFragment(fragment): return fragment.generatedDefinitionName - } - } - -} diff --git a/Sources/ApolloCodegenLib/IR/IR+EntitySelectionTree.swift b/Sources/ApolloCodegenLib/IR/IR+EntitySelectionTree.swift deleted file mode 100644 index 6e1031524a..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+EntitySelectionTree.swift +++ /dev/null @@ -1,588 +0,0 @@ -import OrderedCollections - -extension IR { - - /// Represents the selections for an entity at different nested type scopes in a tree. - /// - /// This data structure is used to memoize the selections for an `Entity` to quickly compute - /// the `mergedSelections` for `SelectionSet`s. - /// - /// During the creation of `SelectionSet`s, their `selections` are added to their entities - /// mergedSelectionTree at the appropriate type scope. After all `SelectionSet`s have been added - /// to the `EntitySelectionTree`, the tree can be quickly traversed to collect the selections - /// that will be selected for a given `SelectionSet`'s type scope. - class EntitySelectionTree { - let rootTypePath: LinkedList - let rootNode: EntityNode - - init(rootTypePath: LinkedList) { - self.rootTypePath = rootTypePath - self.rootNode = EntityNode(rootTypePath: rootTypePath) - } - - // MARK: - Merge Selection Sets Into Tree - - func mergeIn( - selections: DirectSelections.ReadOnly, - with typeInfo: SelectionSet.TypeInfo - ) { - let source = MergedSelections.MergedSource( - typeInfo: typeInfo, - fragment: nil - ) - mergeIn(selections: selections, from: source) - } - - private func mergeIn(selections: DirectSelections.ReadOnly, from source: MergedSelections.MergedSource) { - guard (!selections.fields.isEmpty || !selections.namedFragments.isEmpty) else { - return - } - - let targetNode = Self.findOrCreateNode( - atEnclosingEntityScope: source.typeInfo.scopePath.head, - withEntityScopePath: source.typeInfo.scopePath.head.value.scopePath.head, - from: rootNode, - withRootTypePath: rootTypePath.head - ) - - targetNode.mergeIn(selections, from: source) - } - - fileprivate static func findOrCreateNode( - atEnclosingEntityScope currentEntityScope: LinkedList.Node, - withEntityScopePath currentEntityConditionPath: LinkedList.Node, - from node: EntityNode, - withRootTypePath currentRootTypePathNode: LinkedList.Node - ) -> EntityNode { - guard let nextEntityTypePath = currentRootTypePathNode.next else { - // Advance to field node in current entity & type case - return Self.findOrCreateNode( - withConditionScopePath: currentEntityScope.value.scopePath.head, - from: node - ) - } - - guard let nextConditionPathForCurrentEntity = currentEntityConditionPath.next else { - // Advance to next entity - guard let nextEntityScope = currentEntityScope.next else { fatalError() } - let nextEntityNode = node.childAsEntityNode() - - return findOrCreateNode( - atEnclosingEntityScope: nextEntityScope, - withEntityScopePath: nextEntityScope.value.scopePath.head, - from: nextEntityNode, - withRootTypePath: nextEntityTypePath - ) - } - - // Advance to next type case in current entity - let nextCondition = nextConditionPathForCurrentEntity.value - - let nextNodeForCurrentEntity = node.scope != nextCondition - ? node.scopeConditionNode(for: nextCondition) : node - - return findOrCreateNode( - atEnclosingEntityScope: currentEntityScope, - withEntityScopePath: nextConditionPathForCurrentEntity, - from: nextNodeForCurrentEntity, - withRootTypePath: currentRootTypePathNode - ) - } - - private static func findOrCreateNode( - withConditionScopePath selectionsScopePath: LinkedList.Node, - from node: EntityNode - ) -> EntityNode { - guard let nextConditionInScopePath = selectionsScopePath.next else { - // Last condition in field scope path - let selectionsCondition = selectionsScopePath.value - - return selectionsCondition == node.scope ? - node : node.scopeConditionNode(for: selectionsCondition) - } - - let nextCondition = nextConditionInScopePath.value - let nextConditionNode = node.scopeConditionNode(for: nextCondition) - - return findOrCreateNode( - withConditionScopePath: nextConditionInScopePath, - from: nextConditionNode - ) - } - - // MARK: - Calculate Merged Selections From Tree - - func addMergedSelections(into selections: IR.MergedSelections) { - let rootTypePath = selections.typeInfo.scopePath.head - rootNode.mergeSelections(matchingScopePath: rootTypePath, into: selections) - } - - class EntityNode { - typealias Selections = OrderedDictionary - enum Child { - case entity(EntityNode) - case selections(Selections) - } - - let rootTypePathNode: LinkedList.Node - let type: GraphQLCompositeType - let scope: ScopeCondition - private(set) var child: Child? - var scopeConditions: OrderedDictionary? - - fileprivate convenience init(rootTypePath: LinkedList) { - self.init(typeNode: rootTypePath.head) - } - - private init(typeNode: LinkedList.Node) { - self.scope = .init(type: typeNode.value) - self.type = typeNode.value - self.rootTypePathNode = typeNode - - if let nextNode = typeNode.next { - child = .entity(EntityNode(typeNode: nextNode)) - } else { - child = .selections([:]) - } - } - - private init( - scope: IR.ScopeCondition, - type: GraphQLCompositeType, - rootTypePathNode: LinkedList.Node - ) { - self.scope = scope - self.type = type - self.rootTypePathNode = rootTypePathNode - } - - fileprivate func mergeIn( - _ selections: DirectSelections.ReadOnly, - from source: IR.MergedSelections.MergedSource - ) { - updateSelections { - $0.updateValue(forKey: source, default: EntityTreeScopeSelections()) { - $0.mergeIn(selections) - } - } - } - - fileprivate func mergeIn( - _ selections: EntityTreeScopeSelections, - from source: IR.MergedSelections.MergedSource - ) { - updateSelections { - $0.updateValue(forKey: source, default: EntityTreeScopeSelections()) { - $0.mergeIn(selections) - } - } - } - - private func updateSelections(_ block: (inout Selections) -> Void) { - var entitySelections: Selections - - switch child { - case .entity: - fatalError( - "Selection Merging Error. Please create an issue on Github to report this." - ) - - case let .selections(currentSelections): - entitySelections = currentSelections - - case .none: - entitySelections = Selections() - } - - block(&entitySelections) - self.child = .selections(entitySelections) - } - - func mergeSelections( - matchingScopePath scopePathNode: LinkedList.Node, - into targetSelections: IR.MergedSelections - ) { - switch child { - case let .entity(entityNode): - guard let nextScopePathNode = scopePathNode.next else { return } - entityNode.mergeSelections(matchingScopePath: nextScopePathNode, into: targetSelections) - - case let .selections(selections): - for (source, scopeSelections) in selections { - targetSelections.mergeIn(scopeSelections, from: source) - } - - if let conditionalScopes = scopeConditions { - for (condition, node) in conditionalScopes { - if scopePathNode.value.matches(condition) { - node.mergeSelections(matchingScopePath: scopePathNode, into: targetSelections) - - } else { - targetSelections.addMergedInlineFragment(with: condition) - } - } - } - - case .none: break - } - - if let scopeConditions = scopeConditions { - for (condition, node) in scopeConditions { - if scopePathNode.value.matches(condition) { - node.mergeSelections(matchingScopePath: scopePathNode, into: targetSelections) - } - } - } - } - - fileprivate func childAsEntityNode() -> EntityNode { - switch child { - case let .entity(node): - return node - - case .selections: - fatalError( - "Selection Merging Error. Please create an issue on Github to report this." - ) - - case .none: - let node = EntityNode(typeNode: self.rootTypePathNode.next!) - self.child = .entity(node) - return node - } - } - - fileprivate func scopeConditionNode(for condition: ScopeCondition) -> EntityNode { - let nodeCondition = ScopeCondition( - type: condition.type == self.type ? nil : condition.type, - conditions: condition.conditions, - isDeferred: condition.isDeferred - ) - - func createNode() -> EntityNode { - // When initializing as a conditional scope node, if the `scope` does not have a - // type condition, we should inherit the parent node's type. - let nodeType = nodeCondition.type ?? self.type - - return EntityNode( - scope: nodeCondition, - type: nodeType, - rootTypePathNode: self.rootTypePathNode - ) - } - - guard var scopeConditions = scopeConditions else { - let node = createNode() - self.scopeConditions = [nodeCondition: node] - return node - } - - guard let node = scopeConditions[condition] else { - let node = createNode() - scopeConditions[nodeCondition] = node - self.scopeConditions = scopeConditions - return node - } - - return node - } - } - } - - class EntityTreeScopeSelections: Equatable { - - fileprivate(set) var fields: OrderedDictionary = [:] - fileprivate(set) var namedFragments: OrderedDictionary = [:] - - init() {} - - fileprivate init( - fields: OrderedDictionary, - namedFragments: OrderedDictionary - ) { - self.fields = fields - self.namedFragments = namedFragments - } - - var isEmpty: Bool { - fields.isEmpty && namedFragments.isEmpty - } - - private func mergeIn(_ field: Field) { - fields[field.hashForSelectionSetScope] = field - } - - private func mergeIn(_ fields: T) where T.Element == Field { - fields.forEach { mergeIn($0) } - } - - private func mergeIn(_ fragment: NamedFragmentSpread) { - namedFragments[fragment.hashForSelectionSetScope] = fragment - } - - private func mergeIn(_ fragments: T) where T.Element == NamedFragmentSpread { - fragments.forEach { mergeIn($0) } - } - - func mergeIn(_ selections: DirectSelections.ReadOnly) { - mergeIn(selections.fields.values) - mergeIn(selections.namedFragments.values) - } - - func mergeIn(_ selections: EntityTreeScopeSelections) { - mergeIn(selections.fields.values) - mergeIn(selections.namedFragments.values) - } - - static func == (lhs: IR.EntityTreeScopeSelections, rhs: IR.EntityTreeScopeSelections) -> Bool { - lhs.fields == rhs.fields && - lhs.namedFragments == rhs.namedFragments - } - } -} - -// MARK: - Merge In Other Entity Trees - -extension IR.EntitySelectionTree { - - /// Merges an `EntitySelectionTree` from a matching `Entity` in the given `FragmentSpread` - /// into the receiver. - /// - /// - Precondition: This function assumes that the `EntitySelectionTree` being merged in - /// represents the same entity in the response. Passing a non-matching entity is a serious - /// programming error and will result in undefined behavior. - func mergeIn( - _ otherTree: IR.EntitySelectionTree, - from fragment: IR.NamedFragmentSpread, - using entityStorage: IR.RootFieldEntityStorage - ) { - let otherTreeCount = otherTree.rootTypePath.count - let diffToRoot = rootTypePath.count - otherTreeCount - - precondition(diffToRoot >= 0, "Cannot merge in tree shallower than current tree.") - - var rootEntityToStartMerge: EntityNode = rootNode - - for _ in 0...Node, - from rootNode: IR.EntitySelectionTree.EntityNode - ) -> IR.EntitySelectionTree.EntityNode { - guard let nextFragmentNode = fragmentNode.next else { - return rootNode - } - let nextNode = rootNode.scopeConditionNode(for: nextFragmentNode.value) - return findOrCreate(fromFragmentScopeNode: nextFragmentNode, from: nextNode) - } - - fileprivate func mergeIn( - _ fragmentTree: IR.EntitySelectionTree, - from fragment: IR.NamedFragmentSpread, - with inclusionConditions: AnyOf?, - using entityStorage: IR.RootFieldEntityStorage - ) { - let rootNodeToStartMerge = findOrCreate( - fromFragmentScopeNode: fragment.typeInfo.scopePath.last.value.scopePath.head, - from: self - ) - - let fragmentType = fragment.typeInfo.parentType - let rootTypesMatch = rootNodeToStartMerge.type == fragmentType - - if let inclusionConditions { - for conditionGroup in inclusionConditions.elements { - let scope = IR.ScopeCondition( - type: rootTypesMatch ? nil : fragmentType, - conditions: conditionGroup, - isDeferred: fragment.isDeferred - ) - let nextNode = rootNodeToStartMerge.scopeConditionNode(for: scope) - - nextNode.mergeIn( - fragmentTree.rootNode, - from: fragment, - using: entityStorage - ) - } - - } else { - let nextNode = rootTypesMatch ? - rootNodeToStartMerge : - rootNodeToStartMerge.scopeConditionNode( - for: IR.ScopeCondition(type: fragmentType, isDeferred: fragment.isDeferred) - ) - - nextNode.mergeIn( - fragmentTree.rootNode, - from: fragment, - using: entityStorage - ) - } - } - - fileprivate func mergeIn( - _ otherNode: IR.EntitySelectionTree.EntityNode, - from fragment: IR.NamedFragmentSpread, - using entityStorage: IR.RootFieldEntityStorage - ) { - switch otherNode.child { - case let .entity(otherNextNode): - let nextNode = self.childAsEntityNode() - nextNode.mergeIn( - otherNextNode, - from: fragment, - using: entityStorage - ) - - case let .selections(otherNodeSelections): - self.mergeIn( - otherNodeSelections, - from: fragment, - using: entityStorage - ) - - case .none: - break - } - - if let otherConditions = otherNode.scopeConditions { - for (otherCondition, otherNode) in otherConditions { - let conditionNode = self.scopeConditionNode(for: otherCondition) - conditionNode.mergeIn( - otherNode, - from: fragment, - using: entityStorage - ) - } - } - } - - fileprivate func mergeIn( - _ selections: Selections, - from fragment: IR.NamedFragmentSpread, - using entityStorage: IR.RootFieldEntityStorage - ) { - for (source, selections) in selections { - let newSource = source.fragment != nil ? - source : - IR.MergedSelections.MergedSource( - typeInfo: source.typeInfo, fragment: fragment.fragment - ) - - let fields = selections.fields.mapValues { oldField -> IR.Field in - if let oldField = oldField as? IR.EntityField { - let entity = entityStorage.entity( - for: oldField.entity, - inFragmentSpreadAtTypePath: fragment.typeInfo - ) - - return IR.EntityField( - oldField.underlyingField, - inclusionConditions: oldField.inclusionConditions, - selectionSet: IR.SelectionSet( - entity: entity, - scopePath: oldField.selectionSet.scopePath, - mergedSelectionsOnly: true) - ) - - } else { - return oldField - } - } - - let fragments = selections.namedFragments.mapValues { oldFragment -> IR.NamedFragmentSpread in - let entity = entityStorage.entity( - for: oldFragment.typeInfo.entity, - inFragmentSpreadAtTypePath: fragment.typeInfo - ) - return IR.NamedFragmentSpread( - fragment: oldFragment.fragment, - typeInfo: IR.SelectionSet.TypeInfo( - entity: entity, - scopePath: oldFragment.typeInfo.scopePath - ), - inclusionConditions: oldFragment.inclusionConditions, - isDeferred: oldFragment.isDeferred - ) - } - - self.mergeIn( - IR.EntityTreeScopeSelections(fields: fields, namedFragments: fragments), - from: newSource - ) - } - } - -} - -// MARK: - CustomDebugStringConvertible - -extension IR.EntitySelectionTree: CustomDebugStringConvertible { - var debugDescription: String { - """ - rootTypePath: \(rootTypePath.debugDescription) - \(rootNode.debugDescription) - """ - } -} - -extension IR.EntitySelectionTree.EntityNode: CustomDebugStringConvertible { - var debugDescription: String { - TemplateString(""" - \(scope.debugDescription) { - \(child?.debugDescription ?? "nil") - conditionalScopes: [\(list: scopeConditions?.values.elements ?? [])] - } - """).description - } -} - -extension IR.EntitySelectionTree.EntityNode.Child: CustomDebugStringConvertible { - var debugDescription: String { - func debugDescription(for selections: IR.EntitySelectionTree.EntityNode.Selections) -> String { - TemplateString(""" - [ - \(selections.map { - TemplateString(""" - Source: \($0.key.debugDescription) - \($0.value.debugDescription) - """) - }) - ] - """).description - } - - switch self { - case let .entity(node): - return "child: \(node.debugDescription)" - - case let .selections(selections): - return TemplateString("selections: \(debugDescription(for: selections))").description - } - } - -} - -extension IR.EntityTreeScopeSelections: CustomDebugStringConvertible { - var debugDescription: String { - """ - Fields: \(fields.values.elements) - Fragments: \(namedFragments.values.elements.description) - """ - } -} diff --git a/Sources/ApolloCodegenLib/IR/IR+Field.swift b/Sources/ApolloCodegenLib/IR/IR+Field.swift deleted file mode 100644 index 680ff51790..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+Field.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - - class Field: Equatable, CustomDebugStringConvertible { - let underlyingField: CompilationResult.Field - var inclusionConditions: AnyOf? - - var name: String { underlyingField.name } - var alias: String? { underlyingField.alias } - var responseKey: String { underlyingField.responseKey } - var type: GraphQLType { underlyingField.type } - var arguments: [CompilationResult.Argument]? { underlyingField.arguments } - - fileprivate init( - _ field: CompilationResult.Field, - inclusionConditions: AnyOf? = nil - ) { - self.underlyingField = field - self.inclusionConditions = inclusionConditions - } - - static func ==(lhs: Field, rhs: Field) -> Bool { - lhs.underlyingField == rhs.underlyingField - } - - var debugDescription: String { - TemplateString(""" - \(name): \(type.debugDescription)\(ifLet: inclusionConditions, { - " \($0.debugDescription)" - }) - """).description - } - } - - final class ScalarField: Field { - override init( - _ field: CompilationResult.Field, - inclusionConditions: AnyOf? = nil - ) { - super.init(field, inclusionConditions: inclusionConditions) - } - } - - final class EntityField: Field { - let selectionSet: SelectionSet - var entity: Entity { selectionSet.typeInfo.entity } - - init( - _ field: CompilationResult.Field, - inclusionConditions: AnyOf? = nil, - selectionSet: SelectionSet - ) { - self.selectionSet = selectionSet - super.init(field, inclusionConditions: inclusionConditions) - } - - static func ==(lhs: EntityField, rhs: EntityField) -> Bool { - lhs.underlyingField == rhs.underlyingField && - lhs.selectionSet == rhs.selectionSet - } - } - -} diff --git a/Sources/ApolloCodegenLib/IR/IR+FieldCollector.swift b/Sources/ApolloCodegenLib/IR/IR+FieldCollector.swift deleted file mode 100644 index 6740d1259c..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+FieldCollector.swift +++ /dev/null @@ -1,61 +0,0 @@ -extension IR { - - class FieldCollector { - - typealias CollectedField = (String, GraphQLType, deprecationReason: String?) - - private var collectedFields: [GraphQLCompositeType: [ - String: (GraphQLType, deprecationReason: String?) - ]] = [:] - - func collectFields(from selectionSet: CompilationResult.SelectionSet) { - guard let type = selectionSet.parentType as? GraphQLInterfaceImplementingType else { return } - for case let .field(field) in selectionSet.selections { - add(field: field, to: type) - } - } - - func add( - fields: T, - to type: GraphQLInterfaceImplementingType - ) where T.Element == CompilationResult.Field { - for field in fields { - add(field: field, to: type) - } - } - - func add( - field: CompilationResult.Field, - to type: GraphQLInterfaceImplementingType - ) { - var fields = collectedFields[type] ?? [:] - add(field, to: &fields) - collectedFields.updateValue(fields, forKey: type) - } - - private func add( - _ field: CompilationResult.Field, - to referencedFields: inout [String: (GraphQLType, deprecationReason: String?)] - ) { - let key = field.responseKey - if !referencedFields.keys.contains(key) { - referencedFields[key] = (field.type, field.deprecationReason) - } - } - - func collectedFields( - for type: GraphQLInterfaceImplementingType - ) -> [(String, GraphQLType, deprecationReason: String?)] { - var fields = collectedFields[type] ?? [:] - - for interface in type.interfaces { - if let interfaceFields = collectedFields[interface] { - fields.merge(interfaceFields) { field, _ in field } - } - } - - return fields.sorted { $0.0 < $1.0 }.map { ($0.key, $0.value.0, $0.value.deprecationReason )} - } - } - -} diff --git a/Sources/ApolloCodegenLib/IR/IR+InclusionConditions.swift b/Sources/ApolloCodegenLib/IR/IR+InclusionConditions.swift deleted file mode 100644 index 673aeb30be..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+InclusionConditions.swift +++ /dev/null @@ -1,229 +0,0 @@ -import OrderedCollections - -extension IR { - - /// A condition representing an `@include` or `@skip` directive to determine if a field - /// or fragment should be included. - struct InclusionCondition: Hashable, CustomDebugStringConvertible { - - /// The name of variable used to determine if the inclusion condition is met. - let variable: String - - /// If isInverted is `true`, this condition represents a `@skip` directive and is included - /// if the variable resolves to `false`. - let isInverted: Bool - - init(_ variable: String, isInverted: Bool) { - self.variable = variable - self.isInverted = isInverted - } - - /// Creates an `InclusionCondition` representing an `@include` directive. - static func include(if variable: String) -> InclusionCondition { - .init(variable, isInverted: false) - } - - /// Creates an `InclusionCondition` representing a `@skip` directive. - static func skip(if variable: String) -> InclusionCondition { - .init(variable, isInverted: true) - } - - func inverted() -> InclusionCondition { - InclusionCondition(variable, isInverted: !isInverted) - } - - var debugDescription: String { - TemplateString(""" - @\(if: isInverted, "skip", else: "include")(if: $\(variable)) - """).description - } - - } - - struct InclusionConditions: Collection, Hashable, CustomDebugStringConvertible { - - typealias Element = InclusionCondition - - private var conditions: OrderedSet - - private init(_ conditions: OrderedSet) { - self.conditions = conditions - } - - init(_ condition: InclusionCondition) { - self.conditions = [condition] - } - - static func allOf( - _ conditions: T - ) -> Result where T.Element == InclusionCondition { - return Result(conditions) - } - - static func allOf( - _ conditions: T - ) -> Result where T.Element == CompilationResult.InclusionCondition { - return Result(conditions) - } - - var debugDescription: String { - TemplateString("\(conditions.map(\.debugDescription), separator: " && ")").description - } - - mutating func append(_ condition: InclusionCondition) { - conditions.append(condition) - } - - func appending(_ condition: InclusionCondition) -> InclusionConditions { - var conditions = self.conditions - conditions.append(condition) - return InclusionConditions(conditions) - } - - mutating func append(_ newConditions: InclusionConditions) { - conditions.append(contentsOf: newConditions.conditions) - } - - func appending(_ newConditions: InclusionConditions) -> InclusionConditions { - var conditions = self.conditions - conditions.append(contentsOf: newConditions.conditions) - return InclusionConditions(conditions) - } - - // MARK: Collection Conformance - - var startIndex: Int { conditions.startIndex } - - var endIndex: Int { conditions.endIndex } - - func index(after i: Int) -> Int { conditions.index(after: i) } - - subscript(position: Int) -> IR.InclusionCondition { conditions[position] } - - func isSubset(of other: InclusionConditions?) -> Bool { - conditions.isSubset(of: other?.conditions ?? []) - } - - // MARK: - Joining Operators - - static func &&(_ lhs: Self, rhs: InclusionCondition) -> Result { - Result.conditional(lhs) && rhs - } - - // MARK: - InclusionConditions.Result - - enum Result: Hashable { - case included - case skipped - case conditional(InclusionConditions) - - var conditions: InclusionConditions? { - guard case let .conditional(conditions) = self else { return nil } - return conditions - } - - fileprivate init(_ conditions: T) where T.Element == InclusionCondition { - self = .included - for condition in conditions { - self = self && condition - } - } - - fileprivate init(_ conditions: T) where T.Element == CompilationResult.InclusionCondition { - self = .included - for condition in conditions { - self = self && condition - } - } - - static func &&(_ lhs: Self, rhs: CompilationResult.InclusionCondition) -> Self { - switch rhs { - case .skipped: - return .skipped - - case .included: - return lhs - - case let .variable(variable, isInverted): - let newCondition = InclusionCondition(variable, isInverted: isInverted) - return lhs && newCondition - } - } - - static func &&(_ lhs: Self, rhs: InclusionCondition) -> Self { - switch lhs { - case .skipped: - return .skipped - - case .included: - return .conditional(.init([rhs])) - - case .conditional(var conditions): - guard !conditions.contains(rhs.inverted()) else { - // If both an include & skip exist with the same variable, the result is always skipped. - return .skipped - } - - conditions.append(rhs) - return .conditional(conditions) - } - } - } - - } -} - -struct AnyOf: Hashable { - private(set) var elements: OrderedSet - - init(_ element: T) { - self.elements = [element] - } - - init?(_ element: T?) { - guard let element = element else { return nil } - self.elements = [element] - } - - init(_ elements: S) where S.Element == T { - self.elements = OrderedSet(elements) - } - - mutating func append(contentsOf other: AnyOf) { - elements.append(contentsOf: other.elements) - } -} - -extension AnyOf where T == IR.InclusionConditions { - init(_ condition: IR.InclusionCondition) { - self.init(IR.InclusionConditions(condition)) - } -} - -extension AnyOf: CustomDebugStringConvertible where T: CustomDebugStringConvertible { - var debugDescription: String { - let wrapInParens = elements.count > 1 - var string = "" - for (index, element) in elements.enumerated() { - if index > 0 { - string += " || " - } - - if wrapInParens { - string += "(\(element.debugDescription))" - } else { - string += element.debugDescription - } - } - return string - } -} - -func ||(_ lhs: AnyOf?, rhs: AnyOf?) -> AnyOf? { - guard var lhs = lhs, let rhs = rhs else { - return nil - } - - lhs.append(contentsOf: rhs) - return lhs -} diff --git a/Sources/ApolloCodegenLib/IR/IR+NamedFragmentBuilder.swift b/Sources/ApolloCodegenLib/IR/IR+NamedFragmentBuilder.swift deleted file mode 100644 index fae219f63d..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+NamedFragmentBuilder.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - - func build(fragment fragmentDefinition: CompilationResult.FragmentDefinition) -> NamedFragment { - if let fragment = builtFragments[fragmentDefinition.name] { - return fragment - } - - let rootField = CompilationResult.Field( - name: fragmentDefinition.name, - type: .nonNull(.entity(fragmentDefinition.type)), - selectionSet: fragmentDefinition.selectionSet - ) - - let rootEntity = Entity( - source: .namedFragment(fragmentDefinition) - ) - - let result = RootFieldBuilder.buildRootEntityField( - forRootField: rootField, - onRootEntity: rootEntity, - inIR: self - ) - - let irFragment = IR.NamedFragment( - definition: fragmentDefinition, - rootField: result.rootField, - referencedFragments: result.referencedFragments, - entities: result.entities - ) - - builtFragments[irFragment.name] = irFragment - return irFragment - } - -} diff --git a/Sources/ApolloCodegenLib/IR/IR+OperationBuilder.swift b/Sources/ApolloCodegenLib/IR/IR+OperationBuilder.swift deleted file mode 100644 index e231cc4172..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+OperationBuilder.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - - func build(operation operationDefinition: CompilationResult.OperationDefinition) -> Operation { - let rootField = CompilationResult.Field( - name: operationDefinition.operationType.rawValue, - type: .nonNull(.entity(operationDefinition.rootType)), - selectionSet: operationDefinition.selectionSet - ) - - let rootEntity = Entity( - source: .operation(operationDefinition) - ) - - let result = RootFieldBuilder.buildRootEntityField( - forRootField: rootField, - onRootEntity: rootEntity, - inIR: self - ) - - return IR.Operation( - definition: operationDefinition, - rootField: result.rootField, - referencedFragments: result.referencedFragments - ) - } - -} diff --git a/Sources/ApolloCodegenLib/IR/IR+RootFieldBuilder.swift b/Sources/ApolloCodegenLib/IR/IR+RootFieldBuilder.swift deleted file mode 100644 index 53707de1e0..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+RootFieldBuilder.swift +++ /dev/null @@ -1,389 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - - class RootFieldEntityStorage { - private(set) var entitiesForFields: [Entity.Location: IR.Entity] = [:] - - init(rootEntity: Entity) { - entitiesForFields[rootEntity.location] = rootEntity - } - - func entity( - for field: CompilationResult.Field, - on enclosingEntity: Entity - ) -> Entity { - let location = enclosingEntity - .location - .appending(.init(name: field.responseKey, type: field.type)) - - var rootTypePath: LinkedList { - guard let fieldType = field.selectionSet?.parentType else { - fatalError("Entity cannot be created for non-entity type field \(field).") - } - return enclosingEntity.rootTypePath.appending(fieldType) - } - - return entitiesForFields[location] ?? - createEntity(location: location, rootTypePath: rootTypePath) - } - - func entity( - for entityInFragment: IR.Entity, - inFragmentSpreadAtTypePath fragmentSpreadTypeInfo: SelectionSet.TypeInfo - ) -> Entity { - var location = fragmentSpreadTypeInfo.entity.location - if let pathInFragment = entityInFragment.location.fieldPath { - location = location.appending(pathInFragment) - } - - var rootTypePath: LinkedList { - let otherRootTypePath = entityInFragment.rootTypePath.dropFirst() - return fragmentSpreadTypeInfo.entity.rootTypePath.appending(otherRootTypePath) - } - - return entitiesForFields[location] ?? - createEntity(location: location, rootTypePath: rootTypePath) - } - - private func createEntity( - location: Entity.Location, - rootTypePath: LinkedList - ) -> Entity { - let entity = Entity(location: location, rootTypePath: rootTypePath) - entitiesForFields[location] = entity - return entity - } - - fileprivate func mergeAllSelectionsIntoEntitySelectionTrees(from fragmentSpread: NamedFragmentSpread) { - for (_, fragmentEntity) in fragmentSpread.fragment.entities { - let entity = entity(for: fragmentEntity, inFragmentSpreadAtTypePath: fragmentSpread.typeInfo) - entity.selectionTree.mergeIn(fragmentEntity.selectionTree, from: fragmentSpread, using: self) - } - } - } - - class RootFieldBuilder { - struct Result { - let rootField: IR.EntityField - let referencedFragments: ReferencedFragments - let entities: [Entity.Location: IR.Entity] - } - - typealias ReferencedFragments = OrderedSet - - static func buildRootEntityField( - forRootField rootField: CompilationResult.Field, - onRootEntity rootEntity: Entity, - inIR ir: IR - ) -> Result { - return RootFieldBuilder(ir: ir, rootEntity: rootEntity) - .build(rootField: rootField) - } - - private let ir: IR - private let rootEntity: Entity - private let entityStorage: RootFieldEntityStorage - private var referencedFragments: ReferencedFragments = [] - - private var schema: Schema { ir.schema } - - private init(ir: IR, rootEntity: Entity) { - self.ir = ir - self.rootEntity = rootEntity - self.entityStorage = RootFieldEntityStorage(rootEntity: rootEntity) - } - - private func build( - rootField: CompilationResult.Field - ) -> Result { - guard let rootSelectionSet = rootField.selectionSet else { - fatalError("Root field must have a selection set.") - } - - let rootTypePath = ScopeDescriptor.descriptor( - forType: rootEntity.rootType, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ) - - let rootIrSelectionSet = SelectionSet( - entity: rootEntity, - scopePath: LinkedList(rootTypePath) - ) - - buildDirectSelections( - into: rootIrSelectionSet.selections.direct.unsafelyUnwrapped, - atTypePath: rootIrSelectionSet.typeInfo, - from: rootSelectionSet - ) - - return Result( - rootField: EntityField(rootField, selectionSet: rootIrSelectionSet), - referencedFragments: referencedFragments, - entities: entityStorage.entitiesForFields - ) - } - - private func buildDirectSelections( - into target: DirectSelections, - atTypePath typeInfo: SelectionSet.TypeInfo, - from selectionSet: CompilationResult.SelectionSet - ) { - addSelections(from: selectionSet, to: target, atTypePath: typeInfo) - - typeInfo.entity.selectionTree.mergeIn( - selections: target.readOnlyView, - with: typeInfo - ) - } - - private func addSelections( - from selectionSet: CompilationResult.SelectionSet, - to target: DirectSelections, - atTypePath typeInfo: SelectionSet.TypeInfo - ) { - for selection in selectionSet.selections { - add(selection, to: target, atTypePath: typeInfo) - } - - ir.fieldCollector.collectFields(from: selectionSet) - } - - private func add( - _ selection: CompilationResult.Selection, - to target: DirectSelections, - atTypePath typeInfo: SelectionSet.TypeInfo - ) { - switch selection { - case let .field(field): - if let irField = buildField( - from: field, - atTypePath: typeInfo - ) { - target.mergeIn(irField) - } - - case let .inlineFragment(inlineFragment): - let inlineSelectionSet = inlineFragment.selectionSet - guard let scope = scopeCondition(for: inlineFragment, in: typeInfo) else { - return - } - - if typeInfo.scope.matches(scope) { - addSelections( - from: inlineSelectionSet, - to: target, - atTypePath: typeInfo - ) - - } else { - let irTypeCase = buildInlineFragmentSpread( - from: inlineSelectionSet, - with: scope, - inParentTypePath: typeInfo - ) - target.mergeIn(irTypeCase) - } - - case let .fragmentSpread(fragmentSpread): - guard let scope = scopeCondition(for: fragmentSpread, in: typeInfo) else { - return - } - let selectionSetScope = typeInfo.scope - - var matchesType: Bool { - guard let typeCondition = scope.type else { return true } - return selectionSetScope.matches(typeCondition) - } - let matchesScope = selectionSetScope.matches(scope) - - if matchesScope { - let irFragmentSpread = buildNamedFragmentSpread( - fromFragment: fragmentSpread, - with: scope, - spreadIntoParentWithTypePath: typeInfo - ) - target.mergeIn(irFragmentSpread) - - } else { - let irTypeCaseEnclosingFragment = buildInlineFragmentSpread( - from: CompilationResult.SelectionSet( - parentType: fragmentSpread.parentType, - selections: [selection] - ), - with: scope, - inParentTypePath: typeInfo - ) - - target.mergeIn(irTypeCaseEnclosingFragment) - - if matchesType { - typeInfo.entity.selectionTree.mergeIn( - selections: irTypeCaseEnclosingFragment.selectionSet.selections.direct.unsafelyUnwrapped.readOnlyView, - with: typeInfo - ) - } - } - } - } - - private func scopeCondition( - for conditionalSelectionSet: ConditionallyIncludable, - in parentTypePath: SelectionSet.TypeInfo - ) -> ScopeCondition? { - let inclusionResult = inclusionResult(for: conditionalSelectionSet.inclusionConditions) - guard inclusionResult != .skipped else { - return nil - } - - let type = parentTypePath.parentType == conditionalSelectionSet.parentType ? - nil : conditionalSelectionSet.parentType - - return ScopeCondition(type: type, conditions: inclusionResult.conditions) - } - - private func inclusionResult( - for conditions: [CompilationResult.InclusionCondition]? - ) -> InclusionConditions.Result { - guard let conditions = conditions else { - return .included - } - - return InclusionConditions.allOf(conditions) - } - - private func buildField( - from field: CompilationResult.Field, - atTypePath enclosingTypeInfo: SelectionSet.TypeInfo - ) -> Field? { - let inclusionResult = inclusionResult(for: field.inclusionConditions) - guard inclusionResult != .skipped else { - return nil - } - - let inclusionConditions = inclusionResult.conditions - - if field.type.namedType is GraphQLCompositeType { - let irSelectionSet = buildSelectionSet( - forField: field, - with: inclusionConditions, - atTypePath: enclosingTypeInfo - ) - - return EntityField( - field, - inclusionConditions: AnyOf(inclusionConditions), - selectionSet: irSelectionSet - ) - - } else { - return ScalarField(field, inclusionConditions: AnyOf(inclusionConditions)) - } - } - - private func buildSelectionSet( - forField field: CompilationResult.Field, - with inclusionConditions: InclusionConditions?, - atTypePath enclosingTypeInfo: SelectionSet.TypeInfo - ) -> SelectionSet { - guard let fieldSelectionSet = field.selectionSet else { - preconditionFailure("SelectionSet cannot be created for non-entity type field \(field).") - } - - let entity = entityStorage.entity(for: field, on: enclosingTypeInfo.entity) - - let typeScope = ScopeDescriptor.descriptor( - forType: fieldSelectionSet.parentType, - inclusionConditions: inclusionConditions, - givenAllTypesInSchema: schema.referencedTypes - ) - let typePath = enclosingTypeInfo.scopePath.appending(typeScope) - - let irSelectionSet = SelectionSet( - entity: entity, - scopePath: typePath - ) - buildDirectSelections( - into: irSelectionSet.selections.direct.unsafelyUnwrapped, - atTypePath: irSelectionSet.typeInfo, - from: fieldSelectionSet - ) - return irSelectionSet - } - - private func buildInlineFragmentSpread( - from selectionSet: CompilationResult.SelectionSet?, - with scopeCondition: ScopeCondition, - inParentTypePath enclosingTypeInfo: SelectionSet.TypeInfo - ) -> InlineFragmentSpread { - let typePath = enclosingTypeInfo.scopePath.mutatingLast { - $0.appending(scopeCondition) - } - - let irSelectionSet = SelectionSet( - entity: enclosingTypeInfo.entity, - scopePath: typePath - ) - - if let selectionSet = selectionSet { - buildDirectSelections( - into: irSelectionSet.selections.direct.unsafelyUnwrapped, - atTypePath: irSelectionSet.typeInfo, - from: selectionSet - ) - } - - return InlineFragmentSpread( - selectionSet: irSelectionSet, - isDeferred: scopeCondition.isDeferred - ) - } - - private func buildNamedFragmentSpread( - fromFragment fragmentSpread: CompilationResult.FragmentSpread, - with scopeCondition: ScopeCondition, - spreadIntoParentWithTypePath parentTypeInfo: SelectionSet.TypeInfo - ) -> NamedFragmentSpread { - let fragment = ir.build(fragment: fragmentSpread.fragment) - referencedFragments.append(fragment) - referencedFragments.append(contentsOf: fragment.referencedFragments) - - let scopePath = scopeCondition.isEmpty ? - parentTypeInfo.scopePath : - parentTypeInfo.scopePath.mutatingLast { - $0.appending(scopeCondition) - } - - let typeInfo = SelectionSet.TypeInfo( - entity: parentTypeInfo.entity, - scopePath: scopePath - ) - - let fragmentSpread = NamedFragmentSpread( - fragment: fragment, - typeInfo: typeInfo, - inclusionConditions: AnyOf(scopeCondition.conditions), - isDeferred: scopeCondition.isDeferred - ) - - entityStorage.mergeAllSelectionsIntoEntitySelectionTrees(from: fragmentSpread) - - return fragmentSpread - } - - } -} - -// MARK: - Helpers - -fileprivate protocol ConditionallyIncludable { - var parentType: GraphQLCompositeType { get } - var inclusionConditions: [CompilationResult.InclusionCondition]? { get } -} - -extension CompilationResult.InlineFragment: ConditionallyIncludable { - var parentType: GraphQLCompositeType { selectionSet.parentType } -} -extension CompilationResult.FragmentSpread: ConditionallyIncludable {} diff --git a/Sources/ApolloCodegenLib/IR/IR+Schema.swift b/Sources/ApolloCodegenLib/IR/IR+Schema.swift deleted file mode 100644 index b0541d8cdb..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+Schema.swift +++ /dev/null @@ -1,90 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - final class Schema { - let referencedTypes: ReferencedTypes - let documentation: String? - - init( - referencedTypes: IR.Schema.ReferencedTypes, - documentation: String? = nil - ) { - self.referencedTypes = referencedTypes - self.documentation = documentation - } - - public final class ReferencedTypes: CustomDebugStringConvertible { - let allTypes: OrderedSet - - let objects: OrderedSet - let interfaces: OrderedSet - let unions: OrderedSet - let scalars: OrderedSet - let customScalars: OrderedSet - let enums: OrderedSet - let inputObjects: OrderedSet - - init(_ types: [GraphQLNamedType]) { - self.allTypes = OrderedSet(types) - - var objects = OrderedSet() - var interfaces = OrderedSet() - var unions = OrderedSet() - var scalars = OrderedSet() - var customScalars = OrderedSet() - var enums = OrderedSet() - var inputObjects = OrderedSet() - - for type in allTypes { - switch type { - case let type as GraphQLObjectType: objects.append(type) - case let type as GraphQLInterfaceType: interfaces.append(type) - case let type as GraphQLUnionType: unions.append(type) - case let type as GraphQLScalarType: - if type.isCustomScalar { - customScalars.append(type) - } else { - scalars.append(type) - } - case let type as GraphQLEnumType: enums.append(type) - case let type as GraphQLInputObjectType: inputObjects.append(type) - default: continue - } - } - - self.objects = objects - self.interfaces = interfaces - self.unions = unions - self.scalars = scalars - self.customScalars = customScalars - self.enums = enums - self.inputObjects = inputObjects - } - - private var typeToUnionMap: [GraphQLObjectType: Set] = [:] - - public func unions(including type: GraphQLObjectType) -> Set { - if let unions = typeToUnionMap[type] { - return unions - } - - let matchingUnions = Set(unions.filter { $0.types.contains(type) }) - typeToUnionMap[type] = matchingUnions - return matchingUnions - } - - public var debugDescription: String { - TemplateString(""" - objects: [\(list: objects)] - interfaces: [\(list: interfaces)] - unions: [\(list: unions)] - scalars: [\(list: scalars)] - customScalars: [\(list: customScalars)] - enums: [\(list: enums)] - inputObjects: [\(list: inputObjects)] - """).description - } - } - } -} diff --git a/Sources/ApolloCodegenLib/IR/IR+SelectionSet.swift b/Sources/ApolloCodegenLib/IR/IR+SelectionSet.swift deleted file mode 100644 index 633712db8e..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR+SelectionSet.swift +++ /dev/null @@ -1,160 +0,0 @@ -extension IR { - @dynamicMemberLookup - class SelectionSet: Hashable, CustomDebugStringConvertible { - class TypeInfo: Hashable, CustomDebugStringConvertible { - /// The entity that the `selections` are being selected on. - /// - /// Multiple `SelectionSet`s may reference the same `Entity` - let entity: Entity - - /// A list of the scopes for the `SelectionSet` and its enclosing entities. - /// - /// The selection set's `scope` is the last element in the list. - let scopePath: LinkedList - - /// Describes all of the types and inclusion conditions the selection set matches. - /// Derived from all the selection set's parents. - var scope: ScopeDescriptor { scopePath.last.value } - - var parentType: GraphQLCompositeType { scope.type } - - var inclusionConditions: InclusionConditions? { scope.scopePath.last.value.conditions } - - /// Indicates if the `SelectionSet` represents a root selection set. - /// If `true`, the `SelectionSet` belongs to a field directly. - /// If `false`, the `SelectionSet` belongs to a conditional selection set enclosed - /// in a field's `SelectionSet`. - var isEntityRoot: Bool { scope.scopePath.head.next == nil } - - init( - entity: Entity, - scopePath: LinkedList - ) { - self.entity = entity - self.scopePath = scopePath - } - - static func == (lhs: TypeInfo, rhs: TypeInfo) -> Bool { - lhs.entity === rhs.entity && - lhs.scopePath == rhs.scopePath - } - - func hash(into hasher: inout Hasher) { - hasher.combine(ObjectIdentifier(entity)) - hasher.combine(scopePath) - } - - var debugDescription: String { - scopePath.debugDescription - } - } - - class Selections: CustomDebugStringConvertible { - /// The selections that are directly selected by this selection set. - let direct: DirectSelections? - - /// The selections that are available to be accessed by this selection set. - /// - /// Includes the direct `selections`, along with all selections from other related - /// `SelectionSet`s on the same entity that match the selection set's type scope. - /// - /// Selections in the `mergedSelections` are guaranteed to be selected if this `SelectionSet`'s - /// `selections` are selected. This means they can be merged into the generated object - /// representing this `SelectionSet` as field accessors. - /// - /// - Precondition: The `directSelections` for all `SelectionSet`s in the operation must be - /// completed prior to first access of `mergedSelections`. Otherwise, the merged selections - /// will be incomplete. - private(set) lazy var merged: MergedSelections = { - let mergedSelections = MergedSelections( - directSelections: self.direct?.readOnlyView, - typeInfo: self.typeInfo - ) - typeInfo.entity.selectionTree.addMergedSelections(into: mergedSelections) - - return mergedSelections - }() - - private let typeInfo: TypeInfo - - fileprivate init( - typeInfo: TypeInfo, - directSelections: DirectSelections? - ) { - self.typeInfo = typeInfo - self.direct = directSelections - } - - var debugDescription: String { - TemplateString(""" - direct: { - \(direct?.debugDescription ?? "nil") - } - merged: { - \(merged.debugDescription) - } - """).description - } - } - - // MARK: - SelectionSet - - let typeInfo: TypeInfo - let selections: Selections - - init( - entity: Entity, - scopePath: LinkedList, - mergedSelectionsOnly: Bool = false - ) { - self.typeInfo = TypeInfo( - entity: entity, - scopePath: scopePath - ) - self.selections = Selections( - typeInfo: self.typeInfo, - directSelections: mergedSelectionsOnly ? nil : DirectSelections() - ) - } - - init( - entity: Entity, - scopePath: LinkedList, - selections: DirectSelections - ) { - self.typeInfo = TypeInfo( - entity: entity, - scopePath: scopePath - ) - self.selections = Selections( - typeInfo: self.typeInfo, - directSelections: selections - ) - } - - var debugDescription: String { - TemplateString(""" - SelectionSet on \(typeInfo.parentType.debugDescription)\(ifLet: typeInfo.inclusionConditions, { " \($0.debugDescription)"}) { - \(self.selections.debugDescription) - } - """).description - } - - static func ==(lhs: IR.SelectionSet, rhs: IR.SelectionSet) -> Bool { - lhs.typeInfo === rhs.typeInfo && - lhs.selections.direct === rhs.selections.direct - } - - func hash(into hasher: inout Hasher) { - hasher.combine(typeInfo) - if let directSelections = selections.direct { - hasher.combine(ObjectIdentifier(directSelections)) - } - } - - subscript(dynamicMember keyPath: KeyPath) -> T { - typeInfo[keyPath: keyPath] - } - - } -} diff --git a/Sources/ApolloCodegenLib/IR/IR.swift b/Sources/ApolloCodegenLib/IR/IR.swift deleted file mode 100644 index b19724aae3..0000000000 --- a/Sources/ApolloCodegenLib/IR/IR.swift +++ /dev/null @@ -1,370 +0,0 @@ -import OrderedCollections -import CryptoKit - -class IR { - - let compilationResult: CompilationResult - - let schema: Schema - - let fieldCollector = FieldCollector() - - var builtFragments: [String: NamedFragment] = [:] - - init(compilationResult: CompilationResult) { - self.compilationResult = compilationResult - self.schema = Schema( - referencedTypes: .init(compilationResult.referencedTypes), - documentation: compilationResult.schemaDocumentation - ) - self.processRootTypes() - } - - private func processRootTypes() { - let rootTypes = compilationResult.rootTypes - let typeList = [rootTypes.queryType.name, rootTypes.mutationType?.name, rootTypes.subscriptionType?.name].compactMap { $0 } - - compilationResult.operations.forEach { op in - op.rootType.isRootFieldType = typeList.contains(op.rootType.name) - } - - compilationResult.fragments.forEach { fragment in - fragment.type.isRootFieldType = typeList.contains(fragment.type.name) - } - } - - /// A top level GraphQL definition, which can be an operation or a named fragment. - enum Definition { - case operation(IR.Operation) - case namedFragment(IR.NamedFragment) - - var name: String { - switch self { - case let .operation(operation): - return operation.definition.name - case let .namedFragment(fragment): - return fragment.definition.name - } - } - - var rootField: IR.EntityField { - switch self { - case let .operation(operation): - return operation.rootField - case let .namedFragment(fragment): - return fragment.rootField - } - } - } - - // TODO: Documentation for this to be completed in issue #3141 - enum IsDeferred: Hashable, ExpressibleByBooleanLiteral { - case value(Bool) - case `if`(_ variable: String) - - init(booleanLiteral value: BooleanLiteralType) { - switch value { - case true: - self = .value(true) - case false: - self = .value(false) - } - } - - var definitionDirectiveDescription: String { - switch self { - case .value(false): return "" - case .value(true): return " @defer" - case let .if(variable): - return " @defer(if: \(variable))" - } - } - } - - /// Represents a concrete entity in an operation or fragment that fields are selected upon. - /// - /// Multiple `SelectionSet`s may select fields on the same `Entity`. All `SelectionSet`s that will - /// be selected on the same object share the same `Entity`. - class Entity { - - /// Represents the location within a GraphQL definition (operation or fragment) of an `Entity`. - struct Location: Hashable { - enum SourceDefinition: Hashable { - case operation(CompilationResult.OperationDefinition) - case namedFragment(CompilationResult.FragmentDefinition) - - var rootType: GraphQLCompositeType { - switch self { - case let .operation(definition): return definition.rootType - case let .namedFragment(definition): return definition.type - } - } - } - - struct FieldComponent: Hashable { - let name: String - let type: GraphQLType - } - - typealias FieldPath = LinkedList - - /// The operation or fragment definition that the entity belongs to. - let source: SourceDefinition - - /// The path of fields from the root of the ``source`` definition to the entity. - /// - /// Example: - /// For an operation: - /// ```graphql - /// query MyQuery { - /// allAnimals { - /// predators { - /// height { - /// ... - /// } - /// } - /// } - /// } - /// ``` - /// The `Height` entity would have a field path of [allAnimals, predators, height]. - let fieldPath: FieldPath? - - func appending(_ fieldComponent: FieldComponent) -> Location { - let fieldPath = self.fieldPath?.appending(fieldComponent) ?? LinkedList(fieldComponent) - return Location(source: self.source, fieldPath: fieldPath) - } - - func appending>(_ fieldComponents: C) -> Location { - let fieldPath = self.fieldPath?.appending(fieldComponents) ?? LinkedList(fieldComponents) - return Location(source: self.source, fieldPath: fieldPath) - } - - static func +(lhs: IR.Entity.Location, rhs: FieldComponent) -> Location { - lhs.appending(rhs) - } - } - - /// The selections that are selected for the entity across all type scopes in the operation. - /// Represented as a tree. - let selectionTree: EntitySelectionTree - - /// The location within a GraphQL definition (operation or fragment) where the `Entity` is - /// located. - let location: Location - - var rootTypePath: LinkedList { selectionTree.rootTypePath } - - var rootType: GraphQLCompositeType { rootTypePath.last.value } - - init(source: Location.SourceDefinition) { - self.location = .init(source: source, fieldPath: nil) - self.selectionTree = EntitySelectionTree(rootTypePath: LinkedList(source.rootType)) - } - - init( - location: Location, - rootTypePath: LinkedList - ) { - self.location = location - self.selectionTree = EntitySelectionTree(rootTypePath: rootTypePath) - } - } - - class Operation { - let definition: CompilationResult.OperationDefinition - - /// The root field of the operation. This field must be the root query, mutation, or - /// subscription field of the schema. - let rootField: EntityField - - /// All of the fragments that are referenced by this operation's selection set. - let referencedFragments: OrderedSet - - lazy var operationIdentifier: String = { - if #available(macOS 10.15, *) { - var hasher = SHA256() - func updateHash(with source: inout String) { - source.withUTF8({ buffer in - hasher.update(bufferPointer: UnsafeRawBufferPointer(buffer)) - }) - } - var definitionSource = definition.source.convertedToSingleLine() - updateHash(with: &definitionSource) - - var newline: String - for fragment in referencedFragments { - newline = "\n" - updateHash(with: &newline) - var fragmentSource = fragment.definition.source.convertedToSingleLine() - updateHash(with: &fragmentSource) - } - - let digest = hasher.finalize() - return digest.compactMap { String(format: "%02x", $0) }.joined() - - } else { - fatalError("Code Generation must be run on macOS 10.15+.") - } - }() - - init( - definition: CompilationResult.OperationDefinition, - rootField: EntityField, - referencedFragments: OrderedSet - ) { - self.definition = definition - self.rootField = rootField - self.referencedFragments = referencedFragments - } - } - - class NamedFragment: Hashable, CustomDebugStringConvertible { - let definition: CompilationResult.FragmentDefinition - let rootField: EntityField - - /// All of the fragments that are referenced by this fragment's selection set. - let referencedFragments: OrderedSet - - /// All of the Entities that exist in the fragment's selection set, - /// keyed by their relative location (ie. path) within the fragment. - /// - /// - Note: The FieldPath for an entity within a fragment will begin with a path component - /// with the fragment's name and type. - let entities: [IR.Entity.Location: IR.Entity] - - var name: String { definition.name } - var type: GraphQLCompositeType { definition.type } - - init( - definition: CompilationResult.FragmentDefinition, - rootField: EntityField, - referencedFragments: OrderedSet, - entities: [IR.Entity.Location: IR.Entity] - ) { - self.definition = definition - self.rootField = rootField - self.referencedFragments = referencedFragments - self.entities = entities - } - - static func == (lhs: IR.NamedFragment, rhs: IR.NamedFragment) -> Bool { - lhs.definition == rhs.definition && - lhs.rootField === rhs.rootField - } - - func hash(into hasher: inout Hasher) { - hasher.combine(definition) - hasher.combine(ObjectIdentifier(rootField)) - } - - var debugDescription: String { - definition.debugDescription - } - } - - /// Represents an Inline Fragment that has been "spread into" another SelectionSet using the - /// spread operator (`...`). - class InlineFragmentSpread: Hashable, CustomDebugStringConvertible { - /// The `SelectionSet` representing the inline fragment that has been "spread into" its - /// enclosing operation/fragment. - let selectionSet: SelectionSet - - let isDeferred: IsDeferred - - /// Indicates the location where the inline fragment has been "spread into" its enclosing - /// operation/fragment. - var typeInfo: SelectionSet.TypeInfo { selectionSet.typeInfo } - - var inclusionConditions: InclusionConditions? { selectionSet.inclusionConditions } - - init( - selectionSet: SelectionSet, - isDeferred: IsDeferred - ) { - self.selectionSet = selectionSet - self.isDeferred = isDeferred - } - - static func == (lhs: IR.InlineFragmentSpread, rhs: IR.InlineFragmentSpread) -> Bool { - lhs.selectionSet == rhs.selectionSet && - lhs.isDeferred == rhs.isDeferred - } - - func hash(into hasher: inout Hasher) { - hasher.combine(selectionSet) - hasher.combine(isDeferred) - } - - var debugDescription: String { - var string = typeInfo.parentType.debugDescription - if let conditions = typeInfo.inclusionConditions { - string += " \(conditions.debugDescription)" - } - string += isDeferred.definitionDirectiveDescription - return string - } - } - - /// Represents a Named Fragment that has been "spread into" another SelectionSet using the - /// spread operator (`...`). - /// - /// While a `NamedFragment` can be shared between operations, a `NamedFragmentSpread` represents a - /// `NamedFragment` included in a specific operation. - class NamedFragmentSpread: Hashable, CustomDebugStringConvertible { - - /// The `NamedFragment` that this fragment refers to. - /// - /// This is a fragment that has already been built. To "spread" the fragment in, it's entity - /// selection trees are merged into the entity selection trees of the operation/fragment it is - /// being spread into. This allows merged field calculations to include the fields merged in - /// from the fragment. - let fragment: NamedFragment - - /// Indicates the location where the fragment has been "spread into" its enclosing - /// operation/fragment. It's `scopePath` and `entity` reference are scoped to the operation it - /// belongs to. - let typeInfo: SelectionSet.TypeInfo - - var inclusionConditions: AnyOf? - - let isDeferred: IsDeferred - - var definition: CompilationResult.FragmentDefinition { fragment.definition } - - init( - fragment: NamedFragment, - typeInfo: SelectionSet.TypeInfo, - inclusionConditions: AnyOf?, - isDeferred: IsDeferred - ) { - self.fragment = fragment - self.typeInfo = typeInfo - self.inclusionConditions = inclusionConditions - self.isDeferred = isDeferred - } - - static func == (lhs: IR.NamedFragmentSpread, rhs: IR.NamedFragmentSpread) -> Bool { - lhs.fragment === rhs.fragment && - lhs.typeInfo == rhs.typeInfo && - lhs.inclusionConditions == rhs.inclusionConditions && - lhs.isDeferred == rhs.isDeferred - } - - func hash(into hasher: inout Hasher) { - hasher.combine(ObjectIdentifier(fragment)) - hasher.combine(typeInfo) - hasher.combine(inclusionConditions) - hasher.combine(isDeferred) - } - - var debugDescription: String { - var description = fragment.debugDescription - if let inclusionConditions = inclusionConditions { - description += " \(inclusionConditions.debugDescription)" - } - description += isDeferred.definitionDirectiveDescription - return description - } - } - -} diff --git a/Sources/ApolloCodegenLib/IR/ScopeDescriptor.swift b/Sources/ApolloCodegenLib/IR/ScopeDescriptor.swift deleted file mode 100644 index 5ded5d89a3..0000000000 --- a/Sources/ApolloCodegenLib/IR/ScopeDescriptor.swift +++ /dev/null @@ -1,245 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - - // TODO: Write tests that two inline fragments with same type and inclusion conditions, - // but different defer conditions don't merge together. - // To be done in issue #3141 - struct ScopeCondition: Hashable, CustomDebugStringConvertible { - let type: GraphQLCompositeType? - let conditions: InclusionConditions? - let isDeferred: IsDeferred - - init( - type: GraphQLCompositeType? = nil, - conditions: InclusionConditions? = nil, - isDeferred: IsDeferred = false - ) { - self.type = type - self.conditions = conditions - self.isDeferred = isDeferred - } - - var debugDescription: String { - [type?.debugDescription, conditions?.debugDescription] - .compactMap { $0 } - .joined(separator: " ") - } - - var isEmpty: Bool { - type == nil && (conditions?.isEmpty ?? true) - } - } - - typealias TypeScope = OrderedSet - - /// Defines the scope for an `IR.SelectionSet`. The "scope" indicates where in the entity the - /// selection set is located, what types the `SelectionSet` implements, and what inclusion - /// conditions it requires. - struct ScopeDescriptor: Hashable { - - /// The parentType of the `SelectionSet`. - /// - /// Should always be equivalent to the last "type" value of the `scopePath`. - let type: GraphQLCompositeType - - /// A list of the parent types/conditions for the selection set and it's parents - /// on the same entity. - /// - /// For example, given the set of nested selections sets: - /// ``` - /// object { // object field is of type "Object" - /// ... on A { - /// ... on B { - /// ... on C { - /// fieldOnABC - /// } - /// } - /// } - /// ``` - /// The scopePath for the `SelectionSet` that includes field `fieldOnABC` would be: - /// `[Object, A, B, C]`. - let scopePath: LinkedList - - /// All of the types that the `SelectionSet` implements. That is, all of the types in the - /// `typePath`, all of those types implemented interfaces, and all unions that include - /// those types. - let matchingTypes: TypeScope - - /// All of the inclusion conditions on the entity that must be included for the `SelectionSet` - /// to be included. - let matchingConditions: InclusionConditions? - - let allTypesInSchema: IR.Schema.ReferencedTypes - - private init( - typePath: LinkedList, - type: GraphQLCompositeType, - matchingTypes: TypeScope, - matchingConditions: InclusionConditions?, - allTypesInSchema: IR.Schema.ReferencedTypes - ) { - self.scopePath = typePath - self.type = type - self.matchingTypes = matchingTypes - self.matchingConditions = matchingConditions - self.allTypesInSchema = allTypesInSchema - } - - /// Creates a `ScopeDescriptor` for a root `SelectionSet`. - /// - /// This should only be used to create a `ScopeDescriptor` for a root `SelectionSet`. - /// Nested type cases should be created by calling `appending(_:)` on the - /// parent `SelectionSet`'s `typeScope`. - /// - /// - Parameters: - /// - forType: The parentType for the entity. - /// - inclusionConditions: The `InclusionConditions` for the `SelectionSet` to be included. - /// - givenAllTypesInSchema: The `ReferencedTypes` object that provides information on all of - /// the types in the schema. - static func descriptor( - forType type: GraphQLCompositeType, - inclusionConditions: InclusionConditions?, - givenAllTypesInSchema allTypes: IR.Schema.ReferencedTypes - ) -> ScopeDescriptor { - let scope = Self.typeScope(addingType: type, to: nil, givenAllTypes: allTypes) - return ScopeDescriptor( - typePath: LinkedList(.init( - type: type, - conditions: inclusionConditions - )), - type: type, - matchingTypes: scope, - matchingConditions: inclusionConditions, - allTypesInSchema: allTypes - ) - } - - private static func typeScope( - addingType newType: GraphQLCompositeType, - to scope: TypeScope?, - givenAllTypes allTypes: IR.Schema.ReferencedTypes - ) -> TypeScope { - if let scope = scope, scope.contains(newType) { return scope } - - var newScope = scope ?? [] - newScope.append(newType) - - if let newType = newType as? GraphQLInterfaceImplementingType { - newScope.formUnion(newType.interfaces) - } - - if let newType = newType as? GraphQLObjectType { - newScope.formUnion(allTypes.unions(including: newType)) - } - - return newScope - } - - /// Returns a new `ScopeDescriptor` appending the new `ScopeCondition` to the `scopePath`. - /// Any new types are added to the `matchingTypes`, and any new conditions are added to the - /// `matchingConditions`. - /// - /// This should be used to create a `ScopeDescriptor` for a conditional `SelectionSet` inside - /// of an entity, by appending the conditions to the parent `SelectionSet`'s `ScopeDescriptor`. - func appending(_ scopeCondition: ScopeCondition) -> ScopeDescriptor { - let matchingTypes: TypeScope - if let newType = scopeCondition.type { - matchingTypes = Self.typeScope( - addingType: newType, - to: self.matchingTypes, - givenAllTypes: self.allTypesInSchema - ) - } else { - matchingTypes = self.matchingTypes - } - - var matchingConditions = self.matchingConditions - if let newConditions = scopeCondition.conditions { - matchingConditions = matchingConditions?.appending(newConditions) ?? newConditions - } - - return ScopeDescriptor( - typePath: scopePath.appending(scopeCondition), - type: scopeCondition.type ?? self.type, - matchingTypes: matchingTypes, - matchingConditions: matchingConditions, - allTypesInSchema: self.allTypesInSchema - ) - } - - /// Returns a new `ScopeDescriptor` appending the new type to the `scopePath` and - /// `matchingConditions`. - /// - /// This should be used to create a `ScopeDescriptor` for a conditional `SelectionSet` inside - /// of an entity, by appending the conditions to the parent `SelectionSet`'s `ScopeDescriptor`. - func appending(_ newType: GraphQLCompositeType) -> ScopeDescriptor { - self.appending(.init(type: newType)) - } - - /// Returns a new `ScopeDescriptor` appending the new conditions to the `scopePath` and - /// `matchingTypes`. - /// - /// This should be used to create a `ScopeDescriptor` for a conditional `SelectionSet` inside - /// of an entity, by appending the conditions to the parent `SelectionSet`'s `ScopeDescriptor`. - func appending(_ conditions: InclusionConditions) -> ScopeDescriptor { - self.appending(.init(conditions: conditions)) - } - - /// Indicates if the receiver is all of the types in the given `TypeScope`. - /// If the receiver matches a `TypeScope`, then selections for a `SelectionSet` of that - /// type scope can be merged in to the receiver's `SelectionSet`. - func matches(_ otherScope: TypeScope) -> Bool { - otherScope.isSubset(of: self.matchingTypes) - } - - func matches(_ otherType: GraphQLCompositeType) -> Bool { - self.matchingTypes.contains(otherType) - } - - func matches(_ otherConditions: InclusionConditions) -> Bool { - otherConditions.isSubset(of: self.matchingConditions) - } - - func matches(_ otherConditions: AnyOf) -> Bool { - for conditionGroup in otherConditions.elements { - if conditionGroup.isSubset(of: self.matchingConditions) { return true } - } - return false - } - - /// Indicates if the receiver is of the given type. If the receiver matches a given type, - /// then selections for a `SelectionSet` of that type can be merged in to the receiver's - /// `SelectionSet`. - func matches(_ condition: ScopeCondition) -> Bool { - if let type = condition.type, !self.matches(type) { - return false - } - - if let inclusionConditions = condition.conditions, !self.matches(inclusionConditions) { - return false - } - - return true - } - - static func == (lhs: ScopeDescriptor, rhs: ScopeDescriptor) -> Bool { - lhs.scopePath == rhs.scopePath && - lhs.matchingTypes == rhs.matchingTypes - } - - func hash(into hasher: inout Hasher) { - hasher.combine(scopePath) - hasher.combine(matchingTypes) - } - - } -} - -extension IR.ScopeDescriptor: CustomDebugStringConvertible { - var debugDescription: String { - scopePath.debugDescription - } -} - diff --git a/Sources/ApolloCodegenLib/IR/ScopedSelectionSetHashable.swift b/Sources/ApolloCodegenLib/IR/ScopedSelectionSetHashable.swift deleted file mode 100644 index 791d45fdd5..0000000000 --- a/Sources/ApolloCodegenLib/IR/ScopedSelectionSetHashable.swift +++ /dev/null @@ -1,32 +0,0 @@ -import Foundation - -protocol ScopedSelectionSetHashable { - - /// A hash value that will be the same for any selections that should be merged in a given scope. - /// This is not the same as equivalence. Rather objects with an equal `hashForSelectionSetScope` - /// are considered to be equivalent only if they exist within the same "scope". - /// - /// A "scope" is a group of selection sets that all represent the same entity. - /// A scope can include selections from a selection set along with any selections from it's - /// parent, siblings, fragments spreads, or other selections sets on the same entity that match - /// the selection set's parent type. - var hashForSelectionSetScope: String { get } -} - -extension IR.Field: ScopedSelectionSetHashable { - var hashForSelectionSetScope: String { - underlyingField.responseKey - } -} - -extension CompilationResult.FragmentSpread: ScopedSelectionSetHashable { - var hashForSelectionSetScope: String { - fragment.name - } -} - -extension IR.NamedFragmentSpread: ScopedSelectionSetHashable { - var hashForSelectionSetScope: String { - fragment.definition.name - } -} diff --git a/Sources/ApolloCodegenLib/IR/SortedSelections.swift b/Sources/ApolloCodegenLib/IR/SortedSelections.swift deleted file mode 100644 index 60d9773fb3..0000000000 --- a/Sources/ApolloCodegenLib/IR/SortedSelections.swift +++ /dev/null @@ -1,391 +0,0 @@ -import Foundation -import OrderedCollections - -extension IR { - - class DirectSelections: Equatable, CustomDebugStringConvertible { - - fileprivate(set) var fields: OrderedDictionary = [:] - fileprivate(set) var inlineFragments: OrderedDictionary = [:] - fileprivate(set) var namedFragments: OrderedDictionary = [:] - - init() {} - - init( - fields: [Field] = [], - inlineFragments: [InlineFragmentSpread] = [], - namedFragments: [NamedFragmentSpread] = [] - ) { - mergeIn(fields) - mergeIn(inlineFragments) - mergeIn(namedFragments) - } - - init( - fields: OrderedDictionary = [:], - inlineFragments: OrderedDictionary = [:], - namedFragments: OrderedDictionary = [:] - ) { - mergeIn(fields.values) - mergeIn(inlineFragments.values) - mergeIn(namedFragments.values) - } - - func mergeIn(_ selections: DirectSelections) { - mergeIn(selections.fields.values) - mergeIn(selections.inlineFragments.values) - mergeIn(selections.namedFragments.values) - } - - func mergeIn(_ field: Field) { - let keyInScope = field.hashForSelectionSetScope - - if let existingField = fields[keyInScope] { - - if let existingField = existingField as? EntityField, let field = field as? EntityField { - fields[keyInScope] = merge(field, with: existingField) - - } else { - existingField.inclusionConditions = - (existingField.inclusionConditions || field.inclusionConditions) - - } - } else { - fields[keyInScope] = field - } - } - - private func merge(_ newField: EntityField, with existingField: EntityField) -> EntityField { - var mergedField = existingField - - if existingField.inclusionConditions == newField.inclusionConditions { - mergedField.selectionSet.selections.direct! - .mergeIn(newField.selectionSet.selections.direct!) - - } else if existingField.inclusionConditions != nil { - mergedField = createInclusionWrapperField(wrapping: existingField, mergingIn: newField) - - } else { - merge(field: newField, intoInclusionWrapperField: existingField) - } - - return mergedField - } - - private func createInclusionWrapperField( - wrapping existingField: EntityField, - mergingIn newField: EntityField - ) -> EntityField { - let wrapperScope = existingField.selectionSet.scopePath.mutatingLast { _ in - ScopeDescriptor.descriptor( - forType: existingField.selectionSet.parentType, - inclusionConditions: nil, - givenAllTypesInSchema: existingField.selectionSet.scope.allTypesInSchema - ) - } - - let wrapperField = EntityField( - existingField.underlyingField, - inclusionConditions: (existingField.inclusionConditions || newField.inclusionConditions), - selectionSet: SelectionSet( - entity: existingField.entity, - scopePath: wrapperScope - ) - ) - - merge(field: existingField, intoInclusionWrapperField: wrapperField) - merge(field: newField, intoInclusionWrapperField: wrapperField) - - return wrapperField - } - - private func merge(field newField: EntityField, intoInclusionWrapperField wrapperField: EntityField) { - if let newFieldConditions = newField.selectionSet.inclusionConditions { - let newFieldSelectionSet = SelectionSet( - entity: newField.entity, - scopePath: wrapperField.selectionSet.scopePath.mutatingLast { - $0.appending(newFieldConditions) - }, - selections: newField.selectionSet.selections.direct.unsafelyUnwrapped - ) - let newFieldInlineFragment = InlineFragmentSpread( - selectionSet: newFieldSelectionSet, - isDeferred: false - ) - wrapperField.selectionSet.selections.direct?.mergeIn(newFieldInlineFragment) - - } else { - wrapperField.selectionSet.selections.direct?.mergeIn(newField.selectionSet.selections.direct.unsafelyUnwrapped) - } - } - - func mergeIn(_ fragment: InlineFragmentSpread) { - let scopeCondition = fragment.selectionSet.scope.scopePath.last.value - - if let existingTypeCase = inlineFragments[scopeCondition]?.selectionSet { - existingTypeCase.selections.direct! - .mergeIn(fragment.selectionSet.selections.direct!) - - } else { - inlineFragments[scopeCondition] = fragment - } - } - - func mergeIn(_ fragment: NamedFragmentSpread) { - if let existingFragment = namedFragments[fragment.hashForSelectionSetScope] { - existingFragment.inclusionConditions = - (existingFragment.inclusionConditions || fragment.inclusionConditions) - return - } - - namedFragments[fragment.hashForSelectionSetScope] = fragment - } - - func mergeIn(_ fields: T) where T.Element == Field { - fields.forEach { mergeIn($0) } - } - - func mergeIn(_ inlineFragments: T) where T.Element == InlineFragmentSpread { - inlineFragments.forEach { mergeIn($0) } - } - - func mergeIn(_ fragments: T) where T.Element == NamedFragmentSpread { - fragments.forEach { mergeIn($0) } - } - - var isEmpty: Bool { - fields.isEmpty && inlineFragments.isEmpty && namedFragments.isEmpty - } - - static func == (lhs: DirectSelections, rhs: DirectSelections) -> Bool { - lhs.fields == rhs.fields && - lhs.inlineFragments == rhs.inlineFragments && - lhs.namedFragments == rhs.namedFragments - } - - var debugDescription: String { - """ - Fields: \(fields.values.elements) - InlineFragments: \(inlineFragments.values.elements.map(\.debugDescription)) - Fragments: \(namedFragments.values.elements.map(\.debugDescription)) - """ - } - - var readOnlyView: ReadOnly { - ReadOnly(value: self) - } - - struct ReadOnly: Equatable { - fileprivate let value: DirectSelections - - var fields: OrderedDictionary { value.fields } - var inlineFragments: OrderedDictionary { value.inlineFragments } - var namedFragments: OrderedDictionary { value.namedFragments } - var isEmpty: Bool { value.isEmpty } - } - - var groupedByInclusionCondition: GroupedByInclusionCondition { - GroupedByInclusionCondition(self) - } - - class GroupedByInclusionCondition: Equatable { - - private(set) var unconditionalSelections: - DirectSelections.ReadOnly = .init(value: DirectSelections()) - - private(set) var inclusionConditionGroups: - OrderedDictionary, DirectSelections.ReadOnly> = [:] - - init(_ directSelections: DirectSelections) { - for selection in directSelections.fields { - if let condition = selection.value.inclusionConditions { - inclusionConditionGroups.updateValue( - forKey: condition, - default: .init(value: DirectSelections())) { selections in - selections.value.fields[selection.key] = selection.value - } - - } else { - unconditionalSelections.value.fields[selection.key] = selection.value - } - } - - for selection in directSelections.inlineFragments { - if let condition = selection.value.inclusionConditions { - inclusionConditionGroups.updateValue( - forKey: AnyOf(condition), - default: .init(value: DirectSelections())) { selections in - selections.value.inlineFragments[selection.key] = selection.value - } - - } else { - unconditionalSelections.value.inlineFragments[selection.key] = selection.value - } - } - - for selection in directSelections.namedFragments { - if let condition = selection.value.inclusionConditions { - inclusionConditionGroups.updateValue( - forKey: condition, - default: .init(value: DirectSelections())) { selections in - selections.value.namedFragments[selection.key] = selection.value - } - - } else { - unconditionalSelections.value.namedFragments[selection.key] = selection.value - } - } - } - - static func == ( - lhs: IR.DirectSelections.GroupedByInclusionCondition, - rhs: IR.DirectSelections.GroupedByInclusionCondition - ) -> Bool { - lhs.unconditionalSelections == rhs.unconditionalSelections && - lhs.inclusionConditionGroups == rhs.inclusionConditionGroups - } - } - - } - - class MergedSelections: Equatable, CustomDebugStringConvertible { - - struct MergedSource: Hashable { - let typeInfo: SelectionSet.TypeInfo - - /// The `NamedFragment` that the merged selections were contained in. - /// - /// - Note: If `fragment` is present, the `typeInfo` is relative to the fragment, - /// instead of the operation directly. - unowned let fragment: NamedFragment? - } - - typealias MergedSources = OrderedSet - - private let directSelections: DirectSelections.ReadOnly? - let typeInfo: SelectionSet.TypeInfo - - fileprivate(set) var mergedSources: MergedSources = [] - fileprivate(set) var fields: OrderedDictionary = [:] - fileprivate(set) var inlineFragments: OrderedDictionary = [:] - fileprivate(set) var namedFragments: OrderedDictionary = [:] - - init( - directSelections: DirectSelections.ReadOnly?, - typeInfo: SelectionSet.TypeInfo - ) { - self.directSelections = directSelections - self.typeInfo = typeInfo - } - - func mergeIn(_ selections: EntityTreeScopeSelections, from source: MergedSource) { - @IsEverTrue var didMergeAnySelections: Bool - - selections.fields.values.forEach { didMergeAnySelections = self.mergeIn($0) } - selections.namedFragments.values.forEach { didMergeAnySelections = self.mergeIn($0) } - - if didMergeAnySelections { - mergedSources.append(source) - } - } - - private func mergeIn(_ field: IR.Field) -> Bool { - let keyInScope = field.hashForSelectionSetScope - if let directSelections = directSelections, - directSelections.fields.keys.contains(keyInScope) { - return false - } - - let fieldToMerge: IR.Field - if let entityField = field as? IR.EntityField { - fieldToMerge = createShallowlyMergedNestedEntityField(from: entityField) - - } else { - fieldToMerge = field - } - - fields[keyInScope] = fieldToMerge - return true - } - - private func createShallowlyMergedNestedEntityField(from field: IR.EntityField) -> IR.EntityField { - let newSelectionSet = IR.SelectionSet( - entity: field.entity, - scopePath: self.typeInfo.scopePath.appending(field.selectionSet.typeInfo.scope), - mergedSelectionsOnly: true - ) - return IR.EntityField( - field.underlyingField, - inclusionConditions: field.inclusionConditions, - selectionSet: newSelectionSet - ) - } - - private func mergeIn(_ fragment: IR.NamedFragmentSpread) -> Bool { - let keyInScope = fragment.hashForSelectionSetScope - if let directSelections = directSelections, - directSelections.namedFragments.keys.contains(keyInScope) { - return false - } - - namedFragments[keyInScope] = fragment - - return true - } - - func addMergedInlineFragment(with condition: ScopeCondition) { - guard typeInfo.isEntityRoot else { return } - - createShallowlyMergedInlineFragmentIfNeeded(with: condition) - } - - private func createShallowlyMergedInlineFragmentIfNeeded( - with condition: ScopeCondition - ) { - if let directSelections = directSelections, - directSelections.inlineFragments.keys.contains(condition) { - return - } - - guard !inlineFragments.keys.contains(condition) else { return } - - let inlineFragment = IR.InlineFragmentSpread( - selectionSet: .init( - entity: self.typeInfo.entity, - scopePath: self.typeInfo.scopePath.mutatingLast { $0.appending(condition) }, - mergedSelectionsOnly: true - ), - isDeferred: condition.isDeferred - ) - inlineFragments[condition] = inlineFragment - } - - var isEmpty: Bool { - fields.isEmpty && inlineFragments.isEmpty && namedFragments.isEmpty - } - - static func == (lhs: MergedSelections, rhs: MergedSelections) -> Bool { - lhs.mergedSources == rhs.mergedSources && - lhs.fields == rhs.fields && - lhs.inlineFragments == rhs.inlineFragments && - lhs.namedFragments == rhs.namedFragments - } - - var debugDescription: String { - """ - Merged Sources: \(mergedSources) - Fields: \(fields.values.elements) - InlineFragments: \(inlineFragments.values.elements.map(\.debugDescription)) - NamedFragments: \(namedFragments.values.elements.map(\.debugDescription)) - """ - } - - } - -} - -extension IR.MergedSelections.MergedSource: CustomDebugStringConvertible { - var debugDescription: String { - typeInfo.debugDescription + ", fragment: \(fragment?.debugDescription ?? "nil")" - } -} diff --git a/Sources/ApolloCodegenLib/Info.plist b/Sources/ApolloCodegenLib/Info.plist deleted file mode 100644 index 4f79224132..0000000000 --- a/Sources/ApolloCodegenLib/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2019 Apollo GraphQL. All rights reserved. - - diff --git a/Sources/ApolloCodegenLib/IsEverTrue.swift b/Sources/ApolloCodegenLib/IsEverTrue.swift deleted file mode 100644 index 968cdb2490..0000000000 --- a/Sources/ApolloCodegenLib/IsEverTrue.swift +++ /dev/null @@ -1,13 +0,0 @@ -/// A property wrapper that indicates if a `Bool` value was ever set to `true`. -/// Defaults to `false`, if ever set to `true`, it will always be `true`. -@propertyWrapper -public struct IsEverTrue { - private var _wrappedValue: Bool = false - - public var wrappedValue: Bool { - get { _wrappedValue } - set { if newValue { _wrappedValue = true } } - } - - public init() {} -} diff --git a/Sources/ApolloCodegenLib/LinkedList.swift b/Sources/ApolloCodegenLib/LinkedList.swift deleted file mode 100644 index d85d2bcc44..0000000000 --- a/Sources/ApolloCodegenLib/LinkedList.swift +++ /dev/null @@ -1,302 +0,0 @@ -/// A doubly linked list implementation. -/// -/// This implementation utilizes copy on write semantics and is optimized for forward and backwards -/// traversal and appending items (which requires accessing last). -/// -/// It is not optimized for prepending or insertion of items. -public struct LinkedList: ExpressibleByArrayLiteral { - public class Node { - public let value: T - fileprivate let index: Int - - public fileprivate(set) weak var previous: Node? - public fileprivate(set) var next: Node? { - didSet { - next?.previous = self - oldValue?.previous = nil - } - } - - fileprivate init(value: T, index: Int) { - self.value = value - self.index = index - } - - public var isHead: Bool { - index == 0 - } - } - - final class HeadNode: Node { - fileprivate var lastPointer: Node? - - var last: Node! { - get { - lastPointer ?? self - } - set { - guard newValue !== self else { return } - lastPointer = newValue - } - } - - fileprivate init(value: T) { - super.init(value: value, index: 0) - } - - func copy() -> HeadNode { - let copiedHead = HeadNode(value: self.value) - - var currentNode: Node? = self - var currentCopy: Node? = copiedHead - - while let nextNode = currentNode?.next { - let nextCopy = Node(value: nextNode.value, index: nextNode.index) - currentCopy?.next = nextCopy - - currentNode = nextNode - currentCopy = nextCopy - } - - copiedHead.last = currentCopy - return copiedHead - } - } - - private var headNode: HeadNode - - /// The head (first) node in the list - public var head: Node { headNode } - - /// The last node in the list - public var last: Node { headNode.last } - - private init(head: HeadNode) { - self.headNode = head - } - - @_disfavoredOverload - public init(_ headValue: T) { - self.init(head: HeadNode(value: headValue)) - } - - public init>(_ collection: C) { - precondition(!collection.isEmpty, "Cannot initialize LinkedList with an empty collection. LinkedList must have at least one element.") - var iterator = collection.makeIterator() - let headNode = HeadNode(value: iterator.next()!) - - self.init(head: headNode) - - while let segment = iterator.next() { - append(segment) - } - } - - public init(arrayLiteral segments: T...) { - self.init(segments) - } - - private func copy() -> Self { - return Self.init(head: headNode.copy()) - } - - public mutating func append(_ value: T) { - append(Node(value: value, index: last.index + 1)) - } - - private mutating func append(_ node: Node) { - copyOnWriteIfNeeded() - last.next = node - headNode.last = node - } - - public mutating func append(_ sequence: S) where S.Element == T { - copyOnWriteIfNeeded() - var last: Node = last - - for element in sequence { - let node = Node(value: element, index: last.index + 1) - last.next = node - last = node - } - - headNode.last = last - } - - private mutating func copyOnWriteIfNeeded() { - if !isKnownUniquelyReferenced(&headNode) { - headNode = headNode.copy() - } - } - - public func appending(_ value: T) -> LinkedList { - var copy = self.copy() - copy.append(value) - return copy - } - - public func appending( - _ sequence: S - ) -> LinkedList where S.Element == T { - var copy = self.copy() - copy.append(sequence) - return copy - } - - public mutating func mutateLast(_ mutate: (T) -> T) { - copyOnWriteIfNeeded() - - if let last = headNode.lastPointer { - let newLast = Node(value: mutate(last.value), index: last.index) - last.previous!.next = newLast - headNode.last = newLast - - } else { - headNode = HeadNode(value: mutate(headNode.value)) - } - } - - public func mutatingLast(_ mutate: (T) -> T) -> LinkedList { - var copy = self.copy() - copy.mutateLast(mutate) - return copy - } - - // MARK: - Operators - - public static func +( - lhs: LinkedList, - rhs: S - ) -> LinkedList where S.Element == T { - return lhs.appending(rhs) - } - - public static func +=( - lhs: inout LinkedList, - rhs: S - ) where S.Element == T { - lhs.append(rhs) - } - -} - -extension LinkedList.Node: Equatable where T: Equatable { - public static func == (lhs: LinkedList.Node, rhs: LinkedList.Node) -> Bool { - lhs.value == rhs.value && - lhs.next == rhs.next - } -} - -extension LinkedList: Equatable where T: Equatable { - public static func == (lhs: LinkedList, rhs: LinkedList) -> Bool { - lhs.headNode == rhs.headNode - } -} - -extension LinkedList.Node: Hashable where T: Hashable { - public func hash(into hasher: inout Hasher) { - hasher.combine(value) - hasher.combine(next) - } -} - -extension LinkedList: Hashable where T: Hashable { - public func hash(into hasher: inout Hasher) { - hasher.combine(headNode) - } -} - -// MARK: - Collection Conformance - -extension LinkedList: Collection { - - public var startIndex: Int { 0 } - - public var endIndex: Int { last.index + 1 } - - public var count: Int { endIndex } - - public var isEmpty: Bool { false } - - public func node(at position: Int) -> Node { - let traverseFromFront = position <= last.index / 2 - let numberOfIndiciesToTarget = traverseFromFront ? position : last.index - position - - var node = traverseFromFront ? head : last - for _ in 0.. T { - _read { - yield node(at: position).value - } - } - - public func index(after i: Int) -> Int { - i + 1 - } - -} - -// MARK: - Sequence Conformance - -extension LinkedList: Sequence { - public typealias Element = T - - public class Iterator: IteratorProtocol { - var nodeIterator: LinkedList.Node.Iterator? - - init(_ list: LinkedList) { - nodeIterator = .init(list.head) - } - - public func next() -> Element? { - return nodeIterator?.next() - } - } - - public func makeIterator() -> Iterator { - Iterator(self) - } -} - -extension LinkedList.Node: Sequence { - public typealias Element = T - - public class Iterator: IteratorProtocol { - var currentNode: LinkedList.Node? - - init(_ node: LinkedList.Node) { - currentNode = node - } - - public func next() -> Element? { - let next = currentNode?.next - defer { currentNode = next } - return currentNode?.value - } - } - - public func makeIterator() -> Iterator { - Iterator(self) - } -} - -extension LinkedList: CustomDebugStringConvertible where T: CustomDebugStringConvertible { - public var debugDescription: String { - "[\(headNode.debugDescription)]" - } -} - -extension LinkedList.Node: CustomDebugStringConvertible { - public var debugDescription: String { - var string = "\(value)" - if let next = next { - string += " -> \(next.debugDescription)" - } - return string - } -} diff --git a/Sources/ApolloCodegenLib/Pluralizer.swift b/Sources/ApolloCodegenLib/Pluralizer.swift deleted file mode 100644 index a320abd045..0000000000 --- a/Sources/ApolloCodegenLib/Pluralizer.swift +++ /dev/null @@ -1,131 +0,0 @@ -import Foundation -import InflectorKit - -/// The types of inflection rules that can be used to customize pluralization. -public enum InflectionRule: Codable, Equatable { - - /// A pluralization rule that allows taking a singular word and pluralizing it. - /// - singularRegex: A regular expression representing the single version of the word - /// - replacementRegex: A regular expression representing how to replace the singular version. - case pluralization(singularRegex: String, replacementRegex: String) - - /// A singularization rule that allows taking a plural word and singularizing it. - /// - pluralRegex: A regular expression represeinting the plural version of the word - /// - replacementRegex: A regular expression representing how to replace the singular version - case singularization(pluralRegex: String, replacementRegex: String) - - /// A definition of an irregular pluralization rule not easily captured by regex - for example "person" and "people". - /// - singular: The singular version of the word - /// - plural: The plural version of the word. - case irregular(singular: String, plural: String) - - /// A definition of a word that should never be pluralized or de-pluralized because it's the same no matter what the count - for example, "fish". - /// - word: The word that should never be adjusted. - case uncountable(word: String) -} - -struct Pluralizer { - - private let inflector: StringInflector - - init(rules: [InflectionRule] = []) { - let inflector = StringInflector() - self.inflector = inflector - - add(rules: Self.defaultRules) - add(rules: rules) - } - - private func add(rules: [InflectionRule]) { - for rule in rules { - switch rule { - case .pluralization(let pluralRegex, let replacementRegex): - inflector.addPluralRule(pluralRegex, replacement: replacementRegex) - case .singularization(let singularRegex, let replacementRegex): - inflector.addSingularRule(singularRegex, replacement: replacementRegex) - case .irregular(let singular, let plural): - inflector.addIrregular(singular: singular, plural: plural) - case .uncountable(let word): - inflector.addUncountable(word) - } - } - } - - func singularize(_ string: String) -> String { - self.inflector.singularize(string) - } - - func pluralize(_ string: String) -> String { - self.inflector.pluralize(string) - } - - private static let defaultRules: [InflectionRule] = [ - .pluralization(singularRegex: "$", replacementRegex: "s"), - .pluralization(singularRegex: "s$", replacementRegex: "s"), - .pluralization(singularRegex: "^(ax|test)is$", replacementRegex: "$1es"), - .pluralization(singularRegex: "(octop|vir)us$", replacementRegex: "$1i"), - .pluralization(singularRegex: "(octop|vir)i$", replacementRegex: "$1i"), - .pluralization(singularRegex: "(alias|status)$", replacementRegex: "$1es"), - .pluralization(singularRegex: "(bu)s$", replacementRegex: "$1ses"), - .pluralization(singularRegex: "(buffal|tomat)o$", replacementRegex: "$1oes"), - .pluralization(singularRegex: "([ti])um$", replacementRegex: "$1a"), - .pluralization(singularRegex: "([ti])a$", replacementRegex: "$1a"), - .pluralization(singularRegex: "sis$", replacementRegex: "ses"), - .pluralization(singularRegex: "(?:([^f])fe|([lr])f)$", replacementRegex: "$1$2ves"), - .pluralization(singularRegex: "(hive)$", replacementRegex: "$1s"), - .pluralization(singularRegex: "([^aeiouy]|qu)y$", replacementRegex: "$1ies"), - .pluralization(singularRegex: "(x|ch|ss|sh)$", replacementRegex: "$1es"), - .pluralization(singularRegex: "(matr|vert|ind)(?:ix|ex)$", replacementRegex: "$1ices"), - .pluralization(singularRegex: "^(m|l)ouse$", replacementRegex: "$1ice"), - .pluralization(singularRegex: "^(m|l)ice$", replacementRegex: "$1ice"), - .pluralization(singularRegex: "^(ox)$", replacementRegex: "$1en"), - .pluralization(singularRegex: "^(oxen)$", replacementRegex: "$1"), - .pluralization(singularRegex: "(quiz)$", replacementRegex: "$1zes"), - - .singularization(pluralRegex: "s$", replacementRegex: ""), - .singularization(pluralRegex: "(ss)$", replacementRegex: "$1"), - .singularization(pluralRegex: "(n)ews$", replacementRegex: "$1ews"), - .singularization(pluralRegex: "([ti])a$", replacementRegex: "$1um"), - .singularization(pluralRegex: "((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$", replacementRegex: "$1sis"), - .singularization(pluralRegex: "(^analy)(sis|ses)$$", replacementRegex: "$1sis"), - .singularization(pluralRegex: "([^f])ves$", replacementRegex: "$1fe"), - .singularization(pluralRegex: "(hive)s$", replacementRegex: "$1"), - .singularization(pluralRegex: "(tive)s$", replacementRegex: "$1"), - .singularization(pluralRegex: "([lr])ves$", replacementRegex: "$1f"), - .singularization(pluralRegex: "([^aeiouy]|qu)ies$", replacementRegex: "$1y"), - .singularization(pluralRegex: "(s)eries$", replacementRegex: "$1eries"), - .singularization(pluralRegex: "(m)ovies$", replacementRegex: "$1ovie"), - .singularization(pluralRegex: "(x|ch|ss|sh)es$", replacementRegex: "$1"), - .singularization(pluralRegex: "^(m|l)ice$", replacementRegex: "$1ouse"), - .singularization(pluralRegex: "(bus)(es)?$", replacementRegex: "$1"), - .singularization(pluralRegex: "(o)es$", replacementRegex: "$1"), - .singularization(pluralRegex: "(shoe)s$", replacementRegex: "$1"), - .singularization(pluralRegex: "(cris|test)(is|es)$", replacementRegex: "$1is"), - .singularization(pluralRegex: "^(a)x[ie]s$", replacementRegex: "$1xis"), - .singularization(pluralRegex: "(octop|vir)(us|i)$", replacementRegex: "$1us"), - .singularization(pluralRegex: "(alias|status)(es)?$", replacementRegex: "$1"), - .singularization(pluralRegex: "^(ox)en", replacementRegex: "$1"), - .singularization(pluralRegex: "(vert|ind)ices$", replacementRegex: "$1ex"), - .singularization(pluralRegex: "(matr)ices$", replacementRegex: "$1ix"), - .singularization(pluralRegex: "(quiz)zes$", replacementRegex: "$1"), - .singularization(pluralRegex: "(database)s$", replacementRegex: "$1"), - - .irregular(singular: "person", plural: "people"), - .irregular(singular: "man", plural: "men"), - .irregular(singular: "child", plural: "children"), - .irregular(singular: "sex", plural: "sexes"), - .irregular(singular: "move", plural: "moves"), - .irregular(singular: "zombie", plural: "zombies"), - - .uncountable(word: "equipment"), - .uncountable(word: "information"), - .uncountable(word: "rice"), - .uncountable(word: "money"), - .uncountable(word: "species"), - .uncountable(word: "series"), - .uncountable(word: "fish"), - .uncountable(word: "sheep"), - .uncountable(word: "jeans"), - .uncountable(word: "police"), - ] -} diff --git a/Sources/ApolloCodegenLib/StaticString+Apollo.swift b/Sources/ApolloCodegenLib/StaticString+Apollo.swift deleted file mode 100644 index f8c0c25c07..0000000000 --- a/Sources/ApolloCodegenLib/StaticString+Apollo.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -extension StaticString { - var lastPathComponent: String { - return (description as NSString).lastPathComponent - } -} diff --git a/Sources/ApolloCodegenLib/TemplateString+CodegenConfiguration.swift b/Sources/ApolloCodegenLib/TemplateString+CodegenConfiguration.swift deleted file mode 100644 index 10610d1bbd..0000000000 --- a/Sources/ApolloCodegenLib/TemplateString+CodegenConfiguration.swift +++ /dev/null @@ -1,15 +0,0 @@ -extension TemplateString.StringInterpolation { - - mutating func appendInterpolation( - documentation: String?, - config: ApolloCodegen.ConfigurationContext - ) { - guard config.options.schemaDocumentation == .include else { - removeLineIfEmpty() - return - } - - appendInterpolation(forceDocumentation: documentation) - } - -} diff --git a/Sources/ApolloCodegenLib/TemplateString+DeprecationMessage.swift b/Sources/ApolloCodegenLib/TemplateString+DeprecationMessage.swift deleted file mode 100644 index db2409fa94..0000000000 --- a/Sources/ApolloCodegenLib/TemplateString+DeprecationMessage.swift +++ /dev/null @@ -1,61 +0,0 @@ -extension TemplateString.StringInterpolation { - - mutating func appendInterpolation( - deprecationReason: String?, - config: ApolloCodegen.ConfigurationContext - ) { - guard - config.options.warningsOnDeprecatedUsage == .include, - let escapedDeprecationReason = deprecationReason?.escapedSwiftStringSpecialCharacters() - else { - removeLineIfEmpty() - return - } - - appendInterpolation(""" - @available(*, deprecated, message: \"\(escapedDeprecationReason)\") - """) - } - - mutating func appendInterpolation( - field: String, - argument: String, - warningReason: String - ) { - let escapedWarningReason = warningReason.escapedSwiftStringSpecialCharacters() - - appendInterpolation(""" - #warning("Argument '\(argument)' of field '\(field)' is deprecated. \ - Reason: '\(escapedWarningReason)'") - """) - } -} - -extension String { - /// Replaces specific escaped characters so they are written into the rendered deprecation - /// message as escaped characters to be correctly rendered to the user in an Xcode warning - /// (e.g., `\"` becomes `\\\"`). - /// - /// String literals can include the following special characters: `\0` (null character), - /// `\\` (backslash), `\t` (horizontal tab), `\n` (line feed), `\r` (carriage return), - /// `\"` (double quotation mark) and `\'` (single quotation mark). - func escapedSwiftStringSpecialCharacters() -> String { - var escapedString = String() - escapedString.reserveCapacity(self.count) - - forEach { character in - switch (character) { - case "\0": escapedString.append(#"\0"#) - case "\\": escapedString.append(#"\\"#) - case "\t": escapedString.append(#"\t"#) - case "\n": escapedString.append(#"\n"#) - case "\r": escapedString.append(#"\r"#) - case "\"": escapedString.append(#"\""#) - case "\'": escapedString.append(#"\'"#) - default: escapedString.append(character) - } - } - - return escapedString - } -} diff --git a/Sources/ApolloCodegenLib/TemplateString.swift b/Sources/ApolloCodegenLib/TemplateString.swift deleted file mode 100644 index 872bc204da..0000000000 --- a/Sources/ApolloCodegenLib/TemplateString.swift +++ /dev/null @@ -1,427 +0,0 @@ -import Foundation - -struct TemplateString: ExpressibleByStringInterpolation, CustomStringConvertible { - - private let value: String - private let lastLineWasRemoved: Bool - - init(_ string: String) { - self.value = string - lastLineWasRemoved = false - } - - init(stringLiteral: String) { - self.init(stringLiteral) - } - - init(stringInterpolation: StringInterpolation) { - self.value = stringInterpolation.output - self.lastLineWasRemoved = stringInterpolation.lastLineWasRemoved - } - - init(_ stringInterpolation: StringInterpolation) { - self.value = stringInterpolation.output - self.lastLineWasRemoved = stringInterpolation.lastLineWasRemoved - } - - var description: String { value } - - var isEmpty: Bool { description.isEmpty } - - struct StringInterpolation: StringInterpolationProtocol { - - fileprivate var lastLineWasRemoved = false - private var buffer: String - - fileprivate var output: String { - if lastLineWasRemoved && buffer.hasSuffix("\n") { - return String(buffer.dropLast()) - } - return buffer - } - - init(literalCapacity: Int, interpolationCount: Int) { - var string = String() - string.reserveCapacity(literalCapacity) - self.buffer = string - } - - mutating func appendLiteral(_ literal: StringLiteralType) { - guard !literal.isEmpty else { return } - defer { lastLineWasRemoved = false } - - if lastLineWasRemoved && literal.hasPrefix("\n") { - buffer.append(contentsOf: literal.dropFirst()) - } else { - buffer.append(literal) - } - } - - mutating func appendInterpolation(_ string: StaticString) { - appendInterpolation(string.description) - } - - mutating func appendInterpolation(_ template: TemplateString) { - if template.isEmpty { - removeLineIfEmpty() - - } else { - appendInterpolation(template.description) - } - } - - mutating func appendInterpolation(section: TemplateString) { - appendInterpolation(section) - - if section.isEmpty && buffer.hasSuffix("\n") { - buffer.removeLast() - } - } - - private static let whitespaceNotNewline = Set(" \t") - - mutating func appendInterpolation(_ string: String) { - let indent = getCurrentIndent() - - if indent.isEmpty { - appendLiteral(string) - } else { - let indentedString = string - .split(separator: "\n", omittingEmptySubsequences: false) - .joinedAsLines(withIndent: indent) - - appendLiteral(indentedString) - } - } - - private func getCurrentIndent() -> String { - let reverseBuffer = buffer.reversed() - let startOfLine = reverseBuffer.firstIndex(of: "\n") ?? reverseBuffer.endIndex - return String(reverseBuffer.prefix(upTo: startOfLine).reversed().prefix { - TemplateString.StringInterpolation.whitespaceNotNewline.contains($0) - }) - } - - mutating func appendInterpolation( - _ sequence: T, - separator: String = ",\n", - terminator: String? = nil - ) where T: Sequence, T.Element == TemplateString { - appendInterpolation( - sequence.lazy.map { $0.description }, - separator: separator, - terminator: terminator - ) - } - - @_disfavoredOverload - mutating func appendInterpolation( - _ sequence: T, - separator: String = ",\n", - terminator: String? = nil - ) where T: Sequence, T.Element: CustomStringConvertible { - appendInterpolation( - sequence.lazy.map { $0.description }, - separator: separator, - terminator: terminator - ) - } - - mutating func appendInterpolation( - _ sequence: T, - separator: String = ",\n", - terminator: String? = nil - ) where T: LazySequenceProtocol, T.Element: CustomStringConvertible { - appendInterpolation( - forEachIn: sequence, - separator: separator, - terminator: terminator, - { TemplateString($0.description) } - ) - } - - mutating func appendInterpolation( - list: T, - separator: String = ",\n", - terminator: String? = nil - ) where T: Collection, T.Element: CustomStringConvertible { - let shouldWrapInNewlines = list.count > 1 - if shouldWrapInNewlines { appendInterpolation("\n ") } - appendInterpolation(list, separator: separator, terminator: terminator) - if shouldWrapInNewlines { appendInterpolation("\n") } - } - - @_disfavoredOverload - mutating func appendInterpolation( - list: T, - separator: String = ",\n", - terminator: String? = nil - ) where T: Collection, T.Element: CustomDebugStringConvertible { - let shouldWrapInNewlines = list.count > 1 - if shouldWrapInNewlines { appendLiteral("\n ") } - appendInterpolation( - list.map { $0.debugDescription }, - separator: separator, - terminator: terminator - ) - if shouldWrapInNewlines { appendInterpolation("\n") } - } - - // MARK: For Each - - mutating func appendInterpolation( - forEachIn sequence: T, - separator: String = ",\n", - terminator: String? = nil, - _ template: (T.Element) throws -> TemplateString? - ) rethrows where T: Sequence { - var iterator = sequence.makeIterator() - var resultString = "" - - while let element = iterator.next(), - let elementString = try template(element)?.description { - resultString.append( - resultString.isEmpty ? - elementString : separator + elementString - ) - } - - guard !resultString.isEmpty else { - removeLineIfEmpty() - return - } - - appendInterpolation(resultString) - if let terminator = terminator { - appendInterpolation(terminator) - } - } - - // MARK: While - - mutating func appendInterpolation( - while whileBlock: @autoclosure () -> Bool, - _ template: () -> TemplateString, - separator: String = ",\n", - terminator: String? = nil - ) { - var list: [TemplateString] = [] - while whileBlock() { - list.append(template()) - } - self.appendInterpolation(list, separator: separator, terminator: terminator) - } - - // MARK: If - - mutating func appendInterpolation( - if bool: Bool, - _ template: @autoclosure () -> TemplateString, - else: @autoclosure () -> TemplateString? = nil - ) { - if bool { - appendInterpolation(template()) - } else if let elseTemplate = `else`() { - appendInterpolation(elseTemplate) - } else { - removeLineIfEmpty() - } - } - - /// MARK: If Let - - mutating func appendInterpolation( - ifLet optional: Optional, - _ includeBlock: (T) -> TemplateString - ) { - if let element = optional { - appendInterpolation(includeBlock(element)) - } else { - removeLineIfEmpty() - } - } - - @_disfavoredOverload - mutating func appendInterpolation( - ifLet optional: Optional, - where whereBlock: ((T) -> Bool)? = nil, - _ includeBlock: (T) -> TemplateString, - else: @autoclosure () -> TemplateString? = nil - ) { - if let element = optional, whereBlock?(element) ?? true { - appendInterpolation(includeBlock(element)) - } else if let elseTemplate = `else`() { - appendInterpolation(elseTemplate.description) - } else { - removeLineIfEmpty() - } - } - - @_disfavoredOverload - mutating func appendInterpolation( - ifLet optional: Optional, - where whereBlock: @autoclosure @escaping () -> Bool = true, - _ includeBlock: (T) -> TemplateString, - else: @autoclosure () -> TemplateString? = nil - ) { - appendInterpolation( - ifLet: optional, - where: { _ in whereBlock() }, - includeBlock, - else: `else`() - ) - } - - @_disfavoredOverload - mutating func appendInterpolation( - ifLet optional: Optional, - where whereBlock: ((T) -> Bool)? = nil, - _ includeBlock: @autoclosure () -> TemplateString, - else: @autoclosure () -> TemplateString? = nil - ) { - appendInterpolation( - ifLet: optional, - where: whereBlock, - { _ in includeBlock() }, - else: `else`() - ) - } - - @_disfavoredOverload - mutating func appendInterpolation( - ifLet optional: Optional, - _ includeBlock: (T) -> TemplateString, - else: @autoclosure () -> TemplateString? = nil - ) { - appendInterpolation( - ifLet: optional, - where: nil, - includeBlock, - else: `else`() - ) - } - - mutating func appendInterpolation( - comment: String? - ) { - appendInterpolation(comment: comment, withLinePrefix: "//") - } - - mutating func appendInterpolation( - forceDocumentation documentation: String? - ) { - appendInterpolation(comment: documentation, withLinePrefix: "///") - } - - private mutating func appendInterpolation( - comment: String?, - withLinePrefix prefix: String - ) { - guard let comment = comment, !comment.isEmpty else { - removeLineIfEmpty() - return - } - - let components = comment - .split(separator: "\n", omittingEmptySubsequences: false) - .joinedAsCommentLines(withLinePrefix: prefix) - - appendInterpolation(components) - } - - // MARK: JSON - - mutating func appendInterpolation(json jsonData: Data) { - appendInterpolation(String(decoding: jsonData, as: UTF8.self)) - } - - // MARK: - Helpers - - mutating func removeLineIfEmpty() { - let slice = substringToStartOfLine() - if slice.allSatisfy(\.isWhitespace) { - buffer.removeLast(slice.count) - lastLineWasRemoved = true - } - } - - private func substringToStartOfLine() -> Slice> { - return buffer.reversed().prefix { !$0.isNewline } - } - - } - -} - -/// Can be used to concatenate a `TemplateString` and `String` directly. -/// This bypasses `TemplateString` interpolation logic such as indentation calculation. -func +(lhs: String, rhs: TemplateString) -> TemplateString { - TemplateString(lhs + rhs.description) -} - -// MARK: - Extensions - -extension Array where Element == Substring { - func joinedAsLines(withIndent indent: String) -> String { - var iterator = self.makeIterator() - var string = iterator.next()?.description ?? "" - - while let nextLine = iterator.next() { - string += "\n" - if !nextLine.isEmpty { - string += indent + nextLine - } - } - - return string - } - - fileprivate func joinedAsCommentLines(withLinePrefix prefix: String) -> String { - var string = "" - - func add(line: Substring) { - string += prefix - if !line.isEmpty { - string += " " - string += line - } - } - var iterator = self.makeIterator() - if let firstLine = iterator.next() { add(line: firstLine) } - - while let nextLine = iterator.next() { - string += "\n" - add(line: nextLine) - } - - return string - } -} - -extension String { - var firstUppercased: String { - guard let indexToChangeCase = firstIndex(where: \.isCased) else { - return self - } - return prefix(through: indexToChangeCase).uppercased() + - suffix(from: index(after: indexToChangeCase)) - } - - var firstLowercased: String { - guard let indexToChangeCase = firstIndex(where: \.isCased) else { - return self - } - return prefix(through: indexToChangeCase).lowercased() + - suffix(from: index(after: indexToChangeCase)) - } - - var isAllUppercased: Bool { - return self == self.uppercased() - } - - func convertedToSingleLine() -> String { - return components(separatedBy: .newlines) - .map { $0.trimmingCharacters(in: .whitespaces) } - .joined(separator: " ") - } -} diff --git a/Sources/ApolloCodegenLib/Templates/CustomScalarTemplate.swift b/Sources/ApolloCodegenLib/Templates/CustomScalarTemplate.swift deleted file mode 100644 index 5a84757789..0000000000 --- a/Sources/ApolloCodegenLib/Templates/CustomScalarTemplate.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Custom Scalar](https://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars) -/// into Swift code. -struct CustomScalarTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Custom Scalar](https://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars). - let graphqlScalar: GraphQLScalarType - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .customScalar) - - var headerTemplate: TemplateString? { - HeaderCommentTemplate.editableFileHeader( - fileCanBeEditedTo: "implement advanced custom scalar functionality." - ) - } - - var template: TemplateString { - TemplateString( - """ - \(documentation: documentationTemplate, config: config) - \(accessControlModifier(for: .parent))\ - typealias \(graphqlScalar.formattedName) = String - - """ - ) - } - - private var documentationTemplate: String? { - var string = graphqlScalar.documentation - if let specifiedByURL = graphqlScalar.specifiedByURL { - let specifiedByDocs = "Specified by: [](\(specifiedByURL))" - string = string?.appending("\n\n\(specifiedByDocs)") ?? specifiedByDocs - } - return string - } -} diff --git a/Sources/ApolloCodegenLib/Templates/EnumTemplate.swift b/Sources/ApolloCodegenLib/Templates/EnumTemplate.swift deleted file mode 100644 index e152ac7638..0000000000 --- a/Sources/ApolloCodegenLib/Templates/EnumTemplate.swift +++ /dev/null @@ -1,55 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Enum](https://spec.graphql.org/draft/#sec-Enums) into -/// Swift code. -struct EnumTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Enum](https://spec.graphql.org/draft/#sec-Enums). - let graphqlEnum: GraphQLEnumType - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .enum) - - var template: TemplateString { - TemplateString( - """ - \(documentation: graphqlEnum.documentation, config: config) - \(accessControlModifier(for: .parent))\ - enum \(graphqlEnum.formattedName): String, EnumType { - \(graphqlEnum.values.compactMap({ - enumCase(for: $0) - }), separator: "\n") - } - - """ - ) - } - - private func enumCase(for graphqlEnumValue: GraphQLEnumValue) -> TemplateString? { - if config.options.deprecatedEnumCases == .exclude && graphqlEnumValue.isDeprecated { - return nil - } - - let shouldRenderDocumentation = graphqlEnumValue.documentation != nil && - config.options.schemaDocumentation == .include - - return """ - \(if: shouldRenderDocumentation, "\(forceDocumentation: graphqlEnumValue.documentation)") - \(ifLet: graphqlEnumValue.deprecationReason, { """ - \(if: shouldRenderDocumentation, "///") - \(forceDocumentation: "**Deprecated**: \($0.escapedSwiftStringSpecialCharacters())") - """ }) - \(caseDefinition(for: graphqlEnumValue)) - """ - } - - private func caseDefinition(for graphqlEnumValue: GraphQLEnumValue) -> TemplateString { - """ - case \(graphqlEnumValue.name.rendered(as: .swiftEnumCase, config: config.config))\ - \(if: config.options.conversionStrategies.enumCases != .none, """ - = "\(graphqlEnumValue.name.rendered(as: .rawValue, config: config.config))" - """) - """ - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/FragmentTemplate.swift b/Sources/ApolloCodegenLib/Templates/FragmentTemplate.swift deleted file mode 100644 index 7d77626bc8..0000000000 --- a/Sources/ApolloCodegenLib/Templates/FragmentTemplate.swift +++ /dev/null @@ -1,37 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Fragment](https://spec.graphql.org/draft/#sec-Language.Fragments) -/// into Swift code. -struct FragmentTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Fragment](https://spec.graphql.org/draft/#sec-Language.Fragments). - let fragment: IR.NamedFragment - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .operationFile - - var template: TemplateString { - let definition = IR.Definition.namedFragment(fragment) - - return TemplateString( - """ - \(accessControlModifier(for: .parent))\ - struct \(fragment.generatedDefinitionName.asFragmentName): \ - \(definition.renderedSelectionSetType(config)), Fragment { - \(accessControlModifier(for: .member))\ - static var fragmentDefinition: StaticString { - #"\(fragment.definition.source.convertedToSingleLine())"# - } - - \(SelectionSetTemplate( - definition: definition, - generateInitializers: config.options.shouldGenerateSelectionSetInitializers(for: fragment), - config: config, - renderAccessControl: { accessControlModifier(for: .member) }() - ).renderBody()) - } - - """) - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/InputObjectTemplate.swift b/Sources/ApolloCodegenLib/Templates/InputObjectTemplate.swift deleted file mode 100644 index aadcf6e0c8..0000000000 --- a/Sources/ApolloCodegenLib/Templates/InputObjectTemplate.swift +++ /dev/null @@ -1,119 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Input Object](https://spec.graphql.org/draft/#sec-Input-Objects) -/// into Swift code. -struct InputObjectTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Input Object](https://spec.graphql.org/draft/#sec-Input-Objects). - let graphqlInputObject: GraphQLInputObjectType - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .inputObject) - - var template: TemplateString { - let (validFields, deprecatedFields) = filterFields(graphqlInputObject.fields) - let memberAccessControl = accessControlModifier(for: .member) - - return TemplateString( - """ - \(documentation: graphqlInputObject.documentation, config: config) - \(accessControlModifier(for: .parent))\ - struct \(graphqlInputObject.formattedName): InputObject { - \(memberAccessControl)private(set) var __data: InputDict - - \(memberAccessControl)init(_ data: InputDict) { - __data = data - } - - \(if: !deprecatedFields.isEmpty && !validFields.isEmpty && shouldIncludeDeprecatedWarnings, """ - \(memberAccessControl)init( - \(InitializerParametersTemplate(validFields)) - ) { - __data = InputDict([ - \(InputDictInitializerTemplate(validFields)) - ]) - } - - """ - ) - \(if: !deprecatedFields.isEmpty && shouldIncludeDeprecatedWarnings, """ - @available(*, deprecated, message: "\(deprecatedMessage(for: deprecatedFields))") - """) - \(memberAccessControl)init( - \(InitializerParametersTemplate(graphqlInputObject.fields)) - ) { - __data = InputDict([ - \(InputDictInitializerTemplate(graphqlInputObject.fields)) - ]) - } - - \(graphqlInputObject.fields.map({ "\(FieldPropertyTemplate($1))" }), separator: "\n\n") - } - - """ - ) - } - - private var shouldIncludeDeprecatedWarnings: Bool { - config.options.warningsOnDeprecatedUsage == .include - } - - private func filterFields( - _ fields: GraphQLInputFieldDictionary - ) -> (valid: GraphQLInputFieldDictionary, deprecated: GraphQLInputFieldDictionary) { - var valid: GraphQLInputFieldDictionary = [:] - var deprecated: GraphQLInputFieldDictionary = [:] - - for (key, value) in fields { - if let _ = value.deprecationReason { - deprecated[key] = value - } else { - valid[key] = value - } - } - - return (valid: valid, deprecated: deprecated) - } - - private func deprecatedMessage(for fields: GraphQLInputFieldDictionary) -> String { - guard !fields.isEmpty else { return "" } - - let names: String = fields.values.map({ $0.name }).joined(separator: ", ") - - if fields.count > 1 { - return "Arguments '\(names)' are deprecated." - } else { - return "Argument '\(names)' is deprecated." - } - } - - private func InitializerParametersTemplate( - _ fields: GraphQLInputFieldDictionary - ) -> TemplateString { - TemplateString(""" - \(fields.map({ - "\($1.name.renderAsFieldPropertyName(config: config.config)): \($1.renderInputValueType(includeDefault: true, config: config.config))" - }), separator: ",\n") - """) - } - - private func InputDictInitializerTemplate( - _ fields: GraphQLInputFieldDictionary - ) -> TemplateString { - TemplateString(""" - \(fields.map({ "\"\($1.name)\": \($1.name.renderAsFieldPropertyName(config: config.config))" }), separator: ",\n") - """) - } - - private func FieldPropertyTemplate(_ field: GraphQLInputField) -> TemplateString { - """ - \(documentation: field.documentation, config: config) - \(deprecationReason: field.deprecationReason, config: config) - \(accessControlModifier(for: .member))\ - var \(field.name.renderAsFieldPropertyName(config: config.config)): \(field.renderInputValueType(config: config.config)) { - get { __data["\(field.name)"] } - set { __data["\(field.name)"] = newValue } - } - """ - } -} diff --git a/Sources/ApolloCodegenLib/Templates/InterfaceTemplate.swift b/Sources/ApolloCodegenLib/Templates/InterfaceTemplate.swift deleted file mode 100644 index 3ebf026e57..0000000000 --- a/Sources/ApolloCodegenLib/Templates/InterfaceTemplate.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Interface](https://spec.graphql.org/draft/#sec-Interfaces) -/// into Swift code. -struct InterfaceTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Interface](https://spec.graphql.org/draft/#sec-Interfaces). - let graphqlInterface: GraphQLInterfaceType - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .interface) - - var template: TemplateString { - """ - \(documentation: graphqlInterface.documentation, config: config) - static let \(graphqlInterface.formattedName) = Interface(name: "\(graphqlInterface.name)") - """ - } -} diff --git a/Sources/ApolloCodegenLib/Templates/LegacyAPQOperationManifestTemplate.swift b/Sources/ApolloCodegenLib/Templates/LegacyAPQOperationManifestTemplate.swift deleted file mode 100644 index 40e44834a2..0000000000 --- a/Sources/ApolloCodegenLib/Templates/LegacyAPQOperationManifestTemplate.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation - -/// Provides the format to output an operation manifest file used for APQ registration. -struct LegacyAPQOperationManifestTemplate: OperationManifestTemplate { - - func render(operations: [OperationManifestItem]) -> String { - template(operations).description - } - - private func template(_ operations: [OperationManifestItem]) -> TemplateString { - return TemplateString( - """ - { - \(forEachIn: operations, { operation in - return """ - "\(operation.identifier)" : { - "name": "\(operation.name)", - "source": "\(operation.source)" - } - """ - }) - } - """ - ) - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/LocalCacheMutationDefinitionTemplate.swift b/Sources/ApolloCodegenLib/Templates/LocalCacheMutationDefinitionTemplate.swift deleted file mode 100644 index ee6797dbf0..0000000000 --- a/Sources/ApolloCodegenLib/Templates/LocalCacheMutationDefinitionTemplate.swift +++ /dev/null @@ -1,40 +0,0 @@ -import OrderedCollections - -struct LocalCacheMutationDefinitionTemplate: OperationTemplateRenderer { - /// IR representation of source [GraphQL Operation](https://spec.graphql.org/draft/#sec-Language.Operations). - let operation: IR.Operation - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .operationFile - - var template: TemplateString { - let definition = IR.Definition.operation(operation) - let memberAccessControl = accessControlModifier(for: .member) - - return TemplateString( - """ - \(accessControlModifier(for: .parent))\ - \(classDefinitionKeywords) \(operation.generatedDefinitionName): LocalCacheMutation { - \(memberAccessControl)static let operationType: GraphQLOperationType = .\(operation.definition.operationType.rawValue) - - \(section: VariableProperties(operation.definition.variables)) - - \(Initializer(operation.definition.variables)) - - \(section: VariableAccessors(operation.definition.variables, graphQLOperation: false)) - - \(memberAccessControl)struct Data: \(definition.renderedSelectionSetType(config)) { - \(SelectionSetTemplate( - definition: definition, - generateInitializers: config.options.shouldGenerateSelectionSetInitializers(for: operation), - config: config, - renderAccessControl: { accessControlModifier(for: .member) }() - ).renderBody()) - } - } - - """) - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/MockInterfacesTemplate.swift b/Sources/ApolloCodegenLib/Templates/MockInterfacesTemplate.swift deleted file mode 100644 index ee7a85a4a0..0000000000 --- a/Sources/ApolloCodegenLib/Templates/MockInterfacesTemplate.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation -import OrderedCollections - -struct MockInterfacesTemplate: TemplateRenderer { - - let graphQLInterfaces: OrderedSet - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .testMockFile - - var template: TemplateString { - TemplateString(""" - \(accessControlModifier(for: .parent))extension MockObject { - \(graphQLInterfaces.map { - "typealias \($0.formattedName) = Interface" - }, separator: "\n") - } - - """) - } -} diff --git a/Sources/ApolloCodegenLib/Templates/MockObjectTemplate.swift b/Sources/ApolloCodegenLib/Templates/MockObjectTemplate.swift deleted file mode 100644 index f34c030752..0000000000 --- a/Sources/ApolloCodegenLib/Templates/MockObjectTemplate.swift +++ /dev/null @@ -1,141 +0,0 @@ -import Foundation - -struct MockObjectTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Object](https://spec.graphql.org/draft/#sec-Objects). - let graphqlObject: GraphQLObjectType - - let config: ApolloCodegen.ConfigurationContext - - let ir: IR - - let target: TemplateTarget = .testMockFile - - typealias TemplateField = ( - responseKey: String, - propertyName: String, - initializerParameterName: String?, - type: GraphQLType, - mockType: String, - deprecationReason: String? - ) - - var template: TemplateString { - let objectName = graphqlObject.formattedName - let fields: [TemplateField] = ir.fieldCollector - .collectedFields(for: graphqlObject) - .map { - ( - responseKey: $0.0, - propertyName: $0.0.asTestMockFieldPropertyName, - initializerParameterName: $0.0.asTestMockInitializerParameterName, - type: $0.1, - mockType: mockTypeName(for: $0.1), - deprecationReason: $0.deprecationReason - ) - } - - let memberAccessControl = accessControlModifier(for: .member) - - return """ - \(accessControlModifier(for: .parent))class \(objectName): MockObject { - \(memberAccessControl)static let objectType: Object = \(config.schemaNamespace.firstUppercased).Objects.\(objectName) - \(memberAccessControl)static let _mockFields = MockFields() - \(memberAccessControl)typealias MockValueCollectionType = Array> - - \(memberAccessControl)struct MockFields { - \(fields.map { - TemplateString(""" - \(deprecationReason: $0.deprecationReason, config: config) - @Field<\($0.type.rendered(as: .testMockField(forceNonNull: true), config: config.config))>("\($0.responseKey)") public var \($0.propertyName) - """) - }, separator: "\n") - } - } - \(!fields.isEmpty ? - TemplateString(""" - - \(accessControlModifier(for: .parent))\ - extension Mock where O == \(objectName) { - \(conflictingFieldNameProperties(fields)) - convenience init( - \(fields.map { """ - \($0.propertyName)\(ifLet: $0.initializerParameterName, {" \($0)"}): \($0.mockType)? = nil - """ }, separator: ",\n") - ) { - self.init() - \(fields.map { - return "_set\(mockFunctionDescriptor($0.type))(\($0.initializerParameterName ?? $0.propertyName), for: \\.\($0.propertyName))" - }, separator: "\n") - } - } - """) : TemplateString(stringLiteral: "") - ) - - """ - } - - private func mockFunctionDescriptor(_ graphQLType: GraphQLType) -> String { - switch graphQLType { - case .list(let type): - switch type { - case .nonNull(.list(_)), - .list(_): - return mockFunctionDescriptor(type) - case .nonNull(.entity(_)), - .entity(_): - return "List" - default: - break - } - return "ScalarList" - case .scalar(_), .enum(_): - return "Scalar" - case .entity(_): - return "Entity" - case .inputObject(_): - preconditionFailure("Input object found when determing mock set function descriptor.") - case .nonNull(let type): - return mockFunctionDescriptor(type) - } - } - - private func conflictingFieldNameProperties(_ fields: [TemplateField]) -> TemplateString { - """ - \(fields.map { """ - \(if: $0.propertyName.isConflictingTestMockFieldName, """ - var \($0.propertyName): \($0.mockType)? { - get { _data["\($0.propertyName)"] as? \($0.mockType) } - set { _set\(mockFunctionDescriptor($0.type))(newValue, for: \\.\($0.propertyName)) } - } - """) - """ }, separator: "\n", terminator: "\n") - """ - } - - private func mockTypeName(for type: GraphQLType) -> String { - func nameReplacement(for type: GraphQLType, forceNonNull: Bool) -> String { - switch type { - case .entity(let graphQLCompositeType): - let mockType: String - switch graphQLCompositeType { - case is GraphQLInterfaceType, is GraphQLUnionType: - mockType = "AnyMock" - default: - mockType = "Mock<\(graphQLCompositeType.formattedName)>" - } - return TemplateString("\(mockType)\(if: !forceNonNull, "?")").description - case .scalar, - .enum, - .inputObject: - return type.rendered(as: .testMockField(forceNonNull: true), config: config.config) - case .nonNull(let graphQLType): - return nameReplacement(for: graphQLType, forceNonNull: true) - case .list(let graphQLType): - return "[\(nameReplacement(for: graphQLType, forceNonNull: false))]" - } - } - - return nameReplacement(for: type, forceNonNull: true) - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/MockUnionsTemplate.swift b/Sources/ApolloCodegenLib/Templates/MockUnionsTemplate.swift deleted file mode 100644 index 1eae1eb9ab..0000000000 --- a/Sources/ApolloCodegenLib/Templates/MockUnionsTemplate.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation -import OrderedCollections - -struct MockUnionsTemplate: TemplateRenderer { - - let graphQLUnions: OrderedSet - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .testMockFile - - var template: TemplateString { - TemplateString(""" - \(accessControlModifier(for: .parent))extension MockObject { - \(graphQLUnions.map { - "typealias \($0.formattedName) = Union" - }, separator: "\n") - } - - """) - } -} diff --git a/Sources/ApolloCodegenLib/Templates/ObjectTemplate.swift b/Sources/ApolloCodegenLib/Templates/ObjectTemplate.swift deleted file mode 100644 index f9a7665d42..0000000000 --- a/Sources/ApolloCodegenLib/Templates/ObjectTemplate.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Object](https://spec.graphql.org/draft/#sec-Objects) -/// into Swift code. -struct ObjectTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Object](https://spec.graphql.org/draft/#sec-Objects). - let graphqlObject: GraphQLObjectType - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .object) - - var template: TemplateString { - """ - \(documentation: graphqlObject.documentation, config: config) - static let \(graphqlObject.formattedName) = Object( - typename: "\(graphqlObject.name)\", - implementedInterfaces: \(ImplementedInterfacesTemplate()) - ) - """ - } - - private func ImplementedInterfacesTemplate() -> TemplateString { - return """ - [\(list: graphqlObject.interfaces.map({ interface in - TemplateString(""" - \(if: !config.output.schemaTypes.isInModule, "\(config.schemaNamespace.firstUppercased).")\ - Interfaces.\(interface.formattedName).self - """) - }))] - """ - } -} diff --git a/Sources/ApolloCodegenLib/Templates/OperationDefinitionTemplate.swift b/Sources/ApolloCodegenLib/Templates/OperationDefinitionTemplate.swift deleted file mode 100644 index d695df0903..0000000000 --- a/Sources/ApolloCodegenLib/Templates/OperationDefinitionTemplate.swift +++ /dev/null @@ -1,104 +0,0 @@ -import OrderedCollections - -/// Provides the format to convert a [GraphQL Operation](https://spec.graphql.org/draft/#sec-Language.Operations) -/// into Swift code. -struct OperationDefinitionTemplate: OperationTemplateRenderer { - /// IR representation of source [GraphQL Operation](https://spec.graphql.org/draft/#sec-Language.Operations). - let operation: IR.Operation - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .operationFile - - var template: TemplateString { - let definition = IR.Definition.operation(operation) - - return TemplateString( - """ - \(OperationDeclaration()) - \(DocumentType.render( - operation.definition, - identifier: operation.operationIdentifier, - fragments: operation.referencedFragments, - config: config, - accessControlRenderer: { accessControlModifier(for: .member) }() - )) - - \(section: VariableProperties(operation.definition.variables)) - - \(Initializer(operation.definition.variables)) - - \(section: VariableAccessors(operation.definition.variables)) - - \(accessControlModifier(for: .member))struct Data: \(definition.renderedSelectionSetType(config)) { - \(SelectionSetTemplate( - definition: definition, - generateInitializers: config.options.shouldGenerateSelectionSetInitializers(for: operation), - config: config, - renderAccessControl: { accessControlModifier(for: .member) }() - ).renderBody()) - } - } - - """) - } - - private func OperationDeclaration() -> TemplateString { - return """ - \(accessControlModifier(for: .parent))\ - \(classDefinitionKeywords) \(operation.generatedDefinitionName): \ - \(operation.definition.operationType.renderedProtocolName) { - \(accessControlModifier(for: .member))\ - static let operationName: String = "\(operation.definition.name)" - """ - } - - enum DocumentType { - static func render( - _ operation: CompilationResult.OperationDefinition, - identifier: @autoclosure () -> String, - fragments: OrderedSet, - config: ApolloCodegen.ConfigurationContext, - accessControlRenderer: @autoclosure () -> String - ) -> TemplateString { - let includeFragments = !fragments.isEmpty - let includeDefinition = config.options.operationDocumentFormat.contains(.definition) - - return TemplateString(""" - \(accessControlRenderer())\ - static let operationDocument: \(config.ApolloAPITargetName).OperationDocument = .init( - \(if: config.options.operationDocumentFormat.contains(.operationId), """ - operationIdentifier: \"\(identifier())\"\(if: includeDefinition, ",") - """) - \(if: includeDefinition, """ - definition: .init( - \(operation.source.formattedSource())\(if: includeFragments, ",") - \(if: includeFragments, - "fragments: [\(fragments.map { "\($0.name.asFragmentName).self" }, separator: ", ")]") - )) - """, - else: """ - ) - """) - """ - ) - } - } - -} - -fileprivate extension CompilationResult.OperationType { - var renderedProtocolName: String { - switch self { - case .query: return "GraphQLQuery" - case .mutation: return "GraphQLMutation" - case .subscription: return "GraphQLSubscription" - } - } -} - -fileprivate extension String { - func formattedSource() -> Self { - return "#\"\(convertedToSingleLine())\"#" - } -} diff --git a/Sources/ApolloCodegenLib/Templates/PersistedQueriesOperationManifestTemplate.swift b/Sources/ApolloCodegenLib/Templates/PersistedQueriesOperationManifestTemplate.swift deleted file mode 100644 index 5ce0a49ee6..0000000000 --- a/Sources/ApolloCodegenLib/Templates/PersistedQueriesOperationManifestTemplate.swift +++ /dev/null @@ -1,36 +0,0 @@ -import Foundation - -/// Provides the format to output an operation manifest file used for persisted queries. -struct PersistedQueriesOperationManifestTemplate: OperationManifestTemplate { - - let config: ApolloCodegen.ConfigurationContext - let encoder = JSONEncoder() - - func render(operations: [OperationManifestItem]) -> String { - template(operations).description - } - - private func template(_ operations: [OperationManifestItem]) -> TemplateString { - return TemplateString( - """ - { - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - \(forEachIn: operations, { operation in - return """ - { - "id": "\(operation.identifier)", - "body": "\(operation.source)", - "name": "\(operation.name)", - "type": "\(operation.type.rawValue)" - } - """ - }) - ] - } - """ - ) - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/FieldArgumentRendering.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/FieldArgumentRendering.swift deleted file mode 100644 index 4db259409a..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/FieldArgumentRendering.swift +++ /dev/null @@ -1,22 +0,0 @@ -import OrderedCollections - -extension GraphQLValue { - func renderInputValueLiteral() -> TemplateString { - switch self { - case let .string(string): return "\"\(string)\"" - case let .boolean(boolean): return boolean ? "true" : "false" - case let .int(int): return TemplateString(int.description) - case let .float(float): return TemplateString(float.description) - case let .enum(enumValue): return "\"\(enumValue)\"" - case .null: return ".null" - case let .list(list): - return "[\(list.map{ $0.renderInputValueLiteral() }, separator: ", ")]" - - case let .object(object): - return "[\(list: object.map{ "\"\($0.0)\": " + $0.1.renderInputValueLiteral() })]" - - case let .variable(variableName): - return ".variable(\"\(variableName)\")" - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLCompositeType+SchemaTypeNamespace.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLCompositeType+SchemaTypeNamespace.swift deleted file mode 100644 index bb56b27e3a..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLCompositeType+SchemaTypeNamespace.swift +++ /dev/null @@ -1,10 +0,0 @@ -extension GraphQLCompositeType { - var schemaTypesNamespace: String { - switch self { - case is GraphQLObjectType: return "Objects" - case is GraphQLInterfaceType: return "Interfaces" - case is GraphQLUnionType: return "Unions" - default: fatalError("Invalid parentType for Selection Set: \(self)") - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLEnumValue+Rendered.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLEnumValue+Rendered.swift deleted file mode 100644 index 8b3e3f8493..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLEnumValue+Rendered.swift +++ /dev/null @@ -1,26 +0,0 @@ -extension GraphQLEnumValue.Name { - - enum RenderContext { - /// Renders the value as a case in a generated Swift enum. - case swiftEnumCase - /// Renders the value as the rawValue for the enum case. - case rawValue - } - - func rendered( - as context: RenderContext, - config: ApolloCodegenConfiguration - ) -> String { - switch (context, config.options.conversionStrategies.enumCases) { - case (.rawValue, _): - return value - - case (.swiftEnumCase, .none): - return value.asEnumCaseName - - case (.swiftEnumCase, .camelCase): - return value.convertToCamelCase().asEnumCaseName - } - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLInputField+Rendered.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLInputField+Rendered.swift deleted file mode 100644 index 67509fb60d..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLInputField+Rendered.swift +++ /dev/null @@ -1,38 +0,0 @@ -import JavaScriptCore - -extension GraphQLInputField { - func renderInputValueType( - includeDefault: Bool = false, - config: ApolloCodegenConfiguration - ) -> String { - """ - \(type.rendered(as: .inputValue, config: config))\ - \(isSwiftOptional ? "?" : "")\ - \(includeDefault && hasSwiftNilDefault ? " = nil" : "") - """ - } - - private var isSwiftOptional: Bool { - !isNullable && hasDefaultValue - } - - private var hasSwiftNilDefault: Bool { - isNullable && !hasDefaultValue - } - - var isNullable: Bool { - switch type { - case .nonNull: return false - default: return true - } - } - - var hasDefaultValue: Bool { - switch defaultValue { - case .none: - return false - case .some: - return true - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLNamedType+SwiftName.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLNamedType+SwiftName.swift deleted file mode 100644 index 2f12a3882e..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLNamedType+SwiftName.swift +++ /dev/null @@ -1,10 +0,0 @@ -extension GraphQLNamedType { - /// Provides a Swift type name for GraphQL-specific type names that are not compatible with Swift. - var swiftName: String { - switch name { - case "Boolean": return "Bool" - case "Float": return "Double" - default: return name - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLType+Rendered.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLType+Rendered.swift deleted file mode 100644 index 6587d61d3a..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/GraphQLType+Rendered.swift +++ /dev/null @@ -1,196 +0,0 @@ -extension GraphQLType { - - enum RenderContext { - /// Renders the type for use in an operation selection set. - case selectionSetField(forceNonNull: Bool = false) - /// Renders the type for use in a test mock object. - case testMockField(forceNonNull: Bool = false) - /// Renders the type for use as an input value. - /// - /// If the outermost type is nullable, it will be wrapped in a `GraphQLNullable` instead of - /// an `Optional`. - case inputValue - } - - func rendered( - as context: RenderContext, - replacingNamedTypeWith newTypeName: String? = nil, - config: ApolloCodegenConfiguration - ) -> String { - switch context { - case let .selectionSetField(forceNonNull): - return renderedAsSelectionSetField( - containedInNonNull: forceNonNull, - replacingNamedTypeWith: newTypeName, - config: config - ) - - case let .testMockField(forceNonNull): - return renderedAsTestMockField( - containedInNonNull: forceNonNull, - replacingNamedTypeWith: newTypeName, - config: config - ) - - case .inputValue: - return renderAsInputValue(inNullable: true, config: config) - } - } - - // MARK: Selection Set Field - - private func renderedAsSelectionSetField( - containedInNonNull: Bool, - replacingNamedTypeWith newTypeName: String? = nil, - config: ApolloCodegenConfiguration - ) -> String { - renderType( - in: .selectionSetField(), - containedInNonNull: containedInNonNull, - replacingNamedTypeWith: newTypeName, - config: config - ) - } - - // MARK: Mock Object Field - - private func renderedAsTestMockField( - containedInNonNull: Bool, - replacingNamedTypeWith newTypeName: String? = nil, - config: ApolloCodegenConfiguration - ) -> String { - renderType( - in: .testMockField(), - containedInNonNull: containedInNonNull, - replacingNamedTypeWith: newTypeName, - config: config - ) - } - - // MARK: Input Value - - private func renderAsInputValue( - inNullable: Bool, - config: ApolloCodegenConfiguration - ) -> String { - switch self { - case let .nonNull(ofType): - return ofType.renderAsInputValue(inNullable: false, config: config) - - case let .list(ofType): - let typeName = "[\(ofType.renderType(in: .inputValue, config: config))]" - return inNullable ? "GraphQLNullable<\(typeName)>" : typeName - - default: - let typeName = renderType(in: .inputValue, containedInNonNull: true, config: config) - return inNullable ? "GraphQLNullable<\(typeName)>" : typeName - } - } - - // MARK: - Render Type - - private func renderType( - in context: RenderContext, - containedInNonNull: Bool = false, - replacingNamedTypeWith newTypeName: String? = nil, - config: ApolloCodegenConfiguration - ) -> String { - switch self { - case - .entity(let type as GraphQLNamedType), - .scalar(let type as GraphQLNamedType), - .enum(let type as GraphQLNamedType), - .inputObject(let type as GraphQLNamedType): - - let typeName = type.qualifiedRootTypeName( - in: context, - replacingNamedTypeWith: newTypeName, - config: config - ).wrappedInGraphQLEnum(ifIsEnumType: self) - - return containedInNonNull ? typeName : "\(typeName)?" - - case let .nonNull(ofType): - return ofType.renderType( - in: context, - containedInNonNull: true, - replacingNamedTypeWith: newTypeName, - config: config - ) - - case let .list(ofType): - let rendered = ofType.renderType( - in: context, - containedInNonNull: false, - replacingNamedTypeWith: newTypeName, - config: config - ) - let inner = "[\(rendered)]" - - return containedInNonNull ? inner : "\(inner)?" - } - } - -} - -extension GraphQLNamedType { - - var testMockFieldTypeName: String { - if SwiftKeywords.TestMockFieldAbstractTypeNamesToNamespace.contains(name) && - self is GraphQLAbstractType { - return "MockObject.\(formattedName)" - } - - return formattedName - } - - fileprivate func qualifiedRootTypeName( - in context: GraphQLType.RenderContext, - replacingNamedTypeWith newTypeName: String? = nil, - config: ApolloCodegenConfiguration - ) -> String { - - let typeName: String = { - if case .testMockField = context { - return newTypeName ?? testMockFieldTypeName.firstUppercased - } else { - return newTypeName ?? self.formattedName - } - }() - - let schemaModuleName: String = { - switch self { - case is GraphQLCompositeType: - return "" - - case let scalar as GraphQLScalarType where scalar.isSwiftType: - return "" - - default: - switch context { - case .inputValue: - if !config.output.operations.isInModule { - fallthrough - } else { - return "" - } - - case .selectionSetField, .testMockField: - return "\(config.schemaNamespace.firstUppercased)." - } - } - }() - - return "\(schemaModuleName)\(typeName)" - } -} - -fileprivate extension String { - func wrappedInGraphQLEnum(ifIsEnumType type: GraphQLType) -> String { - if case .enum = type { - return "GraphQLEnum<\(self)>" - } else { - return self - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/IRDefinition+RenderingHelpers.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/IRDefinition+RenderingHelpers.swift deleted file mode 100644 index c9e636e498..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/IRDefinition+RenderingHelpers.swift +++ /dev/null @@ -1,53 +0,0 @@ -extension IR.Definition { - - func renderedSelectionSetType(_ config: ApolloCodegen.ConfigurationContext) -> TemplateString { - "\(config.schemaNamespace.firstUppercased).\(if: isMutable, "Mutable")SelectionSet" - } - - var isMutable: Bool { - switch self { - case let .operation(operation): - return operation.definition.isLocalCacheMutation - case let .namedFragment(fragment): - return fragment.definition.isLocalCacheMutation - } - } - - var generatedDefinitionName: String { - switch self { - case let .operation(operation): - return operation.generatedDefinitionName - case let .namedFragment(fragment): - return fragment.generatedDefinitionName - } - } - -} - -extension CompilationResult.OperationDefinition { - var generatedDefinitionName: String { - nameWithSuffix.firstUppercased - } -} - -extension IR.Operation { - - var generatedDefinitionName: String { - definition.generatedDefinitionName - } - -} - -extension CompilationResult.FragmentDefinition { - var generatedDefinitionName: String { - name.firstUppercased - } -} - -extension IR.NamedFragment { - - var generatedDefinitionName: String { - definition.generatedDefinitionName - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/InputVariableRenderable.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/InputVariableRenderable.swift deleted file mode 100644 index 5cd5c308d0..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/InputVariableRenderable.swift +++ /dev/null @@ -1,89 +0,0 @@ -import OrderedCollections - -protocol InputVariableRenderable { - var type: GraphQLType { get } - var defaultValue: GraphQLValue? { get } -} - -extension CompilationResult.VariableDefinition: InputVariableRenderable {} - -struct InputVariable: InputVariableRenderable { - let type: GraphQLType - let defaultValue: GraphQLValue? -} - -extension InputVariableRenderable { - func renderVariableDefaultValue(config: ApolloCodegenConfiguration) -> TemplateString { - renderVariableDefaultValue(inList: false, config: config) - } - - private func renderVariableDefaultValue( - inList: Bool, - config: ApolloCodegenConfiguration - ) -> TemplateString { - switch defaultValue { - case .none: return "" - case .null: return inList ? "nil" : ".null" - case let .string(string): return "\"\(string)\"" - case let .boolean(boolean): return boolean ? "true" : "false" - case let .int(int): return TemplateString(int.description) - case let .float(float): return TemplateString(float.description) - case let .enum(enumValue): - let name = GraphQLEnumValue.Name(value: enumValue) - return ".init(.\(name.rendered(as: .swiftEnumCase, config: config)))" - case let .list(list): - switch type { - case let .nonNull(.list(listInnerType)), - let .list(listInnerType): - return """ - [\(list.compactMap { - InputVariable(type: listInnerType, defaultValue: $0).renderVariableDefaultValue(inList: true, config: config) - }, separator: ", ")] - """ - - default: - preconditionFailure("Variable type must be List with value of .list type.") - } - - case let .object(object): - switch type { - case let .nonNull(.inputObject(inputObjectType)): - return inputObjectType.renderInitializer(values: object, config: config) - - case let .inputObject(inputObjectType): - return """ - .init( - \(inputObjectType.renderInitializer(values: object, config: config)) - ) - """ - - default: - preconditionFailure("Variable type must be InputObject with value of .object type.") - } - - case .variable: - preconditionFailure("Variable cannot be used as Default Value for an Operation Variable!") - } - } -} - -fileprivate extension GraphQLInputObjectType { - func renderInitializer( - values: OrderedDictionary, - config: ApolloCodegenConfiguration - ) -> TemplateString { - let entries = values.compactMap { entry -> TemplateString in - guard let field = self.fields[entry.0] else { - preconditionFailure("Field \(entry.0) not found on input object.") - } - - let variable = InputVariable(type: field.type, defaultValue: entry.value) - - return "\(entry.0): " + variable.renderVariableDefaultValue(config: config) - } - - return """ - \(if: !config.output.operations.isInModule, "\(config.schemaNamespace.firstUppercased).")\(name)(\(list: entries)) - """ - } -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/OperationTemplateRenderer.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/OperationTemplateRenderer.swift deleted file mode 100644 index c5a9e4c2fa..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/OperationTemplateRenderer.swift +++ /dev/null @@ -1,53 +0,0 @@ -/// Protocol for a `TemplateRenderer` that renders an operation definition template. -/// This protocol provides rendering helper functions for common template elements. -protocol OperationTemplateRenderer: TemplateRenderer { } - -extension OperationTemplateRenderer { - func Initializer( - _ variables: [CompilationResult.VariableDefinition] - ) -> TemplateString { - let `init` = "public init" - if variables.isEmpty { - return "\(`init`)() {}" - } - return """ - \(`init`)(\(list: variables.map(VariableParameter))) { - \(variables.map { - let name = $0.name.renderAsFieldPropertyName(config: config.config) - return "self.\(name) = \(name)" - }, separator: "\n") - } - """ - } - - func VariableProperties( - _ variables: [CompilationResult.VariableDefinition] - ) -> TemplateString { - """ - \(variables.map { "public var \($0.name.renderAsFieldPropertyName(config: config.config)): \($0.type.rendered(as: .inputValue, config: config.config))"}, separator: "\n") - """ - } - - func VariableParameter( - _ variable: CompilationResult.VariableDefinition - ) -> TemplateString { - """ - \(variable.name.renderAsFieldPropertyName(config: config.config)): \(variable.type.rendered(as: .inputValue, config: config.config))\ - \(if: variable.defaultValue != nil, " = " + variable.renderVariableDefaultValue(config: config.config)) - """ - } - - func VariableAccessors( - _ variables: [CompilationResult.VariableDefinition], - graphQLOperation: Bool = true - ) -> TemplateString { - guard !variables.isEmpty else { - return "" - } - - return """ - public var __variables: \(if: !graphQLOperation, "GraphQLOperation.")Variables? { [\(list: variables.map { "\"\($0.name)\": \($0.name.renderAsFieldPropertyName(config: config.config))"})] } - """ - } - -} diff --git a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/String+SwiftNameEscaping.swift b/Sources/ApolloCodegenLib/Templates/RenderingHelpers/String+SwiftNameEscaping.swift deleted file mode 100644 index 590afe7488..0000000000 --- a/Sources/ApolloCodegenLib/Templates/RenderingHelpers/String+SwiftNameEscaping.swift +++ /dev/null @@ -1,201 +0,0 @@ -import Foundation - - -extension String { - - var asEnumCaseName: String { - escapeIf(in: SwiftKeywords.FieldAccessorNamesToEscape) - } - - var asSelectionSetName: String { - SwiftKeywords.TypeNamesToSuffix.contains(self) ? - "\(self)_SelectionSet" : self - } - - var asFragmentName: String { - let uppercasedName = self.firstUppercased - return SwiftKeywords.TypeNamesToSuffix.contains(uppercasedName) ? - "\(uppercasedName)_Fragment" : uppercasedName - } - - var asTestMockFieldPropertyName: String { - escapeIf(in: SwiftKeywords.TestMockFieldNamesToEscape) - } - - var asTestMockInitializerParameterName: String? { - SwiftKeywords.TestMockInitializerParametersToSuffix.contains(self) ? - "\(self)_value" : nil - } - - var isConflictingTestMockFieldName: Bool { - SwiftKeywords.TestMockConflictingFieldNames.contains(self) - } - - private func escapeIf(in set: Set) -> String { - set.contains(self) ? "`\(self)`" : self - } - - /// Renders the string as the property name for a field accessor on a generated `SelectionSet`. - /// This escapes the names of properties that would conflict with Swift reserved keywords. - func renderAsFieldPropertyName( - config: ApolloCodegenConfiguration - ) -> String { - var propertyName = self - - switch config.options.conversionStrategies.fieldAccessors { - case .camelCase: - propertyName = propertyName.convertToCamelCase() - case .idiomatic: - break - } - - propertyName = propertyName.isAllUppercased ? propertyName.lowercased() : propertyName.firstLowercased - return propertyName.escapeIf(in: SwiftKeywords.FieldAccessorNamesToEscape) - } - - /// Convert to `camelCase` from a number of different `snake_case` variants. - /// - /// All inner `_` characters will be removed, each 'word' will be capitalized, returning a final - /// firstLowercased string while preserving original leading and trailing `_` characters. - func convertToCamelCase() -> String { - guard self.firstIndex(of: "_") != nil else { - if self.firstIndex(where: { $0.isLowercase }) != nil { - return self.firstLowercased - } else { - return self.lowercased() - } - } - - return self.components(separatedBy: "_") - .map({ $0.isEmpty ? "_" : $0.capitalized }) - .joined() - .firstLowercased - } -} - -enum SwiftKeywords { - - static let DisallowedFieldNames: Set = [ - "__data", "fragments" - ] - - static let DisallowedInputParameterNames: Set = [ - "self", "_" - ] - - static let DisallowedSchemaNamespaceNames: Set = [ - "schema", "apolloapi" - ] - - static let DisallowedEmbeddedTargetNames: Set = [ - "apollo", "apolloapi" - ] - - static let TypeNamesToSuffix: Set = [ - "Any", - "DataDict", - "DocumentType", - "Fragments", - "FragmentContainer", - "ParentType", - "Protocol", - "Schema", - "Selection", - "Self", - "String", - "Bool", - "Int", - "Float", - "Double", - "ID", - "Type", - "Error", - "_", - ] - - /// When an interface or union named "Actor" is used as the type for a field on a test mock, - /// the compiler recognizes it as a "Swift.Actor". The generated `Actor` is only a `typealias` - /// to `Interface` or `Union`. This error occurs due to Actor's special treatment in the - /// compiler. To prevent the error, we must namespace the type. - /// - /// When the "Actor" type is an object, we do not need to namespace it, as a concrete `Actor` - /// class is generated in the Test Mocks directory. That class will be recognized by the compiler. - static let TestMockFieldAbstractTypeNamesToNamespace: Set = [ - "Actor" - ] - - /// There are some field names that conflict with function names due to the @dynamicMember - /// subscripting of `Mock`. This set is used to match those field names and generate properties - /// instead of just relying on the subscript access. - static let TestMockConflictingFieldNames: Set = [ - "hash" - ] - - fileprivate static let FieldAccessorNamesToEscape: Set = [ - "associatedtype", - "class", - "deinit", - "enum", - "extension", - "fileprivate", - "func", - "import", - "init", - "inout", - "internal", - "let", - "operator", - "private", - "precedencegroup", - "protocol", - "Protocol", - "public", - "rethrows", - "static", - "struct", - "subscript", - "typealias", - "var", - "break", - "case", - "catch", - "continue", - "default", - "defer", - "do", - "else", - "fallthrough", - "for", - "guard", - "if", - "in", - "repeat", - "return", - "throw", - "switch", - "where", - "while", - "as", - "false", - "is", - "nil", - "self", - "Self", - "super", - "throws", - "true", - "try", - "_", - ] - - fileprivate static let InputParameterNamesToEscape: Set = FieldAccessorNamesToEscape - - fileprivate static let TestMockFieldNamesToEscape: Set = - FieldAccessorNamesToEscape.union([ - "Type", "Any" - ]) - - fileprivate static let TestMockInitializerParametersToSuffix: Set = [ - "self" - ] -} diff --git a/Sources/ApolloCodegenLib/Templates/SchemaConfigurationTemplate.swift b/Sources/ApolloCodegenLib/Templates/SchemaConfigurationTemplate.swift deleted file mode 100644 index 6f290f4cc3..0000000000 --- a/Sources/ApolloCodegenLib/Templates/SchemaConfigurationTemplate.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation - -/// Renders the Cache Key Resolution extension for a generated schema. -struct SchemaConfigurationTemplate: TemplateRenderer { - /// Shared codegen configuration - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .schemaConfiguration) - - var headerTemplate: TemplateString? { - HeaderCommentTemplate.editableFileHeader( - fileCanBeEditedTo: """ - provide custom configuration for a generated GraphQL schema. - """ - ) - } - - var template: TemplateString { - return """ - \(accessControlModifier(for: .parent))enum SchemaConfiguration: \ - \(config.ApolloAPITargetName).SchemaConfiguration { - \(accessControlModifier(for: .member))\ - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } - } - - """ - } -} diff --git a/Sources/ApolloCodegenLib/Templates/SchemaMetadataTemplate.swift b/Sources/ApolloCodegenLib/Templates/SchemaMetadataTemplate.swift deleted file mode 100644 index ef3db1a3b6..0000000000 --- a/Sources/ApolloCodegenLib/Templates/SchemaMetadataTemplate.swift +++ /dev/null @@ -1,97 +0,0 @@ -import Foundation - -/// Provides the format to define a schema in Swift code. The schema represents metadata used by -/// the GraphQL executor at runtime to convert response data into corresponding Swift types. -struct SchemaMetadataTemplate: TemplateRenderer { - // IR representation of source GraphQL schema. - let schema: IR.Schema - - let config: ApolloCodegen.ConfigurationContext - - let schemaNamespace: String - - let target: TemplateTarget = .schemaFile(type: .schemaMetadata) - - var template: TemplateString { embeddableTemplate } - - /// Swift code that can be embedded within a namespace. - var embeddableTemplate: TemplateString { - let parentAccessLevel = accessControlModifier(for: .parent) - - return TemplateString( - """ - \(parentAccessLevel)typealias ID = String - - \(if: !config.output.schemaTypes.isInModule, - TemplateString(""" - \(parentAccessLevel)typealias SelectionSet = \(schemaNamespace)_SelectionSet - - \(parentAccessLevel)typealias InlineFragment = \(schemaNamespace)_InlineFragment - - \(parentAccessLevel)typealias MutableSelectionSet = \(schemaNamespace)_MutableSelectionSet - - \(parentAccessLevel)typealias MutableInlineFragment = \(schemaNamespace)_MutableInlineFragment - """), - else: protocolDefinition(prefix: nil, schemaNamespace: schemaNamespace)) - - \(documentation: schema.documentation, config: config) - \(parentAccessLevel)enum SchemaMetadata: \(config.ApolloAPITargetName).SchemaMetadata { - \(accessControlModifier(for: .member))\ - static let configuration: \(config.ApolloAPITargetName).SchemaConfiguration.Type = SchemaConfiguration.self - - \(objectTypeFunction) - } - - \(parentAccessLevel)enum Objects {} - \(parentAccessLevel)enum Interfaces {} - \(parentAccessLevel)enum Unions {} - - """ - ) - } - - var objectTypeFunction: TemplateString { - return """ - \(accessControlModifier(for: .member))\ - static func objectType(forTypename typename: String) -> Object? { - switch typename { - \(schema.referencedTypes.objects.map { - "case \"\($0.name)\": return \(schemaNamespace).Objects.\($0.formattedName)" - }, separator: "\n") - default: return nil - } - } - """ - } - /// Swift code that must be rendered outside of any namespace. - var detachedTemplate: TemplateString? { - guard !config.output.schemaTypes.isInModule else { return nil } - - return protocolDefinition(prefix: "\(schemaNamespace)_", schemaNamespace: schemaNamespace) - } - - init(schema: IR.Schema, config: ApolloCodegen.ConfigurationContext) { - self.schema = schema - self.schemaNamespace = config.schemaNamespace.firstUppercased - self.config = config - } - - private func protocolDefinition(prefix: String?, schemaNamespace: String) -> TemplateString { - let accessLevel = accessControlModifier(for: .member) - - return TemplateString(""" - \(accessLevel)protocol \(prefix ?? "")SelectionSet: \(config.ApolloAPITargetName).SelectionSet & \(config.ApolloAPITargetName).RootSelectionSet - where Schema == \(schemaNamespace).SchemaMetadata {} - - \(accessLevel)protocol \(prefix ?? "")InlineFragment: \(config.ApolloAPITargetName).SelectionSet & \(config.ApolloAPITargetName).InlineFragment - where Schema == \(schemaNamespace).SchemaMetadata {} - - \(accessLevel)protocol \(prefix ?? "")MutableSelectionSet: \(config.ApolloAPITargetName).MutableRootSelectionSet - where Schema == \(schemaNamespace).SchemaMetadata {} - - \(accessLevel)protocol \(prefix ?? "")MutableInlineFragment: \(config.ApolloAPITargetName).MutableSelectionSet & \(config.ApolloAPITargetName).InlineFragment - where Schema == \(schemaNamespace).SchemaMetadata {} - """ - ) - } -} diff --git a/Sources/ApolloCodegenLib/Templates/SchemaModuleNamespaceTemplate.swift b/Sources/ApolloCodegenLib/Templates/SchemaModuleNamespaceTemplate.swift deleted file mode 100644 index 9ac0b1ef9a..0000000000 --- a/Sources/ApolloCodegenLib/Templates/SchemaModuleNamespaceTemplate.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation - -/// Provides the format to define a namespace that is used to wrap other templates to prevent -/// naming collisions in Swift code. -struct SchemaModuleNamespaceTemplate: TemplateRenderer { - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .moduleFile - - var template: TemplateString { - TemplateString(""" - \(accessControlModifier(for: .namespace))\ - enum \(config.schemaNamespace.firstUppercased) { } - - """) - } -} diff --git a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift deleted file mode 100644 index 6e778435a6..0000000000 --- a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift +++ /dev/null @@ -1,984 +0,0 @@ -import InflectorKit -import OrderedCollections - -struct SelectionSetTemplate { - - let definition: IR.Definition - let isMutable: Bool - let generateInitializers: Bool - let config: ApolloCodegen.ConfigurationContext - let renderAccessControl: () -> String - - private let nameCache: SelectionSetNameCache - - init( - definition: IR.Definition, - generateInitializers: Bool, - config: ApolloCodegen.ConfigurationContext, - renderAccessControl: @autoclosure @escaping () -> String - ) { - self.definition = definition - self.isMutable = definition.isMutable - self.generateInitializers = generateInitializers - self.config = config - self.renderAccessControl = renderAccessControl - - self.nameCache = SelectionSetNameCache(config: config) - } - - func renderBody() -> TemplateString { - BodyTemplate(definition.rootField.selectionSet) - } - - // MARK: - Field - func render(field: IR.EntityField) -> String { - TemplateString( - """ - \(SelectionSetNameDocumentation(field.selectionSet)) - \(renderAccessControl())\ - struct \(field.formattedSelectionSetName(with: config.pluralizer)): \(SelectionSetType()) { - \(BodyTemplate(field.selectionSet)) - } - """ - ).description - } - - // MARK: - Inline Fragment - func render(inlineFragment: IR.SelectionSet) -> String { - TemplateString( - """ - \(SelectionSetNameDocumentation(inlineFragment)) - \(renderAccessControl())\ - struct \(inlineFragment.renderedTypeName): \(SelectionSetType(asInlineFragment: true))\ - \(if: inlineFragment.isCompositeSelectionSet, ", \(config.ApolloAPITargetName).CompositeInlineFragment") \ - { - \(BodyTemplate(inlineFragment)) - } - """ - ).description - } - - // MARK: - Selection Set Type - private func SelectionSetType(asInlineFragment: Bool = false) -> TemplateString { - let selectionSetTypeName: String - switch (isMutable, asInlineFragment) { - case (false, false): - selectionSetTypeName = "SelectionSet" - case (false, true): - selectionSetTypeName = "InlineFragment" - case (true, false): - selectionSetTypeName = "MutableSelectionSet" - case (true, true): - selectionSetTypeName = "MutableInlineFragment" - } - - return "\(config.schemaNamespace.firstUppercased).\(selectionSetTypeName)" - } - - // MARK: - Selection Set Name Documentation - func SelectionSetNameDocumentation(_ selectionSet: IR.SelectionSet) -> TemplateString { - """ - /// \(SelectionSetNameGenerator.generatedSelectionSetName( - for: selectionSet, - format: .omittingRoot, - pluralizer: config.pluralizer)) - \(if: config.options.schemaDocumentation == .include, """ - /// - /// Parent Type: `\(selectionSet.parentType.formattedName)` - """) - """ - } - - // MARK: - Body - func BodyTemplate(_ selectionSet: IR.SelectionSet) -> TemplateString { - let selections = selectionSet.selections - let scope = selectionSet.typeInfo.scope - return """ - \(DataFieldAndInitializerTemplate()) - - \(RootEntityTypealias(selectionSet)) - \(ParentTypeTemplate(selectionSet.parentType)) - \(ifLet: selections.direct?.groupedByInclusionCondition, { SelectionsTemplate($0, in: scope) }) - \(if: selectionSet.isCompositeInlineFragment, MergedSourcesTemplate(selectionSet)) - - \(section: FieldAccessorsTemplate(selections, in: scope)) - - \(section: InlineFragmentAccessorsTemplate(selections)) - - \(section: FragmentAccessorsTemplate(selections, in: scope)) - - \(section: "\(if: generateInitializers, InitializerTemplate(selectionSet))") - - \(section: ChildEntityFieldSelectionSets(selections)) - - \(section: ChildTypeCaseSelectionSets(selections)) - """ - } - - private func DataFieldAndInitializerTemplate() -> String { - let accessControl = renderAccessControl() - - return """ - \(accessControl)\(isMutable ? "var" : "let") __data: DataDict - \(accessControl)init(_dataDict: DataDict) { __data = _dataDict } - """ - } - - private func RootEntityTypealias(_ selectionSet: IR.SelectionSet) -> TemplateString { - guard !selectionSet.isEntityRoot else { return "" } - let rootEntityName = SelectionSetNameGenerator.generatedSelectionSetName( - for: selectionSet, - to: selectionSet.scopePath.last.value.scopePath.head, - format: .fullyQualified, - pluralizer: config.pluralizer - ) - - return """ - \(renderAccessControl())typealias RootEntityType = \(rootEntityName) - """ - } - - private func ParentTypeTemplate(_ type: GraphQLCompositeType) -> String { - """ - \(renderAccessControl())\ - static var __parentType: \(config.ApolloAPITargetName).ParentType { \ - \(GeneratedSchemaTypeReference(type)) } - """ - } - - private func MergedSourcesTemplate(_ selectionSet: IR.SelectionSet) -> TemplateString { - return """ - public static var __mergedSources: [any \(config.ApolloAPITargetName).SelectionSet.Type] { [ - \(selectionSet.selections.merged.mergedSources.map { - let selectionSetName = SelectionSetNameGenerator.generatedSelectionSetName( - for: $0, - format: .fullyQualified, - pluralizer: config.pluralizer - ) - return "\(selectionSetName).self" - }) - ] } - """ - } - - private func GeneratedSchemaTypeReference(_ type: GraphQLCompositeType) -> TemplateString { - "\(config.schemaNamespace.firstUppercased).\(type.schemaTypesNamespace).\(type.formattedName)" - } - - // MARK: - Selections - typealias DeprecatedArgument = (field: String, arg: String, reason: String) - - private func SelectionsTemplate( - _ groupedSelections: IR.DirectSelections.GroupedByInclusionCondition, - in scope: IR.ScopeDescriptor - ) -> TemplateString { - var deprecatedArguments: [DeprecatedArgument]? = - config.options.warningsOnDeprecatedUsage == .include ? [] : nil - - let selectionsTemplate = TemplateString(""" - \(renderAccessControl())\ - static var __selections: [\(config.ApolloAPITargetName).Selection] { [ - \(if: shouldIncludeTypenameSelection(for: scope), ".field(\"__typename\", String.self),") - \(renderedSelections(groupedSelections.unconditionalSelections, &deprecatedArguments), terminator: ",") - \(groupedSelections.inclusionConditionGroups.map { - renderedConditionalSelectionGroup($0, $1, in: scope, &deprecatedArguments) - }, terminator: ",") - ] } - """) - return """ - \(if: deprecatedArguments != nil && !deprecatedArguments.unsafelyUnwrapped.isEmpty, """ - \(deprecatedArguments.unsafelyUnwrapped.map { """ - \(field: $0.field, argument: $0.arg, warningReason: $0.reason) - """}) - """) - \(selectionsTemplate) - """ - } - - private func shouldIncludeTypenameSelection(for scope: IR.ScopeDescriptor) -> Bool { - return scope.scopePath.count == 1 && !scope.type.isRootFieldType - } - - private func renderedSelections( - _ selections: IR.DirectSelections.ReadOnly, - _ deprecatedArguments: inout [DeprecatedArgument]? - ) -> [TemplateString] { - selections.fields.values.map { FieldSelectionTemplate($0, &deprecatedArguments) } + - selections.inlineFragments.values.map { InlineFragmentSelectionTemplate($0.selectionSet) } + - selections.namedFragments.values.map { FragmentSelectionTemplate($0) } - } - - private func renderedConditionalSelectionGroup( - _ conditions: AnyOf, - _ selections: IR.DirectSelections.ReadOnly, - in scope: IR.ScopeDescriptor, - _ deprecatedArguments: inout [DeprecatedArgument]? - ) -> TemplateString { - let renderedSelections = self.renderedSelections(selections, &deprecatedArguments) - guard !scope.matches(conditions) else { - return "\(renderedSelections)" - } - - let isSelectionGroup = renderedSelections.count > 1 - return """ - .include(if: \(conditions.conditionVariableExpression), \(if: isSelectionGroup, "[")\(list: renderedSelections, terminator: isSelectionGroup ? "," : nil)\(if: isSelectionGroup, "]")) - """ - } - - private func FieldSelectionTemplate( - _ field: IR.Field, - _ deprecatedArguments: inout [DeprecatedArgument]? - ) -> TemplateString { - """ - .field("\(field.name)"\ - \(ifLet: field.alias, {", alias: \"\($0)\""})\ - , \(typeName(for: field)).self\ - \(ifLet: field.arguments, - where: { !$0.isEmpty }, { args in - ", arguments: " + renderValue(for: args, onFieldNamed: field.name, &deprecatedArguments) - })\ - ) - """ - } - - private func typeName(for field: IR.Field, forceOptional: Bool = false) -> String { - let fieldName: String - switch field { - case let scalarField as IR.ScalarField: - fieldName = scalarField.type.rendered(as: .selectionSetField(), config: config.config) - - case let entityField as IR.EntityField: - fieldName = self.nameCache.selectionSetType(for: entityField) - - default: - fatalError() - } - - if case .nonNull = field.type, forceOptional { - return "\(fieldName)?" - } else { - return fieldName - } - - } - - private func renderValue( - for arguments: [CompilationResult.Argument], - onFieldNamed fieldName: String, - _ deprecatedArguments: inout [DeprecatedArgument]? - ) -> TemplateString { - """ - [\(list: arguments.map { arg -> TemplateString in - if let deprecationReason = arg.deprecationReason { - deprecatedArguments?.append((field: fieldName, arg: arg.name, reason: deprecationReason)) - } - return "\"\(arg.name)\": " + arg.value.renderInputValueLiteral() - })] - """ - } - - private func InlineFragmentSelectionTemplate(_ inlineFragment: IR.SelectionSet) -> TemplateString { - """ - .inlineFragment(\(inlineFragment.renderedTypeName).self) - """ - } - - private func FragmentSelectionTemplate(_ fragment: IR.NamedFragmentSpread) -> TemplateString { - """ - .fragment(\(fragment.definition.name.asFragmentName).self) - """ - } - - // MARK: - Accessors - private func FieldAccessorsTemplate( - _ selections: IR.SelectionSet.Selections, - in scope: IR.ScopeDescriptor - ) -> TemplateString { - """ - \(ifLet: selections.direct?.fields.values, { - "\($0.map { FieldAccessorTemplate($0, in: scope) }, separator: "\n")" - }) - \(selections.merged.fields.values.map { FieldAccessorTemplate($0, in: scope) }, separator: "\n") - """ - } - - private func FieldAccessorTemplate( - _ field: IR.Field, - in scope: IR.ScopeDescriptor - ) -> TemplateString { - return """ - \(documentation: field.underlyingField.documentation, config: config) - \(deprecationReason: field.underlyingField.deprecationReason, config: config) - \(renderAccessControl())var \(field.responseKey.renderAsFieldPropertyName(config: config.config)): \ - \(typeName(for: field, forceOptional: field.isConditionallyIncluded(in: scope))) {\ - \(if: isMutable, - """ - - get { __data["\(field.responseKey)"] } - set { __data["\(field.responseKey)"] = newValue } - } - """, else: - """ - __data["\(field.responseKey)"] } - """) - """ - } - - private func InlineFragmentAccessorsTemplate( - _ selections: IR.SelectionSet.Selections - ) -> TemplateString { - """ - \(ifLet: selections.direct?.inlineFragments.values, { - "\($0.map { InlineFragmentAccessorTemplate($0.selectionSet) }, separator: "\n")" - }) - \(selections.merged.inlineFragments.values.map { InlineFragmentAccessorTemplate($0.selectionSet) }, separator: "\n") - """ - } - - private func InlineFragmentAccessorTemplate(_ inlineFragment: IR.SelectionSet) -> TemplateString { - let typeName = inlineFragment.renderedTypeName - return """ - \(renderAccessControl())var \(typeName.firstLowercased): \(typeName)? {\ - \(if: isMutable, - """ - - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - """, - else: " _asInlineFragment() }" - ) - """ - } - - private func FragmentAccessorsTemplate( - _ selections: IR.SelectionSet.Selections, - in scope: IR.ScopeDescriptor - ) -> TemplateString { - guard !(selections.direct?.namedFragments.isEmpty ?? true) || - !selections.merged.namedFragments.isEmpty else { - return "" - } - - return """ - \(renderAccessControl())struct Fragments: FragmentContainer { - \(DataFieldAndInitializerTemplate()) - - \(ifLet: selections.direct?.namedFragments.values, { - "\($0.map { NamedFragmentAccessorTemplate($0, in: scope) }, separator: "\n")" - }) - \(selections.merged.namedFragments.values.map { - NamedFragmentAccessorTemplate($0, in: scope) - }, separator: "\n") - } - """ - } - - private func NamedFragmentAccessorTemplate( - _ fragment: IR.NamedFragmentSpread, - in scope: IR.ScopeDescriptor - ) -> TemplateString { - let name = fragment.definition.name - let propertyName = name.firstLowercased - let typeName = name.asFragmentName - let isOptional = fragment.inclusionConditions != nil && - !scope.matches(fragment.inclusionConditions.unsafelyUnwrapped) - - return """ - \(renderAccessControl())var \(propertyName): \(typeName)\ - \(if: isOptional, "?") {\ - \(if: isMutable, - """ - - get { _toFragment() } - _modify { var f = \(propertyName); yield &f; \( - if: isOptional, - "if let newData = f?.__data { __data = newData }", - else: "__data = f.__data" - ) } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } - } - """, - else: " _toFragment() }" - ) - """ - } - - // MARK: - SelectionSet Initializer - - private func InitializerTemplate(_ selectionSet: IR.SelectionSet) -> TemplateString { - return """ - \(renderAccessControl())init( - \(InitializerSelectionParametersTemplate(selectionSet)) - ) { - self.init(_dataDict: DataDict( - data: [ - \(InitializerDataDictTemplate(selectionSet)) - ], - fulfilledFragments: \(InitializerFulfilledFragments(selectionSet)) - )) - } - """ - } - - private func InitializerSelectionParametersTemplate( - _ selectionSet: IR.SelectionSet - ) -> TemplateString { - let isConcreteType = selectionSet.parentType is GraphQLObjectType - let allFields = selectionSet.selections.makeFieldIterator() - - return TemplateString(""" - \(if: !isConcreteType, "__typename: String\(if: !allFields.isEmpty, ",")") - \(IteratorSequence(allFields).map({ - InitializerParameterTemplate($0, scope: selectionSet.scope) - })) - """ - ) - } - - private func InitializerParameterTemplate( - _ field: IR.Field, - scope: IR.ScopeDescriptor - ) -> TemplateString { - let isOptional: Bool = field.type.isNullable || field.isConditionallyIncluded(in: scope) - return """ - \(field.responseKey.renderAsFieldPropertyName(config: config.config)): \(typeName(for: field, forceOptional: isOptional))\ - \(if: isOptional, " = nil") - """ - } - - private func InitializerDataDictTemplate( - _ selectionSet: IR.SelectionSet - ) -> TemplateString { - let isConcreteType = selectionSet.parentType is GraphQLObjectType - let allFields = selectionSet.selections.makeFieldIterator() - - return TemplateString(""" - "__typename": \ - \(if: isConcreteType, - "\(GeneratedSchemaTypeReference(selectionSet.parentType)).typename,", - else: "__typename,") - \(IteratorSequence(allFields).map(InitializerDataDictFieldTemplate(_:)), terminator: ",") - """ - ) - } - - private func InitializerDataDictFieldTemplate( - _ field: IR.Field - ) -> TemplateString { - let isEntityField: Bool = { - switch field.type.innerType { - case .entity: return true - default: return false - } - }() - - return """ - "\(field.responseKey)": \(field.responseKey.renderAsFieldPropertyName(config: config.config))\ - \(if: isEntityField, "._fieldData") - """ - } - - private func InitializerFulfilledFragments( - _ selectionSet: IR.SelectionSet - ) -> TemplateString { - var fulfilledFragments: OrderedSet = [] - - var currentNode = Optional(selectionSet.scopePath.last.value.scopePath.head) - while let node = currentNode { - defer { currentNode = node.next } - - let selectionSetName = SelectionSetNameGenerator.generatedSelectionSetName( - for: selectionSet, - to: node, - format: .fullyQualified, - pluralizer: config.pluralizer - ) - - fulfilledFragments.append(selectionSetName) - } - - for source in selectionSet.selections.merged.mergedSources { - fulfilledFragments - .append(contentsOf: source.generatedSelectionSetNamesOfFullfilledFragments( - pluralizer: config.pluralizer - )) - } - - return """ - [ - \(fulfilledFragments.map { "ObjectIdentifier(\($0).self)" }) - ] - """ - } - - // MARK: - Nested Selection Sets - private func ChildEntityFieldSelectionSets( - _ selections: IR.SelectionSet.Selections - ) -> TemplateString { - """ - \(ifLet: selections.direct?.fields.values.compactMap { $0 as? IR.EntityField }, { - "\($0.map { render(field: $0) }, separator: "\n\n")" - }) - \(selections.merged.fields.values.compactMap { field -> String? in - guard let field = field as? IR.EntityField, - field.selectionSet.shouldBeRendered else { return nil } - return render(field: field) - }, separator: "\n\n") - """ - } - - private func ChildTypeCaseSelectionSets(_ selections: IR.SelectionSet.Selections) -> TemplateString { - """ - \(ifLet: selections.direct?.inlineFragments.values, { - "\($0.map { render(inlineFragment: $0.selectionSet) }, separator: "\n\n")" - }) - \(selections.merged.inlineFragments.values.map { render(inlineFragment: $0.selectionSet) }, separator: "\n\n") - """ - } - -} - -// MARK: - SelectionSet Name Computation - -fileprivate class SelectionSetNameCache { - private var generatedSelectionSetNames: [ObjectIdentifier: String] = [:] - - let config: ApolloCodegen.ConfigurationContext - - init(config: ApolloCodegen.ConfigurationContext) { - self.config = config - } - - func selectionSetName(for selectionSet: IR.SelectionSet) -> String { - let objectId = ObjectIdentifier(selectionSet) - if let name = generatedSelectionSetNames[objectId] { return name } - - let name = computeGeneratedSelectionSetName(for: selectionSet) - generatedSelectionSetNames[objectId] = name - return name - } - - // MARK: Entity Field - func selectionSetName(for field: IR.EntityField) -> String { - return selectionSetName(for: field.selectionSet) - } - - func selectionSetType(for field: IR.EntityField) -> String { - field.type.rendered( - as: .selectionSetField(), - replacingNamedTypeWith: selectionSetName(for: field), - config: config.config - ) - } - - // MARK: Name Computation - func computeGeneratedSelectionSetName(for selectionSet: IR.SelectionSet) -> String { - if selectionSet.shouldBeRendered { - let location = selectionSet.entity.location - return location.fieldPath?.last.value - .formattedSelectionSetName(with: config.pluralizer) ?? - location.source.formattedSelectionSetName() - - } else { - return selectionSet.selections.merged.mergedSources - .first.unsafelyUnwrapped - .generatedSelectionSetNamePath( - from: selectionSet.typeInfo, - pluralizer: config.pluralizer - ) - } - } -} - -// MARK: - Helper Extensions - -fileprivate extension IR.SelectionSet { - - /// Indicates if the SelectionSet should be rendered by the template engine. - /// - /// If `false`, references to the selection set can point to another rendered selection set. - /// Use `nameCache.selectionSetName(for:)` to get the name of the rendered selection set that - /// should be referenced. - var shouldBeRendered: Bool { - return selections.direct != nil || selections.merged.mergedSources.count != 1 - } - - var renderedTypeName: String { - self.scope.scopePath.last.value.selectionSetNameComponent - } - - var isCompositeSelectionSet: Bool { - return selections.direct?.isEmpty ?? true - } - - var isCompositeInlineFragment: Bool { - return !self.isEntityRoot && isCompositeSelectionSet - } - -} - -fileprivate extension IR.MergedSelections.MergedSource { - - func generatedSelectionSetNamePath( - from targetTypeInfo: IR.SelectionSet.TypeInfo, - pluralizer: Pluralizer - ) -> String { - if let fragment = fragment { - return generatedSelectionSetNameForMergedEntity( - in: fragment, - pluralizer: pluralizer - ) - } - - var targetTypePathCurrentNode = targetTypeInfo.scopePath.last - var sourceTypePathCurrentNode = typeInfo.scopePath.last - var nodesToSharedRoot = 0 - - while targetTypePathCurrentNode.value == sourceTypePathCurrentNode.value { - guard let previousFieldNode = targetTypePathCurrentNode.previous, - let previousSourceNode = sourceTypePathCurrentNode.previous else { - break - } - - targetTypePathCurrentNode = previousFieldNode - sourceTypePathCurrentNode = previousSourceNode - nodesToSharedRoot += 1 - } - - /// If the shared root is the root of the definition, we should just generate the fully - /// qualified name. - if sourceTypePathCurrentNode.isHead { - return SelectionSetNameGenerator.generatedSelectionSetName( - for: self, format: .fullyQualified, pluralizer: pluralizer - ) - } - - let sharedRootIndex = - typeInfo.entity.location.fieldPath!.count - (nodesToSharedRoot + 1) - - /// We should remove the first component if the shared root is the previous scope and that - /// scope is not the root of the entity. - /// - /// This is because the selection set will be a direct sibling of the current selection set. - /// - /// Example: The `height` field on `AllAnimals.AsPet` can reference the `AllAnimals.Height` - /// object as just `Height`. - let removeFirstComponent = nodesToSharedRoot <= 1 - - let fieldPath = typeInfo.entity.location.fieldPath!.node( - at: max(0, sharedRootIndex) - ) - - let selectionSetName = SelectionSetNameGenerator.generatedSelectionSetName( - from: sourceTypePathCurrentNode, - withFieldPath: fieldPath, - removingFirst: removeFirstComponent, - pluralizer: pluralizer - ) - - return selectionSetName - } - - private func generatedSelectionSetNameForMergedEntity( - in fragment: IR.NamedFragment, - pluralizer: Pluralizer - ) -> String { - var selectionSetNameComponents: [String] = [fragment.generatedDefinitionName] - - let rootEntityScopePath = typeInfo.scopePath.head - if let rootEntityTypeConditionPath = rootEntityScopePath.value.scopePath.head.next { - selectionSetNameComponents.append( - SelectionSetNameGenerator.ConditionPath.path(for: rootEntityTypeConditionPath) - ) - } - - if let fragmentNestedTypePath = rootEntityScopePath.next { - let fieldPath = typeInfo.entity.location - .fieldPath! - .head - - selectionSetNameComponents.append( - SelectionSetNameGenerator.generatedSelectionSetName( - from: fragmentNestedTypePath, - withFieldPath: fieldPath, - pluralizer: pluralizer - ) - ) - } - - return selectionSetNameComponents.joined(separator: ".") - } - - func generatedSelectionSetNamesOfFullfilledFragments( - pluralizer: Pluralizer - ) -> [String] { - let entityRootNameInFragment = SelectionSetNameGenerator - .generatedSelectionSetName( - for: self, - to: typeInfo.scopePath.last.value.scopePath.head, - format: .fullyQualified, - pluralizer: pluralizer - ) - - var fulfilledFragments: [String] = [entityRootNameInFragment] - - var selectionSetNameComponents: [String] = [entityRootNameInFragment] - - var mergedFragmentEntityConditionPathNode = typeInfo.scopePath.last.value.scopePath.head - while let node = mergedFragmentEntityConditionPathNode.next { - defer { - mergedFragmentEntityConditionPathNode = node - } - selectionSetNameComponents.append( - node.value.selectionSetNameComponent - ) - fulfilledFragments.append(selectionSetNameComponents.joined(separator: ".")) - } - return fulfilledFragments - } - -} - -fileprivate struct SelectionSetNameGenerator { - - enum Format { - /// Fully qualifies the name of the selection set including the name of the enclosing - /// operation or fragment. - case fullyQualified - /// Omits the root entity selection set name - /// (ie. the name of the enclosing operation or fragment). - case omittingRoot - } - - static func generatedSelectionSetName( - for selectionSet: IR.SelectionSet, - to toNode: LinkedList.Node? = nil, - format: Format, - pluralizer: Pluralizer - ) -> String { - generatedSelectionSetName( - for: selectionSet.typeInfo, - to: toNode, - format: format, - pluralizer: pluralizer - ) - } - - static func generatedSelectionSetName( - for mergedSource: IR.MergedSelections.MergedSource, - to toNode: LinkedList.Node? = nil, - format: Format, - pluralizer: Pluralizer - ) -> String { - generatedSelectionSetName( - for: mergedSource.typeInfo, - to: toNode, - format: format, - pluralizer: pluralizer - ) - } - - private static func generatedSelectionSetName( - for typeInfo: IR.SelectionSet.TypeInfo, - to toNode: LinkedList.Node? = nil, - format: Format, - pluralizer: Pluralizer - ) -> String { - var components: [String] = [] - - if case .fullyQualified = format { - // The root entity, which represents the operation or fragment root, will use the fully - // qualified name of the operation/fragment. - let sourceName: String = { - switch typeInfo.entity.location.source { - case let .operation(operation): - return "\(operation.generatedDefinitionName).Data" - case let .namedFragment(fragment): - return fragment.generatedDefinitionName - } - }() - components.append(sourceName) - } - - let entityFieldPath = SelectionSetNameGenerator.generatedSelectionSetName( - from: typeInfo.scopePath.head, - to: toNode, - withFieldPath: typeInfo.entity.location.fieldPath?.head, - pluralizer: pluralizer - ) - if !entityFieldPath.isEmpty { - components.append(entityFieldPath) - } - - // Join all the computed components to get the fully qualified name. - return components.joined(separator: ".") - } - - static func generatedSelectionSetName( - from typePathNode: LinkedList.Node, - to endingNode: LinkedList.Node? = nil, - withFieldPath fieldPathNode: IR.Entity.Location.FieldPath.Node?, - removingFirst: Bool = false, - pluralizer: Pluralizer - ) -> String { - // Set up starting nodes - var currentTypePathNode = Optional(typePathNode) - var currentConditionNode = Optional(typePathNode.value.scopePath.head) - // Because the Location's field path starts on the first field (not the location's source), - // If the typePath is starting from the root entity (ie. is the list's head node, we do not - // start using the field path until the second entity node. - var currentFieldPathNode: IR.Entity.Location.FieldPath.Node? = - typePathNode.isHead ? nil : fieldPathNode - - func advanceToNextEntity() { - // Set the current nodes to the root node of the next entity. - currentTypePathNode = currentTypePathNode.unsafelyUnwrapped.next - currentConditionNode = currentTypePathNode?.value.scopePath.head - currentFieldPathNode = currentFieldPathNode?.next ?? fieldPathNode - } - - var components: [String] = [] - - iterateEntityScopes: repeat { - // For the root node of the entity, we use the name of the field in the entity's field path. - if let fieldName = currentFieldPathNode?.value - .formattedSelectionSetName(with: pluralizer) { - components.append(fieldName) - } - - // If the ending node is the root of this entity, then we are done. - // (We've already added the root of the entity to the components by using the fieldName) - guard currentConditionNode !== endingNode else { - break iterateEntityScopes - } - - // If the current entity has conditions in it's scope path, we add those. - currentConditionNode = currentTypePathNode.unsafelyUnwrapped.value.scopePath.head.next - iterateConditionScopes: while currentConditionNode !== nil { - let node = currentConditionNode.unsafelyUnwrapped - - components.append(node.value.selectionSetNameComponent) - guard node !== endingNode else { - break iterateEntityScopes - } - - currentConditionNode = node.next - } - - advanceToNextEntity() - } while currentTypePathNode !== nil - - if removingFirst && !components.isEmpty { components.removeFirst() } - - return components.joined(separator: ".") - } - - fileprivate struct ConditionPath { - static func path(for conditions: LinkedList.Node) -> String { - conditions.map(\.selectionSetNameComponent).joined(separator: ".") - } - } -} - -fileprivate extension IR.ScopeCondition { - - var selectionSetNameComponent: String { - return TemplateString(""" - \(ifLet: type, { "As\($0.formattedName)" })\ - \(ifLet: conditions, { "If\($0.typeNameComponents)"}) - """).description - } - -} - -fileprivate extension AnyOf where T == IR.InclusionConditions { - var conditionVariableExpression: TemplateString { - """ - \(elements.map { - $0.conditionVariableExpression(wrapInParenthesisIfMultiple: elements.count > 1) - }, separator: " || ") - """ - } -} - -fileprivate extension IR.InclusionConditions { - func conditionVariableExpression(wrapInParenthesisIfMultiple: Bool = false) -> TemplateString { - let shouldWrap = wrapInParenthesisIfMultiple && count > 1 - return """ - \(if: shouldWrap, "(")\(map(\.conditionVariableExpression), separator: " && ")\(if: shouldWrap, ")") - """ - } - - var typeNameComponents: TemplateString { - """ - \(map(\.typeNameComponent), separator: "And") - """ - } -} - -fileprivate extension IR.InclusionCondition { - var conditionVariableExpression: TemplateString { - """ - \(if: isInverted, "!")"\(variable)" - """ - } - - var typeNameComponent: TemplateString { - """ - \(if: isInverted, "Not")\(variable.firstUppercased) - """ - } -} - -fileprivate extension IR.Field { - var isCustomScalar: Bool { - guard let scalar = self.type.namedType as? GraphQLScalarType else { return false } - - return scalar.isCustomScalar - } - - func isConditionallyIncluded(in scope: IR.ScopeDescriptor) -> Bool { - guard let conditions = self.inclusionConditions else { return false } - return !scope.matches(conditions) - } -} - -extension IR.SelectionSet.Selections { - fileprivate func makeFieldIterator() -> SelectionsIterator { - SelectionsIterator(direct: direct?.fields, merged: merged.fields) - } - - fileprivate func makeFragmentIterator() -> SelectionsIterator { - SelectionsIterator(direct: direct?.namedFragments, merged: merged.namedFragments) - } - - fileprivate struct SelectionsIterator: IteratorProtocol { - typealias SelectionDictionary = OrderedDictionary - - private let direct: SelectionDictionary? - private let merged: SelectionDictionary - private var directIterator: IndexingIterator? - private var mergedIterator: IndexingIterator - - fileprivate init( - direct: SelectionDictionary?, - merged: SelectionDictionary - ) { - self.direct = direct - self.merged = merged - self.directIterator = self.direct?.values.makeIterator() - self.mergedIterator = self.merged.values.makeIterator() - } - - mutating func next() -> SelectionType? { - directIterator?.next() ?? mergedIterator.next() - } - - var isEmpty: Bool { - return (direct?.isEmpty ?? true) && merged.isEmpty - } - - } -} diff --git a/Sources/ApolloCodegenLib/Templates/SwiftPackageManagerModuleTemplate.swift b/Sources/ApolloCodegenLib/Templates/SwiftPackageManagerModuleTemplate.swift deleted file mode 100644 index ad5cc82a16..0000000000 --- a/Sources/ApolloCodegenLib/Templates/SwiftPackageManagerModuleTemplate.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation - -/// Provides the format to define a Swift Package Manager module in Swift code. The output must -/// conform to the [configuration definition of a Swift package](https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#). -struct SwiftPackageManagerModuleTemplate: TemplateRenderer { - - let testMockConfig: ApolloCodegenConfiguration.TestMockFileOutput - - let target: TemplateTarget = .moduleFile - - let headerTemplate: TemplateString? = nil - - let config: ApolloCodegen.ConfigurationContext - - var template: TemplateString { - let casedSchemaNamespace = config.schemaNamespace.firstUppercased - - return TemplateString(""" - // swift-tools-version:5.7 - - import PackageDescription - - let package = Package( - name: "\(casedSchemaNamespace)", - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - products: [ - .library(name: "\(casedSchemaNamespace)", targets: ["\(casedSchemaNamespace)"]), - \(ifLet: testMockTarget(), { """ - .library(name: "\($0.targetName)", targets: ["\($0.targetName)"]), - """}) - ], - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - targets: [ - .target( - name: "\(casedSchemaNamespace)", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - \(ifLet: testMockTarget(), { """ - .target( - name: "\($0.targetName)", - dependencies: [ - .product(name: "ApolloTestSupport", package: "apollo-ios"), - .target(name: "\(casedSchemaNamespace)"), - ], - path: "\($0.path)" - ), - """}) - ] - ) - - """) - } - - private func testMockTarget() -> (targetName: String, path: String)? { - switch testMockConfig { - case .none, .absolute: - return nil - case let .swiftPackage(targetName): - if let targetName = targetName { - return (targetName.firstUppercased, "./\(targetName.firstUppercased)") - } else { - return ("\(config.schemaNamespace.firstUppercased)TestMocks", "./TestMocks") - } - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/TemplateRenderer.swift b/Sources/ApolloCodegenLib/Templates/TemplateRenderer.swift deleted file mode 100644 index f17b50eb42..0000000000 --- a/Sources/ApolloCodegenLib/Templates/TemplateRenderer.swift +++ /dev/null @@ -1,309 +0,0 @@ -// MARK: TemplateRenderer - -/// Defines the file target of the template. -enum TemplateTarget: Equatable { - /// Used in schema types files; enum, input object, union, etc. - case schemaFile(type: SchemaFileType) - /// Used in operation files; query, mutation, fragment, etc. - case operationFile - /// Used in files that define a module; Swift Package Manager, etc. - case moduleFile - /// Used in test mock files; schema object `Mockable` extensions - case testMockFile - - enum SchemaFileType: Equatable { - case schemaMetadata - case schemaConfiguration - case object - case interface - case union - case `enum` - case customScalar - case inputObject - - var namespaceComponent: String? { - switch self { - case .schemaMetadata, .enum, .customScalar, .inputObject, .schemaConfiguration: - return nil - case .object: - return "Objects" - case .interface: - return "Interfaces" - case .union: - return "Unions" - } - } - } -} - -/// A protocol to handle the rendering of a file template based on the target file type and -/// codegen configuration. -/// -/// All templates that output to a file should conform to this protocol, this does not include -/// templates that are used by others such as `HeaderCommentTemplate` or `ImportStatementTemplate`. -protocol TemplateRenderer { - /// File target of the template. - var target: TemplateTarget { get } - /// The template for the header to render. - var headerTemplate: TemplateString? { get } - /// A template that must be rendered outside of any namespace wrapping. - var detachedTemplate: TemplateString? { get } - /// A template that can be rendered within any namespace wrapping. - var template: TemplateString { get } - /// Shared codegen configuration. - var config: ApolloCodegen.ConfigurationContext { get } -} - -// MARK: Extension - File rendering - -extension TemplateRenderer { - - var headerTemplate: TemplateString? { - TemplateString(HeaderCommentTemplate.template.description) - } - - var detachedTemplate: TemplateString? { nil } - - /// Renders the template converting all input values and generating a final String - /// representation of the template. - /// - /// - Parameter config: Shared codegen configuration. - /// - Returns: Swift code derived from the template format. - func render() -> String { - switch target { - case let .schemaFile(type): return renderSchemaFile(type) - case .operationFile: return renderOperationFile() - case .moduleFile: return renderModuleFile() - case .testMockFile: return renderTestMockFile() - } - } - - private func renderSchemaFile(_ type: TemplateTarget.SchemaFileType) -> String { - let namespace: String? = { - if case .schemaConfiguration = type { - return nil - } - - let useSchemaNamespace = !config.output.schemaTypes.isInModule - switch (useSchemaNamespace, type.namespaceComponent) { - case (false, nil): - return nil - case (true, nil): - return config.schemaNamespace.firstUppercased - case let (false, .some(schemaTypeNamespace)): - return schemaTypeNamespace - case let (true, .some(schemaTypeNamespace)): - return "\(config.schemaNamespace.firstUppercased).\(schemaTypeNamespace)" - } - }() - - return TemplateString( - """ - \(ifLet: headerTemplate, { "\($0)\n" }) - \(ImportStatementTemplate.SchemaType.template(for: config)) - - \(ifLet: detachedTemplate, { "\($0)\n" }) - \(ifLet: namespace, { template.wrappedInNamespace($0, accessModifier: accessControlModifier(for: .namespace)) }, else: template) - """ - ).description - } - - private func renderOperationFile() -> String { - TemplateString( - """ - \(ifLet: headerTemplate, { "\($0)\n" }) - \(ImportStatementTemplate.Operation.template(for: config)) - - \(if: config.output.operations.isInModule && !config.output.schemaTypes.isInModule, - template.wrappedInNamespace( - config.schemaNamespace.firstUppercased, - accessModifier: accessControlModifier(for: .namespace) - ), else: - template) - """ - ).description - } - - private func renderModuleFile() -> String { - TemplateString( - """ - \(ifLet: headerTemplate, { "\($0)\n" }) - \(template) - """ - ).description - } - - private func renderTestMockFile() -> String { - TemplateString( - """ - \(ifLet: headerTemplate, { "\($0)\n" }) - \(ImportStatementTemplate.TestMock.template(for: config)) - - \(template) - """ - ).description - } -} - -// MARK: Extension - Access modifier - -fileprivate extension ApolloCodegenConfiguration.AccessModifier { - var swiftString: String { - switch self { - case .public: return "public " // there should be no spaces in these strings - case .internal: return "" - } - } -} - -enum AccessControlScope { - case namespace - case parent - case member -} - -extension TemplateRenderer { - var classDefinitionKeywords: String { config.options.markOperationDefinitionsAsFinal ? "final class" : "class" } - - func accessControlModifier(for scope: AccessControlScope) -> String { - switch target { - case .moduleFile, .schemaFile: return schemaAccessControlModifier(scope: scope) - case .operationFile: return operationAccessControlModifier(scope: scope) - case .testMockFile: return testMockAccessControlModifier(scope: scope) - } - } - - private func schemaAccessControlModifier( - scope: AccessControlScope - ) -> String { - switch (config.output.schemaTypes.moduleType, scope) { - case (.embeddedInTarget, .parent): - return "" - case - (.embeddedInTarget(_, .public), .namespace), - (.embeddedInTarget(_, .public), .member): - return ApolloCodegenConfiguration.AccessModifier.public.swiftString - case - (.embeddedInTarget(_, .internal), .namespace), - (.embeddedInTarget(_, .internal), .member): - return ApolloCodegenConfiguration.AccessModifier.internal.swiftString - case - (.swiftPackageManager, _), - (.other, _): - return ApolloCodegenConfiguration.AccessModifier.public.swiftString - } - } - - private func operationAccessControlModifier( - scope: AccessControlScope - ) -> String { - switch (config.output.operations, scope) { - case (.inSchemaModule, _): - return schemaAccessControlModifier(scope: scope) - case - (.absolute(_, .public), _), - (.relative(_, .public), _): - return ApolloCodegenConfiguration.AccessModifier.public.swiftString - case - (.absolute(_, .internal), _), - (.relative(_, .internal), _): - return ApolloCodegenConfiguration.AccessModifier.internal.swiftString - } - } - - private func testMockAccessControlModifier( - scope: AccessControlScope - ) -> String { - switch (config.config.output.testMocks, scope) { - case (.none, _): - return "" - case (.absolute(_, .internal), _): - return ApolloCodegenConfiguration.AccessModifier.internal.swiftString - case - (.swiftPackage, _), - (.absolute(_, .public), _): - return ApolloCodegenConfiguration.AccessModifier.public.swiftString - } - } -} - -// MARK: Extension - Namespace - -extension TemplateString { - /// Wraps `self` in an extension on `namespace`. - fileprivate func wrappedInNamespace(_ namespace: String, accessModifier: String) -> Self { - TemplateString( - """ - \(accessModifier)extension \(namespace) { - \(self) - } - """ - ) - } -} - -// MARK: - Header Comment Template - -/// Provides the format to identify a file as automatically generated. -struct HeaderCommentTemplate { - static let template: StaticString = - """ - // @generated - // This file was automatically generated and should not be edited. - """ - - static func editableFileHeader(fileCanBeEditedTo reason: TemplateString) -> TemplateString { - """ - // @generated - // This file was automatically generated and can be edited to - \(comment: reason.description) - // - // Any changes to this file will not be overwritten by future - // code generation execution. - """ - } -} - -// MARK: Import Statement Template - -/// Provides the format to import Swift modules required by the template type. -struct ImportStatementTemplate { - - enum SchemaType { - static func template( - for config: ApolloCodegen.ConfigurationContext - ) -> String { - "import \(config.ApolloAPITargetName)" - } - } - - enum Operation { - static func template( - for config: ApolloCodegen.ConfigurationContext - ) -> TemplateString { - let apolloAPITargetName = config.ApolloAPITargetName - return """ - @_exported import \(apolloAPITargetName) - \(if: config.output.operations != .inSchemaModule, "import \(config.schemaModuleName)") - """ - } - } - - enum TestMock { - static func template(for config: ApolloCodegen.ConfigurationContext) -> TemplateString { - return """ - import \(config.options.cocoapodsCompatibleImportStatements ? "Apollo" : "ApolloTestSupport") - import \(config.schemaModuleName) - """ - } - } -} - -fileprivate extension ApolloCodegenConfiguration { - var schemaModuleName: String { - switch output.schemaTypes.moduleType { - case let .embeddedInTarget(targetName, _): return targetName - case .swiftPackageManager, .other: return schemaNamespace.firstUppercased - } - } -} diff --git a/Sources/ApolloCodegenLib/Templates/UnionTemplate.swift b/Sources/ApolloCodegenLib/Templates/UnionTemplate.swift deleted file mode 100644 index d1476b31ab..0000000000 --- a/Sources/ApolloCodegenLib/Templates/UnionTemplate.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation - -/// Provides the format to convert a [GraphQL Union](https://spec.graphql.org/draft/#sec-Unions) -/// into Swift code. -struct UnionTemplate: TemplateRenderer { - /// IR representation of source [GraphQL Union](https://spec.graphql.org/draft/#sec-Unions). - let graphqlUnion: GraphQLUnionType - - let config: ApolloCodegen.ConfigurationContext - - let target: TemplateTarget = .schemaFile(type: .union) - - var template: TemplateString { - TemplateString( - """ - \(documentation: graphqlUnion.documentation, config: config) - static let \(graphqlUnion.formattedName) = Union( - name: "\(graphqlUnion.name)", - possibleTypes: \(PossibleTypesTemplate()) - ) - """ - ) - } - - private func PossibleTypesTemplate() -> TemplateString { - "[\(list: graphqlUnion.types.map(PossibleTypeTemplate))]" - } - - private func PossibleTypeTemplate( - _ type: GraphQLObjectType - ) -> TemplateString { - """ - \(if: !config.output.schemaTypes.isInModule, "\(config.schemaNamespace.firstUppercased).")\ - Objects.\(type.formattedName).self - """ - } - -} diff --git a/Sources/ApolloCodegenLib/URL+Apollo.swift b/Sources/ApolloCodegenLib/URL+Apollo.swift deleted file mode 100644 index 7b2fee8ef8..0000000000 --- a/Sources/ApolloCodegenLib/URL+Apollo.swift +++ /dev/null @@ -1,58 +0,0 @@ -import Foundation - -public enum ApolloURLError: Error, LocalizedError { - case fileNameIsEmpty - - public var errorDescription: String? { - switch self { - case .fileNameIsEmpty: - return "The file name for this file URL was empty. Please pass a non-empty string." - } - } -} - -extension URL { - - /// Determines if the URL passed in is a directory URL. - /// - /// NOTE: Only works if something at the URL already exists. - /// - /// - Returns: True if the URL is a directory URL, false if it isn't. - var isDirectoryURL: Bool { - guard - let resourceValues = try? resourceValues(forKeys: [.isDirectoryKey]), - let isDirectory = resourceValues.isDirectory else { - return false - } - - return isDirectory - } - - var isSwiftFileURL: Bool { - pathExtension == "swift" - } - - /// - Returns: the URL to the parent folder of the current URL. - public func parentFolderURL() -> URL { - deletingLastPathComponent() - } - - /// - Parameter folderName: The name of the child folder to append to the current URL - /// - Returns: The full URL including the appended child folder. - public func childFolderURL(folderName: String) -> URL { - appendingPathComponent(folderName, isDirectory: true) - } - - /// Adds the filename to the caller to get the full URL of a file - /// - /// - Parameters: - /// - fileName: The name of the child file, with an extension, for example `"API.swift"`. Note: For hidden files just pass `".filename"`. - /// - Returns: The full URL including the full file. - public func childFileURL(fileName: String) throws -> URL { - guard !fileName.isEmpty else { - throw ApolloURLError.fileNameIsEmpty - } - - return appendingPathComponent(fileName, isDirectory: false) - } -} diff --git a/Sources/ApolloCodegenLib/URLDownloader.swift b/Sources/ApolloCodegenLib/URLDownloader.swift deleted file mode 100644 index 63303a5b58..0000000000 --- a/Sources/ApolloCodegenLib/URLDownloader.swift +++ /dev/null @@ -1,139 +0,0 @@ -import Foundation - -/// A protocol to abstract the underlying network provider. -protocol NetworkSession { - - /// Load data via the abstracted network provider - /// - /// - Parameters: - /// - urlRequest: A URL request object that provides the URL, cache policy, request type, - /// body data or body stream, and so on. - /// - completionHandler: The completion handler to call when the load request is complete. - /// - Returns: The new session data task. This task will already have been started with a call - /// to `resume`. - @discardableResult func loadData( - with urlRequest: URLRequest, - completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void - ) -> URLSessionDataTask? -} - -extension URLSession: NetworkSession { - func loadData( - with urlRequest: URLRequest, - completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void - ) -> URLSessionDataTask? { - let task = dataTask(with: urlRequest) { (data, response, error) in - completionHandler(data, response, error) - } - task.resume() - - return task - } -} - -/// A class to help download things from a given remote URL to a given local file URL -class URLDownloader { - let session: NetworkSession - - enum DownloadError: Error, LocalizedError { - case badResponse(code: Int, response: String?) - case emptyDataReceived - case noDataReceived - case downloadTimedOut(after: Double) - case responseNotHTTPResponse - - var errorDescription: String? { - switch self { - case .badResponse(let code, let response): - return "Received bad response from server (code \(code)): \(String(describing: response))" - case .emptyDataReceived: - return "Empty data was received from the server." - case .noDataReceived: - return "No data was received from the server." - case .downloadTimedOut(let seconds): - return "Download timed out after \(seconds) seconds." - case .responseNotHTTPResponse: - return "The response was not an HTTP Response, something's gone very wonky." - } - } - } - - /// Designated initializer. - /// - /// - Parameters: - /// - session: The NetworkSession conforming instance used for downloads, defaults to the - /// shared URLSession singleton object. - init(session: NetworkSession = URLSession.shared) { - self.session = session - } - - /// Downloads the contents of a given URL synchronously to the given output URL - /// - Parameters: - /// - urlRequest: A URL request object that provides the URL, cache policy, request type, - /// body data or body stream, and so on. - /// - outputURL: The file URL where the result will be written to. - /// - timeout: The timeout value for the download request duration. - /// - Throws: Any error which occurs during the download. - func downloadSynchronously( - _ request: URLRequest, - to outputURL: URL, - timeout: Double - ) throws { - let semaphore = DispatchSemaphore(value: 0) - var errorToThrow: Error? = DownloadError.downloadTimedOut(after: timeout) - - session.loadData(with: request) { data, response, error in - func finished(_ error: Error? = nil) { - errorToThrow = error - semaphore.signal() - } - - if let error = error { - finished(error) - return - } - - guard let httpResponse = response as? HTTPURLResponse else { - finished(DownloadError.responseNotHTTPResponse) - return - } - - guard httpResponse.statusCode == 200 else { - let dataAsString = String(bytes: data ?? Data(), encoding: .utf8) - finished(DownloadError.badResponse( - code: httpResponse.statusCode, - response: dataAsString) - ) - return - } - - guard let data = data else { - finished(DownloadError.noDataReceived) - return - } - - guard !data.isEmpty else { - finished(DownloadError.emptyDataReceived) - return - } - - do { - try ApolloFileManager.default.createContainingDirectoryIfNeeded(forPath: outputURL.path) - try data.write(to: outputURL) - - } catch (let writeError) { - finished(writeError) - return - } - - // If we got here, it all worked and it's good to go! - finished() - } - - _ = semaphore.wait(timeout: .now() + timeout) - - if let throwMe = errorToThrow { - throw throwMe - } // else, success! - } -} diff --git a/Sources/ApolloCodegenLib/UntypedGraphQLRequestBodyCreator.swift b/Sources/ApolloCodegenLib/UntypedGraphQLRequestBodyCreator.swift deleted file mode 100644 index 083129ae39..0000000000 --- a/Sources/ApolloCodegenLib/UntypedGraphQLRequestBodyCreator.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation - -class UntypedGraphQLRequestBodyCreator { - - /// A non-type-safe request creator to facilitate sending requests not using code generation. - /// - /// - Parameters: - /// - operationDocument: The query/mutation/subscription document, as a string - /// - variables: [optional] Any variables to send with the operation - /// - operationName: The name of the operation being sent - /// - sendQueryDocument: If the query document should be sent - defaults to true. - /// - sendOperationIdentifiers: If operation identifers should be sent. Defaults to false - /// - operationIdentifier: [Optional] The operation identifier to use, defaults to nil - /// - autoPersistQuery: Whether the query should be auto-persisted, defaults to false. - /// - Returns: The body for the given request, ready to be added as the `httpBody`. - static func requestBody(for operationDocument: String, - variables: [String: Any]?, - operationName: String, - sendQueryDocument: Bool = true, - sendOperationIdentifiers: Bool = false, - operationIdentifier: String? = nil, - autoPersistQuery: Bool = false) -> [String: Any?] { - - var body: [String: Any?] = [ - "variables": variables, - "operationName": operationName, - ] - - if sendOperationIdentifiers { - guard let operationIdentifier = operationIdentifier else { - preconditionFailure("To send operation identifiers, Apollo types must be generated with operationIdentifiers") - } - - body["id"] = operationIdentifier - } - - if sendQueryDocument { - body["query"] = operationDocument - } - - if autoPersistQuery { - guard let operationIdentifier = operationIdentifier else { - preconditionFailure("To enable `autoPersistQueries`, Apollo types must be generated with operationIdentifiers") - } - - body["extensions"] = [ - "persistedQuery" : ["sha256Hash": operationIdentifier, "version": 1] as [String : Any] - ] - } - - return body - } -} diff --git a/Sources/ApolloSQLite/Info.plist b/Sources/ApolloSQLite/Info.plist deleted file mode 100644 index b30021bc5b..0000000000 --- a/Sources/ApolloSQLite/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ApolloSQLite - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2017 Apollo GraphQL. All rights reserved. - NSPrincipalClass - - - diff --git a/Sources/ApolloTestSupport/Info.plist b/Sources/ApolloTestSupport/Info.plist deleted file mode 100644 index fbe1e6b314..0000000000 --- a/Sources/ApolloTestSupport/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/ApolloTestSupport/TestMock.swift b/Sources/ApolloTestSupport/TestMock.swift index 91b9928c72..8ca2db9819 100644 --- a/Sources/ApolloTestSupport/TestMock.swift +++ b/Sources/ApolloTestSupport/TestMock.swift @@ -1,7 +1,7 @@ #if !COCOAPODS @_exported @testable import ApolloAPI -@testable import Apollo #endif +@testable import Apollo import Foundation @dynamicMemberLookup @@ -97,7 +97,7 @@ public class Mock: AnyMock, Hashable { public var _selectionSetMockData: JSONObject { _data.mapValues { - if let mock = $0 as? AnyMock { + if let mock = $0.base as? AnyMock { return mock._selectionSetMockData } if let mockArray = $0 as? Array { @@ -189,20 +189,27 @@ fileprivate extension Array { } func _unsafelyConvertToSelectionSetData() -> [AnyHashable?] { - map { element in - switch element { - case let element as AnyMock: - return element._selectionSetMockData + map(_unsafelyConvertToSelectionSetData(element:)) + } - case let innerArray as Array: - return innerArray._unsafelyConvertToSelectionSetData() + private func _unsafelyConvertToSelectionSetData(element: Any) -> AnyHashable? { + switch element { + case let element as AnyMock: + return element._selectionSetMockData - case let element as AnyHashable: + case let innerArray as Array: + return innerArray._unsafelyConvertToSelectionSetData() + + case let element as AnyHashable: + if DataDict._AnyHashableCanBeCoerced { return element - default: - return nil + } else { + return _unsafelyConvertToSelectionSetData(element: element.base) } + + default: + return nil } } } diff --git a/Sources/ApolloTestSupport/TestMockSelectionSetMapper.swift b/Sources/ApolloTestSupport/TestMockSelectionSetMapper.swift index 510bf541f8..81e67dd720 100644 --- a/Sources/ApolloTestSupport/TestMockSelectionSetMapper.swift +++ b/Sources/ApolloTestSupport/TestMockSelectionSetMapper.swift @@ -1,7 +1,4 @@ -#if !COCOAPODS -@testable import ApolloAPI @testable import Apollo -#endif import Foundation /// An accumulator that converts data from a `Mock` to the correct values to create a `SelectionSet`. diff --git a/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift b/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift index 38513c6eee..9e4c182c9a 100644 --- a/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift +++ b/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift @@ -85,13 +85,14 @@ public final class WebSocket: NSObject, WebSocketClient, StreamDelegate, WebSock } } - struct Constants { + @_spi(Testable) + public struct Constants { static let headerWSUpgradeName = "Upgrade" static let headerWSUpgradeValue = "websocket" static let headerWSHostName = "Host" static let headerWSConnectionName = "Connection" static let headerWSConnectionValue = "Upgrade" - static let headerWSProtocolName = "Sec-WebSocket-Protocol" + public static let headerWSProtocolName = "Sec-WebSocket-Protocol" static let headerWSVersionName = "Sec-WebSocket-Version" static let headerWSVersionValue = "13" static let headerWSExtensionName = "Sec-WebSocket-Extensions" diff --git a/Sources/ApolloWebSocket/Info.plist b/Sources/ApolloWebSocket/Info.plist deleted file mode 100644 index 28165a5b96..0000000000 --- a/Sources/ApolloWebSocket/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ApolloWebSocket - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/CodegenCLI/Commands/FetchSchema.swift b/Sources/CodegenCLI/Commands/FetchSchema.swift deleted file mode 100644 index 061f223f96..0000000000 --- a/Sources/CodegenCLI/Commands/FetchSchema.swift +++ /dev/null @@ -1,54 +0,0 @@ -import Foundation -import ArgumentParser -import ApolloCodegenLib - -public struct FetchSchema: ParsableCommand { - - // MARK: - Configuration - - public static var configuration = CommandConfiguration( - commandName: "fetch-schema", - abstract: "Download a GraphQL schema from the Apollo Registry or GraphQL introspection." - ) - - @OptionGroup var inputs: InputOptions - - // MARK: - Implementation - - public init() { } - - public func run() throws { - try _run() - } - - func _run( - fileManager: FileManager = .default, - schemaDownloadProvider: SchemaDownloadProvider.Type = ApolloSchemaDownloader.self, - logger: LogLevelSetter.Type = CodegenLogger.self - ) throws { - logger.SetLoggingLevel(verbose: inputs.verbose) - - try fetchSchema( - configuration: inputs.getCodegenConfiguration(fileManager: fileManager), - schemaDownloadProvider: schemaDownloadProvider - ) - } - - private func fetchSchema( - configuration codegenConfiguration: ApolloCodegenConfiguration, - schemaDownloadProvider: SchemaDownloadProvider.Type - ) throws { - guard let schemaDownload = codegenConfiguration.schemaDownload else { - throw Error(errorDescription: """ - Missing schema download configuration. Hint: check the `schemaDownload` \ - property of your configuration. - """ - ) - } - - try schemaDownloadProvider.fetch( - configuration: schemaDownload, - withRootURL: rootOutputURL(for: inputs) - ) - } -} diff --git a/Sources/CodegenCLI/Commands/Generate.swift b/Sources/CodegenCLI/Commands/Generate.swift deleted file mode 100644 index 270c9a08d9..0000000000 --- a/Sources/CodegenCLI/Commands/Generate.swift +++ /dev/null @@ -1,90 +0,0 @@ -import Foundation -import ArgumentParser -import ApolloCodegenLib - -public struct Generate: ParsableCommand { - - // MARK: - Configuration - - public static var configuration = CommandConfiguration( - abstract: "Generate Swift source code based on a code generation configuration." - ) - - @OptionGroup var inputs: InputOptions - - @Flag( - name: .shortAndLong, - help: "Fetch the GraphQL schema before Swift code generation." - ) - var fetchSchema: Bool = false - - // MARK: - Implementation - - public init() { } - - public func run() throws { - try _run() - } - - func _run( - fileManager: FileManager = .default, - codegenProvider: CodegenProvider.Type = ApolloCodegen.self, - schemaDownloadProvider: SchemaDownloadProvider.Type = ApolloSchemaDownloader.self, - logger: LogLevelSetter.Type = CodegenLogger.self - ) throws { - logger.SetLoggingLevel(verbose: inputs.verbose) - - try checkForCLIVersionMismatch( - with: inputs - ) - - try generate( - configuration: inputs.getCodegenConfiguration(fileManager: fileManager), - codegenProvider: codegenProvider, - schemaDownloadProvider: schemaDownloadProvider - ) - } - - private func generate( - configuration: ApolloCodegenConfiguration, - codegenProvider: CodegenProvider.Type, - schemaDownloadProvider: SchemaDownloadProvider.Type - ) throws { - if fetchSchema { - guard - let schemaDownload = configuration.schemaDownload - else { - throw Error(errorDescription: """ - Missing schema download configuration. Hint: check the `schemaDownload` \ - property of your configuration. - """ - ) - } - - try fetchSchema( - configuration: schemaDownload, - schemaDownloadProvider: schemaDownloadProvider - ) - } - - var itemsToGenerate: ApolloCodegen.ItemsToGenerate = .code - - if let operationManifest = configuration.operationManifest, - operationManifest.generateManifestOnCodeGeneration { - itemsToGenerate.insert(.operationManifest) - } - - try codegenProvider.build( - with: configuration, - withRootURL: rootOutputURL(for: inputs), - itemsToGenerate: itemsToGenerate - ) - } - - private func fetchSchema( - configuration: ApolloSchemaDownloadConfiguration, - schemaDownloadProvider: SchemaDownloadProvider.Type - ) throws { - try schemaDownloadProvider.fetch(configuration: configuration, withRootURL: rootOutputURL(for: inputs)) - } -} diff --git a/Sources/CodegenCLI/Commands/GenerateOperationManifest.swift b/Sources/CodegenCLI/Commands/GenerateOperationManifest.swift deleted file mode 100644 index 2b695766cc..0000000000 --- a/Sources/CodegenCLI/Commands/GenerateOperationManifest.swift +++ /dev/null @@ -1,64 +0,0 @@ -import Foundation -import ArgumentParser -import ApolloCodegenLib - -public struct GenerateOperationManifest: ParsableCommand { - - // MARK: - Configuration - - public static var configuration = CommandConfiguration( - abstract: "Generate Persisted Queries operation manifest based on a code generation configuration." - ) - - @OptionGroup var inputs: InputOptions - - // MARK: - Implementation - - public init() { } - - public func run() throws { - try _run() - } - - func _run( - fileManager: FileManager = .default, - codegenProvider: CodegenProvider.Type = ApolloCodegen.self, - logger: LogLevelSetter.Type = CodegenLogger.self - ) throws { - logger.SetLoggingLevel(verbose: inputs.verbose) - - let configuration = try inputs.getCodegenConfiguration(fileManager: fileManager) - - try validate(configuration: configuration) - - try generateManifest( - configuration: configuration, - codegenProvider: codegenProvider - ) - } - - private func generateManifest( - configuration: ApolloCodegenConfiguration, - codegenProvider: CodegenProvider.Type - ) throws { - try codegenProvider.build( - with: configuration, - withRootURL: rootOutputURL(for: inputs), - itemsToGenerate: [.operationManifest] - ) - } - - // MARK: - Validation - - func validate(configuration: ApolloCodegenConfiguration) throws { - try checkForCLIVersionMismatch(with: inputs) - - guard configuration.operationManifest != nil else { - throw ValidationError(""" - `operationManifest` section must be set in the codegen configuration JSON in order - to generate an operation manifest. - """) - } - } - -} diff --git a/Sources/CodegenCLI/Commands/Initialize.swift b/Sources/CodegenCLI/Commands/Initialize.swift deleted file mode 100644 index a848101410..0000000000 --- a/Sources/CodegenCLI/Commands/Initialize.swift +++ /dev/null @@ -1,258 +0,0 @@ -import Foundation -import ArgumentParser -import ApolloCodegenLib - -public struct Initialize: ParsableCommand { - - // MARK: - Configuration - - public static var configuration = CommandConfiguration( - commandName: "init", - abstract: "Initialize a new configuration with defaults." - ) - - @Option( - name: [.long], - help: "DEPRECATED - Use --schema-namespace instead." - ) - // When removing this property also do: - // - remove the initialization value for schemaNamespace - // - remove schemaName validation in validate() - // - remove mutating keyword from validate() signature - var schemaName: String? - - @Option( - name: [.long, .customShort("n")], - help: "Name used to scope the generated schema type files." - ) - var schemaNamespace: String = "" - - @Option( - name: [.long, .customShort("m")], - help: """ - How to package the schema types for dependency management. Possible types: \ - \(ModuleTypeExpressibleByArgument.allValueStrings.joined(separator: ", ")). - """ - ) - var moduleType: ModuleTypeExpressibleByArgument - - @Option( - name: [.long, .customShort("t")], - help: """ - Name of the target in which the schema types files will be manually embedded. This is \ - required for the \"embeddedInTarget\" module type and will be ignored for all other module \ - types. - """ - ) - var targetName: String? = nil - - @Option( - name: .shortAndLong, - help: "Write the configuration to a file at the path." - ) - var path: String = Constants.defaultFilePath - - @Flag( - name: [.long, .customShort("w")], - help: """ - Overwrite any file at --path. If init is called without --overwrite and a config file \ - already exists at --path, the command will fail. - """ - ) - var overwrite: Bool = false - - @Flag( - name: [.long, .customShort("s")], - help: "Print the configuration to stdout." - ) - var print: Bool = false - - // MARK: - Implementation - - typealias OutputClosure = ((String) -> ()) - - public init() { } - - public mutating func validate() throws { - switch (moduleType, targetName?.isEmpty) { - case (.embeddedInTarget, nil), (.embeddedInTarget, true): - throw ValidationError(""" - Target name is required when using \"embeddedInTarget\" module type. Use --target-name \ - to specify. - """ - ) - default: - break; - } - - if let schemaName { - Swift.print("Warning: --schema-name is deprecated, please use --schema-namespace instead.") - - if !schemaNamespace.isEmpty { - throw ValidationError(""" - Cannot specify both --schema-name and --schema-namespace. Please only use \ - --schema-namespace". - """) - } - - schemaNamespace = schemaName - } - } - - public func run() throws { - try _run() - } - - func _run(fileManager: ApolloFileManager = .default, output: OutputClosure? = nil) throws { - let encoded = try ApolloCodegenConfiguration - .minimalJSON(schemaNamespace: schemaNamespace, moduleType: moduleType, targetName: targetName) - .asData() - - let decoded = try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: encoded) - try ApolloCodegen._validate(config: decoded) - - if print { - try print(data: encoded, output: output) - return - } - - try write( - data: encoded, - toPath: path, - overwrite: overwrite, - fileManager: fileManager, - output: output - ) - } - - private func write( - data: Data, - toPath path: String, - overwrite: Bool, - fileManager: ApolloFileManager, - output: OutputClosure? = nil - ) throws { - if !overwrite && fileManager.doesFileExist(atPath: path) { - throw Error( - errorDescription: """ - File already exists at \(path). Hint: use --overwrite to overwrite any existing \ - file at the path. - """ - ) - } - - try fileManager.createFile( - atPath: path, - data: data - ) - - print(message: "New configuration output to \(path).", output: output) - } - - private func print(data: Data, output: OutputClosure? = nil) throws { - guard let json = String(data: data, encoding: .utf8) else { - throw Error( - errorDescription: "Could not print the configuration, the JSON was not valid UTF-8." - ) - } - - print(message: json, output: output) - } - - private func print(message: String, output: OutputClosure? = nil) { - if let output = output { - output(message) - } else { - Swift.print(message) - } - } -} - -// MARK: - Internal extensions - -extension ApolloCodegenConfiguration { - static func minimalJSON( - schemaNamespace: String, - moduleType: ModuleTypeExpressibleByArgument, - targetName: String? - ) -> String { - #if COCOAPODS - minimalJSON( - schemaNamespace: schemaNamespace, - supportCocoaPods: true, - moduleType: moduleType, - targetName: targetName - ) - #else - minimalJSON( - schemaNamespace: schemaNamespace, - supportCocoaPods: false, - moduleType: moduleType, - targetName: targetName - ) - #endif - } - - static func minimalJSON( - schemaNamespace: String, - supportCocoaPods: Bool, - moduleType: ModuleTypeExpressibleByArgument, - targetName: String? - ) -> String { - let cocoaPodsOption = supportCocoaPods ? """ - - "options" : { - "cocoapodsCompatibleImportStatements" : true - }, - """ : "" - - let moduleTarget: String = { - guard let targetName = targetName else { return "}" } - - return """ - "name" : "\(targetName)" - } - """ - }() - - return """ - { - "schemaNamespace" : "\(schemaNamespace)",\(cocoaPodsOption) - "input" : { - "operationSearchPaths" : [ - "**/*.graphql" - ], - "schemaSearchPaths" : [ - "**/*.graphqls" - ] - }, - "output" : { - "testMocks" : { - "none" : { - } - }, - "schemaTypes" : { - "path" : "./\(schemaNamespace)", - "moduleType" : { - "\(moduleType)" : { - \(moduleTarget) - } - }, - "operations" : { - "inSchemaModule" : { - } - } - } - } - """ - } -} - -/// A custom enum that matches ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, but -/// specifically without associated values so that it can conform to ExpressibleByArgument and be -/// parsed from the command line. -enum ModuleTypeExpressibleByArgument: String, ExpressibleByArgument, CaseIterable { - case embeddedInTarget - case swiftPackageManager - case other -} diff --git a/Sources/CodegenCLI/Constants.swift b/Sources/CodegenCLI/Constants.swift deleted file mode 100644 index db5f2bc230..0000000000 --- a/Sources/CodegenCLI/Constants.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation - -public enum Constants { - public static let CLIVersion: String = "1.5.1" - static let defaultFilePath: String = "./apollo-codegen-config.json" -} diff --git a/Sources/CodegenCLI/Error.swift b/Sources/CodegenCLI/Error.swift deleted file mode 100644 index 4c1e13fb69..0000000000 --- a/Sources/CodegenCLI/Error.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -struct Error: LocalizedError { - var errorDescription: String? -} diff --git a/Sources/CodegenCLI/Extensions/FileManager+Data.swift b/Sources/CodegenCLI/Extensions/FileManager+Data.swift deleted file mode 100644 index a6a9f6ccf7..0000000000 --- a/Sources/CodegenCLI/Extensions/FileManager+Data.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -extension FileManager { - /// Returns the contents of the file at the specified path or throws an error. - func unwrappedContents(atPath path: String) throws -> Data { - guard let data = contents(atPath: path) else { - throw Error(errorDescription: "Cannot read file at \(path)") - } - - return data - } -} diff --git a/Sources/CodegenCLI/Extensions/ParsableCommand+Apollo.swift b/Sources/CodegenCLI/Extensions/ParsableCommand+Apollo.swift deleted file mode 100644 index 518c365114..0000000000 --- a/Sources/CodegenCLI/Extensions/ParsableCommand+Apollo.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import ArgumentParser -import ApolloCodegenLib - -extension ParsableCommand { - func rootOutputURL(for inputOptions: InputOptions) -> URL? { - if inputOptions.string != nil { return nil } - let rootURL = URL(fileURLWithPath: inputOptions.path).deletingLastPathComponent() - if rootURL.path == FileManager.default.currentDirectoryPath { return nil } - return rootURL - } - - func checkForCLIVersionMismatch( - with inputs: InputOptions, - ignoreVersionMismatch: Bool = false - ) throws { - if case let .versionMismatch(cliVersion, apolloVersion) = - try VersionChecker.matchCLIVersionToApolloVersion(projectRootURL: rootOutputURL(for: inputs)) { - let errorMessage = """ - Apollo Version Mismatch - We've detected that the version of the Apollo Codegen CLI does not match the version of the - Apollo library used in your project. This may lead to incompatible generated objects. - - Please update your version of the Codegen CLI by following the instructions at: - https://www.apollographql.com/docs/ios/code-generation/codegen-cli/#installation - - CLI version: \(cliVersion) - Apollo version: \(apolloVersion) - """ - - if inputs.ignoreVersionMismatch { - print(""" - Warning: \(errorMessage) - """) - } else { - - throw Error(errorDescription: """ - Error: \(errorMessage) - - To ignore this error during code generation, use the argument: --ignore-version-mismatch. - """) - } - } - } -} diff --git a/Sources/CodegenCLI/Extensions/String+Data.swift b/Sources/CodegenCLI/Extensions/String+Data.swift deleted file mode 100644 index 24d8a0b4d0..0000000000 --- a/Sources/CodegenCLI/Extensions/String+Data.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -extension String { - func asData() throws -> Data { - guard let data = data(using: .utf8) else { - throw Error(errorDescription: "Badly encoded string, should be UTF-8!") - } - - return data - } -} diff --git a/Sources/CodegenCLI/Extensions/VersionChecker.swift b/Sources/CodegenCLI/Extensions/VersionChecker.swift deleted file mode 100644 index 731bece8d4..0000000000 --- a/Sources/CodegenCLI/Extensions/VersionChecker.swift +++ /dev/null @@ -1,183 +0,0 @@ -import Foundation -import ApolloCodegenLib - -enum VersionChecker { - - enum VersionCheckResult: Equatable { - case noApolloVersionFound - case versionMatch - case versionMismatch(cliVersion: String, apolloVersion: String) - } - - static func matchCLIVersionToApolloVersion(projectRootURL: URL?) throws -> VersionCheckResult { - guard var packageModel = try findPackageResolvedFile(projectRootURL: projectRootURL), - let apolloVersion = packageModel.apolloVersion else { - return .noApolloVersionFound - } - - if apolloVersion == Constants.CLIVersion { - return .versionMatch - - } else { - return .versionMismatch(cliVersion: Constants.CLIVersion, apolloVersion: apolloVersion) - } - } - - private static func findPackageResolvedFile(projectRootURL: URL?) throws -> PackageResolvedModel? { - let Package_resolved = "Package.resolved" - let fileManager = ApolloFileManager.default - - // When using SPM with a `Package.swift` file, the `Package.resolved` file will be in the - // same directory as the `Package.swift`, which is the project's root directory. - func findInProjectRoot() -> Data? { - let path: String - if let projectRootURL { - path = projectRootURL.appendingPathComponent(Package_resolved, isDirectory: false).path - } else { - path = Package_resolved - } - - return fileManager.base.contents(atPath: path) - } - - // When using SPM via Xcode, the `Package.resolved` file is nested inside either the - // `.xcworkspace` or the `.xcproject` package. Since we don't know the name of your project, - // we just look for the first workspace or project that depends on Apollo, prioritising - // workspaces. This may not be 100% fool-proof, but it should be accurate in almost all cases. - func findInXcode( - fileSuffix: String, - packagePath: String, - excludeFilePathComponents: [String] = [] - ) -> PackageResolvedModel? { - let projectEnumerator = fileManager.base.enumerator(atPath: projectRootURL?.path ?? ".") - enumeratorLoop: while let file = projectEnumerator?.nextObject() as? String { - if file.hasSuffix(fileSuffix) { - //check if this file should be ignored - for component in excludeFilePathComponents { - if file.contains(component) { - continue enumeratorLoop - } - } - - let projectPackagePath = "\(file)\(packagePath)" - if let package = apolloDependantPackage(atPath: projectPackagePath) { - return package - } - } - } - return nil - } - - func apolloDependantPackage(atPath projectPackagePath: String) -> PackageResolvedModel? { - let path: String - if let projectRootURL { - path = projectRootURL.appendingPathComponent(projectPackagePath, isDirectory: false).path - } else { - path = projectPackagePath - } - - if let packageResolvedData = fileManager.base.contents(atPath: path), - var packageModel = try? PackageResolvedModel(data: packageResolvedData), - packageModel.apolloVersion != nil { - return packageModel - } - return nil - } - - - if let packageResolvedData = findInProjectRoot() { - return try PackageResolvedModel(data: packageResolvedData) - } - - if let packageModel = findInXcode( - fileSuffix: ".xcworkspace", - packagePath: "/xcshareddata/swiftpm/\(Package_resolved)", - excludeFilePathComponents: [".xcodeproj/project.xcworkspace"] - ) { - return packageModel - } - - if let packageModel = findInXcode( - fileSuffix: ".xcodeproj", - packagePath: "/project.xcworkspace/xcshareddata/swiftpm/\(Package_resolved)" - ) { - return packageModel - } - - return nil - } - -} - -struct PackageResolvedModel { - typealias Object = [String: Any] - typealias ObjectList = [[String: Any]] - - let fileFormat: FileFormatVersion - let json: Object - lazy var apolloVersion: String? = getApolloVersion() - - init(json: Object) throws { - guard let version = json["version"] as? Int else { - throw Error(errorDescription: """ - Invalid 'Package.resolve' file. - Please create an issue at: https://github.com/apollographql/apollo-ios - """) - } - guard let fileFormat = FileFormatVersion(rawValue: version) else { - throw Error(errorDescription: """ - Package.resolve file version unsupported! - Please create an issue at: https://github.com/apollographql/apollo-ios - """) - } - - self.fileFormat = fileFormat - self.json = json - } - - init?(data: Data) throws { - guard let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] else { - return nil - } - - try self.init(json: json) - } - - private func getApolloVersion() -> String? { - guard let packageList = fileFormat.getPackageList(fromPackageResolvedJSON: json), - let apolloPackage = packageList.first(where: { - let packageName = fileFormat.packageName(forPackage: $0) - return packageName == "Apollo" || packageName == "apollo-ios" - }) - else { - return nil - } - return (apolloPackage["state"] as? Object)?["version"] as? String - } - - enum FileFormatVersion: Int { - case v1 = 1 - case v2 = 2 - - func getPackageList(fromPackageResolvedJSON json: [String: Any]) -> ObjectList? { - switch self { - case .v1: - return (json["object"] as? Object)?["pins"] as? ObjectList - - case .v2: - return json["pins"] as? ObjectList - } - } - - func packageName(forPackage package: Object) -> String? { - switch self { - case .v1: - return package["package"] as? String - - case .v2: - return package["identity"] as? String - } - } - } - -} diff --git a/Sources/CodegenCLI/Info.plist b/Sources/CodegenCLI/Info.plist deleted file mode 100644 index 09738dfd75..0000000000 --- a/Sources/CodegenCLI/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/CodegenCLI/OptionGroups/InputOptions.swift b/Sources/CodegenCLI/OptionGroups/InputOptions.swift deleted file mode 100644 index 107d54d99b..0000000000 --- a/Sources/CodegenCLI/OptionGroups/InputOptions.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import ArgumentParser -import ApolloCodegenLib - -/// Shared group of common arguments used in commands for input parameters. -struct InputOptions: ParsableArguments { - @Option( - name: .shortAndLong, - help: """ - Read the configuration from a file at the path. --string overrides this option if used \ - together. - """ - ) - var path: String = Constants.defaultFilePath - - @Option( - name: .shortAndLong, - help: "Configuration string in JSON format. This option overrides --path." - ) - var string: String? - - @Flag( - name: .shortAndLong, - help: "Increase verbosity to include debug output." - ) - var verbose: Bool = false - - @Flag( - name: .long, - help: "Ignore Apollo version mismatch errors. Warning: This may lead to incompatible generated objects." - ) - var ignoreVersionMismatch: Bool = false - - func getCodegenConfiguration(fileManager: FileManager) throws -> ApolloCodegenConfiguration { - var data: Data - switch (string, path) { - case let (.some(string), _): - data = try string.asData() - - case let (nil, path): - data = try fileManager.unwrappedContents(atPath: path) - } - return try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: data) - } -} diff --git a/Sources/CodegenCLI/Protocols/CodegenProvider.swift b/Sources/CodegenCLI/Protocols/CodegenProvider.swift deleted file mode 100644 index 96ad36a103..0000000000 --- a/Sources/CodegenCLI/Protocols/CodegenProvider.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation -import ApolloCodegenLib - -/// Generic representation of a code generation provider. -public protocol CodegenProvider { - static func build( - with configuration: ApolloCodegenConfiguration, - withRootURL rootURL: URL?, - itemsToGenerate: ApolloCodegen.ItemsToGenerate - ) throws -} - -extension ApolloCodegen: CodegenProvider { } diff --git a/Sources/CodegenCLI/Protocols/LogLevelSetter.swift b/Sources/CodegenCLI/Protocols/LogLevelSetter.swift deleted file mode 100644 index 90a7e05c08..0000000000 --- a/Sources/CodegenCLI/Protocols/LogLevelSetter.swift +++ /dev/null @@ -1,18 +0,0 @@ -import ApolloCodegenLib - -public protocol LogLevelSetter { - static func SetLoggingLevel(verbose: Bool) - static func SetLoggingLevel(_ level: CodegenLogger.LogLevel) -} - -extension LogLevelSetter { - public static func SetLoggingLevel(verbose: Bool) { - SetLoggingLevel(verbose ? .debug : .warning) - } - - public static func SetLoggingLevel(_ level: CodegenLogger.LogLevel) { - CodegenLogger.level = level - } -} - -extension CodegenLogger: LogLevelSetter { } diff --git a/Sources/CodegenCLI/Protocols/SchemaDownloadProvider.swift b/Sources/CodegenCLI/Protocols/SchemaDownloadProvider.swift deleted file mode 100644 index edb7debb4c..0000000000 --- a/Sources/CodegenCLI/Protocols/SchemaDownloadProvider.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation -import ApolloCodegenLib - -/// Generic representation of a schema download provider. -public protocol SchemaDownloadProvider { - static func fetch( - configuration: ApolloSchemaDownloadConfiguration, - withRootURL rootURL: URL? - ) throws -} - -extension ApolloSchemaDownloader: SchemaDownloadProvider { } diff --git a/Sources/GitHubAPI/GitHubAPI/Package.swift b/Sources/GitHubAPI/GitHubAPI/Package.swift deleted file mode 100644 index 0dd5e1cef0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Package.swift +++ /dev/null @@ -1,28 +0,0 @@ -// swift-tools-version:5.7 - -import PackageDescription - -let package = Package( - name: "GitHubAPI", - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - products: [ - .library(name: "GitHubAPI", targets: ["GitHubAPI"]), - ], - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - targets: [ - .target( - name: "GitHubAPI", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] -) diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Fragments/AuthorDetails.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Fragments/AuthorDetails.graphql.swift deleted file mode 100644 index 2fe4a02a34..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Fragments/AuthorDetails.graphql.swift +++ /dev/null @@ -1,46 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct AuthorDetails: GitHubAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment AuthorDetails on Actor { __typename login ... on User { __typename id name } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Actor } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("login", String.self), - .inlineFragment(AsUser.self), - ] } - - /// The username of the actor. - public var login: String { __data["login"] } - - public var asUser: AsUser? { _asInlineFragment() } - - /// AsUser - /// - /// Parent Type: `User` - public struct AsUser: GitHubAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = AuthorDetails - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.User } - public static var __selections: [ApolloAPI.Selection] { [ - .field("id", GitHubAPI.ID.self), - .field("name", String?.self), - ] } - - public var id: GitHubAPI.ID { __data["id"] } - /// The user's public profile name. - public var name: String? { __data["name"] } - /// The username of the actor. - public var login: String { __data["login"] } - } -} diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/IssuesAndCommentsForRepositoryQuery.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/IssuesAndCommentsForRepositoryQuery.graphql.swift deleted file mode 100644 index 0bdb97d822..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/IssuesAndCommentsForRepositoryQuery.graphql.swift +++ /dev/null @@ -1,241 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class IssuesAndCommentsForRepositoryQuery: GraphQLQuery { - public static let operationName: String = "IssuesAndCommentsForRepository" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query IssuesAndCommentsForRepository { repository(name: "apollo-ios", owner: "apollographql") { __typename name issues(last: 100) { __typename nodes { __typename title author { __typename ...AuthorDetails } body comments(last: 100) { __typename nodes { __typename body author { __typename ...AuthorDetails } } } } } } }"#, - fragments: [AuthorDetails.self] - )) - - public init() {} - - public struct Data: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("repository", Repository?.self, arguments: [ - "name": "apollo-ios", - "owner": "apollographql" - ]), - ] } - - /// Lookup a given repository by the owner and repository name. - public var repository: Repository? { __data["repository"] } - - /// Repository - /// - /// Parent Type: `Repository` - public struct Repository: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Repository } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("issues", Issues.self, arguments: ["last": 100]), - ] } - - /// The name of the repository. - public var name: String { __data["name"] } - /// A list of issues that have been opened in the repository. - public var issues: Issues { __data["issues"] } - - /// Repository.Issues - /// - /// Parent Type: `IssueConnection` - public struct Issues: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.IssueConnection } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("nodes", [Node?]?.self), - ] } - - /// A list of nodes. - public var nodes: [Node?]? { __data["nodes"] } - - /// Repository.Issues.Node - /// - /// Parent Type: `Issue` - public struct Node: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Issue } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("title", String.self), - .field("author", Author?.self), - .field("body", String.self), - .field("comments", Comments.self, arguments: ["last": 100]), - ] } - - /// Identifies the issue title. - public var title: String { __data["title"] } - /// The actor who authored the comment. - public var author: Author? { __data["author"] } - /// Identifies the body of the issue. - public var body: String { __data["body"] } - /// A list of comments associated with the Issue. - public var comments: Comments { __data["comments"] } - - /// Repository.Issues.Node.Author - /// - /// Parent Type: `Actor` - public struct Author: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Actor } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(AuthorDetails.self), - ] } - - /// The username of the actor. - public var login: String { __data["login"] } - - public var asUser: AsUser? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var authorDetails: AuthorDetails { _toFragment() } - } - - /// Repository.Issues.Node.Author.AsUser - /// - /// Parent Type: `User` - public struct AsUser: GitHubAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = IssuesAndCommentsForRepositoryQuery.Data.Repository.Issues.Node.Author - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.User } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - AuthorDetails.self, - IssuesAndCommentsForRepositoryQuery.Data.Repository.Issues.Node.Author.self, - AuthorDetails.AsUser.self - ] } - - /// The username of the actor. - public var login: String { __data["login"] } - public var id: GitHubAPI.ID { __data["id"] } - /// The user's public profile name. - public var name: String? { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var authorDetails: AuthorDetails { _toFragment() } - } - } - } - - /// Repository.Issues.Node.Comments - /// - /// Parent Type: `IssueCommentConnection` - public struct Comments: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.IssueCommentConnection } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("nodes", [Node?]?.self), - ] } - - /// A list of nodes. - public var nodes: [Node?]? { __data["nodes"] } - - /// Repository.Issues.Node.Comments.Node - /// - /// Parent Type: `IssueComment` - public struct Node: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.IssueComment } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("body", String.self), - .field("author", Author?.self), - ] } - - /// The body as Markdown. - public var body: String { __data["body"] } - /// The actor who authored the comment. - public var author: Author? { __data["author"] } - - /// Repository.Issues.Node.Comments.Node.Author - /// - /// Parent Type: `Actor` - public struct Author: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Actor } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(AuthorDetails.self), - ] } - - /// The username of the actor. - public var login: String { __data["login"] } - - public var asUser: AsUser? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var authorDetails: AuthorDetails { _toFragment() } - } - - /// Repository.Issues.Node.Comments.Node.Author.AsUser - /// - /// Parent Type: `User` - public struct AsUser: GitHubAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = IssuesAndCommentsForRepositoryQuery.Data.Repository.Issues.Node.Comments.Node.Author - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.User } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - AuthorDetails.self, - IssuesAndCommentsForRepositoryQuery.Data.Repository.Issues.Node.Comments.Node.Author.self, - AuthorDetails.AsUser.self - ] } - - /// The username of the actor. - public var login: String { __data["login"] } - public var id: GitHubAPI.ID { __data["id"] } - /// The user's public profile name. - public var name: String? { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var authorDetails: AuthorDetails { _toFragment() } - } - } - } - } - } - } - } - } - } -} diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/RepoURLQuery.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/RepoURLQuery.graphql.swift deleted file mode 100644 index 50276ec330..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/RepoURLQuery.graphql.swift +++ /dev/null @@ -1,47 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class RepoURLQuery: GraphQLQuery { - public static let operationName: String = "RepoURL" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query RepoURL { repository(owner: "apollographql", name: "apollo-ios") { __typename url } }"# - )) - - public init() {} - - public struct Data: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("repository", Repository?.self, arguments: [ - "owner": "apollographql", - "name": "apollo-ios" - ]), - ] } - - /// Lookup a given repository by the owner and repository name. - public var repository: Repository? { __data["repository"] } - - /// Repository - /// - /// Parent Type: `Repository` - public struct Repository: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Repository } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("url", GitHubAPI.URI.self), - ] } - - /// The HTTP URL for this repository - public var url: GitHubAPI.URI { __data["url"] } - } - } -} diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/RepositoryQuery.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/RepositoryQuery.graphql.swift deleted file mode 100644 index 991e2fbaee..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Operations/Queries/RepositoryQuery.graphql.swift +++ /dev/null @@ -1,165 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class RepositoryQuery: GraphQLQuery { - public static let operationName: String = "Repository" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query Repository { repository(owner: "apollographql", name: "apollo-ios") { __typename issueOrPullRequest(number: 13) { __typename ... on Issue { __typename body ... on UniformResourceLocatable { __typename url } author { __typename avatarUrl } } ... on Reactable { __typename viewerCanReact ... on Comment { __typename author { __typename login } } } } } }"# - )) - - public init() {} - - public struct Data: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("repository", Repository?.self, arguments: [ - "owner": "apollographql", - "name": "apollo-ios" - ]), - ] } - - /// Lookup a given repository by the owner and repository name. - public var repository: Repository? { __data["repository"] } - - /// Repository - /// - /// Parent Type: `Repository` - public struct Repository: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Repository } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("issueOrPullRequest", IssueOrPullRequest?.self, arguments: ["number": 13]), - ] } - - /// Returns a single issue-like object from the current repository by number. - public var issueOrPullRequest: IssueOrPullRequest? { __data["issueOrPullRequest"] } - - /// Repository.IssueOrPullRequest - /// - /// Parent Type: `IssueOrPullRequest` - public struct IssueOrPullRequest: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Unions.IssueOrPullRequest } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsIssue.self), - .inlineFragment(AsReactable.self), - ] } - - public var asIssue: AsIssue? { _asInlineFragment() } - public var asReactable: AsReactable? { _asInlineFragment() } - - /// Repository.IssueOrPullRequest.AsIssue - /// - /// Parent Type: `Issue` - public struct AsIssue: GitHubAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = RepositoryQuery.Data.Repository.IssueOrPullRequest - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Objects.Issue } - public static var __selections: [ApolloAPI.Selection] { [ - .field("body", String.self), - .field("url", GitHubAPI.URI.self), - .field("author", Author?.self), - ] } - - /// Identifies the body of the issue. - public var body: String { __data["body"] } - /// The URL to this resource. - public var url: GitHubAPI.URI { __data["url"] } - /// The actor who authored the comment. - public var author: Author? { __data["author"] } - /// Can user react to this subject - public var viewerCanReact: Bool { __data["viewerCanReact"] } - - /// Repository.IssueOrPullRequest.AsIssue.Author - /// - /// Parent Type: `Actor` - public struct Author: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Actor } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("avatarUrl", GitHubAPI.URI.self), - ] } - - /// A URL pointing to the actor's public avatar. - public var avatarUrl: GitHubAPI.URI { __data["avatarUrl"] } - /// The username of the actor. - public var login: String { __data["login"] } - } - } - - /// Repository.IssueOrPullRequest.AsReactable - /// - /// Parent Type: `Reactable` - public struct AsReactable: GitHubAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = RepositoryQuery.Data.Repository.IssueOrPullRequest - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Reactable } - public static var __selections: [ApolloAPI.Selection] { [ - .field("viewerCanReact", Bool.self), - .inlineFragment(AsComment.self), - ] } - - /// Can user react to this subject - public var viewerCanReact: Bool { __data["viewerCanReact"] } - - public var asComment: AsComment? { _asInlineFragment() } - - /// Repository.IssueOrPullRequest.AsReactable.AsComment - /// - /// Parent Type: `Comment` - public struct AsComment: GitHubAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = RepositoryQuery.Data.Repository.IssueOrPullRequest - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Comment } - public static var __selections: [ApolloAPI.Selection] { [ - .field("author", Author?.self), - ] } - - /// The actor who authored the comment. - public var author: Author? { __data["author"] } - /// Can user react to this subject - public var viewerCanReact: Bool { __data["viewerCanReact"] } - - /// Repository.IssueOrPullRequest.AsReactable.AsComment.Author - /// - /// Parent Type: `Actor` - public struct Author: GitHubAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { GitHubAPI.Interfaces.Actor } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("login", String.self), - ] } - - /// The username of the actor. - public var login: String { __data["login"] } - } - } - } - } - } - } -} diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/CustomScalars/URI.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/CustomScalars/URI.swift deleted file mode 100644 index e914999f41..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/CustomScalars/URI.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// implement advanced custom scalar functionality. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -/// An RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI string. -public typealias URI = String diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Actor.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Actor.graphql.swift deleted file mode 100644 index 98b8c5d117..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Actor.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents an object which can take actions on GitHub. Typically a User or Bot. - static let Actor = Interface(name: "Actor") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Assignable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Assignable.graphql.swift deleted file mode 100644 index ce4f4e6383..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Assignable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// An object that can have users assigned to it. - static let Assignable = Interface(name: "Assignable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/AuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/AuditEntry.graphql.swift deleted file mode 100644 index bcebba5c78..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/AuditEntry.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// An entry in the audit log. - static let AuditEntry = Interface(name: "AuditEntry") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Closable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Closable.graphql.swift deleted file mode 100644 index 69c7e0cdc1..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Closable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// An object that can be closed - static let Closable = Interface(name: "Closable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Comment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Comment.graphql.swift deleted file mode 100644 index 2f66e20d26..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Comment.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents a comment. - static let Comment = Interface(name: "Comment") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Deletable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Deletable.graphql.swift deleted file mode 100644 index 7f7f95418e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Deletable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Entities that can be deleted. - static let Deletable = Interface(name: "Deletable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/EnterpriseAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/EnterpriseAuditEntryData.graphql.swift deleted file mode 100644 index 040eba4ca5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/EnterpriseAuditEntryData.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Metadata for an audit entry containing enterprise account information. - static let EnterpriseAuditEntryData = Interface(name: "EnterpriseAuditEntryData") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/GitObject.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/GitObject.graphql.swift deleted file mode 100644 index 905a14681a..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/GitObject.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents a Git object. - static let GitObject = Interface(name: "GitObject") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Labelable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Labelable.graphql.swift deleted file mode 100644 index 49e68a90a0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Labelable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// An object that can have labels assigned to it. - static let Labelable = Interface(name: "Labelable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Lockable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Lockable.graphql.swift deleted file mode 100644 index 946b251fc0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Lockable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// An object that can be locked. - static let Lockable = Interface(name: "Lockable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/MemberStatusable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/MemberStatusable.graphql.swift deleted file mode 100644 index 8e7dc5f1ef..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/MemberStatusable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Entities that have members who can set status messages. - static let MemberStatusable = Interface(name: "MemberStatusable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Minimizable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Minimizable.graphql.swift deleted file mode 100644 index 684e3f0357..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Minimizable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Entities that can be minimized. - static let Minimizable = Interface(name: "Minimizable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Node.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Node.graphql.swift deleted file mode 100644 index 73a9877cc3..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Node.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// An object with an ID. - static let Node = Interface(name: "Node") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/OauthApplicationAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/OauthApplicationAuditEntryData.graphql.swift deleted file mode 100644 index e6a0f72ae5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/OauthApplicationAuditEntryData.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Metadata for an audit entry with action oauth_application.* - static let OauthApplicationAuditEntryData = Interface(name: "OauthApplicationAuditEntryData") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/OrganizationAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/OrganizationAuditEntryData.graphql.swift deleted file mode 100644 index 6f3ccf4bbf..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/OrganizationAuditEntryData.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Metadata for an audit entry with action org.* - static let OrganizationAuditEntryData = Interface(name: "OrganizationAuditEntryData") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/PackageOwner.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/PackageOwner.graphql.swift deleted file mode 100644 index 6514882de0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/PackageOwner.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents an owner of a package. - static let PackageOwner = Interface(name: "PackageOwner") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/ProfileOwner.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/ProfileOwner.graphql.swift deleted file mode 100644 index cf4610f610..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/ProfileOwner.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents any entity on GitHub that has a profile page. - static let ProfileOwner = Interface(name: "ProfileOwner") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/ProjectOwner.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/ProjectOwner.graphql.swift deleted file mode 100644 index af0c374b71..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/ProjectOwner.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents an owner of a Project. - static let ProjectOwner = Interface(name: "ProjectOwner") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Reactable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Reactable.graphql.swift deleted file mode 100644 index af96042200..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Reactable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents a subject that can be reacted on. - static let Reactable = Interface(name: "Reactable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryAuditEntryData.graphql.swift deleted file mode 100644 index ea14a2ce66..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryAuditEntryData.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Metadata for an audit entry with action repo.* - static let RepositoryAuditEntryData = Interface(name: "RepositoryAuditEntryData") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryInfo.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryInfo.graphql.swift deleted file mode 100644 index ebe9b52633..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryInfo.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// A subset of repository info. - static let RepositoryInfo = Interface(name: "RepositoryInfo") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryNode.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryNode.graphql.swift deleted file mode 100644 index b2f1f2a9a8..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryNode.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents a object that belongs to a repository. - static let RepositoryNode = Interface(name: "RepositoryNode") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryOwner.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryOwner.graphql.swift deleted file mode 100644 index 0f821d293b..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/RepositoryOwner.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents an owner of a Repository. - static let RepositoryOwner = Interface(name: "RepositoryOwner") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Sponsorable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Sponsorable.graphql.swift deleted file mode 100644 index 43da40b194..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Sponsorable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Entities that can be sponsored through GitHub Sponsors - static let Sponsorable = Interface(name: "Sponsorable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Starrable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Starrable.graphql.swift deleted file mode 100644 index 7d73d40355..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Starrable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Things that can be starred. - static let Starrable = Interface(name: "Starrable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Subscribable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Subscribable.graphql.swift deleted file mode 100644 index 666764a3c7..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Subscribable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Entities that can be subscribed to for web and email notifications. - static let Subscribable = Interface(name: "Subscribable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/TeamAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/TeamAuditEntryData.graphql.swift deleted file mode 100644 index 94b1b2c433..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/TeamAuditEntryData.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Metadata for an audit entry with action team.* - static let TeamAuditEntryData = Interface(name: "TeamAuditEntryData") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/TopicAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/TopicAuditEntryData.graphql.swift deleted file mode 100644 index 2d94341b60..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/TopicAuditEntryData.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Metadata for an audit entry with a topic. - static let TopicAuditEntryData = Interface(name: "TopicAuditEntryData") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/UniformResourceLocatable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/UniformResourceLocatable.graphql.swift deleted file mode 100644 index 3f51231d69..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/UniformResourceLocatable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Represents a type that can be retrieved by a URL. - static let UniformResourceLocatable = Interface(name: "UniformResourceLocatable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Updatable.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Updatable.graphql.swift deleted file mode 100644 index 959ca76e54..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/Updatable.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Entities that can be updated. - static let Updatable = Interface(name: "Updatable") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/UpdatableComment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/UpdatableComment.graphql.swift deleted file mode 100644 index f25f8ca607..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Interfaces/UpdatableComment.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// Comments that can be updated. - static let UpdatableComment = Interface(name: "UpdatableComment") -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AddedToProjectEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AddedToProjectEvent.graphql.swift deleted file mode 100644 index 15a83719fb..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AddedToProjectEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'added_to_project' event on a given issue or pull request. - static let AddedToProjectEvent = Object( - typename: "AddedToProjectEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/App.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/App.graphql.swift deleted file mode 100644 index 51341bafce..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/App.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A GitHub App. - static let App = Object( - typename: "App", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AssignedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AssignedEvent.graphql.swift deleted file mode 100644 index 629abddebb..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AssignedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'assigned' event on any assignable object. - static let AssignedEvent = Object( - typename: "AssignedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AutomaticBaseChangeFailedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AutomaticBaseChangeFailedEvent.graphql.swift deleted file mode 100644 index a6e08c5ef4..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AutomaticBaseChangeFailedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'automatic_base_change_failed' event on a given pull request. - static let AutomaticBaseChangeFailedEvent = Object( - typename: "AutomaticBaseChangeFailedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AutomaticBaseChangeSucceededEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AutomaticBaseChangeSucceededEvent.graphql.swift deleted file mode 100644 index 6496de6316..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/AutomaticBaseChangeSucceededEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'automatic_base_change_succeeded' event on a given pull request. - static let AutomaticBaseChangeSucceededEvent = Object( - typename: "AutomaticBaseChangeSucceededEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BaseRefChangedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BaseRefChangedEvent.graphql.swift deleted file mode 100644 index ec120d546f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BaseRefChangedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'base_ref_changed' event on a given issue or pull request. - static let BaseRefChangedEvent = Object( - typename: "BaseRefChangedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BaseRefForcePushedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BaseRefForcePushedEvent.graphql.swift deleted file mode 100644 index 72d0e0c604..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BaseRefForcePushedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'base_ref_force_pushed' event on a given pull request. - static let BaseRefForcePushedEvent = Object( - typename: "BaseRefForcePushedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Blob.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Blob.graphql.swift deleted file mode 100644 index f1bd085e2d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Blob.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Git blob. - static let Blob = Object( - typename: "Blob", - implementedInterfaces: [ - Interfaces.GitObject.self, - Interfaces.Node.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Bot.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Bot.graphql.swift deleted file mode 100644 index 8e1f4e4b51..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Bot.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A special type of user which takes actions on behalf of GitHub Apps. - static let Bot = Object( - typename: "Bot", - implementedInterfaces: [ - Interfaces.Actor.self, - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BranchProtectionRule.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BranchProtectionRule.graphql.swift deleted file mode 100644 index 6c7d40e982..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/BranchProtectionRule.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A branch protection rule. - static let BranchProtectionRule = Object( - typename: "BranchProtectionRule", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CheckRun.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CheckRun.graphql.swift deleted file mode 100644 index 29038be001..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CheckRun.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A check run. - static let CheckRun = Object( - typename: "CheckRun", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CheckSuite.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CheckSuite.graphql.swift deleted file mode 100644 index 506f8572d9..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CheckSuite.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A check suite. - static let CheckSuite = Object( - typename: "CheckSuite", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ClosedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ClosedEvent.graphql.swift deleted file mode 100644 index e197df40b8..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ClosedEvent.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'closed' event on any `Closable`. - static let ClosedEvent = Object( - typename: "ClosedEvent", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CodeOfConduct.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CodeOfConduct.graphql.swift deleted file mode 100644 index 3cf058ac68..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CodeOfConduct.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The Code of Conduct for a repository - static let CodeOfConduct = Object( - typename: "CodeOfConduct", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommentDeletedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommentDeletedEvent.graphql.swift deleted file mode 100644 index 8e9372a4f1..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommentDeletedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'comment_deleted' event on a given issue or pull request. - static let CommentDeletedEvent = Object( - typename: "CommentDeletedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Commit.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Commit.graphql.swift deleted file mode 100644 index 66c1c3f636..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Commit.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Git commit. - static let Commit = Object( - typename: "Commit", - implementedInterfaces: [ - Interfaces.GitObject.self, - Interfaces.Node.self, - Interfaces.Subscribable.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommitComment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommitComment.graphql.swift deleted file mode 100644 index cf0c0fa68e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommitComment.graphql.swift +++ /dev/null @@ -1,21 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a comment on a given Commit. - static let CommitComment = Object( - typename: "CommitComment", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Minimizable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.RepositoryNode.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommitCommentThread.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommitCommentThread.graphql.swift deleted file mode 100644 index 0957795adf..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CommitCommentThread.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A thread of comments on a commit. - static let CommitCommentThread = Object( - typename: "CommitCommentThread", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.RepositoryNode.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConnectedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConnectedEvent.graphql.swift deleted file mode 100644 index 11f6ea2783..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConnectedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'connected' event on a given issue or pull request. - static let ConnectedEvent = Object( - typename: "ConnectedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConvertToDraftEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConvertToDraftEvent.graphql.swift deleted file mode 100644 index ab3e3a1fc4..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConvertToDraftEvent.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'convert_to_draft' event on a given pull request. - static let ConvertToDraftEvent = Object( - typename: "ConvertToDraftEvent", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConvertedNoteToIssueEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConvertedNoteToIssueEvent.graphql.swift deleted file mode 100644 index 1c01fa810b..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ConvertedNoteToIssueEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'converted_note_to_issue' event on a given issue or pull request. - static let ConvertedNoteToIssueEvent = Object( - typename: "ConvertedNoteToIssueEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CrossReferencedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CrossReferencedEvent.graphql.swift deleted file mode 100644 index 39d241781a..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/CrossReferencedEvent.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a mention made by one issue or pull request to another. - static let CrossReferencedEvent = Object( - typename: "CrossReferencedEvent", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DemilestonedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DemilestonedEvent.graphql.swift deleted file mode 100644 index bad335022d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DemilestonedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'demilestoned' event on a given issue or pull request. - static let DemilestonedEvent = Object( - typename: "DemilestonedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DependencyGraphManifest.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DependencyGraphManifest.graphql.swift deleted file mode 100644 index bea7cd0855..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DependencyGraphManifest.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Dependency manifest for a repository - static let DependencyGraphManifest = Object( - typename: "DependencyGraphManifest", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeployKey.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeployKey.graphql.swift deleted file mode 100644 index 4d26fdb8dd..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeployKey.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A repository deploy key. - static let DeployKey = Object( - typename: "DeployKey", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeployedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeployedEvent.graphql.swift deleted file mode 100644 index d386b8f899..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeployedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'deployed' event on a given pull request. - static let DeployedEvent = Object( - typename: "DeployedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Deployment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Deployment.graphql.swift deleted file mode 100644 index 59308ad789..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Deployment.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents triggered deployment instance. - static let Deployment = Object( - typename: "Deployment", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeploymentEnvironmentChangedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeploymentEnvironmentChangedEvent.graphql.swift deleted file mode 100644 index be83fdd7ae..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeploymentEnvironmentChangedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'deployment_environment_changed' event on a given pull request. - static let DeploymentEnvironmentChangedEvent = Object( - typename: "DeploymentEnvironmentChangedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeploymentStatus.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeploymentStatus.graphql.swift deleted file mode 100644 index a89e484200..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DeploymentStatus.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Describes the status of a given deployment attempt. - static let DeploymentStatus = Object( - typename: "DeploymentStatus", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DisconnectedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DisconnectedEvent.graphql.swift deleted file mode 100644 index 3511879afd..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/DisconnectedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'disconnected' event on a given issue or pull request. - static let DisconnectedEvent = Object( - typename: "DisconnectedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Enterprise.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Enterprise.graphql.swift deleted file mode 100644 index 96030051a8..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Enterprise.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An account to manage multiple organizations with consolidated policy and billing. - static let Enterprise = Object( - typename: "Enterprise", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseAdministratorInvitation.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseAdministratorInvitation.graphql.swift deleted file mode 100644 index 7f67ff7a07..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseAdministratorInvitation.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An invitation for a user to become an owner or billing manager of an enterprise. - static let EnterpriseAdministratorInvitation = Object( - typename: "EnterpriseAdministratorInvitation", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseIdentityProvider.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseIdentityProvider.graphql.swift deleted file mode 100644 index 2c243a3673..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseIdentityProvider.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An identity provider configured to provision identities for an enterprise. - static let EnterpriseIdentityProvider = Object( - typename: "EnterpriseIdentityProvider", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseRepositoryInfo.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseRepositoryInfo.graphql.swift deleted file mode 100644 index ebeefa262c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseRepositoryInfo.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A subset of repository information queryable from an enterprise. - static let EnterpriseRepositoryInfo = Object( - typename: "EnterpriseRepositoryInfo", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerInstallation.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerInstallation.graphql.swift deleted file mode 100644 index 8130780127..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerInstallation.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An Enterprise Server installation. - static let EnterpriseServerInstallation = Object( - typename: "EnterpriseServerInstallation", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccount.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccount.graphql.swift deleted file mode 100644 index bf2b4ec5b8..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccount.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A user account on an Enterprise Server installation. - static let EnterpriseServerUserAccount = Object( - typename: "EnterpriseServerUserAccount", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccountEmail.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccountEmail.graphql.swift deleted file mode 100644 index ff9ad99c8f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccountEmail.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An email belonging to a user account on an Enterprise Server installation. - static let EnterpriseServerUserAccountEmail = Object( - typename: "EnterpriseServerUserAccountEmail", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccountsUpload.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccountsUpload.graphql.swift deleted file mode 100644 index 0e3696455f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseServerUserAccountsUpload.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A user accounts upload from an Enterprise Server installation. - static let EnterpriseServerUserAccountsUpload = Object( - typename: "EnterpriseServerUserAccountsUpload", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseUserAccount.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseUserAccount.graphql.swift deleted file mode 100644 index 9c1e57037a..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/EnterpriseUserAccount.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An account for a user who is an admin of an enterprise or a member of an enterprise through one or more organizations. - static let EnterpriseUserAccount = Object( - typename: "EnterpriseUserAccount", - implementedInterfaces: [ - Interfaces.Actor.self, - Interfaces.Node.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ExternalIdentity.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ExternalIdentity.graphql.swift deleted file mode 100644 index 4856adb212..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ExternalIdentity.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An external identity provisioned by SAML SSO or SCIM. - static let ExternalIdentity = Object( - typename: "ExternalIdentity", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Gist.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Gist.graphql.swift deleted file mode 100644 index f6e344b37c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Gist.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A Gist. - static let Gist = Object( - typename: "Gist", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.Starrable.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/GistComment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/GistComment.graphql.swift deleted file mode 100644 index e8d8e1c2b4..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/GistComment.graphql.swift +++ /dev/null @@ -1,19 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a comment on an Gist. - static let GistComment = Object( - typename: "GistComment", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Minimizable.self, - Interfaces.Node.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefDeletedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefDeletedEvent.graphql.swift deleted file mode 100644 index 57fc88e9e5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefDeletedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'head_ref_deleted' event on a given pull request. - static let HeadRefDeletedEvent = Object( - typename: "HeadRefDeletedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefForcePushedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefForcePushedEvent.graphql.swift deleted file mode 100644 index a17ee4b014..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefForcePushedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'head_ref_force_pushed' event on a given pull request. - static let HeadRefForcePushedEvent = Object( - typename: "HeadRefForcePushedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefRestoredEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefRestoredEvent.graphql.swift deleted file mode 100644 index be2688a274..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/HeadRefRestoredEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'head_ref_restored' event on a given pull request. - static let HeadRefRestoredEvent = Object( - typename: "HeadRefRestoredEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IpAllowListEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IpAllowListEntry.graphql.swift deleted file mode 100644 index 7143e41172..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IpAllowListEntry.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An IP address or range of addresses that is allowed to access an owner's resources. - static let IpAllowListEntry = Object( - typename: "IpAllowListEntry", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Issue.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Issue.graphql.swift deleted file mode 100644 index 84adadfb86..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Issue.graphql.swift +++ /dev/null @@ -1,25 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An Issue is a place to discuss ideas, enhancements, tasks, and bugs for a project. - static let Issue = Object( - typename: "Issue", - implementedInterfaces: [ - Interfaces.Assignable.self, - Interfaces.Closable.self, - Interfaces.Comment.self, - Interfaces.Labelable.self, - Interfaces.Lockable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.RepositoryNode.self, - Interfaces.Subscribable.self, - Interfaces.UniformResourceLocatable.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueComment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueComment.graphql.swift deleted file mode 100644 index 64c63e3392..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueComment.graphql.swift +++ /dev/null @@ -1,21 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a comment on an Issue. - static let IssueComment = Object( - typename: "IssueComment", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Minimizable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.RepositoryNode.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueCommentConnection.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueCommentConnection.graphql.swift deleted file mode 100644 index 3b55bf8ace..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueCommentConnection.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The connection type for IssueComment. - static let IssueCommentConnection = Object( - typename: "IssueCommentConnection", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueConnection.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueConnection.graphql.swift deleted file mode 100644 index ffe10c2bc5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/IssueConnection.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The connection type for Issue. - static let IssueConnection = Object( - typename: "IssueConnection", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Label.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Label.graphql.swift deleted file mode 100644 index c93e2a6b06..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Label.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A label for categorizing Issues or Milestones with a given Repository. - static let Label = Object( - typename: "Label", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/LabeledEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/LabeledEvent.graphql.swift deleted file mode 100644 index 26e2f33a6f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/LabeledEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'labeled' event on a given issue or pull request. - static let LabeledEvent = Object( - typename: "LabeledEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Language.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Language.graphql.swift deleted file mode 100644 index 5fd740fc81..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Language.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a given language found in repositories. - static let Language = Object( - typename: "Language", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/License.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/License.graphql.swift deleted file mode 100644 index 73d2b8405b..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/License.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A repository's open source license - static let License = Object( - typename: "License", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/LockedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/LockedEvent.graphql.swift deleted file mode 100644 index 88d57863a5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/LockedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'locked' event on a given issue or pull request. - static let LockedEvent = Object( - typename: "LockedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Mannequin.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Mannequin.graphql.swift deleted file mode 100644 index 165b7b7d3f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Mannequin.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A placeholder user for attribution of imported data on GitHub. - static let Mannequin = Object( - typename: "Mannequin", - implementedInterfaces: [ - Interfaces.Actor.self, - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarkedAsDuplicateEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarkedAsDuplicateEvent.graphql.swift deleted file mode 100644 index bb2c05ac15..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarkedAsDuplicateEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'marked_as_duplicate' event on a given issue or pull request. - static let MarkedAsDuplicateEvent = Object( - typename: "MarkedAsDuplicateEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarketplaceCategory.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarketplaceCategory.graphql.swift deleted file mode 100644 index 1c8bb03273..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarketplaceCategory.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A public description of a Marketplace category. - static let MarketplaceCategory = Object( - typename: "MarketplaceCategory", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarketplaceListing.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarketplaceListing.graphql.swift deleted file mode 100644 index 0e495c4572..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MarketplaceListing.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A listing in the GitHub integration marketplace. - static let MarketplaceListing = Object( - typename: "MarketplaceListing", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposClearAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposClearAuditEntry.graphql.swift deleted file mode 100644 index 7568094c60..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposClearAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a members_can_delete_repos.clear event. - static let MembersCanDeleteReposClearAuditEntry = Object( - typename: "MembersCanDeleteReposClearAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposDisableAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposDisableAuditEntry.graphql.swift deleted file mode 100644 index afba125357..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposDisableAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a members_can_delete_repos.disable event. - static let MembersCanDeleteReposDisableAuditEntry = Object( - typename: "MembersCanDeleteReposDisableAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposEnableAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposEnableAuditEntry.graphql.swift deleted file mode 100644 index 709e3ceb3c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MembersCanDeleteReposEnableAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a members_can_delete_repos.enable event. - static let MembersCanDeleteReposEnableAuditEntry = Object( - typename: "MembersCanDeleteReposEnableAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MentionedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MentionedEvent.graphql.swift deleted file mode 100644 index 362307c505..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MentionedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'mentioned' event on a given issue or pull request. - static let MentionedEvent = Object( - typename: "MentionedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MergedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MergedEvent.graphql.swift deleted file mode 100644 index f57b11a2a1..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MergedEvent.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'merged' event on a given pull request. - static let MergedEvent = Object( - typename: "MergedEvent", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Milestone.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Milestone.graphql.swift deleted file mode 100644 index 678f2fec57..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Milestone.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Milestone object on a given repository. - static let Milestone = Object( - typename: "Milestone", - implementedInterfaces: [ - Interfaces.Closable.self, - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MilestonedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MilestonedEvent.graphql.swift deleted file mode 100644 index 388b2aa92d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MilestonedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'milestoned' event on a given issue or pull request. - static let MilestonedEvent = Object( - typename: "MilestonedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MovedColumnsInProjectEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MovedColumnsInProjectEvent.graphql.swift deleted file mode 100644 index e943413f47..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/MovedColumnsInProjectEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'moved_columns_in_project' event on a given issue or pull request. - static let MovedColumnsInProjectEvent = Object( - typename: "MovedColumnsInProjectEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OauthApplicationCreateAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OauthApplicationCreateAuditEntry.graphql.swift deleted file mode 100644 index 9fea6d7dfe..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OauthApplicationCreateAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a oauth_application.create event. - static let OauthApplicationCreateAuditEntry = Object( - typename: "OauthApplicationCreateAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OauthApplicationAuditEntryData.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgAddBillingManagerAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgAddBillingManagerAuditEntry.graphql.swift deleted file mode 100644 index 31e45f0c5e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgAddBillingManagerAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.add_billing_manager - static let OrgAddBillingManagerAuditEntry = Object( - typename: "OrgAddBillingManagerAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgAddMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgAddMemberAuditEntry.graphql.swift deleted file mode 100644 index aba7e03ec6..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgAddMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.add_member - static let OrgAddMemberAuditEntry = Object( - typename: "OrgAddMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgBlockUserAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgBlockUserAuditEntry.graphql.swift deleted file mode 100644 index 8f82d7e877..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgBlockUserAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.block_user - static let OrgBlockUserAuditEntry = Object( - typename: "OrgBlockUserAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift deleted file mode 100644 index 7375f7585f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.config.disable_collaborators_only event. - static let OrgConfigDisableCollaboratorsOnlyAuditEntry = Object( - typename: "OrgConfigDisableCollaboratorsOnlyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift deleted file mode 100644 index 937ac21e52..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.config.enable_collaborators_only event. - static let OrgConfigEnableCollaboratorsOnlyAuditEntry = Object( - typename: "OrgConfigEnableCollaboratorsOnlyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgCreateAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgCreateAuditEntry.graphql.swift deleted file mode 100644 index 8182a801aa..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgCreateAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.create event. - static let OrgCreateAuditEntry = Object( - typename: "OrgCreateAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift deleted file mode 100644 index b2ef1755a5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableOauthAppRestrictionsAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.disable_oauth_app_restrictions event. - static let OrgDisableOauthAppRestrictionsAuditEntry = Object( - typename: "OrgDisableOauthAppRestrictionsAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableSamlAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableSamlAuditEntry.graphql.swift deleted file mode 100644 index eab42f8515..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableSamlAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.disable_saml event. - static let OrgDisableSamlAuditEntry = Object( - typename: "OrgDisableSamlAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableTwoFactorRequirementAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableTwoFactorRequirementAuditEntry.graphql.swift deleted file mode 100644 index 11ece2a105..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgDisableTwoFactorRequirementAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.disable_two_factor_requirement event. - static let OrgDisableTwoFactorRequirementAuditEntry = Object( - typename: "OrgDisableTwoFactorRequirementAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift deleted file mode 100644 index 5b37b47ef8..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableOauthAppRestrictionsAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.enable_oauth_app_restrictions event. - static let OrgEnableOauthAppRestrictionsAuditEntry = Object( - typename: "OrgEnableOauthAppRestrictionsAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableSamlAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableSamlAuditEntry.graphql.swift deleted file mode 100644 index fb6aead276..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableSamlAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.enable_saml event. - static let OrgEnableSamlAuditEntry = Object( - typename: "OrgEnableSamlAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableTwoFactorRequirementAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableTwoFactorRequirementAuditEntry.graphql.swift deleted file mode 100644 index e8abcbd234..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgEnableTwoFactorRequirementAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.enable_two_factor_requirement event. - static let OrgEnableTwoFactorRequirementAuditEntry = Object( - typename: "OrgEnableTwoFactorRequirementAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgInviteMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgInviteMemberAuditEntry.graphql.swift deleted file mode 100644 index 3018694570..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgInviteMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.invite_member event. - static let OrgInviteMemberAuditEntry = Object( - typename: "OrgInviteMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgInviteToBusinessAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgInviteToBusinessAuditEntry.graphql.swift deleted file mode 100644 index 14ba1df34f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgInviteToBusinessAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.invite_to_business event. - static let OrgInviteToBusinessAuditEntry = Object( - typename: "OrgInviteToBusinessAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessApprovedAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessApprovedAuditEntry.graphql.swift deleted file mode 100644 index 816105e059..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessApprovedAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.oauth_app_access_approved event. - static let OrgOauthAppAccessApprovedAuditEntry = Object( - typename: "OrgOauthAppAccessApprovedAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OauthApplicationAuditEntryData.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessDeniedAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessDeniedAuditEntry.graphql.swift deleted file mode 100644 index d63f53da0a..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessDeniedAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.oauth_app_access_denied event. - static let OrgOauthAppAccessDeniedAuditEntry = Object( - typename: "OrgOauthAppAccessDeniedAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OauthApplicationAuditEntryData.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessRequestedAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessRequestedAuditEntry.graphql.swift deleted file mode 100644 index 4912799f76..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgOauthAppAccessRequestedAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.oauth_app_access_requested event. - static let OrgOauthAppAccessRequestedAuditEntry = Object( - typename: "OrgOauthAppAccessRequestedAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OauthApplicationAuditEntryData.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveBillingManagerAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveBillingManagerAuditEntry.graphql.swift deleted file mode 100644 index c165aac878..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveBillingManagerAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.remove_billing_manager event. - static let OrgRemoveBillingManagerAuditEntry = Object( - typename: "OrgRemoveBillingManagerAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveMemberAuditEntry.graphql.swift deleted file mode 100644 index f99984ea14..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.remove_member event. - static let OrgRemoveMemberAuditEntry = Object( - typename: "OrgRemoveMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift deleted file mode 100644 index a1904f128d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRemoveOutsideCollaboratorAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.remove_outside_collaborator event. - static let OrgRemoveOutsideCollaboratorAuditEntry = Object( - typename: "OrgRemoveOutsideCollaboratorAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberAuditEntry.graphql.swift deleted file mode 100644 index d84a064739..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.restore_member event. - static let OrgRestoreMemberAuditEntry = Object( - typename: "OrgRestoreMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift deleted file mode 100644 index 874c34d14c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipOrganizationAuditEntryData.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Metadata for an organization membership for org.restore_member actions - static let OrgRestoreMemberMembershipOrganizationAuditEntryData = Object( - typename: "OrgRestoreMemberMembershipOrganizationAuditEntryData", - implementedInterfaces: [Interfaces.OrganizationAuditEntryData.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift deleted file mode 100644 index 631ce55f2f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipRepositoryAuditEntryData.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Metadata for a repository membership for org.restore_member actions - static let OrgRestoreMemberMembershipRepositoryAuditEntryData = Object( - typename: "OrgRestoreMemberMembershipRepositoryAuditEntryData", - implementedInterfaces: [Interfaces.RepositoryAuditEntryData.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift deleted file mode 100644 index 5fa1ce9600..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgRestoreMemberMembershipTeamAuditEntryData.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Metadata for a team membership for org.restore_member actions - static let OrgRestoreMemberMembershipTeamAuditEntryData = Object( - typename: "OrgRestoreMemberMembershipTeamAuditEntryData", - implementedInterfaces: [Interfaces.TeamAuditEntryData.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUnblockUserAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUnblockUserAuditEntry.graphql.swift deleted file mode 100644 index 38afa663da..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUnblockUserAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.unblock_user - static let OrgUnblockUserAuditEntry = Object( - typename: "OrgUnblockUserAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift deleted file mode 100644 index 78febd80c2..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateDefaultRepositoryPermissionAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.update_default_repository_permission - static let OrgUpdateDefaultRepositoryPermissionAuditEntry = Object( - typename: "OrgUpdateDefaultRepositoryPermissionAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberAuditEntry.graphql.swift deleted file mode 100644 index 010633c28e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.update_member event. - static let OrgUpdateMemberAuditEntry = Object( - typename: "OrgUpdateMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift deleted file mode 100644 index 48ef3fb9e5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberRepositoryCreationPermissionAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.update_member_repository_creation_permission event. - static let OrgUpdateMemberRepositoryCreationPermissionAuditEntry = Object( - typename: "OrgUpdateMemberRepositoryCreationPermissionAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift deleted file mode 100644 index d057de8be3..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrgUpdateMemberRepositoryInvitationPermissionAuditEntry.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a org.update_member_repository_invitation_permission event. - static let OrgUpdateMemberRepositoryInvitationPermissionAuditEntry = Object( - typename: "OrgUpdateMemberRepositoryInvitationPermissionAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Organization.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Organization.graphql.swift deleted file mode 100644 index 81cfc623af..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Organization.graphql.swift +++ /dev/null @@ -1,22 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An account on GitHub, with one or more owners, that has repositories, members and teams. - static let Organization = Object( - typename: "Organization", - implementedInterfaces: [ - Interfaces.Actor.self, - Interfaces.MemberStatusable.self, - Interfaces.Node.self, - Interfaces.PackageOwner.self, - Interfaces.ProfileOwner.self, - Interfaces.ProjectOwner.self, - Interfaces.RepositoryOwner.self, - Interfaces.Sponsorable.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrganizationIdentityProvider.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrganizationIdentityProvider.graphql.swift deleted file mode 100644 index 1832e3b457..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrganizationIdentityProvider.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An Identity Provider configured to provision SAML and SCIM identities for Organizations - static let OrganizationIdentityProvider = Object( - typename: "OrganizationIdentityProvider", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrganizationInvitation.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrganizationInvitation.graphql.swift deleted file mode 100644 index 0a25d3611c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/OrganizationInvitation.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An Invitation for a user to an organization. - static let OrganizationInvitation = Object( - typename: "OrganizationInvitation", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Package.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Package.graphql.swift deleted file mode 100644 index 07576a1e28..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Package.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Information for an uploaded package. - static let Package = Object( - typename: "Package", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageFile.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageFile.graphql.swift deleted file mode 100644 index 641341c13d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageFile.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A file in a package version. - static let PackageFile = Object( - typename: "PackageFile", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageTag.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageTag.graphql.swift deleted file mode 100644 index d9cf483cd7..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageTag.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A version tag contains the mapping between a tag name and a version. - static let PackageTag = Object( - typename: "PackageTag", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageVersion.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageVersion.graphql.swift deleted file mode 100644 index 3368f36850..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PackageVersion.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Information about a specific package version. - static let PackageVersion = Object( - typename: "PackageVersion", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PinnedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PinnedEvent.graphql.swift deleted file mode 100644 index 69e49339e0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PinnedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'pinned' event on a given issue or pull request. - static let PinnedEvent = Object( - typename: "PinnedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PinnedIssue.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PinnedIssue.graphql.swift deleted file mode 100644 index 5a3bbb3fda..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PinnedIssue.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A Pinned Issue is a issue pinned to a repository's index page. - static let PinnedIssue = Object( - typename: "PinnedIssue", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PrivateRepositoryForkingDisableAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PrivateRepositoryForkingDisableAuditEntry.graphql.swift deleted file mode 100644 index 2389c39c6f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PrivateRepositoryForkingDisableAuditEntry.graphql.swift +++ /dev/null @@ -1,18 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a private_repository_forking.disable event. - static let PrivateRepositoryForkingDisableAuditEntry = Object( - typename: "PrivateRepositoryForkingDisableAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PrivateRepositoryForkingEnableAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PrivateRepositoryForkingEnableAuditEntry.graphql.swift deleted file mode 100644 index a329a4da85..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PrivateRepositoryForkingEnableAuditEntry.graphql.swift +++ /dev/null @@ -1,18 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a private_repository_forking.enable event. - static let PrivateRepositoryForkingEnableAuditEntry = Object( - typename: "PrivateRepositoryForkingEnableAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Project.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Project.graphql.swift deleted file mode 100644 index d4f92de58c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Project.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Projects manage issues, pull requests and notes within a project owner. - static let Project = Object( - typename: "Project", - implementedInterfaces: [ - Interfaces.Closable.self, - Interfaces.Node.self, - Interfaces.Updatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ProjectCard.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ProjectCard.graphql.swift deleted file mode 100644 index 35abda68b3..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ProjectCard.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A card in a project. - static let ProjectCard = Object( - typename: "ProjectCard", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ProjectColumn.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ProjectColumn.graphql.swift deleted file mode 100644 index f7b521196d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ProjectColumn.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A column inside a project. - static let ProjectColumn = Object( - typename: "ProjectColumn", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PublicKey.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PublicKey.graphql.swift deleted file mode 100644 index 90a59dee49..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PublicKey.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A user's public key. - static let PublicKey = Object( - typename: "PublicKey", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequest.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequest.graphql.swift deleted file mode 100644 index a1cc73ca65..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequest.graphql.swift +++ /dev/null @@ -1,25 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A repository pull request. - static let PullRequest = Object( - typename: "PullRequest", - implementedInterfaces: [ - Interfaces.Assignable.self, - Interfaces.Closable.self, - Interfaces.Comment.self, - Interfaces.Labelable.self, - Interfaces.Lockable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.RepositoryNode.self, - Interfaces.Subscribable.self, - Interfaces.UniformResourceLocatable.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestCommit.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestCommit.graphql.swift deleted file mode 100644 index b05805cd10..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestCommit.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Git commit part of a pull request. - static let PullRequestCommit = Object( - typename: "PullRequestCommit", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestCommitCommentThread.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestCommitCommentThread.graphql.swift deleted file mode 100644 index 5117855c6f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestCommitCommentThread.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a commit comment thread part of a pull request. - static let PullRequestCommitCommentThread = Object( - typename: "PullRequestCommitCommentThread", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.RepositoryNode.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReview.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReview.graphql.swift deleted file mode 100644 index 38e7b27eb0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReview.graphql.swift +++ /dev/null @@ -1,20 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A review object for a given pull request. - static let PullRequestReview = Object( - typename: "PullRequestReview", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.RepositoryNode.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReviewComment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReviewComment.graphql.swift deleted file mode 100644 index 7ce4c40006..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReviewComment.graphql.swift +++ /dev/null @@ -1,21 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A review comment associated with a given repository pull request. - static let PullRequestReviewComment = Object( - typename: "PullRequestReviewComment", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Minimizable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.RepositoryNode.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReviewThread.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReviewThread.graphql.swift deleted file mode 100644 index 27888f89e5..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PullRequestReviewThread.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A threaded list of comments for a given pull request. - static let PullRequestReviewThread = Object( - typename: "PullRequestReviewThread", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Push.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Push.graphql.swift deleted file mode 100644 index eab877c978..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Push.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A Git push. - static let Push = Object( - typename: "Push", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PushAllowance.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PushAllowance.graphql.swift deleted file mode 100644 index d5e1c2e89a..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/PushAllowance.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A team, user or app who has the ability to push to a protected branch. - static let PushAllowance = Object( - typename: "PushAllowance", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Query.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Query.graphql.swift deleted file mode 100644 index 55202cf40a..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Query.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The query root of GitHub's GraphQL interface. - static let Query = Object( - typename: "Query", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Reaction.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Reaction.graphql.swift deleted file mode 100644 index 5621020a69..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Reaction.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An emoji reaction to a particular piece of content. - static let Reaction = Object( - typename: "Reaction", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReadyForReviewEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReadyForReviewEvent.graphql.swift deleted file mode 100644 index 04721d3696..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReadyForReviewEvent.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'ready_for_review' event on a given pull request. - static let ReadyForReviewEvent = Object( - typename: "ReadyForReviewEvent", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Ref.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Ref.graphql.swift deleted file mode 100644 index 0c77394edb..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Ref.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Git reference. - static let Ref = Object( - typename: "Ref", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReferencedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReferencedEvent.graphql.swift deleted file mode 100644 index 49c3a4a3b0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReferencedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'referenced' event on a given `ReferencedSubject`. - static let ReferencedEvent = Object( - typename: "ReferencedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Release.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Release.graphql.swift deleted file mode 100644 index 411d582188..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Release.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A release contains the content for a release. - static let Release = Object( - typename: "Release", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReleaseAsset.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReleaseAsset.graphql.swift deleted file mode 100644 index b78acf8b3c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReleaseAsset.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A release asset contains the content for a release asset. - static let ReleaseAsset = Object( - typename: "ReleaseAsset", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RemovedFromProjectEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RemovedFromProjectEvent.graphql.swift deleted file mode 100644 index 6baaa9e8ba..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RemovedFromProjectEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'removed_from_project' event on a given issue or pull request. - static let RemovedFromProjectEvent = Object( - typename: "RemovedFromProjectEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RenamedTitleEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RenamedTitleEvent.graphql.swift deleted file mode 100644 index e199b122fa..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RenamedTitleEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'renamed' event on a given issue or pull request - static let RenamedTitleEvent = Object( - typename: "RenamedTitleEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReopenedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReopenedEvent.graphql.swift deleted file mode 100644 index 611a17ef2e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReopenedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'reopened' event on any `Closable`. - static let ReopenedEvent = Object( - typename: "ReopenedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAccessAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAccessAuditEntry.graphql.swift deleted file mode 100644 index 6d070c7796..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAccessAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.access event. - static let RepoAccessAuditEntry = Object( - typename: "RepoAccessAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAddMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAddMemberAuditEntry.graphql.swift deleted file mode 100644 index c7a0512736..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAddMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.add_member event. - static let RepoAddMemberAuditEntry = Object( - typename: "RepoAddMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAddTopicAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAddTopicAuditEntry.graphql.swift deleted file mode 100644 index 95607d0461..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoAddTopicAuditEntry.graphql.swift +++ /dev/null @@ -1,18 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.add_topic event. - static let RepoAddTopicAuditEntry = Object( - typename: "RepoAddTopicAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self, - Interfaces.TopicAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoArchivedAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoArchivedAuditEntry.graphql.swift deleted file mode 100644 index ef8fdc88f2..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoArchivedAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.archived event. - static let RepoArchivedAuditEntry = Object( - typename: "RepoArchivedAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoChangeMergeSettingAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoChangeMergeSettingAuditEntry.graphql.swift deleted file mode 100644 index 916e09cb9e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoChangeMergeSettingAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.change_merge_setting event. - static let RepoChangeMergeSettingAuditEntry = Object( - typename: "RepoChangeMergeSettingAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift deleted file mode 100644 index df52cfc55f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableAnonymousGitAccessAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.disable_anonymous_git_access event. - static let RepoConfigDisableAnonymousGitAccessAuditEntry = Object( - typename: "RepoConfigDisableAnonymousGitAccessAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift deleted file mode 100644 index 7b07d54ce0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableCollaboratorsOnlyAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.disable_collaborators_only event. - static let RepoConfigDisableCollaboratorsOnlyAuditEntry = Object( - typename: "RepoConfigDisableCollaboratorsOnlyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift deleted file mode 100644 index b58feee948..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableContributorsOnlyAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.disable_contributors_only event. - static let RepoConfigDisableContributorsOnlyAuditEntry = Object( - typename: "RepoConfigDisableContributorsOnlyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift deleted file mode 100644 index 034a28f59f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigDisableSockpuppetDisallowedAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.disable_sockpuppet_disallowed event. - static let RepoConfigDisableSockpuppetDisallowedAuditEntry = Object( - typename: "RepoConfigDisableSockpuppetDisallowedAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift deleted file mode 100644 index 35fb4220ed..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableAnonymousGitAccessAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.enable_anonymous_git_access event. - static let RepoConfigEnableAnonymousGitAccessAuditEntry = Object( - typename: "RepoConfigEnableAnonymousGitAccessAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift deleted file mode 100644 index 5e6c17152d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableCollaboratorsOnlyAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.enable_collaborators_only event. - static let RepoConfigEnableCollaboratorsOnlyAuditEntry = Object( - typename: "RepoConfigEnableCollaboratorsOnlyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift deleted file mode 100644 index 9f6eb7ab3b..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableContributorsOnlyAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.enable_contributors_only event. - static let RepoConfigEnableContributorsOnlyAuditEntry = Object( - typename: "RepoConfigEnableContributorsOnlyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift deleted file mode 100644 index 3820031ddf..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigEnableSockpuppetDisallowedAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.enable_sockpuppet_disallowed event. - static let RepoConfigEnableSockpuppetDisallowedAuditEntry = Object( - typename: "RepoConfigEnableSockpuppetDisallowedAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift deleted file mode 100644 index cb23b6a670..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigLockAnonymousGitAccessAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.lock_anonymous_git_access event. - static let RepoConfigLockAnonymousGitAccessAuditEntry = Object( - typename: "RepoConfigLockAnonymousGitAccessAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift deleted file mode 100644 index a70bd0ee5d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoConfigUnlockAnonymousGitAccessAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.config.unlock_anonymous_git_access event. - static let RepoConfigUnlockAnonymousGitAccessAuditEntry = Object( - typename: "RepoConfigUnlockAnonymousGitAccessAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoCreateAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoCreateAuditEntry.graphql.swift deleted file mode 100644 index c8bc64f73e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoCreateAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.create event. - static let RepoCreateAuditEntry = Object( - typename: "RepoCreateAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoDestroyAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoDestroyAuditEntry.graphql.swift deleted file mode 100644 index a72aae7f7b..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoDestroyAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.destroy event. - static let RepoDestroyAuditEntry = Object( - typename: "RepoDestroyAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoRemoveMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoRemoveMemberAuditEntry.graphql.swift deleted file mode 100644 index 8bdd0987e7..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoRemoveMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.remove_member event. - static let RepoRemoveMemberAuditEntry = Object( - typename: "RepoRemoveMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoRemoveTopicAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoRemoveTopicAuditEntry.graphql.swift deleted file mode 100644 index 19fc602bd9..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepoRemoveTopicAuditEntry.graphql.swift +++ /dev/null @@ -1,18 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repo.remove_topic event. - static let RepoRemoveTopicAuditEntry = Object( - typename: "RepoRemoveTopicAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self, - Interfaces.TopicAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Repository.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Repository.graphql.swift deleted file mode 100644 index e7966ae774..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Repository.graphql.swift +++ /dev/null @@ -1,20 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A repository contains the content for a project. - static let Repository = Object( - typename: "Repository", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.PackageOwner.self, - Interfaces.ProjectOwner.self, - Interfaces.RepositoryInfo.self, - Interfaces.Starrable.self, - Interfaces.Subscribable.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryInvitation.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryInvitation.graphql.swift deleted file mode 100644 index f6e9a4f288..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryInvitation.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An invitation for a user to be added to a repository. - static let RepositoryInvitation = Object( - typename: "RepositoryInvitation", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryTopic.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryTopic.graphql.swift deleted file mode 100644 index ffbe3d76a7..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryTopic.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A repository-topic connects a repository to a topic. - static let RepositoryTopic = Object( - typename: "RepositoryTopic", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVisibilityChangeDisableAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVisibilityChangeDisableAuditEntry.graphql.swift deleted file mode 100644 index a1743b8453..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVisibilityChangeDisableAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repository_visibility_change.disable event. - static let RepositoryVisibilityChangeDisableAuditEntry = Object( - typename: "RepositoryVisibilityChangeDisableAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVisibilityChangeEnableAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVisibilityChangeEnableAuditEntry.graphql.swift deleted file mode 100644 index ab077ce8af..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVisibilityChangeEnableAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a repository_visibility_change.enable event. - static let RepositoryVisibilityChangeEnableAuditEntry = Object( - typename: "RepositoryVisibilityChangeEnableAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.EnterpriseAuditEntryData.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVulnerabilityAlert.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVulnerabilityAlert.graphql.swift deleted file mode 100644 index 11d3508212..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/RepositoryVulnerabilityAlert.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A alert for a repository with an affected vulnerability. - static let RepositoryVulnerabilityAlert = Object( - typename: "RepositoryVulnerabilityAlert", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.RepositoryNode.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewDismissalAllowance.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewDismissalAllowance.graphql.swift deleted file mode 100644 index 99a290748d..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewDismissalAllowance.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A team or user who has the ability to dismiss a review on a protected branch. - static let ReviewDismissalAllowance = Object( - typename: "ReviewDismissalAllowance", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewDismissedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewDismissedEvent.graphql.swift deleted file mode 100644 index fcb2562b97..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewDismissedEvent.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'review_dismissed' event on a given issue or pull request. - static let ReviewDismissedEvent = Object( - typename: "ReviewDismissedEvent", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequest.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequest.graphql.swift deleted file mode 100644 index a93b78387f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequest.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A request for a user to review a pull request. - static let ReviewRequest = Object( - typename: "ReviewRequest", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequestRemovedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequestRemovedEvent.graphql.swift deleted file mode 100644 index 9cada397e9..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequestRemovedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'review_request_removed' event on a given pull request. - static let ReviewRequestRemovedEvent = Object( - typename: "ReviewRequestRemovedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequestedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequestedEvent.graphql.swift deleted file mode 100644 index 1277c7b34b..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/ReviewRequestedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'review_requested' event on a given pull request. - static let ReviewRequestedEvent = Object( - typename: "ReviewRequestedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SavedReply.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SavedReply.graphql.swift deleted file mode 100644 index dd96770077..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SavedReply.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A Saved Reply is text a user can use to reply quickly. - static let SavedReply = Object( - typename: "SavedReply", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SecurityAdvisory.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SecurityAdvisory.graphql.swift deleted file mode 100644 index f4c5bb06bb..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SecurityAdvisory.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A GitHub Security Advisory - static let SecurityAdvisory = Object( - typename: "SecurityAdvisory", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SponsorsListing.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SponsorsListing.graphql.swift deleted file mode 100644 index f102dd3239..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SponsorsListing.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A GitHub Sponsors listing. - static let SponsorsListing = Object( - typename: "SponsorsListing", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SponsorsTier.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SponsorsTier.graphql.swift deleted file mode 100644 index 9c6dd0b638..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SponsorsTier.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A GitHub Sponsors tier associated with a GitHub Sponsors listing. - static let SponsorsTier = Object( - typename: "SponsorsTier", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Sponsorship.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Sponsorship.graphql.swift deleted file mode 100644 index 69a81d5c73..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Sponsorship.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A sponsorship relationship between a sponsor and a maintainer - static let Sponsorship = Object( - typename: "Sponsorship", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Status.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Status.graphql.swift deleted file mode 100644 index 2e8ece991f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Status.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a commit status. - static let Status = Object( - typename: "Status", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/StatusCheckRollup.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/StatusCheckRollup.graphql.swift deleted file mode 100644 index 4865053fde..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/StatusCheckRollup.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents the rollup for both the check runs and status for a commit. - static let StatusCheckRollup = Object( - typename: "StatusCheckRollup", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/StatusContext.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/StatusContext.graphql.swift deleted file mode 100644 index f65b9eedbb..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/StatusContext.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an individual commit status context - static let StatusContext = Object( - typename: "StatusContext", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SubscribedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SubscribedEvent.graphql.swift deleted file mode 100644 index 3652dcb66c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/SubscribedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'subscribed' event on a given `Subscribable`. - static let SubscribedEvent = Object( - typename: "SubscribedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Tag.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Tag.graphql.swift deleted file mode 100644 index fc5d78cdc0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Tag.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Git tag. - static let Tag = Object( - typename: "Tag", - implementedInterfaces: [ - Interfaces.GitObject.self, - Interfaces.Node.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Team.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Team.graphql.swift deleted file mode 100644 index 5de199561e..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Team.graphql.swift +++ /dev/null @@ -1,16 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A team of users in an organization. - static let Team = Object( - typename: "Team", - implementedInterfaces: [ - Interfaces.MemberStatusable.self, - Interfaces.Node.self, - Interfaces.Subscribable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamAddMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamAddMemberAuditEntry.graphql.swift deleted file mode 100644 index 6a00f32840..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamAddMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a team.add_member event. - static let TeamAddMemberAuditEntry = Object( - typename: "TeamAddMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.TeamAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamAddRepositoryAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamAddRepositoryAuditEntry.graphql.swift deleted file mode 100644 index 88e0f83566..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamAddRepositoryAuditEntry.graphql.swift +++ /dev/null @@ -1,18 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a team.add_repository event. - static let TeamAddRepositoryAuditEntry = Object( - typename: "TeamAddRepositoryAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self, - Interfaces.TeamAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamChangeParentTeamAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamChangeParentTeamAuditEntry.graphql.swift deleted file mode 100644 index d269ca2c18..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamChangeParentTeamAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a team.change_parent_team event. - static let TeamChangeParentTeamAuditEntry = Object( - typename: "TeamChangeParentTeamAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.TeamAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamDiscussion.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamDiscussion.graphql.swift deleted file mode 100644 index afe6a141cc..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamDiscussion.graphql.swift +++ /dev/null @@ -1,21 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A team discussion. - static let TeamDiscussion = Object( - typename: "TeamDiscussion", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.Subscribable.self, - Interfaces.UniformResourceLocatable.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamDiscussionComment.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamDiscussionComment.graphql.swift deleted file mode 100644 index fe9fa46779..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamDiscussionComment.graphql.swift +++ /dev/null @@ -1,20 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A comment on a team discussion. - static let TeamDiscussionComment = Object( - typename: "TeamDiscussionComment", - implementedInterfaces: [ - Interfaces.Comment.self, - Interfaces.Deletable.self, - Interfaces.Node.self, - Interfaces.Reactable.self, - Interfaces.UniformResourceLocatable.self, - Interfaces.Updatable.self, - Interfaces.UpdatableComment.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamRemoveMemberAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamRemoveMemberAuditEntry.graphql.swift deleted file mode 100644 index 749f568674..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamRemoveMemberAuditEntry.graphql.swift +++ /dev/null @@ -1,17 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a team.remove_member event. - static let TeamRemoveMemberAuditEntry = Object( - typename: "TeamRemoveMemberAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.TeamAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamRemoveRepositoryAuditEntry.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamRemoveRepositoryAuditEntry.graphql.swift deleted file mode 100644 index 11e8b2d339..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TeamRemoveRepositoryAuditEntry.graphql.swift +++ /dev/null @@ -1,18 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Audit log entry for a team.remove_repository event. - static let TeamRemoveRepositoryAuditEntry = Object( - typename: "TeamRemoveRepositoryAuditEntry", - implementedInterfaces: [ - Interfaces.AuditEntry.self, - Interfaces.Node.self, - Interfaces.OrganizationAuditEntryData.self, - Interfaces.RepositoryAuditEntryData.self, - Interfaces.TeamAuditEntryData.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Topic.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Topic.graphql.swift deleted file mode 100644 index 8491fc9339..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Topic.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A topic aggregates entities that are related to a subject. - static let Topic = Object( - typename: "Topic", - implementedInterfaces: [ - Interfaces.Node.self, - Interfaces.Starrable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TransferredEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TransferredEvent.graphql.swift deleted file mode 100644 index bf32386f30..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/TransferredEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'transferred' event on a given issue or pull request. - static let TransferredEvent = Object( - typename: "TransferredEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Tree.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Tree.graphql.swift deleted file mode 100644 index 4f164a85b9..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/Tree.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a Git tree. - static let Tree = Object( - typename: "Tree", - implementedInterfaces: [ - Interfaces.GitObject.self, - Interfaces.Node.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnassignedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnassignedEvent.graphql.swift deleted file mode 100644 index 46836afa99..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnassignedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'unassigned' event on any assignable object. - static let UnassignedEvent = Object( - typename: "UnassignedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnlabeledEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnlabeledEvent.graphql.swift deleted file mode 100644 index 10840ca448..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnlabeledEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'unlabeled' event on a given issue or pull request. - static let UnlabeledEvent = Object( - typename: "UnlabeledEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnlockedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnlockedEvent.graphql.swift deleted file mode 100644 index b85dddcc96..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnlockedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'unlocked' event on a given issue or pull request. - static let UnlockedEvent = Object( - typename: "UnlockedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnmarkedAsDuplicateEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnmarkedAsDuplicateEvent.graphql.swift deleted file mode 100644 index df543f5a9f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnmarkedAsDuplicateEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'unmarked_as_duplicate' event on a given issue or pull request. - static let UnmarkedAsDuplicateEvent = Object( - typename: "UnmarkedAsDuplicateEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnpinnedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnpinnedEvent.graphql.swift deleted file mode 100644 index 2cb381c95f..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnpinnedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'unpinned' event on a given issue or pull request. - static let UnpinnedEvent = Object( - typename: "UnpinnedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnsubscribedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnsubscribedEvent.graphql.swift deleted file mode 100644 index f08ee33fc9..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UnsubscribedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents an 'unsubscribed' event on a given `Subscribable`. - static let UnsubscribedEvent = Object( - typename: "UnsubscribedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/User.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/User.graphql.swift deleted file mode 100644 index 254789e124..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/User.graphql.swift +++ /dev/null @@ -1,21 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A user is an individual's account on GitHub that owns repositories and can make new content. - static let User = Object( - typename: "User", - implementedInterfaces: [ - Interfaces.Actor.self, - Interfaces.Node.self, - Interfaces.PackageOwner.self, - Interfaces.ProfileOwner.self, - Interfaces.ProjectOwner.self, - Interfaces.RepositoryOwner.self, - Interfaces.Sponsorable.self, - Interfaces.UniformResourceLocatable.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserBlockedEvent.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserBlockedEvent.graphql.swift deleted file mode 100644 index 20ff46efb3..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserBlockedEvent.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a 'user_blocked' event on a given user. - static let UserBlockedEvent = Object( - typename: "UserBlockedEvent", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserContentEdit.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserContentEdit.graphql.swift deleted file mode 100644 index 049cc5bc66..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserContentEdit.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An edit on user content - static let UserContentEdit = Object( - typename: "UserContentEdit", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserStatus.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserStatus.graphql.swift deleted file mode 100644 index 6aeb837a05..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Objects/UserStatus.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The user's description of what they're currently doing. - static let UserStatus = Object( - typename: "UserStatus", - implementedInterfaces: [Interfaces.Node.self] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/SchemaConfiguration.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/SchemaConfiguration.swift deleted file mode 100644 index 7976ecf827..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/SchemaConfiguration.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// provide custom configuration for a generated GraphQL schema. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } -} diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/SchemaMetadata.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/SchemaMetadata.graphql.swift deleted file mode 100644 index e4c9d1e8d0..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/SchemaMetadata.graphql.swift +++ /dev/null @@ -1,223 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public typealias ID = String - -public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet -where Schema == GitHubAPI.SchemaMetadata {} - -public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment -where Schema == GitHubAPI.SchemaMetadata {} - -public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet -where Schema == GitHubAPI.SchemaMetadata {} - -public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment -where Schema == GitHubAPI.SchemaMetadata {} - -public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - - public static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "Query": return GitHubAPI.Objects.Query - case "Repository": return GitHubAPI.Objects.Repository - case "AddedToProjectEvent": return GitHubAPI.Objects.AddedToProjectEvent - case "App": return GitHubAPI.Objects.App - case "AssignedEvent": return GitHubAPI.Objects.AssignedEvent - case "AutomaticBaseChangeFailedEvent": return GitHubAPI.Objects.AutomaticBaseChangeFailedEvent - case "AutomaticBaseChangeSucceededEvent": return GitHubAPI.Objects.AutomaticBaseChangeSucceededEvent - case "BaseRefChangedEvent": return GitHubAPI.Objects.BaseRefChangedEvent - case "BaseRefForcePushedEvent": return GitHubAPI.Objects.BaseRefForcePushedEvent - case "Blob": return GitHubAPI.Objects.Blob - case "Commit": return GitHubAPI.Objects.Commit - case "Issue": return GitHubAPI.Objects.Issue - case "PullRequest": return GitHubAPI.Objects.PullRequest - case "Milestone": return GitHubAPI.Objects.Milestone - case "Bot": return GitHubAPI.Objects.Bot - case "EnterpriseUserAccount": return GitHubAPI.Objects.EnterpriseUserAccount - case "Mannequin": return GitHubAPI.Objects.Mannequin - case "Organization": return GitHubAPI.Objects.Organization - case "Team": return GitHubAPI.Objects.Team - case "User": return GitHubAPI.Objects.User - case "CheckRun": return GitHubAPI.Objects.CheckRun - case "ClosedEvent": return GitHubAPI.Objects.ClosedEvent - case "ConvertToDraftEvent": return GitHubAPI.Objects.ConvertToDraftEvent - case "CrossReferencedEvent": return GitHubAPI.Objects.CrossReferencedEvent - case "Gist": return GitHubAPI.Objects.Gist - case "Topic": return GitHubAPI.Objects.Topic - case "MergedEvent": return GitHubAPI.Objects.MergedEvent - case "PullRequestCommit": return GitHubAPI.Objects.PullRequestCommit - case "ReadyForReviewEvent": return GitHubAPI.Objects.ReadyForReviewEvent - case "Release": return GitHubAPI.Objects.Release - case "RepositoryTopic": return GitHubAPI.Objects.RepositoryTopic - case "ReviewDismissedEvent": return GitHubAPI.Objects.ReviewDismissedEvent - case "TeamDiscussion": return GitHubAPI.Objects.TeamDiscussion - case "CommitComment": return GitHubAPI.Objects.CommitComment - case "GistComment": return GitHubAPI.Objects.GistComment - case "IssueComment": return GitHubAPI.Objects.IssueComment - case "PullRequestReview": return GitHubAPI.Objects.PullRequestReview - case "CommitCommentThread": return GitHubAPI.Objects.CommitCommentThread - case "PullRequestCommitCommentThread": return GitHubAPI.Objects.PullRequestCommitCommentThread - case "PullRequestReviewComment": return GitHubAPI.Objects.PullRequestReviewComment - case "Project": return GitHubAPI.Objects.Project - case "TeamDiscussionComment": return GitHubAPI.Objects.TeamDiscussionComment - case "RepositoryVulnerabilityAlert": return GitHubAPI.Objects.RepositoryVulnerabilityAlert - case "Tag": return GitHubAPI.Objects.Tag - case "Tree": return GitHubAPI.Objects.Tree - case "BranchProtectionRule": return GitHubAPI.Objects.BranchProtectionRule - case "CheckSuite": return GitHubAPI.Objects.CheckSuite - case "CodeOfConduct": return GitHubAPI.Objects.CodeOfConduct - case "CommentDeletedEvent": return GitHubAPI.Objects.CommentDeletedEvent - case "ConnectedEvent": return GitHubAPI.Objects.ConnectedEvent - case "ConvertedNoteToIssueEvent": return GitHubAPI.Objects.ConvertedNoteToIssueEvent - case "DemilestonedEvent": return GitHubAPI.Objects.DemilestonedEvent - case "DependencyGraphManifest": return GitHubAPI.Objects.DependencyGraphManifest - case "DeployKey": return GitHubAPI.Objects.DeployKey - case "DeployedEvent": return GitHubAPI.Objects.DeployedEvent - case "Deployment": return GitHubAPI.Objects.Deployment - case "DeploymentEnvironmentChangedEvent": return GitHubAPI.Objects.DeploymentEnvironmentChangedEvent - case "DeploymentStatus": return GitHubAPI.Objects.DeploymentStatus - case "DisconnectedEvent": return GitHubAPI.Objects.DisconnectedEvent - case "Enterprise": return GitHubAPI.Objects.Enterprise - case "EnterpriseAdministratorInvitation": return GitHubAPI.Objects.EnterpriseAdministratorInvitation - case "EnterpriseIdentityProvider": return GitHubAPI.Objects.EnterpriseIdentityProvider - case "EnterpriseRepositoryInfo": return GitHubAPI.Objects.EnterpriseRepositoryInfo - case "EnterpriseServerInstallation": return GitHubAPI.Objects.EnterpriseServerInstallation - case "EnterpriseServerUserAccount": return GitHubAPI.Objects.EnterpriseServerUserAccount - case "EnterpriseServerUserAccountEmail": return GitHubAPI.Objects.EnterpriseServerUserAccountEmail - case "EnterpriseServerUserAccountsUpload": return GitHubAPI.Objects.EnterpriseServerUserAccountsUpload - case "ExternalIdentity": return GitHubAPI.Objects.ExternalIdentity - case "HeadRefDeletedEvent": return GitHubAPI.Objects.HeadRefDeletedEvent - case "HeadRefForcePushedEvent": return GitHubAPI.Objects.HeadRefForcePushedEvent - case "HeadRefRestoredEvent": return GitHubAPI.Objects.HeadRefRestoredEvent - case "IpAllowListEntry": return GitHubAPI.Objects.IpAllowListEntry - case "Label": return GitHubAPI.Objects.Label - case "LabeledEvent": return GitHubAPI.Objects.LabeledEvent - case "Language": return GitHubAPI.Objects.Language - case "License": return GitHubAPI.Objects.License - case "LockedEvent": return GitHubAPI.Objects.LockedEvent - case "MarkedAsDuplicateEvent": return GitHubAPI.Objects.MarkedAsDuplicateEvent - case "MarketplaceCategory": return GitHubAPI.Objects.MarketplaceCategory - case "MarketplaceListing": return GitHubAPI.Objects.MarketplaceListing - case "MembersCanDeleteReposClearAuditEntry": return GitHubAPI.Objects.MembersCanDeleteReposClearAuditEntry - case "MembersCanDeleteReposDisableAuditEntry": return GitHubAPI.Objects.MembersCanDeleteReposDisableAuditEntry - case "MembersCanDeleteReposEnableAuditEntry": return GitHubAPI.Objects.MembersCanDeleteReposEnableAuditEntry - case "OauthApplicationCreateAuditEntry": return GitHubAPI.Objects.OauthApplicationCreateAuditEntry - case "OrgOauthAppAccessApprovedAuditEntry": return GitHubAPI.Objects.OrgOauthAppAccessApprovedAuditEntry - case "OrgOauthAppAccessDeniedAuditEntry": return GitHubAPI.Objects.OrgOauthAppAccessDeniedAuditEntry - case "OrgOauthAppAccessRequestedAuditEntry": return GitHubAPI.Objects.OrgOauthAppAccessRequestedAuditEntry - case "OrgAddBillingManagerAuditEntry": return GitHubAPI.Objects.OrgAddBillingManagerAuditEntry - case "OrgAddMemberAuditEntry": return GitHubAPI.Objects.OrgAddMemberAuditEntry - case "OrgBlockUserAuditEntry": return GitHubAPI.Objects.OrgBlockUserAuditEntry - case "OrgConfigDisableCollaboratorsOnlyAuditEntry": return GitHubAPI.Objects.OrgConfigDisableCollaboratorsOnlyAuditEntry - case "OrgConfigEnableCollaboratorsOnlyAuditEntry": return GitHubAPI.Objects.OrgConfigEnableCollaboratorsOnlyAuditEntry - case "OrgCreateAuditEntry": return GitHubAPI.Objects.OrgCreateAuditEntry - case "OrgDisableOauthAppRestrictionsAuditEntry": return GitHubAPI.Objects.OrgDisableOauthAppRestrictionsAuditEntry - case "OrgDisableSamlAuditEntry": return GitHubAPI.Objects.OrgDisableSamlAuditEntry - case "OrgDisableTwoFactorRequirementAuditEntry": return GitHubAPI.Objects.OrgDisableTwoFactorRequirementAuditEntry - case "OrgEnableOauthAppRestrictionsAuditEntry": return GitHubAPI.Objects.OrgEnableOauthAppRestrictionsAuditEntry - case "OrgEnableSamlAuditEntry": return GitHubAPI.Objects.OrgEnableSamlAuditEntry - case "OrgEnableTwoFactorRequirementAuditEntry": return GitHubAPI.Objects.OrgEnableTwoFactorRequirementAuditEntry - case "OrgInviteMemberAuditEntry": return GitHubAPI.Objects.OrgInviteMemberAuditEntry - case "OrgInviteToBusinessAuditEntry": return GitHubAPI.Objects.OrgInviteToBusinessAuditEntry - case "OrgRemoveBillingManagerAuditEntry": return GitHubAPI.Objects.OrgRemoveBillingManagerAuditEntry - case "OrgRemoveMemberAuditEntry": return GitHubAPI.Objects.OrgRemoveMemberAuditEntry - case "OrgRemoveOutsideCollaboratorAuditEntry": return GitHubAPI.Objects.OrgRemoveOutsideCollaboratorAuditEntry - case "OrgRestoreMemberAuditEntry": return GitHubAPI.Objects.OrgRestoreMemberAuditEntry - case "OrgRestoreMemberMembershipOrganizationAuditEntryData": return GitHubAPI.Objects.OrgRestoreMemberMembershipOrganizationAuditEntryData - case "OrgUnblockUserAuditEntry": return GitHubAPI.Objects.OrgUnblockUserAuditEntry - case "OrgUpdateDefaultRepositoryPermissionAuditEntry": return GitHubAPI.Objects.OrgUpdateDefaultRepositoryPermissionAuditEntry - case "OrgUpdateMemberAuditEntry": return GitHubAPI.Objects.OrgUpdateMemberAuditEntry - case "OrgUpdateMemberRepositoryCreationPermissionAuditEntry": return GitHubAPI.Objects.OrgUpdateMemberRepositoryCreationPermissionAuditEntry - case "OrgUpdateMemberRepositoryInvitationPermissionAuditEntry": return GitHubAPI.Objects.OrgUpdateMemberRepositoryInvitationPermissionAuditEntry - case "PrivateRepositoryForkingDisableAuditEntry": return GitHubAPI.Objects.PrivateRepositoryForkingDisableAuditEntry - case "OrgRestoreMemberMembershipRepositoryAuditEntryData": return GitHubAPI.Objects.OrgRestoreMemberMembershipRepositoryAuditEntryData - case "PrivateRepositoryForkingEnableAuditEntry": return GitHubAPI.Objects.PrivateRepositoryForkingEnableAuditEntry - case "RepoAccessAuditEntry": return GitHubAPI.Objects.RepoAccessAuditEntry - case "RepoAddMemberAuditEntry": return GitHubAPI.Objects.RepoAddMemberAuditEntry - case "RepoAddTopicAuditEntry": return GitHubAPI.Objects.RepoAddTopicAuditEntry - case "RepoRemoveTopicAuditEntry": return GitHubAPI.Objects.RepoRemoveTopicAuditEntry - case "RepoArchivedAuditEntry": return GitHubAPI.Objects.RepoArchivedAuditEntry - case "RepoChangeMergeSettingAuditEntry": return GitHubAPI.Objects.RepoChangeMergeSettingAuditEntry - case "RepoConfigDisableAnonymousGitAccessAuditEntry": return GitHubAPI.Objects.RepoConfigDisableAnonymousGitAccessAuditEntry - case "RepoConfigDisableCollaboratorsOnlyAuditEntry": return GitHubAPI.Objects.RepoConfigDisableCollaboratorsOnlyAuditEntry - case "RepoConfigDisableContributorsOnlyAuditEntry": return GitHubAPI.Objects.RepoConfigDisableContributorsOnlyAuditEntry - case "RepoConfigDisableSockpuppetDisallowedAuditEntry": return GitHubAPI.Objects.RepoConfigDisableSockpuppetDisallowedAuditEntry - case "RepoConfigEnableAnonymousGitAccessAuditEntry": return GitHubAPI.Objects.RepoConfigEnableAnonymousGitAccessAuditEntry - case "RepoConfigEnableCollaboratorsOnlyAuditEntry": return GitHubAPI.Objects.RepoConfigEnableCollaboratorsOnlyAuditEntry - case "RepoConfigEnableContributorsOnlyAuditEntry": return GitHubAPI.Objects.RepoConfigEnableContributorsOnlyAuditEntry - case "RepoConfigEnableSockpuppetDisallowedAuditEntry": return GitHubAPI.Objects.RepoConfigEnableSockpuppetDisallowedAuditEntry - case "RepoConfigLockAnonymousGitAccessAuditEntry": return GitHubAPI.Objects.RepoConfigLockAnonymousGitAccessAuditEntry - case "RepoConfigUnlockAnonymousGitAccessAuditEntry": return GitHubAPI.Objects.RepoConfigUnlockAnonymousGitAccessAuditEntry - case "RepoCreateAuditEntry": return GitHubAPI.Objects.RepoCreateAuditEntry - case "RepoDestroyAuditEntry": return GitHubAPI.Objects.RepoDestroyAuditEntry - case "RepoRemoveMemberAuditEntry": return GitHubAPI.Objects.RepoRemoveMemberAuditEntry - case "TeamAddRepositoryAuditEntry": return GitHubAPI.Objects.TeamAddRepositoryAuditEntry - case "OrgRestoreMemberMembershipTeamAuditEntryData": return GitHubAPI.Objects.OrgRestoreMemberMembershipTeamAuditEntryData - case "TeamAddMemberAuditEntry": return GitHubAPI.Objects.TeamAddMemberAuditEntry - case "TeamChangeParentTeamAuditEntry": return GitHubAPI.Objects.TeamChangeParentTeamAuditEntry - case "TeamRemoveMemberAuditEntry": return GitHubAPI.Objects.TeamRemoveMemberAuditEntry - case "TeamRemoveRepositoryAuditEntry": return GitHubAPI.Objects.TeamRemoveRepositoryAuditEntry - case "RepositoryVisibilityChangeDisableAuditEntry": return GitHubAPI.Objects.RepositoryVisibilityChangeDisableAuditEntry - case "RepositoryVisibilityChangeEnableAuditEntry": return GitHubAPI.Objects.RepositoryVisibilityChangeEnableAuditEntry - case "MentionedEvent": return GitHubAPI.Objects.MentionedEvent - case "MilestonedEvent": return GitHubAPI.Objects.MilestonedEvent - case "MovedColumnsInProjectEvent": return GitHubAPI.Objects.MovedColumnsInProjectEvent - case "OrganizationIdentityProvider": return GitHubAPI.Objects.OrganizationIdentityProvider - case "OrganizationInvitation": return GitHubAPI.Objects.OrganizationInvitation - case "Package": return GitHubAPI.Objects.Package - case "PackageFile": return GitHubAPI.Objects.PackageFile - case "PackageTag": return GitHubAPI.Objects.PackageTag - case "PackageVersion": return GitHubAPI.Objects.PackageVersion - case "PinnedEvent": return GitHubAPI.Objects.PinnedEvent - case "PinnedIssue": return GitHubAPI.Objects.PinnedIssue - case "ProjectCard": return GitHubAPI.Objects.ProjectCard - case "ProjectColumn": return GitHubAPI.Objects.ProjectColumn - case "PublicKey": return GitHubAPI.Objects.PublicKey - case "PullRequestReviewThread": return GitHubAPI.Objects.PullRequestReviewThread - case "Push": return GitHubAPI.Objects.Push - case "PushAllowance": return GitHubAPI.Objects.PushAllowance - case "Reaction": return GitHubAPI.Objects.Reaction - case "Ref": return GitHubAPI.Objects.Ref - case "ReferencedEvent": return GitHubAPI.Objects.ReferencedEvent - case "ReleaseAsset": return GitHubAPI.Objects.ReleaseAsset - case "RemovedFromProjectEvent": return GitHubAPI.Objects.RemovedFromProjectEvent - case "RenamedTitleEvent": return GitHubAPI.Objects.RenamedTitleEvent - case "ReopenedEvent": return GitHubAPI.Objects.ReopenedEvent - case "RepositoryInvitation": return GitHubAPI.Objects.RepositoryInvitation - case "ReviewDismissalAllowance": return GitHubAPI.Objects.ReviewDismissalAllowance - case "ReviewRequest": return GitHubAPI.Objects.ReviewRequest - case "ReviewRequestRemovedEvent": return GitHubAPI.Objects.ReviewRequestRemovedEvent - case "ReviewRequestedEvent": return GitHubAPI.Objects.ReviewRequestedEvent - case "SavedReply": return GitHubAPI.Objects.SavedReply - case "SecurityAdvisory": return GitHubAPI.Objects.SecurityAdvisory - case "SponsorsListing": return GitHubAPI.Objects.SponsorsListing - case "SponsorsTier": return GitHubAPI.Objects.SponsorsTier - case "Sponsorship": return GitHubAPI.Objects.Sponsorship - case "Status": return GitHubAPI.Objects.Status - case "StatusCheckRollup": return GitHubAPI.Objects.StatusCheckRollup - case "StatusContext": return GitHubAPI.Objects.StatusContext - case "SubscribedEvent": return GitHubAPI.Objects.SubscribedEvent - case "TransferredEvent": return GitHubAPI.Objects.TransferredEvent - case "UnassignedEvent": return GitHubAPI.Objects.UnassignedEvent - case "UnlabeledEvent": return GitHubAPI.Objects.UnlabeledEvent - case "UnlockedEvent": return GitHubAPI.Objects.UnlockedEvent - case "UnmarkedAsDuplicateEvent": return GitHubAPI.Objects.UnmarkedAsDuplicateEvent - case "UnpinnedEvent": return GitHubAPI.Objects.UnpinnedEvent - case "UnsubscribedEvent": return GitHubAPI.Objects.UnsubscribedEvent - case "UserBlockedEvent": return GitHubAPI.Objects.UserBlockedEvent - case "UserContentEdit": return GitHubAPI.Objects.UserContentEdit - case "UserStatus": return GitHubAPI.Objects.UserStatus - case "IssueConnection": return GitHubAPI.Objects.IssueConnection - case "IssueCommentConnection": return GitHubAPI.Objects.IssueCommentConnection - default: return nil - } - } -} - -public enum Objects {} -public enum Interfaces {} -public enum Unions {} diff --git a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Unions/IssueOrPullRequest.graphql.swift b/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Unions/IssueOrPullRequest.graphql.swift deleted file mode 100644 index fb4b46f65c..0000000000 --- a/Sources/GitHubAPI/GitHubAPI/Sources/Schema/Unions/IssueOrPullRequest.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Unions { - /// Used for return value of Repository.issueOrPullRequest. - static let IssueOrPullRequest = Union( - name: "IssueOrPullRequest", - possibleTypes: [ - Objects.Issue.self, - Objects.PullRequest.self - ] - ) -} \ No newline at end of file diff --git a/Sources/GitHubAPI/Info.plist b/Sources/GitHubAPI/Info.plist deleted file mode 100644 index 09738dfd75..0000000000 --- a/Sources/GitHubAPI/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/GitHubAPI/graphql/Queries/IssuesAndCommentsForRepository.graphql b/Sources/GitHubAPI/graphql/Queries/IssuesAndCommentsForRepository.graphql deleted file mode 100644 index ce533b88da..0000000000 --- a/Sources/GitHubAPI/graphql/Queries/IssuesAndCommentsForRepository.graphql +++ /dev/null @@ -1,31 +0,0 @@ -query IssuesAndCommentsForRepository { - repository(name: "apollo-ios", owner: "apollographql") { - name - issues(last: 100) { - nodes { - title - author { - ...AuthorDetails - } - body - comments(last: 100) { - nodes { - body - author { - ...AuthorDetails - } - } - } - } - } - } -} - -fragment AuthorDetails on Actor { - login - ... on User { - id - name - } -} - diff --git a/Sources/GitHubAPI/graphql/Queries/Repository.graphql b/Sources/GitHubAPI/graphql/Queries/Repository.graphql deleted file mode 100644 index a98638e456..0000000000 --- a/Sources/GitHubAPI/graphql/Queries/Repository.graphql +++ /dev/null @@ -1,24 +0,0 @@ -query Repository { - repository(owner: "apollographql", name: "apollo-ios") { - issueOrPullRequest(number: 13) { - ... on Issue { - body - __typename - ... on UniformResourceLocatable { - url - } - author { - avatarUrl - } - } - ... on Reactable { - viewerCanReact - ... on Comment { - author { - login - } - } - } - } - } -} diff --git a/Sources/GitHubAPI/graphql/Queries/TestFolder/TestFolder2/TestFolder3/RepoURL.graphql b/Sources/GitHubAPI/graphql/Queries/TestFolder/TestFolder2/TestFolder3/RepoURL.graphql deleted file mode 100644 index 10f80cf4cb..0000000000 --- a/Sources/GitHubAPI/graphql/Queries/TestFolder/TestFolder2/TestFolder3/RepoURL.graphql +++ /dev/null @@ -1,5 +0,0 @@ -query RepoURL { - repository(owner: "apollographql", name: "apollo-ios") { - url - } -} diff --git a/Sources/GitHubAPI/graphql/operationIDs.json b/Sources/GitHubAPI/graphql/operationIDs.json deleted file mode 100644 index 0159767eee..0000000000 --- a/Sources/GitHubAPI/graphql/operationIDs.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "f9431d2905352492e89d6e534226f4c744080f58ad36b8e2e82765180da7c1bc", - "body": "query IssuesAndCommentsForRepository { repository(name: "apollo-ios", owner: "apollographql") { __typename name issues(last: 100) { __typename nodes { __typename title author { __typename ...AuthorDetails } body comments(last: 100) { __typename nodes { __typename body author { __typename ...AuthorDetails } } } } } } }\nfragment AuthorDetails on Actor { __typename login ... on User { __typename id name } }", - "name": "IssuesAndCommentsForRepository", - "type": "query" - }, - { - "id": "1f953a3d73d4458dc80babe734a112c32a1cea3338eb7c5eb09d8288ece9f2e6", - "body": "query Repository { repository(owner: "apollographql", name: "apollo-ios") { __typename issueOrPullRequest(number: 13) { __typename ... on Issue { __typename body ... on UniformResourceLocatable { __typename url } author { __typename avatarUrl } } ... on Reactable { __typename viewerCanReact ... on Comment { __typename author { __typename login } } } } } }", - "name": "Repository", - "type": "query" - }, - { - "id": "ecd015ec1bf1ae0670be0b6f8563b7e0ff8498eccbab9934316e2288fc3470d8", - "body": "query RepoURL { repository(owner: "apollographql", name: "apollo-ios") { __typename url } }", - "name": "RepoURL", - "type": "query" - } - ] -} \ No newline at end of file diff --git a/Sources/GitHubAPI/graphql/schema.graphqls b/Sources/GitHubAPI/graphql/schema.graphqls deleted file mode 100644 index 7d8b8cc41c..0000000000 --- a/Sources/GitHubAPI/graphql/schema.graphqls +++ /dev/null @@ -1,38245 +0,0 @@ -""" -Defines what type of global IDs are accepted for a mutation argument of type ID. -""" -directive @possibleTypes( - """ - Abstract type of accepted global ID - """ - abstractType: String - - """ - Accepted types of global IDs. - """ - concreteTypes: [String!]! -) on INPUT_FIELD_DEFINITION - -""" -Marks an element of a GraphQL schema as only available via a preview header -""" -directive @preview( - """ - The identifier of the API preview that toggles this field. - """ - toggledBy: String! -) on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION - -""" -Autogenerated input type of AcceptEnterpriseAdministratorInvitation -""" -input AcceptEnterpriseAdministratorInvitationInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The id of the invitation being accepted - """ - invitationId: ID! @possibleTypes(concreteTypes: ["EnterpriseAdministratorInvitation"]) -} - -""" -Autogenerated return type of AcceptEnterpriseAdministratorInvitation -""" -type AcceptEnterpriseAdministratorInvitationPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The invitation that was accepted. - """ - invitation: EnterpriseAdministratorInvitation - - """ - A message confirming the result of accepting an administrator invitation. - """ - message: String -} - -""" -Autogenerated input type of AcceptTopicSuggestion -""" -input AcceptTopicSuggestionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of the suggested topic. - """ - name: String! - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of AcceptTopicSuggestion -""" -type AcceptTopicSuggestionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The accepted topic. - """ - topic: Topic -} - -""" -The possible capabilities for action executions setting. -""" -enum ActionExecutionCapabilitySetting { - """ - All action executions are enabled. - """ - ALL_ACTIONS - - """ - All action executions are disabled. - """ - DISABLED - - """ - Only actions defined within the repo are allowed. - """ - LOCAL_ACTIONS_ONLY - - """ - Organization administrators action execution capabilities. - """ - NO_POLICY -} - -""" -Represents an object which can take actions on GitHub. Typically a User or Bot. -""" -interface Actor { - """ - A URL pointing to the actor's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - The username of the actor. - """ - login: String! - - """ - The HTTP path for this actor. - """ - resourcePath: URI! - - """ - The HTTP URL for this actor. - """ - url: URI! -} - -""" -Location information for an actor -""" -type ActorLocation { - """ - City - """ - city: String - - """ - Country name - """ - country: String - - """ - Country code - """ - countryCode: String - - """ - Region name - """ - region: String - - """ - Region or state code - """ - regionCode: String -} - -""" -Autogenerated input type of AddAssigneesToAssignable -""" -input AddAssigneesToAssignableInput { - """ - The id of the assignable object to add assignees to. - """ - assignableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Assignable") - - """ - The id of users to add as assignees. - """ - assigneeIds: [ID!]! @possibleTypes(concreteTypes: ["User"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated return type of AddAssigneesToAssignable -""" -type AddAssigneesToAssignablePayload { - """ - The item that was assigned. - """ - assignable: Assignable - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of AddComment -""" -input AddCommentInput { - """ - The contents of the comment. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the subject to modify. - """ - subjectId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "IssueOrPullRequest") -} - -""" -Autogenerated return type of AddComment -""" -type AddCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The edge from the subject's comment connection. - """ - commentEdge: IssueCommentEdge - - """ - The subject - """ - subject: Node - - """ - The edge from the subject's timeline connection. - """ - timelineEdge: IssueTimelineItemEdge -} - -""" -Autogenerated input type of AddLabelsToLabelable -""" -input AddLabelsToLabelableInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ids of the labels to add. - """ - labelIds: [ID!]! @possibleTypes(concreteTypes: ["Label"]) - - """ - The id of the labelable object to add labels to. - """ - labelableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Labelable") -} - -""" -Autogenerated return type of AddLabelsToLabelable -""" -type AddLabelsToLabelablePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The item that was labeled. - """ - labelable: Labelable -} - -""" -Autogenerated input type of AddProjectCard -""" -input AddProjectCardInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The content of the card. Must be a member of the ProjectCardItem union - """ - contentId: ID @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "ProjectCardItem") - - """ - The note on the card. - """ - note: String - - """ - The Node ID of the ProjectColumn. - """ - projectColumnId: ID! @possibleTypes(concreteTypes: ["ProjectColumn"]) -} - -""" -Autogenerated return type of AddProjectCard -""" -type AddProjectCardPayload { - """ - The edge from the ProjectColumn's card connection. - """ - cardEdge: ProjectCardEdge - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ProjectColumn - """ - projectColumn: ProjectColumn -} - -""" -Autogenerated input type of AddProjectColumn -""" -input AddProjectColumnInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of the column. - """ - name: String! - - """ - The Node ID of the project. - """ - projectId: ID! @possibleTypes(concreteTypes: ["Project"]) -} - -""" -Autogenerated return type of AddProjectColumn -""" -type AddProjectColumnPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The edge from the project's column connection. - """ - columnEdge: ProjectColumnEdge - - """ - The project - """ - project: Project -} - -""" -Autogenerated input type of AddPullRequestReviewComment -""" -input AddPullRequestReviewCommentInput { - """ - The text of the comment. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The SHA of the commit to comment on. - """ - commitOID: GitObjectID - - """ - The comment id to reply to. - """ - inReplyTo: ID @possibleTypes(concreteTypes: ["PullRequestReviewComment"]) - - """ - The relative path of the file to comment on. - """ - path: String - - """ - The line index in the diff to comment on. - """ - position: Int - - """ - The node ID of the pull request reviewing - """ - pullRequestId: ID @possibleTypes(concreteTypes: ["PullRequest"]) - - """ - The Node ID of the review to modify. - """ - pullRequestReviewId: ID @possibleTypes(concreteTypes: ["PullRequestReview"]) -} - -""" -Autogenerated return type of AddPullRequestReviewComment -""" -type AddPullRequestReviewCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The newly created comment. - """ - comment: PullRequestReviewComment - - """ - The edge from the review's comment connection. - """ - commentEdge: PullRequestReviewCommentEdge -} - -""" -Autogenerated input type of AddPullRequestReview -""" -input AddPullRequestReviewInput { - """ - The contents of the review body comment. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The review line comments. - """ - comments: [DraftPullRequestReviewComment] - - """ - The commit OID the review pertains to. - """ - commitOID: GitObjectID - - """ - The event to perform on the pull request review. - """ - event: PullRequestReviewEvent - - """ - The Node ID of the pull request to modify. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) - - """ - The review line comment threads. - """ - threads: [DraftPullRequestReviewThread] -} - -""" -Autogenerated return type of AddPullRequestReview -""" -type AddPullRequestReviewPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The newly created pull request review. - """ - pullRequestReview: PullRequestReview - - """ - The edge from the pull request's review connection. - """ - reviewEdge: PullRequestReviewEdge -} - -""" -Autogenerated input type of AddPullRequestReviewThread -""" -input AddPullRequestReviewThreadInput { - """ - Body of the thread's first comment. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The line of the blob to which the thread refers. The end of the line range for multi-line comments. - """ - line: Int! - - """ - Path to the file being commented on. - """ - path: String! - - """ - The Node ID of the review to modify. - """ - pullRequestReviewId: ID! @possibleTypes(concreteTypes: ["PullRequestReview"]) - - """ - The side of the diff on which the line resides. For multi-line comments, this is the side for the end of the line range. - """ - side: DiffSide = RIGHT - - """ - The first line of the range to which the comment refers. - """ - startLine: Int - - """ - The side of the diff on which the start line resides. - """ - startSide: DiffSide = RIGHT -} - -""" -Autogenerated return type of AddPullRequestReviewThread -""" -type AddPullRequestReviewThreadPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The newly created thread. - """ - thread: PullRequestReviewThread -} - -""" -Autogenerated input type of AddReaction -""" -input AddReactionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of the emoji to react with. - """ - content: ReactionContent! - - """ - The Node ID of the subject to modify. - """ - subjectId: ID! @possibleTypes(concreteTypes: ["CommitComment", "Issue", "IssueComment", "PullRequest", "PullRequestReview", "PullRequestReviewComment", "TeamDiscussion", "TeamDiscussionComment"], abstractType: "Reactable") -} - -""" -Autogenerated return type of AddReaction -""" -type AddReactionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The reaction object. - """ - reaction: Reaction - - """ - The reactable subject. - """ - subject: Reactable -} - -""" -Autogenerated input type of AddStar -""" -input AddStarInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Starrable ID to star. - """ - starrableId: ID! @possibleTypes(concreteTypes: ["Gist", "Repository", "Topic"], abstractType: "Starrable") -} - -""" -Autogenerated return type of AddStar -""" -type AddStarPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The starrable. - """ - starrable: Starrable -} - -""" -Represents a 'added_to_project' event on a given issue or pull request. -""" -type AddedToProjectEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - Project referenced by event. - """ - project: Project @preview(toggledBy: "starfox-preview") - - """ - Project card referenced by this project event. - """ - projectCard: ProjectCard @preview(toggledBy: "starfox-preview") - - """ - Column name referenced by this project event. - """ - projectColumnName: String! @preview(toggledBy: "starfox-preview") -} - -""" -A GitHub App. -""" -type App implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The description of the app. - """ - description: String - id: ID! - - """ - The hex color code, without the leading '#', for the logo background. - """ - logoBackgroundColor: String! - - """ - A URL pointing to the app's logo. - """ - logoUrl( - """ - The size of the resulting image. - """ - size: Int - ): URI! - - """ - The name of the app. - """ - name: String! - - """ - A slug based on the name of the app for use in URLs. - """ - slug: String! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The URL to the app's homepage. - """ - url: URI! -} - -""" -Autogenerated input type of ArchiveRepository -""" -input ArchiveRepositoryInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the repository to mark as archived. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of ArchiveRepository -""" -type ArchiveRepositoryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The repository that was marked as archived. - """ - repository: Repository -} - -""" -An object that can have users assigned to it. -""" -interface Assignable { - """ - A list of Users assigned to this object. - """ - assignees( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! -} - -""" -Represents an 'assigned' event on any assignable object. -""" -type AssignedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the assignable associated with the event. - """ - assignable: Assignable! - - """ - Identifies the user or mannequin that was assigned. - """ - assignee: Assignee - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the user who was assigned. - """ - user: User @deprecated(reason: "Assignees can now be mannequins. Use the `assignee` field instead. Removal on 2020-01-01 UTC.") -} - -""" -Types that can be assigned to issues. -""" -union Assignee = Bot | Mannequin | Organization | User - -""" -An entry in the audit log. -""" -interface AuditEntry { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Types that can initiate an audit log event. -""" -union AuditEntryActor = Bot | Organization | User - -""" -Ordering options for Audit Log connections. -""" -input AuditLogOrder { - """ - The ordering direction. - """ - direction: OrderDirection - - """ - The field to order Audit Logs by. - """ - field: AuditLogOrderField -} - -""" -Properties by which Audit Log connections can be ordered. -""" -enum AuditLogOrderField { - """ - Order audit log entries by timestamp - """ - CREATED_AT -} - -""" -Represents a 'automatic_base_change_failed' event on a given pull request. -""" -type AutomaticBaseChangeFailedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - The new base for this PR - """ - newBase: String! - - """ - The old base for this PR - """ - oldBase: String! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! -} - -""" -Represents a 'automatic_base_change_succeeded' event on a given pull request. -""" -type AutomaticBaseChangeSucceededEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - The new base for this PR - """ - newBase: String! - - """ - The old base for this PR - """ - oldBase: String! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! -} - -""" -Represents a 'base_ref_changed' event on a given issue or pull request. -""" -type BaseRefChangedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! -} - -""" -Represents a 'base_ref_force_pushed' event on a given pull request. -""" -type BaseRefForcePushedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the after commit SHA for the 'base_ref_force_pushed' event. - """ - afterCommit: Commit - - """ - Identifies the before commit SHA for the 'base_ref_force_pushed' event. - """ - beforeCommit: Commit - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - Identifies the fully qualified ref name for the 'base_ref_force_pushed' event. - """ - ref: Ref -} - -""" -Represents a Git blame. -""" -type Blame { - """ - The list of ranges from a Git blame. - """ - ranges: [BlameRange!]! -} - -""" -Represents a range of information from a Git blame. -""" -type BlameRange { - """ - Identifies the recency of the change, from 1 (new) to 10 (old). This is - calculated as a 2-quantile and determines the length of distance between the - median age of all the changes in the file and the recency of the current - range's change. - """ - age: Int! - - """ - Identifies the line author - """ - commit: Commit! - - """ - The ending line for the range - """ - endingLine: Int! - - """ - The starting line for the range - """ - startingLine: Int! -} - -""" -Represents a Git blob. -""" -type Blob implements GitObject & Node { - """ - An abbreviated version of the Git object ID - """ - abbreviatedOid: String! - - """ - Byte size of Blob object - """ - byteSize: Int! - - """ - The HTTP path for this Git object - """ - commitResourcePath: URI! - - """ - The HTTP URL for this Git object - """ - commitUrl: URI! - id: ID! - - """ - Indicates whether the Blob is binary or text. Returns null if unable to determine the encoding. - """ - isBinary: Boolean - - """ - Indicates whether the contents is truncated - """ - isTruncated: Boolean! - - """ - The Git object ID - """ - oid: GitObjectID! - - """ - The Repository the Git object belongs to - """ - repository: Repository! - - """ - UTF8 text data or null if the Blob is binary - """ - text: String -} - -""" -A special type of user which takes actions on behalf of GitHub Apps. -""" -type Bot implements Actor & Node & UniformResourceLocatable { - """ - A URL pointing to the GitHub App's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - The username of the actor. - """ - login: String! - - """ - The HTTP path for this bot - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this bot - """ - url: URI! -} - -""" -A branch protection rule. -""" -type BranchProtectionRule implements Node { - """ - A list of conflicts matching branches protection rule and other branch protection rules - """ - branchProtectionRuleConflicts( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): BranchProtectionRuleConflictConnection! - - """ - The actor who created this branch protection rule. - """ - creator: Actor - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - Will new commits pushed to matching branches dismiss pull request review approvals. - """ - dismissesStaleReviews: Boolean! - id: ID! - - """ - Can admins overwrite branch protection. - """ - isAdminEnforced: Boolean! - - """ - Repository refs that are protected by this rule - """ - matchingRefs( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filters refs with query on name - """ - query: String - ): RefConnection! - - """ - Identifies the protection rule pattern. - """ - pattern: String! - - """ - A list push allowances for this branch protection rule. - """ - pushAllowances( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PushAllowanceConnection! - - """ - The repository associated with this branch protection rule. - """ - repository: Repository - - """ - Number of approving reviews required to update matching branches. - """ - requiredApprovingReviewCount: Int - - """ - List of required status check contexts that must pass for commits to be accepted to matching branches. - """ - requiredStatusCheckContexts: [String] - - """ - Are approving reviews required to update matching branches. - """ - requiresApprovingReviews: Boolean! - - """ - Are reviews from code owners required to update matching branches. - """ - requiresCodeOwnerReviews: Boolean! - - """ - Are commits required to be signed. - """ - requiresCommitSignatures: Boolean! - - """ - Are status checks required to update matching branches. - """ - requiresStatusChecks: Boolean! - - """ - Are branches required to be up to date before merging. - """ - requiresStrictStatusChecks: Boolean! - - """ - Is pushing to matching branches restricted. - """ - restrictsPushes: Boolean! - - """ - Is dismissal of pull request reviews restricted. - """ - restrictsReviewDismissals: Boolean! - - """ - A list review dismissal allowances for this branch protection rule. - """ - reviewDismissalAllowances( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ReviewDismissalAllowanceConnection! -} - -""" -A conflict between two branch protection rules. -""" -type BranchProtectionRuleConflict { - """ - Identifies the branch protection rule. - """ - branchProtectionRule: BranchProtectionRule - - """ - Identifies the conflicting branch protection rule. - """ - conflictingBranchProtectionRule: BranchProtectionRule - - """ - Identifies the branch ref that has conflicting rules - """ - ref: Ref -} - -""" -The connection type for BranchProtectionRuleConflict. -""" -type BranchProtectionRuleConflictConnection { - """ - A list of edges. - """ - edges: [BranchProtectionRuleConflictEdge] - - """ - A list of nodes. - """ - nodes: [BranchProtectionRuleConflict] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type BranchProtectionRuleConflictEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: BranchProtectionRuleConflict -} - -""" -The connection type for BranchProtectionRule. -""" -type BranchProtectionRuleConnection { - """ - A list of edges. - """ - edges: [BranchProtectionRuleEdge] - - """ - A list of nodes. - """ - nodes: [BranchProtectionRule] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type BranchProtectionRuleEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: BranchProtectionRule -} - -""" -Autogenerated input type of CancelEnterpriseAdminInvitation -""" -input CancelEnterpriseAdminInvitationInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the pending enterprise administrator invitation. - """ - invitationId: ID! @possibleTypes(concreteTypes: ["EnterpriseAdministratorInvitation"]) -} - -""" -Autogenerated return type of CancelEnterpriseAdminInvitation -""" -type CancelEnterpriseAdminInvitationPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The invitation that was canceled. - """ - invitation: EnterpriseAdministratorInvitation - - """ - A message confirming the result of canceling an administrator invitation. - """ - message: String -} - -""" -Autogenerated input type of ChangeUserStatus -""" -input ChangeUserStatusInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The emoji to represent your status. Can either be a native Unicode emoji or an emoji name with colons, e.g., :grinning:. - """ - emoji: String - - """ - If set, the user status will not be shown after this date. - """ - expiresAt: DateTime - - """ - Whether this status should indicate you are not fully available on GitHub, e.g., you are away. - """ - limitedAvailability: Boolean = false - - """ - A short description of your current status. - """ - message: String - - """ - The ID of the organization whose members will be allowed to see the status. If - omitted, the status will be publicly visible. - """ - organizationId: ID @possibleTypes(concreteTypes: ["Organization"]) -} - -""" -Autogenerated return type of ChangeUserStatus -""" -type ChangeUserStatusPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Your updated status. - """ - status: UserStatus -} - -""" -A single check annotation. -""" -type CheckAnnotation @preview(toggledBy: "antiope-preview") { - """ - The annotation's severity level. - """ - annotationLevel: CheckAnnotationLevel - - """ - The path to the file that this annotation was made on. - """ - blobUrl: URI! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The position of this annotation. - """ - location: CheckAnnotationSpan! - - """ - The annotation's message. - """ - message: String! - - """ - The path that this annotation was made on. - """ - path: String! - - """ - Additional information about the annotation. - """ - rawDetails: String - - """ - The annotation's title - """ - title: String -} - -""" -The connection type for CheckAnnotation. -""" -type CheckAnnotationConnection { - """ - A list of edges. - """ - edges: [CheckAnnotationEdge] - - """ - A list of nodes. - """ - nodes: [CheckAnnotation] @preview(toggledBy: "antiope-preview") - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Information from a check run analysis to specific lines of code. -""" -input CheckAnnotationData @preview(toggledBy: "antiope-preview") { - """ - Represents an annotation's information level - """ - annotationLevel: CheckAnnotationLevel! - - """ - The location of the annotation - """ - location: CheckAnnotationRange! - - """ - A short description of the feedback for these lines of code. - """ - message: String! - - """ - The path of the file to add an annotation to. - """ - path: String! - - """ - Details about this annotation. - """ - rawDetails: String - - """ - The title that represents the annotation. - """ - title: String -} - -""" -An edge in a connection. -""" -type CheckAnnotationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CheckAnnotation @preview(toggledBy: "antiope-preview") -} - -""" -Represents an annotation's information level. -""" -enum CheckAnnotationLevel @preview(toggledBy: "antiope-preview") { - """ - An annotation indicating an inescapable error. - """ - FAILURE - - """ - An annotation indicating some information. - """ - NOTICE - - """ - An annotation indicating an ignorable error. - """ - WARNING -} - -""" -A character position in a check annotation. -""" -type CheckAnnotationPosition @preview(toggledBy: "antiope-preview") { - """ - Column number (1 indexed). - """ - column: Int - - """ - Line number (1 indexed). - """ - line: Int! -} - -""" -Information from a check run analysis to specific lines of code. -""" -input CheckAnnotationRange @preview(toggledBy: "antiope-preview") { - """ - The ending column of the range. - """ - endColumn: Int - - """ - The ending line of the range. - """ - endLine: Int! - - """ - The starting column of the range. - """ - startColumn: Int - - """ - The starting line of the range. - """ - startLine: Int! -} - -""" -An inclusive pair of positions for a check annotation. -""" -type CheckAnnotationSpan @preview(toggledBy: "antiope-preview") { - """ - End position (inclusive). - """ - end: CheckAnnotationPosition! - - """ - Start position (inclusive). - """ - start: CheckAnnotationPosition! -} - -""" -The possible states for a check suite or run conclusion. -""" -enum CheckConclusionState @preview(toggledBy: "antiope-preview") { - """ - The check suite or run requires action. - """ - ACTION_REQUIRED - - """ - The check suite or run has been cancelled. - """ - CANCELLED - - """ - The check suite or run has failed. - """ - FAILURE - - """ - The check suite or run was neutral. - """ - NEUTRAL - - """ - The check suite or run was skipped. - """ - SKIPPED - - """ - The check suite or run was marked stale by GitHub. Only GitHub can use this conclusion. - """ - STALE - - """ - The check suite or run has succeeded. - """ - SUCCESS - - """ - The check suite or run has timed out. - """ - TIMED_OUT -} - -""" -A check run. -""" -type CheckRun implements Node & UniformResourceLocatable @preview(toggledBy: "antiope-preview") { - """ - The check run's annotations - """ - annotations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CheckAnnotationConnection - - """ - The check suite that this run is a part of. - """ - checkSuite: CheckSuite! - - """ - Identifies the date and time when the check run was completed. - """ - completedAt: DateTime - - """ - The conclusion of the check run. - """ - conclusion: CheckConclusionState - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The URL from which to find full details of the check run on the integrator's site. - """ - detailsUrl: URI - - """ - A reference for the check run on the integrator's system. - """ - externalId: String - id: ID! - - """ - The name of the check for this check run. - """ - name: String! - - """ - The permalink to the check run summary. - """ - permalink: URI! - - """ - The repository associated with this check run. - """ - repository: Repository! - - """ - The HTTP path for this check run. - """ - resourcePath: URI! - - """ - Identifies the date and time when the check run was started. - """ - startedAt: DateTime - - """ - The current status of the check run. - """ - status: CheckStatusState! - - """ - A string representing the check run's summary - """ - summary: String - - """ - A string representing the check run's text - """ - text: String - - """ - A string representing the check run - """ - title: String - - """ - The HTTP URL for this check run. - """ - url: URI! -} - -""" -Possible further actions the integrator can perform. -""" -input CheckRunAction @preview(toggledBy: "antiope-preview") { - """ - A short explanation of what this action would do. - """ - description: String! - - """ - A reference for the action on the integrator's system. - """ - identifier: String! - - """ - The text to be displayed on a button in the web UI. - """ - label: String! -} - -""" -The connection type for CheckRun. -""" -type CheckRunConnection { - """ - A list of edges. - """ - edges: [CheckRunEdge] - - """ - A list of nodes. - """ - nodes: [CheckRun] @preview(toggledBy: "antiope-preview") - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CheckRunEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CheckRun @preview(toggledBy: "antiope-preview") -} - -""" -The filters that are available when fetching check runs. -""" -input CheckRunFilter @preview(toggledBy: "antiope-preview") { - """ - Filters the check runs created by this application ID. - """ - appId: Int - - """ - Filters the check runs by this name. - """ - checkName: String - - """ - Filters the check runs by this type. - """ - checkType: CheckRunType - - """ - Filters the check runs by this status. - """ - status: CheckStatusState -} - -""" -Descriptive details about the check run. -""" -input CheckRunOutput @preview(toggledBy: "antiope-preview") { - """ - The annotations that are made as part of the check run. - """ - annotations: [CheckAnnotationData!] - - """ - Images attached to the check run output displayed in the GitHub pull request UI. - """ - images: [CheckRunOutputImage!] - - """ - The summary of the check run (supports Commonmark). - """ - summary: String! - - """ - The details of the check run (supports Commonmark). - """ - text: String - - """ - A title to provide for this check run. - """ - title: String! -} - -""" -Images attached to the check run output displayed in the GitHub pull request UI. -""" -input CheckRunOutputImage @preview(toggledBy: "antiope-preview") { - """ - The alternative text for the image. - """ - alt: String! - - """ - A short image description. - """ - caption: String - - """ - The full URL of the image. - """ - imageUrl: URI! -} - -""" -The possible types of check runs. -""" -enum CheckRunType @preview(toggledBy: "antiope-preview") { - """ - Every check run available. - """ - ALL - - """ - The latest check run. - """ - LATEST -} - -""" -The possible states for a check suite or run status. -""" -enum CheckStatusState @preview(toggledBy: "antiope-preview") { - """ - The check suite or run has been completed. - """ - COMPLETED - - """ - The check suite or run is in progress. - """ - IN_PROGRESS - - """ - The check suite or run has been queued. - """ - QUEUED - - """ - The check suite or run has been requested. - """ - REQUESTED -} - -""" -A check suite. -""" -type CheckSuite implements Node @preview(toggledBy: "antiope-preview") { - """ - The GitHub App which created this check suite. - """ - app: App - - """ - The name of the branch for this check suite. - """ - branch: Ref - - """ - The check runs associated with a check suite. - """ - checkRuns( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Filters the check runs by this type. - """ - filterBy: CheckRunFilter - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CheckRunConnection - - """ - The commit for this check suite - """ - commit: Commit! - - """ - The conclusion of this check suite. - """ - conclusion: CheckConclusionState - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - A list of open pull requests matching the check suite. - """ - matchingPullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - The base ref name to filter the pull requests by. - """ - baseRefName: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - The head ref name to filter the pull requests by. - """ - headRefName: String - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the pull requests by. - """ - states: [PullRequestState!] - ): PullRequestConnection - - """ - The push that triggered this check suite. - """ - push: Push - - """ - The repository associated with this check suite. - """ - repository: Repository! - - """ - The HTTP path for this check suite - """ - resourcePath: URI! - - """ - The status of this check suite. - """ - status: CheckStatusState! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this check suite - """ - url: URI! -} - -""" -The auto-trigger preferences that are available for check suites. -""" -input CheckSuiteAutoTriggerPreference @preview(toggledBy: "antiope-preview") { - """ - The node ID of the application that owns the check suite. - """ - appId: ID! - - """ - Set to `true` to enable automatic creation of CheckSuite events upon pushes to the repository. - """ - setting: Boolean! -} - -""" -The connection type for CheckSuite. -""" -type CheckSuiteConnection { - """ - A list of edges. - """ - edges: [CheckSuiteEdge] - - """ - A list of nodes. - """ - nodes: [CheckSuite] @preview(toggledBy: "antiope-preview") - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CheckSuiteEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CheckSuite @preview(toggledBy: "antiope-preview") -} - -""" -The filters that are available when fetching check suites. -""" -input CheckSuiteFilter @preview(toggledBy: "antiope-preview") { - """ - Filters the check suites created by this application ID. - """ - appId: Int - - """ - Filters the check suites by this name. - """ - checkName: String -} - -""" -Autogenerated input type of ClearLabelsFromLabelable -""" -input ClearLabelsFromLabelableInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The id of the labelable object to clear the labels from. - """ - labelableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Labelable") -} - -""" -Autogenerated return type of ClearLabelsFromLabelable -""" -type ClearLabelsFromLabelablePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The item that was unlabeled. - """ - labelable: Labelable -} - -""" -Autogenerated input type of CloneProject -""" -input CloneProjectInput { - """ - The description of the project. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Whether or not to clone the source project's workflows. - """ - includeWorkflows: Boolean! - - """ - The name of the project. - """ - name: String! - - """ - The visibility of the project, defaults to false (private). - """ - public: Boolean - - """ - The source project to clone. - """ - sourceId: ID! @possibleTypes(concreteTypes: ["Project"]) - - """ - The owner ID to create the project under. - """ - targetOwnerId: ID! @possibleTypes(concreteTypes: ["Organization", "Repository", "User"], abstractType: "ProjectOwner") -} - -""" -Autogenerated return type of CloneProject -""" -type CloneProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The id of the JobStatus for populating cloned fields. - """ - jobStatusId: String - - """ - The new cloned project. - """ - project: Project -} - -""" -Autogenerated input type of CloneTemplateRepository -""" -input CloneTemplateRepositoryInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A short description of the new repository. - """ - description: String - - """ - Whether to copy all branches from the template to the new repository. Defaults - to copying only the default branch of the template. - """ - includeAllBranches: Boolean = false - - """ - The name of the new repository. - """ - name: String! - - """ - The ID of the owner for the new repository. - """ - ownerId: ID! @possibleTypes(concreteTypes: ["Organization", "User"], abstractType: "RepositoryOwner") - - """ - The Node ID of the template repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - Indicates the repository's visibility level. - """ - visibility: RepositoryVisibility! -} - -""" -Autogenerated return type of CloneTemplateRepository -""" -type CloneTemplateRepositoryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new repository. - """ - repository: Repository -} - -""" -An object that can be closed -""" -interface Closable { - """ - `true` if the object is closed (definition of closed may depend on type) - """ - closed: Boolean! - - """ - Identifies the date and time when the object was closed. - """ - closedAt: DateTime -} - -""" -Autogenerated input type of CloseIssue -""" -input CloseIssueInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the issue to be closed. - """ - issueId: ID! @possibleTypes(concreteTypes: ["Issue"]) -} - -""" -Autogenerated return type of CloseIssue -""" -type CloseIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue that was closed. - """ - issue: Issue -} - -""" -Autogenerated input type of ClosePullRequest -""" -input ClosePullRequestInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the pull request to be closed. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) -} - -""" -Autogenerated return type of ClosePullRequest -""" -type ClosePullRequestPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The pull request that was closed. - """ - pullRequest: PullRequest -} - -""" -Represents a 'closed' event on any `Closable`. -""" -type ClosedEvent implements Node & UniformResourceLocatable { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Object that was closed. - """ - closable: Closable! - - """ - Object which triggered the creation of this event. - """ - closer: Closer - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - The HTTP path for this closed event. - """ - resourcePath: URI! - - """ - The HTTP URL for this closed event. - """ - url: URI! -} - -""" -The object which triggered a `ClosedEvent`. -""" -union Closer = Commit | PullRequest - -""" -The Code of Conduct for a repository -""" -type CodeOfConduct implements Node { - """ - The body of the Code of Conduct - """ - body: String - id: ID! - - """ - The key for the Code of Conduct - """ - key: String! - - """ - The formal name of the Code of Conduct - """ - name: String! - - """ - The HTTP path for this Code of Conduct - """ - resourcePath: URI - - """ - The HTTP URL for this Code of Conduct - """ - url: URI -} - -""" -Collaborators affiliation level with a subject. -""" -enum CollaboratorAffiliation { - """ - All collaborators the authenticated user can see. - """ - ALL - - """ - All collaborators with permissions to an organization-owned subject, regardless of organization membership status. - """ - DIRECT - - """ - All outside collaborators of an organization-owned subject. - """ - OUTSIDE -} - -""" -Represents a comment. -""" -interface Comment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - The body as Markdown. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -A comment author association with repository. -""" -enum CommentAuthorAssociation { - """ - Author has been invited to collaborate on the repository. - """ - COLLABORATOR - - """ - Author has previously committed to the repository. - """ - CONTRIBUTOR - - """ - Author has not previously committed to GitHub. - """ - FIRST_TIMER - - """ - Author has not previously committed to the repository. - """ - FIRST_TIME_CONTRIBUTOR - - """ - Author is a member of the organization that owns the repository. - """ - MEMBER - - """ - Author has no association with the repository. - """ - NONE - - """ - Author is the owner of the repository. - """ - OWNER -} - -""" -The possible errors that will prevent a user from updating a comment. -""" -enum CommentCannotUpdateReason { - """ - Unable to create comment because repository is archived. - """ - ARCHIVED - - """ - You cannot update this comment - """ - DENIED - - """ - You must be the author or have write access to this repository to update this comment. - """ - INSUFFICIENT_ACCESS - - """ - Unable to create comment because issue is locked. - """ - LOCKED - - """ - You must be logged in to update this comment. - """ - LOGIN_REQUIRED - - """ - Repository is under maintenance. - """ - MAINTENANCE - - """ - At least one email address must be verified to update this comment. - """ - VERIFIED_EMAIL_REQUIRED -} - -""" -Represents a 'comment_deleted' event on a given issue or pull request. -""" -type CommentDeletedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! -} - -""" -Represents a Git commit. -""" -type Commit implements GitObject & Node & Subscribable & UniformResourceLocatable { - """ - An abbreviated version of the Git object ID - """ - abbreviatedOid: String! - - """ - The number of additions in this commit. - """ - additions: Int! - - """ - The pull requests associated with a commit - """ - associatedPullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests. - """ - orderBy: PullRequestOrder = {field: CREATED_AT, direction: ASC} - ): PullRequestConnection - - """ - Authorship details of the commit. - """ - author: GitActor - - """ - Check if the committer and the author match. - """ - authoredByCommitter: Boolean! - - """ - The datetime when this commit was authored. - """ - authoredDate: DateTime! - - """ - Fetches `git blame` information. - """ - blame( - """ - The file whose Git blame information you want. - """ - path: String! - ): Blame! - - """ - The number of changed files in this commit. - """ - changedFiles: Int! - - """ - The check suites associated with a commit. - """ - checkSuites( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Filters the check suites by this type. - """ - filterBy: CheckSuiteFilter - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CheckSuiteConnection @preview(toggledBy: "antiope-preview") - - """ - Comments made on the commit. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CommitCommentConnection! - - """ - The HTTP path for this Git object - """ - commitResourcePath: URI! - - """ - The HTTP URL for this Git object - """ - commitUrl: URI! - - """ - The datetime when this commit was committed. - """ - committedDate: DateTime! - - """ - Check if commited via GitHub web UI. - """ - committedViaWeb: Boolean! - - """ - Committership details of the commit. - """ - committer: GitActor - - """ - The number of deletions in this commit. - """ - deletions: Int! - - """ - The deployments associated with a commit. - """ - deployments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Environments to list deployments for - """ - environments: [String!] - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for deployments returned from the connection. - """ - orderBy: DeploymentOrder = {field: CREATED_AT, direction: ASC} - ): DeploymentConnection - - """ - The linear commit history starting from (and including) this commit, in the same order as `git log`. - """ - history( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - If non-null, filters history to only show commits with matching authorship. - """ - author: CommitAuthor - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - If non-null, filters history to only show commits touching files under this path. - """ - path: String - - """ - Allows specifying a beginning time or date for fetching commits. - """ - since: GitTimestamp - - """ - Allows specifying an ending time or date for fetching commits. - """ - until: GitTimestamp - ): CommitHistoryConnection! - id: ID! - - """ - The Git commit message - """ - message: String! - - """ - The Git commit message body - """ - messageBody: String! - - """ - The commit message body rendered to HTML. - """ - messageBodyHTML: HTML! - - """ - The Git commit message headline - """ - messageHeadline: String! - - """ - The commit message headline rendered to HTML. - """ - messageHeadlineHTML: HTML! - - """ - The Git object ID - """ - oid: GitObjectID! - - """ - The organization this commit was made on behalf of. - """ - onBehalfOf: Organization - - """ - The parents of a commit. - """ - parents( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CommitConnection! - - """ - The datetime when this commit was pushed. - """ - pushedDate: DateTime - - """ - The Repository this commit belongs to - """ - repository: Repository! - - """ - The HTTP path for this commit - """ - resourcePath: URI! - - """ - Commit signing information, if present. - """ - signature: GitSignature - - """ - Status information for this commit - """ - status: Status - - """ - Check and Status rollup information for this commit. - """ - statusCheckRollup: StatusCheckRollup - - """ - Returns a list of all submodules in this repository as of this Commit parsed from the .gitmodules file. - """ - submodules( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): SubmoduleConnection! - - """ - Returns a URL to download a tarball archive for a repository. - Note: For private repositories, these links are temporary and expire after five minutes. - """ - tarballUrl: URI! - - """ - Commit's root Tree - """ - tree: Tree! - - """ - The HTTP path for the tree of this commit - """ - treeResourcePath: URI! - - """ - The HTTP URL for the tree of this commit - """ - treeUrl: URI! - - """ - The HTTP URL for this commit - """ - url: URI! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState - - """ - Returns a URL to download a zipball archive for a repository. - Note: For private repositories, these links are temporary and expire after five minutes. - """ - zipballUrl: URI! -} - -""" -Specifies an author for filtering Git commits. -""" -input CommitAuthor { - """ - Email addresses to filter by. Commits authored by any of the specified email addresses will be returned. - """ - emails: [String!] - - """ - ID of a User to filter by. If non-null, only commits authored by this user - will be returned. This field takes precedence over emails. - """ - id: ID -} - -""" -Represents a comment on a given Commit. -""" -type CommitComment implements Comment & Deletable & Minimizable & Node & Reactable & RepositoryNode & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - Identifies the comment body. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - Identifies the commit associated with the comment, if the commit exists. - """ - commit: Commit - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - Returns whether or not a comment has been minimized. - """ - isMinimized: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Returns why the comment was minimized. - """ - minimizedReason: String - - """ - Identifies the file path associated with the comment. - """ - path: String - - """ - Identifies the line position associated with the comment. - """ - position: Int - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The repository associated with this node. - """ - repository: Repository! - - """ - The HTTP path permalink for this commit comment. - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL permalink for this commit comment. - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Check if the current viewer can minimize this object. - """ - viewerCanMinimize: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -The connection type for CommitComment. -""" -type CommitCommentConnection { - """ - A list of edges. - """ - edges: [CommitCommentEdge] - - """ - A list of nodes. - """ - nodes: [CommitComment] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CommitCommentEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CommitComment -} - -""" -A thread of comments on a commit. -""" -type CommitCommentThread implements Node & RepositoryNode { - """ - The comments that exist in this thread. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CommitCommentConnection! - - """ - The commit the comments were made on. - """ - commit: Commit - id: ID! - - """ - The file the comments were made on. - """ - path: String - - """ - The position in the diff for the commit that the comment was made on. - """ - position: Int - - """ - The repository associated with this node. - """ - repository: Repository! -} - -""" -The connection type for Commit. -""" -type CommitConnection { - """ - A list of edges. - """ - edges: [CommitEdge] - - """ - A list of nodes. - """ - nodes: [Commit] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Ordering options for commit contribution connections. -""" -input CommitContributionOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field by which to order commit contributions. - """ - field: CommitContributionOrderField! -} - -""" -Properties by which commit contribution connections can be ordered. -""" -enum CommitContributionOrderField { - """ - Order commit contributions by how many commits they represent. - """ - COMMIT_COUNT - - """ - Order commit contributions by when they were made. - """ - OCCURRED_AT -} - -""" -This aggregates commits made by a user within one repository. -""" -type CommitContributionsByRepository { - """ - The commit contributions, each representing a day. - """ - contributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for commit contributions returned from the connection. - """ - orderBy: CommitContributionOrder = {field: OCCURRED_AT, direction: DESC} - ): CreatedCommitContributionConnection! - - """ - The repository in which the commits were made. - """ - repository: Repository! - - """ - The HTTP path for the user's commits to the repository in this time range. - """ - resourcePath: URI! - - """ - The HTTP URL for the user's commits to the repository in this time range. - """ - url: URI! -} - -""" -An edge in a connection. -""" -type CommitEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Commit -} - -""" -The connection type for Commit. -""" -type CommitHistoryConnection { - """ - A list of edges. - """ - edges: [CommitEdge] - - """ - A list of nodes. - """ - nodes: [Commit] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a 'connected' event on a given issue or pull request. -""" -type ConnectedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Reference originated in a different repository. - """ - isCrossRepository: Boolean! - - """ - Issue or pull request that made the reference. - """ - source: ReferencedSubject! - - """ - Issue or pull request which was connected. - """ - subject: ReferencedSubject! -} - -""" -A content attachment -""" -type ContentAttachment { - """ - The body text of the content attachment. This parameter supports markdown. - """ - body: String! - - """ - The content reference that the content attachment is attached to. - """ - contentReference: ContentReference! - - """ - Identifies the primary key from the database. - """ - databaseId: Int! - id: ID! - - """ - The title of the content attachment. - """ - title: String! -} - -""" -A content reference -""" -type ContentReference { - """ - Identifies the primary key from the database. - """ - databaseId: Int! - id: ID! - - """ - The reference of the content reference. - """ - reference: String! -} - -""" -Represents a contribution a user made on GitHub, such as opening an issue. -""" -interface Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -A calendar of contributions made on GitHub by a user. -""" -type ContributionCalendar { - """ - A list of hex color codes used in this calendar. The darker the color, the more contributions it represents. - """ - colors: [String!]! - - """ - Determine if the color set was chosen because it's currently Halloween. - """ - isHalloween: Boolean! - - """ - A list of the months of contributions in this calendar. - """ - months: [ContributionCalendarMonth!]! - - """ - The count of total contributions in the calendar. - """ - totalContributions: Int! - - """ - A list of the weeks of contributions in this calendar. - """ - weeks: [ContributionCalendarWeek!]! -} - -""" -Represents a single day of contributions on GitHub by a user. -""" -type ContributionCalendarDay { - """ - The hex color code that represents how many contributions were made on this day compared to others in the calendar. - """ - color: String! - - """ - How many contributions were made by the user on this day. - """ - contributionCount: Int! - - """ - The day this square represents. - """ - date: Date! - - """ - A number representing which day of the week this square represents, e.g., 1 is Monday. - """ - weekday: Int! -} - -""" -A month of contributions in a user's contribution graph. -""" -type ContributionCalendarMonth { - """ - The date of the first day of this month. - """ - firstDay: Date! - - """ - The name of the month. - """ - name: String! - - """ - How many weeks started in this month. - """ - totalWeeks: Int! - - """ - The year the month occurred in. - """ - year: Int! -} - -""" -A week of contributions in a user's contribution graph. -""" -type ContributionCalendarWeek { - """ - The days of contributions in this week. - """ - contributionDays: [ContributionCalendarDay!]! - - """ - The date of the earliest square in this week. - """ - firstDay: Date! -} - -""" -Ordering options for contribution connections. -""" -input ContributionOrder { - """ - The ordering direction. - """ - direction: OrderDirection! -} - -""" -A contributions collection aggregates contributions such as opened issues and commits created by a user. -""" -type ContributionsCollection { - """ - Commit contributions made by the user, grouped by repository. - """ - commitContributionsByRepository( - """ - How many repositories should be included. - """ - maxRepositories: Int = 25 - ): [CommitContributionsByRepository!]! - - """ - A calendar of this user's contributions on GitHub. - """ - contributionCalendar: ContributionCalendar! - - """ - The years the user has been making contributions with the most recent year first. - """ - contributionYears: [Int!]! - - """ - Determine if this collection's time span ends in the current month. - """ - doesEndInCurrentMonth: Boolean! - - """ - The date of the first restricted contribution the user made in this time - period. Can only be non-null when the user has enabled private contribution counts. - """ - earliestRestrictedContributionDate: Date - - """ - The ending date and time of this collection. - """ - endedAt: DateTime! - - """ - The first issue the user opened on GitHub. This will be null if that issue was - opened outside the collection's time range and ignoreTimeRange is false. If - the issue is not visible but the user has opted to show private contributions, - a RestrictedContribution will be returned. - """ - firstIssueContribution: CreatedIssueOrRestrictedContribution - - """ - The first pull request the user opened on GitHub. This will be null if that - pull request was opened outside the collection's time range and - ignoreTimeRange is not true. If the pull request is not visible but the user - has opted to show private contributions, a RestrictedContribution will be returned. - """ - firstPullRequestContribution: CreatedPullRequestOrRestrictedContribution - - """ - The first repository the user created on GitHub. This will be null if that - first repository was created outside the collection's time range and - ignoreTimeRange is false. If the repository is not visible, then a - RestrictedContribution is returned. - """ - firstRepositoryContribution: CreatedRepositoryOrRestrictedContribution - - """ - Does the user have any more activity in the timeline that occurred prior to the collection's time range? - """ - hasActivityInThePast: Boolean! - - """ - Determine if there are any contributions in this collection. - """ - hasAnyContributions: Boolean! - - """ - Determine if the user made any contributions in this time frame whose details - are not visible because they were made in a private repository. Can only be - true if the user enabled private contribution counts. - """ - hasAnyRestrictedContributions: Boolean! - - """ - Whether or not the collector's time span is all within the same day. - """ - isSingleDay: Boolean! - - """ - A list of issues the user opened. - """ - issueContributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Should the user's first issue ever be excluded from the result. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented issue be excluded from the result. - """ - excludePopular: Boolean = false - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedIssueContributionConnection! - - """ - Issue contributions made by the user, grouped by repository. - """ - issueContributionsByRepository( - """ - Should the user's first issue ever be excluded from the result. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented issue be excluded from the result. - """ - excludePopular: Boolean = false - - """ - How many repositories should be included. - """ - maxRepositories: Int = 25 - ): [IssueContributionsByRepository!]! - - """ - When the user signed up for GitHub. This will be null if that sign up date - falls outside the collection's time range and ignoreTimeRange is false. - """ - joinedGitHubContribution: JoinedGitHubContribution - - """ - The date of the most recent restricted contribution the user made in this time - period. Can only be non-null when the user has enabled private contribution counts. - """ - latestRestrictedContributionDate: Date - - """ - When this collection's time range does not include any activity from the user, use this - to get a different collection from an earlier time range that does have activity. - """ - mostRecentCollectionWithActivity: ContributionsCollection - - """ - Returns a different contributions collection from an earlier time range than this one - that does not have any contributions. - """ - mostRecentCollectionWithoutActivity: ContributionsCollection - - """ - The issue the user opened on GitHub that received the most comments in the specified - time frame. - """ - popularIssueContribution: CreatedIssueContribution - - """ - The pull request the user opened on GitHub that received the most comments in the - specified time frame. - """ - popularPullRequestContribution: CreatedPullRequestContribution - - """ - Pull request contributions made by the user. - """ - pullRequestContributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Should the user's first pull request ever be excluded from the result. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented pull request be excluded from the result. - """ - excludePopular: Boolean = false - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedPullRequestContributionConnection! - - """ - Pull request contributions made by the user, grouped by repository. - """ - pullRequestContributionsByRepository( - """ - Should the user's first pull request ever be excluded from the result. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented pull request be excluded from the result. - """ - excludePopular: Boolean = false - - """ - How many repositories should be included. - """ - maxRepositories: Int = 25 - ): [PullRequestContributionsByRepository!]! - - """ - Pull request review contributions made by the user. - """ - pullRequestReviewContributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedPullRequestReviewContributionConnection! - - """ - Pull request review contributions made by the user, grouped by repository. - """ - pullRequestReviewContributionsByRepository( - """ - How many repositories should be included. - """ - maxRepositories: Int = 25 - ): [PullRequestReviewContributionsByRepository!]! - - """ - A list of repositories owned by the user that the user created in this time range. - """ - repositoryContributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Should the user's first repository ever be excluded from the result. - """ - excludeFirst: Boolean = false - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedRepositoryContributionConnection! - - """ - A count of contributions made by the user that the viewer cannot access. Only - non-zero when the user has chosen to share their private contribution counts. - """ - restrictedContributionsCount: Int! - - """ - The beginning date and time of this collection. - """ - startedAt: DateTime! - - """ - How many commits were made by the user in this time span. - """ - totalCommitContributions: Int! - - """ - How many issues the user opened. - """ - totalIssueContributions( - """ - Should the user's first issue ever be excluded from this count. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented issue be excluded from this count. - """ - excludePopular: Boolean = false - ): Int! - - """ - How many pull requests the user opened. - """ - totalPullRequestContributions( - """ - Should the user's first pull request ever be excluded from this count. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented pull request be excluded from this count. - """ - excludePopular: Boolean = false - ): Int! - - """ - How many pull request reviews the user left. - """ - totalPullRequestReviewContributions: Int! - - """ - How many different repositories the user committed to. - """ - totalRepositoriesWithContributedCommits: Int! - - """ - How many different repositories the user opened issues in. - """ - totalRepositoriesWithContributedIssues( - """ - Should the user's first issue ever be excluded from this count. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented issue be excluded from this count. - """ - excludePopular: Boolean = false - ): Int! - - """ - How many different repositories the user left pull request reviews in. - """ - totalRepositoriesWithContributedPullRequestReviews: Int! - - """ - How many different repositories the user opened pull requests in. - """ - totalRepositoriesWithContributedPullRequests( - """ - Should the user's first pull request ever be excluded from this count. - """ - excludeFirst: Boolean = false - - """ - Should the user's most commented pull request be excluded from this count. - """ - excludePopular: Boolean = false - ): Int! - - """ - How many repositories the user created. - """ - totalRepositoryContributions( - """ - Should the user's first repository ever be excluded from this count. - """ - excludeFirst: Boolean = false - ): Int! - - """ - The user who made the contributions in this collection. - """ - user: User! -} - -""" -Autogenerated input type of ConvertProjectCardNoteToIssue -""" -input ConvertProjectCardNoteToIssueInput { - """ - The body of the newly created issue. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ProjectCard ID to convert. - """ - projectCardId: ID! @possibleTypes(concreteTypes: ["ProjectCard"]) - - """ - The ID of the repository to create the issue in. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - The title of the newly created issue. Defaults to the card's note text. - """ - title: String -} - -""" -Autogenerated return type of ConvertProjectCardNoteToIssue -""" -type ConvertProjectCardNoteToIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated ProjectCard. - """ - projectCard: ProjectCard -} - -""" -Represents a 'convert_to_draft' event on a given pull request. -""" -type ConvertToDraftEvent implements Node & UniformResourceLocatable { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - The HTTP path for this convert to draft event. - """ - resourcePath: URI! - - """ - The HTTP URL for this convert to draft event. - """ - url: URI! -} - -""" -Represents a 'converted_note_to_issue' event on a given issue or pull request. -""" -type ConvertedNoteToIssueEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - Project referenced by event. - """ - project: Project @preview(toggledBy: "starfox-preview") - - """ - Project card referenced by this project event. - """ - projectCard: ProjectCard @preview(toggledBy: "starfox-preview") - - """ - Column name referenced by this project event. - """ - projectColumnName: String! @preview(toggledBy: "starfox-preview") -} - -""" -Autogenerated input type of CreateBranchProtectionRule -""" -input CreateBranchProtectionRuleInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Will new commits pushed to matching branches dismiss pull request review approvals. - """ - dismissesStaleReviews: Boolean - - """ - Can admins overwrite branch protection. - """ - isAdminEnforced: Boolean - - """ - The glob-like pattern used to determine matching branches. - """ - pattern: String! - - """ - A list of User, Team or App IDs allowed to push to matching branches. - """ - pushActorIds: [ID!] - - """ - The global relay id of the repository in which a new branch protection rule should be created in. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - Number of approving reviews required to update matching branches. - """ - requiredApprovingReviewCount: Int - - """ - List of required status check contexts that must pass for commits to be accepted to matching branches. - """ - requiredStatusCheckContexts: [String!] - - """ - Are approving reviews required to update matching branches. - """ - requiresApprovingReviews: Boolean - - """ - Are reviews from code owners required to update matching branches. - """ - requiresCodeOwnerReviews: Boolean - - """ - Are commits required to be signed. - """ - requiresCommitSignatures: Boolean - - """ - Are status checks required to update matching branches. - """ - requiresStatusChecks: Boolean - - """ - Are branches required to be up to date before merging. - """ - requiresStrictStatusChecks: Boolean - - """ - Is pushing to matching branches restricted. - """ - restrictsPushes: Boolean - - """ - Is dismissal of pull request reviews restricted. - """ - restrictsReviewDismissals: Boolean - - """ - A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. - """ - reviewDismissalActorIds: [ID!] -} - -""" -Autogenerated return type of CreateBranchProtectionRule -""" -type CreateBranchProtectionRulePayload { - """ - The newly created BranchProtectionRule. - """ - branchProtectionRule: BranchProtectionRule - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of CreateCheckRun -""" -input CreateCheckRunInput @preview(toggledBy: "antiope-preview") { - """ - Possible further actions the integrator can perform, which a user may trigger. - """ - actions: [CheckRunAction!] - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The time that the check run finished. - """ - completedAt: DateTime - - """ - The final conclusion of the check. - """ - conclusion: CheckConclusionState - - """ - The URL of the integrator's site that has the full details of the check. - """ - detailsUrl: URI - - """ - A reference for the run on the integrator's system. - """ - externalId: String - - """ - The SHA of the head commit. - """ - headSha: GitObjectID! - - """ - The name of the check. - """ - name: String! - - """ - Descriptive details about the run. - """ - output: CheckRunOutput - - """ - The node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - The time that the check run began. - """ - startedAt: DateTime - - """ - The current status. - """ - status: RequestableCheckStatusState -} - -""" -Autogenerated return type of CreateCheckRun -""" -type CreateCheckRunPayload @preview(toggledBy: "antiope-preview") { - """ - The newly created check run. - """ - checkRun: CheckRun - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of CreateCheckSuite -""" -input CreateCheckSuiteInput @preview(toggledBy: "antiope-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The SHA of the head commit. - """ - headSha: GitObjectID! - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of CreateCheckSuite -""" -type CreateCheckSuitePayload @preview(toggledBy: "antiope-preview") { - """ - The newly created check suite. - """ - checkSuite: CheckSuite - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of CreateContentAttachment -""" -input CreateContentAttachmentInput { - """ - The body of the content attachment, which may contain markdown. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The node ID of the content_reference. - """ - contentReferenceId: ID! @possibleTypes(concreteTypes: ["ContentReference"]) - - """ - The title of the content attachment. - """ - title: String! -} - -""" -Autogenerated return type of CreateContentAttachment -""" -type CreateContentAttachmentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The newly created content attachment. - """ - contentAttachment: ContentAttachment -} - -""" -Autogenerated input type of CreateDeployment -""" -input CreateDeploymentInput @preview(toggledBy: "flash-preview") { - """ - Attempt to automatically merge the default branch into the requested ref, defaults to true. - """ - autoMerge: Boolean = true - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Short description of the deployment. - """ - description: String = "" - - """ - Name for the target deployment environment. - """ - environment: String = "production" - - """ - JSON payload with extra information about the deployment. - """ - payload: String = "{}" - - """ - The node ID of the ref to be deployed. - """ - refId: ID! @possibleTypes(concreteTypes: ["Ref"]) - - """ - The node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - The status contexts to verify against commit status checks. To bypass required - contexts, pass an empty array. Defaults to all unique contexts. - """ - requiredContexts: [String!] - - """ - Specifies a task to execute. - """ - task: String = "deploy" -} - -""" -Autogenerated return type of CreateDeployment -""" -type CreateDeploymentPayload @preview(toggledBy: "flash-preview") { - """ - True if the default branch has been auto-merged into the deployment ref. - """ - autoMerged: Boolean - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new deployment. - """ - deployment: Deployment -} - -""" -Autogenerated input type of CreateDeploymentStatus -""" -input CreateDeploymentStatusInput @preview(toggledBy: "flash-preview") { - """ - Adds a new inactive status to all non-transient, non-production environment - deployments with the same repository and environment name as the created - status's deployment. - """ - autoInactive: Boolean = true - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The node ID of the deployment. - """ - deploymentId: ID! @possibleTypes(concreteTypes: ["Deployment"]) - - """ - A short description of the status. Maximum length of 140 characters. - """ - description: String = "" - - """ - If provided, updates the environment of the deploy. Otherwise, does not modify the environment. - """ - environment: String - - """ - Sets the URL for accessing your environment. - """ - environmentUrl: String = "" - - """ - The log URL to associate with this status. This URL should contain - output to keep the user updated while the task is running or serve as - historical information for what happened in the deployment. - """ - logUrl: String = "" - - """ - The state of the deployment. - """ - state: DeploymentStatusState! -} - -""" -Autogenerated return type of CreateDeploymentStatus -""" -type CreateDeploymentStatusPayload @preview(toggledBy: "flash-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new deployment status. - """ - deploymentStatus: DeploymentStatus -} - -""" -Autogenerated input type of CreateEnterpriseOrganization -""" -input CreateEnterpriseOrganizationInput { - """ - The logins for the administrators of the new organization. - """ - adminLogins: [String!]! - - """ - The email used for sending billing receipts. - """ - billingEmail: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise owning the new organization. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The login of the new organization. - """ - login: String! - - """ - The profile name of the new organization. - """ - profileName: String! -} - -""" -Autogenerated return type of CreateEnterpriseOrganization -""" -type CreateEnterpriseOrganizationPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise that owns the created organization. - """ - enterprise: Enterprise - - """ - The organization that was created. - """ - organization: Organization -} - -""" -Autogenerated input type of CreateIpAllowListEntry -""" -input CreateIpAllowListEntryInput { - """ - An IP address or range of addresses in CIDR notation. - """ - allowListValue: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Whether the IP allow list entry is active when an IP allow list is enabled. - """ - isActive: Boolean! - - """ - An optional name for the IP allow list entry. - """ - name: String - - """ - The ID of the owner for which to create the new IP allow list entry. - """ - ownerId: ID! @possibleTypes(concreteTypes: ["Enterprise", "Organization"], abstractType: "IpAllowListOwner") -} - -""" -Autogenerated return type of CreateIpAllowListEntry -""" -type CreateIpAllowListEntryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The IP allow list entry that was created. - """ - ipAllowListEntry: IpAllowListEntry -} - -""" -Autogenerated input type of CreateIssue -""" -input CreateIssueInput { - """ - The Node ID for the user assignee for this issue. - """ - assigneeIds: [ID!] @possibleTypes(concreteTypes: ["User"]) - - """ - The body for the issue description. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - An array of Node IDs of labels for this issue. - """ - labelIds: [ID!] @possibleTypes(concreteTypes: ["Label"]) - - """ - The Node ID of the milestone for this issue. - """ - milestoneId: ID @possibleTypes(concreteTypes: ["Milestone"]) - - """ - An array of Node IDs for projects associated with this issue. - """ - projectIds: [ID!] @possibleTypes(concreteTypes: ["Project"]) - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - The title for the issue. - """ - title: String! -} - -""" -Autogenerated return type of CreateIssue -""" -type CreateIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new issue. - """ - issue: Issue -} - -""" -Autogenerated input type of CreateLabel -""" -input CreateLabelInput @preview(toggledBy: "bane-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A 6 character hex code, without the leading #, identifying the color of the label. - """ - color: String! - - """ - A brief description of the label, such as its purpose. - """ - description: String - - """ - The name of the label. - """ - name: String! - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of CreateLabel -""" -type CreateLabelPayload @preview(toggledBy: "bane-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new label. - """ - label: Label -} - -""" -Autogenerated input type of CreateProject -""" -input CreateProjectInput { - """ - The description of project. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of project. - """ - name: String! - - """ - The owner ID to create the project under. - """ - ownerId: ID! @possibleTypes(concreteTypes: ["Organization", "Repository", "User"], abstractType: "ProjectOwner") - - """ - A list of repository IDs to create as linked repositories for the project - """ - repositoryIds: [ID!] @possibleTypes(concreteTypes: ["Repository"]) - - """ - The name of the GitHub-provided template. - """ - template: ProjectTemplate -} - -""" -Autogenerated return type of CreateProject -""" -type CreateProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new project. - """ - project: Project -} - -""" -Autogenerated input type of CreatePullRequest -""" -input CreatePullRequestInput { - """ - The name of the branch you want your changes pulled into. This should be an existing branch - on the current repository. You cannot update the base branch on a pull request to point - to another repository. - """ - baseRefName: String! - - """ - The contents of the pull request. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Indicates whether this pull request should be a draft. - """ - draft: Boolean = false - - """ - The name of the branch where your changes are implemented. For cross-repository pull requests - in the same network, namespace `head_ref_name` with a user like this: `username:branch`. - """ - headRefName: String! - - """ - Indicates whether maintainers can modify the pull request. - """ - maintainerCanModify: Boolean = true - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - The title of the pull request. - """ - title: String! -} - -""" -Autogenerated return type of CreatePullRequest -""" -type CreatePullRequestPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new pull request. - """ - pullRequest: PullRequest -} - -""" -Autogenerated input type of CreateRef -""" -input CreateRefInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The fully qualified name of the new Ref (ie: `refs/heads/my_new_branch`). - """ - name: String! - - """ - The GitObjectID that the new Ref shall target. Must point to a commit. - """ - oid: GitObjectID! - - """ - The Node ID of the Repository to create the Ref in. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of CreateRef -""" -type CreateRefPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The newly created ref. - """ - ref: Ref -} - -""" -Autogenerated input type of CreateRepository -""" -input CreateRepositoryInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A short description of the new repository. - """ - description: String - - """ - Indicates if the repository should have the issues feature enabled. - """ - hasIssuesEnabled: Boolean = true - - """ - Indicates if the repository should have the wiki feature enabled. - """ - hasWikiEnabled: Boolean = false - - """ - The URL for a web page about this repository. - """ - homepageUrl: URI - - """ - The name of the new repository. - """ - name: String! - - """ - The ID of the owner for the new repository. - """ - ownerId: ID @possibleTypes(concreteTypes: ["Organization", "User"], abstractType: "RepositoryOwner") - - """ - When an organization is specified as the owner, this ID identifies the team - that should be granted access to the new repository. - """ - teamId: ID @possibleTypes(concreteTypes: ["Team"]) - - """ - Whether this repository should be marked as a template such that anyone who - can access it can create new repositories with the same files and directory structure. - """ - template: Boolean = false - - """ - Indicates the repository's visibility level. - """ - visibility: RepositoryVisibility! -} - -""" -Autogenerated return type of CreateRepository -""" -type CreateRepositoryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new repository. - """ - repository: Repository -} - -""" -Autogenerated input type of CreateTeamDiscussionComment -""" -input CreateTeamDiscussionCommentInput { - """ - The content of the comment. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the discussion to which the comment belongs. - """ - discussionId: ID! @possibleTypes(concreteTypes: ["TeamDiscussion"]) -} - -""" -Autogenerated return type of CreateTeamDiscussionComment -""" -type CreateTeamDiscussionCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new comment. - """ - teamDiscussionComment: TeamDiscussionComment -} - -""" -Autogenerated input type of CreateTeamDiscussion -""" -input CreateTeamDiscussionInput { - """ - The content of the discussion. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - If true, restricts the visiblity of this discussion to team members and - organization admins. If false or not specified, allows any organization member - to view this discussion. - """ - private: Boolean - - """ - The ID of the team to which the discussion belongs. - """ - teamId: ID! @possibleTypes(concreteTypes: ["Team"]) - - """ - The title of the discussion. - """ - title: String! -} - -""" -Autogenerated return type of CreateTeamDiscussion -""" -type CreateTeamDiscussionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new discussion. - """ - teamDiscussion: TeamDiscussion -} - -""" -Represents the contribution a user made by committing to a repository. -""" -type CreatedCommitContribution implements Contribution { - """ - How many commits were made on this day to this repository by the user. - """ - commitCount: Int! - - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The repository the user made a commit in. - """ - repository: Repository! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -The connection type for CreatedCommitContribution. -""" -type CreatedCommitContributionConnection { - """ - A list of edges. - """ - edges: [CreatedCommitContributionEdge] - - """ - A list of nodes. - """ - nodes: [CreatedCommitContribution] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of commits across days and repositories in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CreatedCommitContributionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CreatedCommitContribution -} - -""" -Represents the contribution a user made on GitHub by opening an issue. -""" -type CreatedIssueContribution implements Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - The issue that was opened. - """ - issue: Issue! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -The connection type for CreatedIssueContribution. -""" -type CreatedIssueContributionConnection { - """ - A list of edges. - """ - edges: [CreatedIssueContributionEdge] - - """ - A list of nodes. - """ - nodes: [CreatedIssueContribution] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CreatedIssueContributionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CreatedIssueContribution -} - -""" -Represents either a issue the viewer can access or a restricted contribution. -""" -union CreatedIssueOrRestrictedContribution = CreatedIssueContribution | RestrictedContribution - -""" -Represents the contribution a user made on GitHub by opening a pull request. -""" -type CreatedPullRequestContribution implements Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The pull request that was opened. - """ - pullRequest: PullRequest! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -The connection type for CreatedPullRequestContribution. -""" -type CreatedPullRequestContributionConnection { - """ - A list of edges. - """ - edges: [CreatedPullRequestContributionEdge] - - """ - A list of nodes. - """ - nodes: [CreatedPullRequestContribution] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CreatedPullRequestContributionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CreatedPullRequestContribution -} - -""" -Represents either a pull request the viewer can access or a restricted contribution. -""" -union CreatedPullRequestOrRestrictedContribution = CreatedPullRequestContribution | RestrictedContribution - -""" -Represents the contribution a user made by leaving a review on a pull request. -""" -type CreatedPullRequestReviewContribution implements Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The pull request the user reviewed. - """ - pullRequest: PullRequest! - - """ - The review the user left on the pull request. - """ - pullRequestReview: PullRequestReview! - - """ - The repository containing the pull request that the user reviewed. - """ - repository: Repository! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -The connection type for CreatedPullRequestReviewContribution. -""" -type CreatedPullRequestReviewContributionConnection { - """ - A list of edges. - """ - edges: [CreatedPullRequestReviewContributionEdge] - - """ - A list of nodes. - """ - nodes: [CreatedPullRequestReviewContribution] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CreatedPullRequestReviewContributionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CreatedPullRequestReviewContribution -} - -""" -Represents the contribution a user made on GitHub by creating a repository. -""" -type CreatedRepositoryContribution implements Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The repository that was created. - """ - repository: Repository! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -The connection type for CreatedRepositoryContribution. -""" -type CreatedRepositoryContributionConnection { - """ - A list of edges. - """ - edges: [CreatedRepositoryContributionEdge] - - """ - A list of nodes. - """ - nodes: [CreatedRepositoryContribution] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type CreatedRepositoryContributionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: CreatedRepositoryContribution -} - -""" -Represents either a repository the viewer can access or a restricted contribution. -""" -union CreatedRepositoryOrRestrictedContribution = CreatedRepositoryContribution | RestrictedContribution - -""" -Represents a mention made by one issue or pull request to another. -""" -type CrossReferencedEvent implements Node & UniformResourceLocatable { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Reference originated in a different repository. - """ - isCrossRepository: Boolean! - - """ - Identifies when the reference was made. - """ - referencedAt: DateTime! - - """ - The HTTP path for this pull request. - """ - resourcePath: URI! - - """ - Issue or pull request that made the reference. - """ - source: ReferencedSubject! - - """ - Issue or pull request to which the reference was made. - """ - target: ReferencedSubject! - - """ - The HTTP URL for this pull request. - """ - url: URI! - - """ - Checks if the target will be closed when the source is merged. - """ - willCloseTarget: Boolean! -} - -""" -An ISO-8601 encoded date string. -""" -scalar Date - -""" -An ISO-8601 encoded UTC date string. -""" -scalar DateTime - -""" -Autogenerated input type of DeclineTopicSuggestion -""" -input DeclineTopicSuggestionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of the suggested topic. - """ - name: String! - - """ - The reason why the suggested topic is declined. - """ - reason: TopicSuggestionDeclineReason! - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of DeclineTopicSuggestion -""" -type DeclineTopicSuggestionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The declined topic. - """ - topic: Topic -} - -""" -The possible default permissions for repositories. -""" -enum DefaultRepositoryPermissionField { - """ - Can read, write, and administrate repos by default - """ - ADMIN - - """ - No access - """ - NONE - - """ - Can read repos by default - """ - READ - - """ - Can read and write repos by default - """ - WRITE -} - -""" -Entities that can be deleted. -""" -interface Deletable { - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! -} - -""" -Autogenerated input type of DeleteBranchProtectionRule -""" -input DeleteBranchProtectionRuleInput { - """ - The global relay id of the branch protection rule to be deleted. - """ - branchProtectionRuleId: ID! @possibleTypes(concreteTypes: ["BranchProtectionRule"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated return type of DeleteBranchProtectionRule -""" -type DeleteBranchProtectionRulePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of DeleteDeployment -""" -input DeleteDeploymentInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the deployment to be deleted. - """ - id: ID! @possibleTypes(concreteTypes: ["Deployment"]) -} - -""" -Autogenerated return type of DeleteDeployment -""" -type DeleteDeploymentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of DeleteIpAllowListEntry -""" -input DeleteIpAllowListEntryInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the IP allow list entry to delete. - """ - ipAllowListEntryId: ID! @possibleTypes(concreteTypes: ["IpAllowListEntry"]) -} - -""" -Autogenerated return type of DeleteIpAllowListEntry -""" -type DeleteIpAllowListEntryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The IP allow list entry that was deleted. - """ - ipAllowListEntry: IpAllowListEntry -} - -""" -Autogenerated input type of DeleteIssueComment -""" -input DeleteIssueCommentInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the comment to delete. - """ - id: ID! @possibleTypes(concreteTypes: ["IssueComment"]) -} - -""" -Autogenerated return type of DeleteIssueComment -""" -type DeleteIssueCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of DeleteIssue -""" -input DeleteIssueInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the issue to delete. - """ - issueId: ID! @possibleTypes(concreteTypes: ["Issue"]) -} - -""" -Autogenerated return type of DeleteIssue -""" -type DeleteIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The repository the issue belonged to - """ - repository: Repository -} - -""" -Autogenerated input type of DeleteLabel -""" -input DeleteLabelInput @preview(toggledBy: "bane-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the label to be deleted. - """ - id: ID! @possibleTypes(concreteTypes: ["Label"]) -} - -""" -Autogenerated return type of DeleteLabel -""" -type DeleteLabelPayload @preview(toggledBy: "bane-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of DeletePackageVersion -""" -input DeletePackageVersionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the package version to be deleted. - """ - packageVersionId: ID! @possibleTypes(concreteTypes: ["PackageVersion"]) -} - -""" -Autogenerated return type of DeletePackageVersion -""" -type DeletePackageVersionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Whether or not the operation succeeded. - """ - success: Boolean -} - -""" -Autogenerated input type of DeleteProjectCard -""" -input DeleteProjectCardInput { - """ - The id of the card to delete. - """ - cardId: ID! @possibleTypes(concreteTypes: ["ProjectCard"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated return type of DeleteProjectCard -""" -type DeleteProjectCardPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The column the deleted card was in. - """ - column: ProjectColumn - - """ - The deleted card ID. - """ - deletedCardId: ID -} - -""" -Autogenerated input type of DeleteProjectColumn -""" -input DeleteProjectColumnInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The id of the column to delete. - """ - columnId: ID! @possibleTypes(concreteTypes: ["ProjectColumn"]) -} - -""" -Autogenerated return type of DeleteProjectColumn -""" -type DeleteProjectColumnPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The deleted column ID. - """ - deletedColumnId: ID - - """ - The project the deleted column was in. - """ - project: Project -} - -""" -Autogenerated input type of DeleteProject -""" -input DeleteProjectInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Project ID to update. - """ - projectId: ID! @possibleTypes(concreteTypes: ["Project"]) -} - -""" -Autogenerated return type of DeleteProject -""" -type DeleteProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The repository or organization the project was removed from. - """ - owner: ProjectOwner -} - -""" -Autogenerated input type of DeletePullRequestReviewComment -""" -input DeletePullRequestReviewCommentInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the comment to delete. - """ - id: ID! @possibleTypes(concreteTypes: ["PullRequestReviewComment"]) -} - -""" -Autogenerated return type of DeletePullRequestReviewComment -""" -type DeletePullRequestReviewCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The pull request review the deleted comment belonged to. - """ - pullRequestReview: PullRequestReview -} - -""" -Autogenerated input type of DeletePullRequestReview -""" -input DeletePullRequestReviewInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the pull request review to delete. - """ - pullRequestReviewId: ID! @possibleTypes(concreteTypes: ["PullRequestReview"]) -} - -""" -Autogenerated return type of DeletePullRequestReview -""" -type DeletePullRequestReviewPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The deleted pull request review. - """ - pullRequestReview: PullRequestReview -} - -""" -Autogenerated input type of DeleteRef -""" -input DeleteRefInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the Ref to be deleted. - """ - refId: ID! @possibleTypes(concreteTypes: ["Ref"]) -} - -""" -Autogenerated return type of DeleteRef -""" -type DeleteRefPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of DeleteTeamDiscussionComment -""" -input DeleteTeamDiscussionCommentInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the comment to delete. - """ - id: ID! @possibleTypes(concreteTypes: ["TeamDiscussionComment"]) -} - -""" -Autogenerated return type of DeleteTeamDiscussionComment -""" -type DeleteTeamDiscussionCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of DeleteTeamDiscussion -""" -input DeleteTeamDiscussionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The discussion ID to delete. - """ - id: ID! @possibleTypes(concreteTypes: ["TeamDiscussion"]) -} - -""" -Autogenerated return type of DeleteTeamDiscussion -""" -type DeleteTeamDiscussionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Represents a 'demilestoned' event on a given issue or pull request. -""" -type DemilestonedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the milestone title associated with the 'demilestoned' event. - """ - milestoneTitle: String! - - """ - Object referenced by event. - """ - subject: MilestoneItem! -} - -""" -A dependency manifest entry -""" -type DependencyGraphDependency @preview(toggledBy: "hawkgirl-preview") { - """ - Does the dependency itself have dependencies? - """ - hasDependencies: Boolean! - - """ - The dependency package manager - """ - packageManager: String - - """ - The required package name - """ - packageName: String! - - """ - The repository containing the package - """ - repository: Repository - - """ - The dependency version requirements - """ - requirements: String! -} - -""" -The connection type for DependencyGraphDependency. -""" -type DependencyGraphDependencyConnection @preview(toggledBy: "hawkgirl-preview") { - """ - A list of edges. - """ - edges: [DependencyGraphDependencyEdge] - - """ - A list of nodes. - """ - nodes: [DependencyGraphDependency] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type DependencyGraphDependencyEdge @preview(toggledBy: "hawkgirl-preview") { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: DependencyGraphDependency -} - -""" -Dependency manifest for a repository -""" -type DependencyGraphManifest implements Node @preview(toggledBy: "hawkgirl-preview") { - """ - Path to view the manifest file blob - """ - blobPath: String! - - """ - A list of manifest dependencies - """ - dependencies( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): DependencyGraphDependencyConnection - - """ - The number of dependencies listed in the manifest - """ - dependenciesCount: Int - - """ - Is the manifest too big to parse? - """ - exceedsMaxSize: Boolean! - - """ - Fully qualified manifest filename - """ - filename: String! - id: ID! - - """ - Were we able to parse the manifest? - """ - parseable: Boolean! - - """ - The repository containing the manifest - """ - repository: Repository! -} - -""" -The connection type for DependencyGraphManifest. -""" -type DependencyGraphManifestConnection @preview(toggledBy: "hawkgirl-preview") { - """ - A list of edges. - """ - edges: [DependencyGraphManifestEdge] - - """ - A list of nodes. - """ - nodes: [DependencyGraphManifest] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type DependencyGraphManifestEdge @preview(toggledBy: "hawkgirl-preview") { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: DependencyGraphManifest -} - -""" -A repository deploy key. -""" -type DeployKey implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - The deploy key. - """ - key: String! - - """ - Whether or not the deploy key is read only. - """ - readOnly: Boolean! - - """ - The deploy key title. - """ - title: String! - - """ - Whether or not the deploy key has been verified. - """ - verified: Boolean! -} - -""" -The connection type for DeployKey. -""" -type DeployKeyConnection { - """ - A list of edges. - """ - edges: [DeployKeyEdge] - - """ - A list of nodes. - """ - nodes: [DeployKey] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type DeployKeyEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: DeployKey -} - -""" -Represents a 'deployed' event on a given pull request. -""" -type DeployedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The deployment associated with the 'deployed' event. - """ - deployment: Deployment! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - The ref associated with the 'deployed' event. - """ - ref: Ref -} - -""" -Represents triggered deployment instance. -""" -type Deployment implements Node { - """ - Identifies the commit sha of the deployment. - """ - commit: Commit - - """ - Identifies the oid of the deployment commit, even if the commit has been deleted. - """ - commitOid: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the actor who triggered the deployment. - """ - creator: Actor! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The deployment description. - """ - description: String - - """ - The latest environment to which this deployment was made. - """ - environment: String - id: ID! - - """ - The latest environment to which this deployment was made. - """ - latestEnvironment: String - - """ - The latest status of this deployment. - """ - latestStatus: DeploymentStatus - - """ - The original environment to which this deployment was made. - """ - originalEnvironment: String - - """ - Extra information that a deployment system might need. - """ - payload: String - - """ - Identifies the Ref of the deployment, if the deployment was created by ref. - """ - ref: Ref - - """ - Identifies the repository associated with the deployment. - """ - repository: Repository! - - """ - The current state of the deployment. - """ - state: DeploymentState - - """ - A list of statuses associated with the deployment. - """ - statuses( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): DeploymentStatusConnection - - """ - The deployment task. - """ - task: String - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -The connection type for Deployment. -""" -type DeploymentConnection { - """ - A list of edges. - """ - edges: [DeploymentEdge] - - """ - A list of nodes. - """ - nodes: [Deployment] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type DeploymentEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Deployment -} - -""" -Represents a 'deployment_environment_changed' event on a given pull request. -""" -type DeploymentEnvironmentChangedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The deployment status that updated the deployment environment. - """ - deploymentStatus: DeploymentStatus! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! -} - -""" -Ordering options for deployment connections -""" -input DeploymentOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order deployments by. - """ - field: DeploymentOrderField! -} - -""" -Properties by which deployment connections can be ordered. -""" -enum DeploymentOrderField { - """ - Order collection by creation time - """ - CREATED_AT -} - -""" -The possible states in which a deployment can be. -""" -enum DeploymentState { - """ - The pending deployment was not updated after 30 minutes. - """ - ABANDONED - - """ - The deployment is currently active. - """ - ACTIVE - - """ - An inactive transient deployment. - """ - DESTROYED - - """ - The deployment experienced an error. - """ - ERROR - - """ - The deployment has failed. - """ - FAILURE - - """ - The deployment is inactive. - """ - INACTIVE - - """ - The deployment is in progress. - """ - IN_PROGRESS - - """ - The deployment is pending. - """ - PENDING - - """ - The deployment has queued - """ - QUEUED -} - -""" -Describes the status of a given deployment attempt. -""" -type DeploymentStatus implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the actor who triggered the deployment. - """ - creator: Actor! - - """ - Identifies the deployment associated with status. - """ - deployment: Deployment! - - """ - Identifies the description of the deployment. - """ - description: String - - """ - Identifies the environment of the deployment at the time of this deployment status - """ - environment: String @preview(toggledBy: "flash-preview") - - """ - Identifies the environment URL of the deployment. - """ - environmentUrl: URI - id: ID! - - """ - Identifies the log URL of the deployment. - """ - logUrl: URI - - """ - Identifies the current state of the deployment. - """ - state: DeploymentStatusState! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -The connection type for DeploymentStatus. -""" -type DeploymentStatusConnection { - """ - A list of edges. - """ - edges: [DeploymentStatusEdge] - - """ - A list of nodes. - """ - nodes: [DeploymentStatus] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type DeploymentStatusEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: DeploymentStatus -} - -""" -The possible states for a deployment status. -""" -enum DeploymentStatusState { - """ - The deployment experienced an error. - """ - ERROR - - """ - The deployment has failed. - """ - FAILURE - - """ - The deployment is inactive. - """ - INACTIVE - - """ - The deployment is in progress. - """ - IN_PROGRESS - - """ - The deployment is pending. - """ - PENDING - - """ - The deployment is queued - """ - QUEUED - - """ - The deployment was successful. - """ - SUCCESS -} - -""" -The possible sides of a diff. -""" -enum DiffSide { - """ - The left side of the diff. - """ - LEFT - - """ - The right side of the diff. - """ - RIGHT -} - -""" -Represents a 'disconnected' event on a given issue or pull request. -""" -type DisconnectedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Reference originated in a different repository. - """ - isCrossRepository: Boolean! - - """ - Issue or pull request from which the issue was disconnected. - """ - source: ReferencedSubject! - - """ - Issue or pull request which was disconnected. - """ - subject: ReferencedSubject! -} - -""" -Autogenerated input type of DismissPullRequestReview -""" -input DismissPullRequestReviewInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The contents of the pull request review dismissal message. - """ - message: String! - - """ - The Node ID of the pull request review to modify. - """ - pullRequestReviewId: ID! @possibleTypes(concreteTypes: ["PullRequestReview"]) -} - -""" -Autogenerated return type of DismissPullRequestReview -""" -type DismissPullRequestReviewPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The dismissed pull request review. - """ - pullRequestReview: PullRequestReview -} - -""" -Specifies a review comment to be left with a Pull Request Review. -""" -input DraftPullRequestReviewComment { - """ - Body of the comment to leave. - """ - body: String! - - """ - Path to the file being commented on. - """ - path: String! - - """ - Position in the file to leave a comment on. - """ - position: Int! -} - -""" -Specifies a review comment thread to be left with a Pull Request Review. -""" -input DraftPullRequestReviewThread { - """ - Body of the comment to leave. - """ - body: String! - - """ - The line of the blob to which the thread refers. The end of the line range for multi-line comments. - """ - line: Int! - - """ - Path to the file being commented on. - """ - path: String! - - """ - The side of the diff on which the line resides. For multi-line comments, this is the side for the end of the line range. - """ - side: DiffSide = RIGHT - - """ - The first line of the range to which the comment refers. - """ - startLine: Int - - """ - The side of the diff on which the start line resides. - """ - startSide: DiffSide = RIGHT -} - -""" -An account to manage multiple organizations with consolidated policy and billing. -""" -type Enterprise implements Node { - """ - A URL pointing to the enterprise's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - Enterprise billing information visible to enterprise billing managers. - """ - billingInfo: EnterpriseBillingInfo - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The description of the enterprise. - """ - description: String - - """ - The description of the enterprise as HTML. - """ - descriptionHTML: HTML! - id: ID! - - """ - The location of the enterprise. - """ - location: String - - """ - A list of users who are members of this enterprise. - """ - members( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Only return members within the selected GitHub Enterprise deployment - """ - deployment: EnterpriseUserDeployment - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for members returned from the connection. - """ - orderBy: EnterpriseMemberOrder = {field: LOGIN, direction: ASC} - - """ - Only return members within the organizations with these logins - """ - organizationLogins: [String!] - - """ - The search string to look for. - """ - query: String - - """ - The role of the user in the enterprise organization or server. - """ - role: EnterpriseUserAccountMembershipRole - ): EnterpriseMemberConnection! - - """ - The name of the enterprise. - """ - name: String! - - """ - A list of organizations that belong to this enterprise. - """ - organizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations returned from the connection. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The search string to look for. - """ - query: String - ): OrganizationConnection! - - """ - Enterprise information only visible to enterprise owners. - """ - ownerInfo: EnterpriseOwnerInfo - - """ - The HTTP path for this enterprise. - """ - resourcePath: URI! - - """ - The URL-friendly identifier for the enterprise. - """ - slug: String! - - """ - The HTTP URL for this enterprise. - """ - url: URI! - - """ - A list of user accounts on this enterprise. - """ - userAccounts( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): EnterpriseUserAccountConnection! - - """ - Is the current viewer an admin of this enterprise? - """ - viewerIsAdmin: Boolean! - - """ - The URL of the enterprise website. - """ - websiteUrl: URI -} - -""" -The connection type for User. -""" -type EnterpriseAdministratorConnection { - """ - A list of edges. - """ - edges: [EnterpriseAdministratorEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -A User who is an administrator of an enterprise. -""" -type EnterpriseAdministratorEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: User - - """ - The role of the administrator. - """ - role: EnterpriseAdministratorRole! -} - -""" -An invitation for a user to become an owner or billing manager of an enterprise. -""" -type EnterpriseAdministratorInvitation implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The email of the person who was invited to the enterprise. - """ - email: String - - """ - The enterprise the invitation is for. - """ - enterprise: Enterprise! - id: ID! - - """ - The user who was invited to the enterprise. - """ - invitee: User - - """ - The user who created the invitation. - """ - inviter: User - - """ - The invitee's pending role in the enterprise (owner or billing_manager). - """ - role: EnterpriseAdministratorRole! -} - -""" -The connection type for EnterpriseAdministratorInvitation. -""" -type EnterpriseAdministratorInvitationConnection { - """ - A list of edges. - """ - edges: [EnterpriseAdministratorInvitationEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseAdministratorInvitation] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseAdministratorInvitationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseAdministratorInvitation -} - -""" -Ordering options for enterprise administrator invitation connections -""" -input EnterpriseAdministratorInvitationOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order enterprise administrator invitations by. - """ - field: EnterpriseAdministratorInvitationOrderField! -} - -""" -Properties by which enterprise administrator invitation connections can be ordered. -""" -enum EnterpriseAdministratorInvitationOrderField { - """ - Order enterprise administrator member invitations by creation time - """ - CREATED_AT -} - -""" -The possible administrator roles in an enterprise account. -""" -enum EnterpriseAdministratorRole { - """ - Represents a billing manager of the enterprise account. - """ - BILLING_MANAGER - - """ - Represents an owner of the enterprise account. - """ - OWNER -} - -""" -Metadata for an audit entry containing enterprise account information. -""" -interface EnterpriseAuditEntryData { - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI -} - -""" -Enterprise billing information visible to enterprise billing managers and owners. -""" -type EnterpriseBillingInfo { - """ - The number of licenseable users/emails across the enterprise. - """ - allLicensableUsersCount: Int! - - """ - The number of data packs used by all organizations owned by the enterprise. - """ - assetPacks: Int! - - """ - The number of available seats across all owned organizations based on the unique number of billable users. - """ - availableSeats: Int! @deprecated(reason: "`availableSeats` will be replaced with `totalAvailableLicenses` to provide more clarity on the value being returned Use EnterpriseBillingInfo.totalAvailableLicenses instead. Removal on 2020-01-01 UTC.") - - """ - The bandwidth quota in GB for all organizations owned by the enterprise. - """ - bandwidthQuota: Float! - - """ - The bandwidth usage in GB for all organizations owned by the enterprise. - """ - bandwidthUsage: Float! - - """ - The bandwidth usage as a percentage of the bandwidth quota. - """ - bandwidthUsagePercentage: Int! - - """ - The total seats across all organizations owned by the enterprise. - """ - seats: Int! @deprecated(reason: "`seats` will be replaced with `totalLicenses` to provide more clarity on the value being returned Use EnterpriseBillingInfo.totalLicenses instead. Removal on 2020-01-01 UTC.") - - """ - The storage quota in GB for all organizations owned by the enterprise. - """ - storageQuota: Float! - - """ - The storage usage in GB for all organizations owned by the enterprise. - """ - storageUsage: Float! - - """ - The storage usage as a percentage of the storage quota. - """ - storageUsagePercentage: Int! - - """ - The number of available licenses across all owned organizations based on the unique number of billable users. - """ - totalAvailableLicenses: Int! - - """ - The total number of licenses allocated. - """ - totalLicenses: Int! -} - -""" -The possible values for the enterprise default repository permission setting. -""" -enum EnterpriseDefaultRepositoryPermissionSettingValue { - """ - Organization members will be able to clone, pull, push, and add new collaborators to all organization repositories. - """ - ADMIN - - """ - Organization members will only be able to clone and pull public repositories. - """ - NONE - - """ - Organizations in the enterprise choose default repository permissions for their members. - """ - NO_POLICY - - """ - Organization members will be able to clone and pull all organization repositories. - """ - READ - - """ - Organization members will be able to clone, pull, and push all organization repositories. - """ - WRITE -} - -""" -The possible values for an enabled/disabled enterprise setting. -""" -enum EnterpriseEnabledDisabledSettingValue { - """ - The setting is disabled for organizations in the enterprise. - """ - DISABLED - - """ - The setting is enabled for organizations in the enterprise. - """ - ENABLED - - """ - There is no policy set for organizations in the enterprise. - """ - NO_POLICY -} - -""" -The possible values for an enabled/no policy enterprise setting. -""" -enum EnterpriseEnabledSettingValue { - """ - The setting is enabled for organizations in the enterprise. - """ - ENABLED - - """ - There is no policy set for organizations in the enterprise. - """ - NO_POLICY -} - -""" -An identity provider configured to provision identities for an enterprise. -""" -type EnterpriseIdentityProvider implements Node { - """ - The digest algorithm used to sign SAML requests for the identity provider. - """ - digestMethod: SamlDigestAlgorithm - - """ - The enterprise this identity provider belongs to. - """ - enterprise: Enterprise - - """ - ExternalIdentities provisioned by this identity provider. - """ - externalIdentities( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ExternalIdentityConnection! - id: ID! - - """ - The x509 certificate used by the identity provider to sign assertions and responses. - """ - idpCertificate: X509Certificate - - """ - The Issuer Entity ID for the SAML identity provider. - """ - issuer: String - - """ - Recovery codes that can be used by admins to access the enterprise if the identity provider is unavailable. - """ - recoveryCodes: [String!] - - """ - The signature algorithm used to sign SAML requests for the identity provider. - """ - signatureMethod: SamlSignatureAlgorithm - - """ - The URL endpoint for the identity provider's SAML SSO. - """ - ssoUrl: URI -} - -""" -An object that is a member of an enterprise. -""" -union EnterpriseMember = EnterpriseUserAccount | User - -""" -The connection type for EnterpriseMember. -""" -type EnterpriseMemberConnection { - """ - A list of edges. - """ - edges: [EnterpriseMemberEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseMember] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -A User who is a member of an enterprise through one or more organizations. -""" -type EnterpriseMemberEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - Whether the user does not have a license for the enterprise. - """ - isUnlicensed: Boolean! - - """ - The item at the end of the edge. - """ - node: EnterpriseMember -} - -""" -Ordering options for enterprise member connections. -""" -input EnterpriseMemberOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order enterprise members by. - """ - field: EnterpriseMemberOrderField! -} - -""" -Properties by which enterprise member connections can be ordered. -""" -enum EnterpriseMemberOrderField { - """ - Order enterprise members by creation time - """ - CREATED_AT - - """ - Order enterprise members by login - """ - LOGIN -} - -""" -The possible values for the enterprise members can create repositories setting. -""" -enum EnterpriseMembersCanCreateRepositoriesSettingValue { - """ - Members will be able to create public and private repositories. - """ - ALL - - """ - Members will not be able to create public or private repositories. - """ - DISABLED - - """ - Organization administrators choose whether to allow members to create repositories. - """ - NO_POLICY - - """ - Members will be able to create only private repositories. - """ - PRIVATE - - """ - Members will be able to create only public repositories. - """ - PUBLIC -} - -""" -The possible values for the members can make purchases setting. -""" -enum EnterpriseMembersCanMakePurchasesSettingValue { - """ - The setting is disabled for organizations in the enterprise. - """ - DISABLED - - """ - The setting is enabled for organizations in the enterprise. - """ - ENABLED -} - -""" -The connection type for Organization. -""" -type EnterpriseOrganizationMembershipConnection { - """ - A list of edges. - """ - edges: [EnterpriseOrganizationMembershipEdge] - - """ - A list of nodes. - """ - nodes: [Organization] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An enterprise organization that a user is a member of. -""" -type EnterpriseOrganizationMembershipEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Organization - - """ - The role of the user in the enterprise membership. - """ - role: EnterpriseUserAccountMembershipRole! -} - -""" -The connection type for User. -""" -type EnterpriseOutsideCollaboratorConnection { - """ - A list of edges. - """ - edges: [EnterpriseOutsideCollaboratorEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -A User who is an outside collaborator of an enterprise through one or more organizations. -""" -type EnterpriseOutsideCollaboratorEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - Whether the outside collaborator does not have a license for the enterprise. - """ - isUnlicensed: Boolean! - - """ - The item at the end of the edge. - """ - node: User - - """ - The enterprise organization repositories this user is a member of. - """ - repositories( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories. - """ - orderBy: RepositoryOrder = {field: NAME, direction: ASC} - ): EnterpriseRepositoryInfoConnection! -} - -""" -Enterprise information only visible to enterprise owners. -""" -type EnterpriseOwnerInfo { - """ - A list of enterprise organizations configured with the provided action execution capabilities setting value. - """ - actionExecutionCapabilitySettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - ): OrganizationConnection! - - """ - A list of all of the administrators for this enterprise. - """ - admins( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for administrators returned from the connection. - """ - orderBy: EnterpriseMemberOrder = {field: LOGIN, direction: ASC} - - """ - The search string to look for. - """ - query: String - - """ - The role to filter by. - """ - role: EnterpriseAdministratorRole - ): EnterpriseAdministratorConnection! - - """ - A list of users in the enterprise who currently have two-factor authentication disabled. - """ - affiliatedUsersWithTwoFactorDisabled( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! - - """ - Whether or not affiliated users with two-factor authentication disabled exist in the enterprise. - """ - affiliatedUsersWithTwoFactorDisabledExist: Boolean! - - """ - The setting value for whether private repository forking is enabled for repositories in organizations in this enterprise. - """ - allowPrivateRepositoryForkingSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided private repository forking setting value. - """ - allowPrivateRepositoryForkingSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for base repository permissions for organizations in this enterprise. - """ - defaultRepositoryPermissionSetting: EnterpriseDefaultRepositoryPermissionSettingValue! - - """ - A list of enterprise organizations configured with the provided default repository permission. - """ - defaultRepositoryPermissionSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The permission to find organizations for. - """ - value: DefaultRepositoryPermissionField! - ): OrganizationConnection! - - """ - Enterprise Server installations owned by the enterprise. - """ - enterpriseServerInstallations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Whether or not to only return installations discovered via GitHub Connect. - """ - connectedOnly: Boolean = false - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for Enterprise Server installations returned. - """ - orderBy: EnterpriseServerInstallationOrder = {field: HOST_NAME, direction: ASC} - ): EnterpriseServerInstallationConnection! - - """ - The setting value for whether the enterprise has an IP allow list enabled. - """ - ipAllowListEnabledSetting: IpAllowListEnabledSettingValue! - - """ - The IP addresses that are allowed to access resources owned by the enterprise. - """ - ipAllowListEntries( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for IP allow list entries returned. - """ - orderBy: IpAllowListEntryOrder = {field: ALLOW_LIST_VALUE, direction: ASC} - ): IpAllowListEntryConnection! - - """ - Whether or not the default repository permission is currently being updated. - """ - isUpdatingDefaultRepositoryPermission: Boolean! - - """ - Whether the two-factor authentication requirement is currently being enforced. - """ - isUpdatingTwoFactorRequirement: Boolean! - - """ - The setting value for whether organization members with admin permissions on a - repository can change repository visibility. - """ - membersCanChangeRepositoryVisibilitySetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided can change repository visibility setting value. - """ - membersCanChangeRepositoryVisibilitySettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for whether members of organizations in the enterprise can create internal repositories. - """ - membersCanCreateInternalRepositoriesSetting: Boolean - - """ - The setting value for whether members of organizations in the enterprise can create private repositories. - """ - membersCanCreatePrivateRepositoriesSetting: Boolean - - """ - The setting value for whether members of organizations in the enterprise can create public repositories. - """ - membersCanCreatePublicRepositoriesSetting: Boolean - - """ - The setting value for whether members of organizations in the enterprise can create repositories. - """ - membersCanCreateRepositoriesSetting: EnterpriseMembersCanCreateRepositoriesSettingValue - - """ - A list of enterprise organizations configured with the provided repository creation setting value. - """ - membersCanCreateRepositoriesSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting to find organizations for. - """ - value: OrganizationMembersCanCreateRepositoriesSettingValue! - ): OrganizationConnection! - - """ - The setting value for whether members with admin permissions for repositories can delete issues. - """ - membersCanDeleteIssuesSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided members can delete issues setting value. - """ - membersCanDeleteIssuesSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for whether members with admin permissions for repositories can delete or transfer repositories. - """ - membersCanDeleteRepositoriesSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided members can delete repositories setting value. - """ - membersCanDeleteRepositoriesSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for whether members of organizations in the enterprise can invite outside collaborators. - """ - membersCanInviteCollaboratorsSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided members can invite collaborators setting value. - """ - membersCanInviteCollaboratorsSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - Indicates whether members of this enterprise's organizations can purchase additional services for those organizations. - """ - membersCanMakePurchasesSetting: EnterpriseMembersCanMakePurchasesSettingValue! - - """ - The setting value for whether members with admin permissions for repositories can update protected branches. - """ - membersCanUpdateProtectedBranchesSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided members can update protected branches setting value. - """ - membersCanUpdateProtectedBranchesSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for whether members can view dependency insights. - """ - membersCanViewDependencyInsightsSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided members can view dependency insights setting value. - """ - membersCanViewDependencyInsightsSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for whether organization projects are enabled for organizations in this enterprise. - """ - organizationProjectsSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided organization projects setting value. - """ - organizationProjectsSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - A list of outside collaborators across the repositories in the enterprise. - """ - outsideCollaborators( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - The login of one specific outside collaborator. - """ - login: String - - """ - Ordering options for outside collaborators returned from the connection. - """ - orderBy: EnterpriseMemberOrder = {field: LOGIN, direction: ASC} - - """ - The search string to look for. - """ - query: String - - """ - Only return outside collaborators on repositories with this visibility. - """ - visibility: RepositoryVisibility - ): EnterpriseOutsideCollaboratorConnection! - - """ - A list of pending administrator invitations for the enterprise. - """ - pendingAdminInvitations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pending enterprise administrator invitations returned from the connection. - """ - orderBy: EnterpriseAdministratorInvitationOrder = {field: CREATED_AT, direction: DESC} - - """ - The search string to look for. - """ - query: String - - """ - The role to filter by. - """ - role: EnterpriseAdministratorRole - ): EnterpriseAdministratorInvitationConnection! - - """ - A list of pending collaborator invitations across the repositories in the enterprise. - """ - pendingCollaboratorInvitations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pending repository collaborator invitations returned from the connection. - """ - orderBy: RepositoryInvitationOrder = {field: CREATED_AT, direction: DESC} - - """ - The search string to look for. - """ - query: String - ): RepositoryInvitationConnection! - - """ - A list of pending collaborators across the repositories in the enterprise. - """ - pendingCollaborators( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pending repository collaborator invitations returned from the connection. - """ - orderBy: RepositoryInvitationOrder = {field: CREATED_AT, direction: DESC} - - """ - The search string to look for. - """ - query: String - ): EnterprisePendingCollaboratorConnection! @deprecated(reason: "Repository invitations can now be associated with an email, not only an invitee. Use the `pendingCollaboratorInvitations` field instead. Removal on 2020-10-01 UTC.") - - """ - A list of pending member invitations for organizations in the enterprise. - """ - pendingMemberInvitations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - The search string to look for. - """ - query: String - ): EnterprisePendingMemberInvitationConnection! - - """ - The setting value for whether repository projects are enabled in this enterprise. - """ - repositoryProjectsSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided repository projects setting value. - """ - repositoryProjectsSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The SAML Identity Provider for the enterprise. - """ - samlIdentityProvider: EnterpriseIdentityProvider - - """ - A list of enterprise organizations configured with the SAML single sign-on setting value. - """ - samlIdentityProviderSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: IdentityProviderConfigurationState! - ): OrganizationConnection! - - """ - The setting value for whether team discussions are enabled for organizations in this enterprise. - """ - teamDiscussionsSetting: EnterpriseEnabledDisabledSettingValue! - - """ - A list of enterprise organizations configured with the provided team discussions setting value. - """ - teamDiscussionsSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! - - """ - The setting value for whether the enterprise requires two-factor authentication for its organizations and users. - """ - twoFactorRequiredSetting: EnterpriseEnabledSettingValue! - - """ - A list of enterprise organizations configured with the two-factor authentication setting value. - """ - twoFactorRequiredSettingOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations with this setting. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The setting value to find organizations for. - """ - value: Boolean! - ): OrganizationConnection! -} - -""" -The connection type for User. -""" -type EnterprisePendingCollaboratorConnection { - """ - A list of edges. - """ - edges: [EnterprisePendingCollaboratorEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -A user with an invitation to be a collaborator on a repository owned by an organization in an enterprise. -""" -type EnterprisePendingCollaboratorEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - Whether the invited collaborator does not have a license for the enterprise. - """ - isUnlicensed: Boolean! - - """ - The item at the end of the edge. - """ - node: User - - """ - The enterprise organization repositories this user is a member of. - """ - repositories( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories. - """ - orderBy: RepositoryOrder = {field: NAME, direction: ASC} - ): EnterpriseRepositoryInfoConnection! -} - -""" -The connection type for OrganizationInvitation. -""" -type EnterprisePendingMemberInvitationConnection { - """ - A list of edges. - """ - edges: [EnterprisePendingMemberInvitationEdge] - - """ - A list of nodes. - """ - nodes: [OrganizationInvitation] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! - - """ - Identifies the total count of unique users in the connection. - """ - totalUniqueUserCount: Int! -} - -""" -An invitation to be a member in an enterprise organization. -""" -type EnterprisePendingMemberInvitationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - Whether the invitation has a license for the enterprise. - """ - isUnlicensed: Boolean! - - """ - The item at the end of the edge. - """ - node: OrganizationInvitation -} - -""" -A subset of repository information queryable from an enterprise. -""" -type EnterpriseRepositoryInfo implements Node { - id: ID! - - """ - Identifies if the repository is private. - """ - isPrivate: Boolean! - - """ - The repository's name. - """ - name: String! - - """ - The repository's name with owner. - """ - nameWithOwner: String! -} - -""" -The connection type for EnterpriseRepositoryInfo. -""" -type EnterpriseRepositoryInfoConnection { - """ - A list of edges. - """ - edges: [EnterpriseRepositoryInfoEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseRepositoryInfo] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseRepositoryInfoEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseRepositoryInfo -} - -""" -An Enterprise Server installation. -""" -type EnterpriseServerInstallation implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The customer name to which the Enterprise Server installation belongs. - """ - customerName: String! - - """ - The host name of the Enterprise Server installation. - """ - hostName: String! - id: ID! - - """ - Whether or not the installation is connected to an Enterprise Server installation via GitHub Connect. - """ - isConnected: Boolean! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - User accounts on this Enterprise Server installation. - """ - userAccounts( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for Enterprise Server user accounts returned from the connection. - """ - orderBy: EnterpriseServerUserAccountOrder = {field: LOGIN, direction: ASC} - ): EnterpriseServerUserAccountConnection! - - """ - User accounts uploads for the Enterprise Server installation. - """ - userAccountsUploads( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for Enterprise Server user accounts uploads returned from the connection. - """ - orderBy: EnterpriseServerUserAccountsUploadOrder = {field: CREATED_AT, direction: DESC} - ): EnterpriseServerUserAccountsUploadConnection! -} - -""" -The connection type for EnterpriseServerInstallation. -""" -type EnterpriseServerInstallationConnection { - """ - A list of edges. - """ - edges: [EnterpriseServerInstallationEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseServerInstallation] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseServerInstallationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseServerInstallation -} - -""" -Ordering options for Enterprise Server installation connections. -""" -input EnterpriseServerInstallationOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order Enterprise Server installations by. - """ - field: EnterpriseServerInstallationOrderField! -} - -""" -Properties by which Enterprise Server installation connections can be ordered. -""" -enum EnterpriseServerInstallationOrderField { - """ - Order Enterprise Server installations by creation time - """ - CREATED_AT - - """ - Order Enterprise Server installations by customer name - """ - CUSTOMER_NAME - - """ - Order Enterprise Server installations by host name - """ - HOST_NAME -} - -""" -A user account on an Enterprise Server installation. -""" -type EnterpriseServerUserAccount implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - User emails belonging to this user account. - """ - emails( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for Enterprise Server user account emails returned from the connection. - """ - orderBy: EnterpriseServerUserAccountEmailOrder = {field: EMAIL, direction: ASC} - ): EnterpriseServerUserAccountEmailConnection! - - """ - The Enterprise Server installation on which this user account exists. - """ - enterpriseServerInstallation: EnterpriseServerInstallation! - id: ID! - - """ - Whether the user account is a site administrator on the Enterprise Server installation. - """ - isSiteAdmin: Boolean! - - """ - The login of the user account on the Enterprise Server installation. - """ - login: String! - - """ - The profile name of the user account on the Enterprise Server installation. - """ - profileName: String - - """ - The date and time when the user account was created on the Enterprise Server installation. - """ - remoteCreatedAt: DateTime! - - """ - The ID of the user account on the Enterprise Server installation. - """ - remoteUserId: Int! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -The connection type for EnterpriseServerUserAccount. -""" -type EnterpriseServerUserAccountConnection { - """ - A list of edges. - """ - edges: [EnterpriseServerUserAccountEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseServerUserAccount] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseServerUserAccountEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseServerUserAccount -} - -""" -An email belonging to a user account on an Enterprise Server installation. -""" -type EnterpriseServerUserAccountEmail implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The email address. - """ - email: String! - id: ID! - - """ - Indicates whether this is the primary email of the associated user account. - """ - isPrimary: Boolean! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The user account to which the email belongs. - """ - userAccount: EnterpriseServerUserAccount! -} - -""" -The connection type for EnterpriseServerUserAccountEmail. -""" -type EnterpriseServerUserAccountEmailConnection { - """ - A list of edges. - """ - edges: [EnterpriseServerUserAccountEmailEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseServerUserAccountEmail] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseServerUserAccountEmailEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseServerUserAccountEmail -} - -""" -Ordering options for Enterprise Server user account email connections. -""" -input EnterpriseServerUserAccountEmailOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order emails by. - """ - field: EnterpriseServerUserAccountEmailOrderField! -} - -""" -Properties by which Enterprise Server user account email connections can be ordered. -""" -enum EnterpriseServerUserAccountEmailOrderField { - """ - Order emails by email - """ - EMAIL -} - -""" -Ordering options for Enterprise Server user account connections. -""" -input EnterpriseServerUserAccountOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order user accounts by. - """ - field: EnterpriseServerUserAccountOrderField! -} - -""" -Properties by which Enterprise Server user account connections can be ordered. -""" -enum EnterpriseServerUserAccountOrderField { - """ - Order user accounts by login - """ - LOGIN - - """ - Order user accounts by creation time on the Enterprise Server installation - """ - REMOTE_CREATED_AT -} - -""" -A user accounts upload from an Enterprise Server installation. -""" -type EnterpriseServerUserAccountsUpload implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The enterprise to which this upload belongs. - """ - enterprise: Enterprise! - - """ - The Enterprise Server installation for which this upload was generated. - """ - enterpriseServerInstallation: EnterpriseServerInstallation! - id: ID! - - """ - The name of the file uploaded. - """ - name: String! - - """ - The synchronization state of the upload - """ - syncState: EnterpriseServerUserAccountsUploadSyncState! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -The connection type for EnterpriseServerUserAccountsUpload. -""" -type EnterpriseServerUserAccountsUploadConnection { - """ - A list of edges. - """ - edges: [EnterpriseServerUserAccountsUploadEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseServerUserAccountsUpload] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseServerUserAccountsUploadEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseServerUserAccountsUpload -} - -""" -Ordering options for Enterprise Server user accounts upload connections. -""" -input EnterpriseServerUserAccountsUploadOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order user accounts uploads by. - """ - field: EnterpriseServerUserAccountsUploadOrderField! -} - -""" -Properties by which Enterprise Server user accounts upload connections can be ordered. -""" -enum EnterpriseServerUserAccountsUploadOrderField { - """ - Order user accounts uploads by creation time - """ - CREATED_AT -} - -""" -Synchronization state of the Enterprise Server user accounts upload -""" -enum EnterpriseServerUserAccountsUploadSyncState { - """ - The synchronization of the upload failed. - """ - FAILURE - - """ - The synchronization of the upload is pending. - """ - PENDING - - """ - The synchronization of the upload succeeded. - """ - SUCCESS -} - -""" -An account for a user who is an admin of an enterprise or a member of an enterprise through one or more organizations. -""" -type EnterpriseUserAccount implements Actor & Node { - """ - A URL pointing to the enterprise user account's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The enterprise in which this user account exists. - """ - enterprise: Enterprise! - id: ID! - - """ - An identifier for the enterprise user account, a login or email address - """ - login: String! - - """ - The name of the enterprise user account - """ - name: String - - """ - A list of enterprise organizations this user is a member of. - """ - organizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for organizations returned from the connection. - """ - orderBy: OrganizationOrder = {field: LOGIN, direction: ASC} - - """ - The search string to look for. - """ - query: String - - """ - The role of the user in the enterprise organization. - """ - role: EnterpriseUserAccountMembershipRole - ): EnterpriseOrganizationMembershipConnection! - - """ - The HTTP path for this user. - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this user. - """ - url: URI! - - """ - The user within the enterprise. - """ - user: User -} - -""" -The connection type for EnterpriseUserAccount. -""" -type EnterpriseUserAccountConnection { - """ - A list of edges. - """ - edges: [EnterpriseUserAccountEdge] - - """ - A list of nodes. - """ - nodes: [EnterpriseUserAccount] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type EnterpriseUserAccountEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: EnterpriseUserAccount -} - -""" -The possible roles for enterprise membership. -""" -enum EnterpriseUserAccountMembershipRole { - """ - The user is a member of the enterprise membership. - """ - MEMBER - - """ - The user is an owner of the enterprise membership. - """ - OWNER -} - -""" -The possible GitHub Enterprise deployments where this user can exist. -""" -enum EnterpriseUserDeployment { - """ - The user is part of a GitHub Enterprise Cloud deployment. - """ - CLOUD - - """ - The user is part of a GitHub Enterprise Server deployment. - """ - SERVER -} - -""" -An external identity provisioned by SAML SSO or SCIM. -""" -type ExternalIdentity implements Node { - """ - The GUID for this identity - """ - guid: String! - id: ID! - - """ - Organization invitation for this SCIM-provisioned external identity - """ - organizationInvitation: OrganizationInvitation - - """ - SAML Identity attributes - """ - samlIdentity: ExternalIdentitySamlAttributes - - """ - SCIM Identity attributes - """ - scimIdentity: ExternalIdentityScimAttributes - - """ - User linked to this external identity. Will be NULL if this identity has not been claimed by an organization member. - """ - user: User -} - -""" -The connection type for ExternalIdentity. -""" -type ExternalIdentityConnection { - """ - A list of edges. - """ - edges: [ExternalIdentityEdge] - - """ - A list of nodes. - """ - nodes: [ExternalIdentity] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ExternalIdentityEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: ExternalIdentity -} - -""" -SAML attributes for the External Identity -""" -type ExternalIdentitySamlAttributes { - """ - The NameID of the SAML identity - """ - nameId: String -} - -""" -SCIM attributes for the External Identity -""" -type ExternalIdentityScimAttributes { - """ - The userName of the SCIM identity - """ - username: String -} - -""" -Autogenerated input type of FollowUser -""" -input FollowUserInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the user to follow. - """ - userId: ID! @possibleTypes(concreteTypes: ["User"]) -} - -""" -Autogenerated return type of FollowUser -""" -type FollowUserPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The user that was followed. - """ - user: User -} - -""" -The connection type for User. -""" -type FollowerConnection { - """ - A list of edges. - """ - edges: [UserEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -The connection type for User. -""" -type FollowingConnection { - """ - A list of edges. - """ - edges: [UserEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -A funding platform link for a repository. -""" -type FundingLink { - """ - The funding platform this link is for. - """ - platform: FundingPlatform! - - """ - The configured URL for this funding link. - """ - url: URI! -} - -""" -The possible funding platforms for repository funding links. -""" -enum FundingPlatform { - """ - Community Bridge funding platform. - """ - COMMUNITY_BRIDGE - - """ - Custom funding platform. - """ - CUSTOM - - """ - GitHub funding platform. - """ - GITHUB - - """ - IssueHunt funding platform. - """ - ISSUEHUNT - - """ - Ko-fi funding platform. - """ - KO_FI - - """ - Liberapay funding platform. - """ - LIBERAPAY - - """ - Open Collective funding platform. - """ - OPEN_COLLECTIVE - - """ - Otechie funding platform. - """ - OTECHIE - - """ - Patreon funding platform. - """ - PATREON - - """ - Tidelift funding platform. - """ - TIDELIFT -} - -""" -A generic hovercard context with a message and icon -""" -type GenericHovercardContext implements HovercardContext { - """ - A string describing this context - """ - message: String! - - """ - An octicon to accompany this context - """ - octicon: String! -} - -""" -A Gist. -""" -type Gist implements Node & Starrable & UniformResourceLocatable { - """ - A list of comments associated with the gist - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): GistCommentConnection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The gist description. - """ - description: String - - """ - The files in this gist. - """ - files( - """ - The maximum number of files to return. - """ - limit: Int = 10 - - """ - The oid of the files to return - """ - oid: GitObjectID - ): [GistFile] - - """ - A list of forks associated with the gist - """ - forks( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for gists returned from the connection - """ - orderBy: GistOrder - ): GistConnection! - id: ID! - - """ - Identifies if the gist is a fork. - """ - isFork: Boolean! - - """ - Whether the gist is public or not. - """ - isPublic: Boolean! - - """ - The gist name. - """ - name: String! - - """ - The gist owner. - """ - owner: RepositoryOwner - - """ - Identifies when the gist was last pushed to. - """ - pushedAt: DateTime - - """ - The HTML path to this resource. - """ - resourcePath: URI! - - """ - A list of users who have starred this starrable. - """ - stargazers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: StarOrder - ): StargazerConnection! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this Gist. - """ - url: URI! - - """ - Returns a boolean indicating whether the viewing user has starred this starrable. - """ - viewerHasStarred: Boolean! -} - -""" -Represents a comment on an Gist. -""" -type GistComment implements Comment & Deletable & Minimizable & Node & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the gist. - """ - authorAssociation: CommentAuthorAssociation! - - """ - Identifies the comment body. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The actor who edited the comment. - """ - editor: Actor - - """ - The associated gist. - """ - gist: Gist! - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - Returns whether or not a comment has been minimized. - """ - isMinimized: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Returns why the comment was minimized. - """ - minimizedReason: String - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Check if the current viewer can minimize this object. - """ - viewerCanMinimize: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -The connection type for GistComment. -""" -type GistCommentConnection { - """ - A list of edges. - """ - edges: [GistCommentEdge] - - """ - A list of nodes. - """ - nodes: [GistComment] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type GistCommentEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: GistComment -} - -""" -The connection type for Gist. -""" -type GistConnection { - """ - A list of edges. - """ - edges: [GistEdge] - - """ - A list of nodes. - """ - nodes: [Gist] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type GistEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Gist -} - -""" -A file in a gist. -""" -type GistFile { - """ - The file name encoded to remove characters that are invalid in URL paths. - """ - encodedName: String - - """ - The gist file encoding. - """ - encoding: String - - """ - The file extension from the file name. - """ - extension: String - - """ - Indicates if this file is an image. - """ - isImage: Boolean! - - """ - Whether the file's contents were truncated. - """ - isTruncated: Boolean! - - """ - The programming language this file is written in. - """ - language: Language - - """ - The gist file name. - """ - name: String - - """ - The gist file size in bytes. - """ - size: Int - - """ - UTF8 text data or null if the file is binary - """ - text( - """ - Optionally truncate the returned file to this length. - """ - truncate: Int - ): String -} - -""" -Ordering options for gist connections -""" -input GistOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order repositories by. - """ - field: GistOrderField! -} - -""" -Properties by which gist connections can be ordered. -""" -enum GistOrderField { - """ - Order gists by creation time - """ - CREATED_AT - - """ - Order gists by push time - """ - PUSHED_AT - - """ - Order gists by update time - """ - UPDATED_AT -} - -""" -The privacy of a Gist -""" -enum GistPrivacy { - """ - Gists that are public and secret - """ - ALL - - """ - Public - """ - PUBLIC - - """ - Secret - """ - SECRET -} - -""" -Represents an actor in a Git commit (ie. an author or committer). -""" -type GitActor { - """ - A URL pointing to the author's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - The timestamp of the Git action (authoring or committing). - """ - date: GitTimestamp - - """ - The email in the Git commit. - """ - email: String - - """ - The name in the Git commit. - """ - name: String - - """ - The GitHub user corresponding to the email field. Null if no such user exists. - """ - user: User -} - -""" -Represents information about the GitHub instance. -""" -type GitHubMetadata { - """ - Returns a String that's a SHA of `github-services` - """ - gitHubServicesSha: GitObjectID! - - """ - IP addresses that users connect to for git operations - """ - gitIpAddresses: [String!] - - """ - IP addresses that service hooks are sent from - """ - hookIpAddresses: [String!] - - """ - IP addresses that the importer connects from - """ - importerIpAddresses: [String!] - - """ - Whether or not users are verified - """ - isPasswordAuthenticationVerifiable: Boolean! - - """ - IP addresses for GitHub Pages' A records - """ - pagesIpAddresses: [String!] -} - -""" -Represents a Git object. -""" -interface GitObject { - """ - An abbreviated version of the Git object ID - """ - abbreviatedOid: String! - - """ - The HTTP path for this Git object - """ - commitResourcePath: URI! - - """ - The HTTP URL for this Git object - """ - commitUrl: URI! - id: ID! - - """ - The Git object ID - """ - oid: GitObjectID! - - """ - The Repository the Git object belongs to - """ - repository: Repository! -} - -""" -A Git object ID. -""" -scalar GitObjectID - -""" -A fully qualified reference name (e.g. `refs/heads/master`). -""" -scalar GitRefname @preview(toggledBy: "update-refs-preview") - -""" -Git SSH string -""" -scalar GitSSHRemote - -""" -Information about a signature (GPG or S/MIME) on a Commit or Tag. -""" -interface GitSignature { - """ - Email used to sign this object. - """ - email: String! - - """ - True if the signature is valid and verified by GitHub. - """ - isValid: Boolean! - - """ - Payload for GPG signing object. Raw ODB object without the signature header. - """ - payload: String! - - """ - ASCII-armored signature header from object. - """ - signature: String! - - """ - GitHub user corresponding to the email signing this commit. - """ - signer: User - - """ - The state of this signature. `VALID` if signature is valid and verified by - GitHub, otherwise represents reason why signature is considered invalid. - """ - state: GitSignatureState! - - """ - True if the signature was made with GitHub's signing key. - """ - wasSignedByGitHub: Boolean! -} - -""" -The state of a Git signature. -""" -enum GitSignatureState { - """ - The signing certificate or its chain could not be verified - """ - BAD_CERT - - """ - Invalid email used for signing - """ - BAD_EMAIL - - """ - Signing key expired - """ - EXPIRED_KEY - - """ - Internal error - the GPG verification service misbehaved - """ - GPGVERIFY_ERROR - - """ - Internal error - the GPG verification service is unavailable at the moment - """ - GPGVERIFY_UNAVAILABLE - - """ - Invalid signature - """ - INVALID - - """ - Malformed signature - """ - MALFORMED_SIG - - """ - The usage flags for the key that signed this don't allow signing - """ - NOT_SIGNING_KEY - - """ - Email used for signing not known to GitHub - """ - NO_USER - - """ - Valid siganture, though certificate revocation check failed - """ - OCSP_ERROR - - """ - Valid signature, pending certificate revocation checking - """ - OCSP_PENDING - - """ - One or more certificates in chain has been revoked - """ - OCSP_REVOKED - - """ - Key used for signing not known to GitHub - """ - UNKNOWN_KEY - - """ - Unknown signature type - """ - UNKNOWN_SIG_TYPE - - """ - Unsigned - """ - UNSIGNED - - """ - Email used for signing unverified on GitHub - """ - UNVERIFIED_EMAIL - - """ - Valid signature and verified by GitHub - """ - VALID -} - -""" -An ISO-8601 encoded date string. Unlike the DateTime type, GitTimestamp is not converted in UTC. -""" -scalar GitTimestamp - -""" -Represents a GPG signature on a Commit or Tag. -""" -type GpgSignature implements GitSignature { - """ - Email used to sign this object. - """ - email: String! - - """ - True if the signature is valid and verified by GitHub. - """ - isValid: Boolean! - - """ - Hex-encoded ID of the key that signed this object. - """ - keyId: String - - """ - Payload for GPG signing object. Raw ODB object without the signature header. - """ - payload: String! - - """ - ASCII-armored signature header from object. - """ - signature: String! - - """ - GitHub user corresponding to the email signing this commit. - """ - signer: User - - """ - The state of this signature. `VALID` if signature is valid and verified by - GitHub, otherwise represents reason why signature is considered invalid. - """ - state: GitSignatureState! - - """ - True if the signature was made with GitHub's signing key. - """ - wasSignedByGitHub: Boolean! -} - -""" -A string containing HTML code. -""" -scalar HTML - -""" -Represents a 'head_ref_deleted' event on a given pull request. -""" -type HeadRefDeletedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the Ref associated with the `head_ref_deleted` event. - """ - headRef: Ref - - """ - Identifies the name of the Ref associated with the `head_ref_deleted` event. - """ - headRefName: String! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! -} - -""" -Represents a 'head_ref_force_pushed' event on a given pull request. -""" -type HeadRefForcePushedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the after commit SHA for the 'head_ref_force_pushed' event. - """ - afterCommit: Commit - - """ - Identifies the before commit SHA for the 'head_ref_force_pushed' event. - """ - beforeCommit: Commit - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - Identifies the fully qualified ref name for the 'head_ref_force_pushed' event. - """ - ref: Ref -} - -""" -Represents a 'head_ref_restored' event on a given pull request. -""" -type HeadRefRestoredEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! -} - -""" -Detail needed to display a hovercard for a user -""" -type Hovercard { - """ - Each of the contexts for this hovercard - """ - contexts: [HovercardContext!]! -} - -""" -An individual line of a hovercard -""" -interface HovercardContext { - """ - A string describing this context - """ - message: String! - - """ - An octicon to accompany this context - """ - octicon: String! -} - -""" -The possible states in which authentication can be configured with an identity provider. -""" -enum IdentityProviderConfigurationState { - """ - Authentication with an identity provider is configured but not enforced. - """ - CONFIGURED - - """ - Authentication with an identity provider is configured and enforced. - """ - ENFORCED - - """ - Authentication with an identity provider is not configured. - """ - UNCONFIGURED -} - -""" -Autogenerated input type of ImportProject -""" -input ImportProjectInput { - """ - The description of Project. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A list of columns containing issues and pull requests. - """ - columnImports: [ProjectColumnImport!]! - - """ - The name of Project. - """ - name: String! - - """ - The name of the Organization or User to create the Project under. - """ - ownerName: String! - - """ - Whether the Project is public or not. - """ - public: Boolean = false -} - -""" -Autogenerated return type of ImportProject -""" -type ImportProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new Project! - """ - project: Project -} - -""" -Autogenerated input type of InviteEnterpriseAdmin -""" -input InviteEnterpriseAdminInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The email of the person to invite as an administrator. - """ - email: String - - """ - The ID of the enterprise to which you want to invite an administrator. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The login of a user to invite as an administrator. - """ - invitee: String - - """ - The role of the administrator. - """ - role: EnterpriseAdministratorRole -} - -""" -Autogenerated return type of InviteEnterpriseAdmin -""" -type InviteEnterpriseAdminPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The created enterprise administrator invitation. - """ - invitation: EnterpriseAdministratorInvitation -} - -""" -The possible values for the IP allow list enabled setting. -""" -enum IpAllowListEnabledSettingValue { - """ - The setting is disabled for the owner. - """ - DISABLED - - """ - The setting is enabled for the owner. - """ - ENABLED -} - -""" -An IP address or range of addresses that is allowed to access an owner's resources. -""" -type IpAllowListEntry implements Node { - """ - A single IP address or range of IP addresses in CIDR notation. - """ - allowListValue: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Whether the entry is currently active. - """ - isActive: Boolean! - - """ - The name of the IP allow list entry. - """ - name: String - - """ - The owner of the IP allow list entry. - """ - owner: IpAllowListOwner! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -The connection type for IpAllowListEntry. -""" -type IpAllowListEntryConnection { - """ - A list of edges. - """ - edges: [IpAllowListEntryEdge] - - """ - A list of nodes. - """ - nodes: [IpAllowListEntry] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type IpAllowListEntryEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: IpAllowListEntry -} - -""" -Ordering options for IP allow list entry connections. -""" -input IpAllowListEntryOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order IP allow list entries by. - """ - field: IpAllowListEntryOrderField! -} - -""" -Properties by which IP allow list entry connections can be ordered. -""" -enum IpAllowListEntryOrderField { - """ - Order IP allow list entries by the allow list value. - """ - ALLOW_LIST_VALUE - - """ - Order IP allow list entries by creation time. - """ - CREATED_AT -} - -""" -Types that can own an IP allow list. -""" -union IpAllowListOwner = Enterprise | Organization - -""" -An Issue is a place to discuss ideas, enhancements, tasks, and bugs for a project. -""" -type Issue implements Assignable & Closable & Comment & Labelable & Lockable & Node & Reactable & RepositoryNode & Subscribable & UniformResourceLocatable & Updatable & UpdatableComment { - """ - Reason that the conversation was locked. - """ - activeLockReason: LockReason - - """ - A list of Users assigned to this object. - """ - assignees( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! - - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - Identifies the body of the issue. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - Identifies the body of the issue rendered to text. - """ - bodyText: String! - - """ - `true` if the object is closed (definition of closed may depend on type) - """ - closed: Boolean! - - """ - Identifies the date and time when the object was closed. - """ - closedAt: DateTime - - """ - A list of comments associated with the Issue. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): IssueCommentConnection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The actor who edited the comment. - """ - editor: Actor - - """ - The hovercard information for this issue - """ - hovercard( - """ - Whether or not to include notification contexts - """ - includeNotificationContexts: Boolean = true - ): Hovercard! - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - A list of labels associated with the object. - """ - labels( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for labels returned from the connection. - """ - orderBy: LabelOrder = {field: CREATED_AT, direction: ASC} - ): LabelConnection - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - `true` if the object is locked - """ - locked: Boolean! - - """ - Identifies the milestone associated with the issue. - """ - milestone: Milestone - - """ - Identifies the issue number. - """ - number: Int! - - """ - A list of Users that are participating in the Issue conversation. - """ - participants( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! - - """ - List of project cards associated with this issue. - """ - projectCards( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - A list of archived states to filter the cards by - """ - archivedStates: [ProjectCardArchivedState] = [ARCHIVED, NOT_ARCHIVED] - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ProjectCardConnection! - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The repository associated with this node. - """ - repository: Repository! - - """ - The HTTP path for this issue - """ - resourcePath: URI! - - """ - Identifies the state of the issue. - """ - state: IssueState! - - """ - A list of events, comments, commits, etc. associated with the issue. - """ - timeline( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows filtering timeline events by a `since` timestamp. - """ - since: DateTime - ): IssueTimelineConnection! @deprecated(reason: "`timeline` will be removed Use Issue.timelineItems instead. Removal on 2020-10-01 UTC.") - - """ - A list of events, comments, commits, etc. associated with the issue. - """ - timelineItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Filter timeline items by type. - """ - itemTypes: [IssueTimelineItemsItemType!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter timeline items by a `since` timestamp. - """ - since: DateTime - - """ - Skips the first _n_ elements in the list. - """ - skip: Int - ): IssueTimelineItemsConnection! - - """ - Identifies the issue title. - """ - title: String! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this issue - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState -} - -""" -Represents a comment on an Issue. -""" -type IssueComment implements Comment & Deletable & Minimizable & Node & Reactable & RepositoryNode & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - The body as Markdown. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - Returns whether or not a comment has been minimized. - """ - isMinimized: Boolean! - - """ - Identifies the issue associated with the comment. - """ - issue: Issue! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Returns why the comment was minimized. - """ - minimizedReason: String - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - Returns the pull request associated with the comment, if this comment was made on a - pull request. - """ - pullRequest: PullRequest - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The repository associated with this node. - """ - repository: Repository! - - """ - The HTTP path for this issue comment - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this issue comment - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Check if the current viewer can minimize this object. - """ - viewerCanMinimize: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -The connection type for IssueComment. -""" -type IssueCommentConnection { - """ - A list of edges. - """ - edges: [IssueCommentEdge] - - """ - A list of nodes. - """ - nodes: [IssueComment] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type IssueCommentEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: IssueComment -} - -""" -The connection type for Issue. -""" -type IssueConnection { - """ - A list of edges. - """ - edges: [IssueEdge] - - """ - A list of nodes. - """ - nodes: [Issue] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -This aggregates issues opened by a user within one repository. -""" -type IssueContributionsByRepository { - """ - The issue contributions. - """ - contributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedIssueContributionConnection! - - """ - The repository in which the issues were opened. - """ - repository: Repository! -} - -""" -An edge in a connection. -""" -type IssueEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Issue -} - -""" -Ways in which to filter lists of issues. -""" -input IssueFilters { - """ - List issues assigned to given name. Pass in `null` for issues with no assigned - user, and `*` for issues assigned to any user. - """ - assignee: String - - """ - List issues created by given name. - """ - createdBy: String - - """ - List issues where the list of label names exist on the issue. - """ - labels: [String!] - - """ - List issues where the given name is mentioned in the issue. - """ - mentioned: String - - """ - List issues by given milestone argument. If an string representation of an - integer is passed, it should refer to a milestone by its number field. Pass in - `null` for issues with no milestone, and `*` for issues that are assigned to any milestone. - """ - milestone: String - - """ - List issues that have been updated at or after the given date. - """ - since: DateTime - - """ - List issues filtered by the list of states given. - """ - states: [IssueState!] - - """ - List issues subscribed to by viewer. - """ - viewerSubscribed: Boolean = false -} - -""" -Used for return value of Repository.issueOrPullRequest. -""" -union IssueOrPullRequest = Issue | PullRequest - -""" -Ways in which lists of issues can be ordered upon return. -""" -input IssueOrder { - """ - The direction in which to order issues by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order issues by. - """ - field: IssueOrderField! -} - -""" -Properties by which issue connections can be ordered. -""" -enum IssueOrderField { - """ - Order issues by comment count - """ - COMMENTS - - """ - Order issues by creation time - """ - CREATED_AT - - """ - Order issues by update time - """ - UPDATED_AT -} - -""" -The possible states of an issue. -""" -enum IssueState { - """ - An issue that has been closed - """ - CLOSED - - """ - An issue that is still open - """ - OPEN -} - -""" -The connection type for IssueTimelineItem. -""" -type IssueTimelineConnection { - """ - A list of edges. - """ - edges: [IssueTimelineItemEdge] - - """ - A list of nodes. - """ - nodes: [IssueTimelineItem] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An item in an issue timeline -""" -union IssueTimelineItem = AssignedEvent | ClosedEvent | Commit | CrossReferencedEvent | DemilestonedEvent | IssueComment | LabeledEvent | LockedEvent | MilestonedEvent | ReferencedEvent | RenamedTitleEvent | ReopenedEvent | SubscribedEvent | TransferredEvent | UnassignedEvent | UnlabeledEvent | UnlockedEvent | UnsubscribedEvent | UserBlockedEvent - -""" -An edge in a connection. -""" -type IssueTimelineItemEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: IssueTimelineItem -} - -""" -An item in an issue timeline -""" -union IssueTimelineItems = AddedToProjectEvent | AssignedEvent | ClosedEvent | CommentDeletedEvent | ConnectedEvent | ConvertedNoteToIssueEvent | CrossReferencedEvent | DemilestonedEvent | DisconnectedEvent | IssueComment | LabeledEvent | LockedEvent | MarkedAsDuplicateEvent | MentionedEvent | MilestonedEvent | MovedColumnsInProjectEvent | PinnedEvent | ReferencedEvent | RemovedFromProjectEvent | RenamedTitleEvent | ReopenedEvent | SubscribedEvent | TransferredEvent | UnassignedEvent | UnlabeledEvent | UnlockedEvent | UnmarkedAsDuplicateEvent | UnpinnedEvent | UnsubscribedEvent | UserBlockedEvent - -""" -The connection type for IssueTimelineItems. -""" -type IssueTimelineItemsConnection { - """ - A list of edges. - """ - edges: [IssueTimelineItemsEdge] - - """ - Identifies the count of items after applying `before` and `after` filters. - """ - filteredCount: Int! - - """ - A list of nodes. - """ - nodes: [IssueTimelineItems] - - """ - Identifies the count of items after applying `before`/`after` filters and `first`/`last`/`skip` slicing. - """ - pageCount: Int! - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! - - """ - Identifies the date and time when the timeline was last updated. - """ - updatedAt: DateTime! -} - -""" -An edge in a connection. -""" -type IssueTimelineItemsEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: IssueTimelineItems -} - -""" -The possible item types found in a timeline. -""" -enum IssueTimelineItemsItemType { - """ - Represents a 'added_to_project' event on a given issue or pull request. - """ - ADDED_TO_PROJECT_EVENT - - """ - Represents an 'assigned' event on any assignable object. - """ - ASSIGNED_EVENT - - """ - Represents a 'closed' event on any `Closable`. - """ - CLOSED_EVENT - - """ - Represents a 'comment_deleted' event on a given issue or pull request. - """ - COMMENT_DELETED_EVENT - - """ - Represents a 'connected' event on a given issue or pull request. - """ - CONNECTED_EVENT - - """ - Represents a 'converted_note_to_issue' event on a given issue or pull request. - """ - CONVERTED_NOTE_TO_ISSUE_EVENT - - """ - Represents a mention made by one issue or pull request to another. - """ - CROSS_REFERENCED_EVENT - - """ - Represents a 'demilestoned' event on a given issue or pull request. - """ - DEMILESTONED_EVENT - - """ - Represents a 'disconnected' event on a given issue or pull request. - """ - DISCONNECTED_EVENT - - """ - Represents a comment on an Issue. - """ - ISSUE_COMMENT - - """ - Represents a 'labeled' event on a given issue or pull request. - """ - LABELED_EVENT - - """ - Represents a 'locked' event on a given issue or pull request. - """ - LOCKED_EVENT - - """ - Represents a 'marked_as_duplicate' event on a given issue or pull request. - """ - MARKED_AS_DUPLICATE_EVENT - - """ - Represents a 'mentioned' event on a given issue or pull request. - """ - MENTIONED_EVENT - - """ - Represents a 'milestoned' event on a given issue or pull request. - """ - MILESTONED_EVENT - - """ - Represents a 'moved_columns_in_project' event on a given issue or pull request. - """ - MOVED_COLUMNS_IN_PROJECT_EVENT - - """ - Represents a 'pinned' event on a given issue or pull request. - """ - PINNED_EVENT - - """ - Represents a 'referenced' event on a given `ReferencedSubject`. - """ - REFERENCED_EVENT - - """ - Represents a 'removed_from_project' event on a given issue or pull request. - """ - REMOVED_FROM_PROJECT_EVENT - - """ - Represents a 'renamed' event on a given issue or pull request - """ - RENAMED_TITLE_EVENT - - """ - Represents a 'reopened' event on any `Closable`. - """ - REOPENED_EVENT - - """ - Represents a 'subscribed' event on a given `Subscribable`. - """ - SUBSCRIBED_EVENT - - """ - Represents a 'transferred' event on a given issue or pull request. - """ - TRANSFERRED_EVENT - - """ - Represents an 'unassigned' event on any assignable object. - """ - UNASSIGNED_EVENT - - """ - Represents an 'unlabeled' event on a given issue or pull request. - """ - UNLABELED_EVENT - - """ - Represents an 'unlocked' event on a given issue or pull request. - """ - UNLOCKED_EVENT - - """ - Represents an 'unmarked_as_duplicate' event on a given issue or pull request. - """ - UNMARKED_AS_DUPLICATE_EVENT - - """ - Represents an 'unpinned' event on a given issue or pull request. - """ - UNPINNED_EVENT - - """ - Represents an 'unsubscribed' event on a given `Subscribable`. - """ - UNSUBSCRIBED_EVENT - - """ - Represents a 'user_blocked' event on a given user. - """ - USER_BLOCKED_EVENT -} - -""" -Represents a user signing up for a GitHub account. -""" -type JoinedGitHubContribution implements Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -A label for categorizing Issues or Milestones with a given Repository. -""" -type Label implements Node { - """ - Identifies the label color. - """ - color: String! - - """ - Identifies the date and time when the label was created. - """ - createdAt: DateTime - - """ - A brief description of this label. - """ - description: String - id: ID! - - """ - Indicates whether or not this is a default label. - """ - isDefault: Boolean! - - """ - A list of issues associated with this label. - """ - issues( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Filtering options for issues returned from the connection. - """ - filterBy: IssueFilters - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for issues returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the issues by. - """ - states: [IssueState!] - ): IssueConnection! - - """ - Identifies the label name. - """ - name: String! - - """ - A list of pull requests associated with this label. - """ - pullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - The base ref name to filter the pull requests by. - """ - baseRefName: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - The head ref name to filter the pull requests by. - """ - headRefName: String - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the pull requests by. - """ - states: [PullRequestState!] - ): PullRequestConnection! - - """ - The repository associated with this label. - """ - repository: Repository! - - """ - The HTTP path for this label. - """ - resourcePath: URI! - - """ - Identifies the date and time when the label was last updated. - """ - updatedAt: DateTime - - """ - The HTTP URL for this label. - """ - url: URI! -} - -""" -The connection type for Label. -""" -type LabelConnection { - """ - A list of edges. - """ - edges: [LabelEdge] - - """ - A list of nodes. - """ - nodes: [Label] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type LabelEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Label -} - -""" -Ways in which lists of labels can be ordered upon return. -""" -input LabelOrder { - """ - The direction in which to order labels by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order labels by. - """ - field: LabelOrderField! -} - -""" -Properties by which label connections can be ordered. -""" -enum LabelOrderField { - """ - Order labels by creation time - """ - CREATED_AT - - """ - Order labels by name - """ - NAME -} - -""" -An object that can have labels assigned to it. -""" -interface Labelable { - """ - A list of labels associated with the object. - """ - labels( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for labels returned from the connection. - """ - orderBy: LabelOrder = {field: CREATED_AT, direction: ASC} - ): LabelConnection -} - -""" -Represents a 'labeled' event on a given issue or pull request. -""" -type LabeledEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the label associated with the 'labeled' event. - """ - label: Label! - - """ - Identifies the `Labelable` associated with the event. - """ - labelable: Labelable! -} - -""" -Represents a given language found in repositories. -""" -type Language implements Node { - """ - The color defined for the current language. - """ - color: String - id: ID! - - """ - The name of the current language. - """ - name: String! -} - -""" -A list of languages associated with the parent. -""" -type LanguageConnection { - """ - A list of edges. - """ - edges: [LanguageEdge] - - """ - A list of nodes. - """ - nodes: [Language] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! - - """ - The total size in bytes of files written in that language. - """ - totalSize: Int! -} - -""" -Represents the language of a repository. -""" -type LanguageEdge { - cursor: String! - node: Language! - - """ - The number of bytes of code written in the language. - """ - size: Int! -} - -""" -Ordering options for language connections. -""" -input LanguageOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order languages by. - """ - field: LanguageOrderField! -} - -""" -Properties by which language connections can be ordered. -""" -enum LanguageOrderField { - """ - Order languages by the size of all files containing the language - """ - SIZE -} - -""" -A repository's open source license -""" -type License implements Node { - """ - The full text of the license - """ - body: String! - - """ - The conditions set by the license - """ - conditions: [LicenseRule]! - - """ - A human-readable description of the license - """ - description: String - - """ - Whether the license should be featured - """ - featured: Boolean! - - """ - Whether the license should be displayed in license pickers - """ - hidden: Boolean! - id: ID! - - """ - Instructions on how to implement the license - """ - implementation: String - - """ - The lowercased SPDX ID of the license - """ - key: String! - - """ - The limitations set by the license - """ - limitations: [LicenseRule]! - - """ - The license full name specified by - """ - name: String! - - """ - Customary short name if applicable (e.g, GPLv3) - """ - nickname: String - - """ - The permissions set by the license - """ - permissions: [LicenseRule]! - - """ - Whether the license is a pseudo-license placeholder (e.g., other, no-license) - """ - pseudoLicense: Boolean! - - """ - Short identifier specified by - """ - spdxId: String - - """ - URL to the license on - """ - url: URI -} - -""" -Describes a License's conditions, permissions, and limitations -""" -type LicenseRule { - """ - A description of the rule - """ - description: String! - - """ - The machine-readable rule key - """ - key: String! - - """ - The human-readable rule label - """ - label: String! -} - -""" -Autogenerated input type of LinkRepositoryToProject -""" -input LinkRepositoryToProjectInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the Project to link to a Repository - """ - projectId: ID! @possibleTypes(concreteTypes: ["Project"]) - - """ - The ID of the Repository to link to a Project. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of LinkRepositoryToProject -""" -type LinkRepositoryToProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The linked Project. - """ - project: Project - - """ - The linked Repository. - """ - repository: Repository -} - -""" -Autogenerated input type of LockLockable -""" -input LockLockableInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A reason for why the issue or pull request will be locked. - """ - lockReason: LockReason - - """ - ID of the issue or pull request to be locked. - """ - lockableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Lockable") -} - -""" -Autogenerated return type of LockLockable -""" -type LockLockablePayload { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The item that was locked. - """ - lockedRecord: Lockable -} - -""" -The possible reasons that an issue or pull request was locked. -""" -enum LockReason { - """ - The issue or pull request was locked because the conversation was off-topic. - """ - OFF_TOPIC - - """ - The issue or pull request was locked because the conversation was resolved. - """ - RESOLVED - - """ - The issue or pull request was locked because the conversation was spam. - """ - SPAM - - """ - The issue or pull request was locked because the conversation was too heated. - """ - TOO_HEATED -} - -""" -An object that can be locked. -""" -interface Lockable { - """ - Reason that the conversation was locked. - """ - activeLockReason: LockReason - - """ - `true` if the object is locked - """ - locked: Boolean! -} - -""" -Represents a 'locked' event on a given issue or pull request. -""" -type LockedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Reason that the conversation was locked (optional). - """ - lockReason: LockReason - - """ - Object that was locked. - """ - lockable: Lockable! -} - -""" -A placeholder user for attribution of imported data on GitHub. -""" -type Mannequin implements Actor & Node & UniformResourceLocatable { - """ - A URL pointing to the GitHub App's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The mannequin's email on the source instance. - """ - email: String - id: ID! - - """ - The username of the actor. - """ - login: String! - - """ - The HTML path to this resource. - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The URL to this resource. - """ - url: URI! -} - -""" -Autogenerated input type of MarkPullRequestReadyForReview -""" -input MarkPullRequestReadyForReviewInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the pull request to be marked as ready for review. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) -} - -""" -Autogenerated return type of MarkPullRequestReadyForReview -""" -type MarkPullRequestReadyForReviewPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The pull request that is ready for review. - """ - pullRequest: PullRequest -} - -""" -Represents a 'marked_as_duplicate' event on a given issue or pull request. -""" -type MarkedAsDuplicateEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! -} - -""" -A public description of a Marketplace category. -""" -type MarketplaceCategory implements Node { - """ - The category's description. - """ - description: String - - """ - The technical description of how apps listed in this category work with GitHub. - """ - howItWorks: String - id: ID! - - """ - The category's name. - """ - name: String! - - """ - How many Marketplace listings have this as their primary category. - """ - primaryListingCount: Int! - - """ - The HTTP path for this Marketplace category. - """ - resourcePath: URI! - - """ - How many Marketplace listings have this as their secondary category. - """ - secondaryListingCount: Int! - - """ - The short name of the category used in its URL. - """ - slug: String! - - """ - The HTTP URL for this Marketplace category. - """ - url: URI! -} - -""" -A listing in the GitHub integration marketplace. -""" -type MarketplaceListing implements Node { - """ - The GitHub App this listing represents. - """ - app: App - - """ - URL to the listing owner's company site. - """ - companyUrl: URI - - """ - The HTTP path for configuring access to the listing's integration or OAuth app - """ - configurationResourcePath: URI! - - """ - The HTTP URL for configuring access to the listing's integration or OAuth app - """ - configurationUrl: URI! - - """ - URL to the listing's documentation. - """ - documentationUrl: URI - - """ - The listing's detailed description. - """ - extendedDescription: String - - """ - The listing's detailed description rendered to HTML. - """ - extendedDescriptionHTML: HTML! - - """ - The listing's introductory description. - """ - fullDescription: String! - - """ - The listing's introductory description rendered to HTML. - """ - fullDescriptionHTML: HTML! - - """ - Does this listing have any plans with a free trial? - """ - hasPublishedFreeTrialPlans: Boolean! - - """ - Does this listing have a terms of service link? - """ - hasTermsOfService: Boolean! - - """ - A technical description of how this app works with GitHub. - """ - howItWorks: String - - """ - The listing's technical description rendered to HTML. - """ - howItWorksHTML: HTML! - id: ID! - - """ - URL to install the product to the viewer's account or organization. - """ - installationUrl: URI - - """ - Whether this listing's app has been installed for the current viewer - """ - installedForViewer: Boolean! - - """ - Whether this listing has been removed from the Marketplace. - """ - isArchived: Boolean! - - """ - Whether this listing is still an editable draft that has not been submitted - for review and is not publicly visible in the Marketplace. - """ - isDraft: Boolean! - - """ - Whether the product this listing represents is available as part of a paid plan. - """ - isPaid: Boolean! - - """ - Whether this listing has been approved for display in the Marketplace. - """ - isPublic: Boolean! - - """ - Whether this listing has been rejected by GitHub for display in the Marketplace. - """ - isRejected: Boolean! - - """ - Whether this listing has been approved for unverified display in the Marketplace. - """ - isUnverified: Boolean! - - """ - Whether this draft listing has been submitted for review for approval to be unverified in the Marketplace. - """ - isUnverifiedPending: Boolean! - - """ - Whether this draft listing has been submitted for review from GitHub for approval to be verified in the Marketplace. - """ - isVerificationPendingFromDraft: Boolean! - - """ - Whether this unverified listing has been submitted for review from GitHub for approval to be verified in the Marketplace. - """ - isVerificationPendingFromUnverified: Boolean! - - """ - Whether this listing has been approved for verified display in the Marketplace. - """ - isVerified: Boolean! - - """ - The hex color code, without the leading '#', for the logo background. - """ - logoBackgroundColor: String! - - """ - URL for the listing's logo image. - """ - logoUrl( - """ - The size in pixels of the resulting square image. - """ - size: Int = 400 - ): URI - - """ - The listing's full name. - """ - name: String! - - """ - The listing's very short description without a trailing period or ampersands. - """ - normalizedShortDescription: String! - - """ - URL to the listing's detailed pricing. - """ - pricingUrl: URI - - """ - The category that best describes the listing. - """ - primaryCategory: MarketplaceCategory! - - """ - URL to the listing's privacy policy, may return an empty string for listings that do not require a privacy policy URL. - """ - privacyPolicyUrl: URI! - - """ - The HTTP path for the Marketplace listing. - """ - resourcePath: URI! - - """ - The URLs for the listing's screenshots. - """ - screenshotUrls: [String]! - - """ - An alternate category that describes the listing. - """ - secondaryCategory: MarketplaceCategory - - """ - The listing's very short description. - """ - shortDescription: String! - - """ - The short name of the listing used in its URL. - """ - slug: String! - - """ - URL to the listing's status page. - """ - statusUrl: URI - - """ - An email address for support for this listing's app. - """ - supportEmail: String - - """ - Either a URL or an email address for support for this listing's app, may - return an empty string for listings that do not require a support URL. - """ - supportUrl: URI! - - """ - URL to the listing's terms of service. - """ - termsOfServiceUrl: URI - - """ - The HTTP URL for the Marketplace listing. - """ - url: URI! - - """ - Can the current viewer add plans for this Marketplace listing. - """ - viewerCanAddPlans: Boolean! - - """ - Can the current viewer approve this Marketplace listing. - """ - viewerCanApprove: Boolean! - - """ - Can the current viewer delist this Marketplace listing. - """ - viewerCanDelist: Boolean! - - """ - Can the current viewer edit this Marketplace listing. - """ - viewerCanEdit: Boolean! - - """ - Can the current viewer edit the primary and secondary category of this - Marketplace listing. - """ - viewerCanEditCategories: Boolean! - - """ - Can the current viewer edit the plans for this Marketplace listing. - """ - viewerCanEditPlans: Boolean! - - """ - Can the current viewer return this Marketplace listing to draft state - so it becomes editable again. - """ - viewerCanRedraft: Boolean! - - """ - Can the current viewer reject this Marketplace listing by returning it to - an editable draft state or rejecting it entirely. - """ - viewerCanReject: Boolean! - - """ - Can the current viewer request this listing be reviewed for display in - the Marketplace as verified. - """ - viewerCanRequestApproval: Boolean! - - """ - Indicates whether the current user has an active subscription to this Marketplace listing. - """ - viewerHasPurchased: Boolean! - - """ - Indicates if the current user has purchased a subscription to this Marketplace listing - for all of the organizations the user owns. - """ - viewerHasPurchasedForAllOrganizations: Boolean! - - """ - Does the current viewer role allow them to administer this Marketplace listing. - """ - viewerIsListingAdmin: Boolean! -} - -""" -Look up Marketplace Listings -""" -type MarketplaceListingConnection { - """ - A list of edges. - """ - edges: [MarketplaceListingEdge] - - """ - A list of nodes. - """ - nodes: [MarketplaceListing] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type MarketplaceListingEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: MarketplaceListing -} - -""" -Entities that have members who can set status messages. -""" -interface MemberStatusable { - """ - Get the status messages members of this entity have set that are either public or visible only to the organization. - """ - memberStatuses( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for user statuses returned from the connection. - """ - orderBy: UserStatusOrder = {field: UPDATED_AT, direction: DESC} - ): UserStatusConnection! -} - -""" -Audit log entry for a members_can_delete_repos.clear event. -""" -type MembersCanDeleteReposClearAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a members_can_delete_repos.disable event. -""" -type MembersCanDeleteReposDisableAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a members_can_delete_repos.enable event. -""" -type MembersCanDeleteReposEnableAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Represents a 'mentioned' event on a given issue or pull request. -""" -type MentionedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! -} - -""" -Autogenerated input type of MergeBranch -""" -input MergeBranchInput { - """ - The name of the base branch that the provided head will be merged into. - """ - base: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Message to use for the merge commit. If omitted, a default will be used. - """ - commitMessage: String - - """ - The head to merge into the base branch. This can be a branch name or a commit GitObjectID. - """ - head: String! - - """ - The Node ID of the Repository containing the base branch that will be modified. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of MergeBranch -""" -type MergeBranchPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The resulting merge Commit. - """ - mergeCommit: Commit -} - -""" -Autogenerated input type of MergePullRequest -""" -input MergePullRequestInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Commit body to use for the merge commit; if omitted, a default message will be used - """ - commitBody: String - - """ - Commit headline to use for the merge commit; if omitted, a default message will be used. - """ - commitHeadline: String - - """ - OID that the pull request head ref must match to allow merge; if omitted, no check is performed. - """ - expectedHeadOid: GitObjectID - - """ - The merge method to use. If omitted, defaults to 'MERGE' - """ - mergeMethod: PullRequestMergeMethod = MERGE - - """ - ID of the pull request to be merged. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) -} - -""" -Autogenerated return type of MergePullRequest -""" -type MergePullRequestPayload { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The pull request that was merged. - """ - pullRequest: PullRequest -} - -""" -Detailed status information about a pull request merge. -""" -enum MergeStateStatus { - """ - The head ref is out of date. - """ - BEHIND - - """ - The merge is blocked. - """ - BLOCKED - - """ - Mergeable and passing commit status. - """ - CLEAN - - """ - The merge commit cannot be cleanly created. - """ - DIRTY - - """ - The merge is blocked due to the pull request being a draft. - """ - DRAFT - - """ - Mergeable with passing commit status and pre-receive hooks. - """ - HAS_HOOKS - - """ - The state cannot currently be determined. - """ - UNKNOWN - - """ - Mergeable with non-passing commit status. - """ - UNSTABLE -} - -""" -Whether or not a PullRequest can be merged. -""" -enum MergeableState { - """ - The pull request cannot be merged due to merge conflicts. - """ - CONFLICTING - - """ - The pull request can be merged. - """ - MERGEABLE - - """ - The mergeability of the pull request is still being calculated. - """ - UNKNOWN -} - -""" -Represents a 'merged' event on a given pull request. -""" -type MergedEvent implements Node & UniformResourceLocatable { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the commit associated with the `merge` event. - """ - commit: Commit - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the Ref associated with the `merge` event. - """ - mergeRef: Ref - - """ - Identifies the name of the Ref associated with the `merge` event. - """ - mergeRefName: String! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - The HTTP path for this merged event. - """ - resourcePath: URI! - - """ - The HTTP URL for this merged event. - """ - url: URI! -} - -""" -Represents a Milestone object on a given repository. -""" -type Milestone implements Closable & Node & UniformResourceLocatable { - """ - `true` if the object is closed (definition of closed may depend on type) - """ - closed: Boolean! - - """ - Identifies the date and time when the object was closed. - """ - closedAt: DateTime - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the actor who created the milestone. - """ - creator: Actor - - """ - Identifies the description of the milestone. - """ - description: String - - """ - Identifies the due date of the milestone. - """ - dueOn: DateTime - id: ID! - - """ - Just for debugging on review-lab - """ - issuePrioritiesDebug: String! - - """ - A list of issues associated with the milestone. - """ - issues( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Filtering options for issues returned from the connection. - """ - filterBy: IssueFilters - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for issues returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the issues by. - """ - states: [IssueState!] - ): IssueConnection! - - """ - Identifies the number of the milestone. - """ - number: Int! - - """ - A list of pull requests associated with the milestone. - """ - pullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - The base ref name to filter the pull requests by. - """ - baseRefName: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - The head ref name to filter the pull requests by. - """ - headRefName: String - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the pull requests by. - """ - states: [PullRequestState!] - ): PullRequestConnection! - - """ - The repository associated with this milestone. - """ - repository: Repository! - - """ - The HTTP path for this milestone - """ - resourcePath: URI! - - """ - Identifies the state of the milestone. - """ - state: MilestoneState! - - """ - Identifies the title of the milestone. - """ - title: String! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this milestone - """ - url: URI! -} - -""" -The connection type for Milestone. -""" -type MilestoneConnection { - """ - A list of edges. - """ - edges: [MilestoneEdge] - - """ - A list of nodes. - """ - nodes: [Milestone] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type MilestoneEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Milestone -} - -""" -Types that can be inside a Milestone. -""" -union MilestoneItem = Issue | PullRequest - -""" -Ordering options for milestone connections. -""" -input MilestoneOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order milestones by. - """ - field: MilestoneOrderField! -} - -""" -Properties by which milestone connections can be ordered. -""" -enum MilestoneOrderField { - """ - Order milestones by when they were created. - """ - CREATED_AT - - """ - Order milestones by when they are due. - """ - DUE_DATE - - """ - Order milestones by their number. - """ - NUMBER - - """ - Order milestones by when they were last updated. - """ - UPDATED_AT -} - -""" -The possible states of a milestone. -""" -enum MilestoneState { - """ - A milestone that has been closed. - """ - CLOSED - - """ - A milestone that is still open. - """ - OPEN -} - -""" -Represents a 'milestoned' event on a given issue or pull request. -""" -type MilestonedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the milestone title associated with the 'milestoned' event. - """ - milestoneTitle: String! - - """ - Object referenced by event. - """ - subject: MilestoneItem! -} - -""" -Entities that can be minimized. -""" -interface Minimizable { - """ - Returns whether or not a comment has been minimized. - """ - isMinimized: Boolean! - - """ - Returns why the comment was minimized. - """ - minimizedReason: String - - """ - Check if the current viewer can minimize this object. - """ - viewerCanMinimize: Boolean! -} - -""" -Autogenerated input type of MinimizeComment -""" -input MinimizeCommentInput { - """ - The classification of comment - """ - classifier: ReportedContentClassifiers! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the subject to modify. - """ - subjectId: ID! @possibleTypes(concreteTypes: ["CommitComment", "GistComment", "IssueComment", "PullRequestReviewComment"], abstractType: "Minimizable") -} - -""" -Autogenerated return type of MinimizeComment -""" -type MinimizeCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The comment that was minimized. - """ - minimizedComment: Minimizable -} - -""" -Autogenerated input type of MoveProjectCard -""" -input MoveProjectCardInput { - """ - Place the new card after the card with this id. Pass null to place it at the top. - """ - afterCardId: ID @possibleTypes(concreteTypes: ["ProjectCard"]) - - """ - The id of the card to move. - """ - cardId: ID! @possibleTypes(concreteTypes: ["ProjectCard"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The id of the column to move it into. - """ - columnId: ID! @possibleTypes(concreteTypes: ["ProjectColumn"]) -} - -""" -Autogenerated return type of MoveProjectCard -""" -type MoveProjectCardPayload { - """ - The new edge of the moved card. - """ - cardEdge: ProjectCardEdge - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of MoveProjectColumn -""" -input MoveProjectColumnInput { - """ - Place the new column after the column with this id. Pass null to place it at the front. - """ - afterColumnId: ID @possibleTypes(concreteTypes: ["ProjectColumn"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The id of the column to move. - """ - columnId: ID! @possibleTypes(concreteTypes: ["ProjectColumn"]) -} - -""" -Autogenerated return type of MoveProjectColumn -""" -type MoveProjectColumnPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new edge of the moved column. - """ - columnEdge: ProjectColumnEdge -} - -""" -Represents a 'moved_columns_in_project' event on a given issue or pull request. -""" -type MovedColumnsInProjectEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - Column name the issue or pull request was moved from. - """ - previousProjectColumnName: String! @preview(toggledBy: "starfox-preview") - - """ - Project referenced by event. - """ - project: Project @preview(toggledBy: "starfox-preview") - - """ - Project card referenced by this project event. - """ - projectCard: ProjectCard @preview(toggledBy: "starfox-preview") - - """ - Column name the issue or pull request was moved to. - """ - projectColumnName: String! @preview(toggledBy: "starfox-preview") -} - -""" -The root query for implementing GraphQL mutations. -""" -type Mutation { - """ - Accepts a pending invitation for a user to become an administrator of an enterprise. - """ - acceptEnterpriseAdministratorInvitation(input: AcceptEnterpriseAdministratorInvitationInput!): AcceptEnterpriseAdministratorInvitationPayload - - """ - Applies a suggested topic to the repository. - """ - acceptTopicSuggestion(input: AcceptTopicSuggestionInput!): AcceptTopicSuggestionPayload - - """ - Adds assignees to an assignable object. - """ - addAssigneesToAssignable(input: AddAssigneesToAssignableInput!): AddAssigneesToAssignablePayload - - """ - Adds a comment to an Issue or Pull Request. - """ - addComment(input: AddCommentInput!): AddCommentPayload - - """ - Adds labels to a labelable object. - """ - addLabelsToLabelable(input: AddLabelsToLabelableInput!): AddLabelsToLabelablePayload - - """ - Adds a card to a ProjectColumn. Either `contentId` or `note` must be provided but **not** both. - """ - addProjectCard(input: AddProjectCardInput!): AddProjectCardPayload - - """ - Adds a column to a Project. - """ - addProjectColumn(input: AddProjectColumnInput!): AddProjectColumnPayload - - """ - Adds a review to a Pull Request. - """ - addPullRequestReview(input: AddPullRequestReviewInput!): AddPullRequestReviewPayload - - """ - Adds a comment to a review. - """ - addPullRequestReviewComment(input: AddPullRequestReviewCommentInput!): AddPullRequestReviewCommentPayload - - """ - Adds a new thread to a pending Pull Request Review. - """ - addPullRequestReviewThread(input: AddPullRequestReviewThreadInput!): AddPullRequestReviewThreadPayload - - """ - Adds a reaction to a subject. - """ - addReaction(input: AddReactionInput!): AddReactionPayload - - """ - Adds a star to a Starrable. - """ - addStar(input: AddStarInput!): AddStarPayload - - """ - Marks a repository as archived. - """ - archiveRepository(input: ArchiveRepositoryInput!): ArchiveRepositoryPayload - - """ - Cancels a pending invitation for an administrator to join an enterprise. - """ - cancelEnterpriseAdminInvitation(input: CancelEnterpriseAdminInvitationInput!): CancelEnterpriseAdminInvitationPayload - - """ - Update your status on GitHub. - """ - changeUserStatus(input: ChangeUserStatusInput!): ChangeUserStatusPayload - - """ - Clears all labels from a labelable object. - """ - clearLabelsFromLabelable(input: ClearLabelsFromLabelableInput!): ClearLabelsFromLabelablePayload - - """ - Creates a new project by cloning configuration from an existing project. - """ - cloneProject(input: CloneProjectInput!): CloneProjectPayload - - """ - Create a new repository with the same files and directory structure as a template repository. - """ - cloneTemplateRepository(input: CloneTemplateRepositoryInput!): CloneTemplateRepositoryPayload - - """ - Close an issue. - """ - closeIssue(input: CloseIssueInput!): CloseIssuePayload - - """ - Close a pull request. - """ - closePullRequest(input: ClosePullRequestInput!): ClosePullRequestPayload - - """ - Convert a project note card to one associated with a newly created issue. - """ - convertProjectCardNoteToIssue(input: ConvertProjectCardNoteToIssueInput!): ConvertProjectCardNoteToIssuePayload - - """ - Create a new branch protection rule - """ - createBranchProtectionRule(input: CreateBranchProtectionRuleInput!): CreateBranchProtectionRulePayload - - """ - Create a check run. - """ - createCheckRun(input: CreateCheckRunInput!): CreateCheckRunPayload @preview(toggledBy: "antiope-preview") - - """ - Create a check suite - """ - createCheckSuite(input: CreateCheckSuiteInput!): CreateCheckSuitePayload @preview(toggledBy: "antiope-preview") - - """ - Create a content attachment. - """ - createContentAttachment(input: CreateContentAttachmentInput!): CreateContentAttachmentPayload @preview(toggledBy: "corsair-preview") - - """ - Creates a new deployment event. - """ - createDeployment(input: CreateDeploymentInput!): CreateDeploymentPayload @preview(toggledBy: "flash-preview") - - """ - Create a deployment status. - """ - createDeploymentStatus(input: CreateDeploymentStatusInput!): CreateDeploymentStatusPayload @preview(toggledBy: "flash-preview") - - """ - Creates an organization as part of an enterprise account. - """ - createEnterpriseOrganization(input: CreateEnterpriseOrganizationInput!): CreateEnterpriseOrganizationPayload - - """ - Creates a new IP allow list entry. - """ - createIpAllowListEntry(input: CreateIpAllowListEntryInput!): CreateIpAllowListEntryPayload - - """ - Creates a new issue. - """ - createIssue(input: CreateIssueInput!): CreateIssuePayload - - """ - Creates a new label. - """ - createLabel(input: CreateLabelInput!): CreateLabelPayload @preview(toggledBy: "bane-preview") - - """ - Creates a new project. - """ - createProject(input: CreateProjectInput!): CreateProjectPayload - - """ - Create a new pull request - """ - createPullRequest(input: CreatePullRequestInput!): CreatePullRequestPayload - - """ - Create a new Git Ref. - """ - createRef(input: CreateRefInput!): CreateRefPayload - - """ - Create a new repository. - """ - createRepository(input: CreateRepositoryInput!): CreateRepositoryPayload - - """ - Creates a new team discussion. - """ - createTeamDiscussion(input: CreateTeamDiscussionInput!): CreateTeamDiscussionPayload - - """ - Creates a new team discussion comment. - """ - createTeamDiscussionComment(input: CreateTeamDiscussionCommentInput!): CreateTeamDiscussionCommentPayload - - """ - Rejects a suggested topic for the repository. - """ - declineTopicSuggestion(input: DeclineTopicSuggestionInput!): DeclineTopicSuggestionPayload - - """ - Delete a branch protection rule - """ - deleteBranchProtectionRule(input: DeleteBranchProtectionRuleInput!): DeleteBranchProtectionRulePayload - - """ - Deletes a deployment. - """ - deleteDeployment(input: DeleteDeploymentInput!): DeleteDeploymentPayload - - """ - Deletes an IP allow list entry. - """ - deleteIpAllowListEntry(input: DeleteIpAllowListEntryInput!): DeleteIpAllowListEntryPayload - - """ - Deletes an Issue object. - """ - deleteIssue(input: DeleteIssueInput!): DeleteIssuePayload - - """ - Deletes an IssueComment object. - """ - deleteIssueComment(input: DeleteIssueCommentInput!): DeleteIssueCommentPayload - - """ - Deletes a label. - """ - deleteLabel(input: DeleteLabelInput!): DeleteLabelPayload @preview(toggledBy: "bane-preview") - - """ - Delete a package version. - """ - deletePackageVersion(input: DeletePackageVersionInput!): DeletePackageVersionPayload @preview(toggledBy: "package-deletes-preview") - - """ - Deletes a project. - """ - deleteProject(input: DeleteProjectInput!): DeleteProjectPayload - - """ - Deletes a project card. - """ - deleteProjectCard(input: DeleteProjectCardInput!): DeleteProjectCardPayload - - """ - Deletes a project column. - """ - deleteProjectColumn(input: DeleteProjectColumnInput!): DeleteProjectColumnPayload - - """ - Deletes a pull request review. - """ - deletePullRequestReview(input: DeletePullRequestReviewInput!): DeletePullRequestReviewPayload - - """ - Deletes a pull request review comment. - """ - deletePullRequestReviewComment(input: DeletePullRequestReviewCommentInput!): DeletePullRequestReviewCommentPayload - - """ - Delete a Git Ref. - """ - deleteRef(input: DeleteRefInput!): DeleteRefPayload - - """ - Deletes a team discussion. - """ - deleteTeamDiscussion(input: DeleteTeamDiscussionInput!): DeleteTeamDiscussionPayload - - """ - Deletes a team discussion comment. - """ - deleteTeamDiscussionComment(input: DeleteTeamDiscussionCommentInput!): DeleteTeamDiscussionCommentPayload - - """ - Dismisses an approved or rejected pull request review. - """ - dismissPullRequestReview(input: DismissPullRequestReviewInput!): DismissPullRequestReviewPayload - - """ - Follow a user. - """ - followUser(input: FollowUserInput!): FollowUserPayload - - """ - Creates a new project by importing columns and a list of issues/PRs. - """ - importProject(input: ImportProjectInput!): ImportProjectPayload @preview(toggledBy: "slothette-preview") - - """ - Invite someone to become an administrator of the enterprise. - """ - inviteEnterpriseAdmin(input: InviteEnterpriseAdminInput!): InviteEnterpriseAdminPayload - - """ - Creates a repository link for a project. - """ - linkRepositoryToProject(input: LinkRepositoryToProjectInput!): LinkRepositoryToProjectPayload - - """ - Lock a lockable object - """ - lockLockable(input: LockLockableInput!): LockLockablePayload - - """ - Marks a pull request ready for review. - """ - markPullRequestReadyForReview(input: MarkPullRequestReadyForReviewInput!): MarkPullRequestReadyForReviewPayload - - """ - Merge a head into a branch. - """ - mergeBranch(input: MergeBranchInput!): MergeBranchPayload - - """ - Merge a pull request. - """ - mergePullRequest(input: MergePullRequestInput!): MergePullRequestPayload - - """ - Minimizes a comment on an Issue, Commit, Pull Request, or Gist - """ - minimizeComment(input: MinimizeCommentInput!): MinimizeCommentPayload - - """ - Moves a project card to another place. - """ - moveProjectCard(input: MoveProjectCardInput!): MoveProjectCardPayload - - """ - Moves a project column to another place. - """ - moveProjectColumn(input: MoveProjectColumnInput!): MoveProjectColumnPayload - - """ - Pin an issue to a repository - """ - pinIssue(input: PinIssueInput!): PinIssuePayload @preview(toggledBy: "elektra-preview") - - """ - Regenerates the identity provider recovery codes for an enterprise - """ - regenerateEnterpriseIdentityProviderRecoveryCodes(input: RegenerateEnterpriseIdentityProviderRecoveryCodesInput!): RegenerateEnterpriseIdentityProviderRecoveryCodesPayload - - """ - Removes assignees from an assignable object. - """ - removeAssigneesFromAssignable(input: RemoveAssigneesFromAssignableInput!): RemoveAssigneesFromAssignablePayload - - """ - Removes an administrator from the enterprise. - """ - removeEnterpriseAdmin(input: RemoveEnterpriseAdminInput!): RemoveEnterpriseAdminPayload - - """ - Removes the identity provider from an enterprise - """ - removeEnterpriseIdentityProvider(input: RemoveEnterpriseIdentityProviderInput!): RemoveEnterpriseIdentityProviderPayload - - """ - Removes an organization from the enterprise - """ - removeEnterpriseOrganization(input: RemoveEnterpriseOrganizationInput!): RemoveEnterpriseOrganizationPayload - - """ - Removes labels from a Labelable object. - """ - removeLabelsFromLabelable(input: RemoveLabelsFromLabelableInput!): RemoveLabelsFromLabelablePayload - - """ - Removes outside collaborator from all repositories in an organization. - """ - removeOutsideCollaborator(input: RemoveOutsideCollaboratorInput!): RemoveOutsideCollaboratorPayload - - """ - Removes a reaction from a subject. - """ - removeReaction(input: RemoveReactionInput!): RemoveReactionPayload - - """ - Removes a star from a Starrable. - """ - removeStar(input: RemoveStarInput!): RemoveStarPayload - - """ - Reopen a issue. - """ - reopenIssue(input: ReopenIssueInput!): ReopenIssuePayload - - """ - Reopen a pull request. - """ - reopenPullRequest(input: ReopenPullRequestInput!): ReopenPullRequestPayload - - """ - Set review requests on a pull request. - """ - requestReviews(input: RequestReviewsInput!): RequestReviewsPayload - - """ - Rerequests an existing check suite. - """ - rerequestCheckSuite(input: RerequestCheckSuiteInput!): RerequestCheckSuitePayload @preview(toggledBy: "antiope-preview") - - """ - Marks a review thread as resolved. - """ - resolveReviewThread(input: ResolveReviewThreadInput!): ResolveReviewThreadPayload - - """ - Creates or updates the identity provider for an enterprise. - """ - setEnterpriseIdentityProvider(input: SetEnterpriseIdentityProviderInput!): SetEnterpriseIdentityProviderPayload - - """ - Submits a pending pull request review. - """ - submitPullRequestReview(input: SubmitPullRequestReviewInput!): SubmitPullRequestReviewPayload - - """ - Transfer an issue to a different repository - """ - transferIssue(input: TransferIssueInput!): TransferIssuePayload - - """ - Unarchives a repository. - """ - unarchiveRepository(input: UnarchiveRepositoryInput!): UnarchiveRepositoryPayload - - """ - Unfollow a user. - """ - unfollowUser(input: UnfollowUserInput!): UnfollowUserPayload - - """ - Deletes a repository link from a project. - """ - unlinkRepositoryFromProject(input: UnlinkRepositoryFromProjectInput!): UnlinkRepositoryFromProjectPayload - - """ - Unlock a lockable object - """ - unlockLockable(input: UnlockLockableInput!): UnlockLockablePayload - - """ - Unmark an issue as a duplicate of another issue. - """ - unmarkIssueAsDuplicate(input: UnmarkIssueAsDuplicateInput!): UnmarkIssueAsDuplicatePayload - - """ - Unminimizes a comment on an Issue, Commit, Pull Request, or Gist - """ - unminimizeComment(input: UnminimizeCommentInput!): UnminimizeCommentPayload - - """ - Unpin a pinned issue from a repository - """ - unpinIssue(input: UnpinIssueInput!): UnpinIssuePayload @preview(toggledBy: "elektra-preview") - - """ - Marks a review thread as unresolved. - """ - unresolveReviewThread(input: UnresolveReviewThreadInput!): UnresolveReviewThreadPayload - - """ - Create a new branch protection rule - """ - updateBranchProtectionRule(input: UpdateBranchProtectionRuleInput!): UpdateBranchProtectionRulePayload - - """ - Update a check run - """ - updateCheckRun(input: UpdateCheckRunInput!): UpdateCheckRunPayload @preview(toggledBy: "antiope-preview") - - """ - Modifies the settings of an existing check suite - """ - updateCheckSuitePreferences(input: UpdateCheckSuitePreferencesInput!): UpdateCheckSuitePreferencesPayload @preview(toggledBy: "antiope-preview") - - """ - Sets the action execution capability setting for an enterprise. - """ - updateEnterpriseActionExecutionCapabilitySetting(input: UpdateEnterpriseActionExecutionCapabilitySettingInput!): UpdateEnterpriseActionExecutionCapabilitySettingPayload - - """ - Updates the role of an enterprise administrator. - """ - updateEnterpriseAdministratorRole(input: UpdateEnterpriseAdministratorRoleInput!): UpdateEnterpriseAdministratorRolePayload - - """ - Sets whether private repository forks are enabled for an enterprise. - """ - updateEnterpriseAllowPrivateRepositoryForkingSetting(input: UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput!): UpdateEnterpriseAllowPrivateRepositoryForkingSettingPayload - - """ - Sets the default repository permission for organizations in an enterprise. - """ - updateEnterpriseDefaultRepositoryPermissionSetting(input: UpdateEnterpriseDefaultRepositoryPermissionSettingInput!): UpdateEnterpriseDefaultRepositoryPermissionSettingPayload - - """ - Sets whether organization members with admin permissions on a repository can change repository visibility. - """ - updateEnterpriseMembersCanChangeRepositoryVisibilitySetting(input: UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput!): UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingPayload - - """ - Sets the members can create repositories setting for an enterprise. - """ - updateEnterpriseMembersCanCreateRepositoriesSetting(input: UpdateEnterpriseMembersCanCreateRepositoriesSettingInput!): UpdateEnterpriseMembersCanCreateRepositoriesSettingPayload - - """ - Sets the members can delete issues setting for an enterprise. - """ - updateEnterpriseMembersCanDeleteIssuesSetting(input: UpdateEnterpriseMembersCanDeleteIssuesSettingInput!): UpdateEnterpriseMembersCanDeleteIssuesSettingPayload - - """ - Sets the members can delete repositories setting for an enterprise. - """ - updateEnterpriseMembersCanDeleteRepositoriesSetting(input: UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput!): UpdateEnterpriseMembersCanDeleteRepositoriesSettingPayload - - """ - Sets whether members can invite collaborators are enabled for an enterprise. - """ - updateEnterpriseMembersCanInviteCollaboratorsSetting(input: UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput!): UpdateEnterpriseMembersCanInviteCollaboratorsSettingPayload - - """ - Sets whether or not an organization admin can make purchases. - """ - updateEnterpriseMembersCanMakePurchasesSetting(input: UpdateEnterpriseMembersCanMakePurchasesSettingInput!): UpdateEnterpriseMembersCanMakePurchasesSettingPayload - - """ - Sets the members can update protected branches setting for an enterprise. - """ - updateEnterpriseMembersCanUpdateProtectedBranchesSetting(input: UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput!): UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingPayload - - """ - Sets the members can view dependency insights for an enterprise. - """ - updateEnterpriseMembersCanViewDependencyInsightsSetting(input: UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput!): UpdateEnterpriseMembersCanViewDependencyInsightsSettingPayload - - """ - Sets whether organization projects are enabled for an enterprise. - """ - updateEnterpriseOrganizationProjectsSetting(input: UpdateEnterpriseOrganizationProjectsSettingInput!): UpdateEnterpriseOrganizationProjectsSettingPayload - - """ - Updates an enterprise's profile. - """ - updateEnterpriseProfile(input: UpdateEnterpriseProfileInput!): UpdateEnterpriseProfilePayload - - """ - Sets whether repository projects are enabled for a enterprise. - """ - updateEnterpriseRepositoryProjectsSetting(input: UpdateEnterpriseRepositoryProjectsSettingInput!): UpdateEnterpriseRepositoryProjectsSettingPayload - - """ - Sets whether team discussions are enabled for an enterprise. - """ - updateEnterpriseTeamDiscussionsSetting(input: UpdateEnterpriseTeamDiscussionsSettingInput!): UpdateEnterpriseTeamDiscussionsSettingPayload - - """ - Sets whether two factor authentication is required for all users in an enterprise. - """ - updateEnterpriseTwoFactorAuthenticationRequiredSetting(input: UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput!): UpdateEnterpriseTwoFactorAuthenticationRequiredSettingPayload - - """ - Sets whether an IP allow list is enabled on an owner. - """ - updateIpAllowListEnabledSetting(input: UpdateIpAllowListEnabledSettingInput!): UpdateIpAllowListEnabledSettingPayload - - """ - Updates an IP allow list entry. - """ - updateIpAllowListEntry(input: UpdateIpAllowListEntryInput!): UpdateIpAllowListEntryPayload - - """ - Updates an Issue. - """ - updateIssue(input: UpdateIssueInput!): UpdateIssuePayload - - """ - Updates an IssueComment object. - """ - updateIssueComment(input: UpdateIssueCommentInput!): UpdateIssueCommentPayload - - """ - Updates an existing label. - """ - updateLabel(input: UpdateLabelInput!): UpdateLabelPayload @preview(toggledBy: "bane-preview") - - """ - Updates an existing project. - """ - updateProject(input: UpdateProjectInput!): UpdateProjectPayload - - """ - Updates an existing project card. - """ - updateProjectCard(input: UpdateProjectCardInput!): UpdateProjectCardPayload - - """ - Updates an existing project column. - """ - updateProjectColumn(input: UpdateProjectColumnInput!): UpdateProjectColumnPayload - - """ - Update a pull request - """ - updatePullRequest(input: UpdatePullRequestInput!): UpdatePullRequestPayload - - """ - Updates the body of a pull request review. - """ - updatePullRequestReview(input: UpdatePullRequestReviewInput!): UpdatePullRequestReviewPayload - - """ - Updates a pull request review comment. - """ - updatePullRequestReviewComment(input: UpdatePullRequestReviewCommentInput!): UpdatePullRequestReviewCommentPayload - - """ - Update a Git Ref. - """ - updateRef(input: UpdateRefInput!): UpdateRefPayload - - """ - Creates, updates and/or deletes multiple refs in a repository. - - This mutation takes a list of `RefUpdate`s and performs these updates - on the repository. All updates are performed atomically, meaning that - if one of them is rejected, no other ref will be modified. - - `RefUpdate.beforeOid` specifies that the given reference needs to point - to the given value before performing any updates. A value of - `0000000000000000000000000000000000000000` can be used to verify that - the references should not exist. - - `RefUpdate.afterOid` specifies the value that the given reference - will point to after performing all updates. A value of - `0000000000000000000000000000000000000000` can be used to delete a - reference. - - If `RefUpdate.force` is set to `true`, a non-fast-forward updates - for the given reference will be allowed. - """ - updateRefs(input: UpdateRefsInput!): UpdateRefsPayload @preview(toggledBy: "update-refs-preview") - - """ - Update information about a repository. - """ - updateRepository(input: UpdateRepositoryInput!): UpdateRepositoryPayload - - """ - Updates the state for subscribable subjects. - """ - updateSubscription(input: UpdateSubscriptionInput!): UpdateSubscriptionPayload - - """ - Updates a team discussion. - """ - updateTeamDiscussion(input: UpdateTeamDiscussionInput!): UpdateTeamDiscussionPayload - - """ - Updates a discussion comment. - """ - updateTeamDiscussionComment(input: UpdateTeamDiscussionCommentInput!): UpdateTeamDiscussionCommentPayload - - """ - Updates team review assignment. - """ - updateTeamReviewAssignment(input: UpdateTeamReviewAssignmentInput!): UpdateTeamReviewAssignmentPayload @preview(toggledBy: "stone-crop-preview") - - """ - Replaces the repository's topics with the given topics. - """ - updateTopics(input: UpdateTopicsInput!): UpdateTopicsPayload -} - -""" -An object with an ID. -""" -interface Node { - """ - ID of the object. - """ - id: ID! -} - -""" -Metadata for an audit entry with action oauth_application.* -""" -interface OauthApplicationAuditEntryData { - """ - The name of the OAuth Application. - """ - oauthApplicationName: String - - """ - The HTTP path for the OAuth Application - """ - oauthApplicationResourcePath: URI - - """ - The HTTP URL for the OAuth Application - """ - oauthApplicationUrl: URI -} - -""" -Audit log entry for a oauth_application.create event. -""" -type OauthApplicationCreateAuditEntry implements AuditEntry & Node & OauthApplicationAuditEntryData & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The application URL of the OAuth Application. - """ - applicationUrl: URI - - """ - The callback URL of the OAuth Application. - """ - callbackUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The name of the OAuth Application. - """ - oauthApplicationName: String - - """ - The HTTP path for the OAuth Application - """ - oauthApplicationResourcePath: URI - - """ - The HTTP URL for the OAuth Application - """ - oauthApplicationUrl: URI - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The rate limit of the OAuth Application. - """ - rateLimit: Int - - """ - The state of the OAuth Application. - """ - state: OauthApplicationCreateAuditEntryState - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The state of an OAuth Application when it was created. -""" -enum OauthApplicationCreateAuditEntryState { - """ - The OAuth Application was active and allowed to have OAuth Accesses. - """ - ACTIVE - - """ - The OAuth Application was in the process of being deleted. - """ - PENDING_DELETION - - """ - The OAuth Application was suspended from generating OAuth Accesses due to abuse or security concerns. - """ - SUSPENDED -} - -""" -The corresponding operation type for the action -""" -enum OperationType { - """ - An existing resource was accessed - """ - ACCESS - - """ - A resource performed an authentication event - """ - AUTHENTICATION - - """ - A new resource was created - """ - CREATE - - """ - An existing resource was modified - """ - MODIFY - - """ - An existing resource was removed - """ - REMOVE - - """ - An existing resource was restored - """ - RESTORE - - """ - An existing resource was transferred between multiple resources - """ - TRANSFER -} - -""" -Possible directions in which to order a list of items when provided an `orderBy` argument. -""" -enum OrderDirection { - """ - Specifies an ascending order for a given `orderBy` argument. - """ - ASC - - """ - Specifies a descending order for a given `orderBy` argument. - """ - DESC -} - -""" -Audit log entry for a org.add_billing_manager -""" -type OrgAddBillingManagerAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The email address used to invite a billing manager for the organization. - """ - invitationEmail: String - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.add_member -""" -type OrgAddMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The permission level of the member added to the organization. - """ - permission: OrgAddMemberAuditEntryPermission - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The permissions available to members on an Organization. -""" -enum OrgAddMemberAuditEntryPermission { - """ - Can read, clone, push, and add collaborators to repositories. - """ - ADMIN - - """ - Can read and clone repositories. - """ - READ -} - -""" -Audit log entry for a org.block_user -""" -type OrgBlockUserAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The blocked user. - """ - blockedUser: User - - """ - The username of the blocked user. - """ - blockedUserName: String - - """ - The HTTP path for the blocked user. - """ - blockedUserResourcePath: URI - - """ - The HTTP URL for the blocked user. - """ - blockedUserUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.config.disable_collaborators_only event. -""" -type OrgConfigDisableCollaboratorsOnlyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.config.enable_collaborators_only event. -""" -type OrgConfigEnableCollaboratorsOnlyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.create event. -""" -type OrgCreateAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The billing plan for the Organization. - """ - billingPlan: OrgCreateAuditEntryBillingPlan - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The billing plans available for organizations. -""" -enum OrgCreateAuditEntryBillingPlan { - """ - Team Plan - """ - BUSINESS - - """ - Enterprise Cloud Plan - """ - BUSINESS_PLUS - - """ - Free Plan - """ - FREE - - """ - Tiered Per Seat Plan - """ - TIERED_PER_SEAT - - """ - Legacy Unlimited Plan - """ - UNLIMITED -} - -""" -Audit log entry for a org.disable_oauth_app_restrictions event. -""" -type OrgDisableOauthAppRestrictionsAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.disable_saml event. -""" -type OrgDisableSamlAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The SAML provider's digest algorithm URL. - """ - digestMethodUrl: URI - id: ID! - - """ - The SAML provider's issuer URL. - """ - issuerUrl: URI - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The SAML provider's signature algorithm URL. - """ - signatureMethodUrl: URI - - """ - The SAML provider's single sign-on URL. - """ - singleSignOnUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.disable_two_factor_requirement event. -""" -type OrgDisableTwoFactorRequirementAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.enable_oauth_app_restrictions event. -""" -type OrgEnableOauthAppRestrictionsAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.enable_saml event. -""" -type OrgEnableSamlAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The SAML provider's digest algorithm URL. - """ - digestMethodUrl: URI - id: ID! - - """ - The SAML provider's issuer URL. - """ - issuerUrl: URI - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The SAML provider's signature algorithm URL. - """ - signatureMethodUrl: URI - - """ - The SAML provider's single sign-on URL. - """ - singleSignOnUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.enable_two_factor_requirement event. -""" -type OrgEnableTwoFactorRequirementAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.invite_member event. -""" -type OrgInviteMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The email address of the organization invitation. - """ - email: String - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The organization invitation. - """ - organizationInvitation: OrganizationInvitation - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.invite_to_business event. -""" -type OrgInviteToBusinessAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.oauth_app_access_approved event. -""" -type OrgOauthAppAccessApprovedAuditEntry implements AuditEntry & Node & OauthApplicationAuditEntryData & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The name of the OAuth Application. - """ - oauthApplicationName: String - - """ - The HTTP path for the OAuth Application - """ - oauthApplicationResourcePath: URI - - """ - The HTTP URL for the OAuth Application - """ - oauthApplicationUrl: URI - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.oauth_app_access_denied event. -""" -type OrgOauthAppAccessDeniedAuditEntry implements AuditEntry & Node & OauthApplicationAuditEntryData & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The name of the OAuth Application. - """ - oauthApplicationName: String - - """ - The HTTP path for the OAuth Application - """ - oauthApplicationResourcePath: URI - - """ - The HTTP URL for the OAuth Application - """ - oauthApplicationUrl: URI - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.oauth_app_access_requested event. -""" -type OrgOauthAppAccessRequestedAuditEntry implements AuditEntry & Node & OauthApplicationAuditEntryData & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The name of the OAuth Application. - """ - oauthApplicationName: String - - """ - The HTTP path for the OAuth Application - """ - oauthApplicationResourcePath: URI - - """ - The HTTP URL for the OAuth Application - """ - oauthApplicationUrl: URI - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.remove_billing_manager event. -""" -type OrgRemoveBillingManagerAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The reason for the billing manager being removed. - """ - reason: OrgRemoveBillingManagerAuditEntryReason - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The reason a billing manager was removed from an Organization. -""" -enum OrgRemoveBillingManagerAuditEntryReason { - """ - SAML external identity missing - """ - SAML_EXTERNAL_IDENTITY_MISSING - - """ - SAML SSO enforcement requires an external identity - """ - SAML_SSO_ENFORCEMENT_REQUIRES_EXTERNAL_IDENTITY - - """ - The organization required 2FA of its billing managers and this user did not have 2FA enabled. - """ - TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE -} - -""" -Audit log entry for a org.remove_member event. -""" -type OrgRemoveMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The types of membership the member has with the organization. - """ - membershipTypes: [OrgRemoveMemberAuditEntryMembershipType!] - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The reason for the member being removed. - """ - reason: OrgRemoveMemberAuditEntryReason - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The type of membership a user has with an Organization. -""" -enum OrgRemoveMemberAuditEntryMembershipType { - """ - Organization administrators have full access and can change several settings, - including the names of repositories that belong to the Organization and Owners - team membership. In addition, organization admins can delete the organization - and all of its repositories. - """ - ADMIN - - """ - A billing manager is a user who manages the billing settings for the Organization, such as updating payment information. - """ - BILLING_MANAGER - - """ - A direct member is a user that is a member of the Organization. - """ - DIRECT_MEMBER - - """ - An outside collaborator is a person who isn't explicitly a member of the - Organization, but who has Read, Write, or Admin permissions to one or more - repositories in the organization. - """ - OUTSIDE_COLLABORATOR - - """ - An unaffiliated collaborator is a person who is not a member of the - Organization and does not have access to any repositories in the Organization. - """ - UNAFFILIATED -} - -""" -The reason a member was removed from an Organization. -""" -enum OrgRemoveMemberAuditEntryReason { - """ - SAML external identity missing - """ - SAML_EXTERNAL_IDENTITY_MISSING - - """ - SAML SSO enforcement requires an external identity - """ - SAML_SSO_ENFORCEMENT_REQUIRES_EXTERNAL_IDENTITY - - """ - User was removed from organization during account recovery - """ - TWO_FACTOR_ACCOUNT_RECOVERY - - """ - The organization required 2FA of its billing managers and this user did not have 2FA enabled. - """ - TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE - - """ - User account has been deleted - """ - USER_ACCOUNT_DELETED -} - -""" -Audit log entry for a org.remove_outside_collaborator event. -""" -type OrgRemoveOutsideCollaboratorAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The types of membership the outside collaborator has with the organization. - """ - membershipTypes: [OrgRemoveOutsideCollaboratorAuditEntryMembershipType!] - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The reason for the outside collaborator being removed from the Organization. - """ - reason: OrgRemoveOutsideCollaboratorAuditEntryReason - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The type of membership a user has with an Organization. -""" -enum OrgRemoveOutsideCollaboratorAuditEntryMembershipType { - """ - A billing manager is a user who manages the billing settings for the Organization, such as updating payment information. - """ - BILLING_MANAGER - - """ - An outside collaborator is a person who isn't explicitly a member of the - Organization, but who has Read, Write, or Admin permissions to one or more - repositories in the organization. - """ - OUTSIDE_COLLABORATOR - - """ - An unaffiliated collaborator is a person who is not a member of the - Organization and does not have access to any repositories in the organization. - """ - UNAFFILIATED -} - -""" -The reason an outside collaborator was removed from an Organization. -""" -enum OrgRemoveOutsideCollaboratorAuditEntryReason { - """ - SAML external identity missing - """ - SAML_EXTERNAL_IDENTITY_MISSING - - """ - The organization required 2FA of its billing managers and this user did not have 2FA enabled. - """ - TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE -} - -""" -Audit log entry for a org.restore_member event. -""" -type OrgRestoreMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The number of custom email routings for the restored member. - """ - restoredCustomEmailRoutingsCount: Int - - """ - The number of issue assignemnts for the restored member. - """ - restoredIssueAssignmentsCount: Int - - """ - Restored organization membership objects. - """ - restoredMemberships: [OrgRestoreMemberAuditEntryMembership!] - - """ - The number of restored memberships. - """ - restoredMembershipsCount: Int - - """ - The number of repositories of the restored member. - """ - restoredRepositoriesCount: Int - - """ - The number of starred repositories for the restored member. - """ - restoredRepositoryStarsCount: Int - - """ - The number of watched repositories for the restored member. - """ - restoredRepositoryWatchesCount: Int - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Types of memberships that can be restored for an Organization member. -""" -union OrgRestoreMemberAuditEntryMembership = OrgRestoreMemberMembershipOrganizationAuditEntryData | OrgRestoreMemberMembershipRepositoryAuditEntryData | OrgRestoreMemberMembershipTeamAuditEntryData - -""" -Metadata for an organization membership for org.restore_member actions -""" -type OrgRestoreMemberMembershipOrganizationAuditEntryData implements OrganizationAuditEntryData { - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI -} - -""" -Metadata for a repository membership for org.restore_member actions -""" -type OrgRestoreMemberMembershipRepositoryAuditEntryData implements RepositoryAuditEntryData { - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI -} - -""" -Metadata for a team membership for org.restore_member actions -""" -type OrgRestoreMemberMembershipTeamAuditEntryData implements TeamAuditEntryData { - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI -} - -""" -Audit log entry for a org.unblock_user -""" -type OrgUnblockUserAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The user being unblocked by the organization. - """ - blockedUser: User - - """ - The username of the blocked user. - """ - blockedUserName: String - - """ - The HTTP path for the blocked user. - """ - blockedUserResourcePath: URI - - """ - The HTTP URL for the blocked user. - """ - blockedUserUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a org.update_default_repository_permission -""" -type OrgUpdateDefaultRepositoryPermissionAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The new default repository permission level for the organization. - """ - permission: OrgUpdateDefaultRepositoryPermissionAuditEntryPermission - - """ - The former default repository permission level for the organization. - """ - permissionWas: OrgUpdateDefaultRepositoryPermissionAuditEntryPermission - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The default permission a repository can have in an Organization. -""" -enum OrgUpdateDefaultRepositoryPermissionAuditEntryPermission { - """ - Can read, clone, push, and add collaborators to repositories. - """ - ADMIN - - """ - No default permission value. - """ - NONE - - """ - Can read and clone repositories. - """ - READ - - """ - Can read, clone and push to repositories. - """ - WRITE -} - -""" -Audit log entry for a org.update_member event. -""" -type OrgUpdateMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The new member permission level for the organization. - """ - permission: OrgUpdateMemberAuditEntryPermission - - """ - The former member permission level for the organization. - """ - permissionWas: OrgUpdateMemberAuditEntryPermission - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The permissions available to members on an Organization. -""" -enum OrgUpdateMemberAuditEntryPermission { - """ - Can read, clone, push, and add collaborators to repositories. - """ - ADMIN - - """ - Can read and clone repositories. - """ - READ -} - -""" -Audit log entry for a org.update_member_repository_creation_permission event. -""" -type OrgUpdateMemberRepositoryCreationPermissionAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - Can members create repositories in the organization. - """ - canCreateRepositories: Boolean - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The permission for visibility level of repositories for this organization. - """ - visibility: OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility -} - -""" -The permissions available for repository creation on an Organization. -""" -enum OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility { - """ - All organization members are restricted from creating any repositories. - """ - ALL - - """ - All organization members are restricted from creating public repositories. - """ - PUBLIC -} - -""" -Audit log entry for a org.update_member_repository_invitation_permission event. -""" -type OrgUpdateMemberRepositoryInvitationPermissionAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - Can outside collaborators be invited to repositories in the organization. - """ - canInviteOutsideCollaboratorsToRepositories: Boolean - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -An account on GitHub, with one or more owners, that has repositories, members and teams. -""" -type Organization implements Actor & MemberStatusable & Node & PackageOwner & ProfileOwner & ProjectOwner & RepositoryOwner & Sponsorable & UniformResourceLocatable { - """ - Determine if this repository owner has any items that can be pinned to their profile. - """ - anyPinnableItems( - """ - Filter to only a particular kind of pinnable item. - """ - type: PinnableItemType - ): Boolean! - - """ - Audit log entries of the organization - """ - auditLog( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for the returned audit log entries. - """ - orderBy: AuditLogOrder = {field: CREATED_AT, direction: DESC} - - """ - The query string to filter audit entries - """ - query: String - ): OrganizationAuditEntryConnection! - - """ - A URL pointing to the organization's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The organization's public profile description. - """ - description: String - - """ - The organization's public profile description rendered to HTML. - """ - descriptionHTML: String - - """ - The organization's public email. - """ - email: String - id: ID! - - """ - The setting value for whether the organization has an IP allow list enabled. - """ - ipAllowListEnabledSetting: IpAllowListEnabledSettingValue! - - """ - The IP addresses that are allowed to access resources owned by the organization. - """ - ipAllowListEntries( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for IP allow list entries returned. - """ - orderBy: IpAllowListEntryOrder = {field: ALLOW_LIST_VALUE, direction: ASC} - ): IpAllowListEntryConnection! - - """ - Whether the organization has verified its profile email and website. - """ - isVerified: Boolean! - - """ - Showcases a selection of repositories and gists that the profile owner has - either curated or that have been selected automatically based on popularity. - """ - itemShowcase: ProfileItemShowcase! - - """ - The organization's public profile location. - """ - location: String - - """ - The organization's login name. - """ - login: String! - - """ - Get the status messages members of this entity have set that are either public or visible only to the organization. - """ - memberStatuses( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for user statuses returned from the connection. - """ - orderBy: UserStatusOrder = {field: UPDATED_AT, direction: DESC} - ): UserStatusConnection! - - """ - A list of users who are members of this organization. - """ - membersWithRole( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): OrganizationMemberConnection! - - """ - The organization's public profile name. - """ - name: String - - """ - The HTTP path creating a new team - """ - newTeamResourcePath: URI! - - """ - The HTTP URL creating a new team - """ - newTeamUrl: URI! - - """ - The billing email for the organization. - """ - organizationBillingEmail: String - - """ - A list of packages under the owner. - """ - packages( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Find packages by their names. - """ - names: [String] - - """ - Ordering of the returned packages. - """ - orderBy: PackageOrder = {field: CREATED_AT, direction: DESC} - - """ - Filter registry package by type. - """ - packageType: PackageType - - """ - Find packages in a repository by ID. - """ - repositoryId: ID - ): PackageConnection! - - """ - A list of users who have been invited to join this organization. - """ - pendingMembers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! - - """ - A list of repositories and gists this profile owner can pin to their profile. - """ - pinnableItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter the types of pinnable items that are returned. - """ - types: [PinnableItemType!] - ): PinnableItemConnection! - - """ - A list of repositories and gists this profile owner has pinned to their profile - """ - pinnedItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter the types of pinned items that are returned. - """ - types: [PinnableItemType!] - ): PinnableItemConnection! - - """ - Returns how many more items this profile owner can pin to their profile. - """ - pinnedItemsRemaining: Int! - - """ - Find project by number. - """ - project( - """ - The project number to find. - """ - number: Int! - ): Project - - """ - A list of projects under the owner. - """ - projects( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for projects returned from the connection - """ - orderBy: ProjectOrder - - """ - Query to search projects by, currently only searching by name. - """ - search: String - - """ - A list of states to filter the projects by. - """ - states: [ProjectState!] - ): ProjectConnection! - - """ - The HTTP path listing organization's projects - """ - projectsResourcePath: URI! - - """ - The HTTP URL listing organization's projects - """ - projectsUrl: URI! - - """ - A list of repositories that the user owns. - """ - repositories( - """ - Array of viewer's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - current viewer owns. - """ - affiliations: [RepositoryAffiliation] - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If non-null, filters repositories according to whether they are forks of another repository - """ - isFork: Boolean - - """ - If non-null, filters repositories according to whether they have been locked - """ - isLocked: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder - - """ - Array of owner's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - organization or user being viewed owns. - """ - ownerAffiliations: [RepositoryAffiliation] = [OWNER, COLLABORATOR] - - """ - If non-null, filters repositories according to privacy - """ - privacy: RepositoryPrivacy - ): RepositoryConnection! - - """ - Find Repository. - """ - repository( - """ - Name of Repository to find. - """ - name: String! - ): Repository - - """ - When true the organization requires all members, billing managers, and outside - collaborators to enable two-factor authentication. - """ - requiresTwoFactorAuthentication: Boolean - - """ - The HTTP path for this organization. - """ - resourcePath: URI! - - """ - The Organization's SAML identity providers - """ - samlIdentityProvider: OrganizationIdentityProvider - - """ - The GitHub Sponsors listing for this user. - """ - sponsorsListing: SponsorsListing - - """ - This object's sponsorships as the maintainer. - """ - sponsorshipsAsMaintainer( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Whether or not to include private sponsorships in the result set - """ - includePrivate: Boolean = false - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! - - """ - This object's sponsorships as the sponsor. - """ - sponsorshipsAsSponsor( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! - - """ - Find an organization's team by its slug. - """ - team( - """ - The name or slug of the team to find. - """ - slug: String! - ): Team - - """ - A list of teams in this organization. - """ - teams( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - If true, filters teams that are mapped to an LDAP Group (Enterprise only) - """ - ldapMapped: Boolean - - """ - Ordering options for teams returned from the connection - """ - orderBy: TeamOrder - - """ - If non-null, filters teams according to privacy - """ - privacy: TeamPrivacy - - """ - If non-null, filters teams with query on team name and team slug - """ - query: String - - """ - If non-null, filters teams according to whether the viewer is an admin or member on team - """ - role: TeamRole - - """ - If true, restrict to only root teams - """ - rootTeamsOnly: Boolean = false - - """ - User logins to filter by - """ - userLogins: [String!] - ): TeamConnection! - - """ - The HTTP path listing organization's teams - """ - teamsResourcePath: URI! - - """ - The HTTP URL listing organization's teams - """ - teamsUrl: URI! - - """ - The organization's Twitter username. - """ - twitterUsername: String - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this organization. - """ - url: URI! - - """ - Organization is adminable by the viewer. - """ - viewerCanAdminister: Boolean! - - """ - Can the viewer pin repositories and gists to the profile? - """ - viewerCanChangePinnedItems: Boolean! - - """ - Can the current viewer create new projects on this owner. - """ - viewerCanCreateProjects: Boolean! - - """ - Viewer can create repositories on this organization - """ - viewerCanCreateRepositories: Boolean! - - """ - Viewer can create teams on this organization. - """ - viewerCanCreateTeams: Boolean! - - """ - Viewer is an active member of this organization. - """ - viewerIsAMember: Boolean! - - """ - The organization's public profile URL. - """ - websiteUrl: URI -} - -""" -An audit entry in an organization audit log. -""" -union OrganizationAuditEntry = MembersCanDeleteReposClearAuditEntry | MembersCanDeleteReposDisableAuditEntry | MembersCanDeleteReposEnableAuditEntry | OauthApplicationCreateAuditEntry | OrgAddBillingManagerAuditEntry | OrgAddMemberAuditEntry | OrgBlockUserAuditEntry | OrgConfigDisableCollaboratorsOnlyAuditEntry | OrgConfigEnableCollaboratorsOnlyAuditEntry | OrgCreateAuditEntry | OrgDisableOauthAppRestrictionsAuditEntry | OrgDisableSamlAuditEntry | OrgDisableTwoFactorRequirementAuditEntry | OrgEnableOauthAppRestrictionsAuditEntry | OrgEnableSamlAuditEntry | OrgEnableTwoFactorRequirementAuditEntry | OrgInviteMemberAuditEntry | OrgInviteToBusinessAuditEntry | OrgOauthAppAccessApprovedAuditEntry | OrgOauthAppAccessDeniedAuditEntry | OrgOauthAppAccessRequestedAuditEntry | OrgRemoveBillingManagerAuditEntry | OrgRemoveMemberAuditEntry | OrgRemoveOutsideCollaboratorAuditEntry | OrgRestoreMemberAuditEntry | OrgUnblockUserAuditEntry | OrgUpdateDefaultRepositoryPermissionAuditEntry | OrgUpdateMemberAuditEntry | OrgUpdateMemberRepositoryCreationPermissionAuditEntry | OrgUpdateMemberRepositoryInvitationPermissionAuditEntry | PrivateRepositoryForkingDisableAuditEntry | PrivateRepositoryForkingEnableAuditEntry | RepoAccessAuditEntry | RepoAddMemberAuditEntry | RepoAddTopicAuditEntry | RepoArchivedAuditEntry | RepoChangeMergeSettingAuditEntry | RepoConfigDisableAnonymousGitAccessAuditEntry | RepoConfigDisableCollaboratorsOnlyAuditEntry | RepoConfigDisableContributorsOnlyAuditEntry | RepoConfigDisableSockpuppetDisallowedAuditEntry | RepoConfigEnableAnonymousGitAccessAuditEntry | RepoConfigEnableCollaboratorsOnlyAuditEntry | RepoConfigEnableContributorsOnlyAuditEntry | RepoConfigEnableSockpuppetDisallowedAuditEntry | RepoConfigLockAnonymousGitAccessAuditEntry | RepoConfigUnlockAnonymousGitAccessAuditEntry | RepoCreateAuditEntry | RepoDestroyAuditEntry | RepoRemoveMemberAuditEntry | RepoRemoveTopicAuditEntry | RepositoryVisibilityChangeDisableAuditEntry | RepositoryVisibilityChangeEnableAuditEntry | TeamAddMemberAuditEntry | TeamAddRepositoryAuditEntry | TeamChangeParentTeamAuditEntry | TeamRemoveMemberAuditEntry | TeamRemoveRepositoryAuditEntry - -""" -The connection type for OrganizationAuditEntry. -""" -type OrganizationAuditEntryConnection { - """ - A list of edges. - """ - edges: [OrganizationAuditEntryEdge] - - """ - A list of nodes. - """ - nodes: [OrganizationAuditEntry] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Metadata for an audit entry with action org.* -""" -interface OrganizationAuditEntryData { - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI -} - -""" -An edge in a connection. -""" -type OrganizationAuditEntryEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: OrganizationAuditEntry -} - -""" -The connection type for Organization. -""" -type OrganizationConnection { - """ - A list of edges. - """ - edges: [OrganizationEdge] - - """ - A list of nodes. - """ - nodes: [Organization] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type OrganizationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Organization -} - -""" -An Identity Provider configured to provision SAML and SCIM identities for Organizations -""" -type OrganizationIdentityProvider implements Node { - """ - The digest algorithm used to sign SAML requests for the Identity Provider. - """ - digestMethod: URI - - """ - External Identities provisioned by this Identity Provider - """ - externalIdentities( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ExternalIdentityConnection! - id: ID! - - """ - The x509 certificate used by the Identity Provder to sign assertions and responses. - """ - idpCertificate: X509Certificate - - """ - The Issuer Entity ID for the SAML Identity Provider - """ - issuer: String - - """ - Organization this Identity Provider belongs to - """ - organization: Organization - - """ - The signature algorithm used to sign SAML requests for the Identity Provider. - """ - signatureMethod: URI - - """ - The URL endpoint for the Identity Provider's SAML SSO. - """ - ssoUrl: URI -} - -""" -An Invitation for a user to an organization. -""" -type OrganizationInvitation implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The email address of the user invited to the organization. - """ - email: String - id: ID! - - """ - The type of invitation that was sent (e.g. email, user). - """ - invitationType: OrganizationInvitationType! - - """ - The user who was invited to the organization. - """ - invitee: User - - """ - The user who created the invitation. - """ - inviter: User! - - """ - The organization the invite is for - """ - organization: Organization! - - """ - The user's pending role in the organization (e.g. member, owner). - """ - role: OrganizationInvitationRole! -} - -""" -The connection type for OrganizationInvitation. -""" -type OrganizationInvitationConnection { - """ - A list of edges. - """ - edges: [OrganizationInvitationEdge] - - """ - A list of nodes. - """ - nodes: [OrganizationInvitation] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type OrganizationInvitationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: OrganizationInvitation -} - -""" -The possible organization invitation roles. -""" -enum OrganizationInvitationRole { - """ - The user is invited to be an admin of the organization. - """ - ADMIN - - """ - The user is invited to be a billing manager of the organization. - """ - BILLING_MANAGER - - """ - The user is invited to be a direct member of the organization. - """ - DIRECT_MEMBER - - """ - The user's previous role will be reinstated. - """ - REINSTATE -} - -""" -The possible organization invitation types. -""" -enum OrganizationInvitationType { - """ - The invitation was to an email address. - """ - EMAIL - - """ - The invitation was to an existing user. - """ - USER -} - -""" -The connection type for User. -""" -type OrganizationMemberConnection { - """ - A list of edges. - """ - edges: [OrganizationMemberEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a user within an organization. -""" -type OrganizationMemberEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - Whether the organization member has two factor enabled or not. Returns null if information is not available to viewer. - """ - hasTwoFactorEnabled: Boolean - - """ - The item at the end of the edge. - """ - node: User - - """ - The role this user has in the organization. - """ - role: OrganizationMemberRole -} - -""" -The possible roles within an organization for its members. -""" -enum OrganizationMemberRole { - """ - The user is an administrator of the organization. - """ - ADMIN - - """ - The user is a member of the organization. - """ - MEMBER -} - -""" -The possible values for the members can create repositories setting on an organization. -""" -enum OrganizationMembersCanCreateRepositoriesSettingValue { - """ - Members will be able to create public and private repositories. - """ - ALL - - """ - Members will not be able to create public or private repositories. - """ - DISABLED - - """ - Members will be able to create only private repositories. - """ - PRIVATE -} - -""" -Ordering options for organization connections. -""" -input OrganizationOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order organizations by. - """ - field: OrganizationOrderField! -} - -""" -Properties by which organization connections can be ordered. -""" -enum OrganizationOrderField { - """ - Order organizations by creation time - """ - CREATED_AT - - """ - Order organizations by login - """ - LOGIN -} - -""" -An organization teams hovercard context -""" -type OrganizationTeamsHovercardContext implements HovercardContext { - """ - A string describing this context - """ - message: String! - - """ - An octicon to accompany this context - """ - octicon: String! - - """ - Teams in this organization the user is a member of that are relevant - """ - relevantTeams( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): TeamConnection! - - """ - The path for the full team list for this user - """ - teamsResourcePath: URI! - - """ - The URL for the full team list for this user - """ - teamsUrl: URI! - - """ - The total number of teams the user is on in the organization - """ - totalTeamCount: Int! -} - -""" -An organization list hovercard context -""" -type OrganizationsHovercardContext implements HovercardContext { - """ - A string describing this context - """ - message: String! - - """ - An octicon to accompany this context - """ - octicon: String! - - """ - Organizations this user is a member of that are relevant - """ - relevantOrganizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): OrganizationConnection! - - """ - The total number of organizations this user is in - """ - totalOrganizationCount: Int! -} - -""" -Information for an uploaded package. -""" -type Package implements Node { - id: ID! - - """ - Find the latest version for the package. - """ - latestVersion: PackageVersion - - """ - Identifies the name of the package. - """ - name: String! - - """ - Identifies the type of the package. - """ - packageType: PackageType! - - """ - The repository this package belongs to. - """ - repository: Repository - - """ - Statistics about package activity. - """ - statistics: PackageStatistics - - """ - Find package version by version string. - """ - version( - """ - The package version. - """ - version: String! - ): PackageVersion - - """ - list of versions for this package - """ - versions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering of the returned packages. - """ - orderBy: PackageVersionOrder = {field: CREATED_AT, direction: DESC} - ): PackageVersionConnection! -} - -""" -The connection type for Package. -""" -type PackageConnection { - """ - A list of edges. - """ - edges: [PackageEdge] - - """ - A list of nodes. - """ - nodes: [Package] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PackageEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Package -} - -""" -A file in a package version. -""" -type PackageFile implements Node { - id: ID! - - """ - MD5 hash of the file. - """ - md5: String - - """ - Name of the file. - """ - name: String! - - """ - The package version this file belongs to. - """ - packageVersion: PackageVersion - - """ - SHA1 hash of the file. - """ - sha1: String - - """ - SHA256 hash of the file. - """ - sha256: String - - """ - Size of the file in bytes. - """ - size: Int - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - URL to download the asset. - """ - url: URI -} - -""" -The connection type for PackageFile. -""" -type PackageFileConnection { - """ - A list of edges. - """ - edges: [PackageFileEdge] - - """ - A list of nodes. - """ - nodes: [PackageFile] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PackageFileEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PackageFile -} - -""" -Ways in which lists of package files can be ordered upon return. -""" -input PackageFileOrder { - """ - The direction in which to order package files by the specified field. - """ - direction: OrderDirection - - """ - The field in which to order package files by. - """ - field: PackageFileOrderField -} - -""" -Properties by which package file connections can be ordered. -""" -enum PackageFileOrderField { - """ - Order package files by creation time - """ - CREATED_AT -} - -""" -Ways in which lists of packages can be ordered upon return. -""" -input PackageOrder { - """ - The direction in which to order packages by the specified field. - """ - direction: OrderDirection - - """ - The field in which to order packages by. - """ - field: PackageOrderField -} - -""" -Properties by which package connections can be ordered. -""" -enum PackageOrderField { - """ - Order packages by creation time - """ - CREATED_AT -} - -""" -Represents an owner of a package. -""" -interface PackageOwner { - id: ID! - - """ - A list of packages under the owner. - """ - packages( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Find packages by their names. - """ - names: [String] - - """ - Ordering of the returned packages. - """ - orderBy: PackageOrder = {field: CREATED_AT, direction: DESC} - - """ - Filter registry package by type. - """ - packageType: PackageType - - """ - Find packages in a repository by ID. - """ - repositoryId: ID - ): PackageConnection! -} - -""" -Represents a object that contains package activity statistics such as downloads. -""" -type PackageStatistics { - """ - Number of times the package was downloaded since it was created. - """ - downloadsTotalCount: Int! -} - -""" -A version tag contains the mapping between a tag name and a version. -""" -type PackageTag implements Node { - id: ID! - - """ - Identifies the tag name of the version. - """ - name: String! - - """ - Version that the tag is associated with. - """ - version: PackageVersion -} - -""" -The possible types of a package. -""" -enum PackageType { - """ - A debian package. - """ - DEBIAN - - """ - A docker image. - """ - DOCKER - - """ - A maven package. - """ - MAVEN - - """ - An npm package. - """ - NPM - - """ - A nuget package. - """ - NUGET - - """ - A python package. - """ - PYPI - - """ - A rubygems package. - """ - RUBYGEMS -} - -""" -Information about a specific package version. -""" -type PackageVersion implements Node { - """ - List of files associated with this package version - """ - files( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering of the returned package files. - """ - orderBy: PackageFileOrder = {field: CREATED_AT, direction: ASC} - ): PackageFileConnection! - id: ID! - - """ - The package associated with this version. - """ - package: Package - - """ - The platform this version was built for. - """ - platform: String - - """ - Whether or not this version is a pre-release. - """ - preRelease: Boolean! - - """ - The README of this package version. - """ - readme: String - - """ - The release associated with this package version. - """ - release: Release - - """ - Statistics about package activity. - """ - statistics: PackageVersionStatistics - - """ - The package version summary. - """ - summary: String - - """ - The version string. - """ - version: String! -} - -""" -The connection type for PackageVersion. -""" -type PackageVersionConnection { - """ - A list of edges. - """ - edges: [PackageVersionEdge] - - """ - A list of nodes. - """ - nodes: [PackageVersion] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PackageVersionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PackageVersion -} - -""" -Ways in which lists of package versions can be ordered upon return. -""" -input PackageVersionOrder { - """ - The direction in which to order package versions by the specified field. - """ - direction: OrderDirection - - """ - The field in which to order package versions by. - """ - field: PackageVersionOrderField -} - -""" -Properties by which package version connections can be ordered. -""" -enum PackageVersionOrderField { - """ - Order package versions by creation time - """ - CREATED_AT -} - -""" -Represents a object that contains package version activity statistics such as downloads. -""" -type PackageVersionStatistics { - """ - Number of times the package was downloaded since it was created. - """ - downloadsTotalCount: Int! -} - -""" -Information about pagination in a connection. -""" -type PageInfo { - """ - When paginating forwards, the cursor to continue. - """ - endCursor: String - - """ - When paginating forwards, are there more items? - """ - hasNextPage: Boolean! - - """ - When paginating backwards, are there more items? - """ - hasPreviousPage: Boolean! - - """ - When paginating backwards, the cursor to continue. - """ - startCursor: String -} - -""" -Types that can grant permissions on a repository to a user -""" -union PermissionGranter = Organization | Repository | Team - -""" -A level of permission and source for a user's access to a repository. -""" -type PermissionSource { - """ - The organization the repository belongs to. - """ - organization: Organization! - - """ - The level of access this source has granted to the user. - """ - permission: DefaultRepositoryPermissionField! - - """ - The source of this permission. - """ - source: PermissionGranter! -} - -""" -Autogenerated input type of PinIssue -""" -input PinIssueInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the issue to be pinned - """ - issueId: ID! @possibleTypes(concreteTypes: ["Issue"]) -} - -""" -Autogenerated return type of PinIssue -""" -type PinIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue that was pinned - """ - issue: Issue -} - -""" -Types that can be pinned to a profile page. -""" -union PinnableItem = Gist | Repository - -""" -The connection type for PinnableItem. -""" -type PinnableItemConnection { - """ - A list of edges. - """ - edges: [PinnableItemEdge] - - """ - A list of nodes. - """ - nodes: [PinnableItem] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PinnableItemEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PinnableItem -} - -""" -Represents items that can be pinned to a profile page or dashboard. -""" -enum PinnableItemType { - """ - A gist. - """ - GIST - - """ - An issue. - """ - ISSUE - - """ - An organization. - """ - ORGANIZATION - - """ - A project. - """ - PROJECT - - """ - A pull request. - """ - PULL_REQUEST - - """ - A repository. - """ - REPOSITORY - - """ - A team. - """ - TEAM - - """ - A user. - """ - USER -} - -""" -Represents a 'pinned' event on a given issue or pull request. -""" -type PinnedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the issue associated with the event. - """ - issue: Issue! -} - -""" -A Pinned Issue is a issue pinned to a repository's index page. -""" -type PinnedIssue implements Node @preview(toggledBy: "elektra-preview") { - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - The issue that was pinned. - """ - issue: Issue! - - """ - The actor that pinned this issue. - """ - pinnedBy: Actor! - - """ - The repository that this issue was pinned to. - """ - repository: Repository! -} - -""" -The connection type for PinnedIssue. -""" -type PinnedIssueConnection @preview(toggledBy: "elektra-preview") { - """ - A list of edges. - """ - edges: [PinnedIssueEdge] - - """ - A list of nodes. - """ - nodes: [PinnedIssue] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PinnedIssueEdge @preview(toggledBy: "elektra-preview") { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PinnedIssue -} - -""" -An ISO-8601 encoded UTC date string with millisecond precison. -""" -scalar PreciseDateTime - -""" -Audit log entry for a private_repository_forking.disable event. -""" -type PrivateRepositoryForkingDisableAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a private_repository_forking.enable event. -""" -type PrivateRepositoryForkingEnableAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -A curatable list of repositories relating to a repository owner, which defaults -to showing the most popular repositories they own. -""" -type ProfileItemShowcase { - """ - Whether or not the owner has pinned any repositories or gists. - """ - hasPinnedItems: Boolean! - - """ - The repositories and gists in the showcase. If the profile owner has any - pinned items, those will be returned. Otherwise, the profile owner's popular - repositories will be returned. - """ - items( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PinnableItemConnection! -} - -""" -Represents any entity on GitHub that has a profile page. -""" -interface ProfileOwner { - """ - Determine if this repository owner has any items that can be pinned to their profile. - """ - anyPinnableItems( - """ - Filter to only a particular kind of pinnable item. - """ - type: PinnableItemType - ): Boolean! - - """ - The public profile email. - """ - email: String - id: ID! - - """ - Showcases a selection of repositories and gists that the profile owner has - either curated or that have been selected automatically based on popularity. - """ - itemShowcase: ProfileItemShowcase! - - """ - The public profile location. - """ - location: String - - """ - The username used to login. - """ - login: String! - - """ - The public profile name. - """ - name: String - - """ - A list of repositories and gists this profile owner can pin to their profile. - """ - pinnableItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter the types of pinnable items that are returned. - """ - types: [PinnableItemType!] - ): PinnableItemConnection! - - """ - A list of repositories and gists this profile owner has pinned to their profile - """ - pinnedItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter the types of pinned items that are returned. - """ - types: [PinnableItemType!] - ): PinnableItemConnection! - - """ - Returns how many more items this profile owner can pin to their profile. - """ - pinnedItemsRemaining: Int! - - """ - Can the viewer pin repositories and gists to the profile? - """ - viewerCanChangePinnedItems: Boolean! - - """ - The public profile website URL. - """ - websiteUrl: URI -} - -""" -Projects manage issues, pull requests and notes within a project owner. -""" -type Project implements Closable & Node & Updatable { - """ - The project's description body. - """ - body: String - - """ - The projects description body rendered to HTML. - """ - bodyHTML: HTML! - - """ - `true` if the object is closed (definition of closed may depend on type) - """ - closed: Boolean! - - """ - Identifies the date and time when the object was closed. - """ - closedAt: DateTime - - """ - List of columns in the project - """ - columns( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ProjectColumnConnection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The actor who originally created the project. - """ - creator: Actor - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - The project's name. - """ - name: String! - - """ - The project's number. - """ - number: Int! - - """ - The project's owner. Currently limited to repositories, organizations, and users. - """ - owner: ProjectOwner! - - """ - List of pending cards in this project - """ - pendingCards( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - A list of archived states to filter the cards by - """ - archivedStates: [ProjectCardArchivedState] = [ARCHIVED, NOT_ARCHIVED] - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ProjectCardConnection! - - """ - The HTTP path for this project - """ - resourcePath: URI! - - """ - Whether the project is open or closed. - """ - state: ProjectState! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this project - """ - url: URI! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! -} - -""" -A card in a project. -""" -type ProjectCard implements Node { - """ - The project column this card is associated under. A card may only belong to one - project column at a time. The column field will be null if the card is created - in a pending state and has yet to be associated with a column. Once cards are - associated with a column, they will not become pending in the future. - """ - column: ProjectColumn - - """ - The card content item - """ - content: ProjectCardItem - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The actor who created this card - """ - creator: Actor - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - Whether the card is archived - """ - isArchived: Boolean! - - """ - The card note - """ - note: String - - """ - The project that contains this card. - """ - project: Project! - - """ - The HTTP path for this card - """ - resourcePath: URI! - - """ - The state of ProjectCard - """ - state: ProjectCardState - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this card - """ - url: URI! -} - -""" -The possible archived states of a project card. -""" -enum ProjectCardArchivedState { - """ - A project card that is archived - """ - ARCHIVED - - """ - A project card that is not archived - """ - NOT_ARCHIVED -} - -""" -The connection type for ProjectCard. -""" -type ProjectCardConnection { - """ - A list of edges. - """ - edges: [ProjectCardEdge] - - """ - A list of nodes. - """ - nodes: [ProjectCard] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ProjectCardEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: ProjectCard -} - -""" -An issue or PR and its owning repository to be used in a project card. -""" -input ProjectCardImport { - """ - The issue or pull request number. - """ - number: Int! - - """ - Repository name with owner (owner/repository). - """ - repository: String! -} - -""" -Types that can be inside Project Cards. -""" -union ProjectCardItem = Issue | PullRequest - -""" -Various content states of a ProjectCard -""" -enum ProjectCardState { - """ - The card has content only. - """ - CONTENT_ONLY - - """ - The card has a note only. - """ - NOTE_ONLY - - """ - The card is redacted. - """ - REDACTED -} - -""" -A column inside a project. -""" -type ProjectColumn implements Node { - """ - List of cards in the column - """ - cards( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - A list of archived states to filter the cards by - """ - archivedStates: [ProjectCardArchivedState] = [ARCHIVED, NOT_ARCHIVED] - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ProjectCardConnection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - The project column's name. - """ - name: String! - - """ - The project that contains this column. - """ - project: Project! - - """ - The semantic purpose of the column - """ - purpose: ProjectColumnPurpose - - """ - The HTTP path for this project column - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this project column - """ - url: URI! -} - -""" -The connection type for ProjectColumn. -""" -type ProjectColumnConnection { - """ - A list of edges. - """ - edges: [ProjectColumnEdge] - - """ - A list of nodes. - """ - nodes: [ProjectColumn] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ProjectColumnEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: ProjectColumn -} - -""" -A project column and a list of its issues and PRs. -""" -input ProjectColumnImport { - """ - The name of the column. - """ - columnName: String! - - """ - A list of issues and pull requests in the column. - """ - issues: [ProjectCardImport!] - - """ - The position of the column, starting from 0. - """ - position: Int! -} - -""" -The semantic purpose of the column - todo, in progress, or done. -""" -enum ProjectColumnPurpose { - """ - The column contains cards which are complete - """ - DONE - - """ - The column contains cards which are currently being worked on - """ - IN_PROGRESS - - """ - The column contains cards still to be worked on - """ - TODO -} - -""" -A list of projects associated with the owner. -""" -type ProjectConnection { - """ - A list of edges. - """ - edges: [ProjectEdge] - - """ - A list of nodes. - """ - nodes: [Project] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ProjectEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Project -} - -""" -Ways in which lists of projects can be ordered upon return. -""" -input ProjectOrder { - """ - The direction in which to order projects by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order projects by. - """ - field: ProjectOrderField! -} - -""" -Properties by which project connections can be ordered. -""" -enum ProjectOrderField { - """ - Order projects by creation time - """ - CREATED_AT - - """ - Order projects by name - """ - NAME - - """ - Order projects by update time - """ - UPDATED_AT -} - -""" -Represents an owner of a Project. -""" -interface ProjectOwner { - id: ID! - - """ - Find project by number. - """ - project( - """ - The project number to find. - """ - number: Int! - ): Project - - """ - A list of projects under the owner. - """ - projects( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for projects returned from the connection - """ - orderBy: ProjectOrder - - """ - Query to search projects by, currently only searching by name. - """ - search: String - - """ - A list of states to filter the projects by. - """ - states: [ProjectState!] - ): ProjectConnection! - - """ - The HTTP path listing owners projects - """ - projectsResourcePath: URI! - - """ - The HTTP URL listing owners projects - """ - projectsUrl: URI! - - """ - Can the current viewer create new projects on this owner. - """ - viewerCanCreateProjects: Boolean! -} - -""" -State of the project; either 'open' or 'closed' -""" -enum ProjectState { - """ - The project is closed. - """ - CLOSED - - """ - The project is open. - """ - OPEN -} - -""" -GitHub-provided templates for Projects -""" -enum ProjectTemplate { - """ - Create a board with v2 triggers to automatically move cards across To do, In progress and Done columns. - """ - AUTOMATED_KANBAN_V2 - - """ - Create a board with triggers to automatically move cards across columns with review automation. - """ - AUTOMATED_REVIEWS_KANBAN - - """ - Create a board with columns for To do, In progress and Done. - """ - BASIC_KANBAN - - """ - Create a board to triage and prioritize bugs with To do, priority, and Done columns. - """ - BUG_TRIAGE -} - -""" -A user's public key. -""" -type PublicKey implements Node { - """ - The last time this authorization was used to perform an action. Values will be null for keys not owned by the user. - """ - accessedAt: DateTime - - """ - Identifies the date and time when the key was created. Keys created before - March 5th, 2014 have inaccurate values. Values will be null for keys not owned by the user. - """ - createdAt: DateTime - - """ - The fingerprint for this PublicKey. - """ - fingerprint: String! - id: ID! - - """ - Whether this PublicKey is read-only or not. Values will be null for keys not owned by the user. - """ - isReadOnly: Boolean - - """ - The public key string. - """ - key: String! - - """ - Identifies the date and time when the key was updated. Keys created before - March 5th, 2014 may have inaccurate values. Values will be null for keys not - owned by the user. - """ - updatedAt: DateTime -} - -""" -The connection type for PublicKey. -""" -type PublicKeyConnection { - """ - A list of edges. - """ - edges: [PublicKeyEdge] - - """ - A list of nodes. - """ - nodes: [PublicKey] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PublicKeyEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PublicKey -} - -""" -A repository pull request. -""" -type PullRequest implements Assignable & Closable & Comment & Labelable & Lockable & Node & Reactable & RepositoryNode & Subscribable & UniformResourceLocatable & Updatable & UpdatableComment { - """ - Reason that the conversation was locked. - """ - activeLockReason: LockReason - - """ - The number of additions in this pull request. - """ - additions: Int! - - """ - A list of Users assigned to this object. - """ - assignees( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! - - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - Identifies the base Ref associated with the pull request. - """ - baseRef: Ref - - """ - Identifies the name of the base Ref associated with the pull request, even if the ref has been deleted. - """ - baseRefName: String! - - """ - Identifies the oid of the base ref associated with the pull request, even if the ref has been deleted. - """ - baseRefOid: GitObjectID! - - """ - The repository associated with this pull request's base Ref. - """ - baseRepository: Repository - - """ - The body as Markdown. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - Whether or not the pull request is rebaseable. - """ - canBeRebased: Boolean! @preview(toggledBy: "merge-info-preview") - - """ - The number of changed files in this pull request. - """ - changedFiles: Int! - - """ - The HTTP path for the checks of this pull request. - """ - checksResourcePath: URI! - - """ - The HTTP URL for the checks of this pull request. - """ - checksUrl: URI! - - """ - `true` if the pull request is closed - """ - closed: Boolean! - - """ - Identifies the date and time when the object was closed. - """ - closedAt: DateTime - - """ - A list of comments associated with the pull request. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): IssueCommentConnection! - - """ - A list of commits present in this pull request's head branch not present in the base branch. - """ - commits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PullRequestCommitConnection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The number of deletions in this pull request. - """ - deletions: Int! - - """ - The actor who edited this pull request's body. - """ - editor: Actor - - """ - Lists the files changed within this pull request. - """ - files( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PullRequestChangedFileConnection - - """ - Identifies the head Ref associated with the pull request. - """ - headRef: Ref - - """ - Identifies the name of the head Ref associated with the pull request, even if the ref has been deleted. - """ - headRefName: String! - - """ - Identifies the oid of the head ref associated with the pull request, even if the ref has been deleted. - """ - headRefOid: GitObjectID! - - """ - The repository associated with this pull request's head Ref. - """ - headRepository: Repository - - """ - The owner of the repository associated with this pull request's head Ref. - """ - headRepositoryOwner: RepositoryOwner - - """ - The hovercard information for this issue - """ - hovercard( - """ - Whether or not to include notification contexts - """ - includeNotificationContexts: Boolean = true - ): Hovercard! - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - The head and base repositories are different. - """ - isCrossRepository: Boolean! - - """ - Identifies if the pull request is a draft. - """ - isDraft: Boolean! - - """ - A list of labels associated with the object. - """ - labels( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for labels returned from the connection. - """ - orderBy: LabelOrder = {field: CREATED_AT, direction: ASC} - ): LabelConnection - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - `true` if the pull request is locked - """ - locked: Boolean! - - """ - Indicates whether maintainers can modify the pull request. - """ - maintainerCanModify: Boolean! - - """ - The commit that was created when this pull request was merged. - """ - mergeCommit: Commit - - """ - Detailed information about the current pull request merge state status. - """ - mergeStateStatus: MergeStateStatus! @preview(toggledBy: "merge-info-preview") - - """ - Whether or not the pull request can be merged based on the existence of merge conflicts. - """ - mergeable: MergeableState! - - """ - Whether or not the pull request was merged. - """ - merged: Boolean! - - """ - The date and time that the pull request was merged. - """ - mergedAt: DateTime - - """ - The actor who merged the pull request. - """ - mergedBy: Actor - - """ - Identifies the milestone associated with the pull request. - """ - milestone: Milestone - - """ - Identifies the pull request number. - """ - number: Int! - - """ - A list of Users that are participating in the Pull Request conversation. - """ - participants( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! - - """ - The permalink to the pull request. - """ - permalink: URI! - - """ - The commit that GitHub automatically generated to test if this pull request - could be merged. This field will not return a value if the pull request is - merged, or if the test merge commit is still being generated. See the - `mergeable` field for more details on the mergeability of the pull request. - """ - potentialMergeCommit: Commit - - """ - List of project cards associated with this pull request. - """ - projectCards( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - A list of archived states to filter the cards by - """ - archivedStates: [ProjectCardArchivedState] = [ARCHIVED, NOT_ARCHIVED] - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ProjectCardConnection! - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The repository associated with this node. - """ - repository: Repository! - - """ - The HTTP path for this pull request. - """ - resourcePath: URI! - - """ - The HTTP path for reverting this pull request. - """ - revertResourcePath: URI! - - """ - The HTTP URL for reverting this pull request. - """ - revertUrl: URI! - - """ - The current status of this pull request with respect to code review. - """ - reviewDecision: PullRequestReviewDecision - - """ - A list of review requests associated with the pull request. - """ - reviewRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ReviewRequestConnection - - """ - The list of all review threads for this pull request. - """ - reviewThreads( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PullRequestReviewThreadConnection! - - """ - A list of reviews associated with the pull request. - """ - reviews( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Filter by author of the review. - """ - author: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - A list of states to filter the reviews. - """ - states: [PullRequestReviewState!] - ): PullRequestReviewConnection - - """ - Identifies the state of the pull request. - """ - state: PullRequestState! - - """ - A list of reviewer suggestions based on commit history and past review comments. - """ - suggestedReviewers: [SuggestedReviewer]! - - """ - A list of events, comments, commits, etc. associated with the pull request. - """ - timeline( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows filtering timeline events by a `since` timestamp. - """ - since: DateTime - ): PullRequestTimelineConnection! @deprecated(reason: "`timeline` will be removed Use PullRequest.timelineItems instead. Removal on 2020-10-01 UTC.") - - """ - A list of events, comments, commits, etc. associated with the pull request. - """ - timelineItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Filter timeline items by type. - """ - itemTypes: [PullRequestTimelineItemsItemType!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter timeline items by a `since` timestamp. - """ - since: DateTime - - """ - Skips the first _n_ elements in the list. - """ - skip: Int - ): PullRequestTimelineItemsConnection! - - """ - Identifies the pull request title. - """ - title: String! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this pull request. - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Whether or not the viewer can apply suggestion. - """ - viewerCanApplySuggestion: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState -} - -""" -A file changed in a pull request. -""" -type PullRequestChangedFile { - """ - The number of additions to the file. - """ - additions: Int! - - """ - The number of deletions to the file. - """ - deletions: Int! - - """ - The path of the file. - """ - path: String! -} - -""" -The connection type for PullRequestChangedFile. -""" -type PullRequestChangedFileConnection { - """ - A list of edges. - """ - edges: [PullRequestChangedFileEdge] - - """ - A list of nodes. - """ - nodes: [PullRequestChangedFile] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PullRequestChangedFileEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestChangedFile -} - -""" -Represents a Git commit part of a pull request. -""" -type PullRequestCommit implements Node & UniformResourceLocatable { - """ - The Git commit object - """ - commit: Commit! - id: ID! - - """ - The pull request this commit belongs to - """ - pullRequest: PullRequest! - - """ - The HTTP path for this pull request commit - """ - resourcePath: URI! - - """ - The HTTP URL for this pull request commit - """ - url: URI! -} - -""" -Represents a commit comment thread part of a pull request. -""" -type PullRequestCommitCommentThread implements Node & RepositoryNode { - """ - The comments that exist in this thread. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CommitCommentConnection! - - """ - The commit the comments were made on. - """ - commit: Commit! - id: ID! - - """ - The file the comments were made on. - """ - path: String - - """ - The position in the diff for the commit that the comment was made on. - """ - position: Int - - """ - The pull request this commit comment thread belongs to - """ - pullRequest: PullRequest! - - """ - The repository associated with this node. - """ - repository: Repository! -} - -""" -The connection type for PullRequestCommit. -""" -type PullRequestCommitConnection { - """ - A list of edges. - """ - edges: [PullRequestCommitEdge] - - """ - A list of nodes. - """ - nodes: [PullRequestCommit] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PullRequestCommitEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestCommit -} - -""" -The connection type for PullRequest. -""" -type PullRequestConnection { - """ - A list of edges. - """ - edges: [PullRequestEdge] - - """ - A list of nodes. - """ - nodes: [PullRequest] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -This aggregates pull requests opened by a user within one repository. -""" -type PullRequestContributionsByRepository { - """ - The pull request contributions. - """ - contributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedPullRequestContributionConnection! - - """ - The repository in which the pull requests were opened. - """ - repository: Repository! -} - -""" -An edge in a connection. -""" -type PullRequestEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequest -} - -""" -Represents available types of methods to use when merging a pull request. -""" -enum PullRequestMergeMethod { - """ - Add all commits from the head branch to the base branch with a merge commit. - """ - MERGE - - """ - Add all commits from the head branch onto the base branch individually. - """ - REBASE - - """ - Combine all commits from the head branch into a single commit in the base branch. - """ - SQUASH -} - -""" -Ways in which lists of issues can be ordered upon return. -""" -input PullRequestOrder { - """ - The direction in which to order pull requests by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order pull requests by. - """ - field: PullRequestOrderField! -} - -""" -Properties by which pull_requests connections can be ordered. -""" -enum PullRequestOrderField { - """ - Order pull_requests by creation time - """ - CREATED_AT - - """ - Order pull_requests by update time - """ - UPDATED_AT -} - -""" -A review object for a given pull request. -""" -type PullRequestReview implements Comment & Deletable & Node & Reactable & RepositoryNode & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - Identifies the pull request review body. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body of this review rendered as plain text. - """ - bodyText: String! - - """ - A list of review comments for the current pull request review. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PullRequestReviewCommentConnection! - - """ - Identifies the commit associated with this pull request review. - """ - commit: Commit - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - A list of teams that this review was made on behalf of. - """ - onBehalfOf( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): TeamConnection! - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - Identifies the pull request associated with this pull request review. - """ - pullRequest: PullRequest! - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The repository associated with this node. - """ - repository: Repository! - - """ - The HTTP path permalink for this PullRequestReview. - """ - resourcePath: URI! - - """ - Identifies the current state of the pull request review. - """ - state: PullRequestReviewState! - - """ - Identifies when the Pull Request Review was submitted - """ - submittedAt: DateTime - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL permalink for this PullRequestReview. - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -A review comment associated with a given repository pull request. -""" -type PullRequestReviewComment implements Comment & Deletable & Minimizable & Node & Reactable & RepositoryNode & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the subject of the comment. - """ - authorAssociation: CommentAuthorAssociation! - - """ - The comment body of this review comment. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The comment body of this review comment rendered as plain text. - """ - bodyText: String! - - """ - Identifies the commit associated with the comment. - """ - commit: Commit - - """ - Identifies when the comment was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The diff hunk to which the comment applies. - """ - diffHunk: String! - - """ - Identifies when the comment was created in a draft state. - """ - draftedAt: DateTime! - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - Returns whether or not a comment has been minimized. - """ - isMinimized: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Returns why the comment was minimized. - """ - minimizedReason: String - - """ - Identifies the original commit associated with the comment. - """ - originalCommit: Commit - - """ - The original line index in the diff to which the comment applies. - """ - originalPosition: Int! - - """ - Identifies when the comment body is outdated - """ - outdated: Boolean! - - """ - The path to which the comment applies. - """ - path: String! - - """ - The line index in the diff to which the comment applies. - """ - position: Int - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - The pull request associated with this review comment. - """ - pullRequest: PullRequest! - - """ - The pull request review associated with this review comment. - """ - pullRequestReview: PullRequestReview - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The comment this is a reply to. - """ - replyTo: PullRequestReviewComment - - """ - The repository associated with this node. - """ - repository: Repository! - - """ - The HTTP path permalink for this review comment. - """ - resourcePath: URI! - - """ - Identifies the state of the comment. - """ - state: PullRequestReviewCommentState! - - """ - Identifies when the comment was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL permalink for this review comment. - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Check if the current viewer can minimize this object. - """ - viewerCanMinimize: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -The connection type for PullRequestReviewComment. -""" -type PullRequestReviewCommentConnection { - """ - A list of edges. - """ - edges: [PullRequestReviewCommentEdge] - - """ - A list of nodes. - """ - nodes: [PullRequestReviewComment] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PullRequestReviewCommentEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestReviewComment -} - -""" -The possible states of a pull request review comment. -""" -enum PullRequestReviewCommentState { - """ - A comment that is part of a pending review - """ - PENDING - - """ - A comment that is part of a submitted review - """ - SUBMITTED -} - -""" -The connection type for PullRequestReview. -""" -type PullRequestReviewConnection { - """ - A list of edges. - """ - edges: [PullRequestReviewEdge] - - """ - A list of nodes. - """ - nodes: [PullRequestReview] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -This aggregates pull request reviews made by a user within one repository. -""" -type PullRequestReviewContributionsByRepository { - """ - The pull request review contributions. - """ - contributions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for contributions returned from the connection. - """ - orderBy: ContributionOrder = {direction: DESC} - ): CreatedPullRequestReviewContributionConnection! - - """ - The repository in which the pull request reviews were made. - """ - repository: Repository! -} - -""" -The review status of a pull request. -""" -enum PullRequestReviewDecision { - """ - The pull request has received an approving review. - """ - APPROVED - - """ - Changes have been requested on the pull request. - """ - CHANGES_REQUESTED - - """ - A review is required before the pull request can be merged. - """ - REVIEW_REQUIRED -} - -""" -An edge in a connection. -""" -type PullRequestReviewEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestReview -} - -""" -The possible events to perform on a pull request review. -""" -enum PullRequestReviewEvent { - """ - Submit feedback and approve merging these changes. - """ - APPROVE - - """ - Submit general feedback without explicit approval. - """ - COMMENT - - """ - Dismiss review so it now longer effects merging. - """ - DISMISS - - """ - Submit feedback that must be addressed before merging. - """ - REQUEST_CHANGES -} - -""" -The possible states of a pull request review. -""" -enum PullRequestReviewState { - """ - A review allowing the pull request to merge. - """ - APPROVED - - """ - A review blocking the pull request from merging. - """ - CHANGES_REQUESTED - - """ - An informational review. - """ - COMMENTED - - """ - A review that has been dismissed. - """ - DISMISSED - - """ - A review that has not yet been submitted. - """ - PENDING -} - -""" -A threaded list of comments for a given pull request. -""" -type PullRequestReviewThread implements Node { - """ - A list of pull request comments associated with the thread. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Skips the first _n_ elements in the list. - """ - skip: Int - ): PullRequestReviewCommentConnection! - - """ - The side of the diff on which this thread was placed. - """ - diffSide: DiffSide! - id: ID! - - """ - Whether this thread has been resolved - """ - isResolved: Boolean! - - """ - The line in the file to which this thread refers - """ - line: Int - - """ - The original line in the file to which this thread refers. - """ - originalLine: Int - - """ - The original start line in the file to which this thread refers (multi-line only). - """ - originalStartLine: Int - - """ - Identifies the pull request associated with this thread. - """ - pullRequest: PullRequest! - - """ - Identifies the repository associated with this thread. - """ - repository: Repository! - - """ - The user who resolved this thread - """ - resolvedBy: User - - """ - The side of the diff that the first line of the thread starts on (multi-line only) - """ - startDiffSide: DiffSide - - """ - The start line in the file to which this thread refers (multi-line only) - """ - startLine: Int - - """ - Whether or not the viewer can resolve this thread - """ - viewerCanResolve: Boolean! - - """ - Whether or not the viewer can unresolve this thread - """ - viewerCanUnresolve: Boolean! -} - -""" -Review comment threads for a pull request review. -""" -type PullRequestReviewThreadConnection { - """ - A list of edges. - """ - edges: [PullRequestReviewThreadEdge] - - """ - A list of nodes. - """ - nodes: [PullRequestReviewThread] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PullRequestReviewThreadEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestReviewThread -} - -""" -Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. -""" -type PullRequestRevisionMarker { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The last commit the viewer has seen. - """ - lastSeenCommit: Commit! - - """ - The pull request to which the marker belongs. - """ - pullRequest: PullRequest! -} - -""" -The possible states of a pull request. -""" -enum PullRequestState { - """ - A pull request that has been closed without being merged. - """ - CLOSED - - """ - A pull request that has been closed by being merged. - """ - MERGED - - """ - A pull request that is still open. - """ - OPEN -} - -""" -The connection type for PullRequestTimelineItem. -""" -type PullRequestTimelineConnection { - """ - A list of edges. - """ - edges: [PullRequestTimelineItemEdge] - - """ - A list of nodes. - """ - nodes: [PullRequestTimelineItem] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An item in an pull request timeline -""" -union PullRequestTimelineItem = AssignedEvent | BaseRefForcePushedEvent | ClosedEvent | Commit | CommitCommentThread | CrossReferencedEvent | DemilestonedEvent | DeployedEvent | DeploymentEnvironmentChangedEvent | HeadRefDeletedEvent | HeadRefForcePushedEvent | HeadRefRestoredEvent | IssueComment | LabeledEvent | LockedEvent | MergedEvent | MilestonedEvent | PullRequestReview | PullRequestReviewComment | PullRequestReviewThread | ReferencedEvent | RenamedTitleEvent | ReopenedEvent | ReviewDismissedEvent | ReviewRequestRemovedEvent | ReviewRequestedEvent | SubscribedEvent | UnassignedEvent | UnlabeledEvent | UnlockedEvent | UnsubscribedEvent | UserBlockedEvent - -""" -An edge in a connection. -""" -type PullRequestTimelineItemEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestTimelineItem -} - -""" -An item in a pull request timeline -""" -union PullRequestTimelineItems = AddedToProjectEvent | AssignedEvent | AutomaticBaseChangeFailedEvent | AutomaticBaseChangeSucceededEvent | BaseRefChangedEvent | BaseRefForcePushedEvent | ClosedEvent | CommentDeletedEvent | ConnectedEvent | ConvertToDraftEvent | ConvertedNoteToIssueEvent | CrossReferencedEvent | DemilestonedEvent | DeployedEvent | DeploymentEnvironmentChangedEvent | DisconnectedEvent | HeadRefDeletedEvent | HeadRefForcePushedEvent | HeadRefRestoredEvent | IssueComment | LabeledEvent | LockedEvent | MarkedAsDuplicateEvent | MentionedEvent | MergedEvent | MilestonedEvent | MovedColumnsInProjectEvent | PinnedEvent | PullRequestCommit | PullRequestCommitCommentThread | PullRequestReview | PullRequestReviewThread | PullRequestRevisionMarker | ReadyForReviewEvent | ReferencedEvent | RemovedFromProjectEvent | RenamedTitleEvent | ReopenedEvent | ReviewDismissedEvent | ReviewRequestRemovedEvent | ReviewRequestedEvent | SubscribedEvent | TransferredEvent | UnassignedEvent | UnlabeledEvent | UnlockedEvent | UnmarkedAsDuplicateEvent | UnpinnedEvent | UnsubscribedEvent | UserBlockedEvent - -""" -The connection type for PullRequestTimelineItems. -""" -type PullRequestTimelineItemsConnection { - """ - A list of edges. - """ - edges: [PullRequestTimelineItemsEdge] - - """ - Identifies the count of items after applying `before` and `after` filters. - """ - filteredCount: Int! - - """ - A list of nodes. - """ - nodes: [PullRequestTimelineItems] - - """ - Identifies the count of items after applying `before`/`after` filters and `first`/`last`/`skip` slicing. - """ - pageCount: Int! - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! - - """ - Identifies the date and time when the timeline was last updated. - """ - updatedAt: DateTime! -} - -""" -An edge in a connection. -""" -type PullRequestTimelineItemsEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PullRequestTimelineItems -} - -""" -The possible item types found in a timeline. -""" -enum PullRequestTimelineItemsItemType { - """ - Represents a 'added_to_project' event on a given issue or pull request. - """ - ADDED_TO_PROJECT_EVENT - - """ - Represents an 'assigned' event on any assignable object. - """ - ASSIGNED_EVENT - - """ - Represents a 'automatic_base_change_failed' event on a given pull request. - """ - AUTOMATIC_BASE_CHANGE_FAILED_EVENT - - """ - Represents a 'automatic_base_change_succeeded' event on a given pull request. - """ - AUTOMATIC_BASE_CHANGE_SUCCEEDED_EVENT - - """ - Represents a 'base_ref_changed' event on a given issue or pull request. - """ - BASE_REF_CHANGED_EVENT - - """ - Represents a 'base_ref_force_pushed' event on a given pull request. - """ - BASE_REF_FORCE_PUSHED_EVENT - - """ - Represents a 'closed' event on any `Closable`. - """ - CLOSED_EVENT - - """ - Represents a 'comment_deleted' event on a given issue or pull request. - """ - COMMENT_DELETED_EVENT - - """ - Represents a 'connected' event on a given issue or pull request. - """ - CONNECTED_EVENT - - """ - Represents a 'converted_note_to_issue' event on a given issue or pull request. - """ - CONVERTED_NOTE_TO_ISSUE_EVENT - - """ - Represents a 'convert_to_draft' event on a given pull request. - """ - CONVERT_TO_DRAFT_EVENT - - """ - Represents a mention made by one issue or pull request to another. - """ - CROSS_REFERENCED_EVENT - - """ - Represents a 'demilestoned' event on a given issue or pull request. - """ - DEMILESTONED_EVENT - - """ - Represents a 'deployed' event on a given pull request. - """ - DEPLOYED_EVENT - - """ - Represents a 'deployment_environment_changed' event on a given pull request. - """ - DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT - - """ - Represents a 'disconnected' event on a given issue or pull request. - """ - DISCONNECTED_EVENT - - """ - Represents a 'head_ref_deleted' event on a given pull request. - """ - HEAD_REF_DELETED_EVENT - - """ - Represents a 'head_ref_force_pushed' event on a given pull request. - """ - HEAD_REF_FORCE_PUSHED_EVENT - - """ - Represents a 'head_ref_restored' event on a given pull request. - """ - HEAD_REF_RESTORED_EVENT - - """ - Represents a comment on an Issue. - """ - ISSUE_COMMENT - - """ - Represents a 'labeled' event on a given issue or pull request. - """ - LABELED_EVENT - - """ - Represents a 'locked' event on a given issue or pull request. - """ - LOCKED_EVENT - - """ - Represents a 'marked_as_duplicate' event on a given issue or pull request. - """ - MARKED_AS_DUPLICATE_EVENT - - """ - Represents a 'mentioned' event on a given issue or pull request. - """ - MENTIONED_EVENT - - """ - Represents a 'merged' event on a given pull request. - """ - MERGED_EVENT - - """ - Represents a 'milestoned' event on a given issue or pull request. - """ - MILESTONED_EVENT - - """ - Represents a 'moved_columns_in_project' event on a given issue or pull request. - """ - MOVED_COLUMNS_IN_PROJECT_EVENT - - """ - Represents a 'pinned' event on a given issue or pull request. - """ - PINNED_EVENT - - """ - Represents a Git commit part of a pull request. - """ - PULL_REQUEST_COMMIT - - """ - Represents a commit comment thread part of a pull request. - """ - PULL_REQUEST_COMMIT_COMMENT_THREAD - - """ - A review object for a given pull request. - """ - PULL_REQUEST_REVIEW - - """ - A threaded list of comments for a given pull request. - """ - PULL_REQUEST_REVIEW_THREAD - - """ - Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. - """ - PULL_REQUEST_REVISION_MARKER - - """ - Represents a 'ready_for_review' event on a given pull request. - """ - READY_FOR_REVIEW_EVENT - - """ - Represents a 'referenced' event on a given `ReferencedSubject`. - """ - REFERENCED_EVENT - - """ - Represents a 'removed_from_project' event on a given issue or pull request. - """ - REMOVED_FROM_PROJECT_EVENT - - """ - Represents a 'renamed' event on a given issue or pull request - """ - RENAMED_TITLE_EVENT - - """ - Represents a 'reopened' event on any `Closable`. - """ - REOPENED_EVENT - - """ - Represents a 'review_dismissed' event on a given issue or pull request. - """ - REVIEW_DISMISSED_EVENT - - """ - Represents an 'review_requested' event on a given pull request. - """ - REVIEW_REQUESTED_EVENT - - """ - Represents an 'review_request_removed' event on a given pull request. - """ - REVIEW_REQUEST_REMOVED_EVENT - - """ - Represents a 'subscribed' event on a given `Subscribable`. - """ - SUBSCRIBED_EVENT - - """ - Represents a 'transferred' event on a given issue or pull request. - """ - TRANSFERRED_EVENT - - """ - Represents an 'unassigned' event on any assignable object. - """ - UNASSIGNED_EVENT - - """ - Represents an 'unlabeled' event on a given issue or pull request. - """ - UNLABELED_EVENT - - """ - Represents an 'unlocked' event on a given issue or pull request. - """ - UNLOCKED_EVENT - - """ - Represents an 'unmarked_as_duplicate' event on a given issue or pull request. - """ - UNMARKED_AS_DUPLICATE_EVENT - - """ - Represents an 'unpinned' event on a given issue or pull request. - """ - UNPINNED_EVENT - - """ - Represents an 'unsubscribed' event on a given `Subscribable`. - """ - UNSUBSCRIBED_EVENT - - """ - Represents a 'user_blocked' event on a given user. - """ - USER_BLOCKED_EVENT -} - -""" -The possible target states when updating a pull request. -""" -enum PullRequestUpdateState { - """ - A pull request that has been closed without being merged. - """ - CLOSED - - """ - A pull request that is still open. - """ - OPEN -} - -""" -A Git push. -""" -type Push implements Node @preview(toggledBy: "antiope-preview") { - id: ID! - - """ - The SHA after the push - """ - nextSha: GitObjectID - - """ - The permalink for this push. - """ - permalink: URI! - - """ - The SHA before the push - """ - previousSha: GitObjectID - - """ - The user who pushed - """ - pusher: User! - - """ - The repository that was pushed to - """ - repository: Repository! -} - -""" -A team, user or app who has the ability to push to a protected branch. -""" -type PushAllowance implements Node { - """ - The actor that can push. - """ - actor: PushAllowanceActor - - """ - Identifies the branch protection rule associated with the allowed user or team. - """ - branchProtectionRule: BranchProtectionRule - id: ID! -} - -""" -Types that can be an actor. -""" -union PushAllowanceActor = App | Team | User - -""" -The connection type for PushAllowance. -""" -type PushAllowanceConnection { - """ - A list of edges. - """ - edges: [PushAllowanceEdge] - - """ - A list of nodes. - """ - nodes: [PushAllowance] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type PushAllowanceEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: PushAllowance -} - -""" -The query root of GitHub's GraphQL interface. -""" -type Query { - """ - Look up a code of conduct by its key - """ - codeOfConduct( - """ - The code of conduct's key - """ - key: String! - ): CodeOfConduct - - """ - Look up a code of conduct by its key - """ - codesOfConduct: [CodeOfConduct] - - """ - Look up an enterprise by URL slug. - """ - enterprise( - """ - The enterprise invitation token. - """ - invitationToken: String - - """ - The enterprise URL slug. - """ - slug: String! - ): Enterprise - - """ - Look up a pending enterprise administrator invitation by invitee, enterprise and role. - """ - enterpriseAdministratorInvitation( - """ - The slug of the enterprise the user was invited to join. - """ - enterpriseSlug: String! - - """ - The role for the business member invitation. - """ - role: EnterpriseAdministratorRole! - - """ - The login of the user invited to join the business. - """ - userLogin: String! - ): EnterpriseAdministratorInvitation - - """ - Look up a pending enterprise administrator invitation by invitation token. - """ - enterpriseAdministratorInvitationByToken( - """ - The invitation token sent with the invitation email. - """ - invitationToken: String! - ): EnterpriseAdministratorInvitation - - """ - Look up an open source license by its key - """ - license( - """ - The license's downcased SPDX ID - """ - key: String! - ): License - - """ - Return a list of known open source licenses - """ - licenses: [License]! - - """ - Get alphabetically sorted list of Marketplace categories - """ - marketplaceCategories( - """ - Exclude categories with no listings. - """ - excludeEmpty: Boolean - - """ - Returns top level categories only, excluding any subcategories. - """ - excludeSubcategories: Boolean - - """ - Return only the specified categories. - """ - includeCategories: [String!] - ): [MarketplaceCategory!]! - - """ - Look up a Marketplace category by its slug. - """ - marketplaceCategory( - """ - The URL slug of the category. - """ - slug: String! - - """ - Also check topic aliases for the category slug - """ - useTopicAliases: Boolean - ): MarketplaceCategory - - """ - Look up a single Marketplace listing - """ - marketplaceListing( - """ - Select the listing that matches this slug. It's the short name of the listing used in its URL. - """ - slug: String! - ): MarketplaceListing - - """ - Look up Marketplace listings - """ - marketplaceListings( - """ - Select listings that can be administered by the specified user. - """ - adminId: ID - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Select listings visible to the viewer even if they are not approved. If omitted or - false, only approved listings will be returned. - """ - allStates: Boolean - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Select only listings with the given category. - """ - categorySlug: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Select listings for products owned by the specified organization. - """ - organizationId: ID - - """ - Select only listings where the primary category matches the given category slug. - """ - primaryCategoryOnly: Boolean = false - - """ - Select the listings with these slugs, if they are visible to the viewer. - """ - slugs: [String] - - """ - Also check topic aliases for the category slug - """ - useTopicAliases: Boolean - - """ - Select listings to which user has admin access. If omitted, listings visible to the - viewer are returned. - """ - viewerCanAdmin: Boolean - - """ - Select only listings that offer a free trial. - """ - withFreeTrialsOnly: Boolean = false - ): MarketplaceListingConnection! - - """ - Return information about the GitHub instance - """ - meta: GitHubMetadata! - - """ - Fetches an object given its ID. - """ - node( - """ - ID of the object. - """ - id: ID! - ): Node - - """ - Lookup nodes by a list of IDs. - """ - nodes( - """ - The list of node IDs. - """ - ids: [ID!]! - ): [Node]! - - """ - Lookup a organization by login. - """ - organization( - """ - The organization's login. - """ - login: String! - ): Organization - - """ - The client's rate limit information. - """ - rateLimit( - """ - If true, calculate the cost for the query without evaluating it - """ - dryRun: Boolean = false - ): RateLimit - - """ - Hack to workaround https://github.com/facebook/relay/issues/112 re-exposing the root query object - """ - relay: Query! - - """ - Lookup a given repository by the owner and repository name. - """ - repository( - """ - The name of the repository - """ - name: String! - - """ - The login field of a user or organization - """ - owner: String! - ): Repository - - """ - Lookup a repository owner (ie. either a User or an Organization) by login. - """ - repositoryOwner( - """ - The username to lookup the owner by. - """ - login: String! - ): RepositoryOwner - - """ - Lookup resource by a URL. - """ - resource( - """ - The URL. - """ - url: URI! - ): UniformResourceLocatable - - """ - Perform a search across resources. - """ - search( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - The search string to look for. - """ - query: String! - - """ - The types of search items to search within. - """ - type: SearchType! - ): SearchResultItemConnection! - - """ - GitHub Security Advisories - """ - securityAdvisories( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Filter advisories by identifier, e.g. GHSA or CVE. - """ - identifier: SecurityAdvisoryIdentifierFilter - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for the returned topics. - """ - orderBy: SecurityAdvisoryOrder = {field: UPDATED_AT, direction: DESC} - - """ - Filter advisories to those published since a time in the past. - """ - publishedSince: DateTime - - """ - Filter advisories to those updated since a time in the past. - """ - updatedSince: DateTime - ): SecurityAdvisoryConnection! - - """ - Fetch a Security Advisory by its GHSA ID - """ - securityAdvisory( - """ - GitHub Security Advisory ID. - """ - ghsaId: String! - ): SecurityAdvisory - - """ - Software Vulnerabilities documented by GitHub Security Advisories - """ - securityVulnerabilities( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - An ecosystem to filter vulnerabilities by. - """ - ecosystem: SecurityAdvisoryEcosystem - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for the returned topics. - """ - orderBy: SecurityVulnerabilityOrder = {field: UPDATED_AT, direction: DESC} - - """ - A package name to filter vulnerabilities by. - """ - package: String - - """ - A list of severities to filter vulnerabilities by. - """ - severities: [SecurityAdvisorySeverity!] - ): SecurityVulnerabilityConnection! - - """ - Look up a single Sponsors Listing - """ - sponsorsListing( - """ - Select the Sponsors listing which matches this slug - """ - slug: String! - ): SponsorsListing @deprecated(reason: "`Query.sponsorsListing` will be removed. Use `Sponsorable.sponsorsListing` instead. Removal on 2020-04-01 UTC.") - - """ - Look up a topic by name. - """ - topic( - """ - The topic's name. - """ - name: String! - ): Topic - - """ - Lookup a user by login. - """ - user( - """ - The user's login. - """ - login: String! - ): User - - """ - The currently authenticated user. - """ - viewer: User! -} - -""" -Represents the client's rate limit. -""" -type RateLimit { - """ - The point cost for the current query counting against the rate limit. - """ - cost: Int! - - """ - The maximum number of points the client is permitted to consume in a 60 minute window. - """ - limit: Int! - - """ - The maximum number of nodes this query may return - """ - nodeCount: Int! - - """ - The number of points remaining in the current rate limit window. - """ - remaining: Int! - - """ - The time at which the current rate limit window resets in UTC epoch seconds. - """ - resetAt: DateTime! -} - -""" -Represents a subject that can be reacted on. -""" -interface Reactable { - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! -} - -""" -The connection type for User. -""" -type ReactingUserConnection { - """ - A list of edges. - """ - edges: [ReactingUserEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a user that's made a reaction. -""" -type ReactingUserEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - node: User! - - """ - The moment when the user made the reaction. - """ - reactedAt: DateTime! -} - -""" -An emoji reaction to a particular piece of content. -""" -type Reaction implements Node { - """ - Identifies the emoji reaction. - """ - content: ReactionContent! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - The reactable piece of content - """ - reactable: Reactable! - - """ - Identifies the user who created this reaction. - """ - user: User -} - -""" -A list of reactions that have been left on the subject. -""" -type ReactionConnection { - """ - A list of edges. - """ - edges: [ReactionEdge] - - """ - A list of nodes. - """ - nodes: [Reaction] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! - - """ - Whether or not the authenticated user has left a reaction on the subject. - """ - viewerHasReacted: Boolean! -} - -""" -Emojis that can be attached to Issues, Pull Requests and Comments. -""" -enum ReactionContent { - """ - Represents the `:confused:` emoji. - """ - CONFUSED - - """ - Represents the `:eyes:` emoji. - """ - EYES - - """ - Represents the `:heart:` emoji. - """ - HEART - - """ - Represents the `:hooray:` emoji. - """ - HOORAY - - """ - Represents the `:laugh:` emoji. - """ - LAUGH - - """ - Represents the `:rocket:` emoji. - """ - ROCKET - - """ - Represents the `:-1:` emoji. - """ - THUMBS_DOWN - - """ - Represents the `:+1:` emoji. - """ - THUMBS_UP -} - -""" -An edge in a connection. -""" -type ReactionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Reaction -} - -""" -A group of emoji reactions to a particular piece of content. -""" -type ReactionGroup { - """ - Identifies the emoji reaction. - """ - content: ReactionContent! - - """ - Identifies when the reaction was created. - """ - createdAt: DateTime - - """ - The subject that was reacted to. - """ - subject: Reactable! - - """ - Users who have reacted to the reaction subject with the emotion represented by this reaction group - """ - users( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): ReactingUserConnection! - - """ - Whether or not the authenticated user has left a reaction on the subject. - """ - viewerHasReacted: Boolean! -} - -""" -Ways in which lists of reactions can be ordered upon return. -""" -input ReactionOrder { - """ - The direction in which to order reactions by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order reactions by. - """ - field: ReactionOrderField! -} - -""" -A list of fields that reactions can be ordered by. -""" -enum ReactionOrderField { - """ - Allows ordering a list of reactions by when they were created. - """ - CREATED_AT -} - -""" -Represents a 'ready_for_review' event on a given pull request. -""" -type ReadyForReviewEvent implements Node & UniformResourceLocatable { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - The HTTP path for this ready for review event. - """ - resourcePath: URI! - - """ - The HTTP URL for this ready for review event. - """ - url: URI! -} - -""" -Represents a Git reference. -""" -type Ref implements Node { - """ - A list of pull requests with this ref as the head ref. - """ - associatedPullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - The base ref name to filter the pull requests by. - """ - baseRefName: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - The head ref name to filter the pull requests by. - """ - headRefName: String - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the pull requests by. - """ - states: [PullRequestState!] - ): PullRequestConnection! - id: ID! - - """ - The ref name. - """ - name: String! - - """ - The ref's prefix, such as `refs/heads/` or `refs/tags/`. - """ - prefix: String! - - """ - The repository the ref belongs to. - """ - repository: Repository! - - """ - The object the ref points to. - - **Upcoming Change on 2019-07-01 UTC** - **Description:** Type for `target` will change from `GitObject!` to `GitObject`. - **Reason:** The `target` field may return `null` values and is changing to nullable - """ - target: GitObject! -} - -""" -The connection type for Ref. -""" -type RefConnection { - """ - A list of edges. - """ - edges: [RefEdge] - - """ - A list of nodes. - """ - nodes: [Ref] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type RefEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Ref -} - -""" -Ways in which lists of git refs can be ordered upon return. -""" -input RefOrder { - """ - The direction in which to order refs by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order refs by. - """ - field: RefOrderField! -} - -""" -Properties by which ref connections can be ordered. -""" -enum RefOrderField { - """ - Order refs by their alphanumeric name - """ - ALPHABETICAL - - """ - Order refs by underlying commit date if the ref prefix is refs/tags/ - """ - TAG_COMMIT_DATE -} - -""" -A ref update -""" -input RefUpdate @preview(toggledBy: "update-refs-preview") { - """ - The value this ref should be updated to. - """ - afterOid: GitObjectID! - - """ - The value this ref needs to point to before the update. - """ - beforeOid: GitObjectID - - """ - Force a non fast-forward update. - """ - force: Boolean = false - - """ - The fully qualified name of the ref to be update. For example `refs/heads/branch-name` - """ - name: GitRefname! -} - -""" -Represents a 'referenced' event on a given `ReferencedSubject`. -""" -type ReferencedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the commit associated with the 'referenced' event. - """ - commit: Commit - - """ - Identifies the repository associated with the 'referenced' event. - """ - commitRepository: Repository! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Reference originated in a different repository. - """ - isCrossRepository: Boolean! - - """ - Checks if the commit message itself references the subject. Can be false in the case of a commit comment reference. - """ - isDirectReference: Boolean! - - """ - Object referenced by event. - """ - subject: ReferencedSubject! -} - -""" -Any referencable object -""" -union ReferencedSubject = Issue | PullRequest - -""" -Autogenerated input type of RegenerateEnterpriseIdentityProviderRecoveryCodes -""" -input RegenerateEnterpriseIdentityProviderRecoveryCodesInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set an identity provider. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) -} - -""" -Autogenerated return type of RegenerateEnterpriseIdentityProviderRecoveryCodes -""" -type RegenerateEnterpriseIdentityProviderRecoveryCodesPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The identity provider for the enterprise. - """ - identityProvider: EnterpriseIdentityProvider -} - -""" -A release contains the content for a release. -""" -type Release implements Node & UniformResourceLocatable { - """ - The author of the release - """ - author: User - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The description of the release. - """ - description: String - - """ - The description of this release rendered to HTML. - """ - descriptionHTML: HTML - id: ID! - - """ - Whether or not the release is a draft - """ - isDraft: Boolean! - - """ - Whether or not the release is a prerelease - """ - isPrerelease: Boolean! - - """ - The title of the release. - """ - name: String - - """ - Identifies the date and time when the release was created. - """ - publishedAt: DateTime - - """ - List of releases assets which are dependent on this release. - """ - releaseAssets( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - A list of names to filter the assets by. - """ - name: String - ): ReleaseAssetConnection! - - """ - The HTTP path for this issue - """ - resourcePath: URI! - - """ - A description of the release, rendered to HTML without any links in it. - """ - shortDescriptionHTML( - """ - How many characters to return. - """ - limit: Int = 200 - ): HTML - - """ - The Git tag the release points to - """ - tag: Ref - - """ - The name of the release's Git tag - """ - tagName: String! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this issue - """ - url: URI! -} - -""" -A release asset contains the content for a release asset. -""" -type ReleaseAsset implements Node { - """ - The asset's content-type - """ - contentType: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The number of times this asset was downloaded - """ - downloadCount: Int! - - """ - Identifies the URL where you can download the release asset via the browser. - """ - downloadUrl: URI! - id: ID! - - """ - Identifies the title of the release asset. - """ - name: String! - - """ - Release that the asset is associated with - """ - release: Release - - """ - The size (in bytes) of the asset - """ - size: Int! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The user that performed the upload - """ - uploadedBy: User! - - """ - Identifies the URL of the release asset. - """ - url: URI! -} - -""" -The connection type for ReleaseAsset. -""" -type ReleaseAssetConnection { - """ - A list of edges. - """ - edges: [ReleaseAssetEdge] - - """ - A list of nodes. - """ - nodes: [ReleaseAsset] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ReleaseAssetEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: ReleaseAsset -} - -""" -The connection type for Release. -""" -type ReleaseConnection { - """ - A list of edges. - """ - edges: [ReleaseEdge] - - """ - A list of nodes. - """ - nodes: [Release] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ReleaseEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Release -} - -""" -Ways in which lists of releases can be ordered upon return. -""" -input ReleaseOrder { - """ - The direction in which to order releases by the specified field. - """ - direction: OrderDirection! - - """ - The field in which to order releases by. - """ - field: ReleaseOrderField! -} - -""" -Properties by which release connections can be ordered. -""" -enum ReleaseOrderField { - """ - Order releases by creation time - """ - CREATED_AT - - """ - Order releases alphabetically by name - """ - NAME -} - -""" -Autogenerated input type of RemoveAssigneesFromAssignable -""" -input RemoveAssigneesFromAssignableInput { - """ - The id of the assignable object to remove assignees from. - """ - assignableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Assignable") - - """ - The id of users to remove as assignees. - """ - assigneeIds: [ID!]! @possibleTypes(concreteTypes: ["User"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated return type of RemoveAssigneesFromAssignable -""" -type RemoveAssigneesFromAssignablePayload { - """ - The item that was unassigned. - """ - assignable: Assignable - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of RemoveEnterpriseAdmin -""" -input RemoveEnterpriseAdminInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Enterprise ID from which to remove the administrator. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The login of the user to remove as an administrator. - """ - login: String! -} - -""" -Autogenerated return type of RemoveEnterpriseAdmin -""" -type RemoveEnterpriseAdminPayload { - """ - The user who was removed as an administrator. - """ - admin: User - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated enterprise. - """ - enterprise: Enterprise - - """ - A message confirming the result of removing an administrator. - """ - message: String - - """ - The viewer performing the mutation. - """ - viewer: User -} - -""" -Autogenerated input type of RemoveEnterpriseIdentityProvider -""" -input RemoveEnterpriseIdentityProviderInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise from which to remove the identity provider. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) -} - -""" -Autogenerated return type of RemoveEnterpriseIdentityProvider -""" -type RemoveEnterpriseIdentityProviderPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The identity provider that was removed from the enterprise. - """ - identityProvider: EnterpriseIdentityProvider -} - -""" -Autogenerated input type of RemoveEnterpriseOrganization -""" -input RemoveEnterpriseOrganizationInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise from which the organization should be removed. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The ID of the organization to remove from the enterprise. - """ - organizationId: ID! @possibleTypes(concreteTypes: ["Organization"]) -} - -""" -Autogenerated return type of RemoveEnterpriseOrganization -""" -type RemoveEnterpriseOrganizationPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated enterprise. - """ - enterprise: Enterprise - - """ - The organization that was removed from the enterprise. - """ - organization: Organization - - """ - The viewer performing the mutation. - """ - viewer: User -} - -""" -Autogenerated input type of RemoveLabelsFromLabelable -""" -input RemoveLabelsFromLabelableInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ids of labels to remove. - """ - labelIds: [ID!]! @possibleTypes(concreteTypes: ["Label"]) - - """ - The id of the Labelable to remove labels from. - """ - labelableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Labelable") -} - -""" -Autogenerated return type of RemoveLabelsFromLabelable -""" -type RemoveLabelsFromLabelablePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Labelable the labels were removed from. - """ - labelable: Labelable -} - -""" -Autogenerated input type of RemoveOutsideCollaborator -""" -input RemoveOutsideCollaboratorInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the organization to remove the outside collaborator from. - """ - organizationId: ID! @possibleTypes(concreteTypes: ["Organization"]) - - """ - The ID of the outside collaborator to remove. - """ - userId: ID! @possibleTypes(concreteTypes: ["User"]) -} - -""" -Autogenerated return type of RemoveOutsideCollaborator -""" -type RemoveOutsideCollaboratorPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The user that was removed as an outside collaborator. - """ - removedUser: User -} - -""" -Autogenerated input type of RemoveReaction -""" -input RemoveReactionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of the emoji reaction to remove. - """ - content: ReactionContent! - - """ - The Node ID of the subject to modify. - """ - subjectId: ID! @possibleTypes(concreteTypes: ["CommitComment", "Issue", "IssueComment", "PullRequest", "PullRequestReview", "PullRequestReviewComment", "TeamDiscussion", "TeamDiscussionComment"], abstractType: "Reactable") -} - -""" -Autogenerated return type of RemoveReaction -""" -type RemoveReactionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The reaction object. - """ - reaction: Reaction - - """ - The reactable subject. - """ - subject: Reactable -} - -""" -Autogenerated input type of RemoveStar -""" -input RemoveStarInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Starrable ID to unstar. - """ - starrableId: ID! @possibleTypes(concreteTypes: ["Gist", "Repository", "Topic"], abstractType: "Starrable") -} - -""" -Autogenerated return type of RemoveStar -""" -type RemoveStarPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The starrable. - """ - starrable: Starrable -} - -""" -Represents a 'removed_from_project' event on a given issue or pull request. -""" -type RemovedFromProjectEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - Project referenced by event. - """ - project: Project @preview(toggledBy: "starfox-preview") - - """ - Column name referenced by this project event. - """ - projectColumnName: String! @preview(toggledBy: "starfox-preview") -} - -""" -Represents a 'renamed' event on a given issue or pull request -""" -type RenamedTitleEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the current title of the issue or pull request. - """ - currentTitle: String! - id: ID! - - """ - Identifies the previous title of the issue or pull request. - """ - previousTitle: String! - - """ - Subject that was renamed. - """ - subject: RenamedTitleSubject! -} - -""" -An object which has a renamable title -""" -union RenamedTitleSubject = Issue | PullRequest - -""" -Autogenerated input type of ReopenIssue -""" -input ReopenIssueInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the issue to be opened. - """ - issueId: ID! @possibleTypes(concreteTypes: ["Issue"]) -} - -""" -Autogenerated return type of ReopenIssue -""" -type ReopenIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue that was opened. - """ - issue: Issue -} - -""" -Autogenerated input type of ReopenPullRequest -""" -input ReopenPullRequestInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the pull request to be reopened. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) -} - -""" -Autogenerated return type of ReopenPullRequest -""" -type ReopenPullRequestPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The pull request that was reopened. - """ - pullRequest: PullRequest -} - -""" -Represents a 'reopened' event on any `Closable`. -""" -type ReopenedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Object that was reopened. - """ - closable: Closable! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! -} - -""" -Audit log entry for a repo.access event. -""" -type RepoAccessAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The visibility of the repository - """ - visibility: RepoAccessAuditEntryVisibility -} - -""" -The privacy of a repository -""" -enum RepoAccessAuditEntryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repo.add_member event. -""" -type RepoAddMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The visibility of the repository - """ - visibility: RepoAddMemberAuditEntryVisibility -} - -""" -The privacy of a repository -""" -enum RepoAddMemberAuditEntryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repo.add_topic event. -""" -type RepoAddTopicAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData & TopicAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The name of the topic added to the repository - """ - topic: Topic - - """ - The name of the topic added to the repository - """ - topicName: String - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.archived event. -""" -type RepoArchivedAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The visibility of the repository - """ - visibility: RepoArchivedAuditEntryVisibility -} - -""" -The privacy of a repository -""" -enum RepoArchivedAuditEntryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repo.change_merge_setting event. -""" -type RepoChangeMergeSettingAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - Whether the change was to enable (true) or disable (false) the merge type - """ - isEnabled: Boolean - - """ - The merge method affected by the change - """ - mergeType: RepoChangeMergeSettingAuditEntryMergeType - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The merge options available for pull requests to this repository. -""" -enum RepoChangeMergeSettingAuditEntryMergeType { - """ - The pull request is added to the base branch in a merge commit. - """ - MERGE - - """ - Commits from the pull request are added onto the base branch individually without a merge commit. - """ - REBASE - - """ - The pull request's commits are squashed into a single commit before they are merged to the base branch. - """ - SQUASH -} - -""" -Audit log entry for a repo.config.disable_anonymous_git_access event. -""" -type RepoConfigDisableAnonymousGitAccessAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.disable_collaborators_only event. -""" -type RepoConfigDisableCollaboratorsOnlyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.disable_contributors_only event. -""" -type RepoConfigDisableContributorsOnlyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.disable_sockpuppet_disallowed event. -""" -type RepoConfigDisableSockpuppetDisallowedAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.enable_anonymous_git_access event. -""" -type RepoConfigEnableAnonymousGitAccessAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.enable_collaborators_only event. -""" -type RepoConfigEnableCollaboratorsOnlyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.enable_contributors_only event. -""" -type RepoConfigEnableContributorsOnlyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.enable_sockpuppet_disallowed event. -""" -type RepoConfigEnableSockpuppetDisallowedAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.lock_anonymous_git_access event. -""" -type RepoConfigLockAnonymousGitAccessAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.config.unlock_anonymous_git_access event. -""" -type RepoConfigUnlockAnonymousGitAccessAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repo.create event. -""" -type RepoCreateAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The name of the parent repository for this forked repository. - """ - forkParentName: String - - """ - The name of the root repository for this netork. - """ - forkSourceName: String - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The visibility of the repository - """ - visibility: RepoCreateAuditEntryVisibility -} - -""" -The privacy of a repository -""" -enum RepoCreateAuditEntryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repo.destroy event. -""" -type RepoDestroyAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The visibility of the repository - """ - visibility: RepoDestroyAuditEntryVisibility -} - -""" -The privacy of a repository -""" -enum RepoDestroyAuditEntryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repo.remove_member event. -""" -type RepoRemoveMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI - - """ - The visibility of the repository - """ - visibility: RepoRemoveMemberAuditEntryVisibility -} - -""" -The privacy of a repository -""" -enum RepoRemoveMemberAuditEntryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repo.remove_topic event. -""" -type RepoRemoveTopicAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData & TopicAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The name of the topic added to the repository - """ - topic: Topic - - """ - The name of the topic added to the repository - """ - topicName: String - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The reasons a piece of content can be reported or minimized. -""" -enum ReportedContentClassifiers { - """ - An abusive or harassing piece of content - """ - ABUSE - - """ - A duplicated piece of content - """ - DUPLICATE - - """ - An irrelevant piece of content - """ - OFF_TOPIC - - """ - An outdated piece of content - """ - OUTDATED - - """ - The content has been resolved - """ - RESOLVED - - """ - A spammy piece of content - """ - SPAM -} - -""" -A repository contains the content for a project. -""" -type Repository implements Node & PackageOwner & ProjectOwner & RepositoryInfo & Starrable & Subscribable & UniformResourceLocatable { - """ - A list of users that can be assigned to issues in this repository. - """ - assignableUsers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filters users with query on user name and login - """ - query: String - ): UserConnection! - - """ - A list of branch protection rules for this repository. - """ - branchProtectionRules( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): BranchProtectionRuleConnection! - - """ - Returns the code of conduct for this repository - """ - codeOfConduct: CodeOfConduct - - """ - A list of collaborators associated with the repository. - """ - collaborators( - """ - Collaborators affiliation level with a repository. - """ - affiliation: CollaboratorAffiliation - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filters users with query on user name and login - """ - query: String - ): RepositoryCollaboratorConnection - - """ - A list of commit comments associated with the repository. - """ - commitComments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CommitCommentConnection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The Ref associated with the repository's default branch. - """ - defaultBranchRef: Ref - - """ - Whether or not branches are automatically deleted when merged in this repository. - """ - deleteBranchOnMerge: Boolean! - - """ - A list of dependency manifests contained in the repository - """ - dependencyGraphManifests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Cursor to paginate dependencies - """ - dependenciesAfter: String - - """ - Number of dependencies to fetch - """ - dependenciesFirst: Int - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Flag to scope to only manifests with dependencies - """ - withDependencies: Boolean - ): DependencyGraphManifestConnection @preview(toggledBy: "hawkgirl-preview") - - """ - A list of deploy keys that are on this repository. - """ - deployKeys( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): DeployKeyConnection! - - """ - Deployments associated with the repository - """ - deployments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Environments to list deployments for - """ - environments: [String!] - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for deployments returned from the connection. - """ - orderBy: DeploymentOrder = {field: CREATED_AT, direction: ASC} - ): DeploymentConnection! - - """ - The description of the repository. - """ - description: String - - """ - The description of the repository rendered to HTML. - """ - descriptionHTML: HTML! - - """ - The number of kilobytes this repository occupies on disk. - """ - diskUsage: Int - - """ - Returns how many forks there are of this repository in the whole network. - """ - forkCount: Int! - - """ - A list of direct forked repositories. - """ - forks( - """ - Array of viewer's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - current viewer owns. - """ - affiliations: [RepositoryAffiliation] - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If non-null, filters repositories according to whether they have been locked - """ - isLocked: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder - - """ - Array of owner's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - organization or user being viewed owns. - """ - ownerAffiliations: [RepositoryAffiliation] = [OWNER, COLLABORATOR] - - """ - If non-null, filters repositories according to privacy - """ - privacy: RepositoryPrivacy - ): RepositoryConnection! - - """ - The funding links for this repository - """ - fundingLinks: [FundingLink!]! - - """ - Indicates if the repository has issues feature enabled. - """ - hasIssuesEnabled: Boolean! - - """ - Indicates if the repository has the Projects feature enabled. - """ - hasProjectsEnabled: Boolean! - - """ - Indicates if the repository has wiki feature enabled. - """ - hasWikiEnabled: Boolean! - - """ - The repository's URL. - """ - homepageUrl: URI - id: ID! - - """ - Indicates if the repository is unmaintained. - """ - isArchived: Boolean! - - """ - Returns whether or not this repository disabled. - """ - isDisabled: Boolean! - - """ - Identifies if the repository is a fork. - """ - isFork: Boolean! - - """ - Indicates if the repository has been locked or not. - """ - isLocked: Boolean! - - """ - Identifies if the repository is a mirror. - """ - isMirror: Boolean! - - """ - Identifies if the repository is private. - """ - isPrivate: Boolean! - - """ - Identifies if the repository is a template that can be used to generate new repositories. - """ - isTemplate: Boolean! - - """ - Returns a single issue from the current repository by number. - """ - issue( - """ - The number for the issue to be returned. - """ - number: Int! - ): Issue - - """ - Returns a single issue-like object from the current repository by number. - """ - issueOrPullRequest( - """ - The number for the issue to be returned. - """ - number: Int! - ): IssueOrPullRequest - - """ - A list of issues that have been opened in the repository. - """ - issues( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Filtering options for issues returned from the connection. - """ - filterBy: IssueFilters - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for issues returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the issues by. - """ - states: [IssueState!] - ): IssueConnection! - - """ - Returns a single label by name - """ - label( - """ - Label name - """ - name: String! - ): Label - - """ - A list of labels associated with the repository. - """ - labels( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for labels returned from the connection. - """ - orderBy: LabelOrder = {field: CREATED_AT, direction: ASC} - - """ - If provided, searches labels by name and description. - """ - query: String - ): LabelConnection - - """ - A list containing a breakdown of the language composition of the repository. - """ - languages( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: LanguageOrder - ): LanguageConnection - - """ - The license associated with the repository - """ - licenseInfo: License - - """ - The reason the repository has been locked. - """ - lockReason: RepositoryLockReason - - """ - A list of Users that can be mentioned in the context of the repository. - """ - mentionableUsers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filters users with query on user name and login - """ - query: String - ): UserConnection! - - """ - Whether or not PRs are merged with a merge commit on this repository. - """ - mergeCommitAllowed: Boolean! - - """ - Returns a single milestone from the current repository by number. - """ - milestone( - """ - The number for the milestone to be returned. - """ - number: Int! - ): Milestone - - """ - A list of milestones associated with the repository. - """ - milestones( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for milestones. - """ - orderBy: MilestoneOrder - - """ - Filter by the state of the milestones. - """ - states: [MilestoneState!] - ): MilestoneConnection - - """ - The repository's original mirror URL. - """ - mirrorUrl: URI - - """ - The name of the repository. - """ - name: String! - - """ - The repository's name with owner. - """ - nameWithOwner: String! - - """ - A Git object in the repository - """ - object( - """ - A Git revision expression suitable for rev-parse - """ - expression: String - - """ - The Git object ID - """ - oid: GitObjectID - ): GitObject - - """ - The image used to represent this repository in Open Graph data. - """ - openGraphImageUrl: URI! - - """ - The User owner of the repository. - """ - owner: RepositoryOwner! - - """ - A list of packages under the owner. - """ - packages( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Find packages by their names. - """ - names: [String] - - """ - Ordering of the returned packages. - """ - orderBy: PackageOrder = {field: CREATED_AT, direction: DESC} - - """ - Filter registry package by type. - """ - packageType: PackageType - - """ - Find packages in a repository by ID. - """ - repositoryId: ID - ): PackageConnection! - - """ - The repository parent, if this is a fork. - """ - parent: Repository - - """ - A list of pinned issues for this repository. - """ - pinnedIssues( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PinnedIssueConnection @preview(toggledBy: "elektra-preview") - - """ - The primary language of the repository's code. - """ - primaryLanguage: Language - - """ - Find project by number. - """ - project( - """ - The project number to find. - """ - number: Int! - ): Project - - """ - A list of projects under the owner. - """ - projects( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for projects returned from the connection - """ - orderBy: ProjectOrder - - """ - Query to search projects by, currently only searching by name. - """ - search: String - - """ - A list of states to filter the projects by. - """ - states: [ProjectState!] - ): ProjectConnection! - - """ - The HTTP path listing the repository's projects - """ - projectsResourcePath: URI! - - """ - The HTTP URL listing the repository's projects - """ - projectsUrl: URI! - - """ - Returns a single pull request from the current repository by number. - """ - pullRequest( - """ - The number for the pull request to be returned. - """ - number: Int! - ): PullRequest - - """ - A list of pull requests that have been opened in the repository. - """ - pullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - The base ref name to filter the pull requests by. - """ - baseRefName: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - The head ref name to filter the pull requests by. - """ - headRefName: String - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the pull requests by. - """ - states: [PullRequestState!] - ): PullRequestConnection! - - """ - Identifies when the repository was last pushed to. - """ - pushedAt: DateTime - - """ - Whether or not rebase-merging is enabled on this repository. - """ - rebaseMergeAllowed: Boolean! - - """ - Fetch a given ref from the repository - """ - ref( - """ - The ref to retrieve. Fully qualified matches are checked in order - (`refs/heads/master`) before falling back onto checks for short name matches (`master`). - """ - qualifiedName: String! - ): Ref - - """ - Fetch a list of refs from the repository - """ - refs( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - DEPRECATED: use orderBy. The ordering direction. - """ - direction: OrderDirection - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for refs returned from the connection. - """ - orderBy: RefOrder - - """ - Filters refs with query on name - """ - query: String - - """ - A ref name prefix like `refs/heads/`, `refs/tags/`, etc. - """ - refPrefix: String! - ): RefConnection - - """ - Lookup a single release given various criteria. - """ - release( - """ - The name of the Tag the Release was created from - """ - tagName: String! - ): Release - - """ - List of releases which are dependent on this repository. - """ - releases( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: ReleaseOrder - ): ReleaseConnection! - - """ - A list of applied repository-topic associations for this repository. - """ - repositoryTopics( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): RepositoryTopicConnection! - - """ - The HTTP path for this repository - """ - resourcePath: URI! - - """ - A description of the repository, rendered to HTML without any links in it. - """ - shortDescriptionHTML( - """ - How many characters to return. - """ - limit: Int = 200 - ): HTML! - - """ - Whether or not squash-merging is enabled on this repository. - """ - squashMergeAllowed: Boolean! - - """ - The SSH URL to clone this repository - """ - sshUrl: GitSSHRemote! - - """ - A list of users who have starred this starrable. - """ - stargazers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: StarOrder - ): StargazerConnection! - - """ - Returns a list of all submodules in this repository parsed from the - .gitmodules file as of the default branch's HEAD commit. - """ - submodules( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): SubmoduleConnection! - - """ - Temporary authentication token for cloning this repository. - """ - tempCloneToken: String - - """ - The repository from which this repository was generated, if any. - """ - templateRepository: Repository - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this repository - """ - url: URI! - - """ - Whether this repository has a custom image to use with Open Graph as opposed to being represented by the owner's avatar. - """ - usesCustomOpenGraphImage: Boolean! - - """ - Indicates whether the viewer has admin permissions on this repository. - """ - viewerCanAdminister: Boolean! - - """ - Can the current viewer create new projects on this owner. - """ - viewerCanCreateProjects: Boolean! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Indicates whether the viewer can update the topics of this repository. - """ - viewerCanUpdateTopics: Boolean! - - """ - Returns a boolean indicating whether the viewing user has starred this starrable. - """ - viewerHasStarred: Boolean! - - """ - The users permission level on the repository. Will return null if authenticated as an GitHub App. - """ - viewerPermission: RepositoryPermission - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState - - """ - A list of vulnerability alerts that are on this repository. - """ - vulnerabilityAlerts( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): RepositoryVulnerabilityAlertConnection - - """ - A list of users watching the repository. - """ - watchers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserConnection! -} - -""" -The affiliation of a user to a repository -""" -enum RepositoryAffiliation { - """ - Repositories that the user has been added to as a collaborator. - """ - COLLABORATOR - - """ - Repositories that the user has access to through being a member of an - organization. This includes every repository on every team that the user is on. - """ - ORGANIZATION_MEMBER - - """ - Repositories that are owned by the authenticated user. - """ - OWNER -} - -""" -Metadata for an audit entry with action repo.* -""" -interface RepositoryAuditEntryData { - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI -} - -""" -The connection type for User. -""" -type RepositoryCollaboratorConnection { - """ - A list of edges. - """ - edges: [RepositoryCollaboratorEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a user who is a collaborator of a repository. -""" -type RepositoryCollaboratorEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - node: User! - - """ - The permission the user has on the repository. - - **Upcoming Change on 2020-10-01 UTC** - **Description:** Type for `permission` will change from `RepositoryPermission!` to `String`. - **Reason:** This field may return additional values - """ - permission: RepositoryPermission! - - """ - A list of sources for the user's access to the repository. - """ - permissionSources: [PermissionSource!] -} - -""" -A list of repositories owned by the subject. -""" -type RepositoryConnection { - """ - A list of edges. - """ - edges: [RepositoryEdge] - - """ - A list of nodes. - """ - nodes: [Repository] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! - - """ - The total size in kilobytes of all repositories in the connection. - """ - totalDiskUsage: Int! -} - -""" -The reason a repository is listed as 'contributed'. -""" -enum RepositoryContributionType { - """ - Created a commit - """ - COMMIT - - """ - Created an issue - """ - ISSUE - - """ - Created a pull request - """ - PULL_REQUEST - - """ - Reviewed a pull request - """ - PULL_REQUEST_REVIEW - - """ - Created the repository - """ - REPOSITORY -} - -""" -An edge in a connection. -""" -type RepositoryEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Repository -} - -""" -A subset of repository info. -""" -interface RepositoryInfo { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The description of the repository. - """ - description: String - - """ - The description of the repository rendered to HTML. - """ - descriptionHTML: HTML! - - """ - Returns how many forks there are of this repository in the whole network. - """ - forkCount: Int! - - """ - Indicates if the repository has issues feature enabled. - """ - hasIssuesEnabled: Boolean! - - """ - Indicates if the repository has the Projects feature enabled. - """ - hasProjectsEnabled: Boolean! - - """ - Indicates if the repository has wiki feature enabled. - """ - hasWikiEnabled: Boolean! - - """ - The repository's URL. - """ - homepageUrl: URI - - """ - Indicates if the repository is unmaintained. - """ - isArchived: Boolean! - - """ - Identifies if the repository is a fork. - """ - isFork: Boolean! - - """ - Indicates if the repository has been locked or not. - """ - isLocked: Boolean! - - """ - Identifies if the repository is a mirror. - """ - isMirror: Boolean! - - """ - Identifies if the repository is private. - """ - isPrivate: Boolean! - - """ - Identifies if the repository is a template that can be used to generate new repositories. - """ - isTemplate: Boolean! - - """ - The license associated with the repository - """ - licenseInfo: License - - """ - The reason the repository has been locked. - """ - lockReason: RepositoryLockReason - - """ - The repository's original mirror URL. - """ - mirrorUrl: URI - - """ - The name of the repository. - """ - name: String! - - """ - The repository's name with owner. - """ - nameWithOwner: String! - - """ - The image used to represent this repository in Open Graph data. - """ - openGraphImageUrl: URI! - - """ - The User owner of the repository. - """ - owner: RepositoryOwner! - - """ - Identifies when the repository was last pushed to. - """ - pushedAt: DateTime - - """ - The HTTP path for this repository - """ - resourcePath: URI! - - """ - A description of the repository, rendered to HTML without any links in it. - """ - shortDescriptionHTML( - """ - How many characters to return. - """ - limit: Int = 200 - ): HTML! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this repository - """ - url: URI! - - """ - Whether this repository has a custom image to use with Open Graph as opposed to being represented by the owner's avatar. - """ - usesCustomOpenGraphImage: Boolean! -} - -""" -An invitation for a user to be added to a repository. -""" -type RepositoryInvitation implements Node { - """ - The email address that received the invitation. - """ - email: String - id: ID! - - """ - The user who received the invitation. - """ - invitee: User - - """ - The user who created the invitation. - """ - inviter: User! - - """ - The permission granted on this repository by this invitation. - - **Upcoming Change on 2020-10-01 UTC** - **Description:** Type for `permission` will change from `RepositoryPermission!` to `String`. - **Reason:** This field may return additional values - """ - permission: RepositoryPermission! - - """ - The Repository the user is invited to. - """ - repository: RepositoryInfo -} - -""" -The connection type for RepositoryInvitation. -""" -type RepositoryInvitationConnection { - """ - A list of edges. - """ - edges: [RepositoryInvitationEdge] - - """ - A list of nodes. - """ - nodes: [RepositoryInvitation] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type RepositoryInvitationEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: RepositoryInvitation -} - -""" -Ordering options for repository invitation connections. -""" -input RepositoryInvitationOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order repository invitations by. - """ - field: RepositoryInvitationOrderField! -} - -""" -Properties by which repository invitation connections can be ordered. -""" -enum RepositoryInvitationOrderField { - """ - Order repository invitations by creation time - """ - CREATED_AT - - """ - Order repository invitations by invitee login - """ - INVITEE_LOGIN @deprecated(reason: "`INVITEE_LOGIN` is no longer a valid field value. Repository invitations can now be associated with an email, not only an invitee. Removal on 2020-10-01 UTC.") -} - -""" -The possible reasons a given repository could be in a locked state. -""" -enum RepositoryLockReason { - """ - The repository is locked due to a billing related reason. - """ - BILLING - - """ - The repository is locked due to a migration. - """ - MIGRATING - - """ - The repository is locked due to a move. - """ - MOVING - - """ - The repository is locked due to a rename. - """ - RENAME -} - -""" -Represents a object that belongs to a repository. -""" -interface RepositoryNode { - """ - The repository associated with this node. - """ - repository: Repository! -} - -""" -Ordering options for repository connections -""" -input RepositoryOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order repositories by. - """ - field: RepositoryOrderField! -} - -""" -Properties by which repository connections can be ordered. -""" -enum RepositoryOrderField { - """ - Order repositories by creation time - """ - CREATED_AT - - """ - Order repositories by name - """ - NAME - - """ - Order repositories by push time - """ - PUSHED_AT - - """ - Order repositories by number of stargazers - """ - STARGAZERS - - """ - Order repositories by update time - """ - UPDATED_AT -} - -""" -Represents an owner of a Repository. -""" -interface RepositoryOwner { - """ - A URL pointing to the owner's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - id: ID! - - """ - The username used to login. - """ - login: String! - - """ - A list of repositories that the user owns. - """ - repositories( - """ - Array of viewer's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - current viewer owns. - """ - affiliations: [RepositoryAffiliation] - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If non-null, filters repositories according to whether they are forks of another repository - """ - isFork: Boolean - - """ - If non-null, filters repositories according to whether they have been locked - """ - isLocked: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder - - """ - Array of owner's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - organization or user being viewed owns. - """ - ownerAffiliations: [RepositoryAffiliation] = [OWNER, COLLABORATOR] - - """ - If non-null, filters repositories according to privacy - """ - privacy: RepositoryPrivacy - ): RepositoryConnection! - - """ - Find Repository. - """ - repository( - """ - Name of Repository to find. - """ - name: String! - ): Repository - - """ - The HTTP URL for the owner. - """ - resourcePath: URI! - - """ - The HTTP URL for the owner. - """ - url: URI! -} - -""" -The access level to a repository -""" -enum RepositoryPermission { - """ - Can read, clone, and push to this repository. Can also manage issues, pull - requests, and repository settings, including adding collaborators - """ - ADMIN - - """ - Can read, clone, and push to this repository. They can also manage issues, pull requests, and some repository settings - """ - MAINTAIN - - """ - Can read and clone this repository. Can also open and comment on issues and pull requests - """ - READ - - """ - Can read and clone this repository. Can also manage issues and pull requests - """ - TRIAGE - - """ - Can read, clone, and push to this repository. Can also manage issues and pull requests - """ - WRITE -} - -""" -The privacy of a repository -""" -enum RepositoryPrivacy { - """ - Private - """ - PRIVATE - - """ - Public - """ - PUBLIC -} - -""" -A repository-topic connects a repository to a topic. -""" -type RepositoryTopic implements Node & UniformResourceLocatable { - id: ID! - - """ - The HTTP path for this repository-topic. - """ - resourcePath: URI! - - """ - The topic. - """ - topic: Topic! - - """ - The HTTP URL for this repository-topic. - """ - url: URI! -} - -""" -The connection type for RepositoryTopic. -""" -type RepositoryTopicConnection { - """ - A list of edges. - """ - edges: [RepositoryTopicEdge] - - """ - A list of nodes. - """ - nodes: [RepositoryTopic] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type RepositoryTopicEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: RepositoryTopic -} - -""" -The repository's visibility level. -""" -enum RepositoryVisibility { - """ - The repository is visible only to users in the same business. - """ - INTERNAL - - """ - The repository is visible only to those with explicit access. - """ - PRIVATE - - """ - The repository is visible to everyone. - """ - PUBLIC -} - -""" -Audit log entry for a repository_visibility_change.disable event. -""" -type RepositoryVisibilityChangeDisableAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a repository_visibility_change.enable event. -""" -type RepositoryVisibilityChangeEnableAuditEntry implements AuditEntry & EnterpriseAuditEntryData & Node & OrganizationAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - - """ - The HTTP path for this enterprise. - """ - enterpriseResourcePath: URI - - """ - The slug of the enterprise. - """ - enterpriseSlug: String - - """ - The HTTP URL for this enterprise. - """ - enterpriseUrl: URI - id: ID! - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -A alert for a repository with an affected vulnerability. -""" -type RepositoryVulnerabilityAlert implements Node & RepositoryNode { - """ - When was the alert created? - """ - createdAt: DateTime! - - """ - The reason the alert was dismissed - """ - dismissReason: String - - """ - When was the alert dimissed? - """ - dismissedAt: DateTime - - """ - The user who dismissed the alert - """ - dismisser: User - id: ID! - - """ - The associated repository - """ - repository: Repository! - - """ - The associated security advisory - """ - securityAdvisory: SecurityAdvisory - - """ - The associated security vulnerablity - """ - securityVulnerability: SecurityVulnerability - - """ - The vulnerable manifest filename - """ - vulnerableManifestFilename: String! - - """ - The vulnerable manifest path - """ - vulnerableManifestPath: String! - - """ - The vulnerable requirements - """ - vulnerableRequirements: String -} - -""" -The connection type for RepositoryVulnerabilityAlert. -""" -type RepositoryVulnerabilityAlertConnection { - """ - A list of edges. - """ - edges: [RepositoryVulnerabilityAlertEdge] - - """ - A list of nodes. - """ - nodes: [RepositoryVulnerabilityAlert] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type RepositoryVulnerabilityAlertEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: RepositoryVulnerabilityAlert -} - -""" -Autogenerated input type of RequestReviews -""" -input RequestReviewsInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the pull request to modify. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) - - """ - The Node IDs of the team to request. - """ - teamIds: [ID!] @possibleTypes(concreteTypes: ["Team"]) - - """ - Add users to the set rather than replace. - """ - union: Boolean - - """ - The Node IDs of the user to request. - """ - userIds: [ID!] @possibleTypes(concreteTypes: ["User"]) -} - -""" -Autogenerated return type of RequestReviews -""" -type RequestReviewsPayload { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The pull request that is getting requests. - """ - pullRequest: PullRequest - - """ - The edge from the pull request to the requested reviewers. - """ - requestedReviewersEdge: UserEdge -} - -""" -The possible states that can be requested when creating a check run. -""" -enum RequestableCheckStatusState @preview(toggledBy: "antiope-preview") { - """ - The check suite or run has been completed. - """ - COMPLETED - - """ - The check suite or run is in progress. - """ - IN_PROGRESS - - """ - The check suite or run has been queued. - """ - QUEUED -} - -""" -Types that can be requested reviewers. -""" -union RequestedReviewer = Mannequin | Team | User - -""" -Autogenerated input type of RerequestCheckSuite -""" -input RerequestCheckSuiteInput @preview(toggledBy: "antiope-preview") { - """ - The Node ID of the check suite. - """ - checkSuiteId: ID! @possibleTypes(concreteTypes: ["CheckSuite"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of RerequestCheckSuite -""" -type RerequestCheckSuitePayload @preview(toggledBy: "antiope-preview") { - """ - The requested check suite. - """ - checkSuite: CheckSuite - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of ResolveReviewThread -""" -input ResolveReviewThreadInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the thread to resolve - """ - threadId: ID! @possibleTypes(concreteTypes: ["PullRequestReviewThread"]) -} - -""" -Autogenerated return type of ResolveReviewThread -""" -type ResolveReviewThreadPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The thread to resolve. - """ - thread: PullRequestReviewThread -} - -""" -Represents a private contribution a user made on GitHub. -""" -type RestrictedContribution implements Contribution { - """ - Whether this contribution is associated with a record you do not have access to. For - example, your own 'first issue' contribution may have been made on a repository you can no - longer access. - """ - isRestricted: Boolean! - - """ - When this contribution was made. - """ - occurredAt: DateTime! - - """ - The HTTP path for this contribution. - """ - resourcePath: URI! - - """ - The HTTP URL for this contribution. - """ - url: URI! - - """ - The user who made this contribution. - """ - user: User! -} - -""" -A team or user who has the ability to dismiss a review on a protected branch. -""" -type ReviewDismissalAllowance implements Node { - """ - The actor that can dismiss. - """ - actor: ReviewDismissalAllowanceActor - - """ - Identifies the branch protection rule associated with the allowed user or team. - """ - branchProtectionRule: BranchProtectionRule - id: ID! -} - -""" -Types that can be an actor. -""" -union ReviewDismissalAllowanceActor = Team | User - -""" -The connection type for ReviewDismissalAllowance. -""" -type ReviewDismissalAllowanceConnection { - """ - A list of edges. - """ - edges: [ReviewDismissalAllowanceEdge] - - """ - A list of nodes. - """ - nodes: [ReviewDismissalAllowance] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ReviewDismissalAllowanceEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: ReviewDismissalAllowance -} - -""" -Represents a 'review_dismissed' event on a given issue or pull request. -""" -type ReviewDismissedEvent implements Node & UniformResourceLocatable { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - Identifies the optional message associated with the 'review_dismissed' event. - """ - dismissalMessage: String - - """ - Identifies the optional message associated with the event, rendered to HTML. - """ - dismissalMessageHTML: String - id: ID! - - """ - Identifies the previous state of the review with the 'review_dismissed' event. - """ - previousReviewState: PullRequestReviewState! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - Identifies the commit which caused the review to become stale. - """ - pullRequestCommit: PullRequestCommit - - """ - The HTTP path for this review dismissed event. - """ - resourcePath: URI! - - """ - Identifies the review associated with the 'review_dismissed' event. - """ - review: PullRequestReview - - """ - The HTTP URL for this review dismissed event. - """ - url: URI! -} - -""" -A request for a user to review a pull request. -""" -type ReviewRequest implements Node { - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - Identifies the pull request associated with this review request. - """ - pullRequest: PullRequest! - - """ - The reviewer that is requested. - """ - requestedReviewer: RequestedReviewer -} - -""" -The connection type for ReviewRequest. -""" -type ReviewRequestConnection { - """ - A list of edges. - """ - edges: [ReviewRequestEdge] - - """ - A list of nodes. - """ - nodes: [ReviewRequest] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ReviewRequestEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: ReviewRequest -} - -""" -Represents an 'review_request_removed' event on a given pull request. -""" -type ReviewRequestRemovedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - Identifies the reviewer whose review request was removed. - """ - requestedReviewer: RequestedReviewer -} - -""" -Represents an 'review_requested' event on a given pull request. -""" -type ReviewRequestedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - PullRequest referenced by event. - """ - pullRequest: PullRequest! - - """ - Identifies the reviewer whose review was requested. - """ - requestedReviewer: RequestedReviewer -} - -""" -A hovercard context with a message describing the current code review state of the pull -request. -""" -type ReviewStatusHovercardContext implements HovercardContext { - """ - A string describing this context - """ - message: String! - - """ - An octicon to accompany this context - """ - octicon: String! - - """ - The current status of the pull request with respect to code review. - """ - reviewDecision: PullRequestReviewDecision -} - -""" -The possible digest algorithms used to sign SAML requests for an identity provider. -""" -enum SamlDigestAlgorithm { - """ - SHA1 - """ - SHA1 - - """ - SHA256 - """ - SHA256 - - """ - SHA384 - """ - SHA384 - - """ - SHA512 - """ - SHA512 -} - -""" -The possible signature algorithms used to sign SAML requests for a Identity Provider. -""" -enum SamlSignatureAlgorithm { - """ - RSA-SHA1 - """ - RSA_SHA1 - - """ - RSA-SHA256 - """ - RSA_SHA256 - - """ - RSA-SHA384 - """ - RSA_SHA384 - - """ - RSA-SHA512 - """ - RSA_SHA512 -} - -""" -A Saved Reply is text a user can use to reply quickly. -""" -type SavedReply implements Node { - """ - The body of the saved reply. - """ - body: String! - - """ - The saved reply body rendered to HTML. - """ - bodyHTML: HTML! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - id: ID! - - """ - The title of the saved reply. - """ - title: String! - - """ - The user that saved this reply. - """ - user: Actor -} - -""" -The connection type for SavedReply. -""" -type SavedReplyConnection { - """ - A list of edges. - """ - edges: [SavedReplyEdge] - - """ - A list of nodes. - """ - nodes: [SavedReply] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type SavedReplyEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: SavedReply -} - -""" -Ordering options for saved reply connections. -""" -input SavedReplyOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order saved replies by. - """ - field: SavedReplyOrderField! -} - -""" -Properties by which saved reply connections can be ordered. -""" -enum SavedReplyOrderField { - """ - Order saved reply by when they were updated. - """ - UPDATED_AT -} - -""" -The results of a search. -""" -union SearchResultItem = App | Issue | MarketplaceListing | Organization | PullRequest | Repository | User - -""" -A list of results that matched against a search query. -""" -type SearchResultItemConnection { - """ - The number of pieces of code that matched the search query. - """ - codeCount: Int! - - """ - A list of edges. - """ - edges: [SearchResultItemEdge] - - """ - The number of issues that matched the search query. - """ - issueCount: Int! - - """ - A list of nodes. - """ - nodes: [SearchResultItem] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - The number of repositories that matched the search query. - """ - repositoryCount: Int! - - """ - The number of users that matched the search query. - """ - userCount: Int! - - """ - The number of wiki pages that matched the search query. - """ - wikiCount: Int! -} - -""" -An edge in a connection. -""" -type SearchResultItemEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: SearchResultItem - - """ - Text matches on the result found. - """ - textMatches: [TextMatch] -} - -""" -Represents the individual results of a search. -""" -enum SearchType { - """ - Returns results matching issues in repositories. - """ - ISSUE - - """ - Returns results matching repositories. - """ - REPOSITORY - - """ - Returns results matching users and organizations on GitHub. - """ - USER -} - -""" -A GitHub Security Advisory -""" -type SecurityAdvisory implements Node { - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - This is a long plaintext description of the advisory - """ - description: String! - - """ - The GitHub Security Advisory ID - """ - ghsaId: String! - id: ID! - - """ - A list of identifiers for this advisory - """ - identifiers: [SecurityAdvisoryIdentifier!]! - - """ - The organization that originated the advisory - """ - origin: String! - - """ - The permalink for the advisory - """ - permalink: URI - - """ - When the advisory was published - """ - publishedAt: DateTime! - - """ - A list of references for this advisory - """ - references: [SecurityAdvisoryReference!]! - - """ - The severity of the advisory - """ - severity: SecurityAdvisorySeverity! - - """ - A short plaintext summary of the advisory - """ - summary: String! - - """ - When the advisory was last updated - """ - updatedAt: DateTime! - - """ - Vulnerabilities associated with this Advisory - """ - vulnerabilities( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - An ecosystem to filter vulnerabilities by. - """ - ecosystem: SecurityAdvisoryEcosystem - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for the returned topics. - """ - orderBy: SecurityVulnerabilityOrder = {field: UPDATED_AT, direction: DESC} - - """ - A package name to filter vulnerabilities by. - """ - package: String - - """ - A list of severities to filter vulnerabilities by. - """ - severities: [SecurityAdvisorySeverity!] - ): SecurityVulnerabilityConnection! - - """ - When the advisory was withdrawn, if it has been withdrawn - """ - withdrawnAt: DateTime -} - -""" -The connection type for SecurityAdvisory. -""" -type SecurityAdvisoryConnection { - """ - A list of edges. - """ - edges: [SecurityAdvisoryEdge] - - """ - A list of nodes. - """ - nodes: [SecurityAdvisory] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -The possible ecosystems of a security vulnerability's package. -""" -enum SecurityAdvisoryEcosystem { - """ - PHP packages hosted at packagist.org - """ - COMPOSER - - """ - Java artifacts hosted at the Maven central repository - """ - MAVEN - - """ - JavaScript packages hosted at npmjs.com - """ - NPM - - """ - .NET packages hosted at the NuGet Gallery - """ - NUGET - - """ - Python packages hosted at PyPI.org - """ - PIP - - """ - Ruby gems hosted at RubyGems.org - """ - RUBYGEMS -} - -""" -An edge in a connection. -""" -type SecurityAdvisoryEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: SecurityAdvisory -} - -""" -A GitHub Security Advisory Identifier -""" -type SecurityAdvisoryIdentifier { - """ - The identifier type, e.g. GHSA, CVE - """ - type: String! - - """ - The identifier - """ - value: String! -} - -""" -An advisory identifier to filter results on. -""" -input SecurityAdvisoryIdentifierFilter { - """ - The identifier type. - """ - type: SecurityAdvisoryIdentifierType! - - """ - The identifier string. Supports exact or partial matching. - """ - value: String! -} - -""" -Identifier formats available for advisories. -""" -enum SecurityAdvisoryIdentifierType { - """ - Common Vulnerabilities and Exposures Identifier. - """ - CVE - - """ - GitHub Security Advisory ID. - """ - GHSA -} - -""" -Ordering options for security advisory connections -""" -input SecurityAdvisoryOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order security advisories by. - """ - field: SecurityAdvisoryOrderField! -} - -""" -Properties by which security advisory connections can be ordered. -""" -enum SecurityAdvisoryOrderField { - """ - Order advisories by publication time - """ - PUBLISHED_AT - - """ - Order advisories by update time - """ - UPDATED_AT -} - -""" -An individual package -""" -type SecurityAdvisoryPackage { - """ - The ecosystem the package belongs to, e.g. RUBYGEMS, NPM - """ - ecosystem: SecurityAdvisoryEcosystem! - - """ - The package name - """ - name: String! -} - -""" -An individual package version -""" -type SecurityAdvisoryPackageVersion { - """ - The package name or version - """ - identifier: String! -} - -""" -A GitHub Security Advisory Reference -""" -type SecurityAdvisoryReference { - """ - A publicly accessible reference - """ - url: URI! -} - -""" -Severity of the vulnerability. -""" -enum SecurityAdvisorySeverity { - """ - Critical. - """ - CRITICAL - - """ - High. - """ - HIGH - - """ - Low. - """ - LOW - - """ - Moderate. - """ - MODERATE -} - -""" -An individual vulnerability within an Advisory -""" -type SecurityVulnerability { - """ - The Advisory associated with this Vulnerability - """ - advisory: SecurityAdvisory! - - """ - The first version containing a fix for the vulnerability - """ - firstPatchedVersion: SecurityAdvisoryPackageVersion - - """ - A description of the vulnerable package - """ - package: SecurityAdvisoryPackage! - - """ - The severity of the vulnerability within this package - """ - severity: SecurityAdvisorySeverity! - - """ - When the vulnerability was last updated - """ - updatedAt: DateTime! - - """ - A string that describes the vulnerable package versions. - This string follows a basic syntax with a few forms. - + `= 0.2.0` denotes a single vulnerable version. - + `<= 1.0.8` denotes a version range up to and including the specified version - + `< 0.1.11` denotes a version range up to, but excluding, the specified version - + `>= 4.3.0, < 4.3.5` denotes a version range with a known minimum and maximum version. - + `>= 0.0.1` denotes a version range with a known minimum, but no known maximum - """ - vulnerableVersionRange: String! -} - -""" -The connection type for SecurityVulnerability. -""" -type SecurityVulnerabilityConnection { - """ - A list of edges. - """ - edges: [SecurityVulnerabilityEdge] - - """ - A list of nodes. - """ - nodes: [SecurityVulnerability] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type SecurityVulnerabilityEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: SecurityVulnerability -} - -""" -Ordering options for security vulnerability connections -""" -input SecurityVulnerabilityOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order security vulnerabilities by. - """ - field: SecurityVulnerabilityOrderField! -} - -""" -Properties by which security vulnerability connections can be ordered. -""" -enum SecurityVulnerabilityOrderField { - """ - Order vulnerability by update time - """ - UPDATED_AT -} - -""" -Autogenerated input type of SetEnterpriseIdentityProvider -""" -input SetEnterpriseIdentityProviderInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The digest algorithm used to sign SAML requests for the identity provider. - """ - digestMethod: SamlDigestAlgorithm! - - """ - The ID of the enterprise on which to set an identity provider. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The x509 certificate used by the identity provider to sign assertions and responses. - """ - idpCertificate: String! - - """ - The Issuer Entity ID for the SAML identity provider - """ - issuer: String - - """ - The signature algorithm used to sign SAML requests for the identity provider. - """ - signatureMethod: SamlSignatureAlgorithm! - - """ - The URL endpoint for the identity provider's SAML SSO. - """ - ssoUrl: URI! -} - -""" -Autogenerated return type of SetEnterpriseIdentityProvider -""" -type SetEnterpriseIdentityProviderPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The identity provider for the enterprise. - """ - identityProvider: EnterpriseIdentityProvider -} - -""" -Represents an S/MIME signature on a Commit or Tag. -""" -type SmimeSignature implements GitSignature { - """ - Email used to sign this object. - """ - email: String! - - """ - True if the signature is valid and verified by GitHub. - """ - isValid: Boolean! - - """ - Payload for GPG signing object. Raw ODB object without the signature header. - """ - payload: String! - - """ - ASCII-armored signature header from object. - """ - signature: String! - - """ - GitHub user corresponding to the email signing this commit. - """ - signer: User - - """ - The state of this signature. `VALID` if signature is valid and verified by - GitHub, otherwise represents reason why signature is considered invalid. - """ - state: GitSignatureState! - - """ - True if the signature was made with GitHub's signing key. - """ - wasSignedByGitHub: Boolean! -} - -""" -Entites that can sponsor others via GitHub Sponsors -""" -union Sponsor = Organization | User - -""" -Entities that can be sponsored through GitHub Sponsors -""" -interface Sponsorable { - """ - The GitHub Sponsors listing for this user. - """ - sponsorsListing: SponsorsListing - - """ - This object's sponsorships as the maintainer. - """ - sponsorshipsAsMaintainer( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Whether or not to include private sponsorships in the result set - """ - includePrivate: Boolean = false - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! - - """ - This object's sponsorships as the sponsor. - """ - sponsorshipsAsSponsor( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! -} - -""" -A GitHub Sponsors listing. -""" -type SponsorsListing implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The full description of the listing. - """ - fullDescription: String! - - """ - The full description of the listing rendered to HTML. - """ - fullDescriptionHTML: HTML! - id: ID! - - """ - The listing's full name. - """ - name: String! - - """ - The short description of the listing. - """ - shortDescription: String! - - """ - The short name of the listing. - """ - slug: String! - - """ - The published tiers for this GitHub Sponsors listing. - """ - tiers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for Sponsors tiers returned from the connection. - """ - orderBy: SponsorsTierOrder = {field: MONTHLY_PRICE_IN_CENTS, direction: ASC} - ): SponsorsTierConnection -} - -""" -A GitHub Sponsors tier associated with a GitHub Sponsors listing. -""" -type SponsorsTier implements Node { - """ - SponsorsTier information only visible to users that can administer the associated Sponsors listing. - """ - adminInfo: SponsorsTierAdminInfo - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The description of the tier. - """ - description: String! - - """ - The tier description rendered to HTML - """ - descriptionHTML: HTML! - id: ID! - - """ - How much this tier costs per month in cents. - """ - monthlyPriceInCents: Int! - - """ - How much this tier costs per month in dollars. - """ - monthlyPriceInDollars: Int! - - """ - The name of the tier. - """ - name: String! - - """ - The sponsors listing that this tier belongs to. - """ - sponsorsListing: SponsorsListing! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -SponsorsTier information only visible to users that can administer the associated Sponsors listing. -""" -type SponsorsTierAdminInfo { - """ - The sponsorships associated with this tier. - """ - sponsorships( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Whether or not to include private sponsorships in the result set - """ - includePrivate: Boolean = false - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! -} - -""" -The connection type for SponsorsTier. -""" -type SponsorsTierConnection { - """ - A list of edges. - """ - edges: [SponsorsTierEdge] - - """ - A list of nodes. - """ - nodes: [SponsorsTier] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type SponsorsTierEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: SponsorsTier -} - -""" -Ordering options for Sponsors tiers connections. -""" -input SponsorsTierOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order tiers by. - """ - field: SponsorsTierOrderField! -} - -""" -Properties by which Sponsors tiers connections can be ordered. -""" -enum SponsorsTierOrderField { - """ - Order tiers by creation time. - """ - CREATED_AT - - """ - Order tiers by their monthly price in cents - """ - MONTHLY_PRICE_IN_CENTS -} - -""" -A sponsorship relationship between a sponsor and a maintainer -""" -type Sponsorship implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - The entity that is being sponsored - """ - maintainer: User! @deprecated(reason: "`Sponsorship.maintainer` will be removed. Use `Sponsorship.sponsorable` instead. Removal on 2020-04-01 UTC.") - - """ - The privacy level for this sponsorship. - """ - privacyLevel: SponsorshipPrivacy! - - """ - The user that is sponsoring. Returns null if the sponsorship is private or if sponsor is not a user. - """ - sponsor: User @deprecated(reason: "`Sponsorship.sponsor` will be removed. Use `Sponsorship.sponsorEntity` instead. Removal on 2020-10-01 UTC.") - - """ - The user or organization that is sponsoring. Returns null if the sponsorship is private. - """ - sponsorEntity: Sponsor - - """ - The entity that is being sponsored - """ - sponsorable: Sponsorable! - - """ - The associated sponsorship tier - """ - tier: SponsorsTier -} - -""" -The connection type for Sponsorship. -""" -type SponsorshipConnection { - """ - A list of edges. - """ - edges: [SponsorshipEdge] - - """ - A list of nodes. - """ - nodes: [Sponsorship] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type SponsorshipEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Sponsorship -} - -""" -Ordering options for sponsorship connections. -""" -input SponsorshipOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order sponsorship by. - """ - field: SponsorshipOrderField! -} - -""" -Properties by which sponsorship connections can be ordered. -""" -enum SponsorshipOrderField { - """ - Order sponsorship by creation time. - """ - CREATED_AT -} - -""" -The privacy of a sponsorship -""" -enum SponsorshipPrivacy { - """ - Private - """ - PRIVATE - - """ - Public - """ - PUBLIC -} - -""" -Ways in which star connections can be ordered. -""" -input StarOrder { - """ - The direction in which to order nodes. - """ - direction: OrderDirection! - - """ - The field in which to order nodes by. - """ - field: StarOrderField! -} - -""" -Properties by which star connections can be ordered. -""" -enum StarOrderField { - """ - Allows ordering a list of stars by when they were created. - """ - STARRED_AT -} - -""" -The connection type for User. -""" -type StargazerConnection { - """ - A list of edges. - """ - edges: [StargazerEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a user that's starred a repository. -""" -type StargazerEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - node: User! - - """ - Identifies when the item was starred. - """ - starredAt: DateTime! -} - -""" -Things that can be starred. -""" -interface Starrable { - id: ID! - - """ - A list of users who have starred this starrable. - """ - stargazers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: StarOrder - ): StargazerConnection! - - """ - Returns a boolean indicating whether the viewing user has starred this starrable. - """ - viewerHasStarred: Boolean! -} - -""" -The connection type for Repository. -""" -type StarredRepositoryConnection { - """ - A list of edges. - """ - edges: [StarredRepositoryEdge] - - """ - Is the list of stars for this user truncated? This is true for users that have many stars. - """ - isOverLimit: Boolean! - - """ - A list of nodes. - """ - nodes: [Repository] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a starred repository. -""" -type StarredRepositoryEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - node: Repository! - - """ - Identifies when the item was starred. - """ - starredAt: DateTime! -} - -""" -Represents a commit status. -""" -type Status implements Node { - """ - The commit this status is attached to. - """ - commit: Commit - - """ - Looks up an individual status context by context name. - """ - context( - """ - The context name. - """ - name: String! - ): StatusContext - - """ - The individual status contexts for this commit. - """ - contexts: [StatusContext!]! - id: ID! - - """ - The combined commit status. - """ - state: StatusState! -} - -""" -Represents the rollup for both the check runs and status for a commit. -""" -type StatusCheckRollup implements Node { - """ - The commit the status and check runs are attached to. - """ - commit: Commit - - """ - A list of status contexts and check runs for this commit. - """ - contexts( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): StatusCheckRollupContextConnection! - id: ID! - - """ - The combined status for the commit. - """ - state: StatusState! -} - -""" -Types that can be inside a StatusCheckRollup context. -""" -union StatusCheckRollupContext = CheckRun | StatusContext - -""" -The connection type for StatusCheckRollupContext. -""" -type StatusCheckRollupContextConnection { - """ - A list of edges. - """ - edges: [StatusCheckRollupContextEdge] - - """ - A list of nodes. - """ - nodes: [StatusCheckRollupContext] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type StatusCheckRollupContextEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: StatusCheckRollupContext -} - -""" -Represents an individual commit status context -""" -type StatusContext implements Node { - """ - The avatar of the OAuth application or the user that created the status - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int = 40 - ): URI - - """ - This commit this status context is attached to. - """ - commit: Commit - - """ - The name of this status context. - """ - context: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The actor who created this status context. - """ - creator: Actor - - """ - The description for this status context. - """ - description: String - id: ID! - - """ - The state of this status context. - """ - state: StatusState! - - """ - The URL for this status context. - """ - targetUrl: URI -} - -""" -The possible commit status states. -""" -enum StatusState { - """ - Status is errored. - """ - ERROR - - """ - Status is expected. - """ - EXPECTED - - """ - Status is failing. - """ - FAILURE - - """ - Status is pending. - """ - PENDING - - """ - Status is successful. - """ - SUCCESS -} - -""" -Autogenerated input type of SubmitPullRequestReview -""" -input SubmitPullRequestReviewInput { - """ - The text field to set on the Pull Request Review. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The event to send to the Pull Request Review. - """ - event: PullRequestReviewEvent! - - """ - The Pull Request ID to submit any pending reviews. - """ - pullRequestId: ID @possibleTypes(concreteTypes: ["PullRequest"]) - - """ - The Pull Request Review ID to submit. - """ - pullRequestReviewId: ID @possibleTypes(concreteTypes: ["PullRequestReview"]) -} - -""" -Autogenerated return type of SubmitPullRequestReview -""" -type SubmitPullRequestReviewPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The submitted pull request review. - """ - pullRequestReview: PullRequestReview -} - -""" -A pointer to a repository at a specific revision embedded inside another repository. -""" -type Submodule { - """ - The branch of the upstream submodule for tracking updates - """ - branch: String - - """ - The git URL of the submodule repository - """ - gitUrl: URI! - - """ - The name of the submodule in .gitmodules - """ - name: String! - - """ - The path in the superproject that this submodule is located in - """ - path: String! - - """ - The commit revision of the subproject repository being tracked by the submodule - """ - subprojectCommitOid: GitObjectID -} - -""" -The connection type for Submodule. -""" -type SubmoduleConnection { - """ - A list of edges. - """ - edges: [SubmoduleEdge] - - """ - A list of nodes. - """ - nodes: [Submodule] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type SubmoduleEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Submodule -} - -""" -Entities that can be subscribed to for web and email notifications. -""" -interface Subscribable { - id: ID! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState -} - -""" -Represents a 'subscribed' event on a given `Subscribable`. -""" -type SubscribedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Object referenced by event. - """ - subscribable: Subscribable! -} - -""" -The possible states of a subscription. -""" -enum SubscriptionState { - """ - The User is never notified. - """ - IGNORED - - """ - The User is notified of all conversations. - """ - SUBSCRIBED - - """ - The User is only notified when participating or @mentioned. - """ - UNSUBSCRIBED -} - -""" -A suggestion to review a pull request based on a user's commit history and review comments. -""" -type SuggestedReviewer { - """ - Is this suggestion based on past commits? - """ - isAuthor: Boolean! - - """ - Is this suggestion based on past review comments? - """ - isCommenter: Boolean! - - """ - Identifies the user suggested to review the pull request. - """ - reviewer: User! -} - -""" -Represents a Git tag. -""" -type Tag implements GitObject & Node { - """ - An abbreviated version of the Git object ID - """ - abbreviatedOid: String! - - """ - The HTTP path for this Git object - """ - commitResourcePath: URI! - - """ - The HTTP URL for this Git object - """ - commitUrl: URI! - id: ID! - - """ - The Git tag message. - """ - message: String - - """ - The Git tag name. - """ - name: String! - - """ - The Git object ID - """ - oid: GitObjectID! - - """ - The Repository the Git object belongs to - """ - repository: Repository! - - """ - Details about the tag author. - """ - tagger: GitActor - - """ - The Git object the tag points to. - """ - target: GitObject! -} - -""" -A team of users in an organization. -""" -type Team implements MemberStatusable & Node & Subscribable { - """ - A list of teams that are ancestors of this team. - """ - ancestors( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): TeamConnection! - - """ - A URL pointing to the team's avatar. - """ - avatarUrl( - """ - The size in pixels of the resulting square image. - """ - size: Int = 400 - ): URI - - """ - List of child teams belonging to this team - """ - childTeams( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Whether to list immediate child teams or all descendant child teams. - """ - immediateOnly: Boolean = true - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: TeamOrder - - """ - User logins to filter by - """ - userLogins: [String!] - ): TeamConnection! - - """ - The slug corresponding to the organization and team. - """ - combinedSlug: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The description of the team. - """ - description: String - - """ - Find a team discussion by its number. - """ - discussion( - """ - The sequence number of the discussion to find. - """ - number: Int! - ): TeamDiscussion - - """ - A list of team discussions. - """ - discussions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If provided, filters discussions according to whether or not they are pinned. - """ - isPinned: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: TeamDiscussionOrder - ): TeamDiscussionConnection! - - """ - The HTTP path for team discussions - """ - discussionsResourcePath: URI! - - """ - The HTTP URL for team discussions - """ - discussionsUrl: URI! - - """ - The HTTP path for editing this team - """ - editTeamResourcePath: URI! - - """ - The HTTP URL for editing this team - """ - editTeamUrl: URI! - id: ID! - - """ - A list of pending invitations for users to this team - """ - invitations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): OrganizationInvitationConnection - - """ - Get the status messages members of this entity have set that are either public or visible only to the organization. - """ - memberStatuses( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for user statuses returned from the connection. - """ - orderBy: UserStatusOrder = {field: UPDATED_AT, direction: DESC} - ): UserStatusConnection! - - """ - A list of users who are members of this team. - """ - members( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter by membership type - """ - membership: TeamMembershipType = ALL - - """ - Order for the connection. - """ - orderBy: TeamMemberOrder - - """ - The search string to look for. - """ - query: String - - """ - Filter by team member role - """ - role: TeamMemberRole - ): TeamMemberConnection! - - """ - The HTTP path for the team' members - """ - membersResourcePath: URI! - - """ - The HTTP URL for the team' members - """ - membersUrl: URI! - - """ - The name of the team. - """ - name: String! - - """ - The HTTP path creating a new team - """ - newTeamResourcePath: URI! - - """ - The HTTP URL creating a new team - """ - newTeamUrl: URI! - - """ - The organization that owns this team. - """ - organization: Organization! - - """ - The parent team of the team. - """ - parentTeam: Team - - """ - The level of privacy the team has. - """ - privacy: TeamPrivacy! - - """ - A list of repositories this team has access to. - """ - repositories( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for the connection. - """ - orderBy: TeamRepositoryOrder - - """ - The search string to look for. - """ - query: String - ): TeamRepositoryConnection! - - """ - The HTTP path for this team's repositories - """ - repositoriesResourcePath: URI! - - """ - The HTTP URL for this team's repositories - """ - repositoriesUrl: URI! - - """ - The HTTP path for this team - """ - resourcePath: URI! - - """ - What algorithm is used for review assignment for this team - """ - reviewRequestDelegationAlgorithm: TeamReviewAssignmentAlgorithm @preview(toggledBy: "stone-crop-preview") - - """ - True if review assignment is enabled for this team - """ - reviewRequestDelegationEnabled: Boolean! @preview(toggledBy: "stone-crop-preview") - - """ - How many team members are required for review assignment for this team - """ - reviewRequestDelegationMemberCount: Int @preview(toggledBy: "stone-crop-preview") - - """ - When assigning team members via delegation, whether the entire team should be notified as well. - """ - reviewRequestDelegationNotifyTeam: Boolean! @preview(toggledBy: "stone-crop-preview") - - """ - The slug corresponding to the team. - """ - slug: String! - - """ - The HTTP path for this team's teams - """ - teamsResourcePath: URI! - - """ - The HTTP URL for this team's teams - """ - teamsUrl: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this team - """ - url: URI! - - """ - Team is adminable by the viewer. - """ - viewerCanAdminister: Boolean! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState -} - -""" -Audit log entry for a team.add_member event. -""" -type TeamAddMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & TeamAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - Whether the team was mapped to an LDAP Group. - """ - isLdapMapped: Boolean - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a team.add_repository event. -""" -type TeamAddRepositoryAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData & TeamAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - Whether the team was mapped to an LDAP Group. - """ - isLdapMapped: Boolean - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Metadata for an audit entry with action team.* -""" -interface TeamAuditEntryData { - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI -} - -""" -Audit log entry for a team.change_parent_team event. -""" -type TeamChangeParentTeamAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & TeamAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - Whether the team was mapped to an LDAP Group. - """ - isLdapMapped: Boolean - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The new parent team. - """ - parentTeam: Team - - """ - The name of the new parent team - """ - parentTeamName: String - - """ - The name of the former parent team - """ - parentTeamNameWas: String - - """ - The HTTP path for the parent team - """ - parentTeamResourcePath: URI - - """ - The HTTP URL for the parent team - """ - parentTeamUrl: URI - - """ - The former parent team. - """ - parentTeamWas: Team - - """ - The HTTP path for the previous parent team - """ - parentTeamWasResourcePath: URI - - """ - The HTTP URL for the previous parent team - """ - parentTeamWasUrl: URI - - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The connection type for Team. -""" -type TeamConnection { - """ - A list of edges. - """ - edges: [TeamEdge] - - """ - A list of nodes. - """ - nodes: [Team] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -A team discussion. -""" -type TeamDiscussion implements Comment & Deletable & Node & Reactable & Subscribable & UniformResourceLocatable & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the discussion's team. - """ - authorAssociation: CommentAuthorAssociation! - - """ - The body as Markdown. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - Identifies the discussion body hash. - """ - bodyVersion: String! - - """ - A list of comments on this discussion. - """ - comments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - When provided, filters the connection such that results begin with the comment with this number. - """ - fromComment: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: TeamDiscussionCommentOrder - ): TeamDiscussionCommentConnection! - - """ - The HTTP path for discussion comments - """ - commentsResourcePath: URI! - - """ - The HTTP URL for discussion comments - """ - commentsUrl: URI! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - Whether or not the discussion is pinned. - """ - isPinned: Boolean! - - """ - Whether or not the discussion is only visible to team members and org admins. - """ - isPrivate: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Identifies the discussion within its team. - """ - number: Int! - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The HTTP path for this discussion - """ - resourcePath: URI! - - """ - The team that defines the context of this discussion. - """ - team: Team! - - """ - The title of the discussion - """ - title: String! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this discussion - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Whether or not the current viewer can pin this discussion. - """ - viewerCanPin: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the viewer is able to change their subscription status for the repository. - """ - viewerCanSubscribe: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! - - """ - Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. - """ - viewerSubscription: SubscriptionState -} - -""" -A comment on a team discussion. -""" -type TeamDiscussionComment implements Comment & Deletable & Node & Reactable & UniformResourceLocatable & Updatable & UpdatableComment { - """ - The actor who authored the comment. - """ - author: Actor - - """ - Author's association with the comment's team. - """ - authorAssociation: CommentAuthorAssociation! - - """ - The body as Markdown. - """ - body: String! - - """ - The body rendered to HTML. - """ - bodyHTML: HTML! - - """ - The body rendered to text. - """ - bodyText: String! - - """ - The current version of the body content. - """ - bodyVersion: String! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Check if this comment was created via an email reply. - """ - createdViaEmail: Boolean! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The discussion this comment is about. - """ - discussion: TeamDiscussion! - - """ - The actor who edited the comment. - """ - editor: Actor - id: ID! - - """ - Check if this comment was edited and includes an edit with the creation data - """ - includesCreatedEdit: Boolean! - - """ - The moment the editor made the last edit - """ - lastEditedAt: DateTime - - """ - Identifies the comment number. - """ - number: Int! - - """ - Identifies when the comment was published at. - """ - publishedAt: DateTime - - """ - A list of reactions grouped by content left on the subject. - """ - reactionGroups: [ReactionGroup!] - - """ - A list of Reactions left on the Issue. - """ - reactions( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Allows filtering Reactions by emoji. - """ - content: ReactionContent - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Allows specifying the order in which reactions are returned. - """ - orderBy: ReactionOrder - ): ReactionConnection! - - """ - The HTTP path for this comment - """ - resourcePath: URI! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this comment - """ - url: URI! - - """ - A list of edits to this content. - """ - userContentEdits( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UserContentEditConnection - - """ - Check if the current viewer can delete this object. - """ - viewerCanDelete: Boolean! - - """ - Can user react to this subject - """ - viewerCanReact: Boolean! - - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! - - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! - - """ - Did the viewer author this comment. - """ - viewerDidAuthor: Boolean! -} - -""" -The connection type for TeamDiscussionComment. -""" -type TeamDiscussionCommentConnection { - """ - A list of edges. - """ - edges: [TeamDiscussionCommentEdge] - - """ - A list of nodes. - """ - nodes: [TeamDiscussionComment] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type TeamDiscussionCommentEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: TeamDiscussionComment -} - -""" -Ways in which team discussion comment connections can be ordered. -""" -input TeamDiscussionCommentOrder { - """ - The direction in which to order nodes. - """ - direction: OrderDirection! - - """ - The field by which to order nodes. - """ - field: TeamDiscussionCommentOrderField! -} - -""" -Properties by which team discussion comment connections can be ordered. -""" -enum TeamDiscussionCommentOrderField { - """ - Allows sequential ordering of team discussion comments (which is equivalent to chronological ordering). - """ - NUMBER -} - -""" -The connection type for TeamDiscussion. -""" -type TeamDiscussionConnection { - """ - A list of edges. - """ - edges: [TeamDiscussionEdge] - - """ - A list of nodes. - """ - nodes: [TeamDiscussion] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type TeamDiscussionEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: TeamDiscussion -} - -""" -Ways in which team discussion connections can be ordered. -""" -input TeamDiscussionOrder { - """ - The direction in which to order nodes. - """ - direction: OrderDirection! - - """ - The field by which to order nodes. - """ - field: TeamDiscussionOrderField! -} - -""" -Properties by which team discussion connections can be ordered. -""" -enum TeamDiscussionOrderField { - """ - Allows chronological ordering of team discussions. - """ - CREATED_AT -} - -""" -An edge in a connection. -""" -type TeamEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Team -} - -""" -The connection type for User. -""" -type TeamMemberConnection { - """ - A list of edges. - """ - edges: [TeamMemberEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a user who is a member of a team. -""" -type TeamMemberEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The HTTP path to the organization's member access page. - """ - memberAccessResourcePath: URI! - - """ - The HTTP URL to the organization's member access page. - """ - memberAccessUrl: URI! - node: User! - - """ - The role the member has on the team. - """ - role: TeamMemberRole! -} - -""" -Ordering options for team member connections -""" -input TeamMemberOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order team members by. - """ - field: TeamMemberOrderField! -} - -""" -Properties by which team member connections can be ordered. -""" -enum TeamMemberOrderField { - """ - Order team members by creation time - """ - CREATED_AT - - """ - Order team members by login - """ - LOGIN -} - -""" -The possible team member roles; either 'maintainer' or 'member'. -""" -enum TeamMemberRole { - """ - A team maintainer has permission to add and remove team members. - """ - MAINTAINER - - """ - A team member has no administrative permissions on the team. - """ - MEMBER -} - -""" -Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL. -""" -enum TeamMembershipType { - """ - Includes immediate and child team members for the team. - """ - ALL - - """ - Includes only child team members for the team. - """ - CHILD_TEAM - - """ - Includes only immediate members of the team. - """ - IMMEDIATE -} - -""" -Ways in which team connections can be ordered. -""" -input TeamOrder { - """ - The direction in which to order nodes. - """ - direction: OrderDirection! - - """ - The field in which to order nodes by. - """ - field: TeamOrderField! -} - -""" -Properties by which team connections can be ordered. -""" -enum TeamOrderField { - """ - Allows ordering a list of teams by name. - """ - NAME -} - -""" -The possible team privacy values. -""" -enum TeamPrivacy { - """ - A secret team can only be seen by its members. - """ - SECRET - - """ - A visible team can be seen and @mentioned by every member of the organization. - """ - VISIBLE -} - -""" -Audit log entry for a team.remove_member event. -""" -type TeamRemoveMemberAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & TeamAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - Whether the team was mapped to an LDAP Group. - """ - isLdapMapped: Boolean - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -Audit log entry for a team.remove_repository event. -""" -type TeamRemoveRepositoryAuditEntry implements AuditEntry & Node & OrganizationAuditEntryData & RepositoryAuditEntryData & TeamAuditEntryData { - """ - The action name - """ - action: String! - - """ - The user who initiated the action - """ - actor: AuditEntryActor - - """ - The IP address of the actor - """ - actorIp: String - - """ - A readable representation of the actor's location - """ - actorLocation: ActorLocation - - """ - The username of the user who initiated the action - """ - actorLogin: String - - """ - The HTTP path for the actor. - """ - actorResourcePath: URI - - """ - The HTTP URL for the actor. - """ - actorUrl: URI - - """ - The time the action was initiated - """ - createdAt: PreciseDateTime! - id: ID! - - """ - Whether the team was mapped to an LDAP Group. - """ - isLdapMapped: Boolean - - """ - The corresponding operation type for the action - """ - operationType: OperationType - - """ - The Organization associated with the Audit Entry. - """ - organization: Organization - - """ - The name of the Organization. - """ - organizationName: String - - """ - The HTTP path for the organization - """ - organizationResourcePath: URI - - """ - The HTTP URL for the organization - """ - organizationUrl: URI - - """ - The repository associated with the action - """ - repository: Repository - - """ - The name of the repository - """ - repositoryName: String - - """ - The HTTP path for the repository - """ - repositoryResourcePath: URI - - """ - The HTTP URL for the repository - """ - repositoryUrl: URI - - """ - The team associated with the action - """ - team: Team - - """ - The name of the team - """ - teamName: String - - """ - The HTTP path for this team - """ - teamResourcePath: URI - - """ - The HTTP URL for this team - """ - teamUrl: URI - - """ - The user affected by the action - """ - user: User - - """ - For actions involving two users, the actor is the initiator and the user is the affected user. - """ - userLogin: String - - """ - The HTTP path for the user. - """ - userResourcePath: URI - - """ - The HTTP URL for the user. - """ - userUrl: URI -} - -""" -The connection type for Repository. -""" -type TeamRepositoryConnection { - """ - A list of edges. - """ - edges: [TeamRepositoryEdge] - - """ - A list of nodes. - """ - nodes: [Repository] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -Represents a team repository. -""" -type TeamRepositoryEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - node: Repository! - - """ - The permission level the team has on the repository - - **Upcoming Change on 2020-10-01 UTC** - **Description:** Type for `permission` will change from `RepositoryPermission!` to `String`. - **Reason:** This field may return additional values - """ - permission: RepositoryPermission! -} - -""" -Ordering options for team repository connections -""" -input TeamRepositoryOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order repositories by. - """ - field: TeamRepositoryOrderField! -} - -""" -Properties by which team repository connections can be ordered. -""" -enum TeamRepositoryOrderField { - """ - Order repositories by creation time - """ - CREATED_AT - - """ - Order repositories by name - """ - NAME - - """ - Order repositories by permission - """ - PERMISSION - - """ - Order repositories by push time - """ - PUSHED_AT - - """ - Order repositories by number of stargazers - """ - STARGAZERS - - """ - Order repositories by update time - """ - UPDATED_AT -} - -""" -The possible team review assignment algorithms -""" -enum TeamReviewAssignmentAlgorithm @preview(toggledBy: "stone-crop-preview") { - """ - Balance review load across the entire team - """ - LOAD_BALANCE - - """ - Alternate reviews between each team member - """ - ROUND_ROBIN -} - -""" -The role of a user on a team. -""" -enum TeamRole { - """ - User has admin rights on the team. - """ - ADMIN - - """ - User is a member of the team. - """ - MEMBER -} - -""" -A text match within a search result. -""" -type TextMatch { - """ - The specific text fragment within the property matched on. - """ - fragment: String! - - """ - Highlights within the matched fragment. - """ - highlights: [TextMatchHighlight!]! - - """ - The property matched on. - """ - property: String! -} - -""" -Represents a single highlight in a search result match. -""" -type TextMatchHighlight { - """ - The indice in the fragment where the matched text begins. - """ - beginIndice: Int! - - """ - The indice in the fragment where the matched text ends. - """ - endIndice: Int! - - """ - The text matched. - """ - text: String! -} - -""" -A topic aggregates entities that are related to a subject. -""" -type Topic implements Node & Starrable { - id: ID! - - """ - The topic's name. - """ - name: String! - - """ - A list of related topics, including aliases of this topic, sorted with the most relevant - first. Returns up to 10 Topics. - """ - relatedTopics( - """ - How many topics to return. - """ - first: Int = 3 - ): [Topic!]! - - """ - A list of users who have starred this starrable. - """ - stargazers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: StarOrder - ): StargazerConnection! - - """ - Returns a boolean indicating whether the viewing user has starred this starrable. - """ - viewerHasStarred: Boolean! -} - -""" -Metadata for an audit entry with a topic. -""" -interface TopicAuditEntryData { - """ - The name of the topic added to the repository - """ - topic: Topic - - """ - The name of the topic added to the repository - """ - topicName: String -} - -""" -Reason that the suggested topic is declined. -""" -enum TopicSuggestionDeclineReason { - """ - The suggested topic is not relevant to the repository. - """ - NOT_RELEVANT - - """ - The viewer does not like the suggested topic. - """ - PERSONAL_PREFERENCE - - """ - The suggested topic is too general for the repository. - """ - TOO_GENERAL - - """ - The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1). - """ - TOO_SPECIFIC -} - -""" -Autogenerated input type of TransferIssue -""" -input TransferIssueInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the issue to be transferred - """ - issueId: ID! @possibleTypes(concreteTypes: ["Issue"]) - - """ - The Node ID of the repository the issue should be transferred to - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of TransferIssue -""" -type TransferIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue that was transferred - """ - issue: Issue -} - -""" -Represents a 'transferred' event on a given issue or pull request. -""" -type TransferredEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - The repository this came from - """ - fromRepository: Repository - id: ID! - - """ - Identifies the issue associated with the event. - """ - issue: Issue! -} - -""" -Represents a Git tree. -""" -type Tree implements GitObject & Node { - """ - An abbreviated version of the Git object ID - """ - abbreviatedOid: String! - - """ - The HTTP path for this Git object - """ - commitResourcePath: URI! - - """ - The HTTP URL for this Git object - """ - commitUrl: URI! - - """ - A list of tree entries. - """ - entries: [TreeEntry!] - id: ID! - - """ - The Git object ID - """ - oid: GitObjectID! - - """ - The Repository the Git object belongs to - """ - repository: Repository! -} - -""" -Represents a Git tree entry. -""" -type TreeEntry { - """ - Entry file mode. - """ - mode: Int! - - """ - Entry file name. - """ - name: String! - - """ - Entry file object. - """ - object: GitObject - - """ - Entry file Git object ID. - """ - oid: GitObjectID! - - """ - The Repository the tree entry belongs to - """ - repository: Repository! - - """ - If the TreeEntry is for a directory occupied by a submodule project, this returns the corresponding submodule - """ - submodule: Submodule - - """ - Entry file type. - """ - type: String! -} - -""" -An RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI string. -""" -scalar URI - -""" -Autogenerated input type of UnarchiveRepository -""" -input UnarchiveRepositoryInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the repository to unarchive. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of UnarchiveRepository -""" -type UnarchiveRepositoryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The repository that was unarchived. - """ - repository: Repository -} - -""" -Represents an 'unassigned' event on any assignable object. -""" -type UnassignedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the assignable associated with the event. - """ - assignable: Assignable! - - """ - Identifies the user or mannequin that was unassigned. - """ - assignee: Assignee - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the subject (user) who was unassigned. - """ - user: User @deprecated(reason: "Assignees can now be mannequins. Use the `assignee` field instead. Removal on 2020-01-01 UTC.") -} - -""" -Autogenerated input type of UnfollowUser -""" -input UnfollowUserInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the user to unfollow. - """ - userId: ID! @possibleTypes(concreteTypes: ["User"]) -} - -""" -Autogenerated return type of UnfollowUser -""" -type UnfollowUserPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The user that was unfollowed. - """ - user: User -} - -""" -Represents a type that can be retrieved by a URL. -""" -interface UniformResourceLocatable { - """ - The HTML path to this resource. - """ - resourcePath: URI! - - """ - The URL to this resource. - """ - url: URI! -} - -""" -Represents an unknown signature on a Commit or Tag. -""" -type UnknownSignature implements GitSignature { - """ - Email used to sign this object. - """ - email: String! - - """ - True if the signature is valid and verified by GitHub. - """ - isValid: Boolean! - - """ - Payload for GPG signing object. Raw ODB object without the signature header. - """ - payload: String! - - """ - ASCII-armored signature header from object. - """ - signature: String! - - """ - GitHub user corresponding to the email signing this commit. - """ - signer: User - - """ - The state of this signature. `VALID` if signature is valid and verified by - GitHub, otherwise represents reason why signature is considered invalid. - """ - state: GitSignatureState! - - """ - True if the signature was made with GitHub's signing key. - """ - wasSignedByGitHub: Boolean! -} - -""" -Represents an 'unlabeled' event on a given issue or pull request. -""" -type UnlabeledEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the label associated with the 'unlabeled' event. - """ - label: Label! - - """ - Identifies the `Labelable` associated with the event. - """ - labelable: Labelable! -} - -""" -Autogenerated input type of UnlinkRepositoryFromProject -""" -input UnlinkRepositoryFromProjectInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the Project linked to the Repository. - """ - projectId: ID! @possibleTypes(concreteTypes: ["Project"]) - - """ - The ID of the Repository linked to the Project. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of UnlinkRepositoryFromProject -""" -type UnlinkRepositoryFromProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The linked Project. - """ - project: Project - - """ - The linked Repository. - """ - repository: Repository -} - -""" -Autogenerated input type of UnlockLockable -""" -input UnlockLockableInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the issue or pull request to be unlocked. - """ - lockableId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "Lockable") -} - -""" -Autogenerated return type of UnlockLockable -""" -type UnlockLockablePayload { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The item that was unlocked. - """ - unlockedRecord: Lockable -} - -""" -Represents an 'unlocked' event on a given issue or pull request. -""" -type UnlockedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Object that was unlocked. - """ - lockable: Lockable! -} - -""" -Autogenerated input type of UnmarkIssueAsDuplicate -""" -input UnmarkIssueAsDuplicateInput { - """ - ID of the issue or pull request currently considered canonical/authoritative/original. - """ - canonicalId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "IssueOrPullRequest") - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - ID of the issue or pull request currently marked as a duplicate. - """ - duplicateId: ID! @possibleTypes(concreteTypes: ["Issue", "PullRequest"], abstractType: "IssueOrPullRequest") -} - -""" -Autogenerated return type of UnmarkIssueAsDuplicate -""" -type UnmarkIssueAsDuplicatePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue or pull request that was marked as a duplicate. - """ - duplicate: IssueOrPullRequest -} - -""" -Represents an 'unmarked_as_duplicate' event on a given issue or pull request. -""" -type UnmarkedAsDuplicateEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! -} - -""" -Autogenerated input type of UnminimizeComment -""" -input UnminimizeCommentInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the subject to modify. - """ - subjectId: ID! @possibleTypes(concreteTypes: ["CommitComment", "GistComment", "IssueComment", "PullRequestReviewComment"], abstractType: "Minimizable") -} - -""" -Autogenerated return type of UnminimizeComment -""" -type UnminimizeCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The comment that was unminimized. - """ - unminimizedComment: Minimizable -} - -""" -Autogenerated input type of UnpinIssue -""" -input UnpinIssueInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the issue to be unpinned - """ - issueId: ID! @possibleTypes(concreteTypes: ["Issue"]) -} - -""" -Autogenerated return type of UnpinIssue -""" -type UnpinIssuePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue that was unpinned - """ - issue: Issue -} - -""" -Represents an 'unpinned' event on a given issue or pull request. -""" -type UnpinnedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Identifies the issue associated with the event. - """ - issue: Issue! -} - -""" -Autogenerated input type of UnresolveReviewThread -""" -input UnresolveReviewThreadInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the thread to unresolve - """ - threadId: ID! @possibleTypes(concreteTypes: ["PullRequestReviewThread"]) -} - -""" -Autogenerated return type of UnresolveReviewThread -""" -type UnresolveReviewThreadPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The thread to resolve. - """ - thread: PullRequestReviewThread -} - -""" -Represents an 'unsubscribed' event on a given `Subscribable`. -""" -type UnsubscribedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - Object referenced by event. - """ - subscribable: Subscribable! -} - -""" -Entities that can be updated. -""" -interface Updatable { - """ - Check if the current viewer can update this object. - """ - viewerCanUpdate: Boolean! -} - -""" -Comments that can be updated. -""" -interface UpdatableComment { - """ - Reasons why the current viewer can not update this comment. - """ - viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! -} - -""" -Autogenerated input type of UpdateBranchProtectionRule -""" -input UpdateBranchProtectionRuleInput { - """ - The global relay id of the branch protection rule to be updated. - """ - branchProtectionRuleId: ID! @possibleTypes(concreteTypes: ["BranchProtectionRule"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Will new commits pushed to matching branches dismiss pull request review approvals. - """ - dismissesStaleReviews: Boolean - - """ - Can admins overwrite branch protection. - """ - isAdminEnforced: Boolean - - """ - The glob-like pattern used to determine matching branches. - """ - pattern: String - - """ - A list of User, Team or App IDs allowed to push to matching branches. - """ - pushActorIds: [ID!] - - """ - Number of approving reviews required to update matching branches. - """ - requiredApprovingReviewCount: Int - - """ - List of required status check contexts that must pass for commits to be accepted to matching branches. - """ - requiredStatusCheckContexts: [String!] - - """ - Are approving reviews required to update matching branches. - """ - requiresApprovingReviews: Boolean - - """ - Are reviews from code owners required to update matching branches. - """ - requiresCodeOwnerReviews: Boolean - - """ - Are commits required to be signed. - """ - requiresCommitSignatures: Boolean - - """ - Are status checks required to update matching branches. - """ - requiresStatusChecks: Boolean - - """ - Are branches required to be up to date before merging. - """ - requiresStrictStatusChecks: Boolean - - """ - Is pushing to matching branches restricted. - """ - restrictsPushes: Boolean - - """ - Is dismissal of pull request reviews restricted. - """ - restrictsReviewDismissals: Boolean - - """ - A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. - """ - reviewDismissalActorIds: [ID!] -} - -""" -Autogenerated return type of UpdateBranchProtectionRule -""" -type UpdateBranchProtectionRulePayload { - """ - The newly created BranchProtectionRule. - """ - branchProtectionRule: BranchProtectionRule - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of UpdateCheckRun -""" -input UpdateCheckRunInput @preview(toggledBy: "antiope-preview") { - """ - Possible further actions the integrator can perform, which a user may trigger. - """ - actions: [CheckRunAction!] - - """ - The node of the check. - """ - checkRunId: ID! @possibleTypes(concreteTypes: ["CheckRun"]) - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The time that the check run finished. - """ - completedAt: DateTime - - """ - The final conclusion of the check. - """ - conclusion: CheckConclusionState - - """ - The URL of the integrator's site that has the full details of the check. - """ - detailsUrl: URI - - """ - A reference for the run on the integrator's system. - """ - externalId: String - - """ - The name of the check. - """ - name: String - - """ - Descriptive details about the run. - """ - output: CheckRunOutput - - """ - The node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - The time that the check run began. - """ - startedAt: DateTime - - """ - The current status. - """ - status: RequestableCheckStatusState -} - -""" -Autogenerated return type of UpdateCheckRun -""" -type UpdateCheckRunPayload @preview(toggledBy: "antiope-preview") { - """ - The updated check run. - """ - checkRun: CheckRun - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of UpdateCheckSuitePreferences -""" -input UpdateCheckSuitePreferencesInput @preview(toggledBy: "antiope-preview") { - """ - The check suite preferences to modify. - """ - autoTriggerPreferences: [CheckSuiteAutoTriggerPreference!]! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of UpdateCheckSuitePreferences -""" -type UpdateCheckSuitePreferencesPayload @preview(toggledBy: "antiope-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated repository. - """ - repository: Repository -} - -""" -Autogenerated input type of UpdateEnterpriseActionExecutionCapabilitySetting -""" -input UpdateEnterpriseActionExecutionCapabilitySettingInput { - """ - The value for the action execution capability setting on the enterprise. - """ - capability: ActionExecutionCapabilitySetting! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can create repositories setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) -} - -""" -Autogenerated return type of UpdateEnterpriseActionExecutionCapabilitySetting -""" -type UpdateEnterpriseActionExecutionCapabilitySettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated action execution capability setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the action execution capability setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseAdministratorRole -""" -input UpdateEnterpriseAdministratorRoleInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the Enterprise which the admin belongs to. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The login of a administrator whose role is being changed. - """ - login: String! - - """ - The new role for the Enterprise administrator. - """ - role: EnterpriseAdministratorRole! -} - -""" -Autogenerated return type of UpdateEnterpriseAdministratorRole -""" -type UpdateEnterpriseAdministratorRolePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A message confirming the result of changing the administrator's role. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseAllowPrivateRepositoryForkingSetting -""" -input UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the allow private repository forking setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the allow private repository forking setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseAllowPrivateRepositoryForkingSetting -""" -type UpdateEnterpriseAllowPrivateRepositoryForkingSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated allow private repository forking setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the allow private repository forking setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseDefaultRepositoryPermissionSetting -""" -input UpdateEnterpriseDefaultRepositoryPermissionSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the default repository permission setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the default repository permission setting on the enterprise. - """ - settingValue: EnterpriseDefaultRepositoryPermissionSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseDefaultRepositoryPermissionSetting -""" -type UpdateEnterpriseDefaultRepositoryPermissionSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated default repository permission setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the default repository permission setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanChangeRepositoryVisibilitySetting -""" -input UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can change repository visibility setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can change repository visibility setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanChangeRepositoryVisibilitySetting -""" -type UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can change repository visibility setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can change repository visibility setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanCreateRepositoriesSetting -""" -input UpdateEnterpriseMembersCanCreateRepositoriesSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can create repositories setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - Allow members to create internal repositories. Defaults to current value. - """ - membersCanCreateInternalRepositories: Boolean - - """ - Allow members to create private repositories. Defaults to current value. - """ - membersCanCreatePrivateRepositories: Boolean - - """ - Allow members to create public repositories. Defaults to current value. - """ - membersCanCreatePublicRepositories: Boolean - - """ - When false, allow member organizations to set their own repository creation member privileges. - """ - membersCanCreateRepositoriesPolicyEnabled: Boolean - - """ - Value for the members can create repositories setting on the enterprise. This - or the granular public/private/internal allowed fields (but not both) must be provided. - """ - settingValue: EnterpriseMembersCanCreateRepositoriesSettingValue -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanCreateRepositoriesSetting -""" -type UpdateEnterpriseMembersCanCreateRepositoriesSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can create repositories setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can create repositories setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanDeleteIssuesSetting -""" -input UpdateEnterpriseMembersCanDeleteIssuesSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can delete issues setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can delete issues setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanDeleteIssuesSetting -""" -type UpdateEnterpriseMembersCanDeleteIssuesSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can delete issues setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can delete issues setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanDeleteRepositoriesSetting -""" -input UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can delete repositories setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can delete repositories setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanDeleteRepositoriesSetting -""" -type UpdateEnterpriseMembersCanDeleteRepositoriesSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can delete repositories setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can delete repositories setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanInviteCollaboratorsSetting -""" -input UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can invite collaborators setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can invite collaborators setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanInviteCollaboratorsSetting -""" -type UpdateEnterpriseMembersCanInviteCollaboratorsSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can invite collaborators setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can invite collaborators setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanMakePurchasesSetting -""" -input UpdateEnterpriseMembersCanMakePurchasesSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can make purchases setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can make purchases setting on the enterprise. - """ - settingValue: EnterpriseMembersCanMakePurchasesSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanMakePurchasesSetting -""" -type UpdateEnterpriseMembersCanMakePurchasesSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can make purchases setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can make purchases setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanUpdateProtectedBranchesSetting -""" -input UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can update protected branches setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can update protected branches setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanUpdateProtectedBranchesSetting -""" -type UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can update protected branches setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can update protected branches setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseMembersCanViewDependencyInsightsSetting -""" -input UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the members can view dependency insights setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the members can view dependency insights setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseMembersCanViewDependencyInsightsSetting -""" -type UpdateEnterpriseMembersCanViewDependencyInsightsSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated members can view dependency insights setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the members can view dependency insights setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseOrganizationProjectsSetting -""" -input UpdateEnterpriseOrganizationProjectsSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the organization projects setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the organization projects setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseOrganizationProjectsSetting -""" -type UpdateEnterpriseOrganizationProjectsSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated organization projects setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the organization projects setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseProfile -""" -input UpdateEnterpriseProfileInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The description of the enterprise. - """ - description: String - - """ - The Enterprise ID to update. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The location of the enterprise. - """ - location: String - - """ - The name of the enterprise. - """ - name: String - - """ - The URL of the enterprise's website. - """ - websiteUrl: String -} - -""" -Autogenerated return type of UpdateEnterpriseProfile -""" -type UpdateEnterpriseProfilePayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated enterprise. - """ - enterprise: Enterprise -} - -""" -Autogenerated input type of UpdateEnterpriseRepositoryProjectsSetting -""" -input UpdateEnterpriseRepositoryProjectsSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the repository projects setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the repository projects setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseRepositoryProjectsSetting -""" -type UpdateEnterpriseRepositoryProjectsSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated repository projects setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the repository projects setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseTeamDiscussionsSetting -""" -input UpdateEnterpriseTeamDiscussionsSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the team discussions setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the team discussions setting on the enterprise. - """ - settingValue: EnterpriseEnabledDisabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseTeamDiscussionsSetting -""" -type UpdateEnterpriseTeamDiscussionsSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated team discussions setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the team discussions setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateEnterpriseTwoFactorAuthenticationRequiredSetting -""" -input UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the enterprise on which to set the two factor authentication required setting. - """ - enterpriseId: ID! @possibleTypes(concreteTypes: ["Enterprise"]) - - """ - The value for the two factor authentication required setting on the enterprise. - """ - settingValue: EnterpriseEnabledSettingValue! -} - -""" -Autogenerated return type of UpdateEnterpriseTwoFactorAuthenticationRequiredSetting -""" -type UpdateEnterpriseTwoFactorAuthenticationRequiredSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The enterprise with the updated two factor authentication required setting. - """ - enterprise: Enterprise - - """ - A message confirming the result of updating the two factor authentication required setting. - """ - message: String -} - -""" -Autogenerated input type of UpdateIpAllowListEnabledSetting -""" -input UpdateIpAllowListEnabledSettingInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the owner on which to set the IP allow list enabled setting. - """ - ownerId: ID! @possibleTypes(concreteTypes: ["Enterprise", "Organization"], abstractType: "IpAllowListOwner") - - """ - The value for the IP allow list enabled setting. - """ - settingValue: IpAllowListEnabledSettingValue! -} - -""" -Autogenerated return type of UpdateIpAllowListEnabledSetting -""" -type UpdateIpAllowListEnabledSettingPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The IP allow list owner on which the setting was updated. - """ - owner: IpAllowListOwner -} - -""" -Autogenerated input type of UpdateIpAllowListEntry -""" -input UpdateIpAllowListEntryInput { - """ - An IP address or range of addresses in CIDR notation. - """ - allowListValue: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the IP allow list entry to update. - """ - ipAllowListEntryId: ID! @possibleTypes(concreteTypes: ["IpAllowListEntry"]) - - """ - Whether the IP allow list entry is active when an IP allow list is enabled. - """ - isActive: Boolean! - - """ - An optional name for the IP allow list entry. - """ - name: String -} - -""" -Autogenerated return type of UpdateIpAllowListEntry -""" -type UpdateIpAllowListEntryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The IP allow list entry that was updated. - """ - ipAllowListEntry: IpAllowListEntry -} - -""" -Autogenerated input type of UpdateIssueComment -""" -input UpdateIssueCommentInput { - """ - The updated text of the comment. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the IssueComment to modify. - """ - id: ID! @possibleTypes(concreteTypes: ["IssueComment"]) -} - -""" -Autogenerated return type of UpdateIssueComment -""" -type UpdateIssueCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated comment. - """ - issueComment: IssueComment -} - -""" -Autogenerated input type of UpdateIssue -""" -input UpdateIssueInput { - """ - An array of Node IDs of users for this issue. - """ - assigneeIds: [ID!] @possibleTypes(concreteTypes: ["User"]) - - """ - The body for the issue description. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the Issue to modify. - """ - id: ID! @possibleTypes(concreteTypes: ["Issue"]) - - """ - An array of Node IDs of labels for this issue. - """ - labelIds: [ID!] @possibleTypes(concreteTypes: ["Label"]) - - """ - The Node ID of the milestone for this issue. - """ - milestoneId: ID @possibleTypes(concreteTypes: ["Milestone"]) - - """ - An array of Node IDs for projects associated with this issue. - """ - projectIds: [ID!] - - """ - The desired issue state. - """ - state: IssueState - - """ - The title for the issue. - """ - title: String -} - -""" -Autogenerated return type of UpdateIssue -""" -type UpdateIssuePayload { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The issue. - """ - issue: Issue -} - -""" -Autogenerated input type of UpdateLabel -""" -input UpdateLabelInput @preview(toggledBy: "bane-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A 6 character hex code, without the leading #, identifying the updated color of the label. - """ - color: String - - """ - A brief description of the label, such as its purpose. - """ - description: String - - """ - The Node ID of the label to be updated. - """ - id: ID! @possibleTypes(concreteTypes: ["Label"]) - - """ - The updated name of the label. - """ - name: String -} - -""" -Autogenerated return type of UpdateLabel -""" -type UpdateLabelPayload @preview(toggledBy: "bane-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated label. - """ - label: Label -} - -""" -Autogenerated input type of UpdateProjectCard -""" -input UpdateProjectCardInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Whether or not the ProjectCard should be archived - """ - isArchived: Boolean - - """ - The note of ProjectCard. - """ - note: String - - """ - The ProjectCard ID to update. - """ - projectCardId: ID! @possibleTypes(concreteTypes: ["ProjectCard"]) -} - -""" -Autogenerated return type of UpdateProjectCard -""" -type UpdateProjectCardPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated ProjectCard. - """ - projectCard: ProjectCard -} - -""" -Autogenerated input type of UpdateProjectColumn -""" -input UpdateProjectColumnInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of project column. - """ - name: String! - - """ - The ProjectColumn ID to update. - """ - projectColumnId: ID! @possibleTypes(concreteTypes: ["ProjectColumn"]) -} - -""" -Autogenerated return type of UpdateProjectColumn -""" -type UpdateProjectColumnPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated project column. - """ - projectColumn: ProjectColumn -} - -""" -Autogenerated input type of UpdateProject -""" -input UpdateProjectInput { - """ - The description of project. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The name of project. - """ - name: String - - """ - The Project ID to update. - """ - projectId: ID! @possibleTypes(concreteTypes: ["Project"]) - - """ - Whether the project is public or not. - """ - public: Boolean - - """ - Whether the project is open or closed. - """ - state: ProjectState -} - -""" -Autogenerated return type of UpdateProject -""" -type UpdateProjectPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated project. - """ - project: Project -} - -""" -Autogenerated input type of UpdatePullRequest -""" -input UpdatePullRequestInput { - """ - An array of Node IDs of users for this pull request. - """ - assigneeIds: [ID!] @possibleTypes(concreteTypes: ["User"]) - - """ - The name of the branch you want your changes pulled into. This should be an existing branch - on the current repository. - """ - baseRefName: String - - """ - The contents of the pull request. - """ - body: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - An array of Node IDs of labels for this pull request. - """ - labelIds: [ID!] @possibleTypes(concreteTypes: ["Label"]) - - """ - Indicates whether maintainers can modify the pull request. - """ - maintainerCanModify: Boolean - - """ - The Node ID of the milestone for this pull request. - """ - milestoneId: ID @possibleTypes(concreteTypes: ["Milestone"]) - - """ - An array of Node IDs for projects associated with this pull request. - """ - projectIds: [ID!] - - """ - The Node ID of the pull request. - """ - pullRequestId: ID! @possibleTypes(concreteTypes: ["PullRequest"]) - - """ - The target state of the pull request. - """ - state: PullRequestUpdateState - - """ - The title of the pull request. - """ - title: String -} - -""" -Autogenerated return type of UpdatePullRequest -""" -type UpdatePullRequestPayload { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated pull request. - """ - pullRequest: PullRequest -} - -""" -Autogenerated input type of UpdatePullRequestReviewComment -""" -input UpdatePullRequestReviewCommentInput { - """ - The text of the comment. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the comment to modify. - """ - pullRequestReviewCommentId: ID! @possibleTypes(concreteTypes: ["PullRequestReviewComment"]) -} - -""" -Autogenerated return type of UpdatePullRequestReviewComment -""" -type UpdatePullRequestReviewCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated comment. - """ - pullRequestReviewComment: PullRequestReviewComment -} - -""" -Autogenerated input type of UpdatePullRequestReview -""" -input UpdatePullRequestReviewInput { - """ - The contents of the pull request review body. - """ - body: String! - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the pull request review to modify. - """ - pullRequestReviewId: ID! @possibleTypes(concreteTypes: ["PullRequestReview"]) -} - -""" -Autogenerated return type of UpdatePullRequestReview -""" -type UpdatePullRequestReviewPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated pull request review. - """ - pullRequestReview: PullRequestReview -} - -""" -Autogenerated input type of UpdateRef -""" -input UpdateRefInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Permit updates of branch Refs that are not fast-forwards? - """ - force: Boolean = false - - """ - The GitObjectID that the Ref shall be updated to target. - """ - oid: GitObjectID! - - """ - The Node ID of the Ref to be updated. - """ - refId: ID! @possibleTypes(concreteTypes: ["Ref"]) -} - -""" -Autogenerated return type of UpdateRef -""" -type UpdateRefPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated Ref. - """ - ref: Ref -} - -""" -Autogenerated input type of UpdateRefs -""" -input UpdateRefsInput @preview(toggledBy: "update-refs-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A list of ref updates. - """ - refUpdates: [RefUpdate!]! - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) -} - -""" -Autogenerated return type of UpdateRefs -""" -type UpdateRefsPayload @preview(toggledBy: "update-refs-preview") { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String -} - -""" -Autogenerated input type of UpdateRepository -""" -input UpdateRepositoryInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - A new description for the repository. Pass an empty string to erase the existing description. - """ - description: String - - """ - Indicates if the repository should have the issues feature enabled. - """ - hasIssuesEnabled: Boolean - - """ - Indicates if the repository should have the project boards feature enabled. - """ - hasProjectsEnabled: Boolean - - """ - Indicates if the repository should have the wiki feature enabled. - """ - hasWikiEnabled: Boolean - - """ - The URL for a web page about this repository. Pass an empty string to erase the existing URL. - """ - homepageUrl: URI - - """ - The new name of the repository. - """ - name: String - - """ - The ID of the repository to update. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - Whether this repository should be marked as a template such that anyone who - can access it can create new repositories with the same files and directory structure. - """ - template: Boolean -} - -""" -Autogenerated return type of UpdateRepository -""" -type UpdateRepositoryPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated repository. - """ - repository: Repository -} - -""" -Autogenerated input type of UpdateSubscription -""" -input UpdateSubscriptionInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The new state of the subscription. - """ - state: SubscriptionState! - - """ - The Node ID of the subscribable object to modify. - """ - subscribableId: ID! @possibleTypes(concreteTypes: ["Commit", "Issue", "PullRequest", "Repository", "Team", "TeamDiscussion"], abstractType: "Subscribable") -} - -""" -Autogenerated return type of UpdateSubscription -""" -type UpdateSubscriptionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The input subscribable entity. - """ - subscribable: Subscribable -} - -""" -Autogenerated input type of UpdateTeamDiscussionComment -""" -input UpdateTeamDiscussionCommentInput { - """ - The updated text of the comment. - """ - body: String! - - """ - The current version of the body content. - """ - bodyVersion: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The ID of the comment to modify. - """ - id: ID! @possibleTypes(concreteTypes: ["TeamDiscussionComment"]) -} - -""" -Autogenerated return type of UpdateTeamDiscussionComment -""" -type UpdateTeamDiscussionCommentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated comment. - """ - teamDiscussionComment: TeamDiscussionComment -} - -""" -Autogenerated input type of UpdateTeamDiscussion -""" -input UpdateTeamDiscussionInput { - """ - The updated text of the discussion. - """ - body: String - - """ - The current version of the body content. If provided, this update operation - will be rejected if the given version does not match the latest version on the server. - """ - bodyVersion: String - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the discussion to modify. - """ - id: ID! @possibleTypes(concreteTypes: ["TeamDiscussion"]) - - """ - If provided, sets the pinned state of the updated discussion. - """ - pinned: Boolean - - """ - The updated title of the discussion. - """ - title: String -} - -""" -Autogenerated return type of UpdateTeamDiscussion -""" -type UpdateTeamDiscussionPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The updated discussion. - """ - teamDiscussion: TeamDiscussion -} - -""" -Autogenerated input type of UpdateTeamReviewAssignment -""" -input UpdateTeamReviewAssignmentInput @preview(toggledBy: "stone-crop-preview") { - """ - The algorithm to use for review assignment - """ - algorithm: TeamReviewAssignmentAlgorithm = ROUND_ROBIN - - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Turn on or off review assignment - """ - enabled: Boolean! - - """ - An array of team member IDs to exclude - """ - excludedTeamMemberIds: [ID!] @possibleTypes(concreteTypes: ["User"]) - - """ - The Node ID of the team to update review assginments of - """ - id: ID! @possibleTypes(concreteTypes: ["Team"]) - - """ - Notify the entire team of the PR if it is delegated - """ - notifyTeam: Boolean = true - - """ - The number of team members to assign - """ - teamMemberCount: Int = 1 -} - -""" -Autogenerated return type of UpdateTeamReviewAssignment -""" -type UpdateTeamReviewAssignmentPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The team that was modified - """ - team: Team -} - -""" -Autogenerated input type of UpdateTopics -""" -input UpdateTopicsInput { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - The Node ID of the repository. - """ - repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"]) - - """ - An array of topic names. - """ - topicNames: [String!]! -} - -""" -Autogenerated return type of UpdateTopics -""" -type UpdateTopicsPayload { - """ - A unique identifier for the client performing the mutation. - """ - clientMutationId: String - - """ - Names of the provided topics that are not valid. - """ - invalidTopicNames: [String!] - - """ - The updated repository. - """ - repository: Repository -} - -""" -A user is an individual's account on GitHub that owns repositories and can make new content. -""" -type User implements Actor & Node & PackageOwner & ProfileOwner & ProjectOwner & RepositoryOwner & Sponsorable & UniformResourceLocatable { - """ - Determine if this repository owner has any items that can be pinned to their profile. - """ - anyPinnableItems( - """ - Filter to only a particular kind of pinnable item. - """ - type: PinnableItemType - ): Boolean! - - """ - A URL pointing to the user's public avatar. - """ - avatarUrl( - """ - The size of the resulting square image. - """ - size: Int - ): URI! - - """ - The user's public profile bio. - """ - bio: String - - """ - The user's public profile bio as HTML. - """ - bioHTML: HTML! - - """ - A list of commit comments made by this user. - """ - commitComments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): CommitCommentConnection! - - """ - The user's public profile company. - """ - company: String - - """ - The user's public profile company as HTML. - """ - companyHTML: HTML! - - """ - The collection of contributions this user has made to different repositories. - """ - contributionsCollection( - """ - Only contributions made at this time or later will be counted. If omitted, defaults to a year ago. - """ - from: DateTime - - """ - The ID of the organization used to filter contributions. - """ - organizationID: ID - - """ - Only contributions made before and up to and including this time will be - counted. If omitted, defaults to the current time. - """ - to: DateTime - ): ContributionsCollection! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the primary key from the database. - """ - databaseId: Int - - """ - The user's publicly visible profile email. - """ - email: String! - - """ - A list of users the given user is followed by. - """ - followers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): FollowerConnection! - - """ - A list of users the given user is following. - """ - following( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): FollowingConnection! - - """ - Find gist by repo name. - """ - gist( - """ - The gist name to find. - """ - name: String! - ): Gist - - """ - A list of gist comments made by this user. - """ - gistComments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): GistCommentConnection! - - """ - A list of the Gists the user has created. - """ - gists( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for gists returned from the connection - """ - orderBy: GistOrder - - """ - Filters Gists according to privacy. - """ - privacy: GistPrivacy - ): GistConnection! - - """ - The hovercard information for this user in a given context - """ - hovercard( - """ - The ID of the subject to get the hovercard in the context of - """ - primarySubjectId: ID - ): Hovercard! - id: ID! - - """ - Whether or not this user is a participant in the GitHub Security Bug Bounty. - """ - isBountyHunter: Boolean! - - """ - Whether or not this user is a participant in the GitHub Campus Experts Program. - """ - isCampusExpert: Boolean! - - """ - Whether or not this user is a GitHub Developer Program member. - """ - isDeveloperProgramMember: Boolean! - - """ - Whether or not this user is a GitHub employee. - """ - isEmployee: Boolean! - - """ - Whether or not the user has marked themselves as for hire. - """ - isHireable: Boolean! - - """ - Whether or not this user is a site administrator. - """ - isSiteAdmin: Boolean! - - """ - Whether or not this user is the viewing user. - """ - isViewer: Boolean! - - """ - A list of issue comments made by this user. - """ - issueComments( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): IssueCommentConnection! - - """ - A list of issues associated with this user. - """ - issues( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Filtering options for issues returned from the connection. - """ - filterBy: IssueFilters - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for issues returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the issues by. - """ - states: [IssueState!] - ): IssueConnection! - - """ - Showcases a selection of repositories and gists that the profile owner has - either curated or that have been selected automatically based on popularity. - """ - itemShowcase: ProfileItemShowcase! - - """ - The user's public profile location. - """ - location: String - - """ - The username used to login. - """ - login: String! - - """ - The user's public profile name. - """ - name: String - - """ - Find an organization by its login that the user belongs to. - """ - organization( - """ - The login of the organization to find. - """ - login: String! - ): Organization - - """ - Verified email addresses that match verified domains for a specified organization the user is a member of. - """ - organizationVerifiedDomainEmails( - """ - The login of the organization to match verified domains from. - """ - login: String! - ): [String!]! - - """ - A list of organizations the user belongs to. - """ - organizations( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): OrganizationConnection! - - """ - A list of packages under the owner. - """ - packages( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Find packages by their names. - """ - names: [String] - - """ - Ordering of the returned packages. - """ - orderBy: PackageOrder = {field: CREATED_AT, direction: DESC} - - """ - Filter registry package by type. - """ - packageType: PackageType - - """ - Find packages in a repository by ID. - """ - repositoryId: ID - ): PackageConnection! - - """ - A list of repositories and gists this profile owner can pin to their profile. - """ - pinnableItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter the types of pinnable items that are returned. - """ - types: [PinnableItemType!] - ): PinnableItemConnection! - - """ - A list of repositories and gists this profile owner has pinned to their profile - """ - pinnedItems( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Filter the types of pinned items that are returned. - """ - types: [PinnableItemType!] - ): PinnableItemConnection! - - """ - Returns how many more items this profile owner can pin to their profile. - """ - pinnedItemsRemaining: Int! - - """ - Find project by number. - """ - project( - """ - The project number to find. - """ - number: Int! - ): Project - - """ - A list of projects under the owner. - """ - projects( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for projects returned from the connection - """ - orderBy: ProjectOrder - - """ - Query to search projects by, currently only searching by name. - """ - search: String - - """ - A list of states to filter the projects by. - """ - states: [ProjectState!] - ): ProjectConnection! - - """ - The HTTP path listing user's projects - """ - projectsResourcePath: URI! - - """ - The HTTP URL listing user's projects - """ - projectsUrl: URI! - - """ - A list of public keys associated with this user. - """ - publicKeys( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): PublicKeyConnection! - - """ - A list of pull requests associated with this user. - """ - pullRequests( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - The base ref name to filter the pull requests by. - """ - baseRefName: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - The head ref name to filter the pull requests by. - """ - headRefName: String - - """ - A list of label names to filter the pull requests by. - """ - labels: [String!] - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for pull requests returned from the connection. - """ - orderBy: IssueOrder - - """ - A list of states to filter the pull requests by. - """ - states: [PullRequestState!] - ): PullRequestConnection! - - """ - A list of repositories that the user owns. - """ - repositories( - """ - Array of viewer's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - current viewer owns. - """ - affiliations: [RepositoryAffiliation] - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If non-null, filters repositories according to whether they are forks of another repository - """ - isFork: Boolean - - """ - If non-null, filters repositories according to whether they have been locked - """ - isLocked: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder - - """ - Array of owner's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - organization or user being viewed owns. - """ - ownerAffiliations: [RepositoryAffiliation] = [OWNER, COLLABORATOR] - - """ - If non-null, filters repositories according to privacy - """ - privacy: RepositoryPrivacy - ): RepositoryConnection! - - """ - A list of repositories that the user recently contributed to. - """ - repositoriesContributedTo( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - If non-null, include only the specified types of contributions. The - GitHub.com UI uses [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY] - """ - contributionTypes: [RepositoryContributionType] - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If true, include user repositories - """ - includeUserRepositories: Boolean - - """ - If non-null, filters repositories according to whether they have been locked - """ - isLocked: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder - - """ - If non-null, filters repositories according to privacy - """ - privacy: RepositoryPrivacy - ): RepositoryConnection! - - """ - Find Repository. - """ - repository( - """ - Name of Repository to find. - """ - name: String! - ): Repository - - """ - The HTTP path for this user - """ - resourcePath: URI! - - """ - Replies this user has saved - """ - savedReplies( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - The field to order saved replies by. - """ - orderBy: SavedReplyOrder = {field: UPDATED_AT, direction: DESC} - ): SavedReplyConnection - - """ - The GitHub Sponsors listing for this user. - """ - sponsorsListing: SponsorsListing - - """ - This object's sponsorships as the maintainer. - """ - sponsorshipsAsMaintainer( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Whether or not to include private sponsorships in the result set - """ - includePrivate: Boolean = false - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! - - """ - This object's sponsorships as the sponsor. - """ - sponsorshipsAsSponsor( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for sponsorships returned from this connection. If left - blank, the sponsorships will be ordered based on relevancy to the viewer. - """ - orderBy: SponsorshipOrder - ): SponsorshipConnection! - - """ - Repositories the user has starred. - """ - starredRepositories( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Order for connection - """ - orderBy: StarOrder - - """ - Filters starred repositories to only return repositories owned by the viewer. - """ - ownedByViewer: Boolean - ): StarredRepositoryConnection! - - """ - The user's description of what they're currently doing. - """ - status: UserStatus - - """ - Repositories the user has contributed to, ordered by contribution rank, plus repositories the user has created - """ - topRepositories( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder! - - """ - How far back in time to fetch contributed repositories - """ - since: DateTime - ): RepositoryConnection! - - """ - The user's Twitter username. - """ - twitterUsername: String - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The HTTP URL for this user - """ - url: URI! - - """ - Can the viewer pin repositories and gists to the profile? - """ - viewerCanChangePinnedItems: Boolean! - - """ - Can the current viewer create new projects on this owner. - """ - viewerCanCreateProjects: Boolean! - - """ - Whether or not the viewer is able to follow the user. - """ - viewerCanFollow: Boolean! - - """ - Whether or not this user is followed by the viewer. - """ - viewerIsFollowing: Boolean! - - """ - A list of repositories the given user is watching. - """ - watching( - """ - Affiliation options for repositories returned from the connection. If none - specified, the results will include repositories for which the current - viewer is an owner or collaborator, or member. - """ - affiliations: [RepositoryAffiliation] - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int - - """ - If non-null, filters repositories according to whether they have been locked - """ - isLocked: Boolean - - """ - Returns the last _n_ elements from the list. - """ - last: Int - - """ - Ordering options for repositories returned from the connection - """ - orderBy: RepositoryOrder - - """ - Array of owner's affiliation options for repositories returned from the - connection. For example, OWNER will include only repositories that the - organization or user being viewed owns. - """ - ownerAffiliations: [RepositoryAffiliation] = [OWNER, COLLABORATOR] - - """ - If non-null, filters repositories according to privacy - """ - privacy: RepositoryPrivacy - ): RepositoryConnection! - - """ - A URL pointing to the user's public website/blog. - """ - websiteUrl: URI -} - -""" -The possible durations that a user can be blocked for. -""" -enum UserBlockDuration { - """ - The user was blocked for 1 day - """ - ONE_DAY - - """ - The user was blocked for 30 days - """ - ONE_MONTH - - """ - The user was blocked for 7 days - """ - ONE_WEEK - - """ - The user was blocked permanently - """ - PERMANENT - - """ - The user was blocked for 3 days - """ - THREE_DAYS -} - -""" -Represents a 'user_blocked' event on a given user. -""" -type UserBlockedEvent implements Node { - """ - Identifies the actor who performed the event. - """ - actor: Actor - - """ - Number of days that the user was blocked for. - """ - blockDuration: UserBlockDuration! - - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - id: ID! - - """ - The user who was blocked. - """ - subject: User -} - -""" -The connection type for User. -""" -type UserConnection { - """ - A list of edges. - """ - edges: [UserEdge] - - """ - A list of nodes. - """ - nodes: [User] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edit on user content -""" -type UserContentEdit implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - Identifies the date and time when the object was deleted. - """ - deletedAt: DateTime - - """ - The actor who deleted this content - """ - deletedBy: Actor - - """ - A summary of the changes for this edit - """ - diff: String - - """ - When this content was edited - """ - editedAt: DateTime! - - """ - The actor who edited this content - """ - editor: Actor - id: ID! - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! -} - -""" -A list of edits to content. -""" -type UserContentEditConnection { - """ - A list of edges. - """ - edges: [UserContentEditEdge] - - """ - A list of nodes. - """ - nodes: [UserContentEdit] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type UserContentEditEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: UserContentEdit -} - -""" -Represents a user. -""" -type UserEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: User -} - -""" -The user's description of what they're currently doing. -""" -type UserStatus implements Node { - """ - Identifies the date and time when the object was created. - """ - createdAt: DateTime! - - """ - An emoji summarizing the user's status. - """ - emoji: String - - """ - The status emoji as HTML. - """ - emojiHTML: HTML - - """ - If set, the status will not be shown after this date. - """ - expiresAt: DateTime - - """ - ID of the object. - """ - id: ID! - - """ - Whether this status indicates the user is not fully available on GitHub. - """ - indicatesLimitedAvailability: Boolean! - - """ - A brief message describing what the user is doing. - """ - message: String - - """ - The organization whose members can see this status. If null, this status is publicly visible. - """ - organization: Organization - - """ - Identifies the date and time when the object was last updated. - """ - updatedAt: DateTime! - - """ - The user who has this status. - """ - user: User! -} - -""" -The connection type for UserStatus. -""" -type UserStatusConnection { - """ - A list of edges. - """ - edges: [UserStatusEdge] - - """ - A list of nodes. - """ - nodes: [UserStatus] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - Identifies the total count of items in the connection. - """ - totalCount: Int! -} - -""" -An edge in a connection. -""" -type UserStatusEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: UserStatus -} - -""" -Ordering options for user status connections. -""" -input UserStatusOrder { - """ - The ordering direction. - """ - direction: OrderDirection! - - """ - The field to order user statuses by. - """ - field: UserStatusOrderField! -} - -""" -Properties by which user status connections can be ordered. -""" -enum UserStatusOrderField { - """ - Order user statuses by when they were updated. - """ - UPDATED_AT -} - -""" -A hovercard context with a message describing how the viewer is related. -""" -type ViewerHovercardContext implements HovercardContext { - """ - A string describing this context - """ - message: String! - - """ - An octicon to accompany this context - """ - octicon: String! - - """ - Identifies the user who is related to this context. - """ - viewer: User! -} - -""" -A valid x509 certificate string -""" -scalar X509Certificate diff --git a/Sources/StarWarsAPI/Info.plist b/Sources/StarWarsAPI/Info.plist deleted file mode 100644 index 09738dfd75..0000000000 --- a/Sources/StarWarsAPI/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/StarWarsAPI/StarWarsAPI/Package.swift b/Sources/StarWarsAPI/StarWarsAPI/Package.swift deleted file mode 100644 index b8f38db9a7..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Package.swift +++ /dev/null @@ -1,28 +0,0 @@ -// swift-tools-version:5.7 - -import PackageDescription - -let package = Package( - name: "StarWarsAPI", - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - products: [ - .library(name: "StarWarsAPI", targets: ["StarWarsAPI"]), - ], - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - targets: [ - .target( - name: "StarWarsAPI", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] -) diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterAppearsIn.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterAppearsIn.graphql.swift deleted file mode 100644 index ee29605e64..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterAppearsIn.graphql.swift +++ /dev/null @@ -1,37 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterAppearsIn: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterAppearsIn on Character { __typename appearsIn }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterAppearsIn.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterName.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterName.graphql.swift deleted file mode 100644 index 052f0d211d..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterName.graphql.swift +++ /dev/null @@ -1,37 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterName: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterName on Character { __typename name }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterName.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndAppearsIn.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndAppearsIn.graphql.swift deleted file mode 100644 index e6c5549dda..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndAppearsIn.graphql.swift +++ /dev/null @@ -1,42 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterNameAndAppearsIn: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterNameAndAppearsIn on Character { __typename name appearsIn }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - name: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameAndAppearsIn.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndAppearsInWithNestedFragments.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndAppearsInWithNestedFragments.graphql.swift deleted file mode 100644 index c76e92b66a..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndAppearsInWithNestedFragments.graphql.swift +++ /dev/null @@ -1,51 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterNameAndAppearsInWithNestedFragments: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterNameAndAppearsInWithNestedFragments on Character { __typename ...CharacterNameWithNestedAppearsInFragment }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterNameWithNestedAppearsInFragment.self), - ] } - - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterNameWithNestedAppearsInFragment: CharacterNameWithNestedAppearsInFragment { _toFragment() } - public var characterAppearsIn: CharacterAppearsIn { _toFragment() } - } - - public init( - __typename: String, - appearsIn: [GraphQLEnum?], - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "appearsIn": appearsIn, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameAndAppearsInWithNestedFragments.self), - ObjectIdentifier(CharacterAppearsIn.self), - ObjectIdentifier(CharacterNameWithNestedAppearsInFragment.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndDroidAppearsIn.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndDroidAppearsIn.graphql.swift deleted file mode 100644 index b2626b5aa5..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndDroidAppearsIn.graphql.swift +++ /dev/null @@ -1,76 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterNameAndDroidAppearsIn: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterNameAndDroidAppearsIn on Character { __typename name ... on Droid { __typename appearsIn } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameAndDroidAppearsIn.self) - ] - )) - } - - /// AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = CharacterNameAndDroidAppearsIn - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The movies this droid appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - appearsIn: [GraphQLEnum?], - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "appearsIn": appearsIn, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameAndDroidAppearsIn.self), - ObjectIdentifier(CharacterNameAndDroidAppearsIn.AsDroid.self) - ] - )) - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndDroidPrimaryFunction.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndDroidPrimaryFunction.graphql.swift deleted file mode 100644 index abed28d286..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameAndDroidPrimaryFunction.graphql.swift +++ /dev/null @@ -1,94 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterNameAndDroidPrimaryFunction: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterNameAndDroidPrimaryFunction on Character { __typename ...CharacterName ...DroidPrimaryFunction }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsDroid.self), - .fragment(CharacterName.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameAndDroidPrimaryFunction.self), - ObjectIdentifier(CharacterName.self) - ] - )) - } - - /// AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = CharacterNameAndDroidPrimaryFunction - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(DroidPrimaryFunction.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var droidPrimaryFunction: DroidPrimaryFunction { _toFragment() } - public var characterName: CharacterName { _toFragment() } - } - - public init( - name: String, - primaryFunction: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - "primaryFunction": primaryFunction, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameAndDroidPrimaryFunction.self), - ObjectIdentifier(CharacterNameAndDroidPrimaryFunction.AsDroid.self), - ObjectIdentifier(CharacterName.self), - ObjectIdentifier(DroidPrimaryFunction.self) - ] - )) - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameWithInlineFragment.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameWithInlineFragment.graphql.swift deleted file mode 100644 index c3b8ac44de..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameWithInlineFragment.graphql.swift +++ /dev/null @@ -1,147 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterNameWithInlineFragment: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterNameWithInlineFragment on Character { __typename ... on Human { __typename friends { __typename appearsIn } } ... on Droid { __typename ...CharacterName ...FriendsNames } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameWithInlineFragment.self) - ] - )) - } - - /// AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = CharacterNameWithInlineFragment - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("friends", [Friend?]?.self), - ] } - - /// This human's friends, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameWithInlineFragment.self), - ObjectIdentifier(CharacterNameWithInlineFragment.AsHuman.self) - ] - )) - } - - /// AsHuman.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameWithInlineFragment.AsHuman.Friend.self) - ] - )) - } - } - } - - /// AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = CharacterNameWithInlineFragment - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(CharacterName.self), - .fragment(FriendsNames.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The friends of the character, or an empty list if they have none - public var friends: [FriendsNames.Friend?]? { __data["friends"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - public var friendsNames: FriendsNames { _toFragment() } - } - - public init( - name: String, - friends: [FriendsNames.Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameWithInlineFragment.self), - ObjectIdentifier(CharacterNameWithInlineFragment.AsDroid.self), - ObjectIdentifier(CharacterName.self), - ObjectIdentifier(FriendsNames.self) - ] - )) - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameWithNestedAppearsInFragment.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameWithNestedAppearsInFragment.graphql.swift deleted file mode 100644 index 3b4016e8af..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/CharacterNameWithNestedAppearsInFragment.graphql.swift +++ /dev/null @@ -1,50 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct CharacterNameWithNestedAppearsInFragment: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment CharacterNameWithNestedAppearsInFragment on Character { __typename name ...CharacterAppearsIn }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .fragment(CharacterAppearsIn.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterAppearsIn: CharacterAppearsIn { _toFragment() } - } - - public init( - __typename: String, - name: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(CharacterNameWithNestedAppearsInFragment.self), - ObjectIdentifier(CharacterAppearsIn.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidDetails.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidDetails.graphql.swift deleted file mode 100644 index 91a03fd881..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidDetails.graphql.swift +++ /dev/null @@ -1,41 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct DroidDetails: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment DroidDetails on Droid { __typename name primaryFunction }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("primaryFunction", String?.self), - ] } - - /// What others call this droid - public var name: String { __data["name"] } - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - - public init( - name: String, - primaryFunction: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - "primaryFunction": primaryFunction, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidDetails.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidName.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidName.graphql.swift deleted file mode 100644 index 34511d2457..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidName.graphql.swift +++ /dev/null @@ -1,36 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct DroidName: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment DroidName on Droid { __typename name }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// What others call this droid - public var name: String { __data["name"] } - - public init( - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidName.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidNameAndPrimaryFunction.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidNameAndPrimaryFunction.graphql.swift deleted file mode 100644 index a09c726874..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidNameAndPrimaryFunction.graphql.swift +++ /dev/null @@ -1,51 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct DroidNameAndPrimaryFunction: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment DroidNameAndPrimaryFunction on Droid { __typename ...CharacterName ...DroidPrimaryFunction }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterName.self), - .fragment(DroidPrimaryFunction.self), - ] } - - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - public var droidPrimaryFunction: DroidPrimaryFunction { _toFragment() } - } - - public init( - primaryFunction: String? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "primaryFunction": primaryFunction, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidNameAndPrimaryFunction.self), - ObjectIdentifier(DroidPrimaryFunction.self), - ObjectIdentifier(CharacterName.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidPrimaryFunction.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidPrimaryFunction.graphql.swift deleted file mode 100644 index d5b7b65dfa..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/DroidPrimaryFunction.graphql.swift +++ /dev/null @@ -1,36 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct DroidPrimaryFunction: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment DroidPrimaryFunction on Droid { __typename primaryFunction }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("primaryFunction", String?.self), - ] } - - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - - public init( - primaryFunction: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "primaryFunction": primaryFunction, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidPrimaryFunction.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/FriendsNames.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/FriendsNames.graphql.swift deleted file mode 100644 index d75b6d7e84..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/FriendsNames.graphql.swift +++ /dev/null @@ -1,69 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct FriendsNames: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment FriendsNames on Character { __typename friends { __typename name } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(FriendsNames.self) - ] - )) - } - - /// Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(FriendsNames.Friend.self) - ] - )) - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/HeroDetails.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/HeroDetails.graphql.swift deleted file mode 100644 index 5fbbe2f33a..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/HeroDetails.graphql.swift +++ /dev/null @@ -1,114 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct HeroDetails: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment HeroDetails on Character { __typename name ... on Human { __typename height } ... on Droid { __typename primaryFunction } }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetails.self) - ] - )) - } - - /// AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetails - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Double?.self), - ] } - - /// Height in the preferred unit, default is meters - public var height: Double? { __data["height"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - height: Double? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "height": height, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetails.self), - ObjectIdentifier(HeroDetails.AsHuman.self) - ] - )) - } - } - - /// AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetails - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("primaryFunction", String?.self), - ] } - - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - primaryFunction: String? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "primaryFunction": primaryFunction, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetails.self), - ObjectIdentifier(HeroDetails.AsDroid.self) - ] - )) - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/HumanHeightWithVariable.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/HumanHeightWithVariable.graphql.swift deleted file mode 100644 index 8db8fb97c6..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Fragments/HumanHeightWithVariable.graphql.swift +++ /dev/null @@ -1,36 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public struct HumanHeightWithVariable: StarWarsAPI.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - #"fragment HumanHeightWithVariable on Human { __typename height(unit: $heightUnit) }"# - } - - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("height", Double?.self, arguments: ["unit": .variable("heightUnit")]), - ] } - - /// Height in the preferred unit, default is meters - public var height: Double? { __data["height"] } - - public init( - height: Double? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "height": height, - ], - fulfilledFragments: [ - ObjectIdentifier(HumanHeightWithVariable.self) - ] - )) - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateAwesomeReviewMutation.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateAwesomeReviewMutation.graphql.swift deleted file mode 100644 index c30591fd64..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateAwesomeReviewMutation.graphql.swift +++ /dev/null @@ -1,83 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class CreateAwesomeReviewMutation: GraphQLMutation { - public static let operationName: String = "CreateAwesomeReview" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "36634ea692d455075551673f2f529e85c8acf6f5e3707243781324cd3d968d02", - definition: .init( - #"mutation CreateAwesomeReview { createReview(episode: JEDI, review: {stars: 10, commentary: "This is awesome!"}) { __typename stars commentary } }"# - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("createReview", CreateReview?.self, arguments: [ - "episode": "JEDI", - "review": [ - "stars": 10, - "commentary": "This is awesome!" - ] - ]), - ] } - - public var createReview: CreateReview? { __data["createReview"] } - - public init( - createReview: CreateReview? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Mutation.typename, - "createReview": createReview._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(CreateAwesomeReviewMutation.Data.self) - ] - )) - } - - /// CreateReview - /// - /// Parent Type: `Review` - public struct CreateReview: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Review } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("stars", Int.self), - .field("commentary", String?.self), - ] } - - /// The number of stars this review gave, 1-5 - public var stars: Int { __data["stars"] } - /// Comment about the movie - public var commentary: String? { __data["commentary"] } - - public init( - stars: Int, - commentary: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Review.typename, - "stars": stars, - "commentary": commentary, - ], - fulfilledFragments: [ - ObjectIdentifier(CreateAwesomeReviewMutation.Data.CreateReview.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateReviewForEpisodeMutation.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateReviewForEpisodeMutation.graphql.swift deleted file mode 100644 index 8b8b371ebf..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateReviewForEpisodeMutation.graphql.swift +++ /dev/null @@ -1,94 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class CreateReviewForEpisodeMutation: GraphQLMutation { - public static let operationName: String = "CreateReviewForEpisode" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "3edcd1f17839f43db021eccbe2ecd41ad7dcb1ba6cd4b7e9897afb4162e4c223", - definition: .init( - #"mutation CreateReviewForEpisode($episode: Episode!, $review: ReviewInput!) { createReview(episode: $episode, review: $review) { __typename stars commentary } }"# - )) - - public var episode: GraphQLEnum - public var review: ReviewInput - - public init( - episode: GraphQLEnum, - review: ReviewInput - ) { - self.episode = episode - self.review = review - } - - public var __variables: Variables? { [ - "episode": episode, - "review": review - ] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("createReview", CreateReview?.self, arguments: [ - "episode": .variable("episode"), - "review": .variable("review") - ]), - ] } - - public var createReview: CreateReview? { __data["createReview"] } - - public init( - createReview: CreateReview? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Mutation.typename, - "createReview": createReview._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(CreateReviewForEpisodeMutation.Data.self) - ] - )) - } - - /// CreateReview - /// - /// Parent Type: `Review` - public struct CreateReview: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Review } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("stars", Int.self), - .field("commentary", String?.self), - ] } - - /// The number of stars this review gave, 1-5 - public var stars: Int { __data["stars"] } - /// Comment about the movie - public var commentary: String? { __data["commentary"] } - - public init( - stars: Int, - commentary: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Review.typename, - "stars": stars, - "commentary": commentary, - ], - fulfilledFragments: [ - ObjectIdentifier(CreateReviewForEpisodeMutation.Data.CreateReview.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateReviewWithNullFieldMutation.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateReviewWithNullFieldMutation.graphql.swift deleted file mode 100644 index c4b80bb5aa..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Mutations/CreateReviewWithNullFieldMutation.graphql.swift +++ /dev/null @@ -1,83 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class CreateReviewWithNullFieldMutation: GraphQLMutation { - public static let operationName: String = "CreateReviewWithNullField" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "e962313bc77c193dc516d097b5e41efea073de16c3a5f2e8c00f082853835d49", - definition: .init( - #"mutation CreateReviewWithNullField { createReview(episode: JEDI, review: {stars: 10, commentary: null}) { __typename stars commentary } }"# - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("createReview", CreateReview?.self, arguments: [ - "episode": "JEDI", - "review": [ - "stars": 10, - "commentary": .null - ] - ]), - ] } - - public var createReview: CreateReview? { __data["createReview"] } - - public init( - createReview: CreateReview? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Mutation.typename, - "createReview": createReview._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(CreateReviewWithNullFieldMutation.Data.self) - ] - )) - } - - /// CreateReview - /// - /// Parent Type: `Review` - public struct CreateReview: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Review } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("stars", Int.self), - .field("commentary", String?.self), - ] } - - /// The number of stars this review gave, 1-5 - public var stars: Int { __data["stars"] } - /// Comment about the movie - public var commentary: String? { __data["commentary"] } - - public init( - stars: Int, - commentary: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Review.typename, - "stars": stars, - "commentary": commentary, - ], - fulfilledFragments: [ - ObjectIdentifier(CreateReviewWithNullFieldMutation.Data.CreateReview.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/DroidDetailsWithFragmentQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/DroidDetailsWithFragmentQuery.graphql.swift deleted file mode 100644 index 08fc62c881..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/DroidDetailsWithFragmentQuery.graphql.swift +++ /dev/null @@ -1,121 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class DroidDetailsWithFragmentQuery: GraphQLQuery { - public static let operationName: String = "DroidDetailsWithFragment" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "6696d5064faa0c379b73574aa6d4c5b912eb17339afc8b66babae61542d233d7", - definition: .init( - #"query DroidDetailsWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...DroidDetails } }"#, - fragments: [DroidDetails.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidDetailsWithFragmentQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsDroid.self), - ] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidDetailsWithFragmentQuery.Data.Hero.self) - ] - )) - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = DroidDetailsWithFragmentQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(DroidDetails.self), - ] } - - /// What others call this droid - public var name: String { __data["name"] } - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var droidDetails: DroidDetails { _toFragment() } - } - - public init( - name: String, - primaryFunction: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - "primaryFunction": primaryFunction, - ], - fulfilledFragments: [ - ObjectIdentifier(DroidDetailsWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(DroidDetailsWithFragmentQuery.Data.Hero.AsDroid.self), - ObjectIdentifier(DroidDetails.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsIDsQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsIDsQuery.graphql.swift deleted file mode 100644 index 32f25cbf01..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsIDsQuery.graphql.swift +++ /dev/null @@ -1,121 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAndFriendsIDsQuery: GraphQLQuery { - public static let operationName: String = "HeroAndFriendsIDs" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "8f1f880891cdfbf7be7ea11bb4b09708bcbf1e3f8e8a40ecb6fcb33c6078955f", - definition: .init( - #"query HeroAndFriendsIDs($episode: Episode) { hero(episode: $episode) { __typename id name friends { __typename id } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsIDsQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the character - public var name: String { __data["name"] } - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - id: StarWarsAPI.ID, - name: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "name": name, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsIDsQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - - public init( - __typename: String, - id: StarWarsAPI.ID - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsIDsQuery.Data.Hero.Friend.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesQuery.graphql.swift deleted file mode 100644 index 5b9df4b28d..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesQuery.graphql.swift +++ /dev/null @@ -1,116 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAndFriendsNamesQuery: GraphQLQuery { - public static let operationName: String = "HeroAndFriendsNames" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "1e36c3331171b74c012b86caa04fbb01062f37c61227655d9c0729a62c6f7285", - definition: .init( - #"query HeroAndFriendsNames($episode: Episode) { hero(episode: $episode) { __typename name friends { __typename name } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - name: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesQuery.Data.Hero.Friend.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithFragmentQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithFragmentQuery.graphql.swift deleted file mode 100644 index 84e55c3634..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithFragmentQuery.graphql.swift +++ /dev/null @@ -1,93 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAndFriendsNamesWithFragmentQuery: GraphQLQuery { - public static let operationName: String = "HeroAndFriendsNamesWithFragment" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "07c54599c2b5f9d4215d1bff7f5f6ff458c983aa5c13338fd44b051210d5ecc6", - definition: .init( - #"query HeroAndFriendsNamesWithFragment($episode: Episode) { hero(episode: $episode) { __typename name ...FriendsNames } }"#, - fragments: [FriendsNames.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .fragment(FriendsNames.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The friends of the character, or an empty list if they have none - public var friends: [FriendsNames.Friend?]? { __data["friends"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var friendsNames: FriendsNames { _toFragment() } - } - - public init( - __typename: String, - name: String, - friends: [FriendsNames.Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(FriendsNames.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift deleted file mode 100644 index be4e5a309b..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithFragmentTwiceQuery.graphql.swift +++ /dev/null @@ -1,195 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAndFriendsNamesWithFragmentTwiceQuery: GraphQLQuery { - public static let operationName: String = "HeroAndFriendsNamesWithFragmentTwice" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "9a769ab058900912bff4e4c51c1b257f609e4dfb4aaa1f17166adc19d510e363", - definition: .init( - #"query HeroAndFriendsNamesWithFragmentTwice($episode: Episode) { hero(episode: $episode) { __typename friends { __typename ...CharacterName } ... on Droid { __typename friends { __typename ...CharacterName } } } }"#, - fragments: [CharacterName.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentTwiceQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friends", [Friend?]?.self), - .inlineFragment(AsDroid.self), - ] } - - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentTwiceQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterName.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentTwiceQuery.Data.Hero.Friend.self), - ObjectIdentifier(CharacterName.self) - ] - )) - } - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroAndFriendsNamesWithFragmentTwiceQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("friends", [Friend?]?.self), - ] } - - /// This droid's friends, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentTwiceQuery.Data.Hero.self), - ObjectIdentifier(HeroAndFriendsNamesWithFragmentTwiceQuery.Data.Hero.AsDroid.self) - ] - )) - } - - /// Hero.AsDroid.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterName.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithFragmentTwiceQuery.Data.Hero.AsDroid.Friend.self), - ObjectIdentifier(CharacterName.self) - ] - )) - } - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift deleted file mode 100644 index 1ab94f7ca7..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithIDForParentOnlyQuery.graphql.swift +++ /dev/null @@ -1,121 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAndFriendsNamesWithIDForParentOnlyQuery: GraphQLQuery { - public static let operationName: String = "HeroAndFriendsNamesWithIDForParentOnly" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "de03aaedeb69050ef75e3aa56b262b4ea1e08bb6fd174f2e91ddd9b84a8ff897", - definition: .init( - #"query HeroAndFriendsNamesWithIDForParentOnly($episode: Episode) { hero(episode: $episode) { __typename id name friends { __typename name } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithIDForParentOnlyQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the character - public var name: String { __data["name"] } - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - id: StarWarsAPI.ID, - name: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "name": name, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithIDForParentOnlyQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithIDForParentOnlyQuery.Data.Hero.Friend.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithIDsQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithIDsQuery.graphql.swift deleted file mode 100644 index e53401a39f..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAndFriendsNamesWithIDsQuery.graphql.swift +++ /dev/null @@ -1,126 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAndFriendsNamesWithIDsQuery: GraphQLQuery { - public static let operationName: String = "HeroAndFriendsNamesWithIDs" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "cdf121c8a2f2188bd1c4dcc04df6104e989164b27f1e7f13d27ccc9c03fbda0c", - definition: .init( - #"query HeroAndFriendsNamesWithIDs($episode: Episode) { hero(episode: $episode) { __typename id name friends { __typename id name } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithIDsQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the character - public var name: String { __data["name"] } - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - id: StarWarsAPI.ID, - name: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "name": name, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithIDsQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - id: StarWarsAPI.ID, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAndFriendsNamesWithIDsQuery.Data.Hero.Friend.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAppearsInQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAppearsInQuery.graphql.swift deleted file mode 100644 index 7c47cb6494..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAppearsInQuery.graphql.swift +++ /dev/null @@ -1,73 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAppearsInQuery: GraphQLQuery { - public static let operationName: String = "HeroAppearsIn" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "59243627e0166c9b631551b56dc4d29701f2d90336d83c231172c50152e02475", - definition: .init( - #"query HeroAppearsIn { hero { __typename appearsIn } }"# - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAppearsInQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAppearsInQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAppearsInWithFragmentQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAppearsInWithFragmentQuery.graphql.swift deleted file mode 100644 index eea03835c6..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroAppearsInWithFragmentQuery.graphql.swift +++ /dev/null @@ -1,88 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroAppearsInWithFragmentQuery: GraphQLQuery { - public static let operationName: String = "HeroAppearsInWithFragment" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "b7e9c75d75c77765849b67116235609b3a05b9052975c617f51a315f8fbaf45a", - definition: .init( - #"query HeroAppearsInWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...CharacterAppearsIn } }"#, - fragments: [CharacterAppearsIn.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAppearsInWithFragmentQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterAppearsIn.self), - ] } - - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterAppearsIn: CharacterAppearsIn { _toFragment() } - } - - public init( - __typename: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroAppearsInWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(CharacterAppearsIn.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsFragmentConditionalInclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsFragmentConditionalInclusionQuery.graphql.swift deleted file mode 100644 index 55759d258e..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsFragmentConditionalInclusionQuery.graphql.swift +++ /dev/null @@ -1,125 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroDetailsFragmentConditionalInclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroDetailsFragmentConditionalInclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "17dfb13c5d9e6c67703fc037b9114ea53ccc8f9274dfecb4abfc2d5a168cf612", - definition: .init( - #"query HeroDetailsFragmentConditionalInclusion($includeDetails: Boolean!) { hero { __typename ...HeroDetails @include(if: $includeDetails) } }"#, - fragments: [HeroDetails.self] - )) - - public var includeDetails: Bool - - public init(includeDetails: Bool) { - self.includeDetails = includeDetails - } - - public var __variables: Variables? { ["includeDetails": includeDetails] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsFragmentConditionalInclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "includeDetails", .inlineFragment(IfIncludeDetails.self)), - ] } - - public var ifIncludeDetails: IfIncludeDetails? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heroDetails: HeroDetails? { _toFragment() } - } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsFragmentConditionalInclusionQuery.Data.Hero.self) - ] - )) - } - - /// Hero.IfIncludeDetails - /// - /// Parent Type: `Character` - public struct IfIncludeDetails: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetailsFragmentConditionalInclusionQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(HeroDetails.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heroDetails: HeroDetails { _toFragment() } - } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsFragmentConditionalInclusionQuery.Data.Hero.self), - ObjectIdentifier(HeroDetailsFragmentConditionalInclusionQuery.Data.Hero.IfIncludeDetails.self), - ObjectIdentifier(HeroDetails.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsInlineConditionalInclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsInlineConditionalInclusionQuery.graphql.swift deleted file mode 100644 index 87d854d250..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsInlineConditionalInclusionQuery.graphql.swift +++ /dev/null @@ -1,114 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroDetailsInlineConditionalInclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroDetailsInlineConditionalInclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "e251576f8c1cfcd442f44d2fbe5fd4b425a36ddd41fb4b6c1019c501ac6ac5bc", - definition: .init( - #"query HeroDetailsInlineConditionalInclusion($includeDetails: Boolean!) { hero { __typename ... @include(if: $includeDetails) { __typename name appearsIn } } }"# - )) - - public var includeDetails: Bool - - public init(includeDetails: Bool) { - self.includeDetails = includeDetails - } - - public var __variables: Variables? { ["includeDetails": includeDetails] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsInlineConditionalInclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "includeDetails", .inlineFragment(IfIncludeDetails.self)), - ] } - - public var ifIncludeDetails: IfIncludeDetails? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsInlineConditionalInclusionQuery.Data.Hero.self) - ] - )) - } - - /// Hero.IfIncludeDetails - /// - /// Parent Type: `Character` - public struct IfIncludeDetails: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetailsInlineConditionalInclusionQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("name", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - name: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsInlineConditionalInclusionQuery.Data.Hero.self), - ObjectIdentifier(HeroDetailsInlineConditionalInclusionQuery.Data.Hero.IfIncludeDetails.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsQuery.graphql.swift deleted file mode 100644 index c1430f37ce..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsQuery.graphql.swift +++ /dev/null @@ -1,156 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroDetailsQuery: GraphQLQuery { - public static let operationName: String = "HeroDetails" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "bf81c1338a3953d1c17c5cad3db3c3ab18b16a6822125ab81c15eb0dd3e82193", - definition: .init( - #"query HeroDetails($episode: Episode) { hero(episode: $episode) { __typename name ... on Human { __typename height } ... on Droid { __typename primaryFunction } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsQuery.Data.Hero.self) - ] - )) - } - - /// Hero.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetailsQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Double?.self), - ] } - - /// Height in the preferred unit, default is meters - public var height: Double? { __data["height"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - height: Double? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "height": height, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsQuery.Data.Hero.self), - ObjectIdentifier(HeroDetailsQuery.Data.Hero.AsHuman.self) - ] - )) - } - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetailsQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("primaryFunction", String?.self), - ] } - - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - primaryFunction: String? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "primaryFunction": primaryFunction, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsQuery.Data.Hero.self), - ObjectIdentifier(HeroDetailsQuery.Data.Hero.AsDroid.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsWithFragmentQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsWithFragmentQuery.graphql.swift deleted file mode 100644 index 0c67f84c11..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroDetailsWithFragmentQuery.graphql.swift +++ /dev/null @@ -1,185 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroDetailsWithFragmentQuery: GraphQLQuery { - public static let operationName: String = "HeroDetailsWithFragment" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "09fe4fc0cbcde5f0ba08b1207526cae13eb2b73ca95f929d4153dd3f643b6780", - definition: .init( - #"query HeroDetailsWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...HeroDetails } }"#, - fragments: [HeroDetails.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsWithFragmentQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(HeroDetails.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heroDetails: HeroDetails { _toFragment() } - } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(HeroDetails.self) - ] - )) - } - - /// Hero.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetailsWithFragmentQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - HeroDetails.self, - HeroDetailsWithFragmentQuery.Data.Hero.self, - HeroDetails.AsHuman.self - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// Height in the preferred unit, default is meters - public var height: Double? { __data["height"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heroDetails: HeroDetails { _toFragment() } - } - - public init( - name: String, - height: Double? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "name": name, - "height": height, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(HeroDetailsWithFragmentQuery.Data.Hero.AsHuman.self), - ObjectIdentifier(HeroDetails.self), - ObjectIdentifier(HeroDetails.AsHuman.self) - ] - )) - } - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroDetailsWithFragmentQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - HeroDetails.self, - HeroDetailsWithFragmentQuery.Data.Hero.self, - HeroDetails.AsDroid.self - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var heroDetails: HeroDetails { _toFragment() } - } - - public init( - name: String, - primaryFunction: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - "primaryFunction": primaryFunction, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroDetailsWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(HeroDetailsWithFragmentQuery.Data.Hero.AsDroid.self), - ObjectIdentifier(HeroDetails.self), - ObjectIdentifier(HeroDetails.AsDroid.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsDetailsConditionalInclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsDetailsConditionalInclusionQuery.graphql.swift deleted file mode 100644 index 601f7a5962..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsDetailsConditionalInclusionQuery.graphql.swift +++ /dev/null @@ -1,150 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroFriendsDetailsConditionalInclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroFriendsDetailsConditionalInclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "ca1b86ff4a0f8212bdac70fbb59c9bb8023d0a30ca0225b24831bb3e807b22a0", - definition: .init( - #"query HeroFriendsDetailsConditionalInclusion($includeFriendsDetails: Boolean!) { hero { __typename friends @include(if: $includeFriendsDetails) { __typename name ... on Droid { __typename primaryFunction } } } }"# - )) - - public var includeFriendsDetails: Bool - - public init(includeFriendsDetails: Bool) { - self.includeFriendsDetails = includeFriendsDetails - } - - public var __variables: Variables? { ["includeFriendsDetails": includeFriendsDetails] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsConditionalInclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "includeFriendsDetails", .field("friends", [Friend?]?.self)), - ] } - - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsConditionalInclusionQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsConditionalInclusionQuery.Data.Hero.Friend.self) - ] - )) - } - - /// Hero.Friend.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroFriendsDetailsConditionalInclusionQuery.Data.Hero.Friend - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("primaryFunction", String?.self), - ] } - - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - primaryFunction: String? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "primaryFunction": primaryFunction, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsConditionalInclusionQuery.Data.Hero.Friend.self), - ObjectIdentifier(HeroFriendsDetailsConditionalInclusionQuery.Data.Hero.Friend.AsDroid.self) - ] - )) - } - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift deleted file mode 100644 index 9bf38c2c0e..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.graphql.swift +++ /dev/null @@ -1,223 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroFriendsDetailsUnconditionalAndConditionalInclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "e36c8e5d752afda2a90fe44bcbfeb92de68f0da92b8390d626d3005cbad16dbe", - definition: .init( - #"query HeroFriendsDetailsUnconditionalAndConditionalInclusion($includeFriendsDetails: Boolean!) { hero { __typename friends { __typename name } friends @include(if: $includeFriendsDetails) { __typename name ... on Droid { __typename primaryFunction } } } }"# - )) - - public var includeFriendsDetails: Bool - - public init(includeFriendsDetails: Bool) { - self.includeFriendsDetails = includeFriendsDetails - } - - public var __variables: Variables? { ["includeFriendsDetails": includeFriendsDetails] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .include(if: "includeFriendsDetails", .inlineFragment(IfIncludeFriendsDetails.self)), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var ifIncludeFriendsDetails: IfIncludeFriendsDetails? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.self) - ] - )) - } - - /// Hero.Friend.IfIncludeFriendsDetails - /// - /// Parent Type: `Character` - public struct IfIncludeFriendsDetails: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("name", String.self), - .inlineFragment(AsDroid.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.self), - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.IfIncludeFriendsDetails.self) - ] - )) - } - - /// Hero.Friend.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("primaryFunction", String?.self), - ] } - - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - primaryFunction: String? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "primaryFunction": primaryFunction, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.self), - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.AsDroid.self) - ] - )) - } - } - } - /// Hero.Friend.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment, ApolloAPI.CompositeInlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.self, - HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.AsDroid.self - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// This droid's primary function - public var primaryFunction: String? { __data["primaryFunction"] } - - public init( - name: String, - primaryFunction: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - "primaryFunction": primaryFunction, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.self), - ObjectIdentifier(HeroFriendsDetailsUnconditionalAndConditionalInclusionQuery.Data.Hero.Friend.AsDroid.self) - ] - )) - } - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsOfFriendsNamesQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsOfFriendsNamesQuery.graphql.swift deleted file mode 100644 index 7dcba96e61..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroFriendsOfFriendsNamesQuery.graphql.swift +++ /dev/null @@ -1,148 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroFriendsOfFriendsNamesQuery: GraphQLQuery { - public static let operationName: String = "HeroFriendsOfFriendsNames" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "513b65fa459185f88540be8d60cdeefb69fd6c82a21b804214337558aa6ecb0b", - definition: .init( - #"query HeroFriendsOfFriendsNames($episode: Episode) { hero(episode: $episode) { __typename friends { __typename id friends { __typename name } } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsOfFriendsNamesQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friends", [Friend?]?.self), - ] } - - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsOfFriendsNamesQuery.Data.Hero.self) - ] - )) - } - - /// Hero.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .field("friends", [Friend?]?.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The friends of the character, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - - public init( - __typename: String, - id: StarWarsAPI.ID, - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsOfFriendsNamesQuery.Data.Hero.Friend.self) - ] - )) - } - - /// Hero.Friend.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroFriendsOfFriendsNamesQuery.Data.Hero.Friend.Friend.self) - ] - )) - } - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameAndAppearsInQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameAndAppearsInQuery.graphql.swift deleted file mode 100644 index 02c928b704..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameAndAppearsInQuery.graphql.swift +++ /dev/null @@ -1,84 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameAndAppearsInQuery: GraphQLQuery { - public static let operationName: String = "HeroNameAndAppearsIn" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "ecdf5248575524004a9d43832abc54e8c0e1d2b3c0afb8bb0c1c1c514b4f9baf", - definition: .init( - #"query HeroNameAndAppearsIn($episode: Episode) { hero(episode: $episode) { __typename name appearsIn } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameAndAppearsInQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - name: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameAndAppearsInQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameAndAppearsInWithFragmentQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameAndAppearsInWithFragmentQuery.graphql.swift deleted file mode 100644 index ebb5fc9b62..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameAndAppearsInWithFragmentQuery.graphql.swift +++ /dev/null @@ -1,92 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameAndAppearsInWithFragmentQuery: GraphQLQuery { - public static let operationName: String = "HeroNameAndAppearsInWithFragment" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "4fc9c2e7f9fbe8ef3f28936bd0b12e8f32bc8d70f3e8ec5df8a6aaf3efd4921c", - definition: .init( - #"query HeroNameAndAppearsInWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...CharacterNameAndAppearsIn } }"#, - fragments: [CharacterNameAndAppearsIn.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameAndAppearsInWithFragmentQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterNameAndAppearsIn.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterNameAndAppearsIn: CharacterNameAndAppearsIn { _toFragment() } - } - - public init( - __typename: String, - name: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameAndAppearsInWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(CharacterNameAndAppearsIn.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalBothQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalBothQuery.graphql.swift deleted file mode 100644 index daaa7685e4..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalBothQuery.graphql.swift +++ /dev/null @@ -1,87 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameConditionalBothQuery: GraphQLQuery { - public static let operationName: String = "HeroNameConditionalBoth" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "e063fa4ab5493e9c67bfa96dfedfa8570475f6286f38c482f6e85ced4ea206af", - definition: .init( - #"query HeroNameConditionalBoth($skipName: Boolean!, $includeName: Boolean!) { hero { __typename name @skip(if: $skipName) @include(if: $includeName) } }"# - )) - - public var skipName: Bool - public var includeName: Bool - - public init( - skipName: Bool, - includeName: Bool - ) { - self.skipName = skipName - self.includeName = includeName - } - - public var __variables: Variables? { [ - "skipName": skipName, - "includeName": includeName - ] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalBothQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: !"skipName" && "includeName", .field("name", String.self)), - ] } - - /// The name of the character - public var name: String? { __data["name"] } - - public init( - __typename: String, - name: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalBothQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalBothSeparateQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalBothSeparateQuery.graphql.swift deleted file mode 100644 index 3f9c31a6f2..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalBothSeparateQuery.graphql.swift +++ /dev/null @@ -1,87 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameConditionalBothSeparateQuery: GraphQLQuery { - public static let operationName: String = "HeroNameConditionalBothSeparate" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "60741c6fca15865a9af75a269ed05871e681f48ac48edfac2a77d953d217d03c", - definition: .init( - #"query HeroNameConditionalBothSeparate($skipName: Boolean!, $includeName: Boolean!) { hero { __typename name @skip(if: $skipName) name @include(if: $includeName) } }"# - )) - - public var skipName: Bool - public var includeName: Bool - - public init( - skipName: Bool, - includeName: Bool - ) { - self.skipName = skipName - self.includeName = includeName - } - - public var __variables: Variables? { [ - "skipName": skipName, - "includeName": includeName - ] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalBothSeparateQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: !"skipName" || "includeName", .field("name", String.self)), - ] } - - /// The name of the character - public var name: String? { __data["name"] } - - public init( - __typename: String, - name: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalBothSeparateQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalExclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalExclusionQuery.graphql.swift deleted file mode 100644 index 4387136fb8..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalExclusionQuery.graphql.swift +++ /dev/null @@ -1,79 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameConditionalExclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroNameConditionalExclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "b6d6f1d10cde449adbf2891d489159006188e63d4dea4edb9a23eddcbe0bd361", - definition: .init( - #"query HeroNameConditionalExclusion($skipName: Boolean!) { hero { __typename name @skip(if: $skipName) } }"# - )) - - public var skipName: Bool - - public init(skipName: Bool) { - self.skipName = skipName - } - - public var __variables: Variables? { ["skipName": skipName] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalExclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: !"skipName", .field("name", String.self)), - ] } - - /// The name of the character - public var name: String? { __data["name"] } - - public init( - __typename: String, - name: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalExclusionQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalInclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalInclusionQuery.graphql.swift deleted file mode 100644 index 8cf4865ef7..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameConditionalInclusionQuery.graphql.swift +++ /dev/null @@ -1,79 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameConditionalInclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroNameConditionalInclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "dd8e5df9634bb4fb6455e4aaddd2941c5abf785b7d28cda959aba65157e950c6", - definition: .init( - #"query HeroNameConditionalInclusion($includeName: Boolean!) { hero { __typename name @include(if: $includeName) } }"# - )) - - public var includeName: Bool - - public init(includeName: Bool) { - self.includeName = includeName - } - - public var __variables: Variables? { ["includeName": includeName] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalInclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "includeName", .field("name", String.self)), - ] } - - /// The name of the character - public var name: String? { __data["name"] } - - public init( - __typename: String, - name: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameConditionalInclusionQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameQuery.graphql.swift deleted file mode 100644 index 20d4d99b9a..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameQuery.graphql.swift +++ /dev/null @@ -1,79 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameQuery: GraphQLQuery { - public static let operationName: String = "HeroName" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "b9d49e889d6f5877c0bf09b8b4f88a71f88836a771e0e48c270a9aa8b506dda1", - definition: .init( - #"query HeroName($episode: Episode) { hero(episode: $episode) { __typename name } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift deleted file mode 100644 index 653119d0be..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameTypeSpecificConditionalInclusionQuery.graphql.swift +++ /dev/null @@ -1,122 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameTypeSpecificConditionalInclusionQuery: GraphQLQuery { - public static let operationName: String = "HeroNameTypeSpecificConditionalInclusion" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "c05a6e91e1a3ddc3df21205ed7fca49cf6f3f171e4390ac98e7690c391b18baf", - definition: .init( - #"query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { hero(episode: $episode) { __typename name @include(if: $includeName) ... on Droid { __typename name } } }"# - )) - - public var episode: GraphQLNullable> - public var includeName: Bool - - public init( - episode: GraphQLNullable>, - includeName: Bool - ) { - self.episode = episode - self.includeName = includeName - } - - public var __variables: Variables? { [ - "episode": episode, - "includeName": includeName - ] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameTypeSpecificConditionalInclusionQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsDroid.self), - .include(if: "includeName", .field("name", String.self)), - ] } - - /// The name of the character - public var name: String? { __data["name"] } - - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameTypeSpecificConditionalInclusionQuery.Data.Hero.self) - ] - )) - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroNameTypeSpecificConditionalInclusionQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("name", String.self), - ] } - - /// What others call this droid - public var name: String { __data["name"] } - - public init( - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameTypeSpecificConditionalInclusionQuery.Data.Hero.self), - ObjectIdentifier(HeroNameTypeSpecificConditionalInclusionQuery.Data.Hero.AsDroid.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithFragmentAndIDQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithFragmentAndIDQuery.graphql.swift deleted file mode 100644 index 89013e7472..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithFragmentAndIDQuery.graphql.swift +++ /dev/null @@ -1,93 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameWithFragmentAndIDQuery: GraphQLQuery { - public static let operationName: String = "HeroNameWithFragmentAndID" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "ec14e5fffc56163c516a21f0d211a7a86d68a3512e6fb6df38a19babe0d1df8d", - definition: .init( - #"query HeroNameWithFragmentAndID($episode: Episode) { hero(episode: $episode) { __typename id ...CharacterName } }"#, - fragments: [CharacterName.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameWithFragmentAndIDQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .fragment(CharacterName.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - } - - public init( - __typename: String, - id: StarWarsAPI.ID, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameWithFragmentAndIDQuery.Data.Hero.self), - ObjectIdentifier(CharacterName.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithFragmentQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithFragmentQuery.graphql.swift deleted file mode 100644 index e1155ab4ce..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithFragmentQuery.graphql.swift +++ /dev/null @@ -1,88 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameWithFragmentQuery: GraphQLQuery { - public static let operationName: String = "HeroNameWithFragment" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "68baad3c27796cb1bf980681324e43b948aa1109698ba57404c1afa46e914ab1", - definition: .init( - #"query HeroNameWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...CharacterName } }"#, - fragments: [CharacterName.self] - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameWithFragmentQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(CharacterName.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var characterName: CharacterName { _toFragment() } - } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameWithFragmentQuery.Data.Hero.self), - ObjectIdentifier(CharacterName.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithIDQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithIDQuery.graphql.swift deleted file mode 100644 index 72c5484463..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroNameWithIDQuery.graphql.swift +++ /dev/null @@ -1,84 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroNameWithIDQuery: GraphQLQuery { - public static let operationName: String = "HeroNameWithID" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "675d636002a28e24e3802d5f04772943b0a78b8795203fcab53f4c8466e1e53c", - definition: .init( - #"query HeroNameWithID($episode: Episode) { hero(episode: $episode) { __typename id name } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameWithIDQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - ] } - - /// The ID of the character - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - id: StarWarsAPI.ID, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "id": id, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroNameWithIDQuery.Data.Hero.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroParentTypeDependentFieldQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroParentTypeDependentFieldQuery.graphql.swift deleted file mode 100644 index 6448abf12c..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroParentTypeDependentFieldQuery.graphql.swift +++ /dev/null @@ -1,298 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroParentTypeDependentFieldQuery: GraphQLQuery { - public static let operationName: String = "HeroParentTypeDependentField" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "dc3b582f2baa66cfb5cd53eb3c215933427fd0537076767c8e0ef894d3990d15", - definition: .init( - #"query HeroParentTypeDependentField($episode: Episode) { hero(episode: $episode) { __typename name ... on Human { __typename friends { __typename name ... on Human { __typename height(unit: FOOT) } } } ... on Droid { __typename friends { __typename name ... on Human { __typename height(unit: METER) } } } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.self) - ] - )) - } - - /// Hero.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroParentTypeDependentFieldQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("friends", [Friend?]?.self), - ] } - - /// This human's friends, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - friends: [Friend?]? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "friends": friends._fieldData, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.self), - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsHuman.self) - ] - )) - } - - /// Hero.AsHuman.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsHuman.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asHuman: AsHuman? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsHuman.Friend.self) - ] - )) - } - - /// Hero.AsHuman.Friend.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroParentTypeDependentFieldQuery.Data.Hero.AsHuman.Friend - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Double?.self, arguments: ["unit": "FOOT"]), - ] } - - /// Height in the preferred unit, default is meters - public var height: Double? { __data["height"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - height: Double? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "height": height, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsHuman.Friend.self), - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsHuman.Friend.AsHuman.self) - ] - )) - } - } - } - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroParentTypeDependentFieldQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("friends", [Friend?]?.self), - ] } - - /// This droid's friends, or an empty list if they have none - public var friends: [Friend?]? { __data["friends"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - friends: [Friend?]? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "friends": friends._fieldData, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.self), - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsDroid.self) - ] - )) - } - - /// Hero.AsDroid.Friend - /// - /// Parent Type: `Character` - public struct Friend: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsHuman.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public var asHuman: AsHuman? { _asInlineFragment() } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsDroid.Friend.self) - ] - )) - } - - /// Hero.AsDroid.Friend.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroParentTypeDependentFieldQuery.Data.Hero.AsDroid.Friend - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("height", Double?.self, arguments: ["unit": "METER"]), - ] } - - /// Height in the preferred unit, default is meters - public var height: Double? { __data["height"] } - /// The name of the character - public var name: String { __data["name"] } - - public init( - height: Double? = nil, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "height": height, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsDroid.Friend.self), - ObjectIdentifier(HeroParentTypeDependentFieldQuery.Data.Hero.AsDroid.Friend.AsHuman.self) - ] - )) - } - } - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroTypeDependentAliasedFieldQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroTypeDependentAliasedFieldQuery.graphql.swift deleted file mode 100644 index 4a6d4dbbb8..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroTypeDependentAliasedFieldQuery.graphql.swift +++ /dev/null @@ -1,142 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HeroTypeDependentAliasedFieldQuery: GraphQLQuery { - public static let operationName: String = "HeroTypeDependentAliasedField" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "5b1ed6a84e96a4e48a3cad675ebb46020bce176f47361d097d8a0a824b7b8452", - definition: .init( - #"query HeroTypeDependentAliasedField($episode: Episode) { hero(episode: $episode) { __typename ... on Human { __typename property: homePlanet } ... on Droid { __typename property: primaryFunction } } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var hero: Hero? { __data["hero"] } - - public init( - hero: Hero? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.self) - ] - )) - } - - /// Hero.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroTypeDependentAliasedFieldQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("homePlanet", alias: "property", String?.self), - ] } - - /// The home planet of the human, or null if unknown - public var property: String? { __data["property"] } - - public init( - property: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "property": property, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.self), - ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.AsHuman.self) - ] - )) - } - } - - /// Hero.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = HeroTypeDependentAliasedFieldQuery.Data.Hero - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("primaryFunction", alias: "property", String?.self), - ] } - - /// This droid's primary function - public var property: String? { __data["property"] } - - public init( - property: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "property": property, - ], - fulfilledFragments: [ - ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.self), - ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.AsDroid.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HumanQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HumanQuery.graphql.swift deleted file mode 100644 index b9096e4d53..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HumanQuery.graphql.swift +++ /dev/null @@ -1,83 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class HumanQuery: GraphQLQuery { - public static let operationName: String = "Human" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "22b975c180932a926f48bfec1e002b9d1389e0ee1d84b3cdfa337d80fb036a26", - definition: .init( - #"query Human($id: ID!) { human(id: $id) { __typename name mass } }"# - )) - - public var id: ID - - public init(id: ID) { - self.id = id - } - - public var __variables: Variables? { ["id": id] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("human", Human?.self, arguments: ["id": .variable("id")]), - ] } - - public var human: Human? { __data["human"] } - - public init( - human: Human? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "human": human._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(HumanQuery.Data.self) - ] - )) - } - - /// Human - /// - /// Parent Type: `Human` - public struct Human: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("mass", Double?.self), - ] } - - /// What this human calls themselves - public var name: String { __data["name"] } - /// Mass in kilograms, or null if unknown - public var mass: Double? { __data["mass"] } - - public init( - name: String, - mass: Double? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "name": name, - "mass": mass, - ], - fulfilledFragments: [ - ObjectIdentifier(HumanQuery.Data.Human.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/SameHeroTwiceQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/SameHeroTwiceQuery.graphql.swift deleted file mode 100644 index 78d9bce644..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/SameHeroTwiceQuery.graphql.swift +++ /dev/null @@ -1,109 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class SameHeroTwiceQuery: GraphQLQuery { - public static let operationName: String = "SameHeroTwice" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "3d960acb3caffc4e42701ccada8535b1a5640f0cc46966b6a12830c755ff46d8", - definition: .init( - #"query SameHeroTwice { hero { __typename name } r2: hero { __typename appearsIn } }"# - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", Hero?.self), - .field("hero", alias: "r2", R2?.self), - ] } - - public var hero: Hero? { __data["hero"] } - public var r2: R2? { __data["r2"] } - - public init( - hero: Hero? = nil, - r2: R2? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "hero": hero._fieldData, - "r2": r2._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(SameHeroTwiceQuery.Data.self) - ] - )) - } - - /// Hero - /// - /// Parent Type: `Character` - public struct Hero: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(SameHeroTwiceQuery.Data.Hero.self) - ] - )) - } - } - - /// R2 - /// - /// Parent Type: `Character` - public struct R2: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("appearsIn", [GraphQLEnum?].self), - ] } - - /// The movies this character appears in - public var appearsIn: [GraphQLEnum?] { __data["appearsIn"] } - - public init( - __typename: String, - appearsIn: [GraphQLEnum?] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "appearsIn": appearsIn, - ], - fulfilledFragments: [ - ObjectIdentifier(SameHeroTwiceQuery.Data.R2.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/SearchQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/SearchQuery.graphql.swift deleted file mode 100644 index 610575f59f..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/SearchQuery.graphql.swift +++ /dev/null @@ -1,191 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class SearchQuery: GraphQLQuery { - public static let operationName: String = "Search" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "29ecc9c7acac3eab2585d305aed9f8257b448bc7ea57341a135d1fa476973ecb", - definition: .init( - #"query Search($term: String) { search(text: $term) { __typename ... on Human { __typename id name } ... on Droid { __typename id name } ... on Starship { __typename id name } } }"# - )) - - public var term: GraphQLNullable - - public init(term: GraphQLNullable) { - self.term = term - } - - public var __variables: Variables? { ["term": term] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("search", [Search?]?.self, arguments: ["text": .variable("term")]), - ] } - - public var search: [Search?]? { __data["search"] } - - public init( - search: [Search?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "search": search._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(SearchQuery.Data.self) - ] - )) - } - - /// Search - /// - /// Parent Type: `SearchResult` - public struct Search: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Unions.SearchResult } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - .inlineFragment(AsStarship.self), - ] } - - public var asHuman: AsHuman? { _asInlineFragment() } - public var asDroid: AsDroid? { _asInlineFragment() } - public var asStarship: AsStarship? { _asInlineFragment() } - - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(SearchQuery.Data.Search.self) - ] - )) - } - - /// Search.AsHuman - /// - /// Parent Type: `Human` - public struct AsHuman: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = SearchQuery.Data.Search - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human } - public static var __selections: [ApolloAPI.Selection] { [ - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - ] } - - /// The ID of the human - public var id: StarWarsAPI.ID { __data["id"] } - /// What this human calls themselves - public var name: String { __data["name"] } - - public init( - id: StarWarsAPI.ID, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Human.typename, - "id": id, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(SearchQuery.Data.Search.self), - ObjectIdentifier(SearchQuery.Data.Search.AsHuman.self) - ] - )) - } - } - - /// Search.AsDroid - /// - /// Parent Type: `Droid` - public struct AsDroid: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = SearchQuery.Data.Search - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid } - public static var __selections: [ApolloAPI.Selection] { [ - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - ] } - - /// The ID of the droid - public var id: StarWarsAPI.ID { __data["id"] } - /// What others call this droid - public var name: String { __data["name"] } - - public init( - id: StarWarsAPI.ID, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Droid.typename, - "id": id, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(SearchQuery.Data.Search.self), - ObjectIdentifier(SearchQuery.Data.Search.AsDroid.self) - ] - )) - } - } - - /// Search.AsStarship - /// - /// Parent Type: `Starship` - public struct AsStarship: StarWarsAPI.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = SearchQuery.Data.Search - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Starship } - public static var __selections: [ApolloAPI.Selection] { [ - .field("id", StarWarsAPI.ID.self), - .field("name", String.self), - ] } - - /// The ID of the starship - public var id: StarWarsAPI.ID { __data["id"] } - /// The name of the starship - public var name: String { __data["name"] } - - public init( - id: StarWarsAPI.ID, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Starship.typename, - "id": id, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(SearchQuery.Data.Search.self), - ObjectIdentifier(SearchQuery.Data.Search.AsStarship.self) - ] - )) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/StarshipCoordinatesQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/StarshipCoordinatesQuery.graphql.swift deleted file mode 100644 index 10b020aff8..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/StarshipCoordinatesQuery.graphql.swift +++ /dev/null @@ -1,87 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class StarshipCoordinatesQuery: GraphQLQuery { - public static let operationName: String = "StarshipCoordinates" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "c10b54b8dd9361556f3b12d71f28c859ace043525d8d19541b39eadc47d14b15", - definition: .init( - #"query StarshipCoordinates($coordinates: [[Float!]!]) { starshipCoordinates(coordinates: $coordinates) { __typename name coordinates length } }"# - )) - - public var coordinates: GraphQLNullable<[[Double]]> - - public init(coordinates: GraphQLNullable<[[Double]]>) { - self.coordinates = coordinates - } - - public var __variables: Variables? { ["coordinates": coordinates] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("starshipCoordinates", StarshipCoordinates?.self, arguments: ["coordinates": .variable("coordinates")]), - ] } - - public var starshipCoordinates: StarshipCoordinates? { __data["starshipCoordinates"] } - - public init( - starshipCoordinates: StarshipCoordinates? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "starshipCoordinates": starshipCoordinates._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(StarshipCoordinatesQuery.Data.self) - ] - )) - } - - /// StarshipCoordinates - /// - /// Parent Type: `Starship` - public struct StarshipCoordinates: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Starship } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("coordinates", [[Double]]?.self), - .field("length", Double?.self), - ] } - - /// The name of the starship - public var name: String { __data["name"] } - public var coordinates: [[Double]]? { __data["coordinates"] } - /// Length of the starship, along the longest axis - public var length: Double? { __data["length"] } - - public init( - name: String, - coordinates: [[Double]]? = nil, - length: Double? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Starship.typename, - "name": name, - "coordinates": coordinates, - "length": length, - ], - fulfilledFragments: [ - ObjectIdentifier(StarshipCoordinatesQuery.Data.StarshipCoordinates.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/StarshipQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/StarshipQuery.graphql.swift deleted file mode 100644 index 82730cd59e..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/StarshipQuery.graphql.swift +++ /dev/null @@ -1,76 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class StarshipQuery: GraphQLQuery { - public static let operationName: String = "Starship" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "e42a9be2ae0f222985e3eacf8d8d513002954d5031dcf544bbb0d27b1089fc58", - definition: .init( - #"query Starship { starship(id: 3000) { __typename name coordinates } }"# - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("starship", Starship?.self, arguments: ["id": 3000]), - ] } - - public var starship: Starship? { __data["starship"] } - - public init( - starship: Starship? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "starship": starship._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(StarshipQuery.Data.self) - ] - )) - } - - /// Starship - /// - /// Parent Type: `Starship` - public struct Starship: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Starship } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .field("coordinates", [[Double]]?.self), - ] } - - /// The name of the starship - public var name: String { __data["name"] } - public var coordinates: [[Double]]? { __data["coordinates"] } - - public init( - name: String, - coordinates: [[Double]]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Starship.typename, - "name": name, - "coordinates": coordinates, - ], - fulfilledFragments: [ - ObjectIdentifier(StarshipQuery.Data.Starship.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/TwoHeroesQuery.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/TwoHeroesQuery.graphql.swift deleted file mode 100644 index 9392b82dfd..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/TwoHeroesQuery.graphql.swift +++ /dev/null @@ -1,109 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class TwoHeroesQuery: GraphQLQuery { - public static let operationName: String = "TwoHeroes" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "79c1cf70ead0fb9d7bb0811982560f1585b0b0a4ad7507c934b43a4482bb2097", - definition: .init( - #"query TwoHeroes { r2: hero { __typename name } luke: hero(episode: EMPIRE) { __typename name } }"# - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query } - public static var __selections: [ApolloAPI.Selection] { [ - .field("hero", alias: "r2", R2?.self), - .field("hero", alias: "luke", Luke?.self, arguments: ["episode": "EMPIRE"]), - ] } - - public var r2: R2? { __data["r2"] } - public var luke: Luke? { __data["luke"] } - - public init( - r2: R2? = nil, - luke: Luke? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Query.typename, - "r2": r2._fieldData, - "luke": luke._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TwoHeroesQuery.Data.self) - ] - )) - } - - /// R2 - /// - /// Parent Type: `Character` - public struct R2: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(TwoHeroesQuery.Data.R2.self) - ] - )) - } - } - - /// Luke - /// - /// Parent Type: `Character` - public struct Luke: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - ] } - - /// The name of the character - public var name: String { __data["name"] } - - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(TwoHeroesQuery.Data.Luke.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Subscriptions/ReviewAddedSubscription.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Subscriptions/ReviewAddedSubscription.graphql.swift deleted file mode 100644 index 3b19459745..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Subscriptions/ReviewAddedSubscription.graphql.swift +++ /dev/null @@ -1,88 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class ReviewAddedSubscription: GraphQLSubscription { - public static let operationName: String = "ReviewAdded" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "2a05903b49a3b665eeb8f7a24240623aff77f1555e006f11bca604540c7cdba8", - definition: .init( - #"subscription ReviewAdded($episode: Episode) { reviewAdded(episode: $episode) { __typename episode stars commentary } }"# - )) - - public var episode: GraphQLNullable> - - public init(episode: GraphQLNullable>) { - self.episode = episode - } - - public var __variables: Variables? { ["episode": episode] } - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Subscription } - public static var __selections: [ApolloAPI.Selection] { [ - .field("reviewAdded", ReviewAdded?.self, arguments: ["episode": .variable("episode")]), - ] } - - public var reviewAdded: ReviewAdded? { __data["reviewAdded"] } - - public init( - reviewAdded: ReviewAdded? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Subscription.typename, - "reviewAdded": reviewAdded._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(ReviewAddedSubscription.Data.self) - ] - )) - } - - /// ReviewAdded - /// - /// Parent Type: `Review` - public struct ReviewAdded: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Review } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("episode", GraphQLEnum?.self), - .field("stars", Int.self), - .field("commentary", String?.self), - ] } - - /// The movie - public var episode: GraphQLEnum? { __data["episode"] } - /// The number of stars this review gave, 1-5 - public var stars: Int { __data["stars"] } - /// Comment about the movie - public var commentary: String? { __data["commentary"] } - - public init( - episode: GraphQLEnum? = nil, - stars: Int, - commentary: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": StarWarsAPI.Objects.Review.typename, - "episode": episode, - "stars": stars, - "commentary": commentary, - ], - fulfilledFragments: [ - ObjectIdentifier(ReviewAddedSubscription.Data.ReviewAdded.self) - ] - )) - } - } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Enums/Episode.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Enums/Episode.graphql.swift deleted file mode 100644 index 7c169daee8..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Enums/Episode.graphql.swift +++ /dev/null @@ -1,14 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -/// The episodes in the Star Wars trilogy -public enum Episode: String, EnumType { - /// Star Wars Episode IV: A New Hope, released in 1977. - case newhope = "NEWHOPE" - /// Star Wars Episode V: The Empire Strikes Back, released in 1980. - case empire = "EMPIRE" - /// Star Wars Episode VI: Return of the Jedi, released in 1983. - case jedi = "JEDI" -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/InputObjects/ColorInput.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/InputObjects/ColorInput.graphql.swift deleted file mode 100644 index 2f4dd87d0c..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/InputObjects/ColorInput.graphql.swift +++ /dev/null @@ -1,40 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -/// The input object sent when passing in a color -public struct ColorInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - red: Int, - green: Int, - blue: Int - ) { - __data = InputDict([ - "red": red, - "green": green, - "blue": blue - ]) - } - - public var red: Int { - get { __data["red"] } - set { __data["red"] = newValue } - } - - public var green: Int { - get { __data["green"] } - set { __data["green"] = newValue } - } - - public var blue: Int { - get { __data["blue"] } - set { __data["blue"] = newValue } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/InputObjects/ReviewInput.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/InputObjects/ReviewInput.graphql.swift deleted file mode 100644 index b5fdb813a8..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/InputObjects/ReviewInput.graphql.swift +++ /dev/null @@ -1,43 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -/// The input object sent when someone is creating a new review -public struct ReviewInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - stars: Int, - commentary: GraphQLNullable = nil, - favorite_color: GraphQLNullable = nil - ) { - __data = InputDict([ - "stars": stars, - "commentary": commentary, - "favorite_color": favorite_color - ]) - } - - /// 0-5 stars - public var stars: Int { - get { __data["stars"] } - set { __data["stars"] = newValue } - } - - /// Comment about the movie, optional - public var commentary: GraphQLNullable { - get { __data["commentary"] } - set { __data["commentary"] = newValue } - } - - /// Favorite color, optional - public var favorite_color: GraphQLNullable { - get { __data["favorite_color"] } - set { __data["favorite_color"] = newValue } - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Interfaces/Character.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Interfaces/Character.graphql.swift deleted file mode 100644 index 98ef5486d8..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Interfaces/Character.graphql.swift +++ /dev/null @@ -1,9 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Interfaces { - /// A character from the Star Wars universe - static let Character = Interface(name: "Character") -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Droid.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Droid.graphql.swift deleted file mode 100644 index ea4bd40937..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Droid.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// An autonomous mechanical character in the Star Wars universe - static let Droid = Object( - typename: "Droid", - implementedInterfaces: [Interfaces.Character.self] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Human.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Human.graphql.swift deleted file mode 100644 index d6b4ca9959..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Human.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// A humanoid creature from the Star Wars universe - static let Human = Object( - typename: "Human", - implementedInterfaces: [Interfaces.Character.self] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Mutation.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Mutation.graphql.swift deleted file mode 100644 index 6dd00778eb..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Mutation.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The mutation type, represents all updates we can make to our data - static let Mutation = Object( - typename: "Mutation", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Query.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Query.graphql.swift deleted file mode 100644 index 80a6150ec2..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Query.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The query type, represents all of the entry points into our object graph - static let Query = Object( - typename: "Query", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Review.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Review.graphql.swift deleted file mode 100644 index 22e818ec3f..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Review.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// Represents a review for a movie - static let Review = Object( - typename: "Review", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Starship.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Starship.graphql.swift deleted file mode 100644 index 719085180b..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Starship.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Starship = Object( - typename: "Starship", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Subscription.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Subscription.graphql.swift deleted file mode 100644 index fbe4489dce..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Objects/Subscription.graphql.swift +++ /dev/null @@ -1,12 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - /// The subscription type, represents all subscriptions we can make to our data - static let Subscription = Object( - typename: "Subscription", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/SchemaConfiguration.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/SchemaConfiguration.swift deleted file mode 100644 index 7976ecf827..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/SchemaConfiguration.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// provide custom configuration for a generated GraphQL schema. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } -} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/SchemaMetadata.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/SchemaMetadata.graphql.swift deleted file mode 100644 index 7819ee56d5..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/SchemaMetadata.graphql.swift +++ /dev/null @@ -1,39 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public typealias ID = String - -public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet -where Schema == StarWarsAPI.SchemaMetadata {} - -public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment -where Schema == StarWarsAPI.SchemaMetadata {} - -public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet -where Schema == StarWarsAPI.SchemaMetadata {} - -public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment -where Schema == StarWarsAPI.SchemaMetadata {} - -public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - - public static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "Query": return StarWarsAPI.Objects.Query - case "Human": return StarWarsAPI.Objects.Human - case "Droid": return StarWarsAPI.Objects.Droid - case "Starship": return StarWarsAPI.Objects.Starship - case "Subscription": return StarWarsAPI.Objects.Subscription - case "Review": return StarWarsAPI.Objects.Review - case "Mutation": return StarWarsAPI.Objects.Mutation - default: return nil - } - } -} - -public enum Objects {} -public enum Interfaces {} -public enum Unions {} diff --git a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Unions/SearchResult.graphql.swift b/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Unions/SearchResult.graphql.swift deleted file mode 100644 index 951924b7d4..0000000000 --- a/Sources/StarWarsAPI/StarWarsAPI/Sources/Schema/Unions/SearchResult.graphql.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Unions { - static let SearchResult = Union( - name: "SearchResult", - possibleTypes: [ - Objects.Human.self, - Objects.Droid.self, - Objects.Starship.self - ] - ) -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/starwars-graphql/API.json b/Sources/StarWarsAPI/starwars-graphql/API.json deleted file mode 100644 index 9d2e099e0a..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/API.json +++ /dev/null @@ -1,7590 +0,0 @@ -{ - "operations": [ - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CreateReviewForEpisode.graphql", - "operationName": "CreateReviewForEpisode", - "operationType": "mutation", - "rootType": "Mutation", - "variables": [ - { - "name": "episode", - "type": "Episode!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - { - "name": "review", - "type": "ReviewInput!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ReviewInput" - } - } - } - } - ], - "source": "mutation CreateReviewForEpisode($episode: Episode!, $review: ReviewInput!) {\n createReview(episode: $episode, review: $review) {\n __typename\n stars\n commentary\n }\n}", - "fields": [ - { - "responseName": "createReview", - "fieldName": "createReview", - "type": "Review", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Review" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - }, - { - "name": "review", - "value": { - "kind": "Variable", - "variableName": "review" - }, - "type": "ReviewInput!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ReviewInput" - } - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "stars", - "fieldName": "stars", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "isConditional": false, - "description": "The number of stars this review gave, 1-5", - "isDeprecated": false - }, - { - "responseName": "commentary", - "fieldName": "commentary", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "Comment about the movie", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "mutation CreateReviewForEpisode($episode: Episode!, $review: ReviewInput!) {\n createReview(episode: $episode, review: $review) {\n __typename\n stars\n commentary\n }\n}", - "operationId": "9bbf5b4074d0635fb19d17c621b7b04ebfb1920d468a94266819e149841e7d5d" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CreateReviewForEpisode.graphql", - "operationName": "CreateAwesomeReview", - "operationType": "mutation", - "rootType": "Mutation", - "variables": [], - "source": "mutation CreateAwesomeReview {\n createReview(episode: JEDI, review: {stars: 10, commentary: \"This is awesome!\"}) {\n __typename\n stars\n commentary\n }\n}", - "fields": [ - { - "responseName": "createReview", - "fieldName": "createReview", - "type": "Review", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Review" - } - }, - "args": [ - { - "name": "episode", - "value": "JEDI", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - }, - { - "name": "review", - "value": { - "stars": 10, - "commentary": "This is awesome!" - }, - "type": "ReviewInput!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ReviewInput" - } - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "stars", - "fieldName": "stars", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "isConditional": false, - "description": "The number of stars this review gave, 1-5", - "isDeprecated": false - }, - { - "responseName": "commentary", - "fieldName": "commentary", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "Comment about the movie", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "mutation CreateAwesomeReview {\n createReview(episode: JEDI, review: {stars: 10, commentary: \"This is awesome!\"}) {\n __typename\n stars\n commentary\n }\n}", - "operationId": "4a1250de93ebcb5cad5870acf15001112bf27bb963e8709555b5ff67a1405374" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "operationName": "HeroAndFriendsNames", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAndFriendsNames($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n friends {\n __typename\n name\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroAndFriendsNames($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n friends {\n __typename\n name\n }\n }\n}", - "operationId": "fe3f21394eb861aa515c4d582e645469045793c9cbbeca4b5d4ce4d7dd617556" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "operationName": "HeroAndFriendsNamesWithIDs", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAndFriendsNamesWithIDs($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n friends {\n __typename\n id\n name\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroAndFriendsNamesWithIDs($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n friends {\n __typename\n id\n name\n }\n }\n}", - "operationId": "8e4ca76c63660898cfd5a3845e3709027750b5f0151c7f9be65759b869c5486d" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "operationName": "HeroAndFriendsIDs", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAndFriendsIDs($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n friends {\n __typename\n id\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroAndFriendsIDs($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n friends {\n __typename\n id\n }\n }\n}", - "operationId": "117d0f6831d8f4abe5b61ed1dbb8071b0825e19649916c0fe0906a6f578bb088" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "operationName": "HeroAndFriendsNamesWithIDForParentOnly", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAndFriendsNamesWithIDForParentOnly($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n friends {\n __typename\n name\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroAndFriendsNamesWithIDForParentOnly($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n friends {\n __typename\n name\n }\n }\n}", - "operationId": "f091468a629f3b757c03a1b7710c6ede8b5c8f10df7ba3238f2bbcd71c56f90f" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "operationName": "HeroAndFriendsNamesWithFragment", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAndFriendsNamesWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n ...FriendsNames\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [ - "FriendsNames" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "FriendsNames" - ], - "sourceWithFragments": "query HeroAndFriendsNamesWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n ...FriendsNames\n }\n}\nfragment FriendsNames on Character {\n __typename\n friends {\n __typename\n name\n }\n}", - "operationId": "1d3ad903dad146ff9d7aa09813fc01becd017489bfc1af8ffd178498730a5a26" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "operationName": "HeroAndFriendsNamesWithFragmentTwice", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAndFriendsNamesWithFragmentTwice($episode: Episode) {\n hero(episode: $episode) {\n __typename\n friends {\n __typename\n ...CharacterName\n }\n ... on Droid {\n friends {\n __typename\n ...CharacterName\n }\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "This droid's friends, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName", - "CharacterName" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "CharacterName" - ], - "sourceWithFragments": "query HeroAndFriendsNamesWithFragmentTwice($episode: Episode) {\n hero(episode: $episode) {\n __typename\n friends {\n __typename\n ...CharacterName\n }\n ... on Droid {\n friends {\n __typename\n ...CharacterName\n }\n }\n }\n}\nfragment CharacterName on Character {\n __typename\n name\n}", - "operationId": "e02ef22e116ad1ca35f0298ed3badb60eeb986203f0088575a5f137768c322fc" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAppearsIn.graphql", - "operationName": "HeroAppearsIn", - "operationType": "query", - "rootType": "Query", - "variables": [], - "source": "query HeroAppearsIn {\n hero {\n __typename\n appearsIn\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroAppearsIn {\n hero {\n __typename\n appearsIn\n }\n}", - "operationId": "22d772c0fc813281705e8f0a55fc70e71eeff6e98f3f9ef96cf67fb896914522" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAppearsIn.graphql", - "operationName": "HeroAppearsInWithFragment", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroAppearsInWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...CharacterAppearsIn\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterAppearsIn" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "CharacterAppearsIn" - ], - "sourceWithFragments": "query HeroAppearsInWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...CharacterAppearsIn\n }\n}\nfragment CharacterAppearsIn on Character {\n __typename\n appearsIn\n}", - "operationId": "1756158bd7736d58db45a48d74a724fa1b6fdac735376df8afac8318ba5431fb" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroNameConditionalExclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "skipName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroNameConditionalExclusion($skipName: Boolean!) {\n hero {\n __typename\n name @skip(if: $skipName)\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "skipName", - "inverted": true - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameConditionalExclusion($skipName: Boolean!) {\n hero {\n __typename\n name @skip(if: $skipName)\n }\n}", - "operationId": "3dd42259adf2d0598e89e0279bee2c128a7913f02b1da6aa43f3b5def6a8a1f8" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroNameConditionalInclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "includeName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroNameConditionalInclusion($includeName: Boolean!) {\n hero {\n __typename\n name @include(if: $includeName)\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeName", - "inverted": false - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameConditionalInclusion($includeName: Boolean!) {\n hero {\n __typename\n name @include(if: $includeName)\n }\n}", - "operationId": "338081aea3acc83d04af0741ecf0da1ec2ee8e6468a88383476b681015905ef8" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroNameConditionalBoth", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "skipName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - }, - { - "name": "includeName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroNameConditionalBoth($skipName: Boolean!, $includeName: Boolean!) {\n hero {\n __typename\n name @skip(if: $skipName) @include(if: $includeName)\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeName", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "skipName", - "inverted": true - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameConditionalBoth($skipName: Boolean!, $includeName: Boolean!) {\n hero {\n __typename\n name @skip(if: $skipName) @include(if: $includeName)\n }\n}", - "operationId": "66f4dc124b6374b1912b22a2a208e34a4b1997349402a372b95bcfafc7884064" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroNameConditionalBothSeparate", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "skipName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - }, - { - "name": "includeName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroNameConditionalBothSeparate($skipName: Boolean!, $includeName: Boolean!) {\n hero {\n __typename\n name @skip(if: $skipName)\n name @include(if: $includeName)\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "skipName", - "inverted": true - }, - { - "kind": "BooleanCondition", - "variableName": "includeName", - "inverted": false - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameConditionalBothSeparate($skipName: Boolean!, $includeName: Boolean!) {\n hero {\n __typename\n name @skip(if: $skipName)\n name @include(if: $includeName)\n }\n}", - "operationId": "d0f9e9205cdc09320035662f528a177654d3275b0bf94cf0e259a65fde33e7e5" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroDetailsInlineConditionalInclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "includeDetails", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroDetailsInlineConditionalInclusion($includeDetails: Boolean!) {\n hero {\n __typename\n ... @include(if: $includeDetails) {\n name\n appearsIn\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroDetailsInlineConditionalInclusion($includeDetails: Boolean!) {\n hero {\n __typename\n ... @include(if: $includeDetails) {\n name\n appearsIn\n }\n }\n}", - "operationId": "fcd9d7acb4e7c97e3ae5ad3cbf4e83556626149de589f0c2fce2f8ede31b0d90" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroDetailsFragmentConditionalInclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "includeDetails", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroDetailsFragmentConditionalInclusion($includeDetails: Boolean!) {\n hero {\n __typename\n ...HeroDetails @include(if: $includeDetails)\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "HeroDetails" - ], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "HeroDetails" - ] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeDetails", - "inverted": false - } - ], - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "HeroDetails" - ] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "HeroDetails" - ], - "sourceWithFragments": "query HeroDetailsFragmentConditionalInclusion($includeDetails: Boolean!) {\n hero {\n __typename\n ...HeroDetails @include(if: $includeDetails)\n }\n}\nfragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n}", - "operationId": "b31aec7d977249e185922e4cc90318fd2c7197631470904bf937b0626de54b4f" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroNameTypeSpecificConditionalInclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - }, - { - "name": "includeName", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) {\n hero(episode: $episode) {\n __typename\n name @include(if: $includeName)\n ... on Droid {\n name\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeName", - "inverted": false - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeName", - "inverted": false - } - ], - "description": "What others call this droid", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) {\n hero(episode: $episode) {\n __typename\n name @include(if: $includeName)\n ... on Droid {\n name\n }\n }\n}", - "operationId": "4d465fbc6e3731d011025048502f16278307d73300ea9329a709d7e2b6815e40" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroFriendsDetailsConditionalInclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "includeFriendsDetails", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroFriendsDetailsConditionalInclusion($includeFriendsDetails: Boolean!) {\n hero {\n __typename\n friends @include(if: $includeFriendsDetails) {\n __typename\n name\n ... on Droid {\n primaryFunction\n }\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroFriendsDetailsConditionalInclusion($includeFriendsDetails: Boolean!) {\n hero {\n __typename\n friends @include(if: $includeFriendsDetails) {\n __typename\n name\n ... on Droid {\n primaryFunction\n }\n }\n }\n}", - "operationId": "9bdfeee789c1d22123402a9c3e3edefeb66799b3436289751be8f47905e3babd" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroConditional.graphql", - "operationName": "HeroFriendsDetailsUnconditionalAndConditionalInclusion", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "includeFriendsDetails", - "type": "Boolean!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Boolean" - } - } - } - } - ], - "source": "query HeroFriendsDetailsUnconditionalAndConditionalInclusion($includeFriendsDetails: Boolean!) {\n hero {\n __typename\n friends {\n __typename\n name\n }\n friends @include(if: $includeFriendsDetails) {\n __typename\n name\n ... on Droid {\n primaryFunction\n }\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - }, - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": true, - "conditions": [ - { - "kind": "BooleanCondition", - "variableName": "includeFriendsDetails", - "inverted": false - } - ], - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroFriendsDetailsUnconditionalAndConditionalInclusion($includeFriendsDetails: Boolean!) {\n hero {\n __typename\n friends {\n __typename\n name\n }\n friends @include(if: $includeFriendsDetails) {\n __typename\n name\n ... on Droid {\n primaryFunction\n }\n }\n }\n}", - "operationId": "501fcb710e5ffeeab2c65b7935fbded394ffea92e7b5dd904d05d5deab6f39c6" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroDetails.graphql", - "operationName": "HeroDetails", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroDetails($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "isConditional": false, - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroDetails($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n}", - "operationId": "2b67111fd3a1c6b2ac7d1ef7764e5cefa41d3f4218e1d60cb67c22feafbd43ec" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroDetails.graphql", - "operationName": "HeroDetailsWithFragment", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...HeroDetails\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "HeroDetails" - ], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "isConditional": false, - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "HeroDetails" - ] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "HeroDetails" - ] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "HeroDetails" - ], - "sourceWithFragments": "query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...HeroDetails\n }\n}\nfragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n}", - "operationId": "d20fa2f460058b8eec3d227f2f6088a708cf35dfa2b5ebf1414e34f9674ecfce" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroDetails.graphql", - "operationName": "DroidDetailsWithFragment", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query DroidDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...DroidDetails\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "DroidDetails" - ], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "DroidDetails" - ] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "DroidDetails" - ], - "sourceWithFragments": "query DroidDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...DroidDetails\n }\n}\nfragment DroidDetails on Droid {\n __typename\n name\n primaryFunction\n}", - "operationId": "7277e97563e911ac8f5c91d401028d218aae41f38df014d7fa0b037bb2a2e739" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroFriendsOfFriends.graphql", - "operationName": "HeroFriendsOfFriendsNames", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroFriendsOfFriendsNames($episode: Episode) {\n hero(episode: $episode) {\n __typename\n friends {\n __typename\n id\n friends {\n __typename\n name\n }\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroFriendsOfFriendsNames($episode: Episode) {\n hero(episode: $episode) {\n __typename\n friends {\n __typename\n id\n friends {\n __typename\n name\n }\n }\n }\n}", - "operationId": "37cd5626048e7243716ffda9e56503939dd189772124a1c21b0e0b87e69aae01" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroName.graphql", - "operationName": "HeroName", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroName($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroName($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n }\n}", - "operationId": "f6e76545cd03aa21368d9969cb39447f6e836a16717823281803778e7805d671" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroName.graphql", - "operationName": "HeroNameWithID", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroNameWithID($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameWithID($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n name\n }\n}", - "operationId": "83c03f612c46fca72f6cb902df267c57bffc9209bc44dd87d2524fb2b34f6f18" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroName.graphql", - "operationName": "HeroNameWithFragment", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroNameWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...CharacterName\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "CharacterName" - ], - "sourceWithFragments": "query HeroNameWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...CharacterName\n }\n}\nfragment CharacterName on Character {\n __typename\n name\n}", - "operationId": "b952f0054915a32ec524ac0dde0244bcda246649debe149f9e32e303e21c8266" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroName.graphql", - "operationName": "HeroNameWithFragmentAndID", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroNameWithFragmentAndID($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n ...CharacterName\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the character", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "CharacterName" - ], - "sourceWithFragments": "query HeroNameWithFragmentAndID($episode: Episode) {\n hero(episode: $episode) {\n __typename\n id\n ...CharacterName\n }\n}\nfragment CharacterName on Character {\n __typename\n name\n}", - "operationId": "a87a0694c09d1ed245e9a80f245d96a5f57b20a4aa936ee9ab09b2a43620db02" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroNameAndAppearsIn.graphql", - "operationName": "HeroNameAndAppearsIn", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroNameAndAppearsIn($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n appearsIn\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroNameAndAppearsIn($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n appearsIn\n }\n}", - "operationId": "f714414a2002404f9943490c8cc9c1a7b8ecac3ca229fa5a326186b43c1385ce" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroNameAndAppearsIn.graphql", - "operationName": "HeroNameAndAppearsInWithFragment", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroNameAndAppearsInWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...CharacterNameAndAppearsIn\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterNameAndAppearsIn" - ], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [ - "CharacterNameAndAppearsIn" - ], - "sourceWithFragments": "query HeroNameAndAppearsInWithFragment($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ...CharacterNameAndAppearsIn\n }\n}\nfragment CharacterNameAndAppearsIn on Character {\n __typename\n name\n appearsIn\n}", - "operationId": "0664fed3eb4f9fbdb44e8691d9e8fd11f2b3c097ba11327592054f602bd3ba1a" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroParentTypeDependentField.graphql", - "operationName": "HeroParentTypeDependentField", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroParentTypeDependentField($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n ... on Human {\n friends {\n __typename\n name\n ... on Human {\n height(unit: FOOT)\n }\n }\n }\n ... on Droid {\n friends {\n __typename\n name\n ... on Human {\n height(unit: METER)\n }\n }\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "This human's friends, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "args": [ - { - "name": "unit", - "value": "FOOT", - "type": "LengthUnit", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "LengthUnit" - } - } - } - ], - "isConditional": false, - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "This droid's friends, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "args": [ - { - "name": "unit", - "value": "METER", - "type": "LengthUnit", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "LengthUnit" - } - } - } - ], - "isConditional": false, - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroParentTypeDependentField($episode: Episode) {\n hero(episode: $episode) {\n __typename\n name\n ... on Human {\n friends {\n __typename\n name\n ... on Human {\n height(unit: FOOT)\n }\n }\n }\n ... on Droid {\n friends {\n __typename\n name\n ... on Human {\n height(unit: METER)\n }\n }\n }\n }\n}", - "operationId": "561e22ac4da5209f254779b70e01557fb2fc57916b9914088429ec809e166cad" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroTypeDependentAliasedField.graphql", - "operationName": "HeroTypeDependentAliasedField", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "query HeroTypeDependentAliasedField($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ... on Human {\n property: homePlanet\n }\n ... on Droid {\n property: primaryFunction\n }\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "property", - "fieldName": "homePlanet", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "The home planet of the human, or null if unknown", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "property", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query HeroTypeDependentAliasedField($episode: Episode) {\n hero(episode: $episode) {\n __typename\n ... on Human {\n property: homePlanet\n }\n ... on Droid {\n property: primaryFunction\n }\n }\n}", - "operationId": "b5838c22bac1c5626023dac4412ca9b86bebfe16608991fb632a37c44e12811e" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/SameHeroTwice.graphql", - "operationName": "SameHeroTwice", - "operationType": "query", - "rootType": "Query", - "variables": [], - "source": "query SameHeroTwice {\n hero {\n __typename\n name\n }\n r2: hero {\n __typename\n appearsIn\n }\n}", - "fields": [ - { - "responseName": "hero", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "responseName": "r2", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query SameHeroTwice {\n hero {\n __typename\n name\n }\n r2: hero {\n __typename\n appearsIn\n }\n}", - "operationId": "2a8ad85a703add7d64622aaf6be76b58a1134caf28e4ff6b34dd00ba89541364" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/Search.graphql", - "operationName": "Search", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "term", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - } - ], - "source": "query Search($term: String) {\n search(text: $term) {\n __typename\n ... on Human {\n id\n name\n }\n ... on Droid {\n id\n name\n }\n ... on Starship {\n id\n name\n }\n }\n}", - "fields": [ - { - "responseName": "search", - "fieldName": "search", - "type": "[SearchResult]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "SearchResult" - } - } - }, - "args": [ - { - "name": "text", - "value": { - "kind": "Variable", - "variableName": "term" - }, - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the human", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the droid", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Starship", - "possibleTypes": [ - "Starship" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "id", - "fieldName": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - }, - "isConditional": false, - "description": "The ID of the starship", - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the starship", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query Search($term: String) {\n search(text: $term) {\n __typename\n ... on Human {\n id\n name\n }\n ... on Droid {\n id\n name\n }\n ... on Starship {\n id\n name\n }\n }\n}", - "operationId": "73536da2eec4d83e6e1003e674cb2299d9da2798f7bd310e57339a6bcd713b77" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/Starship.graphql", - "operationName": "Starship", - "operationType": "query", - "rootType": "Query", - "variables": [], - "source": "query Starship {\n starship(id: 3000) {\n __typename\n name\n coordinates\n }\n}", - "fields": [ - { - "responseName": "starship", - "fieldName": "starship", - "type": "Starship", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Starship" - } - }, - "args": [ - { - "name": "id", - "value": 3000, - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the starship", - "isDeprecated": false - }, - { - "responseName": "coordinates", - "fieldName": "coordinates", - "type": "[[Float!]!]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - } - } - } - } - }, - "isConditional": false, - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query Starship {\n starship(id: 3000) {\n __typename\n name\n coordinates\n }\n}", - "operationId": "a3734516185da9919e3e66d74fe92b60d65292a1943dc54913f7332637dfdd2a" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/Starship.graphql", - "operationName": "StarshipCoordinates", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "coordinates", - "type": "[[Float!]!]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - } - } - } - } - } - } - ], - "source": "query StarshipCoordinates($coordinates: [[Float!]!]) {\n starshipCoordinates(coordinates: $coordinates) {\n __typename\n name\n coordinates\n length\n }\n}", - "fields": [ - { - "responseName": "starshipCoordinates", - "fieldName": "starshipCoordinates", - "type": "Starship", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Starship" - } - }, - "args": [ - { - "name": "coordinates", - "value": { - "kind": "Variable", - "variableName": "coordinates" - }, - "type": "[[Float!]!]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - } - } - } - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the starship", - "isDeprecated": false - }, - { - "responseName": "coordinates", - "fieldName": "coordinates", - "type": "[[Float!]!]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - } - } - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "length", - "fieldName": "length", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "isConditional": false, - "description": "Length of the starship, along the longest axis", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query StarshipCoordinates($coordinates: [[Float!]!]) {\n starshipCoordinates(coordinates: $coordinates) {\n __typename\n name\n coordinates\n length\n }\n}", - "operationId": "8dd77d4bc7494c184606da092a665a7c2ca3c2a3f14d3b23fa5e469e207b3406" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/SubscribeReview.graphql", - "operationName": "ReviewAdded", - "operationType": "subscription", - "rootType": "Subscription", - "variables": [ - { - "name": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "source": "subscription ReviewAdded($episode: Episode) {\n reviewAdded(episode: $episode) {\n __typename\n episode\n stars\n commentary\n }\n}", - "fields": [ - { - "responseName": "reviewAdded", - "fieldName": "reviewAdded", - "type": "Review", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Review" - } - }, - "args": [ - { - "name": "episode", - "value": { - "kind": "Variable", - "variableName": "episode" - }, - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "episode", - "fieldName": "episode", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - }, - "isConditional": false, - "description": "The movie", - "isDeprecated": false - }, - { - "responseName": "stars", - "fieldName": "stars", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "isConditional": false, - "description": "The number of stars this review gave, 1-5", - "isDeprecated": false - }, - { - "responseName": "commentary", - "fieldName": "commentary", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "Comment about the movie", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "subscription ReviewAdded($episode: Episode) {\n reviewAdded(episode: $episode) {\n __typename\n episode\n stars\n commentary\n }\n}", - "operationId": "38644c5e7cf4fd506b91d2e7010cabf84e63dfcd33cf1deb443b4b32b55e2cbe" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/TestFolder/TestFolder2/Human.graphql", - "operationName": "Human", - "operationType": "query", - "rootType": "Query", - "variables": [ - { - "name": "id", - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - } - } - ], - "source": "query Human($id: ID!) {\n human(id: $id) {\n __typename\n name\n mass\n }\n}", - "fields": [ - { - "responseName": "human", - "fieldName": "human", - "type": "Human", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Human" - } - }, - "args": [ - { - "name": "id", - "value": { - "kind": "Variable", - "variableName": "id" - }, - "type": "ID!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ID" - } - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "mass", - "fieldName": "mass", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "isConditional": false, - "description": "Mass in kilograms, or null if unknown", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query Human($id: ID!) {\n human(id: $id) {\n __typename\n name\n mass\n }\n}", - "operationId": "b37eb69b82fd52358321e49453769750983be1c286744dbf415735d7bcf12f1e" - }, - { - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/TwoHeroes.graphql", - "operationName": "TwoHeroes", - "operationType": "query", - "rootType": "Query", - "variables": [], - "source": "query TwoHeroes {\n r2: hero {\n __typename\n name\n }\n luke: hero(episode: EMPIRE) {\n __typename\n name\n }\n}", - "fields": [ - { - "responseName": "r2", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "responseName": "luke", - "fieldName": "hero", - "type": "Character", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "args": [ - { - "name": "episode", - "value": "EMPIRE", - "type": "Episode", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - ], - "isConditional": false, - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [], - "fragmentsReferenced": [], - "sourceWithFragments": "query TwoHeroes {\n r2: hero {\n __typename\n name\n }\n luke: hero(episode: EMPIRE) {\n __typename\n name\n }\n}", - "operationId": "b868fa9c48f19b8151c08c09f46831e3b9cd09f5c617d328647de785244b52bb" - } - ], - "fragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fragmentName": "DroidNameAndPrimaryFunction", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment DroidNameAndPrimaryFunction on Droid {\n __typename\n ...CharacterName\n ...DroidPrimaryFunction\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Droid" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName", - "DroidPrimaryFunction" - ], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterNameAndDroidPrimaryFunction", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment CharacterNameAndDroidPrimaryFunction on Character {\n __typename\n ...CharacterName\n ...DroidPrimaryFunction\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName", - "DroidPrimaryFunction" - ], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterName", - "DroidPrimaryFunction" - ] - } - ] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterNameAndDroidAppearsIn", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment CharacterNameAndDroidAppearsIn on Character {\n __typename\n name\n ... on Droid {\n appearsIn\n }\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this droid appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fragmentName": "DroidName", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment DroidName on Droid {\n __typename\n name\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Droid" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fragmentName": "DroidPrimaryFunction", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment DroidPrimaryFunction on Droid {\n __typename\n primaryFunction\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Droid" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fragmentName": "HumanHeightWithVariable", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment HumanHeightWithVariable on Human {\n __typename\n height(unit: $heightUnit)\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Human" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "args": [ - { - "name": "unit", - "value": { - "kind": "Variable", - "variableName": "heightUnit" - }, - "type": "LengthUnit", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "LengthUnit" - } - } - } - ], - "isConditional": false, - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterNameAndAppearsInWithNestedFragments", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment CharacterNameAndAppearsInWithNestedFragments on Character {\n __typename\n ...CharacterNameWithNestedAppearsInFragment\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterNameWithNestedAppearsInFragment" - ], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterNameWithNestedAppearsInFragment", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment CharacterNameWithNestedAppearsInFragment on Character {\n __typename\n name\n ...CharacterAppearsIn\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [ - "CharacterAppearsIn" - ], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterNameWithInlineFragment", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/CharacterAndSubTypesFragments.graphql", - "source": "fragment CharacterNameWithInlineFragment on Character {\n __typename\n ... on Human {\n friends {\n __typename\n appearsIn\n }\n }\n ... on Droid {\n ...CharacterName\n ...FriendsNames\n }\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "This human's friends, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "This droid's friends, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [ - "CharacterName", - "FriendsNames" - ] - } - ] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "FriendsNames", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAndFriendsNames.graphql", - "source": "fragment FriendsNames on Character {\n __typename\n friends {\n __typename\n name\n }\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "friends", - "fieldName": "friends", - "type": "[Character]", - "typeNode": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - } - }, - "isConditional": false, - "description": "The friends of the character, or an empty list if they have none", - "isDeprecated": false, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterAppearsIn", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroAppearsIn.graphql", - "source": "fragment CharacterAppearsIn on Character {\n __typename\n appearsIn\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "HeroDetails", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroDetails.graphql", - "source": "fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [ - { - "typeCondition": "Human", - "possibleTypes": [ - "Human" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What this human calls themselves", - "isDeprecated": false - }, - { - "responseName": "height", - "fieldName": "height", - "type": "Float", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Float" - } - }, - "isConditional": false, - "description": "Height in the preferred unit, default is meters", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [] - } - ] - }, - { - "typeCondition": "Droid", - "possibleTypes": [ - "Droid" - ], - "fragmentName": "DroidDetails", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroDetails.graphql", - "source": "fragment DroidDetails on Droid {\n __typename\n name\n primaryFunction\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Droid" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "What others call this droid", - "isDeprecated": false - }, - { - "responseName": "primaryFunction", - "fieldName": "primaryFunction", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "isConditional": false, - "description": "This droid's primary function", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterName", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroName.graphql", - "source": "fragment CharacterName on Character {\n __typename\n name\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - }, - { - "typeCondition": "Character", - "possibleTypes": [ - "Human", - "Droid" - ], - "fragmentName": "CharacterNameAndAppearsIn", - "filePath": "file:///Users/ellen/Desktop/Work/Apollo/apollo-ios/Sources/StarWarsAPI/graphql/HeroNameAndAppearsIn.graphql", - "source": "fragment CharacterNameAndAppearsIn on Character {\n __typename\n name\n appearsIn\n}", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Character" - } - }, - "fields": [ - { - "responseName": "__typename", - "fieldName": "__typename", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "isDeprecated": false - }, - { - "responseName": "name", - "fieldName": "name", - "type": "String!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "isConditional": false, - "description": "The name of the character", - "isDeprecated": false - }, - { - "responseName": "appearsIn", - "fieldName": "appearsIn", - "type": "[Episode]!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "ListType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Episode" - } - } - } - }, - "isConditional": false, - "description": "The movies this character appears in", - "isDeprecated": false - } - ], - "fragmentSpreads": [], - "inlineFragments": [] - } - ], - "typesUsed": [ - { - "kind": "EnumType", - "name": "Episode", - "description": "The episodes in the Star Wars trilogy", - "values": [ - { - "name": "NEWHOPE", - "description": "Star Wars Episode IV: A New Hope, released in 1977.", - "isDeprecated": false - }, - { - "name": "EMPIRE", - "description": "Star Wars Episode V: The Empire Strikes Back, released in 1980.", - "isDeprecated": false - }, - { - "name": "JEDI", - "description": "Star Wars Episode VI: Return of the Jedi, released in 1983.", - "isDeprecated": false - } - ] - }, - { - "kind": "InputObjectType", - "name": "ReviewInput", - "description": "The input object sent when someone is creating a new review", - "fields": [ - { - "name": "stars", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "description": "0-5 stars" - }, - { - "name": "commentary", - "type": "String", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - }, - "description": "Comment about the movie, optional" - }, - { - "name": "favorite_color", - "type": "ColorInput", - "typeNode": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ColorInput" - } - }, - "description": "Favorite color, optional" - } - ] - }, - { - "kind": "InputObjectType", - "name": "ColorInput", - "description": "The input object sent when passing in a color", - "fields": [ - { - "name": "red", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "description": "" - }, - { - "name": "green", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "description": "" - }, - { - "name": "blue", - "type": "Int!", - "typeNode": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - } - }, - "description": "" - } - ] - } - ], - "unionTypes": [ - { - "name": "SearchResult", - "types": [ - "Human", - "Droid", - "Starship" - ] - } - ], - "interfaceTypes": [ - { - "name": "Character", - "types": [ - "Human", - "Droid" - ] - } - ] -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/starwars-graphql/CharacterAndSubTypesFragments.graphql b/Sources/StarWarsAPI/starwars-graphql/CharacterAndSubTypesFragments.graphql deleted file mode 100644 index 78c55a1c31..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/CharacterAndSubTypesFragments.graphql +++ /dev/null @@ -1,50 +0,0 @@ -fragment DroidNameAndPrimaryFunction on Droid { - ...CharacterName - ...DroidPrimaryFunction -} - -fragment CharacterNameAndDroidPrimaryFunction on Character { - ...CharacterName - ...DroidPrimaryFunction -} - -fragment CharacterNameAndDroidAppearsIn on Character { - name - ... on Droid { - appearsIn - } -} - -fragment DroidName on Droid { - name -} - -fragment DroidPrimaryFunction on Droid { - primaryFunction -} - -fragment HumanHeightWithVariable on Human { - height(unit: $heightUnit) -} - -fragment CharacterNameAndAppearsInWithNestedFragments on Character { - ...CharacterNameWithNestedAppearsInFragment -} - -fragment CharacterNameWithNestedAppearsInFragment on Character { - name - ...CharacterAppearsIn -} - -fragment CharacterNameWithInlineFragment on Character { - ... on Human { - friends { - appearsIn - } - } - - ... on Droid { - ...CharacterName - ...FriendsNames - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/CreateReviewForEpisode.graphql b/Sources/StarWarsAPI/starwars-graphql/CreateReviewForEpisode.graphql deleted file mode 100644 index 516205dfbd..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/CreateReviewForEpisode.graphql +++ /dev/null @@ -1,20 +0,0 @@ -mutation CreateReviewForEpisode($episode: Episode!, $review: ReviewInput!) { - createReview(episode: $episode, review: $review) { - stars - commentary - } -} - -mutation CreateAwesomeReview { - createReview(episode: JEDI, review: { stars: 10, commentary: "This is awesome!" }) { - stars - commentary - } -} - -mutation CreateReviewWithNullField { - createReview(episode: JEDI, review: { stars: 10, commentary: null }) { - stars - commentary - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroAndFriendsNames.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroAndFriendsNames.graphql deleted file mode 100644 index 402f76f336..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroAndFriendsNames.graphql +++ /dev/null @@ -1,39 +0,0 @@ -query HeroAndFriendsNames($episode: Episode) { - hero(episode: $episode) { - name - friends { - name - } - } -} - -query HeroAndFriendsNamesWithIDs($episode: Episode) { - hero(episode: $episode) { - id - name - friends { - id - name - } - } -} - -query HeroAndFriendsIDs($episode: Episode) { - hero(episode: $episode) { - id - name - friends { - id - } - } -} - -query HeroAndFriendsNamesWithIDForParentOnly($episode: Episode) { - hero(episode: $episode) { - id - name - friends { - name - } - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroAndFriendsNamesWithFragment.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroAndFriendsNamesWithFragment.graphql deleted file mode 100644 index bf7627c4d3..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroAndFriendsNamesWithFragment.graphql +++ /dev/null @@ -1,25 +0,0 @@ -query HeroAndFriendsNamesWithFragment($episode: Episode) { - hero(episode: $episode) { - name - ...FriendsNames - } -} - -query HeroAndFriendsNamesWithFragmentTwice($episode: Episode) { - hero(episode: $episode) { - friends { - ...CharacterName - } - ... on Droid { - friends { - ...CharacterName - } - } - } -} - -fragment FriendsNames on Character { - friends { - name - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroAppearsIn.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroAppearsIn.graphql deleted file mode 100644 index d00ee1f17a..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroAppearsIn.graphql +++ /dev/null @@ -1,15 +0,0 @@ -query HeroAppearsIn { - hero { - appearsIn - } -} - -query HeroAppearsInWithFragment($episode: Episode) { - hero(episode: $episode) { - ...CharacterAppearsIn - } -} - -fragment CharacterAppearsIn on Character { - appearsIn -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroConditional.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroConditional.graphql deleted file mode 100644 index 95773964b9..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroConditional.graphql +++ /dev/null @@ -1,73 +0,0 @@ -query HeroNameConditionalExclusion($skipName: Boolean!) { - hero { - name @skip(if: $skipName) - } -} - -query HeroNameConditionalInclusion($includeName: Boolean!) { - hero { - name @include(if: $includeName) - } -} - -query HeroNameConditionalBoth($skipName: Boolean!, $includeName: Boolean!) { - hero { - name @skip(if: $skipName) @include(if: $includeName) - } -} - -query HeroNameConditionalBothSeparate($skipName: Boolean!, $includeName: Boolean!) { - hero { - name @skip(if: $skipName) - name @include(if: $includeName) - } -} - -query HeroDetailsInlineConditionalInclusion($includeDetails: Boolean!) { - hero { - ... @include(if: $includeDetails) { - name - appearsIn - } - } -} - -query HeroDetailsFragmentConditionalInclusion($includeDetails: Boolean!) { - hero { - ...HeroDetails @include(if: $includeDetails) - } -} - -query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { - hero(episode: $episode) { - name @include(if: $includeName) - ... on Droid { - name - } - } -} - -query HeroFriendsDetailsConditionalInclusion($includeFriendsDetails: Boolean!) { - hero { - friends @include(if: $includeFriendsDetails) { - name - ... on Droid { - primaryFunction - } - } - } -} - -query HeroFriendsDetailsUnconditionalAndConditionalInclusion($includeFriendsDetails: Boolean!) { - hero { - friends { - name - } - friends @include(if: $includeFriendsDetails) { - name - ... on Droid { - primaryFunction - } - } - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroDetails.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroDetails.graphql deleted file mode 100644 index 2e19bd11eb..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroDetails.graphql +++ /dev/null @@ -1,38 +0,0 @@ -query HeroDetails($episode: Episode) { - hero(episode: $episode) { - name - ... on Human { - height - } - ... on Droid { - primaryFunction - } - } -} - -query HeroDetailsWithFragment($episode: Episode) { - hero(episode: $episode) { - ...HeroDetails - } -} - -query DroidDetailsWithFragment($episode: Episode) { - hero(episode: $episode) { - ...DroidDetails - } -} - -fragment HeroDetails on Character { - name - ... on Human { - height - } - ... on Droid { - primaryFunction - } -} - -fragment DroidDetails on Droid { - name - primaryFunction -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroFriendsOfFriends.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroFriendsOfFriends.graphql deleted file mode 100644 index 7959e66743..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroFriendsOfFriends.graphql +++ /dev/null @@ -1,10 +0,0 @@ -query HeroFriendsOfFriendsNames($episode: Episode) { - hero(episode: $episode) { - friends { - id - friends { - name - } - } - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroName.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroName.graphql deleted file mode 100644 index 5f583be0bf..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroName.graphql +++ /dev/null @@ -1,29 +0,0 @@ -query HeroName($episode: Episode) { - hero(episode: $episode) { - name - } -} - -query HeroNameWithID($episode: Episode) { - hero(episode: $episode) { - id - name - } -} - -query HeroNameWithFragment($episode: Episode) { - hero(episode: $episode) { - ...CharacterName - } -} - -query HeroNameWithFragmentAndID($episode: Episode) { - hero(episode: $episode) { - id - ...CharacterName - } -} - -fragment CharacterName on Character { - name -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroNameAndAppearsIn.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroNameAndAppearsIn.graphql deleted file mode 100644 index dd8a0af573..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroNameAndAppearsIn.graphql +++ /dev/null @@ -1,17 +0,0 @@ -query HeroNameAndAppearsIn($episode: Episode) { - hero(episode: $episode) { - name - appearsIn - } -} - -query HeroNameAndAppearsInWithFragment($episode: Episode) { - hero(episode: $episode) { - ...CharacterNameAndAppearsIn - } -} - -fragment CharacterNameAndAppearsIn on Character { - name - appearsIn -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroParentTypeDependentField.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroParentTypeDependentField.graphql deleted file mode 100644 index b3f31bebcd..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroParentTypeDependentField.graphql +++ /dev/null @@ -1,21 +0,0 @@ -query HeroParentTypeDependentField($episode: Episode) { - hero(episode: $episode) { - name - ... on Human { - friends { - name - ... on Human { - height(unit: FOOT) - } - } - } - ... on Droid { - friends { - name - ... on Human { - height(unit: METER) - } - } - } - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/HeroTypeDependentAliasedField.graphql b/Sources/StarWarsAPI/starwars-graphql/HeroTypeDependentAliasedField.graphql deleted file mode 100644 index 1ab5a0656d..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/HeroTypeDependentAliasedField.graphql +++ /dev/null @@ -1,10 +0,0 @@ -query HeroTypeDependentAliasedField($episode: Episode) { - hero(episode: $episode) { - ... on Human { - property: homePlanet - } - ... on Droid { - property: primaryFunction - } - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/SameHeroTwice.graphql b/Sources/StarWarsAPI/starwars-graphql/SameHeroTwice.graphql deleted file mode 100644 index 2480a0e42c..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/SameHeroTwice.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query SameHeroTwice { - hero { - name - } - r2: hero { - appearsIn - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/Search.graphql b/Sources/StarWarsAPI/starwars-graphql/Search.graphql deleted file mode 100644 index d81e3230d0..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/Search.graphql +++ /dev/null @@ -1,16 +0,0 @@ -query Search($term: String) { - search(text: $term) { - ... on Human { - id - name - } - ... on Droid { - id - name - } - ... on Starship { - id - name - } - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/Starship.graphql b/Sources/StarWarsAPI/starwars-graphql/Starship.graphql deleted file mode 100644 index 1bfef3a16b..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/Starship.graphql +++ /dev/null @@ -1,14 +0,0 @@ -query Starship { - starship(id: 3000) { - name - coordinates - } -} - -query StarshipCoordinates($coordinates: [[Float!]!]) { - starshipCoordinates(coordinates: $coordinates) { - name - coordinates - length - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/SubscribeReview.graphql b/Sources/StarWarsAPI/starwars-graphql/SubscribeReview.graphql deleted file mode 100644 index c3e00ba58f..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/SubscribeReview.graphql +++ /dev/null @@ -1,7 +0,0 @@ -subscription ReviewAdded($episode: Episode) { - reviewAdded(episode: $episode) { - episode - stars - commentary - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/TestFolder/TestFolder2/Human.graphql b/Sources/StarWarsAPI/starwars-graphql/TestFolder/TestFolder2/Human.graphql deleted file mode 100644 index f1fdda9f3f..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/TestFolder/TestFolder2/Human.graphql +++ /dev/null @@ -1,6 +0,0 @@ -query Human($id: ID!) { - human(id: $id) { - name - mass - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/TwoHeroes.graphql b/Sources/StarWarsAPI/starwars-graphql/TwoHeroes.graphql deleted file mode 100644 index 74df4933bf..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/TwoHeroes.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query TwoHeroes { - r2: hero { - name - } - luke: hero(episode: EMPIRE) { - name - } -} diff --git a/Sources/StarWarsAPI/starwars-graphql/operationIDs.json b/Sources/StarWarsAPI/starwars-graphql/operationIDs.json deleted file mode 100644 index 4e6a16c122..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/operationIDs.json +++ /dev/null @@ -1,240 +0,0 @@ -{ - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "1e36c3331171b74c012b86caa04fbb01062f37c61227655d9c0729a62c6f7285", - "body": "query HeroAndFriendsNames($episode: Episode) { hero(episode: $episode) { __typename name friends { __typename name } } }", - "name": "HeroAndFriendsNames", - "type": "query" - }, - { - "id": "cdf121c8a2f2188bd1c4dcc04df6104e989164b27f1e7f13d27ccc9c03fbda0c", - "body": "query HeroAndFriendsNamesWithIDs($episode: Episode) { hero(episode: $episode) { __typename id name friends { __typename id name } } }", - "name": "HeroAndFriendsNamesWithIDs", - "type": "query" - }, - { - "id": "8f1f880891cdfbf7be7ea11bb4b09708bcbf1e3f8e8a40ecb6fcb33c6078955f", - "body": "query HeroAndFriendsIDs($episode: Episode) { hero(episode: $episode) { __typename id name friends { __typename id } } }", - "name": "HeroAndFriendsIDs", - "type": "query" - }, - { - "id": "de03aaedeb69050ef75e3aa56b262b4ea1e08bb6fd174f2e91ddd9b84a8ff897", - "body": "query HeroAndFriendsNamesWithIDForParentOnly($episode: Episode) { hero(episode: $episode) { __typename id name friends { __typename name } } }", - "name": "HeroAndFriendsNamesWithIDForParentOnly", - "type": "query" - }, - { - "id": "513b65fa459185f88540be8d60cdeefb69fd6c82a21b804214337558aa6ecb0b", - "body": "query HeroFriendsOfFriendsNames($episode: Episode) { hero(episode: $episode) { __typename friends { __typename id friends { __typename name } } } }", - "name": "HeroFriendsOfFriendsNames", - "type": "query" - }, - { - "id": "07c54599c2b5f9d4215d1bff7f5f6ff458c983aa5c13338fd44b051210d5ecc6", - "body": "query HeroAndFriendsNamesWithFragment($episode: Episode) { hero(episode: $episode) { __typename name ...FriendsNames } }\nfragment FriendsNames on Character { __typename friends { __typename name } }", - "name": "HeroAndFriendsNamesWithFragment", - "type": "query" - }, - { - "id": "9a769ab058900912bff4e4c51c1b257f609e4dfb4aaa1f17166adc19d510e363", - "body": "query HeroAndFriendsNamesWithFragmentTwice($episode: Episode) { hero(episode: $episode) { __typename friends { __typename ...CharacterName } ... on Droid { __typename friends { __typename ...CharacterName } } } }\nfragment CharacterName on Character { __typename name }", - "name": "HeroAndFriendsNamesWithFragmentTwice", - "type": "query" - }, - { - "id": "ecdf5248575524004a9d43832abc54e8c0e1d2b3c0afb8bb0c1c1c514b4f9baf", - "body": "query HeroNameAndAppearsIn($episode: Episode) { hero(episode: $episode) { __typename name appearsIn } }", - "name": "HeroNameAndAppearsIn", - "type": "query" - }, - { - "id": "4fc9c2e7f9fbe8ef3f28936bd0b12e8f32bc8d70f3e8ec5df8a6aaf3efd4921c", - "body": "query HeroNameAndAppearsInWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...CharacterNameAndAppearsIn } }\nfragment CharacterNameAndAppearsIn on Character { __typename name appearsIn }", - "name": "HeroNameAndAppearsInWithFragment", - "type": "query" - }, - { - "id": "e42a9be2ae0f222985e3eacf8d8d513002954d5031dcf544bbb0d27b1089fc58", - "body": "query Starship { starship(id: 3000) { __typename name coordinates } }", - "name": "Starship", - "type": "query" - }, - { - "id": "c10b54b8dd9361556f3b12d71f28c859ace043525d8d19541b39eadc47d14b15", - "body": "query StarshipCoordinates($coordinates: [[Float!]!]) { starshipCoordinates(coordinates: $coordinates) { __typename name coordinates length } }", - "name": "StarshipCoordinates", - "type": "query" - }, - { - "id": "59243627e0166c9b631551b56dc4d29701f2d90336d83c231172c50152e02475", - "body": "query HeroAppearsIn { hero { __typename appearsIn } }", - "name": "HeroAppearsIn", - "type": "query" - }, - { - "id": "b7e9c75d75c77765849b67116235609b3a05b9052975c617f51a315f8fbaf45a", - "body": "query HeroAppearsInWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...CharacterAppearsIn } }\nfragment CharacterAppearsIn on Character { __typename appearsIn }", - "name": "HeroAppearsInWithFragment", - "type": "query" - }, - { - "id": "bf81c1338a3953d1c17c5cad3db3c3ab18b16a6822125ab81c15eb0dd3e82193", - "body": "query HeroDetails($episode: Episode) { hero(episode: $episode) { __typename name ... on Human { __typename height } ... on Droid { __typename primaryFunction } } }", - "name": "HeroDetails", - "type": "query" - }, - { - "id": "09fe4fc0cbcde5f0ba08b1207526cae13eb2b73ca95f929d4153dd3f643b6780", - "body": "query HeroDetailsWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...HeroDetails } }\nfragment HeroDetails on Character { __typename name ... on Human { __typename height } ... on Droid { __typename primaryFunction } }", - "name": "HeroDetailsWithFragment", - "type": "query" - }, - { - "id": "6696d5064faa0c379b73574aa6d4c5b912eb17339afc8b66babae61542d233d7", - "body": "query DroidDetailsWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...DroidDetails } }\nfragment DroidDetails on Droid { __typename name primaryFunction }", - "name": "DroidDetailsWithFragment", - "type": "query" - }, - { - "id": "3d960acb3caffc4e42701ccada8535b1a5640f0cc46966b6a12830c755ff46d8", - "body": "query SameHeroTwice { hero { __typename name } r2: hero { __typename appearsIn } }", - "name": "SameHeroTwice", - "type": "query" - }, - { - "id": "79c1cf70ead0fb9d7bb0811982560f1585b0b0a4ad7507c934b43a4482bb2097", - "body": "query TwoHeroes { r2: hero { __typename name } luke: hero(episode: EMPIRE) { __typename name } }", - "name": "TwoHeroes", - "type": "query" - }, - { - "id": "b6d6f1d10cde449adbf2891d489159006188e63d4dea4edb9a23eddcbe0bd361", - "body": "query HeroNameConditionalExclusion($skipName: Boolean!) { hero { __typename name @skip(if: $skipName) } }", - "name": "HeroNameConditionalExclusion", - "type": "query" - }, - { - "id": "dd8e5df9634bb4fb6455e4aaddd2941c5abf785b7d28cda959aba65157e950c6", - "body": "query HeroNameConditionalInclusion($includeName: Boolean!) { hero { __typename name @include(if: $includeName) } }", - "name": "HeroNameConditionalInclusion", - "type": "query" - }, - { - "id": "e063fa4ab5493e9c67bfa96dfedfa8570475f6286f38c482f6e85ced4ea206af", - "body": "query HeroNameConditionalBoth($skipName: Boolean!, $includeName: Boolean!) { hero { __typename name @skip(if: $skipName) @include(if: $includeName) } }", - "name": "HeroNameConditionalBoth", - "type": "query" - }, - { - "id": "60741c6fca15865a9af75a269ed05871e681f48ac48edfac2a77d953d217d03c", - "body": "query HeroNameConditionalBothSeparate($skipName: Boolean!, $includeName: Boolean!) { hero { __typename name @skip(if: $skipName) name @include(if: $includeName) } }", - "name": "HeroNameConditionalBothSeparate", - "type": "query" - }, - { - "id": "e251576f8c1cfcd442f44d2fbe5fd4b425a36ddd41fb4b6c1019c501ac6ac5bc", - "body": "query HeroDetailsInlineConditionalInclusion($includeDetails: Boolean!) { hero { __typename ... @include(if: $includeDetails) { __typename name appearsIn } } }", - "name": "HeroDetailsInlineConditionalInclusion", - "type": "query" - }, - { - "id": "17dfb13c5d9e6c67703fc037b9114ea53ccc8f9274dfecb4abfc2d5a168cf612", - "body": "query HeroDetailsFragmentConditionalInclusion($includeDetails: Boolean!) { hero { __typename ...HeroDetails @include(if: $includeDetails) } }\nfragment HeroDetails on Character { __typename name ... on Human { __typename height } ... on Droid { __typename primaryFunction } }", - "name": "HeroDetailsFragmentConditionalInclusion", - "type": "query" - }, - { - "id": "c05a6e91e1a3ddc3df21205ed7fca49cf6f3f171e4390ac98e7690c391b18baf", - "body": "query HeroNameTypeSpecificConditionalInclusion($episode: Episode, $includeName: Boolean!) { hero(episode: $episode) { __typename name @include(if: $includeName) ... on Droid { __typename name } } }", - "name": "HeroNameTypeSpecificConditionalInclusion", - "type": "query" - }, - { - "id": "ca1b86ff4a0f8212bdac70fbb59c9bb8023d0a30ca0225b24831bb3e807b22a0", - "body": "query HeroFriendsDetailsConditionalInclusion($includeFriendsDetails: Boolean!) { hero { __typename friends @include(if: $includeFriendsDetails) { __typename name ... on Droid { __typename primaryFunction } } } }", - "name": "HeroFriendsDetailsConditionalInclusion", - "type": "query" - }, - { - "id": "e36c8e5d752afda2a90fe44bcbfeb92de68f0da92b8390d626d3005cbad16dbe", - "body": "query HeroFriendsDetailsUnconditionalAndConditionalInclusion($includeFriendsDetails: Boolean!) { hero { __typename friends { __typename name } friends @include(if: $includeFriendsDetails) { __typename name ... on Droid { __typename primaryFunction } } } }", - "name": "HeroFriendsDetailsUnconditionalAndConditionalInclusion", - "type": "query" - }, - { - "id": "29ecc9c7acac3eab2585d305aed9f8257b448bc7ea57341a135d1fa476973ecb", - "body": "query Search($term: String) { search(text: $term) { __typename ... on Human { __typename id name } ... on Droid { __typename id name } ... on Starship { __typename id name } } }", - "name": "Search", - "type": "query" - }, - { - "id": "b9d49e889d6f5877c0bf09b8b4f88a71f88836a771e0e48c270a9aa8b506dda1", - "body": "query HeroName($episode: Episode) { hero(episode: $episode) { __typename name } }", - "name": "HeroName", - "type": "query" - }, - { - "id": "675d636002a28e24e3802d5f04772943b0a78b8795203fcab53f4c8466e1e53c", - "body": "query HeroNameWithID($episode: Episode) { hero(episode: $episode) { __typename id name } }", - "name": "HeroNameWithID", - "type": "query" - }, - { - "id": "68baad3c27796cb1bf980681324e43b948aa1109698ba57404c1afa46e914ab1", - "body": "query HeroNameWithFragment($episode: Episode) { hero(episode: $episode) { __typename ...CharacterName } }\nfragment CharacterName on Character { __typename name }", - "name": "HeroNameWithFragment", - "type": "query" - }, - { - "id": "ec14e5fffc56163c516a21f0d211a7a86d68a3512e6fb6df38a19babe0d1df8d", - "body": "query HeroNameWithFragmentAndID($episode: Episode) { hero(episode: $episode) { __typename id ...CharacterName } }\nfragment CharacterName on Character { __typename name }", - "name": "HeroNameWithFragmentAndID", - "type": "query" - }, - { - "id": "5b1ed6a84e96a4e48a3cad675ebb46020bce176f47361d097d8a0a824b7b8452", - "body": "query HeroTypeDependentAliasedField($episode: Episode) { hero(episode: $episode) { __typename ... on Human { __typename property: homePlanet } ... on Droid { __typename property: primaryFunction } } }", - "name": "HeroTypeDependentAliasedField", - "type": "query" - }, - { - "id": "2a05903b49a3b665eeb8f7a24240623aff77f1555e006f11bca604540c7cdba8", - "body": "subscription ReviewAdded($episode: Episode) { reviewAdded(episode: $episode) { __typename episode stars commentary } }", - "name": "ReviewAdded", - "type": "subscription" - }, - { - "id": "dc3b582f2baa66cfb5cd53eb3c215933427fd0537076767c8e0ef894d3990d15", - "body": "query HeroParentTypeDependentField($episode: Episode) { hero(episode: $episode) { __typename name ... on Human { __typename friends { __typename name ... on Human { __typename height(unit: FOOT) } } } ... on Droid { __typename friends { __typename name ... on Human { __typename height(unit: METER) } } } } }", - "name": "HeroParentTypeDependentField", - "type": "query" - }, - { - "id": "3edcd1f17839f43db021eccbe2ecd41ad7dcb1ba6cd4b7e9897afb4162e4c223", - "body": "mutation CreateReviewForEpisode($episode: Episode!, $review: ReviewInput!) { createReview(episode: $episode, review: $review) { __typename stars commentary } }", - "name": "CreateReviewForEpisode", - "type": "mutation" - }, - { - "id": "36634ea692d455075551673f2f529e85c8acf6f5e3707243781324cd3d968d02", - "body": "mutation CreateAwesomeReview { createReview(episode: JEDI, review: {stars: 10, commentary: "This is awesome!"}) { __typename stars commentary } }", - "name": "CreateAwesomeReview", - "type": "mutation" - }, - { - "id": "e962313bc77c193dc516d097b5e41efea073de16c3a5f2e8c00f082853835d49", - "body": "mutation CreateReviewWithNullField { createReview(episode: JEDI, review: {stars: 10, commentary: null}) { __typename stars commentary } }", - "name": "CreateReviewWithNullField", - "type": "mutation" - }, - { - "id": "22b975c180932a926f48bfec1e002b9d1389e0ee1d84b3cdfa337d80fb036a26", - "body": "query Human($id: ID!) { human(id: $id) { __typename name mass } }", - "name": "Human", - "type": "query" - } - ] -} \ No newline at end of file diff --git a/Sources/StarWarsAPI/starwars-graphql/schema.graphqls b/Sources/StarWarsAPI/starwars-graphql/schema.graphqls deleted file mode 100644 index e67a0be185..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/schema.graphqls +++ /dev/null @@ -1,196 +0,0 @@ -""" -A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations. -""" -directive @apollo_client_ios_localCacheMutation on QUERY | MUTATION | SUBSCRIPTION | FRAGMENT_DEFINITION - -""" -The query type, represents all of the entry points into our object graph -""" -type Query { - hero(episode: Episode): Character - reviews(episode: Episode!): [Review] - search(text: String): [SearchResult] - character(id: ID!): Character - droid(id: ID!): Droid - human(id: ID!): Human - starship(id: ID!): Starship - starshipCoordinates(coordinates: [[Float!]!]): Starship -} - -"""The mutation type, represents all updates we can make to our data""" -type Mutation { - createReview(episode: Episode, review: ReviewInput!): Review -} - -""" -The subscription type, represents all subscriptions we can make to our data -""" -type Subscription { - reviewAdded(episode: Episode): Review -} - -"""The episodes in the Star Wars trilogy""" -enum Episode { - """Star Wars Episode IV: A New Hope, released in 1977.""" - NEWHOPE - - """Star Wars Episode V: The Empire Strikes Back, released in 1980.""" - EMPIRE - - """Star Wars Episode VI: Return of the Jedi, released in 1983.""" - JEDI -} - -"""A character from the Star Wars universe""" -interface Character { - """The ID of the character""" - id: ID! - - """The name of the character""" - name: String! - - """The friends of the character, or an empty list if they have none""" - friends: [Character] - - """The friends of the character exposed as a connection with edges""" - friendsConnection(first: Int, after: ID): FriendsConnection! - - """The movies this character appears in""" - appearsIn: [Episode]! -} - -"""Units of height""" -enum LengthUnit { - """The standard unit around the world""" - METER - - """Primarily used in the United States""" - FOOT -} - -"""A humanoid creature from the Star Wars universe""" -type Human implements Character { - """The ID of the human""" - id: ID! - - """What this human calls themselves""" - name: String! - - """The home planet of the human, or null if unknown""" - homePlanet: String - - """Height in the preferred unit, default is meters""" - height(unit: LengthUnit = METER): Float - - """Mass in kilograms, or null if unknown""" - mass: Float - - """This human's friends, or an empty list if they have none""" - friends: [Character] - - """The friends of the human exposed as a connection with edges""" - friendsConnection(first: Int, after: ID): FriendsConnection! - - """The movies this human appears in""" - appearsIn: [Episode]! - - """A list of starships this person has piloted, or an empty list if none""" - starships: [Starship] -} - -"""An autonomous mechanical character in the Star Wars universe""" -type Droid implements Character { - """The ID of the droid""" - id: ID! - - """What others call this droid""" - name: String! - - """This droid's friends, or an empty list if they have none""" - friends: [Character] - - """The friends of the droid exposed as a connection with edges""" - friendsConnection(first: Int, after: ID): FriendsConnection! - - """The movies this droid appears in""" - appearsIn: [Episode]! - - """This droid's primary function""" - primaryFunction: String -} - -"""A connection object for a character's friends""" -type FriendsConnection { - """The total number of friends""" - totalCount: Int - - """The edges for each of the character's friends.""" - edges: [FriendsEdge] - - """A list of the friends, as a convenience when edges are not needed.""" - friends: [Character] - - """Information for paginating this connection""" - pageInfo: PageInfo! -} - -"""An edge object for a character's friends""" -type FriendsEdge { - """A cursor used for pagination""" - cursor: ID! - - """The character represented by this friendship edge""" - node: Character -} - -"""Information for paginating this connection""" -type PageInfo { - startCursor: ID - endCursor: ID - hasNextPage: Boolean! -} - -"""Represents a review for a movie""" -type Review { - """The movie""" - episode: Episode - - """The number of stars this review gave, 1-5""" - stars: Int! - - """Comment about the movie""" - commentary: String -} - -"""The input object sent when someone is creating a new review""" -input ReviewInput { - """0-5 stars""" - stars: Int! - - """Comment about the movie, optional""" - commentary: String - - """Favorite color, optional""" - favorite_color: ColorInput -} - -"""The input object sent when passing in a color""" -input ColorInput { - red: Int! - green: Int! - blue: Int! -} - -type Starship { - """The ID of the starship""" - id: ID! - - """The name of the starship""" - name: String! - - """Length of the starship, along the longest axis""" - length(unit: LengthUnit = METER): Float - coordinates: [[Float!]!] -} - -union SearchResult = Human | Droid | Starship \ No newline at end of file diff --git a/Sources/StarWarsAPI/starwars-graphql/schema.json b/Sources/StarWarsAPI/starwars-graphql/schema.json deleted file mode 100644 index b9a35aa09d..0000000000 --- a/Sources/StarWarsAPI/starwars-graphql/schema.json +++ /dev/null @@ -1,2226 +0,0 @@ -{ - "data": { - "__schema": { - "queryType": { - "name": "Query" - }, - "mutationType": { - "name": "Mutation" - }, - "subscriptionType": { - "name": "Subscription" - }, - "types": [ - { - "kind": "OBJECT", - "name": "Query", - "description": "The query type, represents all of the entry points into our object graph", - "fields": [ - { - "name": "hero", - "description": "", - "args": [ - { - "name": "episode", - "description": "", - "type": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviews", - "description": "", - "args": [ - { - "name": "episode", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Review", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "search", - "description": "", - "args": [ - { - "name": "text", - "description": "", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "UNION", - "name": "SearchResult", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "character", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "droid", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Droid", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "human", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Human", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starship", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Starship", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starshipCoordinates", - "description": "", - "args": [ - { - "name": "coordinates", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Float", - "ofType": null - } - } - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Starship", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "Episode", - "description": "The episodes in the Star Wars trilogy", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "NEWHOPE", - "description": "Star Wars Episode IV: A New Hope, released in 1977.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "EMPIRE", - "description": "Star Wars Episode V: The Empire Strikes Back, released in 1980.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "JEDI", - "description": "Star Wars Episode VI: Return of the Jedi, released in 1983.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Character", - "description": "A character from the Star Wars universe", - "fields": [ - { - "name": "id", - "description": "The ID of the character", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the character", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friends", - "description": "The friends of the character, or an empty list if they have none", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friendsConnection", - "description": "The friends of the character exposed as a connection with edges", - "args": [ - { - "name": "first", - "description": "", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "FriendsConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "appearsIn", - "description": "The movies this character appears in", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Human", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Droid", - "ofType": null - } - ] - }, - { - "kind": "SCALAR", - "name": "ID", - "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "String", - "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Int", - "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FriendsConnection", - "description": "A connection object for a character's friends", - "fields": [ - { - "name": "totalCount", - "description": "The total number of friends", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "edges", - "description": "The edges for each of the character's friends.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "FriendsEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friends", - "description": "A list of the friends, as a convenience when edges are not needed.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information for paginating this connection", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FriendsEdge", - "description": "An edge object for a character's friends", - "fields": [ - { - "name": "cursor", - "description": "A cursor used for pagination", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The character represented by this friendship edge", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PageInfo", - "description": "Information for paginating this connection", - "fields": [ - { - "name": "startCursor", - "description": "", - "args": [], - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "endCursor", - "description": "", - "args": [], - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasNextPage", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Boolean", - "description": "The `Boolean` scalar type represents `true` or `false`.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Review", - "description": "Represents a review for a movie", - "fields": [ - { - "name": "episode", - "description": "The movie", - "args": [], - "type": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "stars", - "description": "The number of stars this review gave, 1-5", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commentary", - "description": "Comment about the movie", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "SearchResult", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Human", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Droid", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Starship", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "Human", - "description": "A humanoid creature from the Star Wars universe", - "fields": [ - { - "name": "id", - "description": "The ID of the human", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "What this human calls themselves", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "homePlanet", - "description": "The home planet of the human, or null if unknown", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "height", - "description": "Height in the preferred unit, default is meters", - "args": [ - { - "name": "unit", - "description": "", - "type": { - "kind": "ENUM", - "name": "LengthUnit", - "ofType": null - }, - "defaultValue": "METER" - } - ], - "type": { - "kind": "SCALAR", - "name": "Float", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mass", - "description": "Mass in kilograms, or null if unknown", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Float", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friends", - "description": "This human's friends, or an empty list if they have none", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friendsConnection", - "description": "The friends of the human exposed as a connection with edges", - "args": [ - { - "name": "first", - "description": "", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "FriendsConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "appearsIn", - "description": "The movies this human appears in", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starships", - "description": "A list of starships this person has piloted, or an empty list if none", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Starship", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "LengthUnit", - "description": "Units of height", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "METER", - "description": "The standard unit around the world", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FOOT", - "description": "Primarily used in the United States", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Float", - "description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Starship", - "description": "", - "fields": [ - { - "name": "id", - "description": "The ID of the starship", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the starship", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "length", - "description": "Length of the starship, along the longest axis", - "args": [ - { - "name": "unit", - "description": "", - "type": { - "kind": "ENUM", - "name": "LengthUnit", - "ofType": null - }, - "defaultValue": "METER" - } - ], - "type": { - "kind": "SCALAR", - "name": "Float", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "coordinates", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Float", - "ofType": null - } - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Droid", - "description": "An autonomous mechanical character in the Star Wars universe", - "fields": [ - { - "name": "id", - "description": "The ID of the droid", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "What others call this droid", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friends", - "description": "This droid's friends, or an empty list if they have none", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "friendsConnection", - "description": "The friends of the droid exposed as a connection with edges", - "args": [ - { - "name": "first", - "description": "", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "FriendsConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "appearsIn", - "description": "The movies this droid appears in", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "primaryFunction", - "description": "This droid's primary function", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Character", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Mutation", - "description": "The mutation type, represents all updates we can make to our data", - "fields": [ - { - "name": "createReview", - "description": "", - "args": [ - { - "name": "episode", - "description": "", - "type": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "review", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "ReviewInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Review", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ReviewInput", - "description": "The input object sent when someone is creating a new review", - "fields": null, - "inputFields": [ - { - "name": "stars", - "description": "0-5 stars", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "commentary", - "description": "Comment about the movie, optional", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "favorite_color", - "description": "Favorite color, optional", - "type": { - "kind": "INPUT_OBJECT", - "name": "ColorInput", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ColorInput", - "description": "The input object sent when passing in a color", - "fields": null, - "inputFields": [ - { - "name": "red", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "green", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "blue", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Subscription", - "description": "The subscription type, represents all subscriptions we can make to our data", - "fields": [ - { - "name": "reviewAdded", - "description": "", - "args": [ - { - "name": "episode", - "description": "", - "type": { - "kind": "ENUM", - "name": "Episode", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Review", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Schema", - "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", - "fields": [ - { - "name": "types", - "description": "A list of all types supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "queryType", - "description": "The type that query operations will be rooted at.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mutationType", - "description": "If this server supports mutation, the type that mutation operations will be rooted at.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscriptionType", - "description": "If this server support subscription, the type that subscription operations will be rooted at.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "directives", - "description": "A list of all directives supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Directive", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Type", - "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", - "fields": [ - { - "name": "kind", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "__TypeKind", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fields", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Field", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "interfaces", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "possibleTypes", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "enumValues", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__EnumValue", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inputFields", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ofType", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__TypeKind", - "description": "An enum describing what kind of type a given `__Type` is.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "SCALAR", - "description": "Indicates this type is a scalar.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Indicates this type is a union. `possibleTypes` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Indicates this type is an enum. `enumValues` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Indicates this type is an input object. `inputFields` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LIST", - "description": "Indicates this type is a list. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NON_NULL", - "description": "Indicates this type is a non-null. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Field", - "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__InputValue", - "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "defaultValue", - "description": "A GraphQL-formatted string representing the default value for this input value.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__EnumValue", - "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Directive", - "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "locations", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "__DirectiveLocation", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "onOperation", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - }, - { - "name": "onFragment", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - }, - { - "name": "onField", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__DirectiveLocation", - "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "QUERY", - "description": "Location adjacent to a query operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MUTATION", - "description": "Location adjacent to a mutation operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUBSCRIPTION", - "description": "Location adjacent to a subscription operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD", - "description": "Location adjacent to a field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_DEFINITION", - "description": "Location adjacent to a fragment definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_SPREAD", - "description": "Location adjacent to a fragment spread.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INLINE_FRAGMENT", - "description": "Location adjacent to an inline fragment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCHEMA", - "description": "Location adjacent to a schema definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCALAR", - "description": "Location adjacent to a scalar definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Location adjacent to an object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD_DEFINITION", - "description": "Location adjacent to a field definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ARGUMENT_DEFINITION", - "description": "Location adjacent to an argument definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Location adjacent to an interface definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Location adjacent to a union definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Location adjacent to an enum definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM_VALUE", - "description": "Location adjacent to an enum value definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Location adjacent to an input object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_FIELD_DEFINITION", - "description": "Location adjacent to an input object field definition.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - } - ], - "directives": [ - { - "name": "skip", - "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], - "args": [ - { - "name": "if", - "description": "Skipped when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null - } - ] - }, - { - "name": "include", - "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], - "args": [ - { - "name": "if", - "description": "Included when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null - } - ] - }, - { - "name": "deprecated", - "description": "Marks an element of a GraphQL schema as no longer supported.", - "locations": [ - "FIELD_DEFINITION", - "ENUM_VALUE" - ], - "args": [ - { - "name": "reason", - "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": "\"No longer supported\"" - } - ] - } - ] - } - } -} diff --git a/Sources/SubscriptionAPI/Info.plist b/Sources/SubscriptionAPI/Info.plist deleted file mode 100644 index 09738dfd75..0000000000 --- a/Sources/SubscriptionAPI/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Sources/SubscriptionAPI/SubscriptionAPI/Package.swift b/Sources/SubscriptionAPI/SubscriptionAPI/Package.swift deleted file mode 100644 index e9722b5f28..0000000000 --- a/Sources/SubscriptionAPI/SubscriptionAPI/Package.swift +++ /dev/null @@ -1,28 +0,0 @@ -// swift-tools-version:5.7 - -import PackageDescription - -let package = Package( - name: "SubscriptionAPI", - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - products: [ - .library(name: "SubscriptionAPI", targets: ["SubscriptionAPI"]), - ], - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - targets: [ - .target( - name: "SubscriptionAPI", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] -) diff --git a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Operations/Subscriptions/IncrementingSubscription.graphql.swift b/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Operations/Subscriptions/IncrementingSubscription.graphql.swift deleted file mode 100644 index 1a899ede64..0000000000 --- a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Operations/Subscriptions/IncrementingSubscription.graphql.swift +++ /dev/null @@ -1,26 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class IncrementingSubscription: GraphQLSubscription { - public static let operationName: String = "Incrementing" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"subscription Incrementing { numberIncremented }"# - )) - - public init() {} - - public struct Data: SubscriptionAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { SubscriptionAPI.Objects.Subscription } - public static var __selections: [ApolloAPI.Selection] { [ - .field("numberIncremented", Int?.self), - ] } - - public var numberIncremented: Int? { __data["numberIncremented"] } - } -} diff --git a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/Objects/Subscription.graphql.swift b/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/Objects/Subscription.graphql.swift deleted file mode 100644 index 4d9330bc9d..0000000000 --- a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/Objects/Subscription.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Subscription = Object( - typename: "Subscription", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/SchemaConfiguration.swift b/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/SchemaConfiguration.swift deleted file mode 100644 index 7976ecf827..0000000000 --- a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/SchemaConfiguration.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// provide custom configuration for a generated GraphQL schema. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } -} diff --git a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/SchemaMetadata.graphql.swift b/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/SchemaMetadata.graphql.swift deleted file mode 100644 index 28380a85fb..0000000000 --- a/Sources/SubscriptionAPI/SubscriptionAPI/Sources/Schema/SchemaMetadata.graphql.swift +++ /dev/null @@ -1,33 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public typealias ID = String - -public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet -where Schema == SubscriptionAPI.SchemaMetadata {} - -public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment -where Schema == SubscriptionAPI.SchemaMetadata {} - -public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet -where Schema == SubscriptionAPI.SchemaMetadata {} - -public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment -where Schema == SubscriptionAPI.SchemaMetadata {} - -public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - - public static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "Subscription": return SubscriptionAPI.Objects.Subscription - default: return nil - } - } -} - -public enum Objects {} -public enum Interfaces {} -public enum Unions {} diff --git a/Sources/SubscriptionAPI/graphql/schema.graphqls b/Sources/SubscriptionAPI/graphql/schema.graphqls deleted file mode 100644 index 999724fc7c..0000000000 --- a/Sources/SubscriptionAPI/graphql/schema.graphqls +++ /dev/null @@ -1,12 +0,0 @@ -""" -A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations. -""" -directive @apollo_client_ios_localCacheMutation on QUERY | MUTATION | SUBSCRIPTION | FRAGMENT_DEFINITION - -type Query { - currentNumber: Int -} - -type Subscription { - numberIncremented: Int -} \ No newline at end of file diff --git a/Sources/SubscriptionAPI/graphql/subscription.graphql b/Sources/SubscriptionAPI/graphql/subscription.graphql deleted file mode 100644 index 55b482bc83..0000000000 --- a/Sources/SubscriptionAPI/graphql/subscription.graphql +++ /dev/null @@ -1,4 +0,0 @@ -subscription Incrementing { - numberIncremented -} - diff --git a/Sources/UploadAPI/Info.plist b/Sources/UploadAPI/Info.plist deleted file mode 100644 index 9bcb244429..0000000000 --- a/Sources/UploadAPI/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - - diff --git a/Sources/UploadAPI/UploadAPI/Package.swift b/Sources/UploadAPI/UploadAPI/Package.swift deleted file mode 100644 index 39ef6e3373..0000000000 --- a/Sources/UploadAPI/UploadAPI/Package.swift +++ /dev/null @@ -1,28 +0,0 @@ -// swift-tools-version:5.7 - -import PackageDescription - -let package = Package( - name: "UploadAPI", - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - products: [ - .library(name: "UploadAPI", targets: ["UploadAPI"]), - ], - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - targets: [ - .target( - name: "UploadAPI", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] -) diff --git a/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadMultipleFilesToDifferentParametersMutation.graphql.swift b/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadMultipleFilesToDifferentParametersMutation.graphql.swift deleted file mode 100644 index 9df31f640a..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadMultipleFilesToDifferentParametersMutation.graphql.swift +++ /dev/null @@ -1,65 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class UploadMultipleFilesToDifferentParametersMutation: GraphQLMutation { - public static let operationName: String = "UploadMultipleFilesToDifferentParameters" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"mutation UploadMultipleFilesToDifferentParameters($singleFile: Upload!, $multipleFiles: [Upload!]!) { multipleParameterUpload(singleFile: $singleFile, multipleFiles: $multipleFiles) { __typename id path filename mimetype } }"# - )) - - public var singleFile: Upload - public var multipleFiles: [Upload] - - public init( - singleFile: Upload, - multipleFiles: [Upload] - ) { - self.singleFile = singleFile - self.multipleFiles = multipleFiles - } - - public var __variables: Variables? { [ - "singleFile": singleFile, - "multipleFiles": multipleFiles - ] } - - public struct Data: UploadAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { UploadAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("multipleParameterUpload", [MultipleParameterUpload].self, arguments: [ - "singleFile": .variable("singleFile"), - "multipleFiles": .variable("multipleFiles") - ]), - ] } - - public var multipleParameterUpload: [MultipleParameterUpload] { __data["multipleParameterUpload"] } - - /// MultipleParameterUpload - /// - /// Parent Type: `File` - public struct MultipleParameterUpload: UploadAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { UploadAPI.Objects.File } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", UploadAPI.ID.self), - .field("path", String.self), - .field("filename", String.self), - .field("mimetype", String.self), - ] } - - public var id: UploadAPI.ID { __data["id"] } - public var path: String { __data["path"] } - public var filename: String { __data["filename"] } - public var mimetype: String { __data["mimetype"] } - } - } -} diff --git a/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadMultipleFilesToTheSameParameterMutation.graphql.swift b/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadMultipleFilesToTheSameParameterMutation.graphql.swift deleted file mode 100644 index 13f29b5019..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadMultipleFilesToTheSameParameterMutation.graphql.swift +++ /dev/null @@ -1,54 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class UploadMultipleFilesToTheSameParameterMutation: GraphQLMutation { - public static let operationName: String = "UploadMultipleFilesToTheSameParameter" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"mutation UploadMultipleFilesToTheSameParameter($files: [Upload!]!) { multipleUpload(files: $files) { __typename id path filename mimetype } }"# - )) - - public var files: [Upload] - - public init(files: [Upload]) { - self.files = files - } - - public var __variables: Variables? { ["files": files] } - - public struct Data: UploadAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { UploadAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("multipleUpload", [MultipleUpload].self, arguments: ["files": .variable("files")]), - ] } - - public var multipleUpload: [MultipleUpload] { __data["multipleUpload"] } - - /// MultipleUpload - /// - /// Parent Type: `File` - public struct MultipleUpload: UploadAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { UploadAPI.Objects.File } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", UploadAPI.ID.self), - .field("path", String.self), - .field("filename", String.self), - .field("mimetype", String.self), - ] } - - public var id: UploadAPI.ID { __data["id"] } - public var path: String { __data["path"] } - public var filename: String { __data["filename"] } - public var mimetype: String { __data["mimetype"] } - } - } -} diff --git a/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadOneFileMutation.graphql.swift b/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadOneFileMutation.graphql.swift deleted file mode 100644 index 6442fa8c2d..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Operations/Mutations/UploadOneFileMutation.graphql.swift +++ /dev/null @@ -1,54 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI - -public class UploadOneFileMutation: GraphQLMutation { - public static let operationName: String = "UploadOneFile" - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"mutation UploadOneFile($file: Upload!) { singleUpload(file: $file) { __typename id path filename mimetype } }"# - )) - - public var file: Upload - - public init(file: Upload) { - self.file = file - } - - public var __variables: Variables? { ["file": file] } - - public struct Data: UploadAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { UploadAPI.Objects.Mutation } - public static var __selections: [ApolloAPI.Selection] { [ - .field("singleUpload", SingleUpload.self, arguments: ["file": .variable("file")]), - ] } - - public var singleUpload: SingleUpload { __data["singleUpload"] } - - /// SingleUpload - /// - /// Parent Type: `File` - public struct SingleUpload: UploadAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { UploadAPI.Objects.File } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", UploadAPI.ID.self), - .field("path", String.self), - .field("filename", String.self), - .field("mimetype", String.self), - ] } - - public var id: UploadAPI.ID { __data["id"] } - public var path: String { __data["path"] } - public var filename: String { __data["filename"] } - public var mimetype: String { __data["mimetype"] } - } - } -} diff --git a/Sources/UploadAPI/UploadAPI/Sources/Schema/CustomScalars/Upload.swift b/Sources/UploadAPI/UploadAPI/Sources/Schema/CustomScalars/Upload.swift deleted file mode 100644 index c67b204d3a..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Schema/CustomScalars/Upload.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// implement advanced custom scalar functionality. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -/// The `Upload` scalar type represents a file upload. -public typealias Upload = String diff --git a/Sources/UploadAPI/UploadAPI/Sources/Schema/Objects/File.graphql.swift b/Sources/UploadAPI/UploadAPI/Sources/Schema/Objects/File.graphql.swift deleted file mode 100644 index 7b76d67617..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Schema/Objects/File.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let File = Object( - typename: "File", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/UploadAPI/UploadAPI/Sources/Schema/Objects/Mutation.graphql.swift b/Sources/UploadAPI/UploadAPI/Sources/Schema/Objects/Mutation.graphql.swift deleted file mode 100644 index 7358d341ca..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Schema/Objects/Mutation.graphql.swift +++ /dev/null @@ -1,11 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public extension Objects { - static let Mutation = Object( - typename: "Mutation", - implementedInterfaces: [] - ) -} \ No newline at end of file diff --git a/Sources/UploadAPI/UploadAPI/Sources/Schema/SchemaConfiguration.swift b/Sources/UploadAPI/UploadAPI/Sources/Schema/SchemaConfiguration.swift deleted file mode 100644 index 7976ecf827..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Schema/SchemaConfiguration.swift +++ /dev/null @@ -1,15 +0,0 @@ -// @generated -// This file was automatically generated and can be edited to -// provide custom configuration for a generated GraphQL schema. -// -// Any changes to this file will not be overwritten by future -// code generation execution. - -import ApolloAPI - -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } -} diff --git a/Sources/UploadAPI/UploadAPI/Sources/Schema/SchemaMetadata.graphql.swift b/Sources/UploadAPI/UploadAPI/Sources/Schema/SchemaMetadata.graphql.swift deleted file mode 100644 index 34cb436c47..0000000000 --- a/Sources/UploadAPI/UploadAPI/Sources/Schema/SchemaMetadata.graphql.swift +++ /dev/null @@ -1,34 +0,0 @@ -// @generated -// This file was automatically generated and should not be edited. - -import ApolloAPI - -public typealias ID = String - -public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet -where Schema == UploadAPI.SchemaMetadata {} - -public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment -where Schema == UploadAPI.SchemaMetadata {} - -public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet -where Schema == UploadAPI.SchemaMetadata {} - -public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment -where Schema == UploadAPI.SchemaMetadata {} - -public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - - public static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "Mutation": return UploadAPI.Objects.Mutation - case "File": return UploadAPI.Objects.File - default: return nil - } - } -} - -public enum Objects {} -public enum Interfaces {} -public enum Unions {} diff --git a/Sources/UploadAPI/graphql/UploadMultipleFiles.graphql b/Sources/UploadAPI/graphql/UploadMultipleFiles.graphql deleted file mode 100644 index ec9199d4ee..0000000000 --- a/Sources/UploadAPI/graphql/UploadMultipleFiles.graphql +++ /dev/null @@ -1,17 +0,0 @@ -mutation UploadMultipleFilesToTheSameParameter($files:[Upload!]!) { - multipleUpload(files:$files) { - id - path - filename - mimetype - } -} - -mutation UploadMultipleFilesToDifferentParameters($singleFile: Upload!, $multipleFiles:[Upload!]!) { - multipleParameterUpload(singleFile:$singleFile, multipleFiles:$multipleFiles) { - id - path - filename - mimetype - } -} diff --git a/Sources/UploadAPI/graphql/UploadOneFile.graphql b/Sources/UploadAPI/graphql/UploadOneFile.graphql deleted file mode 100644 index 598c39e173..0000000000 --- a/Sources/UploadAPI/graphql/UploadOneFile.graphql +++ /dev/null @@ -1,8 +0,0 @@ -mutation UploadOneFile($file: Upload!) { - singleUpload(file: $file) { - id - path - filename - mimetype - } -} diff --git a/Sources/UploadAPI/graphql/operationIDs.json b/Sources/UploadAPI/graphql/operationIDs.json deleted file mode 100644 index 7d5f88c7fc..0000000000 --- a/Sources/UploadAPI/graphql/operationIDs.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "93d5a278f1e14f434bcb6978c5da1ac4aec6a5ad8c81aa396f60edf825cf09fc", - "body": "mutation UploadMultipleFilesToTheSameParameter($files: [Upload!]!) { multipleUpload(files: $files) { __typename id path filename mimetype } }", - "name": "UploadMultipleFilesToTheSameParameter", - "type": "mutation" - }, - { - "id": "d9562c30ed2555c852d7e7e49a4f29645a93807991fe6e733059fe87404eb25c", - "body": "mutation UploadMultipleFilesToDifferentParameters($singleFile: Upload!, $multipleFiles: [Upload!]!) { multipleParameterUpload(singleFile: $singleFile, multipleFiles: $multipleFiles) { __typename id path filename mimetype } }", - "name": "UploadMultipleFilesToDifferentParameters", - "type": "mutation" - }, - { - "id": "d67bee226e4f3b990d0d860826e93cd0ee158f02564d8fccff941eb04a9e4f07", - "body": "mutation UploadOneFile($file: Upload!) { singleUpload(file: $file) { __typename id path filename mimetype } }", - "name": "UploadOneFile", - "type": "mutation" - } - ] -} \ No newline at end of file diff --git a/Sources/UploadAPI/graphql/schema.graphqls b/Sources/UploadAPI/graphql/schema.graphqls deleted file mode 100644 index 6226e65ffd..0000000000 --- a/Sources/UploadAPI/graphql/schema.graphqls +++ /dev/null @@ -1,52 +0,0 @@ -"""""" -directive @cacheControl(maxAge: Int, scope: CacheControlScope) on FIELD_DEFINITION | OBJECT | INTERFACE - -""" -A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations. -""" -directive @apollo_client_ios_localCacheMutation on QUERY | MUTATION | SUBSCRIPTION | FRAGMENT_DEFINITION - -"""""" -type Query { - """""" - uploads: [File] -} - -"""""" -type File { - """""" - id: ID! - - """""" - path: String! - - """""" - filename: String! - - """""" - mimetype: String! -} - -"""""" -type Mutation { - """""" - singleUpload(file: Upload!): File! - - """""" - multipleUpload(files: [Upload!]!): [File!]! - - """""" - multipleParameterUpload(singleFile: Upload!, multipleFiles: [Upload!]!): [File!]! -} - -"""The `Upload` scalar type represents a file upload.""" -scalar Upload - -"""""" -enum CacheControlScope { - """""" - PUBLIC - - """""" - PRIVATE -} \ No newline at end of file diff --git a/Sources/apollo-ios-cli/README.md b/Sources/apollo-ios-cli/README.md deleted file mode 100644 index de6f933c03..0000000000 --- a/Sources/apollo-ios-cli/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# Apollo iOS CLI - -``` -OVERVIEW: A command line utility for Apollo iOS code generation. - -USAGE: apollo-ios-cli - -OPTIONS: - --version Show the version. - -h, --help Show help information. - -SUBCOMMANDS: - init Initialize a new configuration with defaults. - generate Generate Swift source code based on a code generation configuration. - fetch-schema Download a GraphQL schema from the Apollo Registry or GraphQL introspection. - generate-operation-manifest - Generate Persisted Queries operation manifest based on a code generation configuration. - - See 'apollo-ios-cli help ' for detailed help. -``` - -## Initialize -``` -OVERVIEW: Initialize a new configuration with defaults. - -USAGE: apollo-ios-cli init --schema-namespace --module-type [--target-name ] [--path ] [--overwrite] [--print] - -OPTIONS: - --schema-name - DEPRECATED - Use --schema-namespace instead. - -n, --schema-namespace - Name used to scope the generated schema type files. - -m, --module-type - How to package the schema types for dependency management. Possible types: embeddedInTarget, - swiftPackageManager, other. - -t, --target-name - Name of the target in which the schema types files will be manually embedded. This is required - for the "embeddedInTarget" module type and will be ignored for all other module types. - -p, --path Write the configuration to a file at the path. (default: ./apollo-codegen-config.json) - -w, --overwrite Overwrite any file at --path. If init is called without --overwrite and a config file already - exists at --path, the command will fail. - -s, --print Print the configuration to stdout. - --version Show the version. - -h, --help Show help information. -``` - -## Generate -``` -OVERVIEW: Generate Swift source code based on a code generation configuration. - -USAGE: apollo-ios-cli generate [--path ] [--string ] [--verbose] [--fetch-schema] [--ignore-version-mismatch] - -OPTIONS: - -p, --path Read the configuration from a file at the path. --string overrides this option if used - together. (default: ./apollo-codegen-config.json) - -s, --string Configuration string in JSON format. This option overrides --path. - -v, --verbose Increase verbosity to include debug output. - -f, --fetch-schema Fetch the GraphQL schema before Swift code generation. - --ignore-version-mismatch - Ignore Apollo version mismatch errors. Warning: This may lead to incompatible generated - objects. - --version Show the version. - -h, --help Show help information. -``` - -## Fetch Schema -``` -OVERVIEW: Download a GraphQL schema from the Apollo Registry or GraphQL introspection. - -USAGE: apollo-ios-cli fetch-schema [--path ] [--string ] [--verbose] - -OPTIONS: - -p, --path Read the configuration from a file at the path. --string overrides this option if used - together. (default: ./apollo-codegen-config.json) - -s, --string Configuration string in JSON format. This option overrides --path. - -v, --verbose Increase verbosity to include debug output. - --version Show the version. - -h, --help Show help information. -``` -## Generate Operation Manifest -``` -OVERVIEW: Generate Persisted Queries operation manifest based on a code generation configuration. - -USAGE: apollo-ios-cli generate-operation-manifest [--path ] [--string ] [--verbose] [--ignore-version-mismatch] - -OPTIONS: - -p, --path Read the configuration from a file at the path. --string overrides this option if used together. (default: ./apollo-codegen-config.json) - -s, --string Configuration string in JSON format. This option overrides --path. - -v, --verbose Increase verbosity to include debug output. - --ignore-version-mismatch - Ignore Apollo version mismatch errors. Warning: This may lead to incompatible generated objects. - --version Show the version. - -h, --help Show help information. -``` \ No newline at end of file diff --git a/Sources/apollo-ios-cli/main.swift b/Sources/apollo-ios-cli/main.swift deleted file mode 100644 index 59f5d46631..0000000000 --- a/Sources/apollo-ios-cli/main.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import ArgumentParser -import CodegenCLI - -struct Apollo_iOS_CLI: ParsableCommand { - static var configuration = CommandConfiguration( - commandName: "apollo-ios-cli", - abstract: "A command line utility for Apollo iOS code generation.", - version: CodegenCLI.Constants.CLIVersion, - subcommands: [ - CodegenCLI.Initialize.self, - CodegenCLI.Generate.self, - CodegenCLI.FetchSchema.self, - CodegenCLI.GenerateOperationManifest.self - ] - ) -} - -Apollo_iOS_CLI.main() diff --git a/SwiftScripts/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/SwiftScripts/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a625..0000000000 --- a/SwiftScripts/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/Codegen.xcscheme b/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/Codegen.xcscheme deleted file mode 100644 index f96d3b9aa0..0000000000 --- a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/Codegen.xcscheme +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/DocumentationGenerator.xcscheme b/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/DocumentationGenerator.xcscheme deleted file mode 100644 index 5c9d411164..0000000000 --- a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/DocumentationGenerator.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/SchemaDownload.xcscheme b/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/SchemaDownload.xcscheme deleted file mode 100644 index 5bdc8266c6..0000000000 --- a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/SchemaDownload.xcscheme +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/SwiftScripts-Package.xcscheme b/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/SwiftScripts-Package.xcscheme deleted file mode 100644 index 9655b4d77d..0000000000 --- a/SwiftScripts/.swiftpm/xcode/xcshareddata/xcschemes/SwiftScripts-Package.xcscheme +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftScripts/Package.resolved b/SwiftScripts/Package.resolved deleted file mode 100644 index 087baddcf2..0000000000 --- a/SwiftScripts/Package.resolved +++ /dev/null @@ -1,61 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "InflectorKit", - "repositoryURL": "https://github.com/mattt/InflectorKit", - "state": { - "branch": null, - "revision": "d8cbcc04972690aaa5fc760a2b9ddb3e9f0decd7", - "version": "1.0.0" - } - }, - { - "package": "SQLite.swift", - "repositoryURL": "https://github.com/stephencelis/SQLite.swift.git", - "state": { - "branch": null, - "revision": "7a2e3cd27de56f6d396e84f63beefd0267b55ccb", - "version": "0.14.1" - } - }, - { - "package": "swift-argument-parser", - "repositoryURL": "https://github.com/apple/swift-argument-parser.git", - "state": { - "branch": null, - "revision": "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a", - "version": "1.2.2" - } - }, - { - "package": "swift-collections", - "repositoryURL": "https://github.com/apple/swift-collections", - "state": { - "branch": null, - "revision": "937e904258d22af6e447a0b72c0bc67583ef64a2", - "version": "1.0.4" - } - }, - { - "package": "SwiftDocCPlugin", - "repositoryURL": "https://github.com/apple/swift-docc-plugin", - "state": { - "branch": null, - "revision": "26ac5758409154cc448d7ab82389c520fa8a8247", - "version": "1.3.0" - } - }, - { - "package": "SymbolKit", - "repositoryURL": "https://github.com/apple/swift-docc-symbolkit", - "state": { - "branch": null, - "revision": "b45d1f2ed151d057b54504d653e0da5552844e34", - "version": "1.0.0" - } - } - ] - }, - "version": 1 -} diff --git a/SwiftScripts/Package.swift b/SwiftScripts/Package.swift deleted file mode 100644 index 1d30ad8e6a..0000000000 --- a/SwiftScripts/Package.swift +++ /dev/null @@ -1,46 +0,0 @@ -// swift-tools-version:5.3 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "SwiftScripts", - platforms: [ - .macOS(.v10_15) - ], - dependencies: [ - .package(name: "Apollo", path: ".."), - .package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMajor(from: "1.2.0")), - .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0") - ], - targets: [ - .target(name: "TargetConfig", - dependencies: [ - .product(name: "ApolloCodegenLib", package: "Apollo"), - ]), - .target(name: "Codegen", - dependencies: [ - .product(name: "ApolloCodegenLib", package: "Apollo"), - .product(name: "ArgumentParser", package: "swift-argument-parser"), - .target(name: "TargetConfig"), - ]), - .target(name: "SchemaDownload", - dependencies: [ - .product(name: "ApolloCodegenLib", package: "Apollo"), - .target(name: "TargetConfig"), - ]), - .target(name: "DocumentationGenerator", - dependencies: [ - .product(name: "ApolloCodegenLib", package: "Apollo"), - .product(name: "Apollo", package: "Apollo"), - .product(name: "ApolloAPI", package: "Apollo"), - .product(name: "ApolloSQLite", package: "Apollo"), - .product(name: "ApolloWebSocket", package: "Apollo") - ] - ), - .testTarget(name: "CodegenTests", - dependencies: [ - "Codegen" - ]), - ] -) diff --git a/SwiftScripts/README.md b/SwiftScripts/README.md deleted file mode 100644 index 65a3694275..0000000000 --- a/SwiftScripts/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Internal Tooling - -``` -OVERVIEW: A Swift package that provides functionality for internal tooling and testing. - -USAGE: Swift run - -SUBCOMMANDS: - Codegen Generate Swift code for the specified targets and package. - DocumentationGenerator Generate API reference documentation for apollo-ios. - SchemaDownload Download the GraphQL schema from all targets in SDL format. -``` - -## Code Generator - -``` -OVERVIEW: Generate Swift code for the specified targets and package. - -USAGE: codegen [--target ...] --package-type - -OPTIONS: - -t, --target The target to generate code for. - -p, --package-type - The package manager for the generated module - Required. - -h, --help Show help information. -``` - -## Documentation Generator - -``` -OVERVIEW: Generate API reference documentation for apollo-ios. - -USAGE: DocumentationGenerator - -OPTIONS: None -``` - -## Schema Download - -``` -OVERVIEW: Download the GraphQL schema from all targets in SDL format. - -USAGE: SchemaDownload - -OPTIONS: None -``` diff --git a/SwiftScripts/Sources/Codegen/main.swift b/SwiftScripts/Sources/Codegen/main.swift deleted file mode 100644 index 16387e8bd0..0000000000 --- a/SwiftScripts/Sources/Codegen/main.swift +++ /dev/null @@ -1,69 +0,0 @@ -import Foundation -import ApolloCodegenLib -import ArgumentParser -import TargetConfig - -// In a typical app, you'll only need to do this for one target, so you'd -// set these up directly within this file. Here, we're using more than one -// target, so we're using an arg parser to figure out which one to build, -// and an enum to hold related options. -struct Codegen: ParsableCommand { - @Option( - wrappedValue: [], - name: [.customLong("target"), .customShort("t")], - parsing: .upToNextOption, - help: "The target to generate code for." - ) - var targetNames: [String] - - @Option( - name: [.customLong("package-type"), .customShort("p")], - help: "The package manager for the generated module - Required." - ) - var packageManager: String = "SPM" - - mutating func run() throws { - let targets = targetNames.isEmpty ? - Target.allCases : - try targetNames.map { try Target(name: $0) } - - guard let module = Module(module: packageManager) else { - throw ArgumentError.invalidPackageType(name: packageManager) - } - - // Grab the parent folder of this file on the filesystem - let parentFolderOfScriptFile = FileFinder.findParentFolder() - - // Use that to calculate the source root - let sourceRootURL = parentFolderOfScriptFile - .parentFolderURL() // Sources - .parentFolderURL() // SwiftScripts - .parentFolderURL() // apollo-ios - - for target in targets { - let targetURL = target.targetRootURL(fromSourceRoot: sourceRootURL) - let inputConfig = target.inputConfig(fromSourceRoot: sourceRootURL) - let outputConfig = try target.outputConfig( - fromSourceRoot: sourceRootURL, - forModuleType: module.moduleType - ) - - // This more necessary if you're using a sub-folder, but make sure - // there's actually a place to write out what you're doing. - try ApolloFileManager.default.createDirectoryIfNeeded(atPath: targetURL.path) - - // Actually attempt to generate code. - try ApolloCodegen.build( - with: ApolloCodegenConfiguration( - schemaNamespace: target.moduleName, - input: inputConfig, - output: outputConfig, - options: target.options(), - experimentalFeatures: target.experimentalFeatures() - ) - ) - } - } -} - -Codegen.main() diff --git a/SwiftScripts/Sources/DocumentationGenerator/main.swift b/SwiftScripts/Sources/DocumentationGenerator/main.swift deleted file mode 100644 index 05a5599113..0000000000 --- a/SwiftScripts/Sources/DocumentationGenerator/main.swift +++ /dev/null @@ -1,120 +0,0 @@ -import Foundation -import ApolloCodegenLib - -enum Target: String, CaseIterable { - case Apollo - case ApolloAPI - case ApolloSQLite - case ApolloWebSocket - case ApolloCodegenLib - - var name: String { - self.rawValue - } - - var outputPath: URL { - DocumentationGenerator.doccFolder - .appendingPathComponent(name) - .appendingPathExtension("doccarchive") - } - -} - -struct DocumentationGenerator { - static func main() { - var currentTarget: Target? - do { - for target in Target.allCases { - currentTarget = target - defer { currentTarget = nil } - - try shell(docBuildCommand(for: target)) - CodegenLogger.log("Generated docs for \(target.name)") - try moveDocsIntoApolloDocCArchive(for: target) - } - - } catch { - if let currentTarget = currentTarget { - CodegenLogger.log("Error generating docs for \(currentTarget.name): \(error)", logLevel: .error) - - } else { - CodegenLogger.log("Error: \(error)", logLevel: .error) - } - exit(1) - } - } - - // Grab the parent folder of this file on the filesystem - static let parentFolderOfScriptFile = FileFinder.findParentFolder() - - // Use that to calculate the source root - static let sourceRootURL = parentFolderOfScriptFile - .deletingLastPathComponent() // Sources - .deletingLastPathComponent() // SwiftScripts - .deletingLastPathComponent() // apollo-ios - - static let doccFolder = sourceRootURL.appendingPathComponent("docs/docc") - - static func docBuildCommand(for target: Target) -> String { - return """ - swift package \ - --allow-writing-to-directory \(target.outputPath.relativePath) \ - generate-documentation \ - --target \(target.name) \ - --disable-indexing \ - --output-path \(target.outputPath.relativePath) \ - --hosting-base-path docs/ios/docc - """ - } - - static func shell(_ command: String) throws { - let task = Process() - let pipe = Pipe() - let outHandle = pipe.fileHandleForReading - outHandle.readabilityHandler = { pipe in - if let line = String(data: pipe.availableData, encoding: .utf8), !line.isEmpty { - CodegenLogger.log(line, logLevel: .debug) - } - } - - task.environment = ProcessInfo.processInfo.environment - task.standardOutput = pipe - task.standardError = pipe - - task.currentDirectoryURL = sourceRootURL.appendingPathComponent("SwiftScripts") - task.environment?["OS_ACTIVITY_DT_MODE"] = nil - task.environment?["DOCC_JSON_PRETTYPRINT"] = "YES" - task.environment?["DOCC_HTML_DIR"] = sourceRootURL - .appendingPathComponent("docs/renderer/dist").relativePath - task.arguments = ["-c", command] - - task.executableURL = URL(fileURLWithPath: "/bin/zsh") - task.standardInput = nil - try task.run() - task.waitUntilExit() - } - - static func moveDocsIntoApolloDocCArchive(for target: Target) throws { - guard target != .Apollo else { return } - - let docsFromURL = doccFolder - .appendingPathComponent("\(target.name).doccarchive/data/documentation/\(target.name.lowercased())") - let docsToURL = doccFolder - .appendingPathComponent("Apollo.doccarchive/data/documentation/\(target.name.lowercased())") - try FileManager.default.moveItem(at: docsFromURL, to: docsToURL) - - let indexJSONFromURL = doccFolder - .appendingPathComponent("\(target.name).doccarchive/data/documentation/\(target.name.lowercased()).json") - let indexJSONToURL = doccFolder - .appendingPathComponent("Apollo.doccarchive/data/documentation/\(target.name.lowercased()).json") - try FileManager.default.moveItem(at: indexJSONFromURL, to: indexJSONToURL) - - try FileManager.default.removeItem(at: target.outputPath) - } - - enum Error: Swift.Error { - case rootDocumentationJSONNotFound - } -} - -DocumentationGenerator.main() diff --git a/SwiftScripts/Sources/SchemaDownload/main.swift b/SwiftScripts/Sources/SchemaDownload/main.swift deleted file mode 100644 index fb503392c9..0000000000 --- a/SwiftScripts/Sources/SchemaDownload/main.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import ApolloCodegenLib -import TargetConfig - -for target in Target.allCases { - - guard let endpoint = target.serverEndpoint else { - continue - } - - // Grab the parent folder of this file on the filesystem - let parentFolderOfScriptFile = FileFinder.findParentFolder() - - // Use that to calculate the source root - let sourceRootURL = parentFolderOfScriptFile - .deletingLastPathComponent() // Sources - .deletingLastPathComponent() // SwiftScripts - .deletingLastPathComponent() // apollo-ios - - let targetURL = target.targetRootURL(fromSourceRoot: sourceRootURL) - let outputURL = target.schemaURL(fromTargetRoot: targetURL) - - // Introspection download: - let configuration = ApolloSchemaDownloadConfiguration( - using: .introspection(endpointURL: endpoint, outputFormat: .SDL), - outputPath: outputURL.path - ) - - do { - try ApolloSchemaDownloader.fetch(configuration: configuration) - } catch { - print(error) - continue - } - -} - -extension Target { - - var serverEndpoint: URL? { - switch self { - case .upload: return URL(string: "http://localhost:4001/")! - case .starWars: return URL(string: "http://localhost:8080/graphql")! - case .subscription: return URL(string: "http://localhost:4000/graphql")! - default: return nil - } - } - -} diff --git a/SwiftScripts/Sources/TargetConfig/ArgumentError.swift b/SwiftScripts/Sources/TargetConfig/ArgumentError.swift deleted file mode 100644 index eb8bb6b993..0000000000 --- a/SwiftScripts/Sources/TargetConfig/ArgumentError.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -public enum ArgumentError: Error, LocalizedError { - case invalidTargetName(name: String) - case invalidPackageType(name: String) - - public var errorDescription: String? { - switch self { - case let .invalidTargetName(name): - return "The target \"\(name)\" is invalid. Please try again." - - case let .invalidPackageType(name): - return "The package type \"\(name)\" is invalid. Please try again." - } - } -} diff --git a/SwiftScripts/Sources/TargetConfig/Module.swift b/SwiftScripts/Sources/TargetConfig/Module.swift deleted file mode 100644 index c3601875bb..0000000000 --- a/SwiftScripts/Sources/TargetConfig/Module.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import ApolloCodegenLib - -public struct Module { - public let moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType - - public init?(module: String) { - switch module.lowercased() { - case "none": self.moduleType = .embeddedInTarget(name: "") - case "swiftpackagemanager", "spm": self.moduleType = .swiftPackageManager - case "other": self.moduleType = .other - default: return nil - } - } -} diff --git a/SwiftScripts/Sources/TargetConfig/Target.swift b/SwiftScripts/Sources/TargetConfig/Target.swift deleted file mode 100644 index 09b0c6cf3e..0000000000 --- a/SwiftScripts/Sources/TargetConfig/Target.swift +++ /dev/null @@ -1,140 +0,0 @@ -import Foundation -import ApolloCodegenLib - -public enum Target: CaseIterable { - case starWars - case gitHub - case upload - case animalKingdom - case subscription - - public init(name: String) throws { - switch name { - case "StarWars": self = .starWars - case "GitHub": self = .gitHub - case "Upload": self = .upload - case "AnimalKingdom": self = .animalKingdom - case "Subscription": self = .subscription - default: throw ArgumentError.invalidTargetName(name: name) - } - } - - public var moduleName: String { - switch self { - case .starWars: return "StarWarsAPI" - case .gitHub: return "GitHubAPI" - case .upload: return "UploadAPI" - case .animalKingdom: return "AnimalKingdomAPI" - case .subscription: return "SubscriptionAPI" - } - } - - public func targetRootURL(fromSourceRoot sourceRootURL: Foundation.URL) -> Foundation.URL { - return sourceRootURL - .childFolderURL(folderName: "Sources") - .childFolderURL(folderName: moduleName) - } - - public func inputConfig( - fromSourceRoot sourceRootURL: Foundation.URL - ) -> ApolloCodegenConfiguration.FileInput { - let targetRootURL = self.targetRootURL(fromSourceRoot: sourceRootURL) - let graphQLFolder = graphQLFolder(fromTargetRoot: targetRootURL) - - switch self { - case .animalKingdom: - return ApolloCodegenConfiguration.FileInput( - schemaPath: graphQLFolder.appendingPathComponent("AnimalSchema.graphqls").path, - // There is a subdirectory that contains CCN enabled operations in the same `graphQLFolder` - // as the .animalKingdom target. We want to include those operations when we generate for - // .animalKingdom. - operationSearchPaths: [graphQLFolder.appendingPathComponent("**/*.graphql").path] - ) - - - default: - return ApolloCodegenConfiguration.FileInput( - schemaPath: schemaURL(fromTargetRoot: targetRootURL).path, - operationSearchPaths: [graphQLFolder.appendingPathComponent("**/*.graphql").path] - ) - } - } - - private func graphQLFolder(fromTargetRoot targetRootURL: Foundation.URL) -> URL { - switch self { - case .starWars: - return targetRootURL.childFolderURL(folderName: "starwars-graphql") - - case .animalKingdom: - return targetRootURL.childFolderURL(folderName: "animalkingdom-graphql") - - default: - return targetRootURL.childFolderURL(folderName: "graphql") - } - } - - public func schemaURL(fromTargetRoot targetRootURL: Foundation.URL) -> Foundation.URL { - let graphQLFolder = graphQLFolder(fromTargetRoot: targetRootURL) - - switch self { - case .animalKingdom: - return graphQLFolder.appendingPathComponent("AnimalSchema.graphqls") - - default: - return graphQLFolder.appendingPathComponent("schema.graphqls") - } - } - - public func outputConfig( - fromSourceRoot sourceRootURL: Foundation.URL, - forModuleType moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType - ) throws -> ApolloCodegenConfiguration.FileOutput { - let targetRootURL = self.targetRootURL(fromSourceRoot: sourceRootURL) - - return ApolloCodegenConfiguration.FileOutput( - schemaTypes: .init( - path: targetRootURL.appendingPathComponent(moduleName).path, - moduleType: moduleType - ), - operations: .inSchemaModule, - testMocks: includeTestMocks ? .swiftPackage() : .none - ) - } - - private var includeOperationIdentifiers: Bool { - switch self { - case .upload, .starWars, .gitHub: return true - default: return false - } - } - - private var includeTestMocks: Bool { - switch self { - case .animalKingdom: return true - default: return false - } - } - - public func options() -> ApolloCodegenConfiguration.OutputOptions { - switch self { - case .starWars: return .init( - schemaDocumentation: .include, - selectionSetInitializers: .all, - operationDocumentFormat: [.definition, .operationId] - ) - case .animalKingdom: return .init( - schemaDocumentation: .include, - selectionSetInitializers: .all - ) - default: return .init() - } - } - - public func experimentalFeatures() -> ApolloCodegenConfiguration.ExperimentalFeatures { - switch self { - case .starWars, .gitHub: return .init(legacySafelistingCompatibleOperations: true) - case .animalKingdom: return .init(clientControlledNullability: true) - default: return .init() - } - } -} diff --git a/SwiftScripts/Tests/CodegenTests/CodegenTests.swift b/SwiftScripts/Tests/CodegenTests/CodegenTests.swift deleted file mode 100644 index 732f78bc77..0000000000 --- a/SwiftScripts/Tests/CodegenTests/CodegenTests.swift +++ /dev/null @@ -1,47 +0,0 @@ -import XCTest -import class Foundation.Bundle - -final class CodegenTests: XCTestCase { - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. - - // Some of the APIs that we use below are available in macOS 10.13 and above. - guard #available(macOS 10.13, *) else { - return - } - - let fooBinary = productsDirectory.appendingPathComponent("Codegen") - - let process = Process() - process.executableURL = fooBinary - - let pipe = Pipe() - process.standardOutput = pipe - - try process.run() - process.waitUntilExit() - - let data = pipe.fileHandleForReading.readDataToEndOfFile() - let output = String(data: data, encoding: .utf8) - - XCTAssertEqual(output, "Hello, world!\n") - } - - /// Returns path to the built products directory. - var productsDirectory: URL { - #if os(macOS) - for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") { - return bundle.bundleURL.deletingLastPathComponent() - } - fatalError("couldn't find the products directory") - #else - return Bundle.main.bundleURL - #endif - } - - static var allTests = [ - ("testExample", testExample), - ] -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/ApolloCodegenInternalTestHelpers.h b/Tests/ApolloCodegenInternalTestHelpers/ApolloCodegenInternalTestHelpers.h deleted file mode 100644 index 60ce1ecdfc..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/ApolloCodegenInternalTestHelpers.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -//! Project version number for ApolloCodegenInternalTestHelpers. -FOUNDATION_EXPORT double ApolloCodegenInternalTestHelpersVersionNumber; - -//! Project version string for ApolloCodegenTestSupport. -FOUNDATION_EXPORT const unsigned char ApolloCodegenInternalTestHelpersVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Tests/ApolloCodegenInternalTestHelpers/CodegenTestHelper.swift b/Tests/ApolloCodegenInternalTestHelpers/CodegenTestHelper.swift deleted file mode 100644 index ab06c28aa5..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/CodegenTestHelper.swift +++ /dev/null @@ -1,68 +0,0 @@ -// -// CodegenTestHelper.swift -// ApolloCodegenTests -// -// Created by Ellen Shapiro on 10/7/19. -// Copyright © 2019 Apollo GraphQL. All rights reserved. -// - -import XCTest -@testable import ApolloCodegenLib - -public struct CodegenTestHelper { - - // Centralized timeout for adjustment when working on terrible wifi - public static var timeout: Double = 90.0 - - public static func sourceRootURL() -> URL { - FileFinder.findParentFolder() - .deletingLastPathComponent() // Tests - .deletingLastPathComponent() // apollo-ios - } - - public static func starWarsFolderURL() -> URL { - let source = self.sourceRootURL() - return source - .appendingPathComponent("Sources") - .appendingPathComponent("StarWarsAPI") - } - - public static func starWarsSchemaFileURL() -> URL { - let starWars = self.starWarsFolderURL() - return starWars - .appendingPathComponent("graphql") - .appendingPathComponent("schema.json") - } - - public static func outputFolderURL() -> URL { - let sourceRoot = self.sourceRootURL() - return sourceRoot - .appendingPathComponent("Tests") - .appendingPathComponent("ApolloCodegenTests") - .appendingPathComponent("Output") - } - - public static func schemaOutputURL() -> URL { - outputFolderURL().appendingPathComponent("schema.graphqls") - } - - public static func schemaFolderURL() -> URL { - let sourceRoot = self.sourceRootURL() - return sourceRoot - .appendingPathComponent("Tests") - .appendingPathComponent("ApolloCodegenTests") - .appendingPathComponent("Schema") - } - - public static func deleteExistingOutputFolder(file: StaticString = #filePath, - line: UInt = #line) { - do { - let outputFolderURL = self.outputFolderURL() - try ApolloFileManager.default.deleteDirectory(atPath: outputFolderURL.path) - } catch { - XCTFail("Error deleting output folder!", - file: file, - line: line) - } - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/GraphQLJSFrontend+TestHelpers.swift b/Tests/ApolloCodegenInternalTestHelpers/GraphQLJSFrontend+TestHelpers.swift deleted file mode 100644 index 96105b1a41..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/GraphQLJSFrontend+TestHelpers.swift +++ /dev/null @@ -1,116 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib - -extension GraphQLJSFrontend { - - public func compile( - schema: String, - document: String, - config: ApolloCodegen.ConfigurationContext - ) throws -> CompilationResult { - let schemaSource = try makeSource(schema, filePath: "") - let documentSource = try makeSource(document, filePath: "") - - let schema = try loadSchema(from: [schemaSource]) - let document = try parseDocument( - documentSource, - experimentalClientControlledNullability: config.experimentalFeatures.clientControlledNullability - ) - - return try compile( - schema: schema, - document: document, - validationOptions: ValidationOptions(config: config) - ) - } - - public func compile( - schema: String, - document: String, - enableCCN: Bool = false - ) throws -> CompilationResult { - let config = ApolloCodegen.ConfigurationContext( - config: .mock(experimentalFeatures: .init(clientControlledNullability: enableCCN))) - - return try compile( - schema: schema, - document: document, - config: config - ) - } - - public func compile( - schema: String, - documents: [String], - config: ApolloCodegen.ConfigurationContext - ) throws -> CompilationResult { - let schemaSource = try makeSource(schema, filePath: "") - let schema = try loadSchema(from: [schemaSource]) - - let documents: [GraphQLDocument] = try documents.enumerated().map { - let source = try makeSource($0.element, filePath: "Doc_\($0.offset)") - return try parseDocument( - source, - experimentalClientControlledNullability: config.experimentalFeatures.clientControlledNullability - ) - } - - let mergedDocument = try mergeDocuments(documents) - return try compile( - schema: schema, - document: mergedDocument, - validationOptions: ValidationOptions(config: config) - ) - } - - public func compile( - schema: String, - documents: [String], - enableCCN: Bool = false - ) throws -> CompilationResult { - let config = ApolloCodegen.ConfigurationContext( - config: .mock(experimentalFeatures: .init(clientControlledNullability: enableCCN))) - - return try compile( - schema: schema, - documents: documents, - config: config - ) - } - - public func compile( - schemaJSON: String, - document: String, - config: ApolloCodegen.ConfigurationContext - ) throws -> CompilationResult { - let documentSource = try makeSource(document, filePath: "") - let schemaSource = try makeSource(schemaJSON, filePath: "schema.json") - - let schema = try loadSchema(from: [schemaSource]) - let document = try parseDocument( - documentSource, - experimentalClientControlledNullability: config.experimentalFeatures.clientControlledNullability) - - return try compile( - schema: schema, - document: document, - validationOptions: ValidationOptions(config: config) - ) - } - - public func compile( - schemaJSON: String, - document: String, - enableCCN: Bool = false - ) throws -> CompilationResult { - let config = ApolloCodegen.ConfigurationContext( - config: .mock(experimentalFeatures: .init(clientControlledNullability: enableCCN))) - - return try compile( - schemaJSON: schemaJSON, - document: document, - config: config - ) - } - -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/IR+InclusionConditionsMock.swift b/Tests/ApolloCodegenInternalTestHelpers/IR+InclusionConditionsMock.swift deleted file mode 100644 index 8177fccc88..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/IR+InclusionConditionsMock.swift +++ /dev/null @@ -1,29 +0,0 @@ -@testable import ApolloCodegenLib -import OrderedCollections - -extension IR.InclusionConditions { - - public static func mock( - _ conditions: OrderedSet - ) -> IR.InclusionConditions? { - let result = IR.InclusionConditions.allOf(conditions) - return result.conditions - } - -} - -extension IR.InclusionCondition: ExpressibleByStringLiteral { - - public init(stringLiteral: String) { - self.init(stringLiteral, isInverted: false) - } - - public static prefix func !(value: IR.InclusionCondition) -> IR.InclusionCondition { - value.inverted() - } - - public static func &&(_ lhs: Self, rhs: Self) -> IR.InclusionConditions.Result { - IR.InclusionConditions.allOf([lhs, rhs]) - } - -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/IR+Mocking.swift b/Tests/ApolloCodegenInternalTestHelpers/IR+Mocking.swift deleted file mode 100644 index c7bc62c434..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/IR+Mocking.swift +++ /dev/null @@ -1,132 +0,0 @@ -@testable import ApolloCodegenLib -import OrderedCollections - -extension IR { - - public static func mock( - schema: String, - document: String, - enableCCN: Bool = false - ) throws -> IR { - let frontend = try GraphQLJSFrontend() - let compilationResult = try frontend.compile( - schema: schema, - document: document, - enableCCN: enableCCN - ) - return .mock(compilationResult: compilationResult) - } - - public static func mock( - schema: String, - documents: [String], - enableCCN: Bool = false - ) throws -> IR { - let frontend = try GraphQLJSFrontend() - let compilationResult = try frontend.compile( - schema: schema, - documents: documents, - enableCCN: enableCCN - ) - return .mock(compilationResult: compilationResult) - } - - public static func mock( - schemaJSON: String, - document: String, - enableCCN: Bool = false - ) throws -> IR { - let frontend = try GraphQLJSFrontend() - let compilationResult = try frontend.compile( - schemaJSON: schemaJSON, - document: document, - enableCCN: enableCCN - ) - return .mock(compilationResult: compilationResult) - } - - public static func mock( - schemaNamespace: String = "TestSchema", - compilationResult: CompilationResult - ) -> IR { - return IR(compilationResult: compilationResult) - } - -} - -extension IR.NamedFragment { - - public static func mock( - _ name: String, - type: GraphQLCompositeType = .mock("MockType"), - source: String? = nil - ) -> IR.NamedFragment { - let definition = CompilationResult.FragmentDefinition.mock(name, type: type, source: source) - let rootField = CompilationResult.Field.mock(name, type: .entity(type)) - let rootEntity = IR.Entity( - location: .init(source: .namedFragment(definition), fieldPath: nil), - rootTypePath: LinkedList(type) - ) - let rootEntityField = IR.EntityField.init( - rootField, - inclusionConditions: nil, - selectionSet: .init( - entity: rootEntity, - scopePath: LinkedList( - .descriptor( - forType: type, - inclusionConditions: nil, - givenAllTypesInSchema: .init([type]) - )))) - - return IR.NamedFragment( - definition: definition, - rootField: rootEntityField, - referencedFragments: [], - entities: [rootEntity.location: rootEntity] - ) - } -} - -extension IR.Operation { - - public static func mock( - definition: CompilationResult.OperationDefinition? = nil, - referencedFragments: OrderedSet = [] - ) -> IR.Operation { - let definition = definition ?? .mock() - return IR.Operation.init( - definition: definition, - rootField: .init( - .mock(), - inclusionConditions: nil, - selectionSet: .init( - entity: .init( - location: .init(source: .operation(definition), fieldPath: nil), - rootTypePath: [.mock()] - ), - scopePath: [.descriptor( - forType: .mock(), - inclusionConditions: nil, - givenAllTypesInSchema: .init([])) - ]) - ), - referencedFragments: referencedFragments - ) - } - - public static func mock( - name: String, - type: CompilationResult.OperationType, - source: String, - referencedFragments: OrderedSet = [] - ) -> IR.Operation { - let definition = CompilationResult.OperationDefinition.mock( - name: name, - type: type, - source: source - ) - - return IR.Operation.mock(definition: definition, referencedFragments: referencedFragments) - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/Info.plist b/Tests/ApolloCodegenInternalTestHelpers/Info.plist deleted file mode 100644 index 5791eec286..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2021 Apollo GraphQL. All rights reserved. - - diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockApolloCodegenConfiguration.swift b/Tests/ApolloCodegenInternalTestHelpers/MockApolloCodegenConfiguration.swift deleted file mode 100644 index 393a7d60ed..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockApolloCodegenConfiguration.swift +++ /dev/null @@ -1,66 +0,0 @@ -@testable import ApolloCodegenLib - -extension ApolloCodegenConfiguration { - public static func mock( - schemaNamespace: String = "TestSchema", - input: FileInput = .init( - schemaPath: "**/*.graphqls", - operationSearchPaths: [] - ), - output: FileOutput = .init( - schemaTypes: .init( - path: "MockSchemaTypes", - moduleType: .embeddedInTarget(name: "MockApplication") - ) - ), - options: OutputOptions = .init(schemaDocumentation: .exclude), - experimentalFeatures: ExperimentalFeatures = .init(), - operationManifest: OperationManifestConfiguration? = nil - ) -> Self { - .init( - schemaNamespace: schemaNamespace, - input: input, - output: output, - options: options, - experimentalFeatures: experimentalFeatures, - operationManifest: operationManifest - ) - } - - public static func mock( - _ moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - options: ApolloCodegenConfiguration.OutputOptions = .init(), - schemaNamespace: String = "TestSchema", - to path: String = "MockModulePath" - ) -> Self { - .init( - schemaNamespace: schemaNamespace, - input: .init( - schemaPath: "schema.graphqls", - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: path, moduleType: moduleType) - ), - options: options - ) - } -} - -extension ApolloCodegenConfiguration.FileOutput { - public static func mock( - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .embeddedInTarget(name: "MockApplication"), - operations: ApolloCodegenConfiguration.OperationsFileOutput = .relative(subpath: nil), - testMocks: ApolloCodegenConfiguration.TestMockFileOutput = .none, - path: String = "" - ) -> Self { - .init( - schemaTypes: .init( - path: path, - moduleType: moduleType - ), - operations: operations, - testMocks: testMocks - ) - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift b/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift deleted file mode 100644 index 215b857609..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift +++ /dev/null @@ -1,214 +0,0 @@ -@testable import ApolloCodegenLib - -public extension CompilationResult { - - class func mock( - rootTypes: RootTypeDefinition = RootTypeDefinition.mock() - ) -> Self { - let mock = Self.emptyMockObject() - mock.rootTypes = rootTypes - mock.referencedTypes = [] - mock.fragments = [] - mock.operations = [] - return mock - } - -} - -public extension CompilationResult.RootTypeDefinition { - - class func mock( - queryName: String = "Query", - mutationName: String = "Mutation", - subscriptionName: String = "Subscription" - ) -> Self { - let mock = Self.emptyMockObject() - mock.queryType = GraphQLCompositeType.mock(queryName) - mock.mutationType = GraphQLCompositeType.mock(mutationName) - mock.subscriptionType = GraphQLCompositeType.mock(subscriptionName) - return mock - } - -} - -public extension CompilationResult.OperationDefinition { - - class func mock( - type: CompilationResult.OperationType = .query, - selections: [CompilationResult.Selection] = [], - path: String = "" - ) -> Self { - let mock = Self.emptyMockObject() - mock.operationType = type - mock.rootType = type.mockRootType() - mock.selectionSet = CompilationResult.SelectionSet( - parentType: mock.rootType, - selections: selections - ) - mock.filePath = path - return mock - } - - class func mock( - name: String, - type: CompilationResult.OperationType, - source: String - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.operationType = type - mock.source = source - - return mock - } -} - -public extension CompilationResult.OperationType { - func mockRootType() -> GraphQLCompositeType { - GraphQLObjectType.mock(rawValue.uppercased()) - } -} - -public extension CompilationResult.InlineFragment { - - class func mock( - parentType: GraphQLCompositeType = GraphQLObjectType.mock(), - inclusionConditions: [CompilationResult.InclusionCondition]? = nil, - selections: [CompilationResult.Selection] = [] - ) -> Self { - let mock = Self.emptyMockObject() - mock.selectionSet = CompilationResult.SelectionSet( - parentType: parentType, - selections: selections - ) - mock.inclusionConditions = inclusionConditions - return mock - } -} - -public extension CompilationResult.SelectionSet { - - class func mock( - parentType: GraphQLCompositeType = GraphQLObjectType.mock(), - selections: [CompilationResult.Selection] = [] - ) -> Self { - Self( - parentType: parentType, - selections: selections - ) - } -} - -public extension CompilationResult.Field { - - class func mock( - _ name: String = "", - alias: String? = nil, - arguments: [CompilationResult.Argument]? = nil, - type: GraphQLType = .entity(GraphQLObjectType.mock("MOCK")), - selectionSet: CompilationResult.SelectionSet = .mock(), - deprecationReason: String? = nil - ) -> Self { - let mock = Self(nil) - mock.name = name - mock.alias = alias - mock.arguments = arguments - mock.type = type - mock.selectionSet = selectionSet - mock.directives = nil - mock.inclusionConditions = nil - mock.deprecationReason = deprecationReason - return mock - } - - class func mock( - _ name: String = "", - alias: String? = nil, - arguments: [CompilationResult.Argument]? = nil, - type: GraphQLScalarType - ) -> Self { - Self.mock( - name, - alias: alias, - arguments: arguments, - type: .scalar(type) - ) - } -} - -public extension CompilationResult.FragmentDefinition { - private class func mockDefinition(name: String) -> String { - return """ - fragment \(name) on Person { - name - } - """ - } - - class func mock( - _ name: String = "NameFragment", - type: GraphQLCompositeType = .emptyMockObject(), - selections: [CompilationResult.Selection] = [], - path: String = "", - source: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.type = type - mock.selectionSet = .mock(parentType: type, selections: selections) - mock.source = source ?? Self.mockDefinition(name: name) - mock.filePath = path - return mock - } -} - -public extension CompilationResult.FragmentSpread { - class func mock( - _ fragment: CompilationResult.FragmentDefinition = .mock(), - inclusionConditions: [CompilationResult.InclusionCondition]? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.fragment = fragment - mock.inclusionConditions = inclusionConditions - return mock - } -} - -public extension CompilationResult.Selection { - static func fragmentSpread( - _ fragment: CompilationResult.FragmentDefinition, - inclusionConditions: [CompilationResult.InclusionCondition]? = nil - ) -> CompilationResult.Selection { - .fragmentSpread(CompilationResult.FragmentSpread.mock( - fragment, - inclusionConditions: inclusionConditions - )) - } -} - - -public extension CompilationResult.VariableDefinition { - class func mock( - _ name: String, - type: GraphQLType, - defaultValue: GraphQLValue? - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.type = type - mock.defaultValue = defaultValue - return mock - } -} - -public extension CompilationResult.Directive { - class func mock( - _ name: String, - arguments: [CompilationResult.Argument]? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.arguments = arguments - return mock - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockFileGenerator.swift b/Tests/ApolloCodegenInternalTestHelpers/MockFileGenerator.swift deleted file mode 100644 index d30bd3be5d..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockFileGenerator.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib - -public struct MockFileGenerator: FileGenerator { - public var template: TemplateRenderer - public var target: FileTarget - public var fileName: String - public var fileExtension: String - - public static func mock( - template: TemplateRenderer, - target: FileTarget, - filename: String, - extension: String = "graphql.swift" - ) -> Self { - MockFileGenerator( - template: template, - target: target, - fileName: filename, - fileExtension: `extension` - ) - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockFileManager.swift b/Tests/ApolloCodegenInternalTestHelpers/MockFileManager.swift deleted file mode 100644 index 50404cd224..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockFileManager.swift +++ /dev/null @@ -1,190 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib -import XCTest - -/// Used to mock a `FileManager` instance that is compatible with the `.apollo` namespace extension. -public class MockApolloFileManager: ApolloFileManager { - /// Translates to the `FileManager` functions that can be mocked. - public enum Closure: CustomStringConvertible { - case fileExists(_ handler: (String, UnsafeMutablePointer?) -> Bool) - case removeItem(_ handler: (String) throws -> Void) - case createFile(_ handler: (String, Data?, FileAttributes?) -> Bool) - case createDirectory(_ handler: (String, Bool, FileAttributes?) throws -> Void) - - // These are based on the return string from the #function macro. They are used in overriden - // functions to lookup the provided closure. Be aware that if the function signature changes - // these should be updated so the mocked closures can still be looked up. - public var description: String { - switch self { - case .fileExists(_): return "fileExists(atPath:isDirectory:)" - case .removeItem(_): return "removeItem(atPath:)" - case .createFile(_): return "createFile(atPath:contents:attributes:)" - case .createDirectory(_): return "createDirectory(atPath:withIntermediateDirectories:attributes:)" - } - } - } - - /// If `true` then all called closures must be mocked otherwise the call will fail. When `false` any called closure - /// that is not mocked will fall through to `super`. As a byproduct of `false`, all mocked closures must be called otherwise - /// the test will fail. - var strict: Bool { _base.strict } - var _base: MockFileManager { unsafeDowncast(base, to: MockFileManager.self) } - - /// Designated initializer. - /// - /// - Parameters: - /// - strict: If `true` then all called closures must be mocked otherwise the call will fail. - /// When `false` any called closure that is not mocked will fall through to `super`. As a - /// byproduct of `false`, all mocked closures must be called otherwise the test will fail. - public init(strict: Bool = true) { - super.init(base: MockFileManager(strict: strict)) - } - - /// Provide a mock closure for the `FileManager` function. - /// - /// - Parameter closure: The mocked function closure. - public func mock(closure: Closure) { - _base.mock(closure: closure) - } - - private func didCall(closure: Closure) { - _base.closuresToBeCalled.remove(closure.description) - } - - /// Check whether all mocked closures were called during the lifetime of an instance. - public var allClosuresCalled: Bool { - return _base.closuresToBeCalled.isEmpty - } - - class MockFileManager: FileManager { - - fileprivate var closures: [String: Closure] = [:] - fileprivate var closuresToBeCalled: Set = [] - - /// If `true` then all called closures must be mocked otherwise the call will fail. When `false` any called closure - /// that is not mocked will fall through to `super`. As a byproduct of `false`, all mocked closures must be called otherwise - /// the test will fail. - let strict: Bool - - fileprivate init(strict: Bool = true) { - self.strict = strict - } - - deinit { - if strict == false && allClosuresCalled == false { - XCTFail("Non-strict mode requires that all mocked closures are called! Check \(closuresToBeCalled) in your MockFileManager instance.") - } - } - - /// Provide a mock closure for the `FileManager` function. - /// - /// - Parameter closure: The mocked function closure. - fileprivate func mock(closure: Closure) { - closures[closure.description] = closure - closuresToBeCalled.insert(closure.description) - } - - fileprivate func didCall(closure: Closure) { - closuresToBeCalled.remove(closure.description) - } - - /// Check whether all mocked closures were called during the lifetime of an instance. - fileprivate var allClosuresCalled: Bool { - return closuresToBeCalled.isEmpty - } - - // MARK: FileManager overrides - - private func missingClosureMessage(_ function: String) -> String { - return "\(function) closure must be mocked before calling it! Check your MockFileManager instance." - } - - public override func fileExists(atPath path: String, isDirectory: UnsafeMutablePointer?) -> Bool { - let key = #function - - guard - let closure = closures[key], - case let .fileExists(handler) = closure else { - if strict { - XCTFail(missingClosureMessage(key)) - return false - } else { - return super.fileExists(atPath: path, isDirectory: isDirectory) - } - } - - defer { - didCall(closure: closure) - } - - return handler(path, isDirectory) - } - - public override func removeItem(atPath path: String) throws { - let key = #function - - guard - let closure = closures[key], - case let .removeItem(handler) = closure else { - if strict { - XCTFail(missingClosureMessage(key)) - return - } else { - return try super.removeItem(atPath: path) - } - } - - defer { - didCall(closure: closure) - } - - try handler(path) - } - - public override func createFile(atPath path: String, contents data: Data?, attributes attr: FileAttributes?) -> Bool { - let key = #function - - guard - let closure = closures[key], - case let .createFile(handler) = closure else { - if strict { - XCTFail(missingClosureMessage(key)) - return false - } else { - return super.createFile(atPath: path, contents: data, attributes: attr) - } - } - - defer { - didCall(closure: closure) - } - - return handler(path, data, attr) - } - - public override func createDirectory(atPath path: String, withIntermediateDirectories createIntermediates: Bool, attributes: FileAttributes?) throws { - let key = #function - - guard - let closure = closures[key], - case let .createDirectory(handler) = closure else { - if strict { - XCTFail(missingClosureMessage(key)) - return - } else { - return try super.createDirectory( - atPath: path, - withIntermediateDirectories: createIntermediates, - attributes: attributes - ) - } - } - - defer { - didCall(closure: closure) - } - - try handler(path, createIntermediates, attributes) - } - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockFileTemplate.swift b/Tests/ApolloCodegenInternalTestHelpers/MockFileTemplate.swift deleted file mode 100644 index 271c58170d..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockFileTemplate.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib - -public struct MockFileTemplate: TemplateRenderer { - public var target: TemplateTarget - public var config: ApolloCodegen.ConfigurationContext - - public var template: TemplateString { - TemplateString( - """ - root { - nested - } - """ - ) - } - - public var detachedTemplate: TemplateString? { - TemplateString( - """ - detached { - nested - } - """ - ) - } - - public static func mock( - target: TemplateTarget, - config: ApolloCodegenConfiguration = .mock() - ) -> Self { - MockFileTemplate(target: target, config: .init(config: config, rootURL: nil)) - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift b/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift deleted file mode 100644 index db100ce335..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift +++ /dev/null @@ -1,190 +0,0 @@ -@testable import ApolloCodegenLib -import OrderedCollections -import AppKit - -public extension GraphQLCompositeType { - @objc class func mock( - _ name: String = "" - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - return mock - } -} - -public extension GraphQLObjectType { - class override func mock( - _ name: String = "" - ) -> Self { - Self.mock(name, fields: [:], interfaces: []) - } - - class func mock( - _ name: String = "", - fields: [String: GraphQLField] = [:], - interfaces: [GraphQLInterfaceType] = [], - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.fields = fields - mock.interfaces = interfaces - mock.documentation = documentation - return mock - } -} - -public extension GraphQLInterfaceType { - class override func mock( - _ name: String = "" - ) -> Self { - Self.mock(name, fields: [:], interfaces: []) - } - - class func mock( - _ name: String = "", - fields: [String: GraphQLField] = [:], - interfaces: [GraphQLInterfaceType] = [], - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.fields = fields - mock.interfaces = interfaces - mock.documentation = documentation - return mock - } -} - -public extension GraphQLUnionType { - class func mock( - _ name: String = "", - types: [GraphQLObjectType] = [], - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.types = types - mock.documentation = documentation - return mock - } -} - -public extension GraphQLScalarType { - class func string() -> Self { mock(name: "String") } - class func integer() -> Self { mock(name: "Int") } - class func boolean() -> Self { mock(name: "Boolean") } - class func float() -> Self { mock(name: "Float") } - - class func mock( - name: String, - specifiedByURL: String? = nil, - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.specifiedByURL = specifiedByURL - mock.documentation = documentation - return mock - } -} - -public extension GraphQLType { - static func string() -> Self { .scalar(GraphQLScalarType.mock(name: "String")) } - static func integer() -> Self { .scalar(GraphQLScalarType.mock(name: "Int")) } - static func boolean() -> Self { .scalar(GraphQLScalarType.mock(name: "Boolean")) } - static func float() -> Self { .scalar(GraphQLScalarType.mock(name: "Float")) } -} - -public extension GraphQLEnumType { - class func skinCovering() -> Self { - mock(name: "SkinCovering", values: ["FUR", "HAIR", "FEATHERS", "SCALES"]) - } - - class func relativeSize() -> Self { - mock(name: "RelativeSize", values: ["LARGE", "AVERAGE", "SMALL"]) - } - - class func mock( - name: String, - values: [String] = [] - ) -> Self { - return self.mock( - name: name, - values: values.map { GraphQLEnumValue.mock(name: $0) } - ) - } - - class func mock( - name: String, - values: [GraphQLEnumValue], - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.values = values - mock.documentation = documentation - return mock - } -} - -public extension GraphQLEnumValue { - class func mock( - name: String, - deprecationReason: String? = nil, - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = Name(value: name) - mock.deprecationReason = deprecationReason - mock.documentation = documentation - return mock - } -} - -public extension GraphQLInputObjectType { - class func mock( - _ name: String, - fields: [GraphQLInputField] = [], - documentation: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.fields = OrderedDictionary.init(uniqueKeysWithValues: fields.map({ ($0.name, $0) })) - mock.documentation = documentation - return mock - } -} - -public extension GraphQLInputField { - class func mock( - _ name: String, - type: GraphQLType, - defaultValue: GraphQLValue?, - documentation: String? = nil, - deprecationReason: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.type = type - mock.defaultValue = defaultValue - mock.documentation = documentation - mock.deprecationReason = deprecationReason - return mock - } -} - -public extension GraphQLField { - class func mock( - _ name: String, - type: GraphQLType, - deprecationReason: String? = nil - ) -> Self { - let mock = Self.emptyMockObject() - mock.name = name - mock.type = type - mock.deprecationReason = deprecationReason - mock.arguments = [] - return mock - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockIRSubscripts.swift b/Tests/ApolloCodegenInternalTestHelpers/MockIRSubscripts.swift deleted file mode 100644 index 59ec5b58d1..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockIRSubscripts.swift +++ /dev/null @@ -1,230 +0,0 @@ -@testable import ApolloCodegenLib - -public protocol ScopeConditionalSubscriptAccessing { - - subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { get } - -} - -extension ScopeConditionalSubscriptAccessing { - - public subscript(as typeCase: String) -> IR.SelectionSet? { - guard let scope = self.scopeCondition(type: typeCase, conditions: nil) else { - return nil - } - - return self[scope] - } - - public subscript( - as typeCase: String? = nil, - if condition: IR.InclusionCondition? = nil - ) -> IR.SelectionSet? { - let conditions: IR.InclusionConditions.Result? - if let condition = condition { - conditions = .conditional(.init(condition)) - } else { - conditions = nil - } - - guard let scope = self.scopeCondition(type: typeCase, conditions: conditions) else { - return nil - } - return self[scope] - } - - public subscript( - as typeCase: String? = nil, - if conditions: IR.InclusionConditions.Result? = nil - ) -> IR.SelectionSet? { - guard let scope = self.scopeCondition(type: typeCase, conditions: conditions) else { - return nil - } - - return self[scope] - } - - private func scopeCondition( - type typeCase: String?, - conditions conditionsResult: IR.InclusionConditions.Result? - ) -> IR.ScopeCondition? { - let type: GraphQLCompositeType? - if let typeCase = typeCase { - type = GraphQLCompositeType.mock(typeCase) - } else { - type = nil - } - - let conditions: IR.InclusionConditions? - - if let conditionsResult = conditionsResult { - guard conditionsResult != .skipped else { - return nil - } - - conditions = conditionsResult.conditions - - } else { - conditions = nil - } - - return IR.ScopeCondition(type: type, conditions: conditions) - } - -} - -extension IR.DirectSelections: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - fields[field] - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - inlineFragments[conditions]?.selectionSet - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - namedFragments[fragment] - } -} - -extension IR.MergedSelections: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - fields[field] - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - inlineFragments[conditions]?.selectionSet - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - namedFragments[fragment] - } -} - -extension IR.EntityTreeScopeSelections { - public subscript(field field: String) -> IR.Field? { - fields[field] - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - namedFragments[fragment] - } -} - - -extension IR.Field: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - return selectionSet?[field: field] - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - return selectionSet?[conditions] - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - return selectionSet?[fragment: fragment] - } - - public var selectionSet: IR.SelectionSet? { - guard let entityField = self as? IR.EntityField else { return nil } - return entityField.selectionSet as IR.SelectionSet - } -} - -extension IR.SelectionSet: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - selections[field: field] - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - selections[conditions] - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - selections[fragment: fragment] - } -} - -extension IR.SelectionSet.Selections: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - direct?.fields[field] ?? merged.fields[field] - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - return direct?.inlineFragments[conditions]?.selectionSet ?? - merged.inlineFragments[conditions]?.selectionSet - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - direct?.namedFragments[fragment] ?? merged.namedFragments[fragment] - } -} - -extension IR.Operation: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - return rootField.underlyingField.name == field ? rootField : nil - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - rootField[conditions] - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - rootField[fragment: fragment] - } -} - -extension IR.NamedFragment: ScopeConditionalSubscriptAccessing { - public subscript(field field: String) -> IR.Field? { - return rootField.selectionSet[field: field] - } - - public subscript(conditions: IR.ScopeCondition) -> IR.SelectionSet? { - return rootField.selectionSet[conditions] - } - - public subscript(fragment fragment: String) -> IR.NamedFragmentSpread? { - rootField.selectionSet[fragment: fragment] - } -} - -extension IR.Schema { - public subscript(object name: String) -> GraphQLObjectType? { - return referencedTypes.objects.first { $0.name == name } - } - - public subscript(interface name: String) -> GraphQLInterfaceType? { - return referencedTypes.interfaces.first { $0.name == name } - } - - public subscript(union name: String) -> GraphQLUnionType? { - return referencedTypes.unions.first { $0.name == name } - } - - public subscript(scalar name: String) -> GraphQLScalarType? { - return referencedTypes.scalars.first { $0.name == name } - } - - public subscript(enum name: String) -> GraphQLEnumType? { - return referencedTypes.enums.first { $0.name == name } - } - - public subscript(inputObject name: String) -> GraphQLInputObjectType? { - return referencedTypes.inputObjects.first { $0.name == name } - } -} - -extension CompilationResult { - - public subscript(type name: String) -> GraphQLNamedType? { - return referencedTypes.first { $0.name == name } - } - - public subscript(operation name: String) -> CompilationResult.OperationDefinition? { - return operations.first { $0.name == name } - } - - public subscript(fragment name: String) -> CompilationResult.FragmentDefinition? { - return fragments.first { $0.name == name } - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockJavaScriptObject.swift b/Tests/ApolloCodegenInternalTestHelpers/MockJavaScriptObject.swift deleted file mode 100644 index adf5e96c76..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockJavaScriptObject.swift +++ /dev/null @@ -1,13 +0,0 @@ -@testable import ApolloCodegenLib -@testable import JavaScriptCore - -private var mockJavaScriptBridge = try! JavaScriptBridge() - -extension JavaScriptObject { - - @objc public class func emptyMockObject() -> Self { - let object = JSValue(newObjectIn: mockJavaScriptBridge.context)! - return Self.fromJSValue(object, bridge: mockJavaScriptBridge) - } - -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockMergedSelections.swift b/Tests/ApolloCodegenInternalTestHelpers/MockMergedSelections.swift deleted file mode 100644 index edd86e0146..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockMergedSelections.swift +++ /dev/null @@ -1,52 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib -import XCTest - -extension IR.MergedSelections.MergedSource { - - public static func mock( - _ field: IR.Field?, - file: StaticString = #file, - line: UInt = #line - ) throws -> Self { - self.init( - typeInfo: try XCTUnwrap(field?.selectionSet?.typeInfo, file: file, line: line), - fragment: nil - ) - } - - public static func mock( - _ typeCase: IR.SelectionSet?, - file: StaticString = #file, - line: UInt = #line - ) throws -> Self { - self.init( - typeInfo: try XCTUnwrap(typeCase?.typeInfo, file: file, line: line), - fragment: nil - ) - } - - public static func mock( - _ fragment: IR.NamedFragmentSpread?, - file: StaticString = #file, - line: UInt = #line - ) throws -> Self { - let fragment = try XCTUnwrap(fragment, file: file, line: line) - return self.init( - typeInfo: fragment.fragment.rootField.selectionSet.typeInfo, - fragment: fragment.fragment - ) - } - - public static func mock( - for field: IR.Field?, - from fragment: IR.NamedFragmentSpread?, - file: StaticString = #file, - line: UInt = #line - ) throws -> Self { - self.init( - typeInfo: try XCTUnwrap(field?.selectionSet?.typeInfo, file: file, line: line), - fragment: try XCTUnwrap(fragment?.fragment, file: file, line: line) - ) - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockNetworkSession.swift b/Tests/ApolloCodegenInternalTestHelpers/MockNetworkSession.swift deleted file mode 100644 index bb9fb48b36..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockNetworkSession.swift +++ /dev/null @@ -1,24 +0,0 @@ -@testable import ApolloCodegenLib - -public final class MockNetworkSession: NetworkSession { - let statusCode: Int - let data: Data? - let error: Error? - let abandon: Bool - - public init(statusCode: Int, data: Data? = nil, error: Error? = nil, abandon: Bool = false) { - self.statusCode = statusCode - self.data = data - self.error = error - self.abandon = abandon - } - - public func loadData(with urlRequest: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask? { - guard !abandon else { return nil } - - let response = HTTPURLResponse(url: urlRequest.url!, statusCode: statusCode, httpVersion: nil, headerFields: nil) - completionHandler(data, response, error) - - return nil - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockTemplateRenderer.swift b/Tests/ApolloCodegenInternalTestHelpers/MockTemplateRenderer.swift deleted file mode 100644 index a49c4ba811..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockTemplateRenderer.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib - -public struct MockTemplateRenderer: TemplateRenderer { - public var target: ApolloCodegenLib.TemplateTarget - public var template: ApolloCodegenLib.TemplateString - public var config: ApolloCodegenLib.ApolloCodegen.ConfigurationContext - - public init( - target: TemplateTarget, - template: TemplateString, - config: ApolloCodegen.ConfigurationContext - ) { - self.target = target - self.template = template - self.config = config - } -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockValidationOptions.swift b/Tests/ApolloCodegenInternalTestHelpers/MockValidationOptions.swift deleted file mode 100644 index 24ce1a731f..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/MockValidationOptions.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation -@testable import ApolloCodegenLib - -extension ValidationOptions { - - public static func mock(schemaNamespace: String = "TestSchema") -> Self { - let context = ApolloCodegen.ConfigurationContext( - config: ApolloCodegenConfiguration.mock(schemaNamespace: schemaNamespace)) - - return ValidationOptions(config: context) - } - -} diff --git a/Tests/ApolloCodegenInternalTestHelpers/Resources.swift b/Tests/ApolloCodegenInternalTestHelpers/Resources.swift deleted file mode 100644 index 2ea7c32d09..0000000000 --- a/Tests/ApolloCodegenInternalTestHelpers/Resources.swift +++ /dev/null @@ -1,66 +0,0 @@ -import Foundation - -private class BundleFinder {} - -public struct Resources { - static let Bundle = Foundation.Bundle.init(for: BundleFinder.self) - static let url = Bundle.resourceURL! - - public enum AnimalKingdom { - public static let Schema = Bundle.url( - forResource: "AnimalSchema", - withExtension: "graphqls", - subdirectory: "animalkingdom-graphql" - )! - - public static let GraphQLOperations: [URL] = Bundle.urls( - forResourcesWithExtension: "graphql", - subdirectory: "animalkingdom-graphql" - )! - - public static let CCNGraphQLOperations: [URL] = Bundle.urls( - forResourcesWithExtension: "graphql", - subdirectory: "animalkingdom-graphql/ccnGraphql" - )! + - Bundle.urls( - forResourcesWithExtension: "graphql", - subdirectory: "animalkingdom-graphql" - )! - - private static func GraphQLOperation(named name: String) -> URL { - Resources.GraphQLOperation(named: name, subdirectory: "animalkingdom-graphql") - } - } - - private static func GraphQLOperation( - named name: String, - subdirectory: String - ) -> URL { - return Bundle.url( - forResource: name, - withExtension: "graphql", - subdirectory: subdirectory - )! - } - - // Star Wars - - public enum StarWars { - public static let JSONSchema = Bundle.url( - forResource: "schema", - withExtension: "json", - subdirectory: "starwars-graphql" - )! - - public static let GraphQLOperations: [URL] = Bundle.urls( - forResourcesWithExtension: "graphql", - subdirectory: "starwars-graphql" - )! - - public static func GraphQLOperation(named name: String) -> URL { - Resources.GraphQLOperation(named: name, subdirectory: "starwars-graphql") - } - } - - -} diff --git a/Tests/ApolloCodegenTests/AnimalKingdomAPI/AnimalKingdomIRCreationTests.swift b/Tests/ApolloCodegenTests/AnimalKingdomAPI/AnimalKingdomIRCreationTests.swift deleted file mode 100644 index f5edb88440..0000000000 --- a/Tests/ApolloCodegenTests/AnimalKingdomAPI/AnimalKingdomIRCreationTests.swift +++ /dev/null @@ -1,1039 +0,0 @@ -import Foundation -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -final class AnimalKingdomIRCreationTests: XCTestCase { - - static let frontend = try! GraphQLJSFrontend() - - static let schema = try! frontend.loadSchema(from: [ - try! frontend.makeSource(from: ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema) - ]) - - static func operationDocuments(experimentalClientControlledNullability: Bool = false) -> GraphQLDocument { - try! frontend.mergeDocuments( - ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.GraphQLOperations.map { - try! frontend.parseDocument( - from: $0, - experimentalClientControlledNullability: experimentalClientControlledNullability - ) - } - ) - } - - static func operationCCNDocuments(experimentalClientControlledNullability: Bool = false) -> GraphQLDocument { - try! frontend.mergeDocuments( - ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.CCNGraphQLOperations.map { - try! frontend.parseDocument( - from: $0, - experimentalClientControlledNullability: experimentalClientControlledNullability - ) - } - ) - } - - var compilationResult: CompilationResult! - - var expected: (fields: [ShallowFieldMatcher], - typeCases: [ShallowInlineFragmentMatcher], - fragments: [ShallowFragmentSpreadMatcher])! - - override func setUp() { - super.setUp() - compilationResult = try! Self.frontend.compile( - schema: Self.schema, - document: Self.operationDocuments(), - validationOptions: ValidationOptions(config: .init(config: .mock())) - ) - } - - override func tearDown() { - super.tearDown() - compilationResult = nil - expected = nil - } - - func test__directSelections_AllAnimalsQuery_RootQuery__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - expected = ( - fields: [ - .mock("allAnimals", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))) - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = rootSelectionSet.selections.direct - - // then - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_RootQuery__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - // when - let actual = rootSelectionSet.selections.merged - - // then - expect(actual).to(beEmpty()) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal__isCorrect() throws { - // given - let Interface_Animal = GraphQLInterfaceType.mock("Animal") - - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap(rootSelectionSet[field: "allAnimals"]?.selectionSet) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(Interface_Animal))))), - ], - typeCases: [ - .mock(parentType: GraphQLInterfaceType.mock("WarmBlooded")), - .mock(parentType: GraphQLInterfaceType.mock("Pet")), - .mock(parentType: GraphQLObjectType.mock("Cat")), - .mock(parentType: GraphQLUnionType.mock("ClassroomPet")), - .mock(parentType: GraphQLObjectType.mock("Dog")), - ], - fragments: [ - .mock("HeightInMeters", type: Interface_Animal) - ] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(Interface_Animal)) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal__isCorrect() throws { - // given - let Interface_Animal = GraphQLInterfaceType.mock("Animal") - - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap(rootSelectionSet[field: "allAnimals"]?.selectionSet) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(Interface_Animal)) - expect(actual).to(beEmpty()) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("inches", - type: .scalar(GraphQLScalarType.integer())), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("meters", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_Predator__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "predators"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - ], - typeCases: [ - .mock(parentType: GraphQLInterfaceType.mock("WarmBlooded")) - ], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("Animal"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_Predator__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "predators"]?.selectionSet - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("Animal"))) - expect(actual).to(beEmpty()) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_Predator_AsWarmBlooded__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "predators"]?[as: "WarmBlooded"] - ) - - expected = ( - fields: [ - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(.mock("Animal")))))), - .mock("laysEggs", - type: .nonNull(.scalar(GraphQLScalarType.boolean()))), - ], - typeCases: [], - fragments: [ - .mock("WarmBloodedDetails", type: GraphQLInterfaceType.mock("WarmBlooded")), - ] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("WarmBlooded"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_Predator_AsWarmBlooded__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "predators"]?[as: "WarmBlooded"] - ) - - expected = ( - fields: [ - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("bodyTemperature", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - ], - typeCases: [], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("WarmBlooded"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsWarmBlooded__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "WarmBlooded"] - ) - - expected = ( - fields: [], - typeCases: [], - fragments: [ - .mock("WarmBloodedDetails", type: GraphQLInterfaceType.mock("WarmBlooded")), - ] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("WarmBlooded"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsWarmBlooded__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "WarmBlooded"] - ) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))), - .mock("bodyTemperature", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - ], - typeCases: [], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("WarmBlooded"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsWarmBlooded_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "WarmBlooded"]?[field: "height"]?.selectionSet - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(beNil()) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsWarmBlooded_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "WarmBlooded"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("inches", - type: .scalar(GraphQLScalarType.integer())), - .mock("meters", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsPet__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"] - ) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))) - ], - typeCases: [ - .mock(parentType: GraphQLInterfaceType.mock("WarmBlooded")), - ], - fragments: [ - .mock("PetDetails", type: GraphQLInterfaceType.mock("Pet")), - ] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("Pet"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsPet__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"] - ) - - expected = ( - fields: [ - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))), - .mock("humanName", - type: .scalar(GraphQLScalarType.string())), - .mock("favoriteToy", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("owner", - type: .entity(GraphQLObjectType.mock("Human"))), - ], - typeCases: [ - ], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("Pet"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsPet_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("relativeSize", - type: .nonNull(.enum(GraphQLEnumType.relativeSize()))), - .mock("centimeters", - type: .nonNull(.scalar(GraphQLScalarType.float()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsPet_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("inches", - type: .scalar(GraphQLScalarType.integer())), - .mock("meters", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AsPet_AsWarmBlooded__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"]?[as: "WarmBlooded"] - ) - - expected = ( - fields: [], - typeCases: [], - fragments: [ - .mock("WarmBloodedDetails", type: GraphQLInterfaceType.mock("WarmBlooded")), - ] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("WarmBlooded"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AsPet_AsWarmBlooded__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"]?[as: "WarmBlooded"] - ) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))), - .mock("bodyTemperature", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("humanName", - type: .scalar(GraphQLScalarType.string())), - .mock("favoriteToy", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("owner", - type: .entity(GraphQLObjectType.mock("Human"))), - ], - typeCases: [], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - .mock("PetDetails", type: GraphQLInterfaceType.mock("Pet")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLInterfaceType.mock("WarmBlooded"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsPet_AsWarmBlooded_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"]?[as: "WarmBlooded"]?[field: "height"]?.selectionSet - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(beNil()) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsPet_AsWarmBlooded_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Pet"]?[as: "WarmBlooded"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("inches", - type: .scalar(GraphQLScalarType.integer())), - .mock("meters", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("relativeSize", - type: .nonNull(.enum(GraphQLEnumType.relativeSize()))), - .mock("centimeters", - type: .nonNull(.scalar(GraphQLScalarType.float()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AsCat__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Cat"] - ) - - expected = ( - fields: [ - .mock("isJellicle", - type: .nonNull(.scalar(GraphQLScalarType.boolean()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Cat"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AsCat__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Cat"] - ) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))), - .mock("bodyTemperature", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("humanName", - type: .scalar(GraphQLScalarType.string())), - .mock("favoriteToy", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("owner", - type: .entity(GraphQLObjectType.mock("Human"))), - ], - typeCases: [], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - .mock("WarmBloodedDetails", type: GraphQLInterfaceType.mock("WarmBlooded")), - .mock("PetDetails", type: GraphQLInterfaceType.mock("Pet")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Cat"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsCat_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Cat"]?[field: "height"]?.selectionSet - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(beNil()) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsCat_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "Cat"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("inches", - type: .scalar(GraphQLScalarType.integer())), - .mock("meters", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("relativeSize", - type: .nonNull(.enum(GraphQLEnumType.relativeSize()))), - .mock("centimeters", - type: .nonNull(.scalar(GraphQLScalarType.float()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AsClassroomPet__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "ClassroomPet"] - ) - - expected = ( - fields: [], - typeCases: [ - .mock(parentType: GraphQLObjectType.mock("Bird")), - ], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLUnionType.mock("ClassroomPet"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AsClassroomPet__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "ClassroomPet"] - ) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))), - ], - typeCases: [ - ], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLUnionType.mock("ClassroomPet"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AsClassroomPet_AsBird__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "ClassroomPet"]?[as: "Bird"] - ) - - expected = ( - fields: [ - .mock("wingspan", - type: .nonNull(.scalar(GraphQLScalarType.float()))) - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Bird"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AsClassroomPet_AsBird__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "ClassroomPet"]?[as: "Bird"] - ) - - expected = ( - fields: [ - .mock("height", - type: .nonNull(.entity(GraphQLObjectType.mock("Height")))), - .mock("species", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("skinCovering", - type: .enum(GraphQLEnumType.skinCovering())), - .mock("predators", - type: .nonNull(.list(.nonNull(.entity(GraphQLInterfaceType.mock("Animal")))))), - .mock("bodyTemperature", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("humanName", - type: .scalar(GraphQLScalarType.string())), - .mock("favoriteToy", - type: .nonNull(.scalar(GraphQLScalarType.string()))), - .mock("owner", - type: .entity(GraphQLObjectType.mock("Human"))), - ], - typeCases: [], - fragments: [ - .mock("HeightInMeters", type: GraphQLInterfaceType.mock("Animal")), - .mock("WarmBloodedDetails", type: GraphQLInterfaceType.mock("WarmBlooded")), - .mock("PetDetails", type: GraphQLInterfaceType.mock("Pet")), - ] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Bird"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__directSelections_AllAnimalsQuery_AllAnimal_AsClassroomPet_AsBird_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "ClassroomPet"]?[as: "Bird"]?[field: "height"]?.selectionSet - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(beNil()) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsClassroomPet_AsBird_Height__isCorrect() throws { - // given - let operation = compilationResult.operations.first { $0.name == "AllAnimalsQuery" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[as: "ClassroomPet"]?[as: "Bird"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("inches", - type: .scalar(GraphQLScalarType.integer())), - .mock("meters", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - .mock("relativeSize", - type: .nonNull(.enum(GraphQLEnumType.relativeSize()))), - .mock("centimeters", - type: .nonNull(.scalar(GraphQLScalarType.float()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.merged - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } - - func test__mergedSelections_AllAnimalsQuery_AllAnimal_AsClassroomPet_AsBird_Height__isCorrect_CCN() throws { - // given - let enableCCN = true - - compilationResult = try! Self.frontend.compile( - schema: Self.schema, - document: Self.operationCCNDocuments( - experimentalClientControlledNullability: enableCCN - ), - validationOptions: ValidationOptions( - config: .init( - config: .mock(experimentalFeatures: .init(clientControlledNullability: enableCCN)) - ) - ) - ) - let operation = compilationResult.operations.first { $0.name == "AllAnimalsCCN" } - let ir = IR.mock(compilationResult: compilationResult) - let rootSelectionSet = ir.build(operation: try XCTUnwrap(operation)).rootField.selectionSet! - - let selectionSet = try XCTUnwrap( - rootSelectionSet[field: "allAnimals"]?[field: "height"]?.selectionSet - ) - - expected = ( - fields: [ - .mock("feet", - type: .scalar(GraphQLScalarType.integer())), - .mock("inches", - type: .nonNull(.scalar(GraphQLScalarType.integer()))), - ], - typeCases: [], - fragments: [] - ) - - // when - let actual = selectionSet.selections.direct - - // then - expect(selectionSet.parentType).to(equal(GraphQLObjectType.mock("Height"))) - expect(actual).to(shallowlyMatch(self.expected)) - } -} diff --git a/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift b/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift deleted file mode 100644 index a8566b4cf2..0000000000 --- a/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift +++ /dev/null @@ -1,1063 +0,0 @@ -import XCTest -import Nimble -import ApolloCodegenLib - -class ApolloCodegenConfigurationCodableTests: XCTestCase { - - // MARK: - ApolloCodegenConfiguration Tests - - var testJSONEncoder: JSONEncoder! - - override func setUp() { - super.setUp() - testJSONEncoder = JSONEncoder() - testJSONEncoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] - } - - override func tearDown() { - testJSONEncoder = nil - super.tearDown() - } - - enum MockApolloCodegenConfiguration { - static var decodedStruct: ApolloCodegenConfiguration { - .init( - schemaNamespace: "SerializedSchema", - input: .init( - schemaPath: "/path/to/schema.graphqls", - operationSearchPaths: [ - "/search/path/**/*.graphql" - ] - ), - output: .init( - schemaTypes: .init( - path: "/output/path", - moduleType: .embeddedInTarget(name: "SomeTarget", accessModifier: .public) - ), - operations: .absolute(path: "/absolute/path", accessModifier: .internal), - testMocks: .swiftPackage(targetName: "SchemaTestMocks") - ), - options: .init( - additionalInflectionRules: [ - .pluralization(singularRegex: "animal", replacementRegex: "animals") - ], - deprecatedEnumCases: .exclude, - schemaDocumentation: .exclude, - cocoapodsCompatibleImportStatements: true, - warningsOnDeprecatedUsage: .exclude, - conversionStrategies:.init( - enumCases: .none, - fieldAccessors: .camelCase - ), - pruneGeneratedFiles: false, - markOperationDefinitionsAsFinal: true - ), - experimentalFeatures: .init( - clientControlledNullability: true, - legacySafelistingCompatibleOperations: true - ), - operationManifest: .init( - path: "/operation/identifiers/path", - version: .persistedQueries, - generateManifestOnCodeGeneration: false - ) - ) - } - - static var encodedJSON: String { - """ - { - "experimentalFeatures" : { - "clientControlledNullability" : true, - "legacySafelistingCompatibleOperations" : true - }, - "input" : { - "operationSearchPaths" : [ - "/search/path/**/*.graphql" - ], - "schemaSearchPaths" : [ - "/path/to/schema.graphqls" - ] - }, - "operationManifest" : { - "generateManifestOnCodeGeneration" : false, - "path" : "/operation/identifiers/path", - "version" : "persistedQueries" - }, - "options" : { - "additionalInflectionRules" : [ - { - "pluralization" : { - "replacementRegex" : "animals", - "singularRegex" : "animal" - } - } - ], - "cocoapodsCompatibleImportStatements" : true, - "conversionStrategies" : { - "enumCases" : "none", - "fieldAccessors" : "camelCase" - }, - "deprecatedEnumCases" : "exclude", - "markOperationDefinitionsAsFinal" : true, - "operationDocumentFormat" : [ - "definition" - ], - "pruneGeneratedFiles" : false, - "schemaDocumentation" : "exclude", - "selectionSetInitializers" : { - "localCacheMutations" : true - }, - "warningsOnDeprecatedUsage" : "exclude" - }, - "output" : { - "operations" : { - "absolute" : { - "accessModifier" : "internal", - "path" : "/absolute/path" - } - }, - "schemaTypes" : { - "moduleType" : { - "embeddedInTarget" : { - "accessModifier" : "public", - "name" : "SomeTarget" - } - }, - "path" : "/output/path" - }, - "testMocks" : { - "swiftPackage" : { - "targetName" : "SchemaTestMocks" - } - } - }, - "schemaNamespace" : "SerializedSchema" - } - """ - } - } - - func test__encodeApolloCodegenConfiguration__givenAllParameters_shouldReturnJSON() throws { - // given - let subject = MockApolloCodegenConfiguration.decodedStruct - - // when - let encodedJSON = try testJSONEncoder.encode(subject) - let actual = encodedJSON.asString - - // then - expect(actual).to(equalLineByLine(MockApolloCodegenConfiguration.encodedJSON)) - } - - func test__decodeApolloCodegenConfiguration__givenAllParameters_shouldReturnStruct() throws { - // given - let subject = MockApolloCodegenConfiguration.encodedJSON.asData - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - - // then - expect(actual).to(equal(MockApolloCodegenConfiguration.decodedStruct)) - } - - func test__decodeApolloCodegenConfiguration__givenOnlyRequiredParameters_shouldReturnStruct() throws { - // given - let subject = """ - { - "input" : { - "operationSearchPaths" : [ - "/search/path/**/*.graphql" - ], - "schemaSearchPaths" : [ - "/path/to/schema.graphqls" - ] - }, - "output" : { - "operations" : { - "absolute" : { - "path" : "/absolute/path" - } - }, - "schemaTypes" : { - "moduleType" : { - "embeddedInTarget" : { - "name" : "SomeTarget" - } - }, - "path" : "/output/path" - }, - "testMocks" : { - "swiftPackage" : { - "targetName" : "SchemaTestMocks" - } - } - }, - "schemaNamespace" : "SerializedSchema" - } - """.asData - - let expected = ApolloCodegenConfiguration.init( - schemaNamespace: "SerializedSchema", - input: .init( - schemaSearchPaths: ["/path/to/schema.graphqls"], - operationSearchPaths: ["/search/path/**/*.graphql"] - ), - output: .init( - schemaTypes: .init( - path: "/output/path", - moduleType: .embeddedInTarget(name: "SomeTarget") - ), - operations: .absolute(path: "/absolute/path"), - testMocks: .swiftPackage(targetName: "SchemaTestMocks") - ) - ) - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloCodegenConfiguration__givenOnlyRequiredParameters_withDeprecatedSchemaNameProperty_shouldReturnStruct() throws { - // given - let subject = """ - { - "input" : { - "operationSearchPaths" : [ - "/search/path/**/*.graphql" - ], - "schemaSearchPaths" : [ - "/path/to/schema.graphqls" - ] - }, - "output" : { - "operations" : { - "absolute" : { - "path" : "/absolute/path" - } - }, - "schemaTypes" : { - "moduleType" : { - "embeddedInTarget" : { - "name" : "SomeTarget" - } - }, - "path" : "/output/path" - }, - "testMocks" : { - "swiftPackage" : { - "targetName" : "SchemaTestMocks" - } - } - }, - "schemaName" : "SerializedSchema" - } - """.asData - - let expected = ApolloCodegenConfiguration.init( - schemaNamespace: "SerializedSchema", - input: .init( - schemaSearchPaths: ["/path/to/schema.graphqls"], - operationSearchPaths: ["/search/path/**/*.graphql"] - ), - output: .init( - schemaTypes: .init( - path: "/output/path", - moduleType: .embeddedInTarget(name: "SomeTarget") - ), - operations: .absolute(path: "/absolute/path"), - testMocks: .swiftPackage(targetName: "SchemaTestMocks") - ) - ) - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloCodegenConfiguration__givenMissingRequiredParameters_shouldThrow() throws { - // given - let subject = """ - { - "input" : { - }, - "output" : { - } - } - """.asData - - // then - expect(try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject)) - .to(throwError()) - } - - func test__encodeMinimalConfigurationStruct__canBeDecoded() throws { - let config = ApolloCodegenConfiguration( - schemaNamespace: "MinimalSchema", - input: .init(schemaPath: "/path/to/schema.graphqls"), - output: .init(schemaTypes: .init( - path: "/output/path", - moduleType: .embeddedInTarget(name: "SomeTarget") - )) - ) - - let encodedConfig = try testJSONEncoder.encode(config) - - expect(try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: encodedConfig)) - .toNot(throwError()) - } - - // MARK: - Composition Tests - - func encodedValue(_ case: ApolloCodegenConfiguration.Composition) -> String { - switch `case` { - case .include: return "\"include\"" - case .exclude: return "\"exclude\"" - } - } - - func test__encodeComposition__givenInclude_shouldReturnString() throws { - // given - let subject = ApolloCodegenConfiguration.Composition.include - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(encodedValue(.include))) - } - - func test__encodeComposition__givenExclude_shouldReturnString() throws { - // given - let subject = ApolloCodegenConfiguration.Composition.exclude - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(encodedValue(.exclude))) - } - - func test__decodeComposition__givenInclude_shouldReturnEnum() throws { - // given - let subject = encodedValue(.include).asData - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.Composition.self, from: subject) - - // then - expect(actual).to(equal(.include)) - } - - func test__decodeComposition__givenExclude_shouldReturnEnum() throws { - // given - let subject = encodedValue(.exclude).asData - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.Composition.self, from: subject) - - // then - expect(actual).to(equal(.exclude)) - } - - func test__decodeComposition__givenUnknown_shouldThrow() throws { - // given - let subject = "\"unknown\"".asData - - // then - expect( - try JSONDecoder().decode(ApolloCodegenConfiguration.Composition.self, from: subject) - ).to(throwError()) - } - - // MARK: - Selection Set Initializers Tests - - func test__encode_selectionSetInitializers__givenOperations_shouldReturnObjectString() throws { - // given - let subject: ApolloCodegenConfiguration.SelectionSetInitializers = [.operations] - - let expected = """ - { - "operations" : true - } - """ - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(expected)) - } - - func test__decode_selectionSetInitializers__givenOperations_shouldReturnOptions() throws { - // given - let subject = """ - { - "operations": true - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal(.operations)) - } - - func test__decode_selectionSetInitializers__givenOperations_false_shouldReturnEmptyOptions() throws { - // given - let subject = """ - { - "operations": false - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal([])) - } - - func test__encode_selectionSetInitializers__givenNamedFragments_shouldReturnObjectString() throws { - // given - let subject: ApolloCodegenConfiguration.SelectionSetInitializers = [.namedFragments] - - let expected = """ - { - "namedFragments" : true - } - """ - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(expected)) - } - - func test__decode_selectionSetInitializers__givenNamedFragments_shouldReturnOptions() throws { - // given - let subject = """ - { - "namedFragments": true - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal(.namedFragments)) - } - - func test__decode_selectionSetInitializers__givenNamedFragments_false_shouldReturnEmptyOptions() throws { - // given - let subject = """ - { - "namedFragments": false - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal([])) - } - - func test__encode_selectionSetInitializers__givenLocalCacheMutations_shouldReturnObjectString() throws { - // given - let subject: ApolloCodegenConfiguration.SelectionSetInitializers = [.localCacheMutations] - - let expected = """ - { - "localCacheMutations" : true - } - """ - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(expected)) - } - - func test__decode_selectionSetInitializers__givenLocalCacheMutations_shouldReturnOptions() throws { - // given - let subject = """ - { - "localCacheMutations": true - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal(.localCacheMutations)) - } - - func test__decode_selectionSetInitializers__givenLocalCacheMutations_false_shouldReturnEmptyOptions() throws { - // given - let subject = """ - { - "localCacheMutations": false - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal([])) - } - - func test__encode_selectionSetInitializers__givenAll_shouldReturnObjectString() throws { - // given - let subject: ApolloCodegenConfiguration.SelectionSetInitializers = .all - - let expected = """ - { - "localCacheMutations" : true, - "namedFragments" : true, - "operations" : true - } - """ - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(expected)) - } - - func test__decode_selectionSetInitializers__givenAll_shouldReturnObjectString() throws { - // given - let subject = """ - { - "operations" : true, - "namedFragments" : true, - "localCacheMutations" : true - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal(.all)) - } - - func test__encode_selectionSetInitializers__givenDefinitionList_shouldReturnObjectString() throws { - // given - let subject: ApolloCodegenConfiguration.SelectionSetInitializers = [ - .namedFragments, - .operation(named: "Operation1"), - .operation(named: "Operation2") - ] - - let expected = """ - { - "definitionsNamed" : [ - "Operation1", - "Operation2" - ], - "namedFragments" : true - } - """ - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(expected)) - } - - func test__decode_selectionSetInitializers__givenOperations_asList_shouldReturnOptions() throws { - // given - let subject = """ - { - "namedFragments" : true, - "definitionsNamed" : [ - "Operation1", - "Operation2" - ] - } - """.asData - - let expected: ApolloCodegenConfiguration.SelectionSetInitializers = [ - .namedFragments, - .operation(named: "Operation1"), - .operation(named: "Operation2") - ] - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.SelectionSetInitializers.self, - from: subject - ) - - // then - expect(decoded).to(equal(expected)) - } - - // MARK: - OperationDocumentFormat Tests - - func encodedValue(_ case: ApolloCodegenConfiguration.OperationDocumentFormat) -> String { - switch `case` { - case .definition: - return """ - [ - "definition" - ] - """ - case .operationId: - return """ - [ - "operationId" - ] - """ - case [.definition, .operationId]: - return """ - [ - "definition", - "operationId" - ] - """ - default: - XCTFail("Invalid Definition") - return "" - } - } - - func test__encodeOperationDocumentFormat__givenDefinition_shouldReturnStringArray() throws { - // given - let subject = ApolloCodegenConfiguration.OperationDocumentFormat.definition - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equalLineByLine(encodedValue(.definition))) - } - - func test__encodeOperationDocumentFormat__givenOperationId_shouldReturnStringArray() throws { - // given - let subject = ApolloCodegenConfiguration.OperationDocumentFormat.operationId - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(encodedValue(.operationId))) - } - - func test__encodeOperationDocumentFormat__givenBoth_shouldReturnStringArray() throws { - // given - let subject: ApolloCodegenConfiguration.OperationDocumentFormat = [ - .definition, .operationId - ] - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(encodedValue([.definition, .operationId]))) - } - - func test__decodeOperationDocumentFormat__givenDefinition_shouldReturnOptionSet() throws { - // given - let subject = encodedValue(.definition).asData - - // when - let actual = try JSONDecoder().decode( - ApolloCodegenConfiguration.OperationDocumentFormat.self, - from: subject - ) - - // then - expect(actual).to(equal(.definition)) - } - - func test__decodeOperationDocumentFormat__givenOperationId_shouldReturnOptionSet() throws { - // given - let subject = encodedValue(.operationId).asData - - // when - let actual = try JSONDecoder().decode( - ApolloCodegenConfiguration.OperationDocumentFormat.self, - from: subject - ) - - // then - expect(actual).to(equal(.operationId)) - } - - func test__decodeOperationDocumentFormat__givenBoth_shouldReturnOptionSet() throws { - // given - let subject = encodedValue([.definition, .operationId]).asData - - // when - let actual = try JSONDecoder().decode( - ApolloCodegenConfiguration.OperationDocumentFormat.self, - from: subject - ) - - // then - expect(actual).to(equal([.definition, .operationId])) - } - - func test__decodeOperationDocumentFormat__givenUnknown_shouldThrow() throws { - // given - let subject = "\"unknown\"".asData - - // then - expect( - try JSONDecoder().decode( - ApolloCodegenConfiguration.OperationDocumentFormat.self, - from: subject - ) - ).to(throwError()) - } - - func test__decodeOperationDocumentFormat__givenEmptyArray_shouldThrow() throws { - // given - let subject = "[]".asData - - // then - expect( - try JSONDecoder().decode( - ApolloCodegenConfiguration.OperationDocumentFormat.self, - from: subject - ) - ).to(throwError()) - } - - // MARK: - APQConfig Tests - - func encodedValue(_ case: ApolloCodegenConfiguration.APQConfig) -> String { - switch `case` { - case .disabled: return "\"disabled\"" - case .automaticallyPersist: return "\"automaticallyPersist\"" - case .persistedOperationsOnly: return "\"persistedOperationsOnly\"" - } - } - - @available(*, deprecated, message: "Testing deprecated APQConfig") - func test__decodeAPQConfig__givenDisabled_shouldReturnEnum() throws { - // given - let subject = encodedValue(.disabled).asData - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.APQConfig.self, from: subject) - - // then - expect(actual).to(equal(.disabled)) - } - - @available(*, deprecated, message: "Testing deprecated APQConfig") - func test__decodeAPQConfig__givenAutomaticallyPersist_shouldReturnEnum() throws { - // given - let subject = encodedValue(.automaticallyPersist).asData - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.APQConfig.self, from: subject) - - // then - expect(actual).to(equal(.automaticallyPersist)) - } - - @available(*, deprecated, message: "Testing deprecated APQConfig") - func test__decodeAPQConfig__givenPersistedOperationsOnly_shouldReturnEnum() throws { - // given - let subject = encodedValue(.persistedOperationsOnly).asData - - // when - let actual = try JSONDecoder().decode(ApolloCodegenConfiguration.APQConfig.self, from: subject) - - // then - expect(actual).to(equal(.persistedOperationsOnly)) - } - - @available(*, deprecated, message: "Testing deprecated APQConfig") - func test__decodeAPQConfig__givenUnknown_shouldThrow() throws { - // given - let subject = "\"unknown\"".asData - - // then - expect( - try JSONDecoder().decode(ApolloCodegenConfiguration.APQConfig.self, from: subject) - ).to(throwError()) - } - - // MARK: - Optional Tests - - func test__decodeTestMockFileOutput__givenAbsoluteWithAccessModifier_shouldReturnEnum() throws { - // given - let subject = """ - { - "absolute" : { - "path" : "x", - "accessModifier" : "internal" - } - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.TestMockFileOutput.self, - from: subject - ) - - // then - expect(decoded).to( - equal(ApolloCodegenConfiguration.TestMockFileOutput.absolute( - path: "x", - accessModifier: .internal - )) - ) - } - - func test__decodeTestMockFileOutput__givenAbsoluteMissingAccessModifier_shouldReturnEnumWithDefaultAccessModifier() throws { - // given - let subject = """ - { - "absolute" : { - "path" : "y" - } - } - """.asData - - // when - let decoded = try JSONDecoder().decode( - ApolloCodegenConfiguration.TestMockFileOutput.self, - from: subject - ) - - // then - expect(decoded).to( - equal(ApolloCodegenConfiguration.TestMockFileOutput.absolute( - path: "y", - accessModifier: .public - )) - ) - } - - func test__decodeApolloCodegenConfiguration__withInvalidFileOutput() throws { - // given - let subject = """ - { - "schemaName": "MySchema", - "input": { - "operationSearchPaths": ["/search/path/**/*.graphql"], - "schemaSearchPaths": ["/path/to/schema.graphqls"] - }, - "output": { - "testMocks": { - "none": {} - }, - "schemaTypes": { - "path": "./MySchema", - "moduleType": { - "swiftPackageManager": {} - } - }, - "operations": { - "inSchemaModule": {} - }, - "options": { - "selectionSetInitializers" : { - "operations": true, - "namedFragments": true, - "localCacheMutations" : true - }, - "queryStringLiteralFormat": "multiline", - "schemaDocumentation": "include", - "apqs": "disabled", - "warningsOnDeprecatedUsage": "include" - } - } - } - """.asData - - func decodeConfiguration(subject: Data) throws -> ApolloCodegenConfiguration { - try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - } - XCTAssertThrowsError(try decodeConfiguration(subject: subject)) { error in - guard case let DecodingError.typeMismatch(type, context) = error else { return fail("Incorrect error type") } - XCTAssertEqual("\(type)", String(describing: ApolloCodegenConfiguration.FileOutput.self)) - XCTAssertEqual(context.debugDescription, "Unrecognized key found: options") - } - } - - func test__decodeApolloCodegenConfiguration__withInvalidOptions() throws { - // given - let subject = """ - { - "schemaName": "MySchema", - "input": { - "operationSearchPaths": ["/search/path/**/*.graphql"], - "schemaSearchPaths": ["/path/to/schema.graphqls"] - }, - "output": { - "testMocks": { - "none": {} - }, - "schemaTypes": { - "path": "./MySchema", - "moduleType": { - "swiftPackageManager": {} - } - }, - "operations": { - "inSchemaModule": {} - } - }, - "options": { - "secret_feature": "flappy_bird", - "selectionSetInitializers" : { - "operations": true, - "namedFragments": true, - "localCacheMutations" : true - }, - "queryStringLiteralFormat": "multiline", - "schemaDocumentation": "include", - "apqs": "disabled", - "warningsOnDeprecatedUsage": "include" - } - } - """.asData - - func decodeConfiguration(subject: Data) throws -> ApolloCodegenConfiguration { - try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - } - XCTAssertThrowsError(try decodeConfiguration(subject: subject)) { error in - guard case let DecodingError.typeMismatch(type, context) = error else { return fail("Incorrect error type") } - XCTAssertEqual("\(type)", String(describing: ApolloCodegenConfiguration.OutputOptions.self)) - XCTAssertEqual(context.debugDescription, "Unrecognized key found: secret_feature") - } - } - - func test__decodeApolloCodegenConfiguration__withInvalidBaseConfiguration() throws { - // given - let subject = """ - { - "contact_info": "42 Wallaby Way, Sydney", - "schemaName": "MySchema", - "input": { - "operationSearchPaths": ["/search/path/**/*.graphql"], - "schemaSearchPaths": ["/path/to/schema.graphqls"] - }, - "output": { - "testMocks": { - "none": {} - }, - "schemaTypes": { - "path": "./MySchema", - "moduleType": { - "swiftPackageManager": {} - } - }, - "operations": { - "inSchemaModule": {} - } - }, - "options": { - "selectionSetInitializers" : { - "operations": true, - "namedFragments": true, - "localCacheMutations" : true - }, - "queryStringLiteralFormat": "multiline", - "schemaDocumentation": "include", - "apqs": "disabled", - "warningsOnDeprecatedUsage": "include" - } - } - """.asData - - func decodeConfiguration(subject: Data) throws -> ApolloCodegenConfiguration { - try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - } - XCTAssertThrowsError(try decodeConfiguration(subject: subject)) { error in - guard case let DecodingError.typeMismatch(type, context) = error else { return fail("Incorrect error type") } - XCTAssertEqual("\(type)", String(describing: ApolloCodegenConfiguration.self)) - XCTAssertEqual(context.debugDescription, "Unrecognized key found: contact_info") - } - } - - func test__decodeApolloCodegenConfiguration__withInvalidBaseConfiguration_multipleErrors() throws { - // given - let subject = """ - { - "contact_info": "42 Wallaby Way, Sydney", - "motto": "Just keep swimming", - "schemaName": "MySchema", - "input": { - "operationSearchPaths": ["/search/path/**/*.graphql"], - "schemaSearchPaths": ["/path/to/schema.graphqls"] - }, - "output": { - "testMocks": { - "none": {} - }, - "schemaTypes": { - "path": "./MySchema", - "moduleType": { - "swiftPackageManager": {} - } - }, - "operations": { - "inSchemaModule": {} - } - }, - "options": { - "selectionSetInitializers" : { - "operations": true, - "namedFragments": true, - "localCacheMutations" : true - }, - "queryStringLiteralFormat": "multiline", - "schemaDocumentation": "include", - "apqs": "disabled", - "warningsOnDeprecatedUsage": "include" - } - } - """.asData - - func decodeConfiguration(subject: Data) throws -> ApolloCodegenConfiguration { - try JSONDecoder().decode(ApolloCodegenConfiguration.self, from: subject) - } - XCTAssertThrowsError(try decodeConfiguration(subject: subject)) { error in - guard case let DecodingError.typeMismatch(type, context) = error else { return fail("Incorrect error type") } - XCTAssertEqual("\(type)", String(describing: ApolloCodegenConfiguration.self)) - XCTAssertEqual(context.debugDescription, "Unrecognized keys found: contact_info, motto") - } - } -} diff --git a/Tests/ApolloCodegenTests/ApolloCodegenConfigurationTests.swift b/Tests/ApolloCodegenTests/ApolloCodegenConfigurationTests.swift deleted file mode 100644 index 9229f2231b..0000000000 --- a/Tests/ApolloCodegenTests/ApolloCodegenConfigurationTests.swift +++ /dev/null @@ -1,88 +0,0 @@ -import XCTest -@testable import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib -import Nimble - -class ApolloCodegenConfigurationTests: XCTestCase { - - var directoryURL: URL! - var filename: String! - var fileURL: URL! - var input: ApolloCodegenConfiguration.FileInput! - var output: ApolloCodegenConfiguration.FileOutput! - var config: ApolloCodegenConfiguration! - - // MARK: Lifecycle - - override func setUpWithError() throws { - try super.setUpWithError() - directoryURL = CodegenTestHelper.outputFolderURL() - .appendingPathComponent("Configuration") - .appendingPathComponent(self.testRun!.test.name) - - try ApolloFileManager.default.createDirectoryIfNeeded(atPath: directoryURL.path) - - filename = UUID().uuidString - fileURL = directoryURL.appendingPathComponent(filename) - - input = .init(schemaPath: fileURL.path) - output = .init(schemaTypes: .init(path: directoryURL.path, moduleType: .embeddedInTarget(name: "MockApplication"))) - } - - override func tearDownWithError() throws { - try ApolloFileManager.default.deleteDirectory(atPath: directoryURL.path) - - config = nil - output = nil - input = nil - directoryURL = nil - fileURL = nil - filename = nil - - try super.tearDownWithError() - } - - // MARK: Test Helpers - - func buildConfig() { - config = ApolloCodegenConfiguration.mock( - input: input, - output: output - ) - } - - // MARK: Initializer Tests - - func test__initializer__givenMinimalFileInput_buildsDefaults() { - // given - let input = ApolloCodegenConfiguration.FileInput() - - // then - expect(input.schemaSearchPaths).to(equal(["**/*.graphqls"])) - expect(input.operationSearchPaths).to(equal(["**/*.graphql"])) - } - - func test__initializer__givenMinimalFileOutput_buildsCorrectDefaults() { - // given - let output = ApolloCodegenConfiguration.FileOutput( - schemaTypes: .init(path: directoryURL.path, moduleType: .other) - ) - - // then - expect(output.operations).to(equal(.inSchemaModule)) - } - - func test__initializer__givenMinimalApolloCodegenConfiguration_buildsCorrectDefaults() { - // given - let config = ApolloCodegenConfiguration( - schemaNamespace: "MockSchema", - input: .init(schemaPath: fileURL.path), - output: .init(schemaTypes: .init(path: directoryURL.path, moduleType: .other)) - ) - - // then - expect(config.options.additionalInflectionRules).to(beEmpty()) - expect(config.options.deprecatedEnumCases).to(equal(.include)) - expect(config.options.schemaDocumentation).to(equal(.include)) - } -} diff --git a/Tests/ApolloCodegenTests/ApolloCodegenTests.swift b/Tests/ApolloCodegenTests/ApolloCodegenTests.swift deleted file mode 100644 index 8fe421e4e6..0000000000 --- a/Tests/ApolloCodegenTests/ApolloCodegenTests.swift +++ /dev/null @@ -1,3028 +0,0 @@ -import XCTest -import ApolloInternalTestHelpers -@testable import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib -import Nimble - -class ApolloCodegenTests: XCTestCase { - private var directoryURL: URL { testFileManager.directoryURL } - private var testFileManager: TestIsolatedFileManager! - - override func setUpWithError() throws { - testFileManager = try testIsolatedFileManager() - - testFileManager.fileManager.changeCurrentDirectoryPath(directoryURL.path) - } - - override func tearDownWithError() throws { - testFileManager = nil - } - - // MARK: Helpers - - private let schemaData: Data = { - """ - type Query { - books: [Book!]! - authors: [Author!]! - } - - type Mutation { - books: [Book!]! - authors: [Author!]! - } - - type Subscription { - books: [Book!]! - authors: [Author!]! - } - - type Book { - title: String! - author: Author! - } - - type Author { - name: String! - books: [Book!]! - } - """ - }().data(using: .utf8)! - - /// Creates a file in the test directory. - /// - /// - Parameters: - /// - data: File content - /// - filename: Target name of the file. This should not include any path information - /// - /// - Returns: - /// - The full path of the created file. - @discardableResult - private func createFile( - containing data: Data, - named filename: String, - inDirectory directory: String? = nil - ) throws -> String { - return try self.testFileManager.createFile( - containing: data, - named: filename, - inDirectory: directory - ) - } - - @discardableResult - private func createFile( - body: @autoclosure () -> String = "Test File", - filename: String, - inDirectory directory: String? = nil - ) throws -> String { - return try self.testFileManager.createFile( - body: body(), - named: filename, - inDirectory: directory - ) - } - - @discardableResult - private func createOperationFile( - type: CompilationResult.OperationType, - named operationName: String, - filename: String, - inDirectory directory: String? = nil - ) throws -> String { - let query: String = - """ - \(type.rawValue) \(operationName) { - books { - title - } - } - """ - return try createFile(body: query, filename: filename, inDirectory: directory) - } - - // MARK: CompilationResult Tests - - func test_compileResults_givenOperation_withGraphQLErrors_shouldThrow() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let operationData: Data = - """ - query getBooks { - books { - title - name - } - } - """.data(using: .utf8)! - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaPath: schemaPath, - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - // with - // - // Fetching `books.name` will cause a GraphQL validation error because `name` - // is not a property of the `Book` type. - - // then - expect(try ApolloCodegen.compileGraphQLResult(config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.graphQLSourceValidationFailure(lines) = error else { - fail("Expected .graphQLSourceValidationFailure, got .\(error)") - return - } - expect(lines).notTo(beEmpty()) - }) - } - - func test_compileResults_givenOperations_withNoErrors_shouldReturn() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let booksData: Data = - """ - query getBooks { - books { - title - } - } - """.data(using: .utf8)! - try createFile(containing: booksData, named: "books-operation.graphql") - - let authorsData: Data = - """ - query getAuthors { - authors { - name - } - } - """.data(using: .utf8)! - try createFile(containing: authorsData, named: "authors-operation.graphql") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaPath: schemaPath, - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config).operations).to(haveCount(2)) - } - - func test_compileResults_givenRelativeSearchPath_relativeToRootURL_hasOperations_shouldReturnOperationsRelativeToRoot() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let rootURL = directoryURL.appendingPathComponent("CustomRoot") - - let booksData: Data = - """ - query getBooks { - books { - title - } - } - """.data(using: .utf8)! - try createFile(containing: booksData, named: "books-operation.graphql", inDirectory: "CustomRoot") - - let authorsData: Data = - """ - query getAuthors { - authors { - name - } - } - """.data(using: .utf8)! - try createFile(containing: authorsData, named: "authors-operation.graphql") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaPath: schemaPath, - operationSearchPaths: ["./**/*.graphql"] - )), rootURL: rootURL) - - let actual = try ApolloCodegen.compileGraphQLResult(config).operations - - // then - expect(actual).to(haveCount(1)) - expect(actual.first?.name).to(equal("getBooks")) - } - - func test_CCN_compileResults_givenOperations_withNoErrors_shouldReturn() throws { - let schemaData: Data = { - """ - type Query { - author: Author - } - - type Author { - name: String - age: Int - } - """ - }().data(using: .utf8)! - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let authorsData: Data = - """ - query getAuthors { - author! { - name! - } - } - """.data(using: .utf8)! - try createFile(containing: authorsData, named: "authors-operation.graphql") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaPath: schemaPath, - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - let compiledDocument = try ApolloCodegen.compileGraphQLResult( - config, - experimentalFeatures: .init(clientControlledNullability: true) - ) - - // then - expect(compiledDocument.operations).to(haveCount(1)) - } - - func test_CCN_compileResults_givenOperations_withErrors_shouldError() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let authorsData: Data = - """ - query getAuthors { - authors { - name! - } - } - """.data(using: .utf8)! - try createFile(containing: authorsData, named: "authors-operation.graphql") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaPath: schemaPath, - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config).operations).to(throwError { error in - guard let error = error as? GraphQLError else { - fail("Expected .graphQLSourceValidationFailure because we attempted to compile a document that uses CCN without CCN enabled, got \(error)") - return - } - expect(error.message).to(equal("Syntax Error: Expected Name, found \"!\".")) - }) - } - - func test_compileResults_givenRelativeSchemaSearchPath_relativeToRootURL_shouldReturnSchemaRelativeToRoot() throws { - // given - try createFile( - body: """ - type QueryTwo { - string: String! - } - """, - filename: "schema1.graphqls") - - try createFile(containing: schemaData, named: "schema.graphqls", inDirectory: "CustomRoot") - - try createFile( - body: """ - query getAuthors { - authors { - name - } - } - """, - filename: "TestQuery.graphql") - - let rootURL = directoryURL.appendingPathComponent("CustomRoot") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaSearchPaths: ["./**/*.graphqls"], - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: rootURL) - - let actual = try ApolloCodegen.compileGraphQLResult(config) - - // then - expect(actual.operations).to(haveCount(1)) - expect(actual.referencedTypes).to(haveCount(3)) - } - - func test__compileResults__givenMultipleSchemaFiles_withDependentTypes_compilesResult() throws { - // given - try createFile( - body: """ - type Query { - books: [Book!]! - authors: [Author!]! - } - """, - filename: "schema1.graphqls") - - try createFile( - body: """ - type Book { - title: String! - author: Author! - } - - type Author { - name: String! - books: [Book!]! - } - """, - filename: "schema2.graphqls") - - try createFile( - body: """ - query getAuthors { - authors { - name - } - } - """, - filename: "TestQuery.graphql") - - // when - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaSearchPaths: [directoryURL.appendingPathComponent("schema*.graphqls").path], - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config).referencedTypes.count).to(equal(3)) - } - - func test__compileResults__givenMultipleSchemaFiles_withDifferentRootTypes_compilesResult() throws { - // given - try createFile( - body: """ - type Query { - string: String! - } - """, - filename: "schema1.graphqls") - - try createFile( - body: """ - type Subscription { - bool: Boolean! - } - """, - filename: "schema2.graphqls") - - try createFile( - body: """ - query TestQuery { - string - } - """, - filename: "TestQuery.graphql") - - try createFile( - body: """ - subscription TestSubscription { - bool - } - """, - filename: "TestSubscription.graphql") - - // when - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaSearchPaths: [directoryURL.appendingPathComponent("schema*.graphqls").path], - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - let result = try ApolloCodegen.compileGraphQLResult(config) - - // then - expect(result.operations.count).to(equal(2)) - } - - func test__compileResults__givenMultipleSchemaFiles_withSchemaTypeExtension_compilesResultWithExtension() throws { - // given - try createFile( - body: """ - type Query { - string: String! - } - """, - filename: "schema1.graphqls") - - try createFile( - body: """ - extend type Query { - bool: Boolean! - } - """, - filename: "schemaExtension.graphqls") - - try createFile( - body: """ - query TestQuery { - string - bool - } - """, - filename: "TestQuery.graphql") - - // when - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaSearchPaths: [directoryURL.appendingPathComponent("schema*.graphqls").path], - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - let result = try ApolloCodegen.compileGraphQLResult(config) - - // then - expect(result.operations.count).to(equal(1)) - } - - func test__compileResults__givenMultipleSchemaFilesWith_introspectionJSONSchema_withSchemaTypeExtension_compilesResultWithExtension() throws { - // given - let introspectionJSON = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - - try createFile(body: introspectionJSON, filename: "schemaJSON.json") - - try createFile( - body: """ - extend type Query { - testExtensionField: Boolean! - } - """, - filename: "schemaExtension.graphqls") - - try createFile( - body: """ - query TestQuery { - testExtensionField - } - """, - filename: "TestQuery.graphql") - - // when - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaSearchPaths: [ - directoryURL.appendingPathComponent("schema*.graphqls").path, - directoryURL.appendingPathComponent("schema*.json").path, - ], - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - let result = try ApolloCodegen.compileGraphQLResult(config) - - // then - expect(result.operations.count).to(equal(1)) - } - - func test__compileResults__givenMultipleIntrospectionJSONSchemaFiles_throwsError() throws { - // given - let introspectionJSON = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - - try createFile(body: introspectionJSON, filename: "schemaJSON1.json") - try createFile(body: introspectionJSON, filename: "schemaJSON2.json") - - // when - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock(input: .init( - schemaSearchPaths: [ - directoryURL.appendingPathComponent("schema*.graphqls").path, - directoryURL.appendingPathComponent("schema*.json").path, - ], - operationSearchPaths: [directoryURL.appendingPathComponent("*.graphql").path] - )), rootURL: nil) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config)).to(throwError()) - } - - func test__compileResults__givenSchemaSearchPath_withNoMatches_throwsError() throws { - // given - let config = ApolloCodegen.ConfigurationContext(config: .mock( - input: .init(schemaPath: directoryURL.appendingPathComponent("file_does_not_exist").path))) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config)) - .to(throwError(ApolloCodegen.Error.cannotLoadSchema)) - } - - func test__compileResults__givenSchemaSearchPaths_withMixedMatches_doesNotThrowError() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let operationPath = try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let config = ApolloCodegen.ConfigurationContext(config: .mock( - input: .init( - schemaSearchPaths: [ - schemaPath, - directoryURL.appendingPathComponent("file_does_not_exist").path - ], - operationSearchPaths: [operationPath] - ))) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config)) - .notTo(throwError()) - } - - func test__compileResults__givenOperationSearchPath_withNoMatches_throwsError() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let config = ApolloCodegen.ConfigurationContext(config: .mock( - input: .init( - schemaPath: schemaPath, - operationSearchPaths: [directoryURL.appendingPathComponent("file_does_not_exist").path]))) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config)) - .to(throwError(ApolloCodegen.Error.cannotLoadOperations)) - } - - func test__compileResults__givenOperationSearchPaths_withMixedMatches_doesNotThrowError() throws { - // given - let schemaPath = try createFile(containing: schemaData, named: "schema.graphqls") - - let operationPath = try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let config = ApolloCodegen.ConfigurationContext(config: .mock( - input: .init( - schemaPath: schemaPath, - operationSearchPaths: [ - operationPath, - directoryURL.appendingPathComponent("file_does_not_exist").path - ]))) - - // then - expect(try ApolloCodegen.compileGraphQLResult(config)) - .notTo(throwError()) - } - - // MARK: File Generator Tests - - func test_fileGenerators_givenSchemaAndMultipleOperationDocuments_operations_inSchemaModule_shouldGenerateSchemaAndOperationsFiles() throws { - // given - let schemaPath = ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema.path - let operationsPath = ApolloCodegenInternalTestHelpers.Resources.url - .appendingPathComponent("animalkingdom-graphql") - .appendingPathComponent("*.graphql").path - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - schemaNamespace: "AnimalKingdomAPI", - input: .init( - schemaPath: schemaPath, - operationSearchPaths: [operationsPath] - ), - output: .mock( - moduleType: .swiftPackageManager, - operations: .inSchemaModule, - path: directoryURL.path - ) - ), rootURL: nil) - - let fileManager = MockApolloFileManager(strict: false) - - var filePaths: Set = [] - fileManager.mock(closure: .createFile({ path, data, attributes in - filePaths.insert(path) - return true - })) - - let expectedPaths: Set = [ - directoryURL.appendingPathComponent("Sources/Schema/SchemaMetadata.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/SchemaConfiguration.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/Pet.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/Animal.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/WarmBlooded.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/HousePet.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Enums/RelativeSize.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Unions/ClassroomPet.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/InputObjects/PetAdoptionInput.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/InputObjects/PetSearchFilters.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/InputObjects/MeasurementsInput.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Objects/Height.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Query.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Cat.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Human.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Bird.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Rat.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/PetRock.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Fish.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Crocodile.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Mutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Dog.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/CustomScalars/CustomDate.swift").path, - - directoryURL.appendingPathComponent("Sources/Operations/Queries/AllAnimalsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/ClassroomPetsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/DogQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Mutations/PetAdoptionMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Fragments/PetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/DogFragment.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/ClassroomPetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/HeightInMeters.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/WarmBloodedDetails.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/CrocodileFragment.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/LocalCacheMutations/PetDetailsMutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("Package.swift").path, - ] - - // when - let compilationResult = try ApolloCodegen.compileGraphQLResult(config) - - let ir = IR(compilationResult: compilationResult) - - try ApolloCodegen.generateFiles( - compilationResult: compilationResult, - ir: ir, - config: config, - fileManager: fileManager, - itemsToGenerate: [.code] - ) - - // then - expect(filePaths).to(equal(expectedPaths)) - expect(fileManager.allClosuresCalled).to(beTrue()) - } - - func test_fileGenerators_givenSchemaAndMultipleOperationDocuments_operations_absolute_shouldGenerateSchemaAndOperationsFiles() throws { - // given - let schemaPath = ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema.path - let operationsPath = ApolloCodegenInternalTestHelpers.Resources.url - .appendingPathComponent("animalkingdom-graphql") - .appendingPathComponent("*.graphql").path - - let operationsOutputURL = directoryURL.appendingPathComponent("AbsoluteSources") - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - schemaNamespace: "AnimalKingdomAPI", - input: .init( - schemaPath: schemaPath, - operationSearchPaths: [operationsPath] - ), - output: .mock( - moduleType: .swiftPackageManager, - operations: .absolute(path: operationsOutputURL.path), - path: directoryURL.path - ) - ), rootURL: nil) - - let fileManager = MockApolloFileManager(strict: false) - - var filePaths: Set = [] - fileManager.mock(closure: .createFile({ path, data, attributes in - filePaths.insert(path) - return true - })) - - let expectedPaths: Set = [ - directoryURL.appendingPathComponent("Sources/SchemaMetadata.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/SchemaConfiguration.swift").path, - - directoryURL.appendingPathComponent("Sources/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Interfaces/Pet.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Interfaces/Animal.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Interfaces/WarmBlooded.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Interfaces/HousePet.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Enums/RelativeSize.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Unions/ClassroomPet.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/InputObjects/PetAdoptionInput.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/InputObjects/PetSearchFilters.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/InputObjects/MeasurementsInput.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Height.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Query.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Cat.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Human.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Bird.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Rat.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/PetRock.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Fish.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Crocodile.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Mutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Objects/Dog.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/CustomScalars/CustomDate.swift").path, - - operationsOutputURL.appendingPathComponent("Queries/AllAnimalsQuery.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Queries/DogQuery.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Queries/AllAnimalsIncludeSkipQuery.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Queries/ClassroomPetsQuery.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Queries/PetSearchQuery.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Queries/PetSearchQuery.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Mutations/PetAdoptionMutation.graphql.swift").path, - - operationsOutputURL.appendingPathComponent("Fragments/PetDetails.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Fragments/DogFragment.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Fragments/ClassroomPetDetails.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Fragments/HeightInMeters.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Fragments/WarmBloodedDetails.graphql.swift").path, - operationsOutputURL.appendingPathComponent("Fragments/CrocodileFragment.graphql.swift").path, - - operationsOutputURL.appendingPathComponent("LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift").path, - operationsOutputURL.appendingPathComponent("LocalCacheMutations/PetDetailsMutation.graphql.swift").path, - operationsOutputURL.appendingPathComponent("LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("Package.swift").path, - ] - - // when - let compilationResult = try ApolloCodegen.compileGraphQLResult(config) - - let ir = IR(compilationResult: compilationResult) - - try ApolloCodegen.generateFiles( - compilationResult: compilationResult, - ir: ir, - config: config, - fileManager: fileManager, - itemsToGenerate: [.code] - ) - - // then - expect(filePaths).to(equal(expectedPaths)) - expect(fileManager.allClosuresCalled).to(beTrue()) - } - - func test_fileGenerators_givenSchemaAndMultipleOperationDocuments_shouldGenerateSchemaAndOperationsFiles_CCN() throws { - // given - let schemaPath = ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema.path - let operationsPath = ApolloCodegenInternalTestHelpers.Resources.url - .appendingPathComponent("animalkingdom-graphql") - .appendingPathComponent("**/*.graphql").path - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration( - schemaNamespace: "AnimalKingdomAPI", - input: .init(schemaPath: schemaPath, operationSearchPaths: [operationsPath]), - output: .mock( - moduleType: .swiftPackageManager, - operations: .inSchemaModule, - path: directoryURL.path - ) - ), rootURL: nil) - - let fileManager = MockApolloFileManager(strict: false) - - var filePaths: Set = [] - fileManager.mock(closure: .createFile({ path, data, attributes in - filePaths.insert(path) - return true - })) - - let expectedPaths: Set = [ - directoryURL.appendingPathComponent("Sources/Schema/SchemaMetadata.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/SchemaConfiguration.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/Pet.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/Animal.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/WarmBlooded.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Interfaces/HousePet.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Enums/RelativeSize.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Unions/ClassroomPet.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/InputObjects/PetAdoptionInput.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/InputObjects/PetSearchFilters.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/InputObjects/MeasurementsInput.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/Objects/Height.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Query.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Cat.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Human.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Bird.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Rat.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/PetRock.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Mutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Dog.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Fish.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Schema/Objects/Crocodile.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Schema/CustomScalars/CustomDate.swift").path, - - directoryURL.appendingPathComponent("Sources/Operations/Queries/AllAnimalsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/DogQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/ClassroomPetsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/AllAnimalsCCNQuery.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Operations/Queries/ClassroomPetsCCNQuery.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Operations/Mutations/PetAdoptionMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/Fragments/ClassroomPetDetailsCCN.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/PetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/DogFragment.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/ClassroomPetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/HeightInMeters.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/WarmBloodedDetails.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/Fragments/CrocodileFragment.graphql.swift").path, - - directoryURL.appendingPathComponent("Sources/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/LocalCacheMutations/PetDetailsMutation.graphql.swift").path, - directoryURL.appendingPathComponent("Sources/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("Package.swift").path, - ] - - // when - let compilationResult = try ApolloCodegen.compileGraphQLResult( - config, - experimentalFeatures: .init(clientControlledNullability: true) - ) - - let ir = IR(compilationResult: compilationResult) - - try ApolloCodegen.generateFiles( - compilationResult: compilationResult, - ir: ir, - config: config, - fileManager: fileManager, - itemsToGenerate: [.code] - ) - - // then - expect(filePaths).to(equal(expectedPaths)) - expect(fileManager.allClosuresCalled).to(beTrue()) - } - - func test_fileGenerators_givenTestMockOutput_absolutePath_shouldGenerateTestMocks() throws { - // given - let schemaPath = ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema.path - let operationsPath = ApolloCodegenInternalTestHelpers.Resources.url - .appendingPathComponent("animalkingdom-graphql") - .appendingPathComponent("**/*.graphql").path - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration( - schemaNamespace: "AnimalKingdomAPI", - input: .init(schemaPath: schemaPath, operationSearchPaths: [operationsPath]), - output: .init( - schemaTypes: .init(path: directoryURL.path, - moduleType: .swiftPackageManager), - operations: .inSchemaModule, - testMocks: .absolute(path: directoryURL.appendingPathComponent("TestMocks").path) - ) - ), rootURL: nil) - - let fileManager = MockApolloFileManager(strict: false) - - var filePaths: Set = [] - fileManager.mock(closure: .createFile({ path, data, attributes in - if path.contains("/TestMocks/") { - filePaths.insert(path) - } - return true - })) - - let expectedPaths: Set = [ - directoryURL.appendingPathComponent("TestMocks/Height+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Query+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Cat+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Human+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Bird+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Rat+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/PetRock+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Mutation+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Dog+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Fish+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/Crocodile+Mock.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/MockObject+Unions.graphql.swift").path, - directoryURL.appendingPathComponent("TestMocks/MockObject+Interfaces.graphql.swift").path, - ] - - // when - let compilationResult = try ApolloCodegen.compileGraphQLResult( - config, - experimentalFeatures: .init(clientControlledNullability: true) - ) - - let ir = IR(compilationResult: compilationResult) - - try ApolloCodegen.generateFiles( - compilationResult: compilationResult, - ir: ir, - config: config, - fileManager: fileManager, - itemsToGenerate: [.code] - ) - - // then - expect(filePaths).to(equal(expectedPaths)) - expect(fileManager.allClosuresCalled).to(beTrue()) - } - - // MARK: Custom Root URL Tests - - func test_fileGenerators_givenCustomRootDirectoryPath_operations_inSchemaModule__shouldGenerateFilesWithCustomRootPath() throws { - // given - let schemaPath = ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema.path - let operationsPath = ApolloCodegenInternalTestHelpers.Resources.url - .appendingPathComponent("animalkingdom-graphql") - .appendingPathComponent("*.graphql").path - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - schemaNamespace: "AnimalKingdomAPI", - input: .init( - schemaPath: schemaPath, - operationSearchPaths: [operationsPath] - ), - output: .mock( - moduleType: .swiftPackageManager, - operations: .inSchemaModule, - path: "./RelativePath" - ) - ), rootURL: directoryURL) - - let fileManager = MockApolloFileManager(strict: false) - - var filePaths: Set = [] - fileManager.mock(closure: .createFile({ path, data, attributes in - filePaths.insert(path) - return true - })) - - let expectedPaths: Set = [ - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/SchemaMetadata.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/SchemaConfiguration.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Interfaces/Pet.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Interfaces/Animal.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Interfaces/WarmBlooded.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Interfaces/HousePet.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Enums/RelativeSize.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Unions/ClassroomPet.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/InputObjects/PetAdoptionInput.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/InputObjects/PetSearchFilters.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/InputObjects/MeasurementsInput.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Height.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Query.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Cat.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Human.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Bird.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Rat.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/PetRock.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Fish.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Crocodile.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Mutation.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/Objects/Dog.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Schema/CustomScalars/CustomDate.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Queries/AllAnimalsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Queries/DogQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Queries/ClassroomPetsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Operations/Mutations/PetAdoptionMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Fragments/PetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Fragments/DogFragment.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Fragments/ClassroomPetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Fragments/HeightInMeters.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Fragments/WarmBloodedDetails.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Fragments/CrocodileFragment.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/LocalCacheMutations/PetDetailsMutation.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Package.swift").path, - ] - - // when - let compilationResult = try ApolloCodegen.compileGraphQLResult(config) - - let ir = IR(compilationResult: compilationResult) - - try ApolloCodegen.generateFiles( - compilationResult: compilationResult, - ir: ir, - config: config, - fileManager: fileManager, - itemsToGenerate: [.code] - ) - - // then - expect(filePaths).to(equal(expectedPaths)) - expect(fileManager.allClosuresCalled).to(beTrue()) - } - - func test_fileGenerators_givenCustomRootDirectoryPath_operations_absolute__shouldGenerateFilesWithCustomRootPath() throws { - // given - let schemaPath = ApolloCodegenInternalTestHelpers.Resources.AnimalKingdom.Schema.path - let operationsPath = ApolloCodegenInternalTestHelpers.Resources.url - .appendingPathComponent("animalkingdom-graphql") - .appendingPathComponent("*.graphql").path - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - schemaNamespace: "AnimalKingdomAPI", - input: .init( - schemaPath: schemaPath, - operationSearchPaths: [operationsPath] - ), - output: .mock( - moduleType: .swiftPackageManager, - operations: .absolute(path: "./RelativeOperations"), - path: "./RelativePath" - ) - ), rootURL: directoryURL) - - let fileManager = MockApolloFileManager(strict: false) - - var filePaths: Set = [] - fileManager.mock(closure: .createFile({ path, data, attributes in - filePaths.insert(path) - return true - })) - - let expectedPaths: Set = [ - directoryURL.appendingPathComponent("RelativePath/Sources/SchemaMetadata.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/SchemaConfiguration.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Interfaces/Pet.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Interfaces/Animal.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Interfaces/WarmBlooded.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Interfaces/HousePet.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Enums/SkinCovering.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Enums/RelativeSize.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Unions/ClassroomPet.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/InputObjects/PetAdoptionInput.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/InputObjects/PetSearchFilters.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/InputObjects/MeasurementsInput.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Height.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Query.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Cat.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Human.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Bird.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Rat.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/PetRock.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Fish.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Crocodile.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Mutation.graphql.swift").path, - directoryURL.appendingPathComponent("RelativePath/Sources/Objects/Dog.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Sources/CustomScalars/CustomDate.swift").path, - - directoryURL.appendingPathComponent("RelativeOperations/Queries/AllAnimalsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Queries/DogQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Queries/AllAnimalsIncludeSkipQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Queries/ClassroomPetsQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Queries/PetSearchQuery.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Mutations/PetAdoptionMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativeOperations/Fragments/PetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Fragments/DogFragment.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Fragments/ClassroomPetDetails.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Fragments/HeightInMeters.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Fragments/WarmBloodedDetails.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/Fragments/CrocodileFragment.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativeOperations/LocalCacheMutations/AllAnimalsLocalCacheMutation.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/LocalCacheMutations/PetDetailsMutation.graphql.swift").path, - directoryURL.appendingPathComponent("RelativeOperations/LocalCacheMutations/PetSearchLocalCacheMutation.graphql.swift").path, - - directoryURL.appendingPathComponent("RelativePath/Package.swift").path, - ] - - // when - let compilationResult = try ApolloCodegen.compileGraphQLResult(config) - - let ir = IR(compilationResult: compilationResult) - - try ApolloCodegen.generateFiles( - compilationResult: compilationResult, - ir: ir, - config: config, - fileManager: fileManager, - itemsToGenerate: [.code] - ) - - // then - expect(filePaths).to(equal(expectedPaths)) - expect(fileManager.allClosuresCalled).to(beTrue()) - } - - // MARK: Old File Deletion Tests - - func test__fileDeletion__givenPruneGeneratedFiles_false__doesNotDeleteUnusedGeneratedFiles() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let testFile = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "SchemaModule" - ) - let testInSourcesFile = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "SchemaModule/Sources" - ) - let testInOtherFolderFile = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "SchemaModule/OtherFolder" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ), - options: .init(pruneGeneratedFiles: false) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInSourcesFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInOtherFolderFile)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedFilesExist_InSchemaModuleDirectory_deletesOnlyGeneratedFiles() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let testFile = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "SchemaModule" - ) - let testInSourcesFile = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "SchemaModule/Sources" - ) - let testInOtherFolderFile = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "SchemaModule/OtherFolder" - ) - - let testUserFile = try createFile( - filename: "TestUserFileA.swift", - inDirectory: "SchemaModule" - ) - let testInSourcesUserFile = try createFile( - filename: "TestUserFileB.swift", - inDirectory: "SchemaModule/Sources" - ) - let testInOtherFolderUserFile = try createFile( - filename: "TestUserFileC.swift", - inDirectory: "SchemaModule/OtherFolder" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testFile)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInSourcesFile)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInOtherFolderFile)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInSourcesUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInOtherFolderUserFile)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedFilesExist_InOperationAbsoluteDirectory_deletesOnlyGeneratedFiles() throws { - // given - let absolutePath = "OperationPath" - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let testFile = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: absolutePath - ) - let testInChildFile = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "\(absolutePath)/Child" - ) - - let testUserFile = try createFile( - filename: "TestFileA.swift", - inDirectory: absolutePath - ) - let testInChildUserFile = try createFile( - filename: "TestFileB.swift", - inDirectory: "\(absolutePath)/Child" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .absolute(path: "OperationPath") - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testFile)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInChildFile)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInChildUserFile)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedFilesExist_InOperationRelativeDirectories_deletesOnlyRelativeGeneratedFilesInOperationSearchPaths() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql", - inDirectory: "code" - ) - - let testGeneratedFileInRootPath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code" - ) - let testGeneratedFileInChildPath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child" - ) - let testGeneratedFileInNestedChildPath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/one/two" - ) - - let testGeneratedFileNotInRelativePath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: nil - ) - let testGeneratedFileNotInRelativeChildPath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child" - ) - - let testUserFileInRootPath = try createFile( - filename: "TestUserFileA.swift", - inDirectory: "code" - ) - let testUserFileInChildPath = try createFile( - filename: "TestUserFileB.swift", - inDirectory: "code/child" - ) - let testUserFileInNestedChildPath = try createFile( - filename: "TestUserFileC.swift", - inDirectory: "code/one/two" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["code/**/*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .relative(subpath: nil) - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPath)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInNestedChildPath)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedFilesExist_InOperationRelativeDirectories_operationSearchPathWithoutDirectories_deletesOnlyRelativeGeneratedFilesInOperationSearchPaths() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "code.graphql" - ) - - let testGeneratedFileInRootPath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code" - ) - let testGeneratedFileInChildPath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child" - ) - let testGeneratedFileInNestedChildPath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/one/two" - ) - - let testGeneratedFileNotInRelativePath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: nil - ) - let testGeneratedFileNotInRelativeChildPath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child" - ) - - let testUserFileInRootPath = try createFile( - filename: "TestUserFileA.swift", - inDirectory: "code" - ) - let testUserFileInChildPath = try createFile( - filename: "TestUserFileB.swift", - inDirectory: "code/child" - ) - let testUserFileInNestedChildPath = try createFile( - filename: "TestUserFileC.swift", - inDirectory: "code/one/two" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["code.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .relative(subpath: nil) - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInNestedChildPath)).to(beTrue()) - } - - func test__fileDeletion__inOperationRelativeDirectory__whenSymlinkIsUsed() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - let schemaDirectory = "SchemaModule" - let codeDirectory = "code" - let relativeSubPath = "Operations" - let operationFilename = "TestQuery.graphql" - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: operationFilename, - inDirectory: codeDirectory - ) - - let symLinkURL = directoryURL.appendingPathComponent("/\(codeDirectory)/\(relativeSubPath)/") - let symLinkDestURL = directoryURL.appendingPathComponent("\(schemaDirectory)/Sources/Operations/") - let fileValidationPath = symLinkDestURL.appendingPathComponent("\(operationFilename).swift").path - - //setup symlink folder - try testFileManager.fileManager.createDirectory(at: symLinkDestURL, withIntermediateDirectories: true) - try testFileManager.fileManager.createSymbolicLink(at: symLinkURL, withDestinationURL: symLinkDestURL) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["code/**/*.graphql"] - ), - output: .init( - schemaTypes: .init(path: schemaDirectory, - moduleType: .swiftPackageManager), - operations: .relative(subpath: relativeSubPath) - ), - options: .init( - pruneGeneratedFiles: true - ) - ) - - // then - - // running codegen multiple times to validate symlink related file creation/deletion bug - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - expect(ApolloFileManager.default.doesFileExist(atPath: fileValidationPath)).to(beTrue()) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - expect(ApolloFileManager.default.doesFileExist(atPath: fileValidationPath)).to(beTrue()) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - expect(ApolloFileManager.default.doesFileExist(atPath: fileValidationPath)).to(beTrue()) - - } - - func test__fileDeletion__givenGeneratedFilesExist_InOperationRelativeDirectoriesWithSubPath_deletesOnlyRelativeGeneratedFilesInOperationSearchPaths() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - let testGeneratedFileInRootPath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code" - ) - let testGeneratedFileInChildPath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child" - ) - let testGeneratedFileInNestedChildPath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/one/two" - ) - - let testGeneratedFileNotInRelativePath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: nil - ) - let testGeneratedFileNotInRelativeChildPath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child" - ) - - let testGeneratedFileInRootPathSubpath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code/subpath" - ) - let testGeneratedFileInChildPathSubpath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child/subpath" - ) - let testGeneratedFileInNestedChildPathSubpath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/one/two/subpath" - ) - - let testGeneratedFileNotInRelativePathSubpath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: "subpath" - ) - let testGeneratedFileNotInRelativeChildPathSubpath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child/subpath" - ) - - let testUserFileInRootPath = try createOperationFile( - type: .query, - named: "OperationA", - filename: "TestUserFileOperationA.graphql", - inDirectory: "code" - ) - let testUserFileInChildPath = try createOperationFile( - type: .query, - named: "OperationB", - filename: "TestUserFileOperationB.graphql", - inDirectory: "code/child" - ) - let testUserFileInNestedChildPath = try createOperationFile( - type: .query, - named: "OperationC", - filename: "TestUserFileOperationC.graphql", - inDirectory: "code/one/two" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["code/**/*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .relative(subpath: "subpath") - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPathSubpath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPathSubpath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPathSubpath)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePathSubpath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPathSubpath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInNestedChildPath)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedFilesExist_InOperationRelativeDirectoriesWithSubPath_operationSearchPathWithNoDirectories_deletesOnlyRelativeGeneratedFilesInOperationSearchPaths() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "code.graphql" - ) - - let testGeneratedFileInRootPath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code" - ) - let testGeneratedFileInChildPath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child" - ) - let testGeneratedFileInNestedChildPath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/one/two" - ) - - let testGeneratedFileNotInRelativePath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: nil - ) - let testGeneratedFileNotInRelativeChildPath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child" - ) - - let testGeneratedFileInRootPathSubpath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code/subpath" - ) - let testGeneratedFileInChildPathSubpath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child/subpath" - ) - let testGeneratedFileInNestedChildPathSubpath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/one/two/subpath" - ) - - let testGeneratedFileNotInRelativePathSubpath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: "subpath" - ) - let testGeneratedFileNotInRelativeChildPathSubpath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child/subpath" - ) - - let testUserFileInRootPath = try createOperationFile( - type: .query, - named: "OperationA", - filename: "TestUserFileOperationA.graphql", - inDirectory: "code" - ) - let testUserFileInChildPath = try createOperationFile( - type: .query, - named: "OperationB", - filename: "TestUserFileOperationB.graphql", - inDirectory: "code/child" - ) - let testUserFileInNestedChildPath = try createOperationFile( - type: .query, - named: "OperationC", - filename: "TestUserFileOperationC.graphql", - inDirectory: "code/one/two" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["code.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .relative(subpath: "subpath") - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPathSubpath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPathSubpath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPathSubpath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePathSubpath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPathSubpath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInNestedChildPath)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedFilesExist_InOperationRelativeDirectoriesWithSubPath_operationSearchPathWithoutGlobstar_deletesOnlyRelativeGeneratedFilesInOperationSearchPaths() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - let testGeneratedFileInRootPath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code" - ) - let testGeneratedFileInChildPath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child" - ) - let testGeneratedFileInNestedChildPath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/child/A" - ) - - let testGeneratedFileNotInRelativePath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: nil - ) - let testGeneratedFileNotInRelativeChildPath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child" - ) - - let testGeneratedFileInRootPathSubpath = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: "code/subpath" - ) - let testGeneratedFileInChildPathSubpath = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "code/child/subpath" - ) - let testGeneratedFileInNestedChildPathSubpath = try createFile( - filename: "TestGeneratedC.graphql.swift", - inDirectory: "code/child/next/subpath" - ) - - let testGeneratedFileNotInRelativePathSubpath = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: "subpath" - ) - let testGeneratedFileNotInRelativeChildPathSubpath = try createFile( - filename: "TestGeneratedE.graphql.swift", - inDirectory: "other/child/subpath" - ) - - let testUserFileInRootPath = try createOperationFile( - type: .query, - named: "OperationA", - filename: "TestUserFileOperationA.graphql", - inDirectory: "code" - ) - let testUserFileInChildPath = try createOperationFile( - type: .query, - named: "OperationB", - filename: "TestUserFileOperationB.graphql", - inDirectory: "code/child" - ) - let testUserFileInNestedChildPath = try createOperationFile( - type: .query, - named: "OperationC", - filename: "TestUserFileOperationC.graphql", - inDirectory: "code/child/next" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["code/child/*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .relative(subpath: "subpath") - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInRootPathSubpath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInChildPathSubpath)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileInNestedChildPathSubpath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativePathSubpath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testGeneratedFileNotInRelativeChildPathSubpath)).to(beTrue()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInRootPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInChildPath)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFileInNestedChildPath)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedTestMockFilesExist_InAbsoluteDirectory_deletesOnlyGeneratedFiles() throws { - // given - let absolutePath = "TestMocksPath" - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let testFile = try createFile( - filename: "TestGeneratedA.graphql.swift", - inDirectory: absolutePath - ) - let testInChildFile = try createFile( - filename: "TestGeneratedB.graphql.swift", - inDirectory: "\(absolutePath)/Child" - ) - - let testUserFile = try createFile( - filename: "TestFileA.swift", - inDirectory: absolutePath - ) - let testInChildUserFile = try createFile( - filename: "TestFileB.swift", - inDirectory: "\(absolutePath)/Child" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule, - testMocks: .absolute(path: absolutePath) - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testFile)).to(beFalse()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInChildFile)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInChildUserFile)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedTestMockFilesExist_InSwiftPackageDirectory_deletesOnlyGeneratedFiles() throws { - // given - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let testInTestMocksFolderFile = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: "SchemaModule/TestMocks" - ) - - let testUserFile = try createFile( - filename: "TestUserFileA.swift", - inDirectory: "SchemaModule" - ) - let testInSourcesUserFile = try createFile( - filename: "TestUserFileB.swift", - inDirectory: "SchemaModule/Sources" - ) - let testInOtherFolderUserFile = try createFile( - filename: "TestUserFileC.swift", - inDirectory: "SchemaModule/OtherFolder" - ) - let testInTestMocksFolderUserFile = try createFile( - filename: "TestUserFileD.swift", - inDirectory: "SchemaModule/TestMocks" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - schemaNamespace: "TestSchema", - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - testMocks: .swiftPackage() - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testInTestMocksFolderFile)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInSourcesUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInOtherFolderUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInTestMocksFolderUserFile)).to(beTrue()) - } - - func test__fileDeletion__givenGeneratedTestMockFilesExist_InSwiftPackageWithCustomTargetNameDirectory_deletesOnlyGeneratedFiles() throws { - // given - let testMockTargetName = "ApolloTestTarget" - try createFile(containing: schemaData, named: "schema.graphqls") - - try createOperationFile( - type: .query, - named: "TestQuery", - filename: "TestQuery.graphql" - ) - - let testInTestMocksFolderFile = try createFile( - filename: "TestGeneratedD.graphql.swift", - inDirectory: "SchemaModule/\(testMockTargetName)" - ) - - let testUserFile = try createFile( - filename: "TestUserFileA.swift", - inDirectory: "SchemaModule" - ) - let testInSourcesUserFile = try createFile( - filename: "TestUserFileB.swift", - inDirectory: "SchemaModule/Sources" - ) - let testInOtherFolderUserFile = try createFile( - filename: "TestUserFileC.swift", - inDirectory: "SchemaModule/OtherFolder" - ) - let testInTestMocksFolderUserFile = try createFile( - filename: "TestUserFileD.swift", - inDirectory: "SchemaModule/\(testMockTargetName)" - ) - - // when - let config = ApolloCodegenConfiguration.mock( - schemaNamespace: "TestSchema", - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - testMocks: .swiftPackage(targetName: testMockTargetName) - ) - ) - - try ApolloCodegen.build(with: config, withRootURL: directoryURL) - - // then - expect(ApolloFileManager.default.doesFileExist(atPath: testInTestMocksFolderFile)).to(beFalse()) - - expect(ApolloFileManager.default.doesFileExist(atPath: testUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInSourcesUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInOtherFolderUserFile)).to(beTrue()) - expect(ApolloFileManager.default.doesFileExist(atPath: testInTestMocksFolderUserFile)).to(beTrue()) - } - - // MARK: Validation Tests - - func test_validation_givenTestMockConfiguration_asSwiftPackage_withSchemaTypesModule_asEmbeddedInTarget_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaPath: "path"), - output: .mock( - moduleType: .embeddedInTarget(name: "ModuleTarget"), - testMocks: .swiftPackage(targetName: nil) - ) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.testMocksInvalidSwiftPackageConfiguration)) - } - - func test_validation_givenTestMockConfiguration_asSwiftPackage_withSchemaTypesModule_asOther_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaPath: "path"), - output: .mock( - moduleType: .other, - testMocks: .swiftPackage(targetName: nil) - ) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.testMocksInvalidSwiftPackageConfiguration)) - } - - func test_validation_givenTestMockConfiguration_asSwiftPackage_withSchemaTypesModule_asSwiftPackage_shouldNotThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaPath: "path.graphqls") - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .notTo(throwError()) - } - - func test_validation_givenOperationSearchPathWithoutFileExtensionComponent_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaPath: "path.graphqls", operationSearchPaths: ["operations/*"]) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.inputSearchPathInvalid(path: "operations/*"))) - } - - func test_validation_givenOperationSearchPathEndingInPeriod_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaPath: "path.graphqls", operationSearchPaths: ["operations/*."]) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.inputSearchPathInvalid(path: "operations/*."))) - } - - func test_validation_givenSchemaSearchPathWithoutFileExtensionComponent_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaSearchPaths: ["schema/*"]) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.inputSearchPathInvalid(path: "schema/*"))) - } - - func test_validation_givenSchemaSearchPathEndingInPeriod_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - input: .init(schemaSearchPaths: ["schema/*."]) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.inputSearchPathInvalid(path: "schema/*."))) - } - - let conflictingSchemaNames = ["rocket", "Rocket"] - - func test__validation__givenSchemaName_matchingObjectName_shouldThrow() throws { - // given - let object = GraphQLObjectType.mock("Rocket") - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(object) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingInterfaceName_shouldThrow() throws { - // given - let interface = GraphQLInterfaceType.mock("Rocket") - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(interface) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingUnionName_shouldThrow() throws { - // given - let union = GraphQLUnionType.mock("Rocket") - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(union) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingEnumName_shouldThrow() throws { - // given - let `enum` = GraphQLEnumType.mock(name: "Rocket", values: ["one", "two"]) - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(`enum`) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingInputObjectName_shouldThrow() throws { - // given - let inputObject = GraphQLInputObjectType.mock("Rocket") - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(inputObject) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingCustomScalarName_shouldThrow() throws { - // given - let customScalar = GraphQLScalarType.mock(name: "Rocket") - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(customScalar) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingFragmentDefinitionName_shouldThrow() throws { - // given - let fragmentDefinition = CompilationResult.FragmentDefinition.mock( - "Rocket", - type: .mock("MockType")) - let compilationResult = CompilationResult.mock() - - compilationResult.fragments.append(fragmentDefinition) - - // then - for name in conflictingSchemaNames { - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: name - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: configContext.schemaNamespace))) - } - } - - func test__validation__givenSchemaName_matchingDisallowedSchemaNamespaceName_shouldThrow() throws { - // given - let disallowedNames = ["schema", "Schema", "ApolloAPI", "apolloapi"] - - // when - for name in disallowedNames { - let config = ApolloCodegenConfiguration.mock(schemaNamespace: name) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.schemaNameConflict(name: config.schemaNamespace))) - } - } - - func test__validation__givenTargetName_matchingDisallowedTargetName_shouldThrow() throws { - // given - let disallowedNames = ["apollo", "Apollo", "apolloapi", "ApolloAPI"] - - // when - for name in disallowedNames { - let config = ApolloCodegenConfiguration.mock( - output: .mock( - moduleType: .embeddedInTarget(name: name) - ) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.targetNameConflict(name: name))) - } - } - - func test__validation__givenEmptySchemaName_shouldThrow() throws { - let config = ApolloCodegenConfiguration.mock(schemaNamespace: "") - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.invalidSchemaName("", message: ""))) - } - - func test__validation__givenWhitespaceOnlySchemaName_shouldThrow() throws { - let config = ApolloCodegenConfiguration.mock(schemaNamespace: " ") - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.invalidSchemaName(" ", message: ""))) - } - - func test__validation__givenSchemaNameContainingWhitespace_shouldThrow() throws { - let config = ApolloCodegenConfiguration.mock(schemaNamespace: "My Schema") - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.invalidSchemaName("My Schema", message: ""))) - } - - func test__validation__givenUniqueSchemaName_shouldNotThrow() throws { - // given - let object = GraphQLObjectType.mock("MockObject") - let interface = GraphQLInterfaceType.mock("MockInterface") - let union = GraphQLUnionType.mock("MockUnion") - let `enum` = GraphQLEnumType.mock(name: "MockEnum", values: ["one", "two"]) - let inputObject = GraphQLInputObjectType.mock("MockInputObject") - let customScalar = GraphQLScalarType.mock(name: "MockCustomScalar") - let fragmentDefinition = CompilationResult.FragmentDefinition.mock( - "MockFragmentDefinition", - type: .mock("MockType")) - let compilationResult = CompilationResult.mock() - - compilationResult.referencedTypes.append(contentsOf: [ - object, - interface, - union, - `enum`, - inputObject, - customScalar - ]) - compilationResult.fragments.append(fragmentDefinition) - - // then - let configContext = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: "MySchema" - ), rootURL: nil) - - expect(try ApolloCodegen.validate(configContext, with: compilationResult)) - .notTo(throwError()) - } - - func test__validation__givenSchemaTypesModule_swiftPackageManager_withCocoapodsCompatibleImportStatements_true_shouldThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - .swiftPackageManager, - options: .init(cocoapodsCompatibleImportStatements: true) - ) - - // then - expect(try ApolloCodegen._validate(config: config)) - .to(throwError(ApolloCodegen.Error.invalidConfiguration(message: """ - cocoapodsCompatibleImportStatements cannot be set to 'true' when the output schema types \ - module type is Swift Package Manager. Change the cocoapodsCompatibleImportStatements \ - value to 'false' to resolve the conflict. - """))) - } - - func test__validation__givenSchemaTypesModule_swiftPackageManager_withCocoapodsCompatibleImportStatements_false_shouldNotThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - .swiftPackageManager, - options: .init(cocoapodsCompatibleImportStatements: false) - ) - - // then - expect(try ApolloCodegen._validate(config: config)).notTo(throwError()) - } - - func test__validation__givenSchemaTypesModule_embeddedInTarget_withCocoapodsCompatibleImportStatements_true_shouldNotThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - .embeddedInTarget(name: "TestTarget"), - options: .init(cocoapodsCompatibleImportStatements: true) - ) - - // then - expect(try ApolloCodegen._validate(config: config)).notTo(throwError()) - } - - func test__validation__givenSchemaTypesModule_other_withCocoapodsCompatibleImportStatements_true_shouldNotThrow() throws { - // given - let config = ApolloCodegenConfiguration.mock( - .other, - options: .init(cocoapodsCompatibleImportStatements: true) - ) - - // then - expect(try ApolloCodegen._validate(config: config)).notTo(throwError()) - } - - func test__validation__selectionSet_typeConflicts_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - - type User { - containers: [Container] - } - - type Container { - value: Value - values: [Value] - } - - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - - values { - propertyA - propertyC - } - } - } - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("value")) - expect(conflictingName).to(equal("values")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - func test__validation__selectionSet_typeConflicts_withDirectInlineFragment_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - type User { - containers: [ContainerInterface] - } - interface ContainerInterface { - value: Value - } - type Container implements ContainerInterface{ - value: Value - values: [Value] - } - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - ... on Container { - values { - propertyA - propertyC - } - } - } - } - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("values")) - expect(conflictingName).to(equal("value")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - func test__validation__selectionSet_typeConflicts_withMergedInlineFragment_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: UserInterface - } - type User implements UserInterface { - containers: [ContainerInterface] - } - interface UserInterface { - containers: [ContainerInterface] - } - interface ContainerInterface { - value: Value - } - type Container implements ContainerInterface { - value: Value - values: [Value] - } - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - } - ... on User { - containers { - ... on Container { - values { - propertyA - propertyC - } - } - } - } - } - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("values")) - expect(conflictingName).to(equal("value")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - func test__validation__selectionSet_typeConflicts_withDirectNamedFragment_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - type User { - containers: [Container] - } - - type Container { - value: Value - values: [Value] - } - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - ...ContainerFields - } - } - } - - fragment ContainerFields on Container { - values { - propertyA - propertyC - } - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("value")) - expect(conflictingName).to(equal("values")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - func test__validation__selectionSet_typeConflicts_withNamedFragment_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - type User { - containers: [Container] - } - - type Container { - value: Value - values: [Value] - } - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - fragment ContainerFields on Container { - value { - propertyA - propertyB - propertyC - propertyD - } - values { - propertyA - propertyC - } - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("value")) - expect(conflictingName).to(equal("values")) - expect(containingObject).to(equal("ContainerFields")) - }) - } - - func test__validation__selectionSet_typeConflicts_withNamedFragmentFieldCollisionWithinInlineFragment_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - - type User { - containers: [ContainerInterface] - } - - interface ContainerInterface { - value: Value - } - - type Container implements ContainerInterface{ - value: Value - values: [Value] - user: Int - } - - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - ... on Container { - ...ValueFragment - } - } - } - } - - fragment ValueFragment on Container { - values { - propertyA - propertyC - } - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("value")) - expect(conflictingName).to(equal("values")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - func test__validation__selectionSet_typeConflicts_withNamedFragmentWithinInlineFragmentTypeCollision_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - - type User { - containers: [ContainerInterface] - } - - interface ContainerInterface { - value: Value - } - - type Container implements ContainerInterface{ - nestedContainer: NestedContainer - value: Value - values: [Value] - user: Int - } - - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - - type NestedContainer { - values: [Value] - description: String - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - ... on Container { - nestedContainer { - ...value - } - } - } - } - } - - fragment value on NestedContainer { - description - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("value")) - expect(conflictingName).to(equal("value")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - func test__validation__selectionSet_typeConflicts_withFieldUsingNamedFragmentCollision_shouldThrowError() throws { - let schemaDefData: Data = { - """ - type Query { - user: User - } - - type User { - containers: [Container] - } - - type Container { - info: Value - } - - type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! - } - """ - }().data(using: .utf8)! - - let operationData: Data = - """ - query ConflictingQuery { - user { - containers { - info { - ...Info - } - } - } - } - - fragment Info on Value { - propertyA - propertyB - propertyD - } - """.data(using: .utf8)! - - try createFile(containing: schemaDefData, named: "schema.graphqls") - try createFile(containing: operationData, named: "operation.graphql") - - let config = ApolloCodegenConfiguration.mock( - input: .init( - schemaSearchPaths: ["schema*.graphqls"], - operationSearchPaths: ["*.graphql"] - ), - output: .init( - schemaTypes: .init(path: "SchemaModule", - moduleType: .swiftPackageManager), - operations: .inSchemaModule - ) - ) - - expect(try ApolloCodegen.build(with: config)) - .to(throwError { error in - guard case let ApolloCodegen.Error.typeNameConflict(name, conflictingName, containingObject) = error else { - fail("Expected .typeNameConflict, got .\(error)") - return - } - expect(name).to(equal("info")) - expect(conflictingName).to(equal("Info")) - expect(containingObject).to(equal("ConflictingQuery")) - }) - } - - // MARK: Path Match Exclusion Tests - - func test__match__givenFilesInSpecialExcludedPaths_shouldNotReturnExcludedPaths() throws { - // given - try createFile(filename: "included.file") - - try createFile(filename: "excludedBuildFolder.file", inDirectory: ".build") - try createFile(filename: "excludedBuildSubfolderOne.file", inDirectory: ".build/subfolder") - try createFile(filename: "excludedBuildSubfolderTwo.file", inDirectory: ".build/subfolder/two") - try createFile(filename: "excludedNestedOneBuildFolder.file", inDirectory: "nested/.build") - try createFile(filename: "excludedNestedTwoBuildFolder.file", inDirectory: "nested/two/.build") - - try createFile(filename: "excludedSwiftpmFolder.file", inDirectory: ".swiftpm") - try createFile(filename: "excludedSwiftpmSubfolderOne.file", inDirectory: ".swiftpm/subfolder") - try createFile(filename: "excludedSwiftpmSubfolderTwo.file", inDirectory: ".swiftpm/subfolder/two") - try createFile(filename: "excludedNestedOneSwiftpmFolder.file", inDirectory: "nested/.swiftpm") - try createFile(filename: "excludedNestedTwoSwiftpmFolder.file", inDirectory: "nested/two/.swiftpm") - - try createFile(filename: "excludedPodsFolder.file", inDirectory: ".Pods") - try createFile(filename: "excludedPodsSubfolderOne.file", inDirectory: ".Pods/subfolder") - try createFile(filename: "excludedPodsSubfolderTwo.file", inDirectory: ".Pods/subfolder/two") - try createFile(filename: "excludedNestedOnePodsFolder.file", inDirectory: "nested/.Pods") - try createFile(filename: "excludedNestedTwoPodsFolder.file", inDirectory: "nested/two/.Pods") - - // when - let matches = try ApolloCodegen.match( - searchPaths: ["\(directoryURL.path)/**/*.file"], - relativeTo: nil) - - // then - expect(matches.count).to(equal(1)) - expect(matches.contains(where: { $0.contains(".build") })).to(beFalse()) - expect(matches.contains(where: { $0.contains(".swiftpm") })).to(beFalse()) - expect(matches.contains(where: { $0.contains(".Pods") })).to(beFalse()) - } - - func test__match__givenFilesInSpecialExcludedPaths_usingRelativeDirectory_shouldNotReturnExcludedPaths() throws { - // given - try createFile(filename: "included.file") - - try createFile(filename: "excludedBuildFolder.file", inDirectory: ".build") - try createFile(filename: "excludedBuildSubfolderOne.file", inDirectory: ".build/subfolder") - try createFile(filename: "excludedBuildSubfolderTwo.file", inDirectory: ".build/subfolder/two") - try createFile(filename: "excludedNestedOneBuildFolder.file", inDirectory: "nested/.build") - try createFile(filename: "excludedNestedTwoBuildFolder.file", inDirectory: "nested/two/.build") - - try createFile(filename: "excludedSwiftpmFolder.file", inDirectory: ".swiftpm") - try createFile(filename: "excludedSwiftpmSubfolderOne.file", inDirectory: ".swiftpm/subfolder") - try createFile(filename: "excludedSwiftpmSubfolderTwo.file", inDirectory: ".swiftpm/subfolder/two") - try createFile(filename: "excludedNestedOneSwiftpmFolder.file", inDirectory: "nested/.swiftpm") - try createFile(filename: "excludedNestedTwoSwiftpmFolder.file", inDirectory: "nested/two/.swiftpm") - - try createFile(filename: "excludedPodsFolder.file", inDirectory: ".Pods") - try createFile(filename: "excludedPodsSubfolderOne.file", inDirectory: ".Pods/subfolder") - try createFile(filename: "excludedPodsSubfolderTwo.file", inDirectory: ".Pods/subfolder/two") - try createFile(filename: "excludedNestedOnePodsFolder.file", inDirectory: "nested/.Pods") - try createFile(filename: "excludedNestedTwoPodsFolder.file", inDirectory: "nested/two/.Pods") - - // when - let matches = try ApolloCodegen.match( - searchPaths: ["**/*.file"], - relativeTo: directoryURL) - - // then - expect(matches.count).to(equal(1)) - expect(matches.contains(where: { $0.contains(".build") })).to(beFalse()) - expect(matches.contains(where: { $0.contains(".swiftpm") })).to(beFalse()) - expect(matches.contains(where: { $0.contains(".Pods") })).to(beFalse()) - } - -} diff --git a/Tests/ApolloCodegenTests/ApolloSchemaDownloadConfigurationCodableTests.swift b/Tests/ApolloCodegenTests/ApolloSchemaDownloadConfigurationCodableTests.swift deleted file mode 100644 index 11659c9e0f..0000000000 --- a/Tests/ApolloCodegenTests/ApolloSchemaDownloadConfigurationCodableTests.swift +++ /dev/null @@ -1,379 +0,0 @@ -import XCTest -import Nimble -import ApolloCodegenLib - -class ApolloSchemaDownloadConfigurationCodableTests: XCTestCase { - - var testJSONEncoder: JSONEncoder! - - override func setUp() { - super.setUp() - - testJSONEncoder = JSONEncoder() - testJSONEncoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] - } - - override func tearDown() { - testJSONEncoder = nil - - super.tearDown() - } - - // MARK: - ApolloSchemaDownloadConfiguration Tests - - func test__encodeApolloSchemaDownloadConfiguration__givenAllParameters_shouldReturnJSON_withHTTPHeadersAsArrayOfStructs() throws { - // given - let subject = ApolloSchemaDownloadConfiguration( - using: .introspection( - endpointURL: URL(string: "http://server.com")!, - httpMethod: .POST, - outputFormat: .SDL, - includeDeprecatedInputValues: true), - timeout: 120, - headers: [ - .init(key: "Accept-Encoding", value: "gzip"), - .init(key: "Authorization", value: "Bearer ") - ], - outputPath: "ServerSchema.graphqls" - ) - - // when - let encodedJSON = try testJSONEncoder.encode(subject) - let actual = encodedJSON.asString - - let expected = """ - { - "downloadMethod" : { - "introspection" : { - "endpointURL" : "http://server.com", - "httpMethod" : { - "POST" : { - - } - }, - "includeDeprecatedInputValues" : true, - "outputFormat" : "SDL" - } - }, - "downloadTimeout" : 120, - "headers" : [ - { - "key" : "Accept-Encoding", - "value" : "gzip" - }, - { - "key" : "Authorization", - "value" : "Bearer " - } - ], - "outputPath" : "ServerSchema.graphqls" - } - """ - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloSchemaDownloadConfiguration__givenAllParameters_withHTTPHeadersAsArrayOfStructs_shouldReturnStruct() throws { - // given - let subject = """ - { - "downloadMethod" : { - "introspection" : { - "endpointURL" : "http://server.com", - "httpMethod" : { - "POST" : { - - } - }, - "includeDeprecatedInputValues" : true, - "outputFormat" : "SDL" - } - }, - "downloadTimeout" : 120, - "headers" : [ - { - "key" : "Accept-Encoding", - "value" : "gzip" - }, - { - "key" : "Authorization", - "value" : "Bearer " - } - ], - "outputPath" : "ServerSchema.graphqls" - } - """ - - // when - let actual = try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.self, - from: subject.asData - ) - - let expected = ApolloSchemaDownloadConfiguration( - using: .introspection( - endpointURL: URL(string: "http://server.com")!, - httpMethod: .POST, - outputFormat: .SDL, - includeDeprecatedInputValues: true), - timeout: 120, - headers: [ - .init(key: "Accept-Encoding", value: "gzip"), - .init(key: "Authorization", value: "Bearer ") - ], - outputPath: "ServerSchema.graphqls" - ) - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloSchemaDownloadConfiguration__givenAllParameters_withHTTPHeadersAsDictionary_shouldReturnStruct() throws { - // given - let subject = """ - { - "downloadMethod" : { - "introspection" : { - "endpointURL" : "http://server.com", - "httpMethod" : { - "POST" : { - - } - }, - "includeDeprecatedInputValues" : true, - "outputFormat" : "SDL" - } - }, - "downloadTimeout" : 120, - "headers" : { - "Accept-Encoding" : "gzip", - "Authorization" : "Bearer " - }, - "outputPath" : "ServerSchema.graphqls" - } - """ - - // when - let actual = try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.self, - from: subject.asData - ) - - let expected = ApolloSchemaDownloadConfiguration( - using: .introspection( - endpointURL: URL(string: "http://server.com")!, - httpMethod: .POST, - outputFormat: .SDL, - includeDeprecatedInputValues: true), - timeout: 120, - headers: [ - .init(key: "Accept-Encoding", value: "gzip"), - .init(key: "Authorization", value: "Bearer ") - ], - outputPath: "ServerSchema.graphqls" - ) - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloSchemaDownloadConfiguration__givenOnlyRequiredParameters_shouldReturnStruct() throws { - // given - let subject = """ - { - "downloadMethod" : { - "introspection" : { - "endpointURL" : "http://server.com", - "httpMethod" : { - "POST" : { - - } - }, - "includeDeprecatedInputValues" : true, - "outputFormat" : "SDL" - } - }, - "outputPath" : "ServerSchema.graphqls" - } - """.asData - - let expected = ApolloSchemaDownloadConfiguration( - using: .introspection( - endpointURL: URL(string: "http://server.com")!, - httpMethod: .POST, - outputFormat: .SDL, - includeDeprecatedInputValues: true), - outputPath: "ServerSchema.graphqls") - - // when - let actual = try JSONDecoder().decode(ApolloSchemaDownloadConfiguration.self, from: subject) - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloSchemaDownloadConfiguration__givenMissingRequiredParameters_shouldThrow() throws { - // given - let subject = """ - {} - """.asData - - // then - expect(try JSONDecoder().decode(ApolloSchemaDownloadConfiguration.self, from: subject)) - .to(throwError()) - } - - // MARK: - ApolloRegistrySettings Tests - - enum MockApolloRegistrySettings { - static var decodedStruct: ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings { - .init(apiKey: "ABC123", graphID: "DEF456", variant: "final") - } - - static var encodedJSON: String { - """ - { - "apiKey" : "ABC123", - "graphID" : "DEF456", - "variant" : "final" - } - """ - } - } - - func test__encodeApolloRegistrySettings__givenAllParameters_shouldReturnJSON() throws { - // given - let subject = MockApolloRegistrySettings.decodedStruct - - // when - let encodedJSON = try testJSONEncoder.encode(subject) - let actual = encodedJSON.asString - - // then - expect(actual).to(equal(MockApolloRegistrySettings.encodedJSON)) - } - - func test__decodeApolloRegistrySettings__givenAllParameters_shouldReturnStruct() throws { - // given - let subject = MockApolloRegistrySettings.encodedJSON.asData - - // when - let actual = try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings.self, - from: subject - ) - - // then - expect(actual).to(equal(MockApolloRegistrySettings.decodedStruct)) - } - - func test__decodeApolloRegistrySettings__givenOnlyRequiredParameters_shouldReturnStruct() throws { - // given - let subject = """ - { - "apiKey" : "EGWRB", - "graphID" : "YUNRT" - } - """.asData - - let expected = ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings( - apiKey: "EGWRB", - graphID: "YUNRT" - ) - - // when - let actual = try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings.self, - from: subject - ) - - // then - expect(actual).to(equal(expected)) - } - - func test__decodeApolloRegistrySettings__givenMissingRequiredParameters_shouldThrow() throws { - // given - let subject = """ - {} - """.asData - - // then - expect(try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings.self, - from: subject - )).to(throwError()) - } - - // MARK: - OutputFormat Tests - - func encodedValue(_ case: ApolloSchemaDownloadConfiguration.DownloadMethod.OutputFormat) -> String { - switch `case` { - case .SDL: return "\"SDL\"" - case .JSON: return "\"JSON\"" - } - } - - func test__encodeOutputFormat__givenSDL_shouldReturnString() throws { - // given - let subject = ApolloSchemaDownloadConfiguration.DownloadMethod.OutputFormat.SDL - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(encodedValue(.SDL))) - } - - func test__encodeOutputFormat__givenJSON_shouldReturnString() throws { - // given - let subject = ApolloSchemaDownloadConfiguration.DownloadMethod.OutputFormat.JSON - - // when - let actual = try testJSONEncoder.encode(subject).asString - - // then - expect(actual).to(equal(encodedValue(.JSON))) - } - - func test__decodeOutputFormat__givenSDL_shouldReturnEnum() throws { - // given - let subject = encodedValue(.SDL).asData - - // when - let actual = try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.DownloadMethod.OutputFormat.self, - from: subject - ) - - // then - expect(actual).to(equal(.SDL)) - } - - func test__decodeOutputFormat__givenJSON_shouldReturnEnum() throws { - // given - let subject = encodedValue(.JSON).asData - - // when - let actual = try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.DownloadMethod.OutputFormat.self, - from: subject - ) - - // then - expect(actual).to(equal(.JSON)) - } - - func test__decodeOutputFormat__givenUnknown_shouldThrow() throws { - // given - let subject = "\"unknown\"".asData - - // then - expect( - try JSONDecoder().decode( - ApolloSchemaDownloadConfiguration.DownloadMethod.OutputFormat.self, - from: subject - ) - ).to(throwError()) - } -} diff --git a/Tests/ApolloCodegenTests/ApolloSchemaInternalTests.swift b/Tests/ApolloCodegenTests/ApolloSchemaInternalTests.swift deleted file mode 100644 index 8a9a50bbd5..0000000000 --- a/Tests/ApolloCodegenTests/ApolloSchemaInternalTests.swift +++ /dev/null @@ -1,254 +0,0 @@ -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class ApolloSchemaInternalTests: XCTestCase { - let mockFileManager = MockApolloFileManager(strict: true) - - // MARK: Conversion Tests - - func testFormatConversion_givenIntrospectionJSON_shouldOutputValidSDL() throws { - let bundle = Bundle(for: type(of: self)) - guard let jsonURL = bundle.url(forResource: "introspection_response", withExtension: "json") else { - throw XCTFailure("Missing resource file!", file: #file, line: #line) - } - - try ApolloFileManager.default.createDirectoryIfNeeded(atPath: CodegenTestHelper.outputFolderURL().path) - let configuration = ApolloSchemaDownloadConfiguration( - using: .introspection(endpointURL: TestURL.mockPort8080.url), - outputPath: CodegenTestHelper.schemaOutputURL().path - ) - - try ApolloSchemaDownloader.convertFromIntrospectionJSONToSDLFile( - jsonFileURL: jsonURL, - configuration: configuration, - withRootURL: nil - ) - XCTAssertTrue(ApolloFileManager.default.doesFileExist(atPath: configuration.outputPath)) - - let frontend = try GraphQLJSFrontend() - let source = try frontend.makeSource(from: URL(fileURLWithPath: configuration.outputPath)) - let schema = try frontend.loadSchema(from: [source]) - - let authorType = try schema.getType(named: "Author") - XCTAssertEqual(authorType?.name, "Author") - - let postType = try schema.getType(named: "Post") - XCTAssertEqual(postType?.name, "Post") - } - - // MARK: Request Tests - - func testRequest_givenIntrospectionGETDownload_shouldOutputGETRequest() throws { - let url = ApolloInternalTestHelpers.TestURL.mockServer.url - let queryParameterName = "customParam" - let headers: [ApolloSchemaDownloadConfiguration.HTTPHeader] = [ - .init(key: "key1", value: "value1"), - .init(key: "key2", value: "value2") - ] - - let request = try ApolloSchemaDownloader.introspectionRequest(from: url, - httpMethod: .GET(queryParameterName: queryParameterName), - headers: headers, - includeDeprecatedInputValues: false) - - XCTAssertEqual(request.httpMethod, "GET") - XCTAssertNil(request.httpBody) - - XCTAssertEqual(request.allHTTPHeaderFields?["Content-Type"], "application/json") - for header in headers { - XCTAssertEqual(request.allHTTPHeaderFields?[header.key], header.value) - } - - var components = URLComponents(url: url, resolvingAgainstBaseURL: true) - components?.queryItems = [URLQueryItem(name: queryParameterName, value: ApolloSchemaDownloader.introspectionQuery(includeDeprecatedInputValues: false))] - - XCTAssertNotNil(components?.url) - XCTAssertEqual(request.url, components?.url) - } - - func testRequest_givenIntrospectionGETDownload_andIncludeDeprecatedInputValues_shouldOutputGETRequest() throws { - let url = ApolloInternalTestHelpers.TestURL.mockServer.url - let queryParameterName = "customParam" - let headers: [ApolloSchemaDownloadConfiguration.HTTPHeader] = [ - .init(key: "key1", value: "value1"), - .init(key: "key2", value: "value2") - ] - - let request = try ApolloSchemaDownloader.introspectionRequest(from: url, - httpMethod: .GET(queryParameterName: queryParameterName), - headers: headers, - includeDeprecatedInputValues: true) - - XCTAssertEqual(request.httpMethod, "GET") - XCTAssertNil(request.httpBody) - - XCTAssertEqual(request.allHTTPHeaderFields?["Content-Type"], "application/json") - for header in headers { - XCTAssertEqual(request.allHTTPHeaderFields?[header.key], header.value) - } - - var components = URLComponents(url: url, resolvingAgainstBaseURL: true) - components?.queryItems = [URLQueryItem(name: queryParameterName, value: ApolloSchemaDownloader.introspectionQuery(includeDeprecatedInputValues: true))] - - XCTAssertNotNil(components?.url) - XCTAssertEqual(request.url, components?.url) - } - - func testRequest_givenIntrospectionPOSTDownload_shouldOutputPOSTRequest() throws { - let url = ApolloInternalTestHelpers.TestURL.mockServer.url - let headers: [ApolloSchemaDownloadConfiguration.HTTPHeader] = [ - .init(key: "key1", value: "value1"), - .init(key: "key2", value: "value2") - ] - - let request = try ApolloSchemaDownloader.introspectionRequest(from: url, httpMethod: .POST, headers: headers, includeDeprecatedInputValues: false) - - XCTAssertEqual(request.httpMethod, "POST") - XCTAssertEqual(request.url, url) - - XCTAssertEqual(request.allHTTPHeaderFields?["Content-Type"], "application/json") - for header in headers { - XCTAssertEqual(request.allHTTPHeaderFields?[header.key], header.value) - } - - let requestBody = UntypedGraphQLRequestBodyCreator.requestBody(for: ApolloSchemaDownloader.introspectionQuery(includeDeprecatedInputValues: false), - variables: nil, - operationName: "IntrospectionQuery") - let bodyData = try JSONSerialization.data(withJSONObject: requestBody, options: [.sortedKeys]) - - XCTAssertEqual(request.httpBody, bodyData) - } - - func testRequest_givenRegistryDownload_shouldOutputPOSTRequest() throws { - let apiKey = "custom-api-key" - let graphID = "graph-id" - let variant = "a-variant" - let headers: [ApolloSchemaDownloadConfiguration.HTTPHeader] = [ - .init(key: "key1", value: "value1"), - .init(key: "key2", value: "value2"), - ] - - let request = try ApolloSchemaDownloader.registryRequest(with: .init(apiKey: apiKey, - graphID: graphID, - variant: variant), - headers: headers) - - XCTAssertEqual(request.httpMethod, "POST") - XCTAssertEqual(request.url, ApolloSchemaDownloader.RegistryEndpoint) - - XCTAssertEqual(request.allHTTPHeaderFields?["Content-Type"], "application/json") - XCTAssertEqual(request.allHTTPHeaderFields?["x-api-key"], apiKey) - for header in headers { - XCTAssertEqual(request.allHTTPHeaderFields?[header.key], header.value) - } - - let variables: [String: String] = [ - "graphID": graphID, - "variant": variant - ] - let requestBody = UntypedGraphQLRequestBodyCreator.requestBody(for: ApolloSchemaDownloader.RegistryDownloadQuery, - variables: variables, - operationName: "DownloadSchema") - let bodyData = try JSONSerialization.data(withJSONObject: requestBody, options: [.sortedKeys]) - - XCTAssertEqual(request.httpBody, bodyData) - } - - // MARK: Path Tests - - func test__write__givenRelativePath_noRootURL_shouldUseRelativePath() throws { - // given - let path = "./subfolder/output.test" - - mockFileManager.base.changeCurrentDirectoryPath(CodegenTestHelper.outputFolderURL().path) - - mockFileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - mockFileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - let expected = CodegenTestHelper.outputFolderURL() - .appendingPathComponent("subfolder/output.test").path - - // then - XCTAssertEqual(path, expected) - - return true - })) - - // when - try ApolloSchemaDownloader.write( - "Test File", - path: path, - rootURL: nil, - fileManager: mockFileManager) - } - - func test__write__givenAbsolutePath_noRootURL_shouldUseAbsolutePath() throws { - // given - let path = "/absolute/path/subfolder/output.test" - - mockFileManager.base.changeCurrentDirectoryPath(CodegenTestHelper.outputFolderURL().path) - - mockFileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - mockFileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - let expected = "/absolute/path/subfolder/output.test" - - // then - XCTAssertEqual(path, expected) - - return true - })) - - // when - try ApolloSchemaDownloader.write( - "Test File", - path: path, - rootURL: nil, - fileManager: mockFileManager) - } - - func test__write__givenPath_withRootURL_shouldExtendRootURL() throws { - // given - let path = "output.test" - - mockFileManager.base.changeCurrentDirectoryPath(CodegenTestHelper.outputFolderURL().path) - - mockFileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - mockFileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - let expected = "/rootURL/path/output.test" - - // then - XCTAssertEqual(path, expected) - - return true - })) - - // when - try ApolloSchemaDownloader.write( - "Test File", - path: path, - rootURL: URL(fileURLWithPath: "/rootURL/path/"), - fileManager: mockFileManager) - } -} diff --git a/Tests/ApolloCodegenTests/ApolloSchemaPublicTests.swift b/Tests/ApolloCodegenTests/ApolloSchemaPublicTests.swift deleted file mode 100644 index 10a32cc979..0000000000 --- a/Tests/ApolloCodegenTests/ApolloSchemaPublicTests.swift +++ /dev/null @@ -1,67 +0,0 @@ -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -import ApolloCodegenLib // Do not use @testable with this import! Plain `import` ensures the correct access modifiers are used. - -class ApolloSchemaPublicTests: XCTestCase { - - func testCreatingSchemaDownloadConfiguration_forIntrospectionDownload_usingDefaultParameters() throws { - let configuration = ApolloSchemaDownloadConfiguration( - using: .introspection(endpointURL: TestURL.mockPort8080.url), - outputPath: CodegenTestHelper.schemaOutputURL().path - ) - - XCTAssertEqual(configuration.downloadMethod, .introspection(endpointURL: TestURL.mockPort8080.url)) - XCTAssertEqual(configuration.outputPath, CodegenTestHelper.schemaOutputURL().path) - XCTAssertTrue(configuration.headers.isEmpty) - } - - func testCreatingSchemaDownloadConfiguration_forRegistryDownload_usingDefaultParameters() throws { - let settings = ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings( - apiKey: "Fake_API_Key", - graphID: "Fake_Graph_ID" - ) - - let configuration = ApolloSchemaDownloadConfiguration( - using: .apolloRegistry(settings), - outputPath: CodegenTestHelper.schemaOutputURL().path - ) - - XCTAssertEqual(configuration.downloadMethod, .apolloRegistry(settings)) - XCTAssertEqual(configuration.outputPath, CodegenTestHelper.schemaOutputURL().path) - XCTAssertTrue(configuration.headers.isEmpty) - } - - func testCreatingSchemaDownloadConfiguration_forRegistryDownload_usingAllParameters() throws { - let settings = ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings( - apiKey: "Fake_API_Key", - graphID: "Fake_Graph_ID", - variant: "Fake_Variant" - ) - let headers = [ - ApolloSchemaDownloadConfiguration.HTTPHeader( - key: "Authorization", - value: "Bearer tokenGoesHere" - ), - ApolloSchemaDownloadConfiguration.HTTPHeader( - key: "Custom-Header", - value: "Custom_Customer" - ) - ] - - let schemaFileName = "different_name" - let outputURL = CodegenTestHelper.outputFolderURL() - .appendingPathComponent("\(schemaFileName).graphqls") - let configuration = ApolloSchemaDownloadConfiguration( - using: .apolloRegistry(settings), - headers: headers, - outputPath: outputURL.path - ) - - XCTAssertEqual(configuration.downloadMethod, .apolloRegistry(settings)) - XCTAssertEqual(configuration.headers, headers) - XCTAssertEqual(configuration.outputPath, outputURL.path) - } - -} - diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IRCustomScalarTests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IRCustomScalarTests.swift deleted file mode 100644 index 1e38987b4e..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IRCustomScalarTests.swift +++ /dev/null @@ -1,92 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class IRCustomScalarTests: XCTestCase { - func test__givenScalarString__shouldAppendToScalarsSet() { - // given - let scalar = GraphQLScalarType.string() - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.scalars).to(equal([scalar])) - expect(subject.customScalars).to(beEmpty()) - } - - func test__givenScalarInt__shouldAppendToScalarsSet() { - // given - let scalar = GraphQLScalarType.integer() - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.scalars).to(equal([scalar])) - expect(subject.customScalars).to(beEmpty()) - } - - func test__givenScalarBool__shouldAppendToScalarsSet() { - // given - let scalar = GraphQLScalarType.boolean() - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.scalars).to(equal([scalar])) - expect(subject.customScalars).to(beEmpty()) - } - - func test__givenScalarFloat__shouldAppendToScalarsSet() { - // given - let scalar = GraphQLScalarType.float() - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.scalars).to(equal([scalar])) - expect(subject.customScalars).to(beEmpty()) - } - - func test__givenScalarID__shouldAppendToScalarsSet() { - // given - let scalar = GraphQLScalarType.mock(name: "ID") - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.scalars).to(equal([scalar])) - expect(subject.customScalars).to(beEmpty()) - } - - func test__givenCustomScalar__shouldAppendToCustomScalarsSet() { - // given - let scalar = GraphQLScalarType.mock(name: "CustomScalar") - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.customScalars).to(equal([scalar])) - expect(subject.scalars).to(beEmpty()) - } - - func test__givenCustomScalarWithSpecifiedByURL__shouldAppendToCustomScalarsSet() { - // given - let scalar = GraphQLScalarType.mock( - name: "String", - specifiedByURL: "https://tools.ietf.org/html/rfc4122" - ) - - // when - let subject = IR.Schema.ReferencedTypes.init([scalar]) - - // then - expect(subject.customScalars).to(equal([scalar])) - expect(subject.scalars).to(beEmpty()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IRFieldCollectorTests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IRFieldCollectorTests.swift deleted file mode 100644 index f372e1457f..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IRFieldCollectorTests.swift +++ /dev/null @@ -1,583 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib - -class IRFieldCollectorTests: XCTestCase { - - typealias ReferencedFields = [(String, GraphQLType, deprecationReason: String?)] - - var schemaSDL: String! - var document: String! - var ir: IR! - var subject: IR.FieldCollector! - - var schema: IR.Schema { ir.schema } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - func buildIR() throws { - ir = try .mock(schema: schemaSDL, document: document) - - for operation in ir.compilationResult.operations { - _ = ir.build(operation: operation) - } - - subject = ir.fieldCollector - } - - // MARK: - Tests - - func test__collectedFields__givenObject_collectsReferencedFieldsOnly() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - type Dog { - a: String - b: String - c: String - } - """ - - document = """ - query Test { - dog { - a - b - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenInterface_collectsReferencedFieldsOnly() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - interface Dog { - a: String - b: String - c: String - } - """ - - document = """ - query Test { - dog { - a - b - } - } - """ - - // when - try buildIR() - - let Dog = try schema[interface: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenFieldsInNonAlphabeticalOrder_retrurnsReferencedFieldsSortedAlphabetically() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - type Dog { - a: String - b: String - } - """ - - document = """ - query Test { - dog { - b - a - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenObjectImplementingInterface_collectsFieldsReferencedOnInterface() throws { - // given - schemaSDL = """ - type Query { - animal: Animal! - } - - interface Animal { - a: String - } - - type Dog implements Animal{ - a: String - b: String - c: String - } - """ - - document = """ - query Test { - animal { - a - ... on Dog { - b - } - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenFieldsFromFragment_collectsFieldsReferencedInFragment() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - type Dog { - a: String - b: String - c: String - } - """ - - document = """ - query Test { - dog { - ...FragmentB - a - } - } - - fragment FragmentB on Dog { - b - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenFieldsFromFragmentOnInterface_collectsFieldsReferencedInFragment() throws { - // given - schemaSDL = """ - type Query { - animal: Animal! - } - - interface Animal { - a: String - } - - type Dog implements Animal { - a: String - b: String - c: String - } - """ - - document = """ - query Test { - animal { - a - ... on Dog { - ...FragmentB - } - } - } - - fragment FragmentB on Dog { - b - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenFieldsFromQueryOnImplementedInterface_collectsFieldsReferencedInQueryOnInterface() throws { - // given - schemaSDL = """ - type Query { - animal: Animal! - dog: Dog! - } - - interface Animal { - a: String - } - - type Dog implements Animal { - a: String - b: String - c: String - } - """ - - document = """ - query Test1 { - animal { - a - } - } - - query Test2 { - dog { - b - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil) - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenAliasedField_collectsFields() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - type Dog { - a: String - b: String - c: String - } - """ - - document = """ - query Test1 { - dog { - aliasedA: a - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("aliasedA", .string(), nil), - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenFieldWithArguments_collectsFields() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - type Dog { - a(arg1: String): String - } - """ - - document = """ - query Test1 { - dog { - a(arg1: "test") - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("a", .string(), nil), - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenAliasedFieldsWithArguments_collectsFields() throws { - // given - schemaSDL = """ - type Query { - dog: Dog! - } - - type Dog { - a(arg1: String): String - } - """ - - document = """ - query Test1 { - dog { - field1: a(arg1: "one") - field2: a(arg1: "two") - } - } - """ - - // when - try buildIR() - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let actual = subject.collectedFields(for: Dog) - - let expected: ReferencedFields = [ - ("field1", .string(), nil), - ("field2", .string(), nil), - ] - - expect(actual).to(equal(expected)) - } - - func test__collectedFields__givenFieldsOnNestedInlineFragmentWithRedundantType_referenceFieldOnNestedTypeNotMatchingTargetType_doesNotCollectsField() throws { - // given - schemaSDL = """ - type Query { - animal: Animal! - } - - interface Animal { - a: String - } - - interface Pet { - b: String - } - - type PetRock implements Pet { - b: String - } - - type Dog implements Animal & Pet { - a: String - b: String - } - """ - - document = """ - query Test1 { - animal { - ... on Pet { - ... on Animal { - a - } - b - } - } - } - """ - - // when - try buildIR() - - let PetRock = try schema[object: "PetRock"].xctUnwrapped() - let petRockActual = subject.collectedFields(for: PetRock) - - let petRockExpected: ReferencedFields = [ - ("b", .string(), nil), - ] - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let dogActual = subject.collectedFields(for: Dog) - - let dogExpected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil), - ] - - expect(petRockActual).to(equal(petRockExpected)) - expect(dogActual).to(equal(dogExpected)) - } - - func test__collectedFields__givenFieldsOnNestedNamedFragmentWithRedundantType_referenceFieldOnNestedTypeNotMatchingTargetType_doesNotCollectsField() throws { - // given - schemaSDL = """ - type Query { - animal: Animal! - } - - interface Animal { - a: String - } - - interface Pet { - b: String - } - - type PetRock implements Pet { - b: String - } - - type Dog implements Animal & Pet { - a: String - b: String - } - """ - - document = """ - query Test1 { - animal { - ... on Pet { - ...FragA - b - } - } - } - - fragment FragA on Animal { - a - } - """ - - // when - try buildIR() - - let PetRock = try schema[object: "PetRock"].xctUnwrapped() - let petRockActual = subject.collectedFields(for: PetRock) - - let petRockExpected: ReferencedFields = [ - ("b", .string(), nil), - ] - - let Dog = try schema[object: "Dog"].xctUnwrapped() - let dogActual = subject.collectedFields(for: Dog) - - let dogExpected: ReferencedFields = [ - ("a", .string(), nil), - ("b", .string(), nil), - ] - - expect(petRockActual).to(equal(petRockExpected)) - expect(dogActual).to(equal(dogExpected)) - } - - /// MARK: - Custom Matchers - func equal( - _ expected: ReferencedFields - ) -> Predicate { - return Predicate.define { actual in - let message: ExpectationMessage = .expectedActualValueTo("have fields equal to \(expected)") - - guard let actual = try actual.evaluate(), - expected.count == actual.count else { - return PredicateResult(status: .fail, message: message.appended(details: "Fields Did Not Match!")) - } - - for (index, field) in zip(expected, actual).enumerated() { - guard field.0.0 == field.1.0, field.0.1 == field.1.1 else { - return PredicateResult( - status: .fail, - message: message.appended( - details: "Expected fields[\(index)] to equal \(field.0), got \(field.1)." - ) - ) - } - } - - return PredicateResult(status: .matches, message: message) - } - } -} - diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IRInputObjectTests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IRInputObjectTests.swift deleted file mode 100644 index 1a05267f51..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IRInputObjectTests.swift +++ /dev/null @@ -1,68 +0,0 @@ -import Foundation -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib - -class IRInputObjectTests: XCTestCase { - - var subject: GraphQLInputObjectType! - var schemaSDL: String! - var document: String! - - override func tearDown() { - subject = nil - schemaSDL = nil - document = nil - - super.tearDown() - } - - // MARK: - Helpers - - func buildSubject() throws { - let ir: IR = try .mock(schema: schemaSDL, document: document) - subject = ir.schema.referencedTypes.inputObjects.first! - } - - // MARK: - Tests - - func test__compileInputObject__givenNestedInputObjectParameterWithDefaultValue_compilesInputTypeWithDefaultValue() throws { - // given - schemaSDL = """ - type Query { - exampleQuery(input: Input!): String! - } - - input ChildInput { - a: String - b: String - c: String - } - - input Input { - child: ChildInput = { a: "a", b: "b", c: "c" } - } - """ - - document = """ - query TestOperation($input: Input!) { - exampleQuery(input: $input) - } - """ - - // when - try buildSubject() - let childField = subject.fields["child"] - - let expectedDefaultValue = GraphQLValue.object([ - "a": .string("a"), - "b": .string("b"), - "c": .string("c") - ]) - - // then - expect(childField?.defaultValue).to(equal(expectedDefaultValue)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IRNamedFragmentBuilderTests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IRNamedFragmentBuilderTests.swift deleted file mode 100644 index 3c3b3c5985..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IRNamedFragmentBuilderTests.swift +++ /dev/null @@ -1,295 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -import ApolloAPI - -class IRNamedFragmentBuilderTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var fragment: CompilationResult.FragmentDefinition! - var subject: IR.NamedFragment! - - var schema: IR.Schema { ir.schema } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - fragment = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - func buildSubjectFragment() throws { - ir = try .mock(schema: schemaSDL, document: document) - fragment = try XCTUnwrap(ir.compilationResult[fragment: "TestFragment"]) - subject = ir.build(fragment: fragment) - } - - func test__buildFragment__givenFragment_hasConfiguredRootField() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - // when - try buildSubjectFragment() - - let Object_Animal = try ir.schema[interface: "Animal"].xctUnwrapped() - - // then - expect(self.subject.definition).to(beIdenticalTo(fragment)) - expect(self.subject.definition.name).to(equal("TestFragment")) - - expect(self.subject.rootField.underlyingField.name).to(equal("TestFragment")) - expect(self.subject.rootField.underlyingField.type).to(equal(.nonNull(.entity(Object_Animal)))) - expect(self.subject.rootField.underlyingField.selectionSet) - .to(beIdenticalTo(self.fragment.selectionSet)) - - expect(self.subject.rootField.selectionSet.entity.rootType).to(equal(Object_Animal)) - expect(self.subject.rootField.selectionSet.entity.rootTypePath) - .to(equal(LinkedList(Object_Animal))) - expect(self.subject.rootField.selectionSet.entity.location) - .to(equal(.init(source: .namedFragment(self.subject.definition), fieldPath: nil))) - } - - func test__buildFragment__givenFragment_hasNamedFragmentInBuiltFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - // when - try buildSubjectFragment() - - let actual = ir.builtFragments["TestFragment"] - - // then - expect(actual).to(beIdenticalTo(self.subject)) - } - - func test__buildFragment__givenAlreadyBuiltFragment_returnsExistingBuiltFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - // when - try buildSubjectFragment() - - let actual = ir.build(fragment: fragment) - - // then - expect(actual).to(beIdenticalTo(self.subject)) - } - - func test__referencedFragments__givenUsesFragmentsReferencingOtherFragment_includesBothFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - name: String - } - """ - - document = """ - fragment AnimalDetails on Animal { - species - ...AnimalName - } - - fragment AnimalName on Animal { - name - } - - fragment TestFragment on Animal { - ...AnimalDetails - } - """ - - // when - try buildSubjectFragment() - - let expected: OrderedSet = [ - try ir.builtFragments["AnimalDetails"].xctUnwrapped(), - try ir.builtFragments["AnimalName"].xctUnwrapped(), - ] - - // then - expect(self.subject.referencedFragments).to(equal(expected)) - } - - func test__entities__givenUsesMultipleNestedEntities_includingEntitiesInNestedFragments_includesAllEntities() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - name: String - friend: Animal - } - """ - - document = """ - fragment AnimalDetails on Animal { - details1: friend { - details2: friend { - name - } - } - } - - fragment TestFragment on Animal { - test1: friend { - test2: friend { - ...AnimalDetails - } - } - ...AnimalDetails - } - """ - - // when - try buildSubjectFragment() - - let Interface_Animal = try schema[interface: "Animal"].xctUnwrapped() - - let field_root = subject.rootField - let field_test1 = try field_root[field: "test1"].xctUnwrapped() - let field_test1_test2 = try field_test1[field: "test2"].xctUnwrapped() - - let field_test1_test2_details1 = try field_test1_test2[field: "details1"].xctUnwrapped() - let field_test1_test2_details1_details2 = try field_test1_test2_details1[field: "details2"].xctUnwrapped() - - let field_root_details1 = try field_root[field: "details1"].xctUnwrapped() - let field_root_details1_details2 = try field_root_details1[field: "details2"].xctUnwrapped() - - let rootFieldLocation: IR.Entity.Location = .init( - source: .namedFragment(subject.definition), - fieldPath: nil - ) - let test1FieldLocation: IR.Entity.Location = rootFieldLocation + .init(field_test1.underlyingField) - let test2FieldLocation: IR.Entity.Location = test1FieldLocation + .init(field_test1_test2.underlyingField) - let test_details1FieldLocation: IR.Entity.Location = - test2FieldLocation + .init(field_test1_test2_details1.underlyingField) - let test_details2FieldLocation: IR.Entity.Location = - test_details1FieldLocation + .init(field_test1_test2_details1_details2.underlyingField) - let root_details1FieldLocation: IR.Entity.Location = - rootFieldLocation + .init(field_root_details1.underlyingField) - let root_details2FieldLocation: IR.Entity.Location = - root_details1FieldLocation + .init(field_root_details1_details2.underlyingField) - - let rootTypePath: LinkedList = [Interface_Animal] - let test1TypePath: LinkedList = [Interface_Animal, Interface_Animal] - let test2TypePath: LinkedList = [Interface_Animal, Interface_Animal, Interface_Animal] - let test_details1TypePath: LinkedList = [Interface_Animal, Interface_Animal, Interface_Animal, Interface_Animal] - let test_details2TypePath: LinkedList = [Interface_Animal, Interface_Animal, Interface_Animal, Interface_Animal, Interface_Animal] - let root_details1TypePath: LinkedList = [Interface_Animal, Interface_Animal] - let root_details2TypePath: LinkedList = [Interface_Animal, Interface_Animal, Interface_Animal] - - let expected: [IR.Entity.Location: IR.Entity] = [ - rootFieldLocation: IR.Entity(location: rootFieldLocation, rootTypePath: rootTypePath), - test1FieldLocation: IR.Entity(location: test1FieldLocation, rootTypePath: test1TypePath), - test2FieldLocation: IR.Entity(location: test2FieldLocation, rootTypePath: test2TypePath), - test_details1FieldLocation: IR.Entity(location: test_details1FieldLocation, rootTypePath: test_details1TypePath), - test_details2FieldLocation: IR.Entity(location: test_details2FieldLocation, rootTypePath: test_details2TypePath), - root_details1FieldLocation: IR.Entity(location: root_details1FieldLocation, rootTypePath: root_details1TypePath), - root_details2FieldLocation: IR.Entity(location: root_details2FieldLocation, rootTypePath: root_details2TypePath), - ] - - // then - expect(self.subject.entities).to(match(expected)) - } - -} - -// MARK: - Helpers - -extension IR.Entity.Location.FieldComponent { - init(_ field: CompilationResult.Field) { - self.init(name: field.responseKey, type: field.type) - } -} - -// MARK: - Custom Matchers - -fileprivate func match( - _ expectedValue: [IR.Entity.Location: IR.Entity] -) -> Predicate<[IR.Entity.Location: IR.Entity]> { - return Predicate.define { actual in - let message: ExpectationMessage = .expectedActualValueTo("equal \(expectedValue)") - guard var actual = try actual.evaluate(), - actual.count == expectedValue.count else { - return PredicateResult(status: .fail, message: message) - } - - for expected in expectedValue { - guard let actual = actual.removeValue(forKey: expected.key) else { - return PredicateResult(status: .fail, message: message) - } - - if expected.value.rootTypePath != actual.rootTypePath || - expected.value.location != actual.location { - return PredicateResult(status: .fail, message: message) - } - } - - guard actual.isEmpty else { - return PredicateResult(status: .fail, message: message) - } - - return PredicateResult(status: .matches, message: message) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IROperationBuilderTests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IROperationBuilderTests.swift deleted file mode 100644 index 9d3947b6aa..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IROperationBuilderTests.swift +++ /dev/null @@ -1,217 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -import ApolloAPI - -class IROperationBuilderTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: CompilationResult.OperationDefinition! - var subject: IR.Operation! - - var schema: IR.Schema { ir.schema } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - operation = nil - subject = nil - super.tearDown() - } - - // MARK: = Helpers - - func buildSubjectOperation( - named operationName: String? = nil, - fromJSONSchema json: Bool = false - ) throws { - ir = json ? - try .mock(schemaJSON: schemaSDL, document: document) : - try .mock(schema: schemaSDL, document: document) - - if let operationName = operationName { - operation = try XCTUnwrap(ir.compilationResult.operations.first {$0.name == operationName}) - } else { - operation = try XCTUnwrap(ir.compilationResult.operations.first) - } - subject = ir.build(operation: operation) - } - - func test__buildOperation__givenQuery_hasRootFieldAsQuery() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test { - allAnimals { - species - } - } - """ - - // when - try buildSubjectOperation() - - let Object_Query = GraphQLObjectType.mock("Query") - - // then - expect(self.subject.definition.operationType).to(equal(.query)) - - expect(self.subject.rootField.underlyingField.name).to(equal("query")) - expect(self.subject.rootField.underlyingField.type).to(equal(.nonNull(.entity(Object_Query)))) - expect(self.subject.rootField.underlyingField.selectionSet) - .to(beIdenticalTo(self.operation.selectionSet)) - - expect(self.subject.rootField.selectionSet.entity.rootType).to(equal(Object_Query)) - expect(self.subject.rootField.selectionSet.entity.rootTypePath) - .to(equal(LinkedList(Object_Query))) - expect(self.subject.rootField.selectionSet.entity.location) - .to(equal(.init(source: .operation(self.subject.definition), fieldPath: nil))) - } - - func test__buildOperation__givenSubscription_hasRootFieldAsSubscription() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Subscription { - streamAnimal: Animal! - } - - interface Animal { - species: String! - } - """ - - document = """ - subscription Test { - streamAnimal { - species - } - } - """ - - // when - try buildSubjectOperation() - - let Object_Subscription = GraphQLObjectType.mock("Subscription") - - // then - expect(self.subject.definition.operationType).to(equal(.subscription)) - - expect(self.subject.rootField.underlyingField.name).to(equal("subscription")) - expect(self.subject.rootField.underlyingField.type).to(equal(.nonNull(.entity(Object_Subscription)))) - expect(self.subject.rootField.underlyingField.selectionSet) - .to(beIdenticalTo(self.operation.selectionSet)) - - expect(self.subject.rootField.selectionSet.entity.rootType).to(equal(Object_Subscription)) - expect(self.subject.rootField.selectionSet.entity.rootTypePath) - .to(equal(LinkedList(Object_Subscription))) - expect(self.subject.rootField.selectionSet.entity.location) - .to(equal(.init(source: .operation(self.subject.definition), fieldPath: nil))) - } - - func test__buildOperation__givenMutation_hasRootFieldAsMutation() throws { - // given - schemaSDL = """ - type Mutation { - createAnimal: Animal! - } - - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - mutation Test { - createAnimal { - species - } - } - """ - - // when - try buildSubjectOperation() - - let Object_Mutation = GraphQLObjectType.mock("Mutation") - - // then - expect(self.subject.definition.operationType).to(equal(.mutation)) - - expect(self.subject.rootField.underlyingField.name).to(equal("mutation")) - expect(self.subject.rootField.underlyingField.type).to(equal(.nonNull(.entity(Object_Mutation)))) - expect(self.subject.rootField.underlyingField.selectionSet) - .to(beIdenticalTo(self.operation.selectionSet)) - - expect(self.subject.rootField.selectionSet.entity.rootType).to(equal(Object_Mutation)) - expect(self.subject.rootField.selectionSet.entity.rootTypePath) - .to(equal(LinkedList(Object_Mutation))) - expect(self.subject.rootField.selectionSet.entity.location) - .to(equal(.init(source: .operation(self.subject.definition), fieldPath: nil))) - } - - // MARK: - Operation Identifier Computation - - func test__buildOperation__givenOperationWithNoFragments__hasCorrectOperationIdentifier() throws { - // given - document = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.GraphQLOperation(named: "HeroAndFriendsNames") - ) - - schemaSDL = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema) - - let expected = "1e36c3331171b74c012b86caa04fbb01062f37c61227655d9c0729a62c6f7285" - - // when - try buildSubjectOperation(named: "HeroAndFriendsNames", fromJSONSchema: true) - - // then - expect(self.subject.operationIdentifier).to(equal(expected)) - } - - func test__buildOperation__givenOperationWithFragment__hasCorrectOperationIdentifier() throws { - // given - document = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.GraphQLOperation(named: "HeroAndFriendsNamesWithFragment") - ) + "\n" + String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.GraphQLOperation(named: "HeroName") - ) - - schemaSDL = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema) - - let expected = "599cd7d91ede7a5508cdb26b424e3b8e99e6c2c5575b799f6090695289ff8e99" - - // when - try buildSubjectOperation(named: "HeroAndFriendsNamesWithFragment", fromJSONSchema: true) - - // then - expect(self.subject.operationIdentifier).to(equal(expected)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IRRootFieldBuilderTests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IRRootFieldBuilderTests.swift deleted file mode 100644 index 230be54c55..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IRRootFieldBuilderTests.swift +++ /dev/null @@ -1,4324 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -import ApolloAPI - -class IRRootFieldBuilderTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: CompilationResult.OperationDefinition! - var subject: IR.EntityField! - var computedReferencedFragments: IR.RootFieldBuilder.ReferencedFragments! - - var schema: IR.Schema { ir.schema } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - operation = nil - subject = nil - computedReferencedFragments = nil - super.tearDown() - } - - // MARK: - Helpers - - func buildSubjectRootField() throws { - ir = try .mock(schema: schemaSDL, document: document) - operation = try XCTUnwrap(ir.compilationResult.operations.first) - - let result = IR.RootFieldBuilder.buildRootEntityField( - forRootField: .mock( - "query", - type: .nonNull(.entity(operation.rootType)), - selectionSet: operation.selectionSet - ), - onRootEntity: IR.Entity(source: .operation(operation)), - inIR: ir - ) - subject = result.rootField - computedReferencedFragments = result.referencedFragments - } - - // MARK: - Children Computation - - // MARK: Children - Fragment Type - - func test__children__initWithNamedFragmentOnTheSameType_hasNoChildTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = self.subject[field: "allAnimals"]?.selectionSet - - // then - expect(allAnimals?.selections.direct?.inlineFragments).to(beEmpty()) - } - - func test__children__initWithNamedFragmentOnMoreSpecificType_hasChildTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Bird implements Animal { - species: String! - } - """ - - document = """ - query Test { - allAnimals { - ...BirdDetails - } - } - - fragment BirdDetails on Bird { - species - } - """ - - // when - try buildSubjectRootField() - - let Object_Bird = try XCTUnwrap(schema[object: "Bird"]) - let Fragment_BirdDetails = try XCTUnwrap(ir.compilationResult[fragment: "BirdDetails"]) - - let allAnimals = self.subject[field: "allAnimals"]?.selectionSet - - // then - expect(allAnimals?.selections.direct?.inlineFragments.count).to(equal(1)) - - let child = allAnimals?[as: "Bird"] - expect(child?.parentType).to(equal(Object_Bird)) - expect(child?.selections.direct?.namedFragments.values).to(shallowlyMatch([Fragment_BirdDetails])) - } - - func test__children__isObjectType_initWithNamedFragmentOnLessSpecificMatchingType_hasNoChildTypeCase() throws { - // given - schemaSDL = """ - type Query { - birds: [Bird!] - } - - interface Animal { - species: String! - } - - type Bird implements Animal { - species: String! - } - """ - - document = """ - query Test { - birds { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - // when - try buildSubjectRootField() - - let birds = self.subject[field: "birds"]?.selectionSet - - // then - expect(birds?.selections.direct?.inlineFragments).to(beEmpty()) - } - - func test__children__isInterfaceType_initWithNamedFragmentOnLessSpecificMatchingType_hasNoChildTypeCase() throws { - // given - schemaSDL = """ - type Query { - flyingAnimals: [FlyingAnimal!] - } - - interface Animal { - species: String! - } - - interface FlyingAnimal implements Animal { - species: String! - } - """ - - document = """ - query Test { - flyingAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - // when - try buildSubjectRootField() - - let flyingAnimals = self.subject[field: "flyingAnimals"]?.selectionSet - - // then - expect(flyingAnimals?.selections.direct?.inlineFragments).to(beEmpty()) - } - - func test__children__initWithNamedFragmentOnUnrelatedType_hasChildTypeCase() throws { - // given - schemaSDL = """ - type Query { - rocks: [Rock!] - } - - interface Animal { - species: String! - } - - type Rock { - name: String! - } - """ - - document = """ - query Test { - rocks { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Fragment_AnimalDetails = try XCTUnwrap(ir.compilationResult[fragment: "AnimalDetails"]) - - let rocks = self.subject[field: "rocks"]?.selectionSet - - // then - expect(rocks?.selections.direct?.inlineFragments.count).to(equal(1)) - - let child = rocks?[as: "Animal"] - expect(child?.parentType).to(equal(Interface_Animal)) - expect(child?.selections.direct?.namedFragments.count).to(equal(1)) - expect(child?.selections.direct?.namedFragments.values[0].definition).to(equal(Fragment_AnimalDetails)) - } - - // MARK: Children Computation - Union Type - - func test__children__givenIsUnionType_withNestedTypeCaseOfObjectType_hasChildrenForTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Bird { - species: String! - } - - union ClassroomPet = Bird - """ - - document = """ - query Test { - allAnimals { - ... on ClassroomPet { - ... on Bird { - species - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let Object_Bird = try XCTUnwrap(schema[object: "Bird"]) - let Union_ClassroomPet = try XCTUnwrap(schema[union: "ClassroomPet"]) - - let Scalar_String = try XCTUnwrap(schema[scalar: "String"]) - let Field_Species: ShallowFieldMatcher = .mock( - "species", type: .nonNull(.scalar(Scalar_String)) - ) - - let onClassroomPet = subject[field: "allAnimals"]?[as: "ClassroomPet"] - let onClassroomPet_onBird = onClassroomPet?[as:"Bird"] - - // then - expect(onClassroomPet?.parentType).to(beIdenticalTo(Union_ClassroomPet)) - expect(onClassroomPet?.selections.direct?.inlineFragments.count).to(equal(1)) - - expect(onClassroomPet_onBird?.parentType).to(beIdenticalTo(Object_Bird)) - expect(onClassroomPet_onBird?.selections.direct?.fields.values).to(shallowlyMatch([Field_Species])) - } - - // MARK: Children - Type Cases - - func test__children__givenInlineFragment_onSameType_mergesTypeCaseIn_doesNotHaveTypeCaseChild() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - A: String! - B: String! - } - """ - - document = """ - query Test { - aField { # On A - A - ... on A { - B - } - } - } - """ - - // when - try buildSubjectRootField() - - let aField = subject[field: "aField"] - - // then - expect(aField?.selectionSet?.selections.direct?.inlineFragments).to(beEmpty()) - } - - func test__children__givenInlineFragment_onMatchingType_mergesTypeCaseIn_doesNotHaveTypeCaseChild() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - interface A { - A: String! - B: String! - } - - type B implements A { - A: String! - B: String! - } - """ - - document = """ - query Test { - bField { # On B - A - ... on A { - B - } - } - } - """ - - // when - try buildSubjectRootField() - - let Scalar_String = try XCTUnwrap(schema[scalar: "String"]) - let Object_B = try XCTUnwrap(schema[object: "B"]) - - let bField = subject[field: "bField"] - - let expected = SelectionSetMatcher( - parentType: Object_B, - directSelections: [ - .field("A", type: .nonNull(.scalar(Scalar_String))), - .field("B", type: .nonNull(.scalar(Scalar_String))), - ] - ) - - // then - expect(bField?.selectionSet).to(shallowlyMatch(expected)) - } - - func test__children__givenInlineFragment_onNonMatchingType_doesNotMergeTypeCaseIn_hasChildTypeCase() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - interface A { - A: String! - B: String! - } - - type B { - A: String - B: String - } - """ - - document = """ - query Test { - aField { # On A - A - ... on B { - B - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_A = try XCTUnwrap(schema[interface: "A"]) - let Object_B = try XCTUnwrap(schema[object: "B"]) - let Scalar_String = try XCTUnwrap(schema[scalar: "String"]) - - let aField = subject[field: "aField"] as? IR.EntityField - - let expected = SelectionSetMatcher( - parentType: Interface_A, - directSelections: [ - .field("A", type: .nonNull(.scalar(Scalar_String))), - .inlineFragment(parentType: Object_B) - ] - ) - - let asB_expected = SelectionSetMatcher.directOnly( - parentType: Object_B, - directSelections: [ - .field("B", type: .scalar(Scalar_String)), - ] - ) - - // then - expect(aField?.selectionSet).to(shallowlyMatch(expected)) - expect(aField?[as: "B"]).to(shallowlyMatch(asB_expected)) - } - - // MARK: Children - Group Duplicate Type Cases - - func test__children__givenInlineFragmentsWithSameType_deduplicatesChildren() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - interface InterfaceA { - A: String - B: String - } - - type B { - name: String - } - """ - - document = """ - query Test { - bField { - ... on InterfaceA { - A - } - ... on InterfaceA { - B - } - } - } - """ - - // when - try buildSubjectRootField() - - let Object_B = try XCTUnwrap(schema[object: "B"]) - let Interface_A = try XCTUnwrap(schema[interface: "InterfaceA"]) - let Scalar_String = try XCTUnwrap(schema[scalar: "String"]) - - let bField = subject[field: "bField"] as? IR.EntityField - let bField_asInterfaceA = bField?[as: "InterfaceA"] - - let bField_expected = SelectionSetMatcher( - parentType: Object_B, - directSelections: [ - .inlineFragment(parentType: Interface_A), - ] - ) - - let bField_asA_expected = SelectionSetMatcher( - parentType: Interface_A, - directSelections: [ - .field("A", type: .scalar(Scalar_String)), - .field("B", type: .scalar(Scalar_String)), - ] - ) - - // then - expect(bField?.selectionSet).to(shallowlyMatch(bField_expected)) - expect(bField_asInterfaceA).to(shallowlyMatch(bField_asA_expected)) - } - - func test__children__givenInlineFragmentsWithDifferentType_hasSeperateChildTypeCases() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - interface InterfaceA { - A: String - } - - interface InterfaceB { - B: String - } - - type A { - name: String - } - """ - - document = """ - query Test { - aField { - ... on InterfaceA { - A - } - ... on InterfaceB { - B - } - } - } - """ - - // when - try buildSubjectRootField() - - let Scalar_String = try XCTUnwrap(schema[scalar: "String"]) - let Field_A: ShallowSelectionMatcher = .field("A", type: .scalar(Scalar_String)) - let Field_B: ShallowSelectionMatcher = .field("B", type: .scalar(Scalar_String)) - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_asInterfaceA = aField?[as: "InterfaceA"] - let aField_asInterfaceB = aField?[as: "InterfaceB"] - - // then - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(2)) - - expect(aField_asInterfaceA?.parentType).to(equal(GraphQLInterfaceType.mock("InterfaceA"))) - expect(aField_asInterfaceA?.selections.direct).to(shallowlyMatch([Field_A])) - - expect(aField_asInterfaceB?.parentType).to(equal(GraphQLInterfaceType.mock("InterfaceB"))) - expect(aField_asInterfaceB?.selections.direct).to(shallowlyMatch([Field_B])) - } - - // MARK: Children - Group Duplicate Fragments - - func test__children__givenDuplicateNamedFragments_onNonMatchingParentType_hasDeduplicatedTypeCaseWithChildFragment() throws { - // given - schemaSDL = """ - type Query { - aField: [InterfaceA!] - } - - interface InterfaceA { - a: String - } - - interface InterfaceB { - b: String - } - """ - - document = """ - fragment FragmentB on InterfaceB { - b - } - - query Test { - aField { - ... FragmentB - ... FragmentB - } - } - """ - // when - try buildSubjectRootField() - - let InterfaceB = try XCTUnwrap(schema[interface: "InterfaceB"]) - let FragmentB = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB"]) - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_asInterfaceB = aField?[as: "InterfaceB"] - - // then - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(1)) - - expect(aField_asInterfaceB?.parentType).to(equal(InterfaceB)) - expect(aField_asInterfaceB?.selections.direct).to(shallowlyMatch([.fragmentSpread(FragmentB)])) - } - - func test__children__givenTwoNamedFragments_onSameNonMatchingParentType_hasDeduplicatedTypeCaseWithBothChildFragments() throws { - // given - schemaSDL = """ - type Query { - aField: [InterfaceA!] - } - - interface InterfaceA { - a: String - } - - interface InterfaceB { - b: String - c: String - } - """ - - document = """ - fragment FragmentB1 on InterfaceB { - b - } - - fragment FragmentB2 on InterfaceB { - c - } - - query Test { - aField { - ...FragmentB1 - ...FragmentB2 - } - } - """ - - // when - try buildSubjectRootField() - - let InterfaceB = try XCTUnwrap(schema[interface: "InterfaceB"]) - let FragmentB1 = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB1"]) - let FragmentB2 = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB2"]) - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_asInterfaceB = aField?[as: "InterfaceB"] - - // then - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(1)) - - expect(aField_asInterfaceB?.parentType).to(equal(InterfaceB)) - expect(aField_asInterfaceB?.selections.direct).to(shallowlyMatch([ - .fragmentSpread(FragmentB1), - .fragmentSpread(FragmentB2) - ])) - } - - // MARK: - Selections - - // MARK: Selections - Group Duplicate Fields - - func test__selections__givenFieldSelectionsWithSameName_scalarType_deduplicatesSelection() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: String - } - """ - - document = """ - query Test { - aField { - a - a - } - } - """ - - let expected: [ShallowSelectionMatcher] = [ - .field("a", type: .string()) - ] - - // when - try buildSubjectRootField() - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenFieldSelectionsWithSameNameDifferentAlias_scalarType_doesNotDeduplicateSelection() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: String - } - """ - - document = """ - query Test { - aField { - b: a - c: a - } - } - """ - - let expected: [ShallowSelectionMatcher] = [ - .field("a", alias: "b", type: .string()), - .field("a", alias: "c", type: .string()) - ] - - // when - try buildSubjectRootField() - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenFieldSelectionsWithSameResponseKey_onObjectWithDifferentChildSelections_mergesChildSelectionsIntoOneField() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: A - b: String - c: Int - } - """ - - document = """ - query Test { - aField { - a { - b - } - a { - c - } - } - } - """ - - let expectedAFields: [ShallowSelectionMatcher] = [ - .field("b", type: .string()), - .field("c", type: .integer()) - ] - - // when - try buildSubjectRootField() - - let Object_A = try XCTUnwrap(schema[object: "A"]) - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_a = aField?[field: "a"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct?.fields.count).to(equal(1)) - expect(aField?.selectionSet.parentType).to(equal(Object_A)) - expect(aField_a?.selectionSet.parentType).to(equal(Object_A)) - expect(aField_a?.selectionSet.selections.direct).to(shallowlyMatch(expectedAFields)) - } - - func test__selections__givenFieldSelectionsWithSameResponseKey_onObjectWithSameAndDifferentChildSelections_mergesChildSelectionsAndDoesNotDuplicateFields() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: A - b: Int - c: Boolean - d: String - } - """ - - document = """ - query Test { - aField { - a { - b - c - } - a { - b - d - } - } - } - """ - - let expectedAFields: [ShallowSelectionMatcher] = [ - .field("b", type: .integer()), - .field("c", type: .boolean()), - .field("d", type: .string()), - ] - - // when - try buildSubjectRootField() - - let Object_A = try XCTUnwrap(schema[object: "A"]) - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_a = aField?[field: "a"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct?.fields.count).to(equal(1)) - expect(aField?.selectionSet.parentType).to(equal(Object_A)) - expect(aField_a?.selectionSet.parentType).to(equal(Object_A)) - expect(aField_a?.selectionSet.selections.direct).to(shallowlyMatch(expectedAFields)) - } - - // MARK: Selections - Type Cases - - func test__selections__givenInlineFragment_onSameType_mergesTypeCaseIn() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: String - b: Int - } - """ - - document = """ - query Test { - aField { - a - ... on A { - b - } - } - } - """ - - let expected: [ShallowSelectionMatcher] = [ - .field("a", type: .string()), - .field("b", type: .integer()), - ] - - // when - try buildSubjectRootField() - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragment_onMatchingType_mergesTypeCaseIn() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - interface A { - a: String - } - - type B implements A { - a: String - b: Int - } - """ - - document = """ - query Test { - bField { - b - ... on A { - a - } - } - } - """ - - let expected: [ShallowSelectionMatcher] = [ - .field("b", type: .integer()), - .field("a", type: .string()), - ] - - // when - try buildSubjectRootField() - - let bField = subject[field: "bField"] as? IR.EntityField - - // then - expect(bField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragment_onNonMatchingType_doesNotMergeTypeCaseIn() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - interface A { - a: String - } - - type B { - a: String - b: Int - } - """ - - document = """ - query Test { - aField { - a - ... on B { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_asB = aField?[as: "B"] - - // then - expect(aField?.selectionSet.selections.direct?.fields.values).to(shallowlyMatch([ - .field("a", type: .string()) - ])) - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(1)) - - expect(aField_asB?.selections.direct).to(shallowlyMatch([ - .field("b", type: .integer()) - ])) - } - - // MARK: Selections - Group Duplicate Type Cases - - func test__selections__givenInlineFragmentsWithSameInterfaceType_deduplicatesSelection() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - interface A { - a: String - } - - type B { - b: Int - } - """ - - document = """ - query Test { - bField { - ... on A { a } - ... on A { a } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_A = try XCTUnwrap(schema[interface: "A"]) - - let expected: [ShallowSelectionMatcher] = [ - .inlineFragment(parentType: Interface_A) - ] - - let bField = subject[field: "bField"] as? IR.EntityField - - // then - expect(bField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragmentsWithSameInterfaceType_deduplicatesTypeCaseMergesSelections() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - interface A { - a: String - b: Int - } - - type B { - c: Int - } - """ - - document = """ - query Test { - bField { - ... on A { a } - ... on A { b } - } - } - """ - - // when - try buildSubjectRootField() - - let expected: [ShallowSelectionMatcher] = [ - .field("a", type: .string()), - .field("b", type: .integer()) - ] - - let actual = subject[field: "bField"]?[as: "A"] - - // then - expect(actual?.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragmentsWithSameObjectType_deduplicatesSelection() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - type A { - a: String - } - - type B { - b: Int - } - """ - - document = """ - query Test { - bField { - ... on A { a } - ... on A { a } - } - } - """ - - // when - try buildSubjectRootField() - - let Object_A = try XCTUnwrap(schema[object: "A"]) - - let expected: [ShallowSelectionMatcher] = [ - .inlineFragment(parentType: Object_A) - ] - - let bField = subject[field: "bField"] as? IR.EntityField - - // then - expect(bField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragmentsWithSameUnionType_deduplicatesSelection() throws { - // given - schemaSDL = """ - type Query { - bField: [B!] - } - - type A { - a1: String - a2: String - } - - union UnionA = A - - type B { - b: Int - } - """ - - document = """ - query Test { - bField { - ... on UnionA { ...on A { a1 } } - ... on UnionA { ...on A { a2 } } - } - } - """ - - // when - try buildSubjectRootField() - - let Union_A = try XCTUnwrap(schema[union: "UnionA"]) - - let expected: [ShallowSelectionMatcher] = [ - .inlineFragment(parentType: Union_A) - ] - - let bField = subject[field: "bField"] as? IR.EntityField - - // then - expect(bField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragmentsWithDifferentType_doesNotDeduplicateSelection() throws { - schemaSDL = """ - type Query { - objField: [Object!] - } - - type Object { - name: String - } - - interface A { - a: String - } - - interface B { - b: String - } - """ - - document = """ - query Test { - objField { - ... on A { a } - ... on B { b } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_A = try XCTUnwrap(schema[interface: "A"]) - let Interface_B = try XCTUnwrap(schema[interface: "B"]) - - let expected: [ShallowSelectionMatcher] = [ - .inlineFragment(parentType: Interface_A), - .inlineFragment(parentType: Interface_B), - ] - - let objField = subject[field: "objField"] as? IR.EntityField - - // then - expect(objField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenInlineFragmentsWithSameType_withSameAndDifferentChildSelections_mergesChildSelectionsIntoOneTypeCaseAndDeduplicatesChildSelections() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: A - } - - interface B { - b: Int - c: Boolean - d: String - } - """ - - document = """ - query Test { - aField { - ... on B { - b - c - } - ... on B { - b - d - } - } - } - """ - - let expected: [ShallowSelectionMatcher] = [ - .field("b", type: .integer()), - .field("c", type: .boolean()), - .field("d", type: .string()), - ] - - // when - try buildSubjectRootField() - - let Interface_B = try XCTUnwrap(schema[interface:"B"]) - - let aField = subject[field: "aField"] as? IR.EntityField - let aField_asB = aField?[as: "B"] - - // then - expect(aField_asB?.parentType).to(equal(Interface_B)) - expect(aField_asB?.selections.direct).to(shallowlyMatch(expected)) - } - - // MARK: Selections - Fragments - - func test__selections__givenNamedFragmentWithSelectionSet_onMatchingParentType_hasFragmentSelection() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - } - """ - - document = """ - fragment FragmentA on A { - a - } - - query Test { - aField { - ...FragmentA - } - } - """ - - // when - try buildSubjectRootField() - - let Object_A = try XCTUnwrap(schema[object: "A"]) - - let expected: [ShallowSelectionMatcher] = [ - .fragmentSpread("FragmentA", type: Object_A), - ] - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - // MARK: Selections - Group Duplicate Fragments - - func test__selections__givenNamedFragmentsWithSameName_onMatchingParentType_deduplicatesSelection() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - } - """ - - document = """ - fragment FragmentA on A { - a - } - - query Test { - aField { - ...FragmentA - ...FragmentA - } - } - """ - - // when - try buildSubjectRootField() - - let Object_A = try XCTUnwrap(schema[object: "A"]) - - let expected: [ShallowSelectionMatcher] = [ - .fragmentSpread("FragmentA", type: Object_A), - ] - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenNamedFragmentsWithDifferentNames_onMatchingParentType_doesNotDeduplicateSelection() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - b: String - } - """ - - document = """ - fragment FragmentA1 on A { - a - } - - fragment FragmentA2 on A { - b - } - - query Test { - aField { - ...FragmentA1 - ...FragmentA2 - } - } - """ - - // when - try buildSubjectRootField() - - let Object_A = try XCTUnwrap(schema[object: "A"]) - - let expected: [ShallowSelectionMatcher] = [ - .fragmentSpread("FragmentA1", type: Object_A), - .fragmentSpread("FragmentA2", type: Object_A), - ] - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenNamedFragmentsWithSameName_onNonMatchingParentType_deduplicatesSelectionIntoSingleTypeCase() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - b: String - } - - interface B { - b: String - } - """ - - document = """ - fragment FragmentB on B { - b - } - - query Test { - aField { - ...FragmentB - ...FragmentB - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_B = try XCTUnwrap(schema[interface: "B"]) - - let expected: [ShallowSelectionMatcher] = [ - .fragmentSpread("FragmentB", type: Interface_B) - ] - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct?.fields.count).to(equal(0)) - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(1)) - expect(aField?[as: "B"]?.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenNamedFragmentsWithDifferentNamesAndSameParentType_onNonMatchingParentType_deduplicatesSelectionIntoSingleTypeCaseWithBothFragments() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - } - - interface B { - b1: String - b2: String - } - """ - - document = """ - fragment FragmentB1 on B { - b1 - } - - fragment FragmentB2 on B { - b2 - } - - query Test { - aField { - ...FragmentB1 - ...FragmentB2 - } - } - """ - - // when - try buildSubjectRootField() - - let Fragment_B1 = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB1"]) - let Fragment_B2 = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB2"]) - - let expected: [ShallowSelectionMatcher] = [ - .fragmentSpread(Fragment_B1), - .fragmentSpread(Fragment_B2), - ] - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct?.fields.count).to(equal(0)) - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(1)) - expect(aField?[as: "B"]?.selections.direct).to(shallowlyMatch(expected)) - } - - func test__selections__givenNamedFragmentsWithDifferentNamesAndDifferentParentType_onNonMatchingParentType_doesNotDeduplicate_hasTypeCaseForEachFragment() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - } - - interface B { - b: String - } - - interface C { - c: String - } - """ - - document = """ - fragment FragmentB on B { - b - } - - fragment FragmentC on C { - c - } - - query Test { - aField { - ...FragmentB - ...FragmentC - } - } - """ - - // when - try buildSubjectRootField() - - let Fragment_B = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB"]) - let Fragment_C = try XCTUnwrap(ir.compilationResult[fragment: "FragmentC"]) - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct?.fields.count).to(equal(0)) - expect(aField?.selectionSet.selections.direct?.inlineFragments.count).to(equal(2)) - expect(aField?[as: "B"]?.selections.direct).to(shallowlyMatch([.fragmentSpread(Fragment_B)])) - expect(aField?[as: "C"]?.selections.direct).to(shallowlyMatch([.fragmentSpread(Fragment_C)])) - } - - // MARK: Selections - Nested Objects - - func test__selections__givenNestedObjectInRootAndTypeCase_doesNotInheritSelectionsFromRoot() throws { - // given - schemaSDL = """ - type Query { - childContainer: HasChild! - } - - interface HasChild { - child: Child - } - - type Root { - child: Child - } - - type Child { - a: Int - b: Int - } - """ - - document = """ - query Test { - childContainer { - child { - a - } - ... on Root { - child { - b - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let expected: [ShallowSelectionMatcher] = [ - .field("b", type: .integer()) - ] - - let asRoot_child = subject[field: "childContainer"]?[as: "Root"]?[field: "child"] as? IR.EntityField - - // then - expect(asRoot_child?.selectionSet.selections.direct).to(shallowlyMatch(expected)) - } - - // MARK: - Merged Selections - - func test__mergedSelections__givenSelectionSetWithSelections_returnsSelections() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - } - """ - - document = """ - query Test { - aField { - a - } - } - """ - - // when - try buildSubjectRootField() - - let expected_direct: [ShallowSelectionMatcher] = [ - .field("a", type: .scalar(.integer())) - ] - let expected_merged: [ShallowSelectionMatcher] = [ - ] - - let aField = subject[field: "aField"] as? IR.EntityField - - // then - expect(aField?.selectionSet.selections.direct).to(shallowlyMatch(expected_direct)) - expect(aField?.selectionSet.selections.merged).to(shallowlyMatch(expected_merged)) - } - - func test__mergedSelections__givenSelectionSetWithSelectionsAndParentFields_returnsSelfAndParentFields() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - a: Int - } - - type B { - b: Int - } - """ - - document = """ - query Test { - aField { - a - ... on B { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let expected = SelectionsMatcher( - direct: [ - .field("b", type: .integer()), - ], - merged: [ - .field("a", type: .integer()), - ], - mergedSources: [ - try .mock(subject[field: "aField"]) - ] - ) - - let actual = subject[field: "aField"]?[as: "B"] - - // then - expect(actual).to(shallowlyMatch(expected)) - } - - // MARK: - Merged Selections - Siblings - - // MARK: Merged Selections - Siblings - Object Type <-> Object Type - - func test__mergedSelections__givenIsObjectType_siblingSelectionSetIsDifferentObjectType_doesNotMergesSiblingSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - type Bird implements Animal { - species: String - wingspan: Int - } - - type Cat implements Animal { - species: String - } - """ - - document = """ - query Test { - allAnimals { - ... on Bird { - wingspan - } - ... on Cat { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let asBirdExpected: [ShallowSelectionMatcher] = [ - .field("wingspan", type: .integer()), - ] - let asCatExpected: [ShallowSelectionMatcher] = [ - .field("species", type: .string()), - ] - - let allAnimals = subject[field: "allAnimals"] - let asBird = allAnimals?[as: "Bird"] - let asCat = allAnimals?[as: "Cat"] - - // then - expect(asBird?.selections.merged).to(beEmpty()) - expect(asBird?.selections.direct).to(shallowlyMatch(asBirdExpected)) - expect(asCat?.selections.merged).to(beEmpty()) - expect(asCat?.selections.direct).to(shallowlyMatch(asCatExpected)) - } - - // MARK: Merged Selections - Siblings - Object Type -> Interface Type - - func test__mergedSelections__givenIsObjectType_siblingSelectionSetIsImplementedInterface_mergesSiblingSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - species: String - } - - type Bird implements Pet { - species: String - wingspan: Int - } - """ - - document = """ - query Test { - allAnimals { - ... on Bird { - wingspan - } - ... on Pet { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asBird = allAnimals?[as: "Bird"] - let asPet = allAnimals?[as: "Pet"] - - let asBirdExpected = SelectionsMatcher( - direct: [ - .field("wingspan", type: .integer()), - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(asPet) - ] - ) - - let asPetExpected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - - // then - expect(asBird).to(shallowlyMatch(asBirdExpected)) - expect(asPet).to(shallowlyMatch(asPetExpected)) - } - - func test__mergedSelections__givenIsObjectType_siblingSelectionSetIsUnimplementedInterface_doesNotMergeSiblingSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - species: String - } - - type Bird { - species: String - wingspan: Int - } - """ - - document = """ - query Test { - allAnimals { - ... on Bird { - wingspan - } - ... on Pet { # Bird does not implement Pet - species - } - } - } - """ - - let asBirdExpected = SelectionsMatcher( - direct: [ - .field("wingspan", type: .integer()), - ], - merged: [ - ] - ) - - let asPetExpected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asBird = allAnimals?[as: "Bird"] - let asPet = allAnimals?[as: "Pet"] - - // then - expect(asBird).to(shallowlyMatch(asBirdExpected)) - expect(asPet).to(shallowlyMatch(asPetExpected)) - } - - // MARK: Merged Selections - Siblings - Interface Type -> Interface Type - - func test__mergedSelections__givenIsInterfaceType_siblingSelectionSetIsImplementedInterface_mergesSiblingSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - species: String - } - - interface HousePet implements Pet { - species: String - humanName: String - } - """ - - document = """ - query Test { - allAnimals { - ... on HousePet { - humanName - } - ... on Pet { # HousePet Implements Pet - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asHousePet = allAnimals?[as: "HousePet"] - let asPet = allAnimals?[as: "Pet"] - - let asHousePetExpected = SelectionsMatcher( - direct: [ - .field("humanName", type: .string()), - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(asPet) - ] - ) - - let asPetExpected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // then - expect(asHousePet).to(shallowlyMatch(asHousePetExpected)) - expect(asPet).to(shallowlyMatch(asPetExpected)) - } - - func test__mergedSelections__givenIsInterfaceType_siblingSelectionSetIsUnimplementedInterface_doesNotMergeSiblingSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - species: String - } - - interface HousePet { - humanName: String - } - """ - - document = """ - query Test { - allAnimals { - ... on HousePet { - humanName - } - ... on Pet { # HousePet does not implement Pet - species - } - } - } - """ - - let asHousePetExpected = SelectionsMatcher( - direct: [ - .field("humanName", type: .string()), - ], - merged: [ - ] - ) - - let asPetExpected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asHousePet = allAnimals?[as: "HousePet"] - let asPet = allAnimals?[as: "Pet"] - - // then - expect(asHousePet).to(shallowlyMatch(asHousePetExpected)) - expect(asPet).to(shallowlyMatch(asPetExpected)) - } - - // MARK: - Merged Selections - Parent's Sibling - - func test__mergedSelections__givenIsNestedInterfaceType_uncleSelectionSetIsTheSameInterfaceType_mergesUncleSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface WarmBlooded { - bodyTemperature: Int - } - - interface Pet implements Animal { - species: String - humanName: String - } - """ - - document = """ - query Test { - allAnimals { - ... on WarmBlooded { - ... on Pet { - humanName - } - } - ... on Pet { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asWarmBlooded_asPet_actual = allAnimals?[as:"WarmBlooded"]?[as: "Pet"] - let asPet_actual = allAnimals?[as: "Pet"] - - let onWarmBlooded_onPet_expected = SelectionsMatcher( - direct: [ - .field("humanName", type: .string()), - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(asPet_actual) - ] - ) - - let onPet_expected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // then - expect(asWarmBlooded_asPet_actual).to(shallowlyMatch(onWarmBlooded_onPet_expected)) - expect(asPet_actual).to(shallowlyMatch(onPet_expected)) - } - - func test__mergedSelections__givenIsObjectInInterfaceType_uncleSelectionSetIsMatchingInterfaceType_mergesUncleSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface WarmBlooded { - bodyTemperature: Int - } - - interface Pet { - humanName: String - species: String - } - - type Bird implements Pet { - wingspan: Int - humanName: String - species: String - } - """ - - document = """ - query Test { - allAnimals { - ... on WarmBlooded { - ... on Bird { - wingspan - } - } - ... on Pet { # Bird Implements Pet - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asWarmBlooded_asBird_actual = allAnimals?[as: "WarmBlooded"]?[as: "Bird"] - let asPet_actual = allAnimals?[as: "Pet"] - - let onWarmBlooded_onBird_expected = SelectionsMatcher( - direct: [ - .field("wingspan", type: .integer()), - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(asPet_actual) - ] - ) - - let onPet_expected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // then - expect(asWarmBlooded_asBird_actual).to(shallowlyMatch(onWarmBlooded_onBird_expected)) - expect(asPet_actual).to(shallowlyMatch(onPet_expected)) - } - - func test__mergedSelections__givenIsObjectInInterfaceType_uncleSelectionSetIsNonMatchingInterfaceType_doesNotMergeUncleSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface WarmBlooded { - bodyTemperature: Int - } - - interface Pet { - humanName: String - species: String - } - - type Bird { - wingspan: Int - } - """ - - document = """ - query Test { - allAnimals { - ... on WarmBlooded { - ... on Bird { - wingspan - } - } - ... on Pet { # Bird Does Not Implement Pet - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asWarmBlooded_asBird_actual = allAnimals?[as: "WarmBlooded"]?[as: "Bird"] - let asPet_actual = allAnimals?[as: "Pet"] - - let asWarmBlooded_asBird_expected = SelectionsMatcher( - direct: [ - .field("wingspan", type: .integer()), - ], - merged: [ - ] - ) - - let asPet_expected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // then - expect(asWarmBlooded_asBird_actual).to(shallowlyMatch(asWarmBlooded_asBird_expected)) - expect(asPet_actual).to(shallowlyMatch(asPet_expected)) - } - - // MARK: Merged Selections - Parent's Sibling - Object Type <-> Object in Union Type - - func test__mergedSelections__givenIsObjectType_siblingSelectionSetIsUnionTypeWithNestedTypeCaseOfSameObjectType_mergesSiblingChildSelectionsInBothDirections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - type Bird implements Animal { - wingspan: Int - species: String - } - - union ClassroomPet = Bird - """ - - document = """ - query Test { - allAnimals { - ... on Bird { - wingspan - } - ... on ClassroomPet { - ... on Bird { - species - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asBirdActual = allAnimals?[as: "Bird"] - let asClassroomPet_asBirdActual = allAnimals?[as: "ClassroomPet"]?[as: "Bird"] - - let asBirdExpected = SelectionsMatcher( - direct: [ - .field("wingspan", type: .integer()) - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(asClassroomPet_asBirdActual) - ] - ) - - let asClassroomPet_asBirdExpected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - .field("wingspan", type: .integer()) - ], - mergedSources: [ - try .mock(asBirdActual) - ] - ) - - // then - expect(asBirdActual).to(shallowlyMatch(asBirdExpected)) - expect(asClassroomPet_asBirdActual).to(shallowlyMatch(asClassroomPet_asBirdExpected)) - } - - func test__mergedSelections__givenIsObjectType_siblingSelectionSetIsUnionTypeWithNestedTypeCaseOfDifferentObjectType_doesNotMergeSiblingChildSelectionsInEitherDirection() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - type Bird implements Animal { - wingspan: Int - species: String - } - - type Cat implements Animal { - species: String - } - - union ClassroomPet = Bird | Cat - """ - - document = """ - query Test { - allAnimals { - ... on Bird { - wingspan - } - ... on ClassroomPet { - ... on Cat { - species - } - } - } - } - """ - - let asBirdExpected = SelectionsMatcher( - direct: [ - .field("wingspan", type: .integer()) - ], - merged: [ - ] - ) - - let asClassroomPet_asCatExpected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - let asBirdActual = allAnimals?[as: "Bird"] - let asClassroomPet_asCatActual = allAnimals?[as: "ClassroomPet"]?[as: "Cat"] - - // then - expect(asBirdActual).to(shallowlyMatch(asBirdExpected)) - expect(asClassroomPet_asCatActual).to(shallowlyMatch(asClassroomPet_asCatExpected)) - } - - // MARK: Merged Selections - Parent's Sibling - Interface in Union Type - - func test__mergedSelections__givenInterfaceTypeInUnion_uncleSelectionSetIsMatchingInterfaceType_mergesUncleSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface WarmBlooded implements Animal { - bodyTemperature: Int - species: String - } - - type Bird implements Animal { - wingspan: Int - species: String - } - - union ClassroomPet = Bird - """ - - document = """ - query Test { - allAnimals { - ... on WarmBlooded { - bodyTemperature - } - ... on ClassroomPet { - ... on WarmBlooded { - species - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asWarmBlooded_actual = allAnimals?[as: "WarmBlooded"] - let asClassroomPet_asWarmBlooded_actual = allAnimals?[as: "ClassroomPet"]?[as: "WarmBlooded"] - - let asWarmBlooded_expected = SelectionsMatcher( - direct: [ - .field("bodyTemperature", type: .integer()), - ], - merged: [ - ] - ) - - let asClassroomPet_asWarmBlooded_expected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - .field("bodyTemperature", type: .integer()), - ], - mergedSources: [ - try .mock(asWarmBlooded_actual) - ] - ) - - // then - expect(asWarmBlooded_actual).to(shallowlyMatch(asWarmBlooded_expected)) - expect(asClassroomPet_asWarmBlooded_actual).to(shallowlyMatch(asClassroomPet_asWarmBlooded_expected)) - } - - func test__mergedSelections__givenInterfaceTypeInUnion_uncleSelectionSetIsChildMatchingInterfaceType_mergesUncleSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - humanName: String - species: String - } - - interface WarmBloodedPet implements Pet { - bodyTemperature: Int - species: String - humanName: String - } - - type Cat implements WarmBloodedPet & Pet { - bodyTemperature: Int - species: String - humanName: String - } - - union ClassroomPet = Cat - """ - - document = """ - query Test { - allAnimals { - ... on Pet { - humanName - } - ... on ClassroomPet { - ... on WarmBloodedPet { # WarmBloodedPet implements Pet - species - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asPet_actual = allAnimals?[as: "Pet"] - let asClassroomPet_asWarmBloodedPet_actual = allAnimals?[as: "ClassroomPet"]?[as: "WarmBloodedPet"] - - let asPet_expected = SelectionsMatcher( - direct: [ - .field("humanName", type: .string()), - ], - merged: [ - ] - ) - - let asClassroomPet_asWarmBloodedPet_expected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - .field("humanName", type: .string()), - ], - mergedSources: [ - try .mock(asPet_actual) - ] - ) - - // then - expect(asPet_actual).to(shallowlyMatch(asPet_expected)) - expect(asClassroomPet_asWarmBloodedPet_actual).to(shallowlyMatch(asClassroomPet_asWarmBloodedPet_expected)) - } - - func test__mergedSelections__givenInterfaceTypeInUnion_uncleSelectionSetIsNonMatchingInterfaceType_doesNotMergesUncleSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - interface Pet { - humanName: String - species: String - } - - interface WarmBlooded { - bodyTemperature: Int - species: String - humanName: String - } - - type Cat implements WarmBlooded & Pet { - bodyTemperature: Int - species: String - humanName: String - } - - union ClassroomPet = Cat - """ - - document = """ - query Test { - allAnimals { - ... on WarmBlooded { - bodyTemperature - } - ... on ClassroomPet { - ... on Pet { - species - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - let asWarmBlooded_actual = allAnimals?[as: "WarmBlooded"] - - let asClassroomPet_asPet_actual = allAnimals?[as: "ClassroomPet"]?[as: "Pet"] - - let asWarmBlooded_expected = SelectionsMatcher( - direct: [ - .field("bodyTemperature", type: .integer()), - ], - merged: [ - ] - ) - - let asClassroomPet_asPet_expected = SelectionsMatcher( - direct: [ - .field("species", type: .string()), - ], - merged: [ - ] - ) - - // then - expect(asWarmBlooded_actual).to(shallowlyMatch(asWarmBlooded_expected)) - expect(asClassroomPet_asPet_actual).to(shallowlyMatch(asClassroomPet_asPet_expected)) - } - - // MARK: - Merged Selections - Child Fragment - - func test__mergedSelections__givenChildIsNamedFragmentOnSameType_mergesFragmentFieldsAndMaintainsFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - """ - - document = """ - query Test { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let Fragment_AnimalDetails = try XCTUnwrap(allAnimals?[fragment: "AnimalDetails"]) - let actual = allAnimals?.selectionSet - - let expected = SelectionsMatcher( - direct: [ - .fragmentSpread(Fragment_AnimalDetails.definition) - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(Fragment_AnimalDetails) - ] - ) - - // then - expect(actual).to(shallowlyMatch(expected)) - } - - func test__mergedSelections__givenChildIsNamedFragmentOnSameType_fragmentSpreadTypePathIsCorrect() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - """ - - document = """ - query Test { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - // when - try buildSubjectRootField() - - let actual = subject[field: "allAnimals"]?[fragment: "AnimalDetails"] - - let query_TypeScope = IR.ScopeDescriptor.descriptor( - forType: operation.rootType, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes) - - let allAnimals_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[interface: "Animal"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ) - - let expectedTypePath = LinkedList([ - query_TypeScope, - allAnimals_TypeScope, - ]) - - // then - expect(actual?.typeInfo.scopePath).to(equal(expectedTypePath)) - } - - func test__mergedSelections__givenChildIsNamedFragmentOnMoreSpecificType_doesNotMergeFragmentFields_hasTypeCaseForNamedFragmentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - type Bird implements Animal { - species: String - } - """ - - document = """ - query Test { - allAnimals { - ...BirdDetails - } - } - - fragment BirdDetails on Bird { - species - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Object_Bird = try XCTUnwrap(schema[object: "Bird"]) - let Fragment_BirdDetails = try XCTUnwrap(ir.compilationResult[fragment: "BirdDetails"]) - - let allAnimals = subject[field: "allAnimals"] - - let allAnimals_expected = SelectionSetMatcher( - parentType: Interface_Animal, - directSelections: [ - .inlineFragment(parentType: Object_Bird) - ], - mergedSelections: [], - mergedSources: [] - ) - - let allAnimals_asBird_expected = SelectionSetMatcher( - parentType: Object_Bird, - directSelections: [ - .fragmentSpread(Fragment_BirdDetails) - ], - mergedSelections: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(allAnimals?[as: "Bird"]?[fragment: "BirdDetails"]) - ] - ) - - let actual = allAnimals?.selectionSet - - // then - expect(actual).to(shallowlyMatch(allAnimals_expected)) - expect(actual?[as: "Bird"]).to(shallowlyMatch(allAnimals_asBird_expected)) - } - - func test__mergedSelections__givenChildIsNamedFragmentOnMultipleNestedMoreSpecificTypes_doesNotMergeFragmentFields_hasTypeCaseForNamedFragmentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - species: String - } - - type Bird implements Animal & Pet { - species: String - } - """ - - document = """ - query Test { - allAnimals { - ... on Pet { - ...BirdDetails - } - } - } - - fragment BirdDetails on Bird { - species - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - let Object_Bird = try XCTUnwrap(schema[object: "Bird"]) - let Fragment_BirdDetails = try XCTUnwrap(ir.compilationResult[fragment: "BirdDetails"]) - - let allAnimals = subject[field: "allAnimals"] - - let allAnimals_expected = SelectionSetMatcher( - parentType: Interface_Animal, - directSelections: [ - .inlineFragment(parentType: Interface_Pet) - ], - mergedSelections: [], - mergedSources: [] - ) - - let allAnimals_asPet_expected = SelectionSetMatcher( - parentType: Interface_Pet, - directSelections: [ - .inlineFragment(parentType: Object_Bird) - ], - mergedSelections: [], - mergedSources: [] - ) - - let allAnimals_asPet_asBird_expected = SelectionSetMatcher( - parentType: Object_Bird, - directSelections: [ - .fragmentSpread(Fragment_BirdDetails) - ], - mergedSelections: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(allAnimals?[as: "Pet"]?[as: "Bird"]?[fragment: "BirdDetails"]) - ] - ) - - let actual = allAnimals?.selectionSet - - // then - expect(actual).to(shallowlyMatch(allAnimals_expected)) - expect(actual?[as: "Pet"]).to(shallowlyMatch(allAnimals_asPet_expected)) - expect(actual?[as: "Pet"]?[as: "Bird"]).to(shallowlyMatch(allAnimals_asPet_asBird_expected)) - } - - func test__mergedSelections__givenIsObjectType_childIsNamedFragmentOnLessSpecificMatchingType_mergesFragmentFields() throws { - // given - schemaSDL = """ - type Query { - birds: [Bird!] - } - - interface Animal { - species: String - } - - type Bird implements Animal { - species: String - } - """ - - document = """ - fragment AnimalDetails on Animal { - species - } - - query Test { - birds { - ...AnimalDetails - } - } - """ - - // when - try buildSubjectRootField() - - - let birds = subject[field: "birds"] - let actual = birds?.selectionSet - - let Fragment_AnimalDetails = try XCTUnwrap(birds?[fragment: "AnimalDetails"]) - - let expected = SelectionsMatcher( - direct: [ - .fragmentSpread(Fragment_AnimalDetails.definition) - ], - merged: [ - .field("species", type: .string()) - ], - mergedSources: [ - try .mock(Fragment_AnimalDetails) - ] - ) - - // then - expect(actual).to(shallowlyMatch(expected)) - } - - func test__mergedSelections__givenIsInterfaceType_childIsNamedFragmentOnLessSpecificMatchingType_mergesFragmentFields() throws { - // given - schemaSDL = """ - type Query { - flyingAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface FlyingAnimal implements Animal { - species: String - } - """ - - document = """ - fragment AnimalDetails on Animal { - species - } - - query Test { - flyingAnimals { - ...AnimalDetails - } - } - """ - - // when - try buildSubjectRootField() - - - let flyingAnimals = subject[field: "flyingAnimals"] - let actual = flyingAnimals?.selectionSet - - let Fragment_AnimalDetails = try XCTUnwrap(flyingAnimals?[fragment: "AnimalDetails"]) - - let expected = SelectionsMatcher( - direct: [ - .fragmentSpread(Fragment_AnimalDetails.definition) - ], - merged: [ - .field("species", type: .string()), - ], - mergedSources: [ - try .mock(Fragment_AnimalDetails) - ] - ) - - // then - expect(actual).to(shallowlyMatch(expected)) - } - - func test__mergedSelections__givenChildIsNamedFragmentOnUnrelatedType_doesNotMergeFragmentFields_hasTypeCaseForNamedFragmentType() throws { - // given - schemaSDL = """ - type Query { - rocks: [Rock!] - } - - interface Animal { - species: String - } - - type Bird implements Animal { - species: String - } - - type Rock { - name: String - } - """ - - document = """ - fragment BirdDetails on Bird { - species - } - - query Test { - rocks { - ...BirdDetails - } - } - """ - - // when - try buildSubjectRootField() - - let Object_Bird = try XCTUnwrap(schema[object: "Bird"]) - - let Fragment_BirdDetails = try XCTUnwrap(ir.compilationResult[fragment: "BirdDetails"]) - - let expected = SelectionsMatcher( - direct: [ - .inlineFragment(parentType: Object_Bird) - ], - merged: [ - ] - ) - - let rocks = subject[field: "rocks"] - let actual = rocks?.selectionSet - - // then - expect(actual).to(shallowlyMatch(expected)) - expect(actual?[as: "Bird"]?.selections.direct) - .to(shallowlyMatch([.fragmentSpread(Fragment_BirdDetails)])) - } - - func test__mergedSelections__givenNestedNamedFragmentWithNonMatchingParentType_otherNestedNamedFragmentWithNonMatchingParentTypeWithInlineFragmentOnTypeOfFirstFragment_hasFragmentMergedSelections() throws { - // given - schemaSDL = """ - type Query { - aField: [A!] - } - - type A { - someInterface: SomeInterface! - } - - type B implements BInterface { - cObject: C! - } - - type C { - integer: Int - } - - interface SomeInterface { - integer: Int - } - - interface SomeInterface2 { - cObject: C! - } - - interface BInterface { - cObject: C! - } - """ - - document = """ - fragment FragmentA on A { - someInterface { - ...FragmentB - ...FragmentB2 - } - } - - fragment FragmentB on BInterface { - ... on SomeInterface2 { - cObject { - integer - } - } - } - - fragment FragmentB2 on SomeInterface2 { - cObject { - integer - } - } - - query Test { - aField { - ...FragmentA - } - } - """ - - // when - try buildSubjectRootField() - - let Fragment_FragmentB = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB"]) - let Interface_BInterface = try XCTUnwrap(schema[interface: "BInterface"]) - let Interface_SomeInterface2 = try XCTUnwrap(schema[interface: "SomeInterface2"]) - - let aField = subject[field: "aField"] as? IR.EntityField - let someInterfaceField = aField![field: "someInterface"] as? IR.EntityField - let someInterfaceField_asBInterface = someInterfaceField![as: "BInterface"] - - let FragmentSpread_FragmentA = aField?[fragment: "FragmentA"] - let FragmentA_someInterface = FragmentSpread_FragmentA?.fragment[field: "someInterface"] - let FragmentA_someInterface_asBInterface = try XCTUnwrap(FragmentA_someInterface?[as: "BInterface"]) - - let someInterfaceFieldExpected = SelectionsMatcher( - direct: nil, - merged: [ - .inlineFragment(parentType: Interface_BInterface), - .inlineFragment(parentType: Interface_SomeInterface2), - ], - mergedSources: [] - ) - - let someInterfaceField_asBInterfaceExpected = SelectionsMatcher( - direct: nil, - merged: [ - .fragmentSpread(Fragment_FragmentB, inclusionConditions: .none) - ], - mergedSources: [ - .init(typeInfo: FragmentA_someInterface_asBInterface.typeInfo, - fragment: FragmentSpread_FragmentA?.fragment) - ] - ) - - // then - expect(someInterfaceField?.selectionSet).to(shallowlyMatch(someInterfaceFieldExpected)) - expect(someInterfaceField_asBInterface).to(shallowlyMatch(someInterfaceField_asBInterfaceExpected)) - } - - // MARK: - Nested Entity Field - Merged Selections - - func test__mergedSelections__givenEntityFieldOnObjectAndTypeCase_withOtherNestedFieldInTypeCase_mergesParentFieldIntoNestedSelectionsInTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - height: Height - } - - interface Pet implements Animal { - height: Height - } - - type Height { - feet: Int - meters: Int - } - """ - - document = """ - query Test { - allAnimals { - height { - feet - } - ... on Pet { - height { - meters - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let allAnimals_height_actual = allAnimals?[field: "height"]?.selectionSet - let allAnimals_asPet_height_actual = allAnimals?[as: "Pet"]?[field: "height"]?.selectionSet - - let allAnimals_height_expected = SelectionsMatcher( - direct: [ - .field("feet", type: .integer()) - ], - merged: [ - ] - ) - - let allAnimals_asPet_height_expected = SelectionsMatcher( - direct: [ - .field("meters", type: .integer()), - ], - merged: [ - .field("feet", type: .integer()), - ], - mergedSources: [ - try .mock(allAnimals_height_actual) - ] - ) - - // then - expect(allAnimals_height_actual).to(shallowlyMatch(allAnimals_height_expected)) - expect(allAnimals_asPet_height_actual).to(shallowlyMatch(allAnimals_asPet_height_expected)) - } - - func test__mergedSelections__givenEntityFieldOnObjectWithSelectionSetIncludingSameFieldNameAndDifferentSelections_doesNotMergeFieldIntoNestedFieldsSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - height: Height - predators: [Animal!] - } - - type Height { - feet: Int - meters: Int - } - """ - - document = """ - query Test { - allAnimals { - height { - feet - } - predators { - height { - meters - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - let allAnimals_expected = SelectionsMatcher( - direct: [ - .field("feet", type: .integer()) - ], - merged: [ - ] - ) - - let predators_expected = SelectionsMatcher( - direct: [ - .field("meters", type: .integer()), - ], - merged: [ - ] - ) - - let allAnimals_height_actual = allAnimals?[field: "height"]?.selectionSet - let predators_height_actual = allAnimals?[field: "predators"]?[field: "height"]?.selectionSet - - // then - expect(allAnimals_height_actual).to(shallowlyMatch(allAnimals_expected)) - expect(predators_height_actual).to(shallowlyMatch(predators_expected)) - } - - func test__mergedSelections__givenEntityFieldOnInterfaceAndTypeCase_withOtherNestedFieldInTypeCase_mergesParentFieldIntoNestedSelectionsInObjectTypeCaseMatchingInterfaceTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - height: Height - } - - interface Pet implements Animal { - height: Height - species: String - } - - type Cat implements Pet & Animal { - species: String - height: Height - } - - type Height { - feet: Int - meters: Int - } - """ - - document = """ - query Test { - allAnimals { - height { - feet - } - ... on Pet { - height { - meters - } - } - ... on Cat { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let allAnimals_asCat_height_actual = allAnimals?[as: "Cat"]?[field: "height"]?.selectionSet - - let allAnimals_asCat_height_expected = SelectionsMatcher( - direct: nil, - merged: [ - .field("feet", type: .integer()), - .field("meters", type: .integer()), - ], - mergedSources: [ - try .mock(allAnimals?[field: "height"]), - try .mock(allAnimals?[as: "Pet"]?[field: "height"]), - ] - ) - - // then - expect(allAnimals_asCat_height_actual).to(shallowlyMatch(allAnimals_asCat_height_expected)) - } - - func test__mergedSelections__givenEntityFieldOnInterfaceAndTypeCase_withOtherNestedFieldInTypeCase_doesNotMergeParentFieldIntoNestedSelectionsInObjectTypeCaseNotMatchingInterfaceTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - height: Height - } - - interface Pet implements Animal { - height: Height - species: String - } - - type Elephant implements Animal { - species: String - height: Height - } - - type Height { - feet: Int - meters: Int - } - """ - - document = """ - query Test { - allAnimals { - height { - feet - } - ... on Pet { - height { - meters - } - } - ... on Elephant { # does not implement Pet - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - let allAnimals_asElephant_height_expected = SelectionsMatcher( - direct: nil, - merged: [ - .field("feet", type: .integer()) - ], - mergedSources: [ - try .mock(allAnimals?[field: "height"]) - ] - ) - - let allAnimals_asElephant_height_actual = allAnimals?[as: "Elephant"]?[field: "height"]?.selectionSet - - // then - expect(allAnimals_asElephant_height_actual).to(shallowlyMatch(allAnimals_asElephant_height_expected)) - } - - func test__mergedSelections__givenEntityFieldOnEntityWithDeepNestedTypeCases_eachTypeCaseHasDifferentNestedEntityFields_mergesFieldIntoMatchingNestedTypeCases() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - height: Height - } - - interface Pet implements Animal { - height: Height - species: String - } - - interface WarmBlooded { - height: Height - } - - type Height { - feet: Int - meters: Int - inches: Int - yards: Int - } - """ - - document = """ - query Test { - allAnimals { - height { - feet - } - ... on Pet { - height { - meters - } - ... on WarmBlooded { - height { - inches - } - } - } - ... on WarmBlooded { - height { - yards - } - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let allAnimals_height = allAnimals?[field: "height"] - let allAnimals_asPet_height = allAnimals?[as: "Pet"]?[field: "height"] - let allAnimals_asWarmBlooded_height = allAnimals?[as: "WarmBlooded"]?[field: "height"] - - let allAnimals_height_expected = SelectionsMatcher( - direct: [ - .field("feet", type: .integer()) - ], - merged: [ - ] - ) - - let allAnimals_asPet_height_expected = SelectionsMatcher( - direct: [ - .field("meters", type: .integer()), - ], - merged: [ - .field("feet", type: .integer()), - ], - mergedSources: [ - try .mock(allAnimals_height) - ] - ) - - let allAnimals_asPet_asWarmBlooded_height_expected = SelectionsMatcher( - direct: [ - .field("inches", type: .integer()), - ], - merged: [ - .field("feet", type: .integer()), - .field("meters", type: .integer()), - .field("yards", type: .integer()), - ], - mergedSources: [ - try .mock(allAnimals_height), - try .mock(allAnimals_asPet_height), - try .mock(allAnimals_asWarmBlooded_height), - ] - ) - - let allAnimals_asWarmBlooded_height_expected = SelectionsMatcher( - direct: [ - .field("yards", type: .integer()), - ], - merged: [ - .field("feet", type: .integer()), - ], - mergedSources: [ - try .mock(allAnimals_height) - ] - ) - - let allAnimals_height_actual = allAnimals?[field: "height"]?.selectionSet - - let allAnimals_asPet_height_actual = - allAnimals?[as: "Pet"]?[field: "height"]?.selectionSet - - let allAnimals_asPet_asWarmBlooded_height_actual = - allAnimals?[as: "Pet"]?[as: "WarmBlooded"]?[field: "height"]?.selectionSet - - let allAnimals_asWarmBlooded_height_actual = - allAnimals?[as: "WarmBlooded"]?[field: "height"]?.selectionSet - - // then - expect(allAnimals_height_actual) - .to(shallowlyMatch(allAnimals_height_expected)) - expect(allAnimals_asPet_height_actual) - .to(shallowlyMatch(allAnimals_asPet_height_expected)) - expect(allAnimals_asPet_asWarmBlooded_height_actual) - .to(shallowlyMatch(allAnimals_asPet_asWarmBlooded_height_expected)) - expect(allAnimals_asWarmBlooded_height_actual) - .to(shallowlyMatch(allAnimals_asWarmBlooded_height_expected)) - } - - func test__mergedSelections__givenSiblingTypeCasesAndNestedEntityTypeCases_onlyNestedEntityFieldMergeTypeCases() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - predator: Animal - height: Height - } - - interface Reptile { - skinCovering: String - } - - type Cat implements Pet & Animal { - species: String - breed: String - height: Height - predator: Animal - } - - type Height { - feet: Int - } - """ - - document = """ - query Test { - allAnimals { - ... on Pet { - ... on Reptile { - skinCovering - } - predator { - ... on Pet { - height { - feet - } - } - ... on Reptile { - skinCovering - } - ... on Cat { - breed - } - } - } - ... on Reptile { - skinCovering - } - ... on Cat { - breed - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]).toNot(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "skinCovering"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[as: "Reptile"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[as: "Pet"]).to(beNil()) - - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]?[field: "height"]).toNot(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]?[field: "skinCovering"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]?[field: "breed"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]?[as: "Reptile"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]?[as: "Pet"]).to(beNil()) - - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Cat"]?[field: "height"]).toNot(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Cat"]?[field: "skinCovering"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Cat"]?[as: "Reptile"]).to(beNil()) - expect(allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Cat"]?[as: "Pet"]).to(beNil()) - - expect(allAnimals?[as: "Pet"]?[field: "predator"]?[as: "Cat"]?[field: "height"]).toNot(beNil()) - expect(allAnimals?[as: "Pet"]?[field: "predator"]?[as: "Cat"]?[field: "breed"]).toNot(beNil()) - expect(allAnimals?[as: "Pet"]?[field: "predator"]?[as: "Cat"]?[field: "skinCovering"]).to(beNil()) - expect(allAnimals?[as: "Pet"]?[field: "predator"]?[as: "Cat"]?[as: "Reptile"]).to(beNil()) - expect(allAnimals?[as: "Pet"]?[field: "predator"]?[as: "Cat"]?[as: "Pet"]).to(beNil()) - } - - func test__mergedSelections__givenSiblingTypeCasesAndNestedEntityTypeCases_withNamedFragments_mergesFragmentsIntoNestedEntityTypeCases() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - predator: Animal - height: Height - } - - interface Reptile { - skinCovering: String - } - - type Cat implements Pet & Animal { - species: String - breed: String - height: Height - predator: Animal - } - - type Height { - feet: Int - } - """ - - document = """ - query Test { - allAnimals { - ... on Pet { - ... on Reptile { - ...SkinCoveringFragment - } - predator { - ... on Pet { - ...HeightFragment - } - ... on Reptile { - ...SkinCoveringFragment - } - ... on Cat { - ...SpeciesFragment - } - } - } - ... on Reptile { - ...SkinCoveringFragment - } - ... on Cat { - ...BreedFragment - } - } - } - - fragment HeightFragment on Pet { - height { - feet - } - } - - fragment SkinCoveringFragment on Reptile { - skinCovering - } - - fragment SpeciesFragment on Animal { - species - } - - fragment BreedFragment on Cat { - breed - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - let asCat = allAnimals?[as: "Cat"] - let asCat_predator = asCat?[field: "predator"] - - expect(asCat?[fragment: "BreedFragment"]).toNot(beNil()) - expect(asCat?[fragment: "SkinCoveringFragment"]).to(beNil()) - - expect(asCat?[field: "predator"]?[fragment: "SkinCoveringFragment"]).to(beNil()) - expect(asCat?[field: "predator"]?[fragment: "BreedFragment"]).to(beNil()) - expect(asCat?[field: "predator"]?[fragment: "SpeciesFragment"]).to(beNil()) - expect(asCat?[field: "predator"]?[fragment: "HeightFragment"]).to(beNil()) - - expect(asCat_predator?[as: "Pet"]?[fragment: "SkinCoveringFragment"]).to(beNil()) - expect(asCat_predator?[as: "Pet"]?[fragment: "BreedFragment"]).to(beNil()) - expect(asCat_predator?[as: "Pet"]?[fragment: "SpeciesFragment"]).to(beNil()) - expect(asCat_predator?[as: "Pet"]?[fragment: "HeightFragment"]).toNot(beNil()) - - expect(asCat_predator?[as: "Reptile"]?[fragment: "SkinCoveringFragment"]).toNot(beNil()) - expect(asCat_predator?[as: "Reptile"]?[fragment: "BreedFragment"]).to(beNil()) - expect(asCat_predator?[as: "Reptile"]?[fragment: "SpeciesFragment"]).to(beNil()) - expect(asCat_predator?[as: "Reptile"]?[fragment: "HeightFragment"]).to(beNil()) - - expect(asCat_predator?[as: "Cat"]?[fragment: "SkinCoveringFragment"]).to(beNil()) - expect(asCat_predator?[as: "Cat"]?[fragment: "BreedFragment"]).to(beNil()) - expect(asCat_predator?[as: "Cat"]?[fragment: "SpeciesFragment"]).toNot(beNil()) - expect(asCat_predator?[as: "Cat"]?[fragment: "HeightFragment"]).toNot(beNil()) - } - - // MARK: - Nested Entity Field - Merged Selections - Calculate Type Path - - func test__mergedSelections__givenEntityFieldOnTypeWithOnlyMergedSelections_mergedOnlyEntityFieldHasCorrectTypePath() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - height: Height - predator: Animal - } - - type Cat implements Animal { - breed: String - height: Height - predator: Animal - } - - type Height { - feet: Int - } - """ - - document = """ - query Test { - allAnimals { - predator { - height { - feet - } - } - ... on Cat { - breed - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - let query_TypeScope = IR.ScopeDescriptor.descriptor( - forType: operation.rootType, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes) - - let allAnimals_asCat_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[interface: "Animal"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ).appending(schema[object: "Cat"]!) - - let allAnimals_asCat_predator_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[interface: "Animal"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes) - - let allAnimals_asCat_predator_height_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[object: "Height"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes) - - let allAnimals_asCat_predator_expectedTypePath = LinkedList([ - query_TypeScope, - allAnimals_asCat_TypeScope, - allAnimals_asCat_predator_TypeScope - ]) - - let allAnimals_asCat_predator_height_expectedTypePath = LinkedList([ - query_TypeScope, - allAnimals_asCat_TypeScope, - allAnimals_asCat_predator_TypeScope, - allAnimals_asCat_predator_height_TypeScope - ]) - - let allAnimals_asCat_predator_actual = allAnimals?[as: "Cat"]?[field: "predator"]?.selectionSet - - let allAnimals_asCat_predator_height_actual = allAnimals?[as: "Cat"]?[field: "predator"]?[field: "height"]?.selectionSet - - // then - expect(allAnimals_asCat_predator_actual?.scopePath).to(equal(allAnimals_asCat_predator_expectedTypePath)) - - expect(allAnimals_asCat_predator_height_actual?.scopePath).to(equal(allAnimals_asCat_predator_height_expectedTypePath)) - } - - func test__mergedSelections__givenEntityFieldInMatchingTypeCaseOnTypeWithOnlyMergedSelections_mergedOnlyEntityFieldHasCorrectTypePath() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - - interface Pet { - predator: Animal - height: Height - } - - type Cat implements Pet & Animal { - species: String - breed: String - height: Height - predator: Animal - } - - type Height { - feet: Int - } - """ - - document = """ - query Test { - allAnimals { - ... on Pet { - predator { - ... on Pet { - height { - feet - } - } - ... on Cat { - breed - } - } - } - ... on Cat { - breed - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = subject[field: "allAnimals"] - - let query_TypeScope = IR.ScopeDescriptor.descriptor( - forType: operation.rootType, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes) - - let allAnimals_asCat_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[interface: "Animal"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ).appending(schema[object: "Cat"]!) - - let allAnimals_asCat_predator_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[interface: "Animal"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ) - - let allAnimals_asCat_predator_asPet_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[interface: "Animal"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ).appending(schema[interface: "Pet"]!) - - let allAnimals_asCat_predator_asPet_height_TypeScope = IR.ScopeDescriptor.descriptor( - forType: schema[object: "Height"]!, - inclusionConditions: nil, - givenAllTypesInSchema: schema.referencedTypes - ) - - let allAnimals_asCat_predator_expectedTypePath = LinkedList([ - query_TypeScope, - allAnimals_asCat_TypeScope, - allAnimals_asCat_predator_TypeScope - ]) - - let allAnimals_asCat_predator_height_expectedTypePath = LinkedList([ - query_TypeScope, - allAnimals_asCat_TypeScope, - allAnimals_asCat_predator_asPet_TypeScope, - allAnimals_asCat_predator_asPet_height_TypeScope - ]) - - let allAnimals_asCat_predator_actual = allAnimals?[as: "Cat"]?[field: "predator"]?.selectionSet - - let allAnimals_asCat_predator_height_actual = allAnimals?[as: "Cat"]?[field: "predator"]?[as: "Pet"]?[field: "height"]?.selectionSet - - // then - expect(allAnimals_asCat_predator_actual?.scopePath) - .to(equal(allAnimals_asCat_predator_expectedTypePath)) - - expect(allAnimals_asCat_predator_height_actual?.scopePath) - .to(equal(allAnimals_asCat_predator_height_expectedTypePath)) - } - - // MARK: - Nested Entity In Fragments - Merged Selections - - func test__mergedSelections__givenEntityField_DirectSelectionsAndMergedFromNestedEntityInFragmentAndFragmentInFragment_nestedEntityFieldHasFragmentMergedSources() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - predator: Animal! - height: Height! - } - - type Height { - feet: Int - meters: Int - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - ...PredatorDetails - } - } - - fragment PredatorDetails on Animal { - predator { - height { - feet - ...HeightInMeters - } - } - } - - fragment HeightInMeters on Height { - meters - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Object_Height = try XCTUnwrap(schema[object: "Height"]) - - let allAnimals = try XCTUnwrap( - subject?[field: "allAnimals"] as? IR.EntityField - ) - let allAnimals_predator = try XCTUnwrap( - allAnimals[field: "predator"] as? IR.EntityField - ) - - let Fragment_PredatorDetails = try XCTUnwrap( - subject?[field: "allAnimals"]?[fragment: "PredatorDetails"] - ) - let PredatorDetails_Predator = try XCTUnwrap( - Fragment_PredatorDetails.fragment[field: "predator"] - ) - let PredatorDetails_Predator_Height = try XCTUnwrap( - PredatorDetails_Predator[field: "height"] - ) - - let Fragment_PredatorDetails_HeightInMeters = try XCTUnwrap( - PredatorDetails_Predator_Height[fragment: "HeightInMeters"] - ) - - let allAnimals_expected = SelectionSetMatcher( - parentType: Interface_Animal, - directSelections: [ - .field("predator", type: .nonNull(.entity(Interface_Animal))), - .fragmentSpread(Fragment_PredatorDetails.definition), - ], - mergedSelections: [], - mergedSources: [] - ) - - let predator_expected = SelectionSetMatcher( - parentType: Interface_Animal, - directSelections: [ - .field("species", type: .string()), - ], - mergedSelections: [ - .field("height", type: .nonNull(.entity(Object_Height))) - ], - mergedSources: [ - try .mock(for: PredatorDetails_Predator, from: Fragment_PredatorDetails) - ] - ) - - let predator_height_expected = SelectionSetMatcher( - parentType: Object_Height, - directSelections: nil, - mergedSelections: [ - .field("meters", type: .integer()), - .field("feet", type: .integer()), - .fragmentSpread(Fragment_PredatorDetails_HeightInMeters.definition), - ], - mergedSources: [ - try .mock(for: Fragment_PredatorDetails_HeightInMeters.fragment.rootField, from: Fragment_PredatorDetails_HeightInMeters), - try .mock(for: PredatorDetails_Predator_Height, from: Fragment_PredatorDetails), - ] - ) - - // then - expect(allAnimals.selectionSet).to(shallowlyMatch(allAnimals_expected)) - expect(allAnimals_predator.selectionSet).to(shallowlyMatch(predator_expected)) - expect(allAnimals_predator[field: "height"]?.selectionSet) - .to(shallowlyMatch(predator_height_expected)) - } - - func test__mergedSelections__givenEntityFieldMergedFromNestedFragmentInTypeCase_withNoOtherMergedFields_hasNestedEntityMergedFields() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface WarmBlooded implements Animal { - species: String! - predator: Animal! - height: Height! - } - - type Height { - meters: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...WarmBloodedDetails - } - } - } - - fragment WarmBloodedDetails on WarmBlooded { - species - ...HeightInMeters - } - - fragment HeightInMeters on Animal { - height { - meters - } - } - """ - - // when - try buildSubjectRootField() - - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_WarmBlooded = try XCTUnwrap(schema[interface: "WarmBlooded"]) - let Object_Height = try XCTUnwrap(schema[object: "Height"]) - - let allAnimals = try XCTUnwrap( - subject?[field: "allAnimals"] as? IR.EntityField - ) - let allAnimals_predator = try XCTUnwrap( - allAnimals[field: "predator"] as? IR.EntityField - ) - let allAnimals_predator_asWarmBlooded = try XCTUnwrap( - allAnimals_predator[as: "WarmBlooded"] - ) - - let Fragment_WarmBloodedDetails = try XCTUnwrap( - allAnimals_predator_asWarmBlooded[fragment: "WarmBloodedDetails"] - ) - - let WarmBloodedDetails_HeightInMeters = try XCTUnwrap( - Fragment_WarmBloodedDetails.fragment[fragment: "HeightInMeters"] - ) - - let HeightInMeters_Height = try XCTUnwrap( - WarmBloodedDetails_HeightInMeters.fragment[field: "height"] as? IR.EntityField - ) - - let predator_expected = SelectionSetMatcher( - parentType: Interface_Animal, - directSelections: [ - .inlineFragment(parentType: Interface_WarmBlooded) - ], - mergedSelections: [], - mergedSources: [] - ) - - let predator_asWarmBlooded_expected = SelectionSetMatcher( - parentType: Interface_WarmBlooded, - directSelections: [ - .fragmentSpread(Fragment_WarmBloodedDetails.definition) - ], - mergedSelections: [ - .field("species", type: .nonNull(.string())), - .field("height", type: .nonNull(.entity(Object_Height))), - .fragmentSpread(WarmBloodedDetails_HeightInMeters.definition) - ], - mergedSources: [ - try .mock(Fragment_WarmBloodedDetails), - try .mock(WarmBloodedDetails_HeightInMeters) - ] - ) - - let predator_asWarmBlooded_height_expected = SelectionSetMatcher( - parentType: Object_Height, - directSelections: nil, - mergedSelections: [ - .field("meters", type: .nonNull(.integer())), - ], - mergedSources: [ - try .mock(for: HeightInMeters_Height, from: WarmBloodedDetails_HeightInMeters) - ] - ) - - // then - expect(allAnimals_predator.selectionSet).to(shallowlyMatch(predator_expected)) - expect(allAnimals_predator_asWarmBlooded) - .to(shallowlyMatch(predator_asWarmBlooded_expected)) - expect(allAnimals_predator_asWarmBlooded[field: "height"]?.selectionSet) - .to(shallowlyMatch(predator_asWarmBlooded_height_expected)) - } - - // MARK: - Nested Entity In Fragments - Merged Sources - - func test__mergedSources__givenEntityField_DirectSelectonsAndMergedFromNestedEntityInFragment_nestedEntityFieldHasFragmentMergedSources() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - ...PredatorDetails - } - } - - fragment PredatorDetails on Animal { - predator { - height { - feet - } - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals_predator = try XCTUnwrap( - subject?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let Fragment_PredatorDetails = subject?[field: "allAnimals"]?[fragment: "PredatorDetails"] - let PredatorDetails_predator = try XCTUnwrap( - Fragment_PredatorDetails?.fragment[field: "predator"] as? IR.EntityField - ) - - let expected: IR.MergedSelections.MergedSources = [ - try .mock(for: PredatorDetails_predator, from: Fragment_PredatorDetails) - ] - - // then - expect(allAnimals_predator.selectionSet.selections.merged.mergedSources).to(equal(expected)) - } - - // MARK: - Referenced Fragments - - func test__referencedFragments__givenUsesNoFragments_isEmpty() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - """ - - document = """ - query Test { - allAnimals { - species - } - } - """ - - // when - try buildSubjectRootField() - - // then - expect(self.computedReferencedFragments).to(beEmpty()) - } - - func test__referencedFragments__givenUsesFragmentAtRoot_includesFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - """ - - document = """ - fragment QueryDetails on Query { - allAnimals { - species - } - } - - query Test { - ...QueryDetails - } - """ - - // when - try buildSubjectRootField() - - let expected: OrderedSet = [ - try ir.builtFragments["QueryDetails"].xctUnwrapped() - ] - - // then - expect(self.computedReferencedFragments).to(equal(expected)) - } - - func test__referencedFragments__givenUsesFragmentOnEntityField_includesFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - } - """ - - document = """ - fragment AnimalDetails on Animal { - species - } - - query Test { - allAnimals { - ...AnimalDetails - } - } - """ - - // when - try buildSubjectRootField() - - let expected: OrderedSet = [ - try ir.builtFragments["AnimalDetails"].xctUnwrapped() - ] - - // then - expect(self.computedReferencedFragments).to(equal(expected)) - } - - func test__referencedFragments__givenUsesMultipleFragmentsOnEntityField_includesFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - name: String - } - """ - - document = """ - fragment AnimalDetails on Animal { - species - } - - fragment AnimalName on Animal { - name - } - - query Test { - allAnimals { - ...AnimalDetails - ...AnimalName - } - } - """ - - // when - try buildSubjectRootField() - - let expected: OrderedSet = [ - try ir.builtFragments["AnimalDetails"].xctUnwrapped(), - try ir.builtFragments["AnimalName"].xctUnwrapped(), - ] - - // then - expect(self.computedReferencedFragments).to(equal(expected)) - } - - func test__referencedFragments__givenUsesFragmentsReferencingOtherFragment_includesBothFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String - name: String - } - """ - - document = """ - fragment AnimalDetails on Animal { - species - ...AnimalName - } - - fragment AnimalName on Animal { - name - } - - query Test { - allAnimals { - ...AnimalDetails - } - } - """ - - // when - try buildSubjectRootField() - - let expected: OrderedSet = [ - try ir.builtFragments["AnimalDetails"].xctUnwrapped(), - try ir.builtFragments["AnimalName"].xctUnwrapped(), - ] - - // then - expect(self.computedReferencedFragments).to(equal(expected)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGenIR/IRSelectionSet_IncludeSkip_Tests.swift b/Tests/ApolloCodegenTests/CodeGenIR/IRSelectionSet_IncludeSkip_Tests.swift deleted file mode 100644 index 68406b3228..0000000000 --- a/Tests/ApolloCodegenTests/CodeGenIR/IRSelectionSet_IncludeSkip_Tests.swift +++ /dev/null @@ -1,2985 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -import ApolloAPI - -class IRSelectionSet_IncludeSkip_Tests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: CompilationResult.OperationDefinition! - var subject: IR.EntityField! - - var schema: IR.Schema { ir.schema } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - operation = nil - subject = nil - super.tearDown() - } - - // MARK: = Helpers - - func buildSubjectRootField() throws { - ir = try .mock(schema: schemaSDL, document: document) - operation = try XCTUnwrap(ir.compilationResult.operations.first) - - let result = IR.RootFieldBuilder.buildRootEntityField( - forRootField: .mock( - "query", - type: .nonNull(.entity(operation.rootType)), - selectionSet: operation.selectionSet - ), - onRootEntity: IR.Entity(source: .operation(operation)), - inIR: ir - ) - subject = result.rootField - } - - // MARK: - Scalar Fields - - func test__selections__givenIncludeIfVariable_onScalarField_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @include(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try XCTUnwrap( - AnyOf(.mock([.include(if: "a")])) - ) - - // then - expect(actual?.inclusionConditions).to(equal(expected)) - } - - func test__selections__givenSkipIfVariable_onScalarField_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @skip(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try XCTUnwrap( - AnyOf(.mock([ - .skip(if: "a") - ])) - ) - - // then - expect(actual?.inclusionConditions).to(equal(expected)) - } - - func test__selections__givenTwoIncludeVariables_onScalarField_createsSelectionWithBothInclusionConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!, $b: Boolean!) { - allAnimals { - species @include(if: $a) @include(if: $b) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try XCTUnwrap( - AnyOf(.mock([ - .include(if: "a"), - .include(if: "b"), - ])) - ) - - // then - expect(actual?.inclusionConditions).to(equal(expected)) - } - - func test__selections__givenTwoSkipVariables_onScalarField_createsSelectionWithBothInclusionConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!, $b: Boolean!) { - allAnimals { - species @skip(if: $a) @skip(if: $b) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try XCTUnwrap( - AnyOf(.mock([ - .skip(if: "a"), - .skip(if: "b"), - ])) - ) - - // then - expect(actual?.inclusionConditions).to(equal(expected)) - } - - func test__selections__givenTwoIncludeWithSameVariable_onScalarField_createsSelectionWithOneInclusionConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!, $b: Boolean!) { - allAnimals { - species @include(if: $a) @include(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try XCTUnwrap( - AnyOf(.mock([ - .include(if: "a") - ])) - ) - - // then - expect(actual?.inclusionConditions).to(equal(expected)) - } - - func test__selections__givenDuplicateSelection_includeWithSameVariableFirst_onScalarField_createsSelectionWithNoInclusionConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!, $b: Boolean!) { - allAnimals { - species @include(if: $a) - species - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - // then - expect(actual).toNot(beNil()) - expect(actual?.inclusionConditions).to(beNil()) - } - - func test__selections__givenDuplicateSelection_includeWithSameVariableSecond_onScalarField_includeFieldWithNoConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!, $b: Boolean!) { - allAnimals { - species - species @include(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - // then - expect(actual).toNot(beNil()) - expect(actual?.inclusionConditions).to(beNil()) - } - - // MARK: - Omit Skipped Fields - - func test__selections__givenIncludeIfFalse_onScalarField_omitFieldFromSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @include(if: false) - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = self.subject[field: "allAnimals"] - - // then - expect(allAnimals).toNot(beNil()) - expect(allAnimals?[field: "species"]).to(beNil()) - } - - func test__selections__givenIncludeIfTrue_onScalarField_doesNotOmitFieldFromSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @include(if: true) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - // then - expect(actual).toNot(beNil()) - expect(actual?.inclusionConditions).to(beNil()) - } - - func test__selections__givenSkipIfTrue_onScalarField_omitFieldFromSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @skip(if: true) - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = self.subject[field: "allAnimals"] - - // then - expect(allAnimals).toNot(beNil()) - expect(allAnimals?[field: "species"]).to(beNil()) - } - - func test__selections__givenSkipIfFalse_onScalarField_doesNotOmitFieldFromSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @skip(if: false) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - // then - expect(actual).toNot(beNil()) - expect(actual?.inclusionConditions).to(beNil()) - } - - func test__selections__givenIncludeAndSkipOnSameVariable_onScalarField_omitFieldFromSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @include(if: $a) @skip(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = self.subject[field: "allAnimals"] - - // then - expect(allAnimals).toNot(beNil()) - expect(allAnimals?[field: "species"]).to(beNil()) - } - - func test__selections__givenDuplicateSelectionIncludeAndSkipOnSameVariable_onScalarField_includeFieldWithConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @include(if: $a) - species @skip(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try AnyOf([ - XCTUnwrap(.mock([.include(if: "a")])), - XCTUnwrap(.mock([.skip(if: "a")])), - ]) - - // then - expect(actual).toNot(beNil()) - expect(actual?.inclusionConditions).to(equal(expected)) - } - - func test__selections__givenDuplicateSelectionIncludeAndSkipOnSameVariableWithOtherInclude_onScalarField_doesNotReduceConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - species @include(if: $a) @include(if: $b) - species @skip(if: $a) - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "species"] - - let expected: AnyOf = try AnyOf([ - XCTUnwrap(.mock([.include(if: "a"), .include(if: "b")])), - XCTUnwrap(.mock([.skip(if: "a")])), - ]) - - // then - expect(actual).toNot(beNil()) - expect(actual?.inclusionConditions).to(equal(expected)) - } - - // MARK: - Entity Fields - - func test__selections__givenIncludeIfVariable_onEntityField_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: $a) { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let expected: IR.InclusionConditions = try XCTUnwrap(.mock([.include(if: "a")])) - - // then - expect(actual?.inclusionConditions).to(equal(AnyOf(expected))) - expect(actual?.selectionSet?.inclusionConditions).to(equal(expected)) - - expect(actual?[field: "species"]).toNot(beNil()) - } - - func test__selections__givenMergingFieldWithNoConditionIntoFieldWithCondition_onEntityField_createsWrapperSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: $a) { - a - } - friend { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let expected_friend_selections: - [ShallowSelectionMatcher] = [ - .field("b", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]) - ] - - let expected_friendIfA_selections: [ShallowSelectionMatcher] = [ - .field("a", type: .nonNull(.scalar(.string()))), - ] - - let friend_ifA_expectedConditions: IR.InclusionConditions = try XCTUnwrap(.mock([ - .include(if: "a") - ])) - - // then - expect(actual?.inclusionConditions).to(beNil()) - expect(actual?.selectionSet?.inclusionConditions).to(beNil()) - expect(actual?.selectionSet?.selections.direct).to(shallowlyMatch(expected_friend_selections)) - - expect(actual?[if: "a"]?.inclusionConditions).to(equal(friend_ifA_expectedConditions)) - expect(actual?[if: "a"]?.selections.direct) - .to(shallowlyMatch(expected_friendIfA_selections)) - } - - func test__selections__givenMergingFieldWithConditionIntoFieldWithNoCondition_onEntityField_createsMergedFieldAsConditionalChildSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend { - b - } - friend @include(if: $a) { - a - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let expected_friend = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]) - ] - ) - - let expected_friendIfA = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(actual?.inclusionConditions).to(beNil()) - expect(actual?.selectionSet).to(shallowlyMatch(expected_friend)) - - expect(actual?[if: "a"]).to(shallowlyMatch(expected_friendIfA)) - } - - func test__selections__givenTwoEntityFieldsIncludeIfVariableAndSkipIfSameVariable_onEntityField_createsSelectionWithInclusionConditionsWithNestedSelectionSetsWithEachInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: $a) { - a - } - friend @skip(if: $a) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let friend_expected: AnyOf = try AnyOf([ - XCTUnwrap(.mock([.include(if: "a")])), - XCTUnwrap(.mock([.skip(if: "a")])) - ]) - - let friend_ifA_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ] - ) - - let friend_ifNotA_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.skip(if: "a")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(actual?.inclusionConditions).to(equal(friend_expected)) - expect(actual?.selectionSet?.inclusionConditions).to(beNil()) - - expect(actual?.selectionSet?.selections.direct?.fields).to(beEmpty()) - - expect(actual?[if: "a"]).to(shallowlyMatch(friend_ifA_expected)) - expect(actual?[if: !"a"]).to(shallowlyMatch(friend_ifNotA_expected)) - } - - func test__selections__givenMergeTwoEntityFieldsWithTwoConditions_createsSelectionWithInclusionConditionsWithNestedSelectionSetsWithEachInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - c: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: $a) @include(if: $b) { - a - } - friend @include(if: $c) @include(if: $d) { - c - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let friend_expected: AnyOf = try AnyOf([ - XCTUnwrap(.mock([ - .include(if: "a"), - .include(if: "b"), - ])), - XCTUnwrap(.mock([ - .include(if: "c"), - .include(if: "d"), - ])) - ]) - - let friend_ifAAndB_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a"), .include(if: "b")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ] - ) - - let friend_ifCAndD_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "c"), .include(if: "d"),], - directSelections: [ - .field("c", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(actual?.inclusionConditions).to(equal(friend_expected)) - expect(actual?.selectionSet?.inclusionConditions).to(beNil()) - - expect(actual?.selectionSet?.selections.direct?.fields).to(beEmpty()) - - expect(actual?[if: "a" && "b"]).to(shallowlyMatch(friend_ifAAndB_expected)) - expect(actual?[if: "c" && "d"]).to(shallowlyMatch(friend_ifCAndD_expected)) - } - - func test__selections__givenMergeThreeFieldsWithConditions_onEntityField_createsSelectionWithInclusionConditionsWithNestedSelectionSetsWithEachInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - c: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: $a) { - a - } - friend @skip(if: $b) { - b - } - friend @include(if: $c) { - c - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let friend_expected: AnyOf = try AnyOf([ - XCTUnwrap(.mock([.include(if: "a")])), - XCTUnwrap(.mock([.skip(if: "b")])), - XCTUnwrap(.mock([.include(if: "c")])), - ]) - - let friend_ifA_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ] - ) - - let friend_ifNotB_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.skip(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ] - ) - - let friend_ifC_expected = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "c")], - directSelections: [ - .field("c", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(actual?.inclusionConditions).to(equal(friend_expected)) - expect(actual?.selectionSet?.inclusionConditions).to(beNil()) - - expect(actual?.selectionSet?.selections.direct?.fields).to(beEmpty()) - - expect(actual?[if: "a"]).to(shallowlyMatch(friend_ifA_expected)) - expect(actual?[if: !"b"]).to(shallowlyMatch(friend_ifNotB_expected)) - expect(actual?[if: "c"]).to(shallowlyMatch(friend_ifC_expected)) - } - - func test__selections__givenMergingFieldWithIncludeIfTrueIntoFieldWithNoCondition_onEntityField_mergesSelectionsDirectly() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - """ - - document = """ - query Test { - allAnimals { - friend { - b - } - friend @include(if: true) { - a - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let expected_friend = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - .field("a", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(actual?.inclusionConditions).to(beNil()) - expect(actual?.selectionSet).to(shallowlyMatch(expected_friend)) - } - - func test__selections__givenMergingFieldWithConditionIntoFieldWithIncludeIfTrue_onEntityField_createsMergedFieldAsConditionalChildSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: true) { - b - } - friend @include(if: $a) { - a - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let actual = self.subject[field: "allAnimals"]?[field: "friend"] - - let expected_friend = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]) - ] - ) - - let expected_friendIfA = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(actual?.inclusionConditions).to(beNil()) - expect(actual?.selectionSet).to(shallowlyMatch(expected_friend)) - - expect(actual?[if: "a"]).to(shallowlyMatch(expected_friendIfA)) - } - - // MARK: Merged Fields - - func test__selections__givenIncludeIfVariable_onEntityField_mergedFromParent_createsMergedSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - friend: Animal! - } - - interface Pet { - species: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - friend @include(if: $a) { - species - } - ... on Pet { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let actual = self.subject[field: "allAnimals"]?[as: "Pet"]?[field: "friend"] - - let expected: IR.InclusionConditions = try XCTUnwrap(.mock([.include(if: "a")])) - - // then - expect(actual?.inclusionConditions).to(equal(AnyOf(expected))) - expect(actual?.selectionSet?.inclusionConditions).to(equal(expected)) - - expect(actual?[field: "species"]).toNot(beNil()) - } - - // MARK: - Inline Fragments - - func test__selections__givenIncludeIfVariable_onInlineFragment_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - species - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]) - ] - ) - - let expected_allAnimal_ifA = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("species", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - } - - func test__selections__givenDuplicateConditions_onInlineFragments_deduplicatesSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - a - } - ... @include(if: $a) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - ] - ) - - let expected_allAnimal_ifA = SelectionSetMatcher.directOnly( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - ] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - } - - func test__selections__givenConditionThatIsSupersetOfOtherCondition_onInlineFragments_createsSeperateSelectionsWithInclusionConditions() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - a - } - ... @include(if: $a) @include(if: $b) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a"), .include(if: "b")]) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifA = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifAAndB = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a"), .include(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]) - ] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - expect(allAnimals?[if: "a" && "b"]).to(shallowlyMatch(expected_allAnimal_ifAAndB)) - } - - func test__selections__givenConditionNotMatchingOtherCondition_onInlineFragments_doesNotMergeInSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - a - } - ... @include(if: $b) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifA = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifB = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - expect(allAnimals?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifB)) - } - - func test__selections__givenDuplicateConditionsNestedInsideOtherCondition_onInlineFragments_hasNestedConditionalSelectionSets() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b1: String! - b2: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - a - ... @include(if: $b) { - b2 - } - } - ... @include(if: $b) { - b1 - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifA = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifB = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b1", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifA_ifB = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b2", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b1", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]), - .mock(allAnimals?[if: "b"]) - ] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - expect(allAnimals?[if: "a"]?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifA_ifB)) - expect(allAnimals?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifB)) - } - - func test__selections__givenConditionNotMatchingNestedCondition_onInlineFragments_doesNotMergeSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - c: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - a - ... @include(if: $b) { - b - } - } - ... @include(if: $c) { - c - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "c")]), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifA = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifC = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "c")], - directSelections: [ - .field("c", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifA_ifB = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]), - ] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - expect(allAnimals?[if: "a"]?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifA_ifB)) - expect(allAnimals?[if: "c"]).to(shallowlyMatch(expected_allAnimal_ifC)) - } - - - func test__selections__givenSiblingTypeCaseAndCondition_onInlineFragments_doesNotMergeSiblings() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - } - - interface Pet implements Animal { - a: String! - b: String! - } - """ - - document = """ - query Test($b: Boolean!) { - allAnimals { - ... on Pet { - a - } - ... @include(if: $b) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Pet, - inclusionConditions: nil), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_asPet = SelectionSetMatcher( - parentType: Interface_Pet, - inclusionConditions: nil, - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifB = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - // then - expect(allAnimals?.inclusionConditions).to(beNil()) - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[as: "Pet"]).to(shallowlyMatch(expected_allAnimal_asPet)) - expect(allAnimals?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifB)) - } - - func test__selections__givenTypeCaseAndCondition_siblingWithMatchingCondition_onInlineFragments_mergesConditionSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - } - - interface Pet implements Animal { - a: String! - b: String! - } - """ - - document = """ - query Test($b: Boolean!) { - allAnimals { - ... on Pet @include(if: $b) { - a - } - ... @include(if: $b) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Pet, - inclusionConditions: [.include(if: "b")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_asPet = try SelectionSetMatcher( - parentType: Interface_Pet, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "b"]) - ] - ) - - let expected_allAnimal_ifB = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[as: "Pet", if: "b"]).to(shallowlyMatch(expected_allAnimal_asPet)) - expect(allAnimals?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifB)) - } - - func test__selections__givenTypeCaseAndCondition_siblingWithNonMatchingCondition_onInlineFragments_doesNotMergesConditionSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - } - - interface Pet implements Animal { - a: String! - b: String! - } - """ - - document = """ - query Test($b: Boolean!) { - allAnimals { - ... on Pet @include(if: $a) { - a - } - ... @include(if: $b) { - b - } - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Pet, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_asPet = SelectionSetMatcher( - parentType: Interface_Pet, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimal_ifB = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [], - mergedSources: [] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[as: "Pet", if: "a"]).to(shallowlyMatch(expected_allAnimal_asPet)) - expect(allAnimals?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifB)) - } - - // MARK: - Named Fragments - - func test__selections__givenIncludeIfVariable_onNamedFragment_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]) - ], - mergedSources: [ - .mock(allAnimals) - ] - ) - - let expected_allAnimal_ifA = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]?[fragment: "FragmentA"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - } - - func test__selections__givenIncludeIfVariable_onNamedFragmentOfDifferentType_createsTypeCaseSelectionWithInclusionCondition_typeCaseDoesNotContainAdditionalInlineFragmentForInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - friend: Animal! - } - - type Dog implements Animal { - a: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Dog { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Object_Dog = try XCTUnwrap(schema[object: "Dog"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Object_Dog, - inclusionConditions: [.include(if: "a")]) - ], - mergedSelections: [ - ], - mergedSources: [] - ) - - let expected_allAnimal_asDog = try SelectionSetMatcher( - parentType: Object_Dog, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[as: "Dog", if: "a"]?[fragment: "FragmentA"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[as: "Dog", if: "a"]).to(shallowlyMatch(expected_allAnimal_asDog)) - } - - func test__selections__givenDuplicateIncludeIfVariable_onNamedFragment_createsSelectionWithDeduplicatedInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSources: [ - .mock(allAnimals) - ] - ) - - let expected_allAnimal_ifA = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]?[fragment: "FragmentA"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - } - - func test__selections__givenDuplicateNamedFragmentWithDifferentConditions_createsDeduplicatedInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - ...FragmentA @include(if: $b) - } - } - - fragment FragmentA on Animal { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")]), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "b")]) - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimal_ifA = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]) - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]?[fragment: "FragmentA"]), - ] - ) - - let expected_allAnimal_ifB = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "b")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "b")]) - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "b"]?[fragment: "FragmentA"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - expect(allAnimals?[if: "b"]).to(shallowlyMatch(expected_allAnimal_ifB)) - } - - func test__selections__givenNamedFragmentWithCompoundConditionsAndDuplicateWithDifferentConditions_createsDeduplicatedInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) @include(if: $b) - ...FragmentA @include(if: $c) - } - } - - fragment FragmentA on Animal { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a"), .include(if: "b")]), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "c")]), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "c")]) - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimal_ifAAndB = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a"), .include(if: "b")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a"), .include(if: "b")]) - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a" && "b"]?[fragment: "FragmentA"]), - ] - ) - - let expected_allAnimal_ifC = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "c")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "c")]) - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "c"]?[fragment: "FragmentA"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - expect(allAnimals?[if: "a" && "b"]).to(shallowlyMatch(expected_allAnimal_ifAAndB)) - expect(allAnimals?[if: "c"]).to(shallowlyMatch(expected_allAnimal_ifC)) - } - - func test__selections__givenTwoIncludeIfNamedFragments_withSameCondition_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - ...FragmentB @include(if: $a) - } - } - - fragment FragmentA on Animal { - a - } - - fragment FragmentB on Animal { - b - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - let FragmentB = try XCTUnwrap(ir.compilationResult[fragment: "FragmentB"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - .fragmentSpread(FragmentB, inclusionConditions: [.include(if: "a")]), - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimal_ifA = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - .fragmentSpread(FragmentB, inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]?[fragment: "FragmentA"]), - .mock(allAnimals?[if: "a"]?[fragment: "FragmentB"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - } - - func test__selections__namedFragmentWithConditionMergedIntoTypeCase_doesNotMergeNamedFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - b: String! - friend: Animal! - } - - interface Pet { - b: String! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - ... on Pet { - b - } - } - } - - fragment FragmentA on Animal { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - .inlineFragment(parentType: Interface_Pet), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimal_ifA = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]?[fragment: "FragmentA"]), - ] - ) - - let expected_allAnimal_asPet = try SelectionSetMatcher( - parentType: Interface_Pet, - inclusionConditions: nil, - directSelections: [ - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - expect(allAnimals?[as: "Pet"]).to(shallowlyMatch(expected_allAnimal_asPet)) - expect(allAnimals?[as: "Pet"]?[if: "a"]).to(beNil()) - } - - // MARK: Merged Named Fragments - - func test__selections__givenIncludeIfVariableOnNamedFragment_merged_createsSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - friend: Animal! - } - """ - - document = """ - query Test($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - a - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let FragmentA = try XCTUnwrap(ir.compilationResult[fragment: "FragmentA"]) - - let allAnimals = self.subject[field: "allAnimals"] - - let expected_allAnimal = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimal_ifA = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.include(if: "a")], - directSelections: [ - .fragmentSpread(FragmentA, inclusionConditions: [.include(if: "a")]), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals?[if: "a"]?[fragment: "FragmentA"]), - ] - ) - - // then - expect(allAnimals?.selectionSet).to(shallowlyMatch(expected_allAnimal)) - - expect(allAnimals?[if: "a"]).to(shallowlyMatch(expected_allAnimal_ifA)) - } - - func test__selections__givenNonNullFieldMergedFromNestedEntityInNamedFragmentWithIncludeCondition_createsSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - child: Child! - } - - type Child { - a: String! - b: String! - c: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...ChildFragment @include(if: $a) - ...ChildFragment @include(if: $b) - child { - a - } - child @include(if: $c) { - c - } - } - } - - fragment ChildFragment on Animal { - child { - b - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = try XCTUnwrap( - self.subject[field: "allAnimals"] as? IR.EntityField - ) - - let allAnimals_child = try XCTUnwrap( - allAnimals[field: "child"] as? IR.EntityField - ) - - let Object_Child = try XCTUnwrap(schema[object: "Child"]) - let ChildFragment = try XCTUnwrap(allAnimals[fragment: "ChildFragment"]) - - let expected_allAnimals_child = SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Object_Child, - inclusionConditions: [.include(if: "c")]), - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimals_child_ifC = try SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: [.include(if: "c")], - directSelections: [ - .field("c", type: .nonNull(.scalar(.string()))), - ], - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals[field: "child"]), - ] - ) - - let expected_allAnimals_ifA_child = try SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: nil, - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Object_Child, - inclusionConditions: [.include(if: "c")]), - ], - mergedSources: [ - .mock(allAnimals[field: "child"]), - .mock(for: ChildFragment.fragment[field: "child"], - from: ChildFragment), - ] - ) - - let expected_allAnimals_ifB_child = try SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: nil, - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - .inlineFragment(parentType: Object_Child, - inclusionConditions: [.include(if: "c")]), - ], - mergedSources: [ - .mock(allAnimals[field: "child"]), - .mock(for: ChildFragment.fragment[field: "child"], - from: ChildFragment), - ] - ) - - // then - expect(allAnimals_child.selectionSet).to(shallowlyMatch(expected_allAnimals_child)) - expect(allAnimals_child[if: "c"]) - .to(shallowlyMatch(expected_allAnimals_child_ifC)) - expect(allAnimals[if: "a"]?[field: "child"]?.selectionSet) - .to(shallowlyMatch(expected_allAnimals_ifA_child)) - expect(allAnimals[if: "b"]?[field: "child"]?.selectionSet) - .to(shallowlyMatch(expected_allAnimals_ifB_child)) - } - - func test__selections__givenFragmentMergedInEntityRootWithInclusionConditionAndInOtherFragmentWithOtherInclusionCondition_mergesSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - child: Child! - } - - interface WarmBlooded implements Animal { - child: Child! - } - - type Child { - a: String! - b: String! - c: String! - } - """ - - document = """ - query TestOperation($b: Boolean!, $c: Boolean!) { - allAnimals { - child { - a - } - ...ChildFragment @skip(if: $b) - ...FragmentContainingChildFragment @include(if: $c) - } - } - - fragment ChildFragment on Animal { - child { - b - } - } - - fragment FragmentContainingChildFragment on WarmBlooded { - ...ChildFragment - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = try XCTUnwrap( - self.subject[field: "allAnimals"] as? IR.EntityField - ) - - let allAnimals_child = try XCTUnwrap( - allAnimals[field: "child"] as? IR.EntityField - ) - - let allAnimals_asWarmBloodedIfC = allAnimals[as: "WarmBlooded", if: "c"] - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_WarmBlooded = try XCTUnwrap(schema[interface: "WarmBlooded"]) - let Object_Child = try XCTUnwrap(schema[object: "Child"]) - let ChildFragment = try XCTUnwrap(allAnimals[fragment: "ChildFragment"]) - let FragmentContainingChildFragment = try XCTUnwrap( - allAnimals[as: "WarmBlooded", if: "c"]?[fragment: "FragmentContainingChildFragment"] - ) - - let expected_allAnimals = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - .inlineFragment(parentType: Interface_Animal, - inclusionConditions: [.skip(if: "b")]), - .inlineFragment(parentType: Interface_WarmBlooded, - inclusionConditions: [.include(if: "c")]), - ], - mergedSelections: [ - .fragmentSpread(ChildFragment.definition, - inclusionConditions: [.skip(if: "b")]), - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimals_child = SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimals_ifB = try SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: [.skip(if: "b")], - directSelections: [ - .fragmentSpread(ChildFragment.definition, - inclusionConditions: [.skip(if: "b")]) - ], - mergedSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - ], - mergedSources: [ - .mock(allAnimals), - .mock(for: ChildFragment.fragment.rootField, - from: ChildFragment), - ] - ) - - let expected_allAnimals_ifB_child = try SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: nil, - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals[field: "child"]), - .mock(for: ChildFragment.fragment[field: "child"], - from: ChildFragment), - ] - ) - - let expected_allAnimals_ifWarmBloodedAndC = try SelectionSetMatcher( - parentType: Interface_WarmBlooded, - inclusionConditions: [.include(if: "c")], - directSelections: [ - .fragmentSpread(FragmentContainingChildFragment.definition, - inclusionConditions: [.include(if: "c")]), - ], - mergedSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - .fragmentSpread(ChildFragment.definition), - ], - mergedSources: [ - .mock(allAnimals), - .mock(FragmentContainingChildFragment), - .mock(ChildFragment) - ] - ) - - let expected_allAnimals_ifWarmBloodedAndC_child = try SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: nil, - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals[field: "child"]), - .mock(for: ChildFragment.fragment[field: "child"], - from: ChildFragment), - ] - ) - - // then - expect(allAnimals.selectionSet).to(shallowlyMatch(expected_allAnimals)) - expect(allAnimals_child.selectionSet).to(shallowlyMatch(expected_allAnimals_child)) - expect(allAnimals[if: !"b"]).to(shallowlyMatch(expected_allAnimals_ifB)) - expect(allAnimals[if: !"b"]?[field: "child"]?.selectionSet) - .to(shallowlyMatch(expected_allAnimals_ifB_child)) - expect(allAnimals_asWarmBloodedIfC).to(shallowlyMatch(expected_allAnimals_ifWarmBloodedAndC)) - expect(allAnimals[as: "WarmBlooded", if: "c"]?[field: "child"]?.selectionSet) - .to(shallowlyMatch(expected_allAnimals_ifWarmBloodedAndC_child)) - } - - func test__selections__givenFragmentMergedFromEntityRootWithInclusionConditionAndFromInTypeCaseWithNoInclusionCondition_mergesFragmentIntoBothConditionalSelectionSets() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - child: Child! - } - - interface Pet implements Animal { - child: Child! - } - - interface WarmBlooded implements Animal { - child: Child! - } - - type Child { - a: String! - b: String! - c: String! - } - """ - - document = """ - query TestOperation($b: Boolean!, $c: Boolean!) { - allAnimals { - child { - a - } - ...WarmBloodedDetails @skip(if: $b) - ... on Pet { - ...WarmBloodedDetails - } - } - } - - fragment WarmBloodedDetails on WarmBlooded { - child { - b - } - } - """ - - // when - try buildSubjectRootField() - - let allAnimals = try XCTUnwrap( - self.subject[field: "allAnimals"] as? IR.EntityField - ) - - let allAnimals_asPet = try XCTUnwrap( - allAnimals[as: "Pet"] - ) - - let allAnimals_asPet_asWarmBlooded = try XCTUnwrap( - allAnimals_asPet[as: "WarmBlooded"] - ) - - let allAnimals_child = try XCTUnwrap( - allAnimals[field: "child"] as? IR.EntityField - ) - - let allAnimals_asWarmBloodedIfNotB = allAnimals[as: "WarmBlooded", if: !"b"] - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_WarmBlooded = try XCTUnwrap(schema[interface: "WarmBlooded"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - let Object_Child = try XCTUnwrap(schema[object: "Child"]) - let WarmBloodedDetails = try XCTUnwrap( - allAnimals[as: "WarmBlooded", if: !"b"]?[fragment: "WarmBloodedDetails"] - ) - - let expected_allAnimals = SelectionSetMatcher( - parentType: Interface_Animal, - inclusionConditions: nil, - directSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - .inlineFragment(parentType: Interface_WarmBlooded, - inclusionConditions: [.skip(if: "b")]), - .inlineFragment(parentType: Interface_Pet), - ], - mergedSelections: [ - ], - mergedSources: [] - ) - - let expected_allAnimals_child = SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: [ - .field("a", type: .nonNull(.scalar(.string()))) - ], - mergedSelections: [], - mergedSources: [] - ) - - let expected_allAnimals_asPet = try SelectionSetMatcher( - parentType: Interface_Pet, - inclusionConditions: nil, - directSelections: [ - .inlineFragment(parentType: Interface_WarmBlooded), - ], - mergedSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - ], - mergedSources: [ - .mock(allAnimals), - ] - ) - - let expected_allAnimals_asPet_asWarmBlooded = try SelectionSetMatcher( - parentType: Interface_WarmBlooded, - inclusionConditions: nil, - directSelections: [ - .fragmentSpread(WarmBloodedDetails.definition) - ], - mergedSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - ], - mergedSources: [ - .mock(allAnimals), - .mock(WarmBloodedDetails), - ] - ) - - let expected_allAnimals_ifWarmBloodedAndNotB = try SelectionSetMatcher( - parentType: Interface_WarmBlooded, - inclusionConditions: [.skip(if: "b")], - directSelections: [ - .fragmentSpread(WarmBloodedDetails.definition, - inclusionConditions: [.skip(if: "b")]), - ], - mergedSelections: [ - .field("child", type: .nonNull(.entity(Object_Child))), - ], - mergedSources: [ - .mock(allAnimals), - .mock(WarmBloodedDetails), - ] - ) - - let expected_allAnimals_ifWarmBloodedAndNotB_child = try SelectionSetMatcher( - parentType: Object_Child, - inclusionConditions: nil, - directSelections: nil, - mergedSelections: [ - .field("a", type: .nonNull(.scalar(.string()))), - .field("b", type: .nonNull(.scalar(.string()))), - ], - mergedSources: [ - .mock(allAnimals[field: "child"]), - .mock(for: WarmBloodedDetails.fragment[field: "child"], - from: WarmBloodedDetails), - ] - ) - - // then - expect(allAnimals.selectionSet).to(shallowlyMatch(expected_allAnimals)) - expect(allAnimals_child.selectionSet).to(shallowlyMatch(expected_allAnimals_child)) - expect(allAnimals_asPet).to(shallowlyMatch(expected_allAnimals_asPet)) - expect(allAnimals_asPet_asWarmBlooded).to(shallowlyMatch(expected_allAnimals_asPet_asWarmBlooded)) - expect(allAnimals_asWarmBloodedIfNotB).to(shallowlyMatch(expected_allAnimals_ifWarmBloodedAndNotB)) - expect(allAnimals_asWarmBloodedIfNotB?[field: "child"]?.selectionSet) - .to(shallowlyMatch(expected_allAnimals_ifWarmBloodedAndNotB_child)) - } - - // MARK: - Group By Inclusion Conditions - - func test__groupedByInclusionConditions__groupsInclusionConditionsCorrectly() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String - b: String - c: String - d: String - e: String - f: String - g: String - h: String - i: String - j: String - k: String - l: String - } - - interface Pet { - pet1: String - pet2: String - pet3: String - } - """ - - document = """ - fragment FragB on Animal { - b - } - - fragment FragG on Animal { - g - } - - query Test { - allAnimals { - a @include(if: $a) - ...FragB @include(if: $a) - ... on Pet @include(if: $a) { - pet1 - } - c @include(if: $c) - d @include(if: $d) - ... on Pet @include(if: $e) { - pet2 - } - f - ...FragG - ... on Pet { - pet3 - } - h @include(if: $h1) - h @include(if: $h2) - i @include(if: $i1) @skip(if: $i2) - i @skip(if: $i3) - j @include(if: $j) @skip(if: $j) - k - k @include(if: $k) - l @skip(if: $l) - } - } - """ - - // when - try buildSubjectRootField() - - let Interface_Animal = try XCTUnwrap(schema[interface: "Animal"]) - let Interface_Pet = try XCTUnwrap(schema[interface: "Pet"]) - let FragmentG = try XCTUnwrap(ir.compilationResult[fragment: "FragG"]) - let allAnimals = self.subject[field: "allAnimals"] - - let expectedUnconditional: SelectionMatcherTuple = ( - fields: [ - .mock("f", type: .string()), - .mock("k", type: .string()) - ], - typeCases: [ - .mock(parentType: Interface_Pet) - ], - fragments: [ - .mock(FragmentG) - ] - ) - - let h1Orh2Condition: AnyOf = AnyOf([ - .init(.include(if: "h1")), - .init(.include(if: "h2")) - ]) - - let i1Andi2Ori3Condition: AnyOf = try AnyOf([ - (.include(if: "i1") && .skip(if: "i2")).conditions.xctUnwrapped(), - .init(.skip(if: "i3")) - ]) - - let expectedInclusionGroups: - OrderedDictionary, SelectionMatcherTuple> = [ - AnyOf(.include(if: "a")): ( - fields: [ - .mock("a", type: .string(), inclusionConditions: AnyOf(.include(if: "a"))), - ], - typeCases: [ - .mock(parentType: Interface_Animal, inclusionConditions: [.include(if: "a")]), - .mock(parentType: Interface_Pet, inclusionConditions: [.include(if: "a")]) - ], - fragments: [ - ]), - AnyOf(.include(if: "c")): ( - fields: [ - .mock("c", type: .string(), inclusionConditions: AnyOf(.include(if: "c"))), - ], - typeCases: [], - fragments: []), - AnyOf(.include(if: "d")): ( - fields: [ - .mock("d", type: .string(), inclusionConditions: AnyOf(.include(if: "d"))), - ], - typeCases: [], - fragments: []), - AnyOf(.include(if: "e")): ( - fields: [], - typeCases: [ - .mock(parentType: Interface_Pet, inclusionConditions: [.include(if: "e")]) - ], - fragments: []), - h1Orh2Condition: ( - fields: [ - .mock("h", type: .string(), inclusionConditions: h1Orh2Condition), - ], - typeCases: [], - fragments: []), - i1Andi2Ori3Condition: ( - fields: [ - .mock("i", type: .string(), inclusionConditions: i1Andi2Ori3Condition), - ], - typeCases: [], - fragments: []), - AnyOf(.skip(if: "l")): ( - fields: [ - .mock("l", type: .string(), inclusionConditions: AnyOf(.skip(if: "l"))), - ], - typeCases: [], - fragments: []), - ] - - let actual = allAnimals?.selectionSet?.selections.direct?.groupedByInclusionCondition - - // then - expect(actual?.unconditionalSelections).to(shallowlyMatch(expectedUnconditional)) - - expect(actual?.inclusionConditionGroups.count).to(equal(expectedInclusionGroups.count)) - for conditionGroup in expectedInclusionGroups.keys { - let expectedGroup = try expectedInclusionGroups[conditionGroup].xctUnwrapped() - let actualGroup = try actual?.inclusionConditionGroups[conditionGroup].xctUnwrapped() - expect(actualGroup).to(shallowlyMatch(expectedGroup)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/CustomScalarFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/CustomScalarFileGeneratorTests.swift deleted file mode 100644 index fe413a486f..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/CustomScalarFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class CustomScalarFileGeneratorTests: XCTestCase { - let graphqlScalar = GraphQLScalarType.mock(name: "MockCustomScalar") - - var subject: CustomScalarFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = CustomScalarFileGenerator( - graphqlScalar: graphqlScalar, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_customScalar() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.customScalar)) - } - - func test__properties__givenGraphQLScalar_shouldReturnFileName_matchingScalarName() { - // given - buildSubject() - - let expected = graphqlScalar.name - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLScalar_shouldNotOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beFalse()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/EnumFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/EnumFileGeneratorTests.swift deleted file mode 100644 index 9fdb0c1867..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/EnumFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class EnumFileGeneratorTests: XCTestCase { - let graphqlEnum = GraphQLEnumType.mock(name: "MockEnum") - - var subject: EnumFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = EnumFileGenerator( - graphqlEnum: graphqlEnum, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_enum() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.enum)) - } - - func test__properties__givenGraphQLEnum_shouldReturnFileName_matchingEnumName() { - // given - buildSubject() - - let expected = graphqlEnum.formattedName - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLEnum_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FileGeneratorTests.swift deleted file mode 100644 index 0a3315cac9..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FileGeneratorTests.swift +++ /dev/null @@ -1,135 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -@testable import ApolloCodegenInternalTestHelpers - -class FileGeneratorTests: XCTestCase { - let fileManager = MockApolloFileManager(strict: false) - let directoryURL = CodegenTestHelper.outputFolderURL() - - var config: ApolloCodegen.ConfigurationContext! - var fileTarget: FileTarget! - var template: MockFileTemplate! - var subject: MockFileGenerator! - - override func tearDown() { - template = nil - subject = nil - fileTarget = nil - config = nil - - super.tearDown() - } - - // MARK: Helpers - - private func buildConfig() { - let mockedConfig = ApolloCodegenConfiguration.mock(output: .mock( - moduleType: .swiftPackageManager, - operations: .inSchemaModule, - path: directoryURL.path - )) - - config = ApolloCodegen.ConfigurationContext(config: mockedConfig) - } - - private func buildSubject(extension: String = "graphql.swift") { - template = MockFileTemplate.mock(target: .schemaFile(type: .schemaMetadata)) - fileTarget = .object - subject = MockFileGenerator.mock( - template: template, - target: fileTarget, - filename: "lowercasedType", - extension: `extension` - ) - } - - // MARK: - Tests - - func test__generate__shouldWriteToCorrectPath() throws { - // given - buildConfig() - buildSubject() - - fileManager.mock(closure: .createFile({ path, data, attributes in - let expected = self.fileTarget.resolvePath(forConfig: self.config) - - // then - let actual = URL(fileURLWithPath: path).deletingLastPathComponent().path - expect(actual).to(equal(expected)) - - return true - })) - - // when - try subject.generate(forConfig: config, fileManager: fileManager) - - // then - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__shouldFirstUppercaseFilename() throws { - // given - buildConfig() - buildSubject() - - fileManager.mock(closure: .createFile({ path, data, attributes in - let expected = "LowercasedType.graphql.swift" - - // then - let actual = URL(fileURLWithPath: path).lastPathComponent - expect(actual).to(equal(expected)) - - return true - })) - - // when - try subject.generate(forConfig: config, fileManager: fileManager) - - // then - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__shouldAddExtensionToFilePath() throws { - // given - buildConfig() - buildSubject(extension: "test") - - fileManager.mock(closure: .createFile({ path, data, attributes in - let expected = "LowercasedType.test" - - // then - let actual = URL(fileURLWithPath: path).lastPathComponent - expect(actual).to(equal(expected)) - - return true - })) - - // when - try subject.generate(forConfig: config, fileManager: fileManager) - - // then - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__shouldWriteRenderedTemplate() throws { - // given - buildConfig() - buildSubject() - - let expectedData = template.render().data(using: .utf8) - - fileManager.mock(closure: .createFile({ path, data, attributes in - // then - expect(data).to(equal(expectedData)) - - return true - })) - - // when - try subject.generate(forConfig: config, fileManager: fileManager) - - // then - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FileGenerator_ResolvePath_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FileGenerator_ResolvePath_Tests.swift deleted file mode 100644 index c9669b0d83..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FileGenerator_ResolvePath_Tests.swift +++ /dev/null @@ -1,2301 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class FileGenerator_ResolvePath_Tests: XCTestCase { - let directoryURL = CodegenTestHelper.outputFolderURL() - - var irFragment: IR.NamedFragment! - var irOperation: IR.Operation! - var subject: FileTarget! - var config: ApolloCodegenConfiguration! - - override func tearDown() { - irOperation = nil - irFragment = nil - subject = nil - config = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildIR() throws { - let schemaSDL = """ - type Animal { - species: String - } - - type Query { - animals: [Animal] - } - """ - - let operationDocument = """ - query AllAnimals { - animals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: operationDocument) - - irFragment = ir.build(fragment: ir.compilationResult.fragments[0]) - irFragment.definition.filePath = directoryURL - .appendingPathComponent("\(UUID().uuidString)/fragment.graphql").path - - irOperation = ir.build(operation: ir.compilationResult.operations[0]) - irOperation.definition.filePath = directoryURL - .appendingPathComponent("\(UUID().uuidString)/operation.graphql").path - } - - private func buildConfig( - module: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - testMocks: ApolloCodegenConfiguration.TestMockFileOutput = .none - ) { - config = .mock(output: .mock( - moduleType: module, - operations: operations, - testMocks: testMocks, - path: directoryURL.path - )) - } - - private func deleteLastPathComponent(_ path: String, appending newPath: String? = nil) -> String { - let result = URL(fileURLWithPath: path).deletingLastPathComponent() - - guard let newPath = newPath else { - return result.path - } - - return result.appendingPathComponent(newPath).path - } - - private func resolvePath() -> String { - subject.resolvePath(forConfig: ApolloCodegen.ConfigurationContext(config: config)) - } - - var currentWorkingDirectoryPath: String { - let path = FileManager.default.currentDirectoryPath - if path.isEmpty { - return path - } else { - return path + "/" - } - } - - // MARK: - Resolving Schema Path Tests - - // MARK: .object - - func test__resolvePath__givenFileTargetObject_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleNone_operationsAbsolutePath_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleNone_operationsRelativeSubpathNil_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleNone_operationsRelativeSubpath_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleOther_operationsAbsolutePath_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleOther_operationsRelativeSubpathNil_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetObject_when_moduleOther_operationsRelativeSubpath_shouldReturnObjectsSubpath() { - // given - subject = .object - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Objects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .enum - - func test__resolvePath__givenFileTargetEnum_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleNone_operationsAbsolutePath_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleNone_operationsRelativeSubpathNil_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleNone_operationsRelativeSubpath_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleOther_operationsAbsolutePath_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleOther_operationsRelativeSubpathNil_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetEnum_when_moduleOther_operationsRelativeSubpath_shouldReturnEnumsSubpath() { - // given - subject = .enum - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Enums") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .interface - - func test__resolvePath__givenFileTargetInterface_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleNone_operationsAbsolutePath_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleNone_operationsRelativeSubpathNil_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleNone_operationsRelativeSubpath_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleOther_operationsAbsolutePath_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleOther_operationsRelativeSubpathNil_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInterface_when_moduleOther_operationsRelativeSubpath_shouldReturnInterfacesSubpath() { - // given - subject = .interface - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Interfaces") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .union - - func test__resolvePath__givenFileTargetUnion_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleNone_operationsAbsolutePath_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleNone_operationsRelativeSubpathNil_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleNone_operationsRelativeSubpath_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleOther_operationsAbsolutePath_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleOther_operationsRelativeSubpathNil_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetUnion_when_moduleOther_operationsRelativeSubpath_shouldReturnUnionsSubpath() { - // given - subject = .union - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Unions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .inputObjects - - func test__resolvePath__givenFileTargetInputObject_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleNone_operationsAbsolutePath_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleNone_operationsRelativeSubpathNil_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleNone_operationsRelativeSubpath_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleOther_operationsAbsolutePath_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleOther_operationsRelativeSubpathNil_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetInputObject_when_moduleOther_operationsRelativeSubpath_shouldReturnInputObjectsSubpath() { - // given - subject = .inputObject - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("InputObjects") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .customScalar - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleNone_operationsAbsolutePath_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleNone_operationsRelativeSubpathNil_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleNone_operationsRelativeSubpath_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleOther_operationsAbsolutePath_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleOther_operationsRelativeSubpathNil_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetCustomScalar_when_moduleOther_operationsRelativeSubpath_shouldReturnInputObjectsSubpath() { - // given - subject = .customScalar - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("CustomScalars") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .schema - - func test__resolvePath__givenFileTargetSchema_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnSchemaSubpath() { - // given - subject = .schema - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Schema") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .swiftPackageManager, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = directoryURL - .appendingPathComponent("Sources") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .appendingPathComponent("Sources") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleNone_operationsInSchemaModule_shouldReturnSchemaSubpath() { - // given - subject = .schema - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleNone_operationsAbsolutePath_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleNone_operationsRelativeSubpathNil_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = directoryURL - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleNone_operationsRelativeSubpath_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleOther_operationsInSchemaModule_shouldReturnSchemaSubpath() { - // given - subject = .schema - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Schema") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleOther_operationsAbsolutePath_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .other, operations: .absolute(path: "NewPath")) - - let expected = directoryURL - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleOther_operationsRelativeSubpathNil_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = directoryURL - .standardizedFileURL.path - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSchema_when_moduleOther_operationsRelativeSubpath_shouldReturnEmptySubpath() { - // given - subject = .schema - - // when - buildConfig(module: .other, operations: .relative(subpath: "NewPath")) - - let expected = directoryURL - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .fragment - - func test__resolvePath__givenFileTargetFragment_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnFragmentsSubpath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Fragments") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnAbsolutePathFragmentsDirectory() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - let path = "New/Path" - buildConfig(module: .swiftPackageManager, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Fragments" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnFilePath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = deleteLastPathComponent(irFragment.definition.filePath) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnRelativeSubpath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - let path = "NewPath" - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: path)) - - let expected = deleteLastPathComponent(irFragment.definition.filePath, appending: path) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleNone_operationsInSchemaModule_shouldReturnFragmentsSubpath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Fragments") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleNone_operationsAbsolutePath_shouldReturnAbsoluteSubpathFragmentsDirectory() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - let path = "New/Path" - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Fragments" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleNone_operationsRelativeSubpathNil_shouldReturnFilePath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = deleteLastPathComponent(irFragment.definition.filePath) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleNone_operationsRelativeSubpath_shouldReturnRelativeSubpath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - let path = "NewPath" - - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: path)) - - let expected = deleteLastPathComponent(irFragment.definition.filePath, appending: path) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleOther_operationsInSchemaModule_shouldReturnFragmentsSubpath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Fragments") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleOther_operationsAbsolutePath_shouldReturnAbsoluteSubpathFragmentsDirectory() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - let path = "New/Path" - - buildConfig(module: .other, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Fragments" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleOther_operationsRelativeSubpathNil_shouldReturnFilePath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = deleteLastPathComponent(irFragment.definition.filePath) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetFragment_when_moduleOther_operationsRelativeSubpath_shouldReturnRelativeSubpath() throws { - // given - try buildIR() - subject = .fragment(irFragment.definition) - - // when - let path = "NewPath" - - buildConfig(module: .other, operations: .relative(subpath: path)) - - let expected = deleteLastPathComponent(irFragment.definition.filePath, appending: path) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .operation - - func test__resolvePath__givenFileTargetQuery_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnOperationsQuerySubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .query - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Operations") - .appendingPathComponent("Queries") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetMutation_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnOperationsMutationSubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .mutation - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Operations") - .appendingPathComponent("Mutations") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSubscription_when_moduleSwiftPackageManager_operationsInSchemaModule_shouldReturnOperationsSubscriptionsSubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .subscription - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .swiftPackageManager, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Sources") - .appendingPathComponent("Operations") - .appendingPathComponent("Subscriptions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetQuery_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnAbsolutePathQueryDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .query - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - buildConfig(module: .swiftPackageManager, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Queries" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetMutation_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnAbsolutePathMutationDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .mutation - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - buildConfig(module: .swiftPackageManager, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Mutations" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSubscription_when_moduleSwiftPackageManager_operationsAbsolutePath_shouldReturnAbsolutePathQueryDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .subscription - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - buildConfig(module: .swiftPackageManager, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Subscriptions" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetOperation_when_moduleSwiftPackageManager_operationsRelativeSubpathNil_shouldReturnFilePath() throws { - // given - try buildIR() - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: nil)) - - let expected = deleteLastPathComponent(irOperation.definition.filePath) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetOperation_when_moduleSwiftPackageManager_operationsRelativeSubpath_shouldReturnRelativeSubpath() throws { - // given - try buildIR() - subject = .operation(irOperation.definition) - - // when - let path = "NewPath" - buildConfig(module: .swiftPackageManager, operations: .relative(subpath: path)) - - let expected = deleteLastPathComponent(irOperation.definition.filePath, appending: path) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetQuery_when_moduleNone_operationsInSchemaModule_shouldReturnOperationsQuerySubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .query - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Operations") - .appendingPathComponent("Queries") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetMutation_when_moduleNone_operationsInSchemaModule_shouldReturnOperationsMutationSubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .mutation - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Operations") - .appendingPathComponent("Mutations") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSubscription_when_moduleNone_operationsInSchemaModule_shouldReturnOperationsSubscriptionsSubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .subscription - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Operations") - .appendingPathComponent("Subscriptions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetQuery_when_moduleNone_operationsAbsolutePath_shouldReturnAbsoluteSubpathQueryDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .query - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Queries" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetMutation_when_moduleNone_operationsAbsolutePath_shouldReturnAbsoluteSubpathMutationDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .mutation - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Mutations" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSubscription_when_moduleNone_operationsAbsolutePath_shouldReturnAbsoluteSubpathMutationDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .subscription - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Subscriptions" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetOperation_when_moduleNone_operationsRelativeSubpathNil_shouldReturnFilePath() throws { - // given - try buildIR() - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)) - - let expected = deleteLastPathComponent(irOperation.definition.filePath) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetOperation_when_moduleNone_operationsRelativeSubpath_shouldReturnRelativeSubpath() throws { - // given - try buildIR() - subject = .operation(irOperation.definition) - - // when - let path = "NewPath" - - buildConfig(module: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: path)) - - let expected = deleteLastPathComponent(irOperation.definition.filePath, appending: path) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetQuery_when_moduleOther_operationsInSchemaModule_shouldReturnOperationsQuerySubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .query - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Operations") - .appendingPathComponent("Queries") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetMutation_when_moduleOther_operationsInSchemaModule_shouldReturnOperationsMutationSubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .mutation - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Operations") - .appendingPathComponent("Mutations") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSubscription_when_moduleOther_operationsInSchemaModule_shouldReturnOperationsQuerySubpath() throws { - // given - try buildIR() - irOperation.definition.operationType = .subscription - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .other, operations: .inSchemaModule) - - let expected = directoryURL - .appendingPathComponent("Operations") - .appendingPathComponent("Subscriptions") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetQuery_when_moduleOther_operationsAbsolutePath_shouldReturnAbsoluteSubpathQueryDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .query - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - - buildConfig(module: .other, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Queries" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetMutation_when_moduleOther_operationsAbsolutePath_shouldReturnAbsoluteSubpathMutationDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .mutation - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - - buildConfig(module: .other, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Mutations" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetSubscription_when_moduleOther_operationsAbsolutePath_shouldReturnAbsoluteSubpathSubscriptionDirectory() throws { - // given - try buildIR() - irOperation.definition.operationType = .subscription - subject = .operation(irOperation.definition) - - // when - let path = "New/Path" - - buildConfig(module: .other, operations: .absolute(path: path)) - - let expected = currentWorkingDirectoryPath + path + "/Subscriptions" - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetOperation_when_moduleOther_operationsRelativeSubpathNil_shouldReturnFilePath() throws { - // given - try buildIR() - subject = .operation(irOperation.definition) - - // when - buildConfig(module: .other, operations: .relative(subpath: nil)) - - let expected = deleteLastPathComponent(irOperation.definition.filePath) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetOperation_when_moduleOther_operationsRelativeSubpath_shouldReturnRelativeSubpath() throws { - // given - try buildIR() - subject = .operation(irOperation.definition) - - // when - let path = "NewPath" - - buildConfig(module: .other, operations: .relative(subpath: path)) - - let expected = deleteLastPathComponent(irOperation.definition.filePath, appending: path) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - // MARK: .testMock - - func test__resolvePath__givenFileTargetTestMock_when_moduleSwiftPackageManager_mocksInSwiftPackage_noTargetNane_shouldReturnTestMocksPath() { - // given - subject = .testMock - - // when - buildConfig( - module: .swiftPackageManager, - operations: .inSchemaModule, - testMocks: .swiftPackage() - ) - - let expected = directoryURL - .appendingPathComponent("TestMocks") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetTestMock_when_moduleSwiftPackageManager_mocksInSwiftPackage_withTargetName_shouldReturnTestMocksPathWithCustomName() { - // given - subject = .testMock - - // when - buildConfig( - module: .swiftPackageManager, - operations: .inSchemaModule, - testMocks: .swiftPackage(targetName: "CustomMockTarget") - ) - - let expected = directoryURL - .appendingPathComponent("CustomMockTarget") - .standardizedFileURL.path - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - - func test__resolvePath__givenFileTargetTestMock_mocksAbsolutePath_shouldReturnPath() { - // given - subject = .testMock - - let expected = directoryURL - .appendingPathComponent("AbsoluteTestMocks") - .standardizedFileURL.path - - // when - buildConfig( - module: .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule, - testMocks: .absolute(path: expected) - ) - - // then - let actual = resolvePath() - - expect(actual).to(equal(expected)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FragmentFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FragmentFileGeneratorTests.swift deleted file mode 100644 index 55cf91012f..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/FragmentFileGeneratorTests.swift +++ /dev/null @@ -1,86 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class FragmentFileGeneratorTests: XCTestCase { - var irFragment: IR.NamedFragment! - var subject: FragmentFileGenerator! - var operationDocument: String! - - override func setUp() { - super.setUp() - operationDocument = """ - query AllAnimals { - animals { - ...animalDetails - } - } - - fragment animalDetails on Animal { - species - } - """ - } - - override func tearDown() { - subject = nil - irFragment = nil - operationDocument = nil - - super.tearDown() - } - - // MARK: Test Helpers - - private func buildSubject() throws { - let schemaSDL = """ - type Animal { - species: String - } - - type Query { - animals: [Animal] - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: operationDocument) - irFragment = ir.build(fragment: ir.compilationResult.fragments[0]) - - subject = FragmentFileGenerator( - irFragment: irFragment, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_fragment() throws { - // given - try buildSubject() - - let expected: FileTarget = .fragment(irFragment.definition) - - // then - expect(self.subject.target).to(equal(expected)) - } - - func test__properties__givenGraphQLFragment_shouldReturnFileName_matchingFragmentDefinitionName() throws { - // given - try buildSubject() - - let expected = irFragment.definition.name - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLFragment_shouldOverwrite() throws { - // given - try buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/InputObjectFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/InputObjectFileGeneratorTests.swift deleted file mode 100644 index e9320a6550..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/InputObjectFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class InputObjectFileGeneratorTests: XCTestCase { - let graphqlInputObject = GraphQLInputObjectType.mock("MockInputObject") - - var subject: InputObjectFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = InputObjectFileGenerator( - graphqlInputObject: graphqlInputObject, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_inputObject() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.inputObject)) - } - - func test__properties__givenGraphQLInputObject_shouldReturnFileName_matchingInputObjectName() { - // given - buildSubject() - - let expected = graphqlInputObject.name - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLInputObject_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/InterfaceFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/InterfaceFileGeneratorTests.swift deleted file mode 100644 index 51c0773c61..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/InterfaceFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class InterfaceFileGeneratorTests: XCTestCase { - let graphqlInterface = GraphQLInterfaceType.mock("MockInterface", fields: [:], interfaces: []) - - var subject: InterfaceFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = InterfaceFileGenerator( - graphqlInterface: graphqlInterface, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_interface() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.interface)) - } - - func test__properties__givenGraphQLInterface_shouldReturnFileName_matchingInterfaceName() { - // given - buildSubject() - - let expected = graphqlInterface.name - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLInterface_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockInterfacesFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockInterfacesFileGeneratorTests.swift deleted file mode 100644 index 689414cebc..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockInterfacesFileGeneratorTests.swift +++ /dev/null @@ -1,64 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib - -class MockInterfacesFileGeneratorTests: XCTestCase { - static let mockInterface = GraphQLInterfaceType.mock("MockUnion") - - var subject: MockInterfacesFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject(interfaces: OrderedSet = [mockInterface]) { - let compilationResult = CompilationResult.mock() - compilationResult.referencedTypes.append(contentsOf: interfaces.elements) - - let ir = IR.mock(compilationResult: compilationResult) - - subject = MockInterfacesFileGenerator( - ir: ir, - config: ApolloCodegen.ConfigurationContext(config: .mock(.other)) - ) - } - - // MARK: Property Tests - - func test__init_givenNoInterfaces__shouldBeNil() { - // given - buildSubject(interfaces: []) - - // then - expect(self.subject).to(beNil()) - } - - func test__properties__shouldReturnTargetType_testMock() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.testMock)) - } - - func test__properties__shouldReturnFileName() { - // given - buildSubject() - - let expected = "MockObject+Interfaces" - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__overwrite_shouldBeTrue() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockObjectFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockObjectFileGeneratorTests.swift deleted file mode 100644 index 8cf4cdd9e2..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockObjectFileGeneratorTests.swift +++ /dev/null @@ -1,51 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class MockObjectFileGeneratorTests: XCTestCase { - let graphqlObject = GraphQLObjectType.mock("MockObject", fields: [:], interfaces: []) - - var subject: MockObjectFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = MockObjectFileGenerator( - graphqlObject: graphqlObject, - ir: .mock(compilationResult: .mock()), - config: ApolloCodegen.ConfigurationContext(config: .mock(.other)) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_testMock() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.testMock)) - } - - func test__properties__givenGraphQLObject_shouldReturnFileName_matchingObjectName() { - // given - buildSubject() - - let expected = "\(graphqlObject.name)+Mock" - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLObject_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockUnionsFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockUnionsFileGeneratorTests.swift deleted file mode 100644 index 9e8c419e85..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/MockUnionsFileGeneratorTests.swift +++ /dev/null @@ -1,64 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib - -class MockUnionsFileGeneratorTests: XCTestCase { - static let mockUnion = GraphQLUnionType.mock("MockUnion", types: []) - - var subject: MockUnionsFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject(unions: OrderedSet = [mockUnion]) { - let compilationResult = CompilationResult.mock() - compilationResult.referencedTypes.append(contentsOf: unions.elements) - - let ir = IR.mock(compilationResult: compilationResult) - - subject = MockUnionsFileGenerator( - ir: ir, - config: ApolloCodegen.ConfigurationContext(config: .mock(.other)) - ) - } - - // MARK: Property Tests - - func test__init_givenNoUnions__shouldBeNil() { - // given - buildSubject(unions: []) - - // then - expect(self.subject).to(beNil()) - } - - func test__properties__shouldReturnTargetType_testMock() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.testMock)) - } - - func test__properties__shouldReturnFileName() { - // given - buildSubject() - - let expected = "MockObject+Unions" - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__overwrite_shouldBeTrue() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/ObjectFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/ObjectFileGeneratorTests.swift deleted file mode 100644 index ffb8619a08..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/ObjectFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class ObjectFileGeneratorTests: XCTestCase { - let graphqlObject = GraphQLObjectType.mock("MockObject", fields: [:], interfaces: []) - - var subject: ObjectFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = ObjectFileGenerator( - graphqlObject: graphqlObject, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_object() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.object)) - } - - func test__properties__givenGraphQLObject_shouldReturnFileName_matchingObjectName() { - // given - buildSubject() - - let expected = graphqlObject.name - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLObject_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/OperationFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/OperationFileGeneratorTests.swift deleted file mode 100644 index 1222c3b273..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/OperationFileGeneratorTests.swift +++ /dev/null @@ -1,114 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class OperationFileGeneratorTests: XCTestCase { - var irOperation: IR.Operation! - var subject: OperationFileGenerator! - var operationDocument: String! - - override func setUp() { - super.setUp() - - operationDocument = """ - query AllAnimals { - animals { - species - } - } - """ - } - - override func tearDown() { - subject = nil - irOperation = nil - operationDocument = nil - super.tearDown() - } - - // MARK: Test Helpers - - private func buildSubject() throws { - let schemaSDL = """ - type Animal { - species: String - } - - type Query { - animals: [Animal] - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: operationDocument) - irOperation = ir.build(operation: ir.compilationResult.operations[0]) - - let config = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - - subject = OperationFileGenerator(irOperation: irOperation, config: config) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_operation() throws { - // given - try buildSubject() - - let expected: FileTarget = .operation(irOperation.definition) - - // then - expect(self.subject.target).to(equal(expected)) - } - - func test__properties__givenIrOperation_shouldReturnFileName_matchingOperationDefinitionName() throws { - // given - try buildSubject() - - let expected = irOperation.definition.nameWithSuffix - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenIrOperation_shouldOverwrite() throws { - // given - try buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } - - func test__template__givenNotLocalCacheMutationOperation_shouldBeOperationTemplate() throws { - // given - operationDocument = """ - query AllAnimals { - animals { - species - } - } - """ - - // when - try buildSubject() - - // then - expect(self.subject.template).to(beAKindOf(OperationDefinitionTemplate.self)) - } - - func test__template__givenLocalCacheMutationOperation_shouldBeLocalCacheMutationOperationTemplate() throws { - // given - operationDocument = """ - query AllAnimals @apollo_client_ios_localCacheMutation { - animals { - species - } - } - """ - - // when - try buildSubject() - - // then - expect(self.subject.template).to(beAKindOf(LocalCacheMutationDefinitionTemplate.self)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/OperationManifestFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/OperationManifestFileGeneratorTests.swift deleted file mode 100644 index 5237fc2fcf..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/OperationManifestFileGeneratorTests.swift +++ /dev/null @@ -1,298 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class OperationManifestFileGeneratorTests: XCTestCase { - var fileManager: MockApolloFileManager! - var subject: OperationManifestFileGenerator! - - override func setUp() { - super.setUp() - - fileManager = MockApolloFileManager(strict: true) - } - - override func tearDown() { - subject = nil - fileManager = nil - } - - // MARK: Test Helpers - - private func buildSubject( - path: String? = nil, - version: ApolloCodegenConfiguration.OperationManifestConfiguration.Version = .legacy - ) throws { - let manifest: ApolloCodegenConfiguration.OperationManifestConfiguration? = { - guard let path else { return nil } - return .init(path: path, version: version) - }() - - subject = try OperationManifestFileGenerator( - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - output: .init( - schemaTypes: .init(path: "", moduleType: .swiftPackageManager) - ), - operationManifest: manifest - )) - ).xctUnwrapped() - } - - // MARK: Initializer Tests - - func test__initializer__givenPath_shouldReturnInstance() { - // given - let config = ApolloCodegenConfiguration.mock( - output: .init( - schemaTypes: .init(path: "", moduleType: .swiftPackageManager) - ), - operationManifest: .init( - path: "a/file/path" - ) - ) - - // when - let instance = OperationManifestFileGenerator(config: .init(config: config)) - - // then - expect(instance).notTo(beNil()) - } - - func test__initializer__givenNilPath_shouldReturnNil() { - // given - let config = ApolloCodegenConfiguration.mock( - output: .init( - schemaTypes: .init(path: "", moduleType: .swiftPackageManager) - ), - operationManifest: nil - ) - - // when - let instance = OperationManifestFileGenerator(config: .init(config: config)) - - // then - expect(instance).to(beNil()) - } - - // MARK: Generate Tests - - func test__generate__givenOperation_shouldWriteToAbsolutePath() throws { - // given - let filePath = "path/to/match" - try buildSubject(path: filePath) - - subject.collectOperationIdentifier(.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - )) - - fileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - fileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - fileManager.mock(closure: .createFile({ path, data, attributes in - expect(path).to(equal("\(filePath).json")) - - return true - })) - - // when - try subject.generate(fileManager: fileManager) - - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenOperation_withPathExtension_shouldWriteToAbsolutePathWithSinglePathExtension() throws { - // given - let filePath = "path/to/match" - try buildSubject(path: "\(filePath).json") - - subject.collectOperationIdentifier(.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - )) - - fileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - fileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - fileManager.mock(closure: .createFile({ path, data, attributes in - expect(path).to(equal("\(filePath).json")) - - return true - })) - - // when - try subject.generate(fileManager: fileManager) - - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenOperation_shouldWriteToRelativePath() throws { - // given - let filePath = "./path/to/match" - try buildSubject(path: filePath) - - subject.collectOperationIdentifier(.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - )) - - fileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - fileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - fileManager.mock(closure: .createFile({ path, data, attributes in - let expectedPath = URL(fileURLWithPath: String(filePath.dropFirst(2)), relativeTo: self.subject.config.rootURL) - .resolvingSymlinksInPath() - .appendingPathExtension("json") - .path - expect(path).to(equal(expectedPath)) - - return true - })) - - // when - try subject.generate(fileManager: fileManager) - - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenOperation_withPathExtension_shouldWriteToRelativePathWithSinglePathExtension() throws { - // given - let filePath = "./path/to/match" - try buildSubject(path: "\(filePath).json") - - subject.collectOperationIdentifier(.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - )) - - fileManager.mock(closure: .fileExists({ path, isDirectory in - return false - })) - - fileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - fileManager.mock(closure: .createFile({ path, data, attributes in - let expectedPath = URL(fileURLWithPath: String(filePath.dropFirst(2)), relativeTo: self.subject.config.rootURL) - .resolvingSymlinksInPath() - .appendingPathExtension("json") - .path - expect(path).to(equal(expectedPath)) - - return true - })) - - // when - try subject.generate(fileManager: fileManager) - - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenOperations_whenFileExists_shouldOverwrite() throws { - // given - let filePath = "path/that/exists" - try buildSubject(path: filePath) - - subject.collectOperationIdentifier(.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - )) - - fileManager.mock(closure: .fileExists({ path, isDirectory in - return true - })) - - fileManager.mock(closure: .createDirectory({ path, intermediateDirectories, attributes in - // no-op - })) - - fileManager.mock(closure: .createFile({ path, data, attributes in - expect(path).to(equal("\(filePath).json")) - - expect(String(data: data!, encoding: .utf8)).to(equal( - """ - { - "8ed9fcbb8ef3c853ad0ecdc920eb8216608bd7c3b32258744e9289ec0372eb30" : { - "name": "TestQuery", - "source": "query TestQuery { test }" - } - } - """ - )) - - return true - })) - - // when - try subject.generate(fileManager: fileManager) - - expect(self.fileManager.allClosuresCalled).to(beTrue()) - } - - // MARK: - Template Type Selection Tests - - func test__template__givenOperationManifestVersion_legacy__isLegacyTemplate() throws { - // given - try buildSubject(path: "a/path", version: .legacy) - - // when - let actual = subject.template - - // then - expect(actual).to(beAKindOf(LegacyAPQOperationManifestTemplate.self)) - } - - func test__template__givenOperationManifestVersion_persistedQueries__isPersistedQueriesTemplate() throws { - // given - try buildSubject(path: "a/path", version: .persistedQueries) - - // when - let actual = subject.template as? PersistedQueriesOperationManifestTemplate - - // then - expect(actual).toNot(beNil()) - expect(actual?.config).to(beIdenticalTo(self.subject.config)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaConfigurationFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaConfigurationFileGeneratorTests.swift deleted file mode 100644 index 44c8f9abef..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaConfigurationFileGeneratorTests.swift +++ /dev/null @@ -1,49 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class SchemaConfigurationFileGeneratorTests: XCTestCase { - let irSchema = IR.Schema(referencedTypes: .init([])) - - var subject: SchemaConfigurationFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = SchemaConfigurationFileGenerator( - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_schema() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.schema)) - } - - func test__properties__givenIrSchema_shouldReturnFileName_plusCacheKeyResolution() { - // given - buildSubject() - - let expected = "SchemaConfiguration" - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties_overwrite__shouldBeFalse() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beFalse()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaMetadataFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaMetadataFileGeneratorTests.swift deleted file mode 100644 index 5ef9cdd60f..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaMetadataFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class SchemaMetadataFileGeneratorTests: XCTestCase { - let irSchema = IR.Schema(referencedTypes: .init([])) - - var subject: SchemaMetadataFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = SchemaMetadataFileGenerator( - schema: irSchema, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_schema() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.schema)) - } - - func test__properties__givenIrSchema_shouldReturnFileName_matchingName() { - // given - buildSubject() - - let expected = "SchemaMetadata" - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphIrSchema_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaModuleFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaModuleFileGeneratorTests.swift deleted file mode 100644 index c087429539..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/SchemaModuleFileGeneratorTests.swift +++ /dev/null @@ -1,133 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers -import Nimble - -class SchemaModuleFileGeneratorTests: XCTestCase { - let rootURL = URL(fileURLWithPath: CodegenTestHelper.outputFolderURL().path) - let mockFileManager = MockApolloFileManager(strict: false) - - override func tearDown() { - CodegenTestHelper.deleteExistingOutputFolder() - - super.tearDown() - } - - // MARK: - Tests - - func test__generate__givenModuleType_swiftPackageManager_shouldGeneratePackageFile() throws { - // given - let fileURL = rootURL.appendingPathComponent("Package.swift") - - let configuration = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - .swiftPackageManager, - to: rootURL.path - )) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - // then - expect(path).to(equal(fileURL.path)) - - return true - })) - - // when - try SchemaModuleFileGenerator.generate(configuration, fileManager: mockFileManager) - - // then - expect(self.mockFileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenModuleTypeEmbeddedInTarget_lowercaseSchemaName_shouldGenerateNamespaceFileWithCapitalizedName() throws { - // given - let fileURL = rootURL.appendingPathComponent("Schema.graphql.swift") - - let configuration = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - .embeddedInTarget(name: "MockApplication"), - schemaNamespace: "schema", - to: rootURL.path - )) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - // then - expect(path).to(equal(fileURL.path)) - - return true - })) - - // when - try SchemaModuleFileGenerator.generate(configuration, fileManager: mockFileManager) - - // then - expect(self.mockFileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenModuleTypeEmbeddedInTarget_uppercaseSchemaName_shouldGenerateNamespaceFileWithUppercaseName() throws { - // given - let fileURL = rootURL.appendingPathComponent("SCHEMA.graphql.swift") - - let configuration = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - .embeddedInTarget(name: "MockApplication"), - schemaNamespace: "SCHEMA", - to: rootURL.path - )) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - // then - expect(path).to(equal(fileURL.path)) - - return true - })) - - // when - try SchemaModuleFileGenerator.generate(configuration, fileManager: mockFileManager) - - // then - expect(self.mockFileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenModuleTypeEmbeddedInTarget_capitalizedSchemaName_shouldGenerateNamespaceFileWithCapitalizedName() throws { - // given - let fileURL = rootURL.appendingPathComponent("MySchema.graphql.swift") - - let configuration = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - .embeddedInTarget(name: "MockApplication"), - schemaNamespace: "MySchema", - to: rootURL.path - )) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - // then - expect(path).to(equal(fileURL.path)) - - return true - })) - - // when - try SchemaModuleFileGenerator.generate(configuration, fileManager: mockFileManager) - - // then - expect(self.mockFileManager.allClosuresCalled).to(beTrue()) - } - - func test__generate__givenModuleType_other_shouldNotGenerateFile() throws { - // given - let configuration = ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock( - .other, - to: rootURL.path - )) - - mockFileManager.mock(closure: .createFile({ path, data, attributes in - // then - fail("Unexpected module file created at \(path)") - - return true - })) - - // when - try SchemaModuleFileGenerator.generate(configuration, fileManager: mockFileManager) - - // then - expect(self.mockFileManager.allClosuresCalled).to(beFalse()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/UnionFileGeneratorTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/UnionFileGeneratorTests.swift deleted file mode 100644 index 83ea2983fd..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/FileGenerators/UnionFileGeneratorTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class UnionFileGeneratorTests: XCTestCase { - let graphqlUnion = GraphQLUnionType.mock("MockUnion", types: []) - - var subject: UnionFileGenerator! - - override func tearDown() { - subject = nil - } - - // MARK: Test Helpers - - private func buildSubject() { - subject = UnionFileGenerator( - graphqlUnion: graphqlUnion, - config: ApolloCodegen.ConfigurationContext(config: ApolloCodegenConfiguration.mock()) - ) - } - - // MARK: Property Tests - - func test__properties__shouldReturnTargetType_union() { - // given - buildSubject() - - // then - expect(self.subject.target).to(equal(.union)) - } - - func test__properties__givenGraphQLUnion_shouldReturnFileName_matchingUnionName() { - // given - buildSubject() - - let expected = graphqlUnion.name - - // then - expect(self.subject.fileName).to(equal(expected)) - } - - func test__properties__givenGraphQLUnion_shouldOverwrite() { - // given - buildSubject() - - // then - expect(self.subject.overwrite).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/CustomScalarTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/CustomScalarTemplateTests.swift deleted file mode 100644 index 394a0216ac..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/CustomScalarTemplateTests.swift +++ /dev/null @@ -1,240 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers -import ApolloAPI - -class CustomScalarTemplateTests: XCTestCase { - var subject: CustomScalarTemplate! - - // MARK: Helpers - - override func tearDown() { - subject = nil - - super.tearDown() - } - - private func buildSubject( - name: String = "MyCustomScalar", - config: ApolloCodegenConfiguration = .mock() - ) { - subject = CustomScalarTemplate( - graphqlScalar: GraphQLScalarType.mock(name: name), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func buildSubject( - type: GraphQLScalarType, - config: ApolloCodegenConfiguration = .mock() - ) { - subject = CustomScalarTemplate( - graphqlScalar: type, - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Casing Tests - - func test__render__givenCustomScalar_shouldGenerateTypealiasNameFirstUppercased() throws { - // given - buildSubject(name: "aCustomScalar") - - let expected = """ - typealias ACustomScalar = String - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - // MARK: Typealias Definition Tests - - func test__render__givenCustomScalar_shouldGenerateStringTypealias() throws { - // given - buildSubject() - - let expected = """ - typealias MyCustomScalar = String - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - // MARK: Access Level Tests - - func test_render_givenModuleType_swiftPackageManager_generatesTypealias_withPublicAccess() { - // given - buildSubject(config: .mock(.swiftPackageManager)) - - let expected = """ - public typealias MyCustomScalar = String - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_other_generatesTypealias_withPublicAccess() { - // given - buildSubject(config: .mock(.other)) - - let expected = """ - public typealias MyCustomScalar = String - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_embeddedInTarget_withInternalAccessModifier_generatesTypealias_withInternalAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .internal))) - - let expected = """ - typealias MyCustomScalar = String - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_embeddedInTarget_withPublicAccessModifier_generatesTypealias_withPublicAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .public))) - - let expected = """ - typealias MyCustomScalar = String - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - type: .mock( - name: "CustomScalar", - specifiedByURL: nil, - documentation: documentation - ), - config: .mock(options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - typealias CustomScalar = String - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenSchemaDocumentation_include_hasDocumentationAndSpecifiedByURL_shouldGenerateDocumentationCommentWithSpecifiedBy() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - type: .mock( - name: "CustomScalar", - specifiedByURL: "http://www.apollographql.com/scalarSpec", - documentation: documentation - ), - config: .mock(options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - /// - /// Specified by: [](http://www.apollographql.com/scalarSpec) - typealias CustomScalar = String - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - type: .mock( - name: "CustomScalar", - specifiedByURL: nil, - documentation: documentation - ), - config: .mock(options: .init(schemaDocumentation: .exclude)) - ) - - let expected = """ - typealias CustomScalar = String - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - // MARK: - Reserved Keyword Tests - - func test__render__givenCustomScalar_usingReservedKeyword_shouldRenderAsEscaped() throws { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject(name: keyword) - - let expected = """ - typealias \(keyword.firstUppercased)_Scalar = String - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/EnumTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/EnumTemplateTests.swift deleted file mode 100644 index 9e2a34a8ea..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/EnumTemplateTests.swift +++ /dev/null @@ -1,486 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class EnumTemplateTests: XCTestCase { - var subject: EnumTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: Helpers - - /// Convenience function to build the `EnumTemplate` `subject`. - /// - /// - Parameters: - /// - name: Enum definition name. - /// - values: A tuple that combines the value name and optional deprecation reason. - /// - config: Code generation configuration. - private func buildSubject( - name: String = "TestEnum", - documentation: String? = nil, - values: [(String, String?, documentation: String?)] = [("ONE", nil, nil), ("TWO", nil, nil)], - config: ApolloCodegenConfiguration = ApolloCodegenConfiguration.mock() - ) { - subject = EnumTemplate( - graphqlEnum: GraphQLEnumType.mock( - name: name, - values: values.map({ - GraphQLEnumValue.mock( - name: $0.0, - deprecationReason: $0.1, - documentation: $0.documentation - ) - }), - documentation: documentation - ), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Access Level Tests - - func test_render_givenModuleType_swiftPackageManager_generatesSwiftEnum_withPublicAccess() { - // given - buildSubject(config: .mock(.swiftPackageManager)) - - let expected = """ - public enum TestEnum: String, EnumType { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_other_generatesSwiftEnum_withPublicAccess() { - // given - buildSubject(config: .mock(.other)) - - let expected = """ - public enum TestEnum: String, EnumType { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_embeddedInTarget_withInternalAccessModifier_generatesSwiftEnum_withInternalAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .internal))) - - let expected = """ - enum TestEnum: String, EnumType { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_embeddedInTarget_withPublicAccessModifier_generatesSwiftEnum_withPublicAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .public))) - - let expected = """ - enum TestEnum: String, EnumType { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Casing Tests - - func test_render_givenSchemaEnum_generatesSwiftEnumNameFirstUppercased() throws { - // given - buildSubject(name: "anEnum") - - let expected = """ - enum AnEnum: String, EnumType { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenOption_caseConversionStrategy_camelCase_generatesSwiftEnumValues_convertedToCamelCase() { - // given - buildSubject( - name: "casedEnum", - values: [ - // Mixed case - ("lowercase", nil, nil), - ("UPPERCASE", nil, nil), - ("Capitalized", nil, nil), - ("snake_case", nil, nil), - ("UPPER_SNAKE_CASE", nil, nil), - ("_1", nil, nil), - ("_one_two_three_", nil, nil), - ("camelCased", nil, nil), - ("UpperCamelCase", nil, nil), - ("BEFORE2023", nil, nil), - - // Escaped keywords - ("associatedtype", nil, nil), - ("Protocol", nil, nil), - ], - config: .mock( - options: .init(conversionStrategies: .init(enumCases: .camelCase)) - ) - ) - - let expected = """ - enum CasedEnum: String, EnumType { - case lowercase = "lowercase" - case uppercase = "UPPERCASE" - case capitalized = "Capitalized" - case snakeCase = "snake_case" - case upperSnakeCase = "UPPER_SNAKE_CASE" - case _1 = "_1" - case _oneTwoThree_ = "_one_two_three_" - case camelCased = "camelCased" - case upperCamelCase = "UpperCamelCase" - case before2023 = "BEFORE2023" - case `associatedtype` = "associatedtype" - case `protocol` = "Protocol" - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test_render_givenOption_caseConversionStrategy_default_generatesSwiftEnumValues_respectingSchemaValueCasing() throws { - // given - buildSubject( - name: "casedEnum", - values: [ - // Mixed case - ("lowercase", nil, nil), - ("UPPERCASE", nil, nil), - ("Capitalized", nil, nil), - ("snake_case", nil, nil), - ("UPPER_SNAKE_CASE", nil, nil), - ("_1", nil, nil), - ("_one_two_three_", nil, nil), - ("camelCased", nil, nil), - ("UpperCamelCase", nil, nil), - ("BEFORE2023", nil, nil), - - // Escaped keywords - ("associatedtype", nil, nil), - ("Protocol", nil, nil), - ], - config: .mock( - options: .init(conversionStrategies: .init(enumCases: .none)) - ) - ) - - let expected = """ - enum CasedEnum: String, EnumType { - case lowercase - case UPPERCASE - case Capitalized - case snake_case - case UPPER_SNAKE_CASE - case _1 - case _one_two_three_ - case camelCased - case UpperCamelCase - case BEFORE2023 - case `associatedtype` - case `Protocol` - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Deprecation Tests - - func test__render__givenOption_deprecatedInclude_warningsExclude_whenDeprecation_shouldGenerateEnumCase_withDeprecationComment() throws { - // given / when - buildSubject( - values: [ - ("ONE", nil, nil), - ("TWO", "Deprecated for tests", nil), - ("THREE", nil, nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .include, - warningsOnDeprecatedUsage: .exclude - )) - ) - - let expected = """ - enum TestEnum: String, EnumType { - case one = "ONE" - /// **Deprecated**: Deprecated for tests - case two = "TWO" - case three = "THREE" - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenOption_deprecatedInclude_warningsInclude_whenDeprecation_shouldGenerateEnumCase_withDeprecationComment() throws { - // given / when - buildSubject( - values: [ - ("ONE", nil, nil), - ("TWO", "Deprecated for tests", nil), - ("THREE", nil, nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .include, - warningsOnDeprecatedUsage: .include - )) - ) - - let expected = """ - enum TestEnum: String, EnumType { - case one = "ONE" - /// **Deprecated**: Deprecated for tests - case two = "TWO" - case three = "THREE" - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenOption_deprecatedExclude_warningsInclude_whenDeprecation_shouldNotGenerateEnumCase() throws { - // given / when - buildSubject( - values: [ - ("ONE", "Deprecated for tests", nil), - ("TWO", nil, nil), - ("THREE", "Deprecated for tests", nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .exclude, - warningsOnDeprecatedUsage: .include - )) - ) - - let expected = """ - enum TestEnum: String, EnumType { - case two = "TWO" - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenOption_deprecatedExclude_warningsExclude_whenDeprecation_shouldNotGenerateEnumCase() throws { - // given / when - buildSubject( - values: [ - ("ONE", "Deprecated for tests", nil), - ("TWO", nil, nil), - ("THREE", "Deprecated for tests", nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .exclude, - warningsOnDeprecatedUsage: .exclude - )) - ) - - let expected = """ - enum TestEnum: String, EnumType { - case two = "TWO" - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - values: [ - ("ONE", "Deprecated for tests", "Doc: One"), - ("TWO", nil, "Doc: Two"), - ("THREE", "Deprecated for tests", nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .include, - schemaDocumentation: .include, - warningsOnDeprecatedUsage: .include - )) - ) - - let expected = """ - /// \(documentation) - enum TestEnum: String, EnumType { - /// Doc: One - /// - /// **Deprecated**: Deprecated for tests - case one = "ONE" - /// Doc: Two - case two = "TWO" - /// **Deprecated**: Deprecated for tests - case three = "THREE" - } - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenSchemaDocumentation_include_warningsOnDeprecation_exclude_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - values: [ - ("ONE", "Deprecated for tests", "Doc: One"), - ("TWO", nil, "Doc: Two"), - ("THREE", "Deprecated for tests", nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .include, - schemaDocumentation: .include, - warningsOnDeprecatedUsage: .exclude - )) - ) - - let expected = """ - /// \(documentation) - enum TestEnum: String, EnumType { - /// Doc: One - /// - /// **Deprecated**: Deprecated for tests - case one = "ONE" - /// Doc: Two - case two = "TWO" - /// **Deprecated**: Deprecated for tests - case three = "THREE" - } - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - values: [ - ("ONE", "Deprecated for tests", "Doc: One"), - ("TWO", nil, "Doc: Two"), - ("THREE", "Deprecated for tests", nil) - ], - config: ApolloCodegenConfiguration.mock(options: .init( - deprecatedEnumCases: .include, - schemaDocumentation: .exclude, - warningsOnDeprecatedUsage: .exclude - )) - ) - - let expected = """ - enum TestEnum: String, EnumType { - /// **Deprecated**: Deprecated for tests - case one = "ONE" - case two = "TWO" - /// **Deprecated**: Deprecated for tests - case three = "THREE" - } - - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected)) - } - - // MARK: - Reserved Keyword Tests - - func test_render_givenReservedKeywordType_AsEscapedType() { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject(name: keyword) - - let expected = """ - enum \(keyword.firstUppercased)_Enum: String, EnumType { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift deleted file mode 100644 index cc0dbbc6c8..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift +++ /dev/null @@ -1,748 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class FragmentTemplateTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var fragment: IR.NamedFragment! - var subject: FragmentTemplate! - - override func setUp() { - super.setUp() - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Query { - allAnimals { - species - } - } - """ - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - fragment = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubjectAndFragment( - named fragmentName: String = "TestFragment", - config: ApolloCodegenConfiguration = .mock() - ) throws { - ir = try .mock(schema: schemaSDL, document: document) - let fragmentDefinition = try XCTUnwrap(ir.compilationResult[fragment: fragmentName]) - fragment = ir.build(fragment: fragmentDefinition) - subject = FragmentTemplate( - fragment: fragment, - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Fragment Definition - - func test__render__givenFragment_generatesFragmentDeclarationDefinitionAndBoilerplate() throws { - // given - let expected = - """ - struct TestFragment: TestSchema.SelectionSet, Fragment { - static var fragmentDefinition: StaticString { - #"fragment TestFragment on Query { __typename allAnimals { __typename species } }"# - } - - let __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - """ - - // when - try buildSubjectAndFragment() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - expect(String(actual.reversed())).to(equalLineByLine("\n}", ignoringExtraLines: true)) - } - - func test__render__givenLowercaseFragment_generatesTitleCaseTypeName() throws { - // given - document = """ - fragment testFragment on Query { - allAnimals { - species - } - } - """ - - let expected = - """ - struct TestFragment: TestSchema.SelectionSet, Fragment { - static var fragmentDefinition: StaticString { - #"fragment testFragment on Query { __typename allAnimals { __typename species } }"# - """ - - // when - try buildSubjectAndFragment(named: "testFragment") - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenFragmentWithUnderscoreInName_rendersDeclarationWithName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - fragment Test_Fragment on Animal { - species - } - """ - - let expected = """ - struct Test_Fragment: TestSchema.SelectionSet, Fragment { - """ - - // when - try buildSubjectAndFragment(named: "Test_Fragment") - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render_parentType__givenFragmentTypeConditionAs_Object_rendersParentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - let expected = """ - static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Animal } - """ - - // when - try buildSubjectAndFragment() - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 9, ignoringExtraLines: true)) - } - - func test__render_parentType__givenFragmentTypeConditionAs_Interface_rendersParentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - let expected = """ - static var __parentType: ApolloAPI.ParentType { TestSchema.Interfaces.Animal } - """ - - // when - try buildSubjectAndFragment() - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 9, ignoringExtraLines: true)) - } - - func test__render_parentType__givenFragmentTypeConditionAs_Union_rendersParentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Dog { - species: String! - } - - union Animal = Dog - """ - - document = """ - fragment TestFragment on Animal { - ... on Dog { - species - } - } - """ - - let expected = """ - static var __parentType: ApolloAPI.ParentType { TestSchema.Unions.Animal } - """ - - // when - try buildSubjectAndFragment() - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 9, ignoringExtraLines: true)) - } - - func test__render__givenFragmentOnRootOperationTypeWithOnlyTypenameField_generatesFragmentDefinition_withNoSelections() throws { - // given - document = """ - fragment TestFragment on Query { - __typename - } - """ - - try buildSubjectAndFragment() - - let expected = """ - struct TestFragment: TestSchema.SelectionSet, Fragment { - static var fragmentDefinition: StaticString { - #"fragment TestFragment on Query { __typename }"# - } - - let __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - - static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Query } - static var __selections: [ApolloAPI.Selection] { [ - ] } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenFragmentWithOnlyTypenameField_generatesFragmentDefinition_withTypeNameSelection() throws { - // given - document = """ - fragment TestFragment on Animal { - __typename - } - """ - - try buildSubjectAndFragment() - - let expected = """ - struct TestFragment: TestSchema.SelectionSet, Fragment { - static var fragmentDefinition: StaticString { - #"fragment TestFragment on Animal { __typename }"# - } - - let __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - - static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Animal } - static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - ] } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Access Level Tests - - func test__render__givenModuleType_swiftPackageManager_generatesFragmentDefinition_withPublicAccess() throws { - // given - try buildSubjectAndFragment(config: .mock(.swiftPackageManager)) - - let expected = """ - public struct TestFragment: TestSchema.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleType_other_generatesFragmentDefinition_withPublicAccess() throws { - // given - try buildSubjectAndFragment(config: .mock(.other)) - - let expected = """ - public struct TestFragment: TestSchema.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleType_embeddedInTarget_withInternalAccessModifier_generatesFragmentDefinition_withInternalAccess() throws { - // given - try buildSubjectAndFragment( - config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .internal)) - ) - - let expected = """ - struct TestFragment: TestSchema.SelectionSet, Fragment { - static var fragmentDefinition: StaticString { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleType_embeddedInTarget_withPublicAccessModifier_generatesFragmentDefinition_withPublicAccess() throws { - // given - try buildSubjectAndFragment( - config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .public)) - ) - - let expected = """ - struct TestFragment: TestSchema.SelectionSet, Fragment { - public static var fragmentDefinition: StaticString { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Initializer Tests - - func test__render_givenInitializerConfigIncludesNamedFragments_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - let expected = - """ - init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestFragment.self) - ] - )) - } - """ - - // when - try buildSubjectAndFragment( - config: .mock(options: .init( - selectionSetInitializers: [.namedFragments] - ))) - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_givenNamedFragment_configIncludesSpecificFragment_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - let expected = - """ - init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestFragment.self) - ] - )) - } - """ - - // when - try buildSubjectAndFragment( - config: .mock(options: .init( - selectionSetInitializers: [.fragment(named: "TestFragment")] - ))) - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_givenNamedFragment_configDoesNotIncludeNamedFragments_doesNotRenderInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - // when - try buildSubjectAndFragment( - config: .mock(options: .init( - selectionSetInitializers: [.operations] - ))) - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine("}", atLine: 16, ignoringExtraLines: true)) - } - - func test__render_givenNamedFragments_configIncludeSpecificFragmentWithOtherName_doesNotRenderInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal { - species - } - """ - - // when - try buildSubjectAndFragment( - config: .mock(options: .init( - selectionSetInitializers: [.fragment(named: "OtherFragment")] - ))) - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine("}", atLine: 16, ignoringExtraLines: true)) - } - - func test__render_givenNamedFragments_asLocalCacheMutation_configIncludeLocalCacheMutations_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - fragment TestFragment on Animal @apollo_client_ios_localCacheMutation { - species - } - """ - - let expected = - """ - init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestFragment.self) - ] - )) - } - """ - - // when - try buildSubjectAndFragment( - config: .mock(options: .init( - selectionSetInitializers: [.localCacheMutations] - ))) - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 20, ignoringExtraLines: true)) - } - - // MARK: Local Cache Mutation Tests - func test__render__givenFragment__asLocalCacheMutation_generatesFragmentDeclarationDefinitionAsMutableSelectionSetAndBoilerplate() throws { - // given - document = """ - fragment TestFragment on Query @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - struct TestFragment: TestSchema.MutableSelectionSet, Fragment { - """ - - // when - try buildSubjectAndFragment() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - expect(String(actual.reversed())).to(equalLineByLine("\n}", ignoringExtraLines: true)) - } - - func test__render__givenFragment__asLocalCacheMutation_generatesFragmentDefinitionStrippingLocalCacheMutationDirective() throws { - // given - document = """ - fragment TestFragment on Query @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - struct TestFragment: TestSchema.MutableSelectionSet, Fragment { - static var fragmentDefinition: StaticString { - #"fragment TestFragment on Query { __typename allAnimals { __typename species } }"# - } - """ - - // when - try buildSubjectAndFragment() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - expect(String(actual.reversed())).to(equalLineByLine("\n}", ignoringExtraLines: true)) - } - - func test__render__givenFragment__asLocalCacheMutation_generatesFragmentDefinitionAsMutableSelectionSet() throws { - // given - document = """ - fragment TestFragment on Query @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - var __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - - static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Query } - static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal]?.self), - ] } - - var allAnimals: [AllAnimal]? { - get { __data["allAnimals"] } - set { __data["allAnimals"] = newValue } - } - """ - - // when - try buildSubjectAndFragment() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - // MARK: Casing - - func test__casing__givenLowercasedSchemaName_generatesWithFirstUppercasedNamespace() throws { - // given - try buildSubjectAndFragment(config: .mock(schemaNamespace: "mySchema")) - - // then - let expected = """ - struct TestFragment: MySchema.SelectionSet, Fragment { - """ - - let actual = renderSubject() - - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__casing__givenUppercasedSchemaName_generatesWithUppercasedNamespace() throws { - // given - try buildSubjectAndFragment(config: .mock(schemaNamespace: "MY_SCHEMA")) - - // then - let expected = """ - struct TestFragment: MY_SCHEMA.SelectionSet, Fragment { - """ - - let actual = renderSubject() - - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__casing__givenCapitalizedSchemaName_generatesWithCapitalizedNamespace() throws { - // given - try buildSubjectAndFragment(config: .mock(schemaNamespace: "MySchema")) - - // then - let expected = """ - struct TestFragment: MySchema.SelectionSet, Fragment { - """ - - let actual = renderSubject() - - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test__render__givenFragmentReservedKeywordName_rendersEscapedName() throws { - let keywords = ["Type", "type"] - - try keywords.forEach { keyword in - // given - schemaSDL = """ - type Query { - getUser(id: String): User - } - - type User { - id: String! - name: String! - } - """ - - document = """ - fragment \(keyword) on User { - name - } - """ - - let expected = """ - struct \(keyword.firstUppercased)_Fragment: TestSchema.SelectionSet, Fragment { - """ - - // when - try buildSubjectAndFragment(named: keyword) - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/InputObjectTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/InputObjectTemplateTests.swift deleted file mode 100644 index 72c26fc43d..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/InputObjectTemplateTests.swift +++ /dev/null @@ -1,2471 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import Apollo - -class InputObjectTemplateTests: XCTestCase { - var subject: InputObjectTemplate! - - override func tearDown() { - subject = nil - super.tearDown() - } - - private func buildSubject( - name: String = "MockInput", - fields: [GraphQLInputField] = [], - documentation: String? = nil, - config: ApolloCodegenConfiguration = .mock(.swiftPackageManager) - ) { - subject = InputObjectTemplate( - graphqlInputObject: GraphQLInputObjectType.mock( - name, - fields: fields, - documentation: documentation - ), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Definition Tests - - func test__render__generatesInputObject_withInputDictVariableAndInitializer() throws { - // given - buildSubject( - name: "mockInput", - fields: [GraphQLInputField.mock("field", type: .scalar(.integer()), defaultValue: nil)] - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Access Level Tests - - func test_render_givenInputObjectWithValidAndDeprecatedFields_whenModuleType_swiftPackageManager_generatesAllWithPublicAccess() { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ), - GraphQLInputField.mock( - "fieldTwo", - type: .nonNull(.string()), - defaultValue: nil - ) - ], - config: .mock(.swiftPackageManager) - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldTwo: String - ) { - __data = InputDict([ - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - public init( - fieldOne: String, - fieldTwo: String - ) { - __data = InputDict([ - "fieldOne": fieldOne, - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - get { __data["fieldOne"] } - set { __data["fieldOne"] = newValue } - } - - public var fieldTwo: String { - get { __data["fieldTwo"] } - set { __data["fieldTwo"] = newValue } - } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test_render_givenInputObjectWithValidAndDeprecatedFields_whenModuleType_other_generatesAllWithPublicAccess() { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ), - GraphQLInputField.mock( - "fieldTwo", - type: .nonNull(.string()), - defaultValue: nil - ) - ], - config: .mock(.other) - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldTwo: String - ) { - __data = InputDict([ - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - public init( - fieldOne: String, - fieldTwo: String - ) { - __data = InputDict([ - "fieldOne": fieldOne, - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - get { __data["fieldOne"] } - set { __data["fieldOne"] = newValue } - } - - public var fieldTwo: String { - get { __data["fieldTwo"] } - set { __data["fieldTwo"] = newValue } - } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenInputObjectWithValidAndDeprecatedFields_whenModuleType_embeddedInTarget_withPublicAccessModifier_generatesAllWithPublicAccess() { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ), - GraphQLInputField.mock( - "fieldTwo", - type: .nonNull(.string()), - defaultValue: nil - ) - ], - config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .public)) - ) - - let expected = """ - struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldTwo: String - ) { - __data = InputDict([ - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - public init( - fieldOne: String, - fieldTwo: String - ) { - __data = InputDict([ - "fieldOne": fieldOne, - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - get { __data["fieldOne"] } - set { __data["fieldOne"] = newValue } - } - - public var fieldTwo: String { - get { __data["fieldTwo"] } - set { __data["fieldTwo"] = newValue } - } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenInputObjectWithValidAndDeprecatedFields_whenModuleType_embeddedInTarget_withInternalAccessModifier_generatesAllWithInternalAccess() { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ), - GraphQLInputField.mock( - "fieldTwo", - type: .nonNull(.string()), - defaultValue: nil - ) - ], - config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .internal)) - ) - - let expected = """ - struct MockInput: InputObject { - private(set) var __data: InputDict - - init(_ data: InputDict) { - __data = data - } - - init( - fieldTwo: String - ) { - __data = InputDict([ - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - init( - fieldOne: String, - fieldTwo: String - ) { - __data = InputDict([ - "fieldOne": fieldOne, - "fieldTwo": fieldTwo - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - var fieldOne: String { - get { __data["fieldOne"] } - set { __data["fieldOne"] = newValue } - } - - var fieldTwo: String { - get { __data["fieldTwo"] } - set { __data["fieldTwo"] = newValue } - } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Casing Tests - - func test__render__givenLowercasedInputObjectField__generatesCorrectlyCasedSwiftDefinition() throws { - // given - buildSubject( - name: "mockInput", - fields: [GraphQLInputField.mock("field", type: .scalar(.integer()), defaultValue: nil)] - ) - - let expected = "public struct MockInput: InputObject {" - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenUppercasedInputObjectField__generatesCorrectlyCasedSwiftDefinition() throws { - // given - buildSubject( - name: "MOCKInput", - fields: [GraphQLInputField.mock("field", type: .scalar(.integer()), defaultValue: nil)] - ) - - let expected = "public struct MOCKInput: InputObject {" - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenMixedCaseInputObjectField__generatesCorrectlyCasedSwiftDefinition() throws { - // given - buildSubject( - name: "mOcK_Input", - fields: [GraphQLInputField.mock("field", type: .scalar(.integer()), defaultValue: nil)] - ) - - let expected = "public struct MOcK_Input: InputObject {" - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Field Type Tests - - func test__render__givenSingleFieldType__generatesCorrectParameterAndInitializer_withClosingBrace() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("field", type: .scalar(.string()), defaultValue: nil) - ]) - - let expected = """ - public init( - field: GraphQLNullable = nil - ) { - __data = InputDict([ - "field": field - ]) - } - - public var field: GraphQLNullable { - get { __data["field"] } - set { __data["field"] = newValue } - } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: false)) - } - - func test__render__givenSingleFieldTypeInMixedCase__generatesParameterAndInitializerWithCorrectCasing() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("Field", type: .scalar(.string()), defaultValue: nil) - ]) - - let expected = """ - public init( - field: GraphQLNullable = nil - ) { - __data = InputDict([ - "Field": field - ]) - } - - public var field: GraphQLNullable { - get { __data["Field"] } - set { __data["Field"] = newValue } - } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: false)) - } - - func test__render__givenSingleFieldTypeInAllUppercase__generatesParameterAndInitializerWithCorrectCasing() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("FIELDNAME", type: .scalar(.string()), defaultValue: nil) - ]) - - let expected = """ - public init( - fieldname: GraphQLNullable = nil - ) { - __data = InputDict([ - "FIELDNAME": fieldname - ]) - } - - public var fieldname: GraphQLNullable { - get { __data["FIELDNAME"] } - set { __data["FIELDNAME"] = newValue } - } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: false)) - } - - func test__render__givenAllPossibleSchemaInputFieldTypes__generatesCorrectParametersAndInitializer() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock( - "stringField", - type: .scalar(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "intField", - type: .scalar(.integer()), - defaultValue: nil - ), - GraphQLInputField.mock( - "boolField", - type: .scalar(.boolean()), - defaultValue: nil - ), - GraphQLInputField.mock( - "floatField", - type: .scalar(.float()), - defaultValue: nil - ), - GraphQLInputField.mock( - "customScalarField", - type: .scalar(.mock(name: "CustomScalar")), - defaultValue: nil - ), - GraphQLInputField.mock( - "lowercaseCustomScalarField", - type: .scalar(.mock(name: "lowercaseCustomScalar")), - defaultValue: nil - ), - GraphQLInputField.mock( - "enumField", - type: .enum(.mock(name: "EnumType")), - defaultValue: nil - ), - GraphQLInputField.mock( - "lowercaseEnumField", - type: .enum(.mock(name: "lowercaseEnumType")), - defaultValue: nil - ), - GraphQLInputField.mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ), - GraphQLInputField.mock( - "lowercaseInputField", - type: .inputObject(.mock( - "lowercaseInnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ), - GraphQLInputField.mock( - "listField", - type: .list(.scalar(.string())), - defaultValue: nil - ) - ], config: .mock(.swiftPackageManager, schemaNamespace: "TestSchema")) - - let expected = """ - public init( - stringField: GraphQLNullable = nil, - intField: GraphQLNullable = nil, - boolField: GraphQLNullable = nil, - floatField: GraphQLNullable = nil, - customScalarField: GraphQLNullable = nil, - lowercaseCustomScalarField: GraphQLNullable = nil, - enumField: GraphQLNullable> = nil, - lowercaseEnumField: GraphQLNullable> = nil, - inputField: GraphQLNullable = nil, - lowercaseInputField: GraphQLNullable = nil, - listField: GraphQLNullable<[String?]> = nil - ) { - __data = InputDict([ - "stringField": stringField, - "intField": intField, - "boolField": boolField, - "floatField": floatField, - "customScalarField": customScalarField, - "lowercaseCustomScalarField": lowercaseCustomScalarField, - "enumField": enumField, - "lowercaseEnumField": lowercaseEnumField, - "inputField": inputField, - "lowercaseInputField": lowercaseInputField, - "listField": listField - ]) - } - - public var stringField: GraphQLNullable { - get { __data["stringField"] } - set { __data["stringField"] = newValue } - } - - public var intField: GraphQLNullable { - get { __data["intField"] } - set { __data["intField"] = newValue } - } - - public var boolField: GraphQLNullable { - get { __data["boolField"] } - set { __data["boolField"] = newValue } - } - - public var floatField: GraphQLNullable { - get { __data["floatField"] } - set { __data["floatField"] = newValue } - } - - public var customScalarField: GraphQLNullable { - get { __data["customScalarField"] } - set { __data["customScalarField"] = newValue } - } - - public var lowercaseCustomScalarField: GraphQLNullable { - get { __data["lowercaseCustomScalarField"] } - set { __data["lowercaseCustomScalarField"] = newValue } - } - - public var enumField: GraphQLNullable> { - get { __data["enumField"] } - set { __data["enumField"] = newValue } - } - - public var lowercaseEnumField: GraphQLNullable> { - get { __data["lowercaseEnumField"] } - set { __data["lowercaseEnumField"] = newValue } - } - - public var inputField: GraphQLNullable { - get { __data["inputField"] } - set { __data["inputField"] = newValue } - } - - public var lowercaseInputField: GraphQLNullable { - get { __data["lowercaseInputField"] } - set { __data["lowercaseInputField"] = newValue } - } - - public var listField: GraphQLNullable<[String?]> { - get { __data["listField"] } - set { __data["listField"] = newValue } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__givenSchemaModuleInputFieldTypes__generatesCorrectParametersAndInitializer_withNamespaceWhenRequired() throws { - // given - let fields: [GraphQLInputField] = [ - GraphQLInputField.mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: nil - ), - GraphQLInputField.mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ) - ] - - let expectedNoNamespace = """ - public init( - enumField: GraphQLNullable> = nil, - inputField: GraphQLNullable = nil - ) { - __data = InputDict([ - "enumField": enumField, - "inputField": inputField - ]) - } - - public var enumField: GraphQLNullable> { - get { __data["enumField"] } - set { __data["enumField"] = newValue } - } - - public var inputField: GraphQLNullable { - get { __data["inputField"] } - set { __data["inputField"] = newValue } - } - """ - - let expectedWithNamespace = """ - public init( - enumField: GraphQLNullable> = nil, - inputField: GraphQLNullable = nil - ) { - __data = InputDict([ - "enumField": enumField, - "inputField": inputField - ]) - } - - public var enumField: GraphQLNullable> { - get { __data["enumField"] } - set { __data["enumField"] = newValue } - } - - public var inputField: GraphQLNullable { - get { __data["inputField"] } - set { __data["inputField"] = newValue } - } - """ - - let tests: [(config: ApolloCodegenConfiguration.FileOutput, expected: String)] = [ - (.mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil)), expectedWithNamespace), - (.mock(moduleType: .swiftPackageManager, operations: .absolute(path: "custom")), expectedWithNamespace), - (.mock(moduleType: .swiftPackageManager, operations: .inSchemaModule), expectedNoNamespace), - (.mock(moduleType: .other, operations: .relative(subpath: nil)), expectedWithNamespace), - (.mock(moduleType: .other, operations: .absolute(path: "custom")), expectedWithNamespace), - (.mock(moduleType: .other, operations: .inSchemaModule), expectedNoNamespace), - (.mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .relative(subpath: nil)), expectedWithNamespace), - (.mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .absolute(path: "custom")), expectedWithNamespace), - (.mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .inSchemaModule), expectedNoNamespace) - ] - - for test in tests { - // given - buildSubject(fields: fields, config: .mock(output: test.config)) - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(test.expected, atLine: 8, ignoringExtraLines: true)) - } - } - - // MARK: Nullable Field Tests - - func test__render__given_NullableField_NoDefault__generates_NullableParameter_InitializerNilDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nullable", type: .scalar(.integer()), defaultValue: nil) - ]) - - let expected = """ - public init( - nullable: GraphQLNullable = nil - ) { - __data = InputDict([ - "nullable": nullable - ]) - } - - public var nullable: GraphQLNullable { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NullableField_WithDefault__generates_NullableParameter_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nullableWithDefault", type: .scalar(.integer()), defaultValue: .int(3)) - ]) - - let expected = """ - public init( - nullableWithDefault: GraphQLNullable - ) { - __data = InputDict([ - "nullableWithDefault": nullableWithDefault - ]) - } - - public var nullableWithDefault: GraphQLNullable { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NonNullableField_NoDefault__generates_NonNullableNonOptionalParameter_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nonNullable", type: .nonNull(.scalar(.integer())), defaultValue: nil) - ]) - - let expected = """ - public init( - nonNullable: Int - ) { - __data = InputDict([ - "nonNullable": nonNullable - ]) - } - - public var nonNullable: Int { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NonNullableField_WithDefault__generates_OptionalParameter_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nonNullableWithDefault", type: .nonNull(.scalar(.integer())), defaultValue: .int(3)) - ]) - - let expected = """ - public init( - nonNullableWithDefault: Int? - ) { - __data = InputDict([ - "nonNullableWithDefault": nonNullableWithDefault - ]) - } - - public var nonNullableWithDefault: Int? { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NullableList_NullableItem_NoDefault__generates_NullableParameter_OptionalItem_InitializerNilDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nullableListNullableItem", type: .list(.scalar(.string())), defaultValue: nil) - ]) - - let expected = """ - public init( - nullableListNullableItem: GraphQLNullable<[String?]> = nil - ) { - __data = InputDict([ - "nullableListNullableItem": nullableListNullableItem - ]) - } - - public var nullableListNullableItem: GraphQLNullable<[String?]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NullableList_NullableItem_WithDefault__generates_NullableParameter_OptionalItem_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nullableListNullableItemWithDefault", - type: .list(.scalar(.string())), - defaultValue: .list([.string("val")])) - ]) - - let expected = """ - public init( - nullableListNullableItemWithDefault: GraphQLNullable<[String?]> - ) { - __data = InputDict([ - "nullableListNullableItemWithDefault": nullableListNullableItemWithDefault - ]) - } - - public var nullableListNullableItemWithDefault: GraphQLNullable<[String?]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - - func test__render__given_NullableList_NonNullableItem_NoDefault__generates_NullableParameter_NonOptionalItem_InitializerNilDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nullableListNonNullableItem", type: .list(.nonNull(.scalar(.string()))), defaultValue: nil) - ]) - - let expected = """ - public init( - nullableListNonNullableItem: GraphQLNullable<[String]> = nil - ) { - __data = InputDict([ - "nullableListNonNullableItem": nullableListNonNullableItem - ]) - } - - public var nullableListNonNullableItem: GraphQLNullable<[String]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NullableList_NonNullableItem_WithDefault__generates_NullableParameter_NonOptionalItem_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nullableListNonNullableItemWithDefault", - type: .list(.nonNull(.scalar(.string()))), - defaultValue: .list([.string("val")])) - ]) - - let expected = """ - public init( - nullableListNonNullableItemWithDefault: GraphQLNullable<[String]> - ) { - __data = InputDict([ - "nullableListNonNullableItemWithDefault": nullableListNonNullableItemWithDefault - ]) - } - - public var nullableListNonNullableItemWithDefault: GraphQLNullable<[String]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NonNullableList_NullableItem_NoDefault__generates_NonNullableNonOptionalParameter_OptionalItem_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nonNullableListNullableItem", type: .nonNull(.list(.scalar(.string()))), defaultValue: nil) - ]) - - let expected = """ - public init( - nonNullableListNullableItem: [String?] - ) { - __data = InputDict([ - "nonNullableListNullableItem": nonNullableListNullableItem - ]) - } - - public var nonNullableListNullableItem: [String?] { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NonNullableList_NullableItem_WithDefault__generates_OptionalParameter_OptionalItem_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nonNullableListNullableItemWithDefault", - type: .nonNull(.list(.scalar(.string()))), - defaultValue: .list([.string("val")])) - ]) - - let expected = """ - public init( - nonNullableListNullableItemWithDefault: [String?]? - ) { - __data = InputDict([ - "nonNullableListNullableItemWithDefault": nonNullableListNullableItemWithDefault - ]) - } - - public var nonNullableListNullableItemWithDefault: [String?]? { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NonNullableList_NonNullableItem_NoDefault__generates_NonNullableNonOptionalParameter_NonOptionalItem_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nonNullableListNonNullableItem", type: .nonNull(.list(.nonNull(.scalar(.string())))), defaultValue: nil) - ]) - - let expected = """ - public init( - nonNullableListNonNullableItem: [String] - ) { - __data = InputDict([ - "nonNullableListNonNullableItem": nonNullableListNonNullableItem - ]) - } - - public var nonNullableListNonNullableItem: [String] { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NonNullableList_NonNullableItem_WithDefault__generates_OptionalParameter_NonOptionalItem_NoInitializerDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock("nonNullableListNonNullableItemWithDefault", - type: .nonNull(.list(.nonNull(.scalar(.string())))), - defaultValue: .list([.string("val")])) - ]) - - let expected = """ - public init( - nonNullableListNonNullableItemWithDefault: [String]? - ) { - __data = InputDict([ - "nonNullableListNonNullableItemWithDefault": nonNullableListNonNullableItemWithDefault - ]) - } - - public var nonNullableListNonNullableItemWithDefault: [String]? { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__given_NullableListOfNullableEnum_NoDefault__generates_NullableParameter_OptionalItem_InitializerNilDefault() throws { - // given - buildSubject(fields: [ - GraphQLInputField.mock( - "nullableListNullableItem", - type: .list(.enum(.mock(name: "EnumValue"))), - defaultValue: nil) - ]) - - let expected = """ - public init( - nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> = nil - ) { - __data = InputDict([ - "nullableListNullableItem": nullableListNullableItem - ]) - } - - public var nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - fields: [ - GraphQLInputField.mock("fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - documentation: "Field Documentation!") - ], - documentation: documentation, - config: .mock(.swiftPackageManager, options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - /// Field Documentation! - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - fields: [ - GraphQLInputField.mock("fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - documentation: "Field Documentation!") - ], - documentation: documentation, - config: .mock(.swiftPackageManager, options: .init(schemaDocumentation: .exclude)) - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Deprecation Tests - - func test__render__givenDeprecatedField_includeDeprecationWarnings_shouldGenerateWarning() throws { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ) - ], - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include, warningsOnDeprecatedUsage: .include) - ) - ) - - let expected = """ - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__givenOnlyDeprecatedFields_includeDeprecationWarnings_shouldGenerateWarning_withoutValidInitializer() throws { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ) - ], - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include,warningsOnDeprecatedUsage: .include) - ) - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenDeprecatedField_excludeDeprecationWarnings_shouldNotGenerateWarning() throws { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ) - ], - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include,warningsOnDeprecatedUsage: .exclude) - ) - ) - - let expected = """ - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render__givenDeprecatedField_andDocumentation_includeDeprecationWarnings_shouldGenerateWarning_afterDocumentation() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - documentation: "Field Documentation!", - deprecationReason: "Not used anymore!" - ) - ], - documentation: documentation, - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include,warningsOnDeprecatedUsage: .include) - ) - ) - - let expected = """ - /// This is some great documentation! - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - @available(*, deprecated, message: "Argument 'fieldOne' is deprecated.") - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - /// Field Documentation! - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenDeprecatedField_andDocumentation_excludeDeprecationWarnings_shouldNotGenerateWarning_afterDocumentation() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - documentation: "Field Documentation!") - ], - documentation: documentation, - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include,warningsOnDeprecatedUsage: .exclude) - ) - ) - - let expected = """ - /// This is some great documentation! - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldOne: String - ) { - __data = InputDict([ - "fieldOne": fieldOne - ]) - } - - /// Field Documentation! - public var fieldOne: String { - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenDeprecatedAndValidFields_includeDeprecationWarnings_shouldGenerateWarnings_withValidInitializer() throws { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ), - GraphQLInputField.mock( - "fieldTwo", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "fieldThree", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "fieldFour", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Stop using this field!" - ) - ], - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include,warningsOnDeprecatedUsage: .include) - ) - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldTwo: String, - fieldThree: String - ) { - __data = InputDict([ - "fieldTwo": fieldTwo, - "fieldThree": fieldThree - ]) - } - - @available(*, deprecated, message: "Arguments 'fieldOne, fieldFour' are deprecated.") - public init( - fieldOne: String, - fieldTwo: String, - fieldThree: String, - fieldFour: String - ) { - __data = InputDict([ - "fieldOne": fieldOne, - "fieldTwo": fieldTwo, - "fieldThree": fieldThree, - "fieldFour": fieldFour - ]) - } - - @available(*, deprecated, message: "Not used anymore!") - public var fieldOne: String { - get { __data["fieldOne"] } - set { __data["fieldOne"] = newValue } - } - - public var fieldTwo: String { - get { __data["fieldTwo"] } - set { __data["fieldTwo"] = newValue } - } - - public var fieldThree: String { - get { __data["fieldThree"] } - set { __data["fieldThree"] = newValue } - } - - @available(*, deprecated, message: "Stop using this field!") - public var fieldFour: String { - get { __data["fieldFour"] } - set { __data["fieldFour"] = newValue } - } - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenDeprecatedAndValidFields_excludeDeprecationWarnings_shouldNotGenerateWarning_afterDocumentation_withOnlyOneInitializer() throws { - // given - buildSubject( - fields: [ - GraphQLInputField.mock( - "fieldOne", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Not used anymore!" - ), - GraphQLInputField.mock( - "fieldTwo", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "fieldThree", - type: .nonNull(.string()), - defaultValue: nil, - deprecationReason: "Stop using this field!" - ) - ], - config: .mock( - .swiftPackageManager, - options: .init(schemaDocumentation: .include,warningsOnDeprecatedUsage: .exclude) - ) - ) - - let expected = """ - public struct MockInput: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - - public init( - fieldOne: String, - fieldTwo: String, - fieldThree: String - ) { - __data = InputDict([ - "fieldOne": fieldOne, - "fieldTwo": fieldTwo, - "fieldThree": fieldThree - ]) - } - - public var fieldOne: String { - get { __data["fieldOne"] } - set { __data["fieldOne"] = newValue } - } - - public var fieldTwo: String { - get { __data["fieldTwo"] } - set { __data["fieldTwo"] = newValue } - } - - public var fieldThree: String { - get { __data["fieldThree"] } - set { __data["fieldThree"] = newValue } - } - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Reserved Keywords + Special Names - - func test__render__givenFieldsUsingReservedNames__generatesPropertiesAndInitializerWithEscaping() throws { - // given - let fields = [ - GraphQLInputField.mock( - "associatedtype", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "class", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "deinit", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "enum", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "extension", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "fileprivate", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "func", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "import", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "init", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "inout", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "internal", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "let", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "operator", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "private", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "precedencegroup", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "protocol", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "public", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "rethrows", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "static", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "struct", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "subscript", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "typealias", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "var", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "break", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "case", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "catch", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "continue", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "default", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "defer", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "do", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "else", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "fallthrough", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "for", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "guard", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "if", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "in", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "repeat", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "return", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "throw", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "switch", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "where", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "while", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "as", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "false", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "is", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "nil", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "self", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "super", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "throws", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "true", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "try", - type: .nonNull(.string()), - defaultValue: nil - ), - GraphQLInputField.mock( - "_", - type: .nonNull(.string()), - defaultValue: nil - ), - ] - - buildSubject( - fields: fields, - config: .mock(.swiftPackageManager, schemaNamespace: "TestSchema") - ) - - let expected = """ - public init( - `associatedtype`: String, - `class`: String, - `deinit`: String, - `enum`: String, - `extension`: String, - `fileprivate`: String, - `func`: String, - `import`: String, - `init`: String, - `inout`: String, - `internal`: String, - `let`: String, - `operator`: String, - `private`: String, - `precedencegroup`: String, - `protocol`: String, - `public`: String, - `rethrows`: String, - `static`: String, - `struct`: String, - `subscript`: String, - `typealias`: String, - `var`: String, - `break`: String, - `case`: String, - `catch`: String, - `continue`: String, - `default`: String, - `defer`: String, - `do`: String, - `else`: String, - `fallthrough`: String, - `for`: String, - `guard`: String, - `if`: String, - `in`: String, - `repeat`: String, - `return`: String, - `throw`: String, - `switch`: String, - `where`: String, - `while`: String, - `as`: String, - `false`: String, - `is`: String, - `nil`: String, - `self`: String, - `super`: String, - `throws`: String, - `true`: String, - `try`: String, - `_`: String - ) { - __data = InputDict([ - "associatedtype": `associatedtype`, - "class": `class`, - "deinit": `deinit`, - "enum": `enum`, - "extension": `extension`, - "fileprivate": `fileprivate`, - "func": `func`, - "import": `import`, - "init": `init`, - "inout": `inout`, - "internal": `internal`, - "let": `let`, - "operator": `operator`, - "private": `private`, - "precedencegroup": `precedencegroup`, - "protocol": `protocol`, - "public": `public`, - "rethrows": `rethrows`, - "static": `static`, - "struct": `struct`, - "subscript": `subscript`, - "typealias": `typealias`, - "var": `var`, - "break": `break`, - "case": `case`, - "catch": `catch`, - "continue": `continue`, - "default": `default`, - "defer": `defer`, - "do": `do`, - "else": `else`, - "fallthrough": `fallthrough`, - "for": `for`, - "guard": `guard`, - "if": `if`, - "in": `in`, - "repeat": `repeat`, - "return": `return`, - "throw": `throw`, - "switch": `switch`, - "where": `where`, - "while": `while`, - "as": `as`, - "false": `false`, - "is": `is`, - "nil": `nil`, - "self": `self`, - "super": `super`, - "throws": `throws`, - "true": `true`, - "try": `try`, - "_": `_` - ]) - } - - public var `associatedtype`: String { - get { __data["associatedtype"] } - set { __data["associatedtype"] = newValue } - } - - public var `class`: String { - get { __data["class"] } - set { __data["class"] = newValue } - } - - public var `deinit`: String { - get { __data["deinit"] } - set { __data["deinit"] = newValue } - } - - public var `enum`: String { - get { __data["enum"] } - set { __data["enum"] = newValue } - } - - public var `extension`: String { - get { __data["extension"] } - set { __data["extension"] = newValue } - } - - public var `fileprivate`: String { - get { __data["fileprivate"] } - set { __data["fileprivate"] = newValue } - } - - public var `func`: String { - get { __data["func"] } - set { __data["func"] = newValue } - } - - public var `import`: String { - get { __data["import"] } - set { __data["import"] = newValue } - } - - public var `init`: String { - get { __data["init"] } - set { __data["init"] = newValue } - } - - public var `inout`: String { - get { __data["inout"] } - set { __data["inout"] = newValue } - } - - public var `internal`: String { - get { __data["internal"] } - set { __data["internal"] = newValue } - } - - public var `let`: String { - get { __data["let"] } - set { __data["let"] = newValue } - } - - public var `operator`: String { - get { __data["operator"] } - set { __data["operator"] = newValue } - } - - public var `private`: String { - get { __data["private"] } - set { __data["private"] = newValue } - } - - public var `precedencegroup`: String { - get { __data["precedencegroup"] } - set { __data["precedencegroup"] = newValue } - } - - public var `protocol`: String { - get { __data["protocol"] } - set { __data["protocol"] = newValue } - } - - public var `public`: String { - get { __data["public"] } - set { __data["public"] = newValue } - } - - public var `rethrows`: String { - get { __data["rethrows"] } - set { __data["rethrows"] = newValue } - } - - public var `static`: String { - get { __data["static"] } - set { __data["static"] = newValue } - } - - public var `struct`: String { - get { __data["struct"] } - set { __data["struct"] = newValue } - } - - public var `subscript`: String { - get { __data["subscript"] } - set { __data["subscript"] = newValue } - } - - public var `typealias`: String { - get { __data["typealias"] } - set { __data["typealias"] = newValue } - } - - public var `var`: String { - get { __data["var"] } - set { __data["var"] = newValue } - } - - public var `break`: String { - get { __data["break"] } - set { __data["break"] = newValue } - } - - public var `case`: String { - get { __data["case"] } - set { __data["case"] = newValue } - } - - public var `catch`: String { - get { __data["catch"] } - set { __data["catch"] = newValue } - } - - public var `continue`: String { - get { __data["continue"] } - set { __data["continue"] = newValue } - } - - public var `default`: String { - get { __data["default"] } - set { __data["default"] = newValue } - } - - public var `defer`: String { - get { __data["defer"] } - set { __data["defer"] = newValue } - } - - public var `do`: String { - get { __data["do"] } - set { __data["do"] = newValue } - } - - public var `else`: String { - get { __data["else"] } - set { __data["else"] = newValue } - } - - public var `fallthrough`: String { - get { __data["fallthrough"] } - set { __data["fallthrough"] = newValue } - } - - public var `for`: String { - get { __data["for"] } - set { __data["for"] = newValue } - } - - public var `guard`: String { - get { __data["guard"] } - set { __data["guard"] = newValue } - } - - public var `if`: String { - get { __data["if"] } - set { __data["if"] = newValue } - } - - public var `in`: String { - get { __data["in"] } - set { __data["in"] = newValue } - } - - public var `repeat`: String { - get { __data["repeat"] } - set { __data["repeat"] = newValue } - } - - public var `return`: String { - get { __data["return"] } - set { __data["return"] = newValue } - } - - public var `throw`: String { - get { __data["throw"] } - set { __data["throw"] = newValue } - } - - public var `switch`: String { - get { __data["switch"] } - set { __data["switch"] = newValue } - } - - public var `where`: String { - get { __data["where"] } - set { __data["where"] = newValue } - } - - public var `while`: String { - get { __data["while"] } - set { __data["while"] = newValue } - } - - public var `as`: String { - get { __data["as"] } - set { __data["as"] = newValue } - } - - public var `false`: String { - get { __data["false"] } - set { __data["false"] = newValue } - } - - public var `is`: String { - get { __data["is"] } - set { __data["is"] = newValue } - } - - public var `nil`: String { - get { __data["nil"] } - set { __data["nil"] = newValue } - } - - public var `self`: String { - get { __data["self"] } - set { __data["self"] = newValue } - } - - public var `super`: String { - get { __data["super"] } - set { __data["super"] = newValue } - } - - public var `throws`: String { - get { __data["throws"] } - set { __data["throws"] = newValue } - } - - public var `true`: String { - get { __data["true"] } - set { __data["true"] = newValue } - } - - public var `try`: String { - get { __data["try"] } - set { __data["try"] = newValue } - } - - public var `_`: String { - get { __data["_"] } - set { __data["_"] = newValue } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: Casing Tests - - func test__casing__givenSchemaNameLowercased_nonListField_generatesWithFirstUppercasedNamespace() throws { - // given - let fields: [GraphQLInputField] = [ - GraphQLInputField.mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: nil - ), - GraphQLInputField.mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ) - ] - - buildSubject( - fields: fields, - config: .mock(schemaNamespace: "testschema", output: .mock( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil))) - ) - - let expected = """ - public init( - enumField: GraphQLNullable> = nil, - inputField: GraphQLNullable = nil - ) { - __data = InputDict([ - "enumField": enumField, - "inputField": inputField - ]) - } - - public var enumField: GraphQLNullable> { - get { __data["enumField"] } - set { __data["enumField"] = newValue } - } - - public var inputField: GraphQLNullable { - get { __data["inputField"] } - set { __data["inputField"] = newValue } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__casing__givenUppercasedSchemaName_nonListField_generatesWithUppercasedNamespace() throws { - // given - let fields: [GraphQLInputField] = [ - GraphQLInputField.mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: nil - ), - GraphQLInputField.mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ) - ] - - buildSubject( - fields: fields, - config: .mock(schemaNamespace: "TESTSCHEMA", output: .mock( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil))) - ) - - let expected = """ - public init( - enumField: GraphQLNullable> = nil, - inputField: GraphQLNullable = nil - ) { - __data = InputDict([ - "enumField": enumField, - "inputField": inputField - ]) - } - - public var enumField: GraphQLNullable> { - get { __data["enumField"] } - set { __data["enumField"] = newValue } - } - - public var inputField: GraphQLNullable { - get { __data["inputField"] } - set { __data["inputField"] = newValue } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__casing__givenCapitalizedSchemaName_nonListField_generatesWithCapitalizedNamespace() throws { - // given - let fields: [GraphQLInputField] = [ - GraphQLInputField.mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: nil - ), - GraphQLInputField.mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ) - ] - - buildSubject( - fields: fields, - config: .mock(schemaNamespace: "TestSchema", output: .mock( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil))) - ) - - let expected = """ - public init( - enumField: GraphQLNullable> = nil, - inputField: GraphQLNullable = nil - ) { - __data = InputDict([ - "enumField": enumField, - "inputField": inputField - ]) - } - - public var enumField: GraphQLNullable> { - get { __data["enumField"] } - set { __data["enumField"] = newValue } - } - - public var inputField: GraphQLNullable { - get { __data["inputField"] } - set { __data["inputField"] = newValue } - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__casing__givenLowercasedSchemaName_listField_generatesWithFirstUppercasedNamespace() throws { - // given - buildSubject( - fields: [GraphQLInputField.mock( - "nullableListNullableItem", - type: .list(.enum(.mock(name: "EnumValue"))), - defaultValue: nil)], - config: .mock( - schemaNamespace: "testschema", - output: .mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil)) - ) - ) - - let expected = """ - public init( - nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> = nil - ) { - __data = InputDict([ - "nullableListNullableItem": nullableListNullableItem - ]) - } - - public var nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__casing__givenUppercasedSchemaName_listField_generatesWithUppercasedNamespace() throws { - // given - buildSubject( - fields: [GraphQLInputField.mock( - "nullableListNullableItem", - type: .list(.enum(.mock(name: "EnumValue"))), - defaultValue: nil)], - config: .mock( - schemaNamespace: "TESTSCHEMA", - output: .mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil)) - ) - ) - - let expected = """ - public init( - nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> = nil - ) { - __data = InputDict([ - "nullableListNullableItem": nullableListNullableItem - ]) - } - - public var nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__casing__givenCapitalizedSchemaName_listField_generatesWithCapitalizedNamespace() throws { - // given - buildSubject( - fields: [GraphQLInputField.mock( - "nullableListNullableItem", - type: .list(.enum(.mock(name: "EnumValue"))), - defaultValue: nil)], - config: .mock( - schemaNamespace: "TestSchema", - output: .mock(moduleType:.swiftPackageManager ,operations: .relative(subpath: nil)) - ) - ) - - let expected = """ - public init( - nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> = nil - ) { - __data = InputDict([ - "nullableListNullableItem": nullableListNullableItem - ]) - } - - public var nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]> { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test__render__generatesInputObject_usingReservedKeyword_asEscapedType() throws { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject( - name: keyword, - fields: [GraphQLInputField.mock("field", type: .scalar(.integer()), defaultValue: nil)] - ) - - let expected = """ - public struct \(keyword.firstUppercased)_InputObject: InputObject { - public private(set) var __data: InputDict - - public init(_ data: InputDict) { - __data = data - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/InterfaceTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/InterfaceTemplateTests.swift deleted file mode 100644 index f5483ae635..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/InterfaceTemplateTests.swift +++ /dev/null @@ -1,117 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class InterfaceTemplateTests: XCTestCase { - var subject: InterfaceTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - name: String = "Dog", - documentation: String? = nil, - config: ApolloCodegenConfiguration = .mock() - ) { - subject = InterfaceTemplate( - graphqlInterface: GraphQLInterfaceType.mock( - name, - fields: [:], - interfaces: [], - documentation: documentation - ), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Casing Tests - - func test_render_givenSchemaInterface_generatesSwiftClassDefinitionCorrectlyCased() throws { - // given - buildSubject(name: "aDog") - - let expected = """ - static let ADog = Interface(name: "aDog") - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - static let Dog = Interface(name: "Dog") - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .exclude)) - ) - - let expected = """ - static let Dog = Interface(name: "Dog") - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test_render_givenSchemaInterfaceUsingReservedKeyword_generatesWithEscapedType() throws { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject(name: keyword) - - let expected = """ - static let \(keyword.firstUppercased)_Interface = Interface(name: "\(keyword)") - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/LegacyAPQOperationManifestTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/LegacyAPQOperationManifestTemplateTests.swift deleted file mode 100644 index 9acd0940a6..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/LegacyAPQOperationManifestTemplateTests.swift +++ /dev/null @@ -1,150 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class LegacyAPQOperationManifestTemplateTests: XCTestCase { - var subject: LegacyAPQOperationManifestTemplate! - - override func setUp() { - super.setUp() - - subject = LegacyAPQOperationManifestTemplate() - } - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: Render tests - - func test__render__givenSingleOperation_shouldOutputJSONFormat() throws { - // given - let operation = IR.Operation.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - ) - - let expected = """ - { - "8ed9fcbb8ef3c853ad0ecdc920eb8216608bd7c3b32258744e9289ec0372eb30" : { - "name": "TestQuery", - "source": "query TestQuery { test }" - } - } - """ - - let operations = [operation].map(OperationManifestItem.init) - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equal(expected)) - } - - func test__render__givenMultipleOperations_shouldOutputJSONFormat() throws { - // given - let operations = [ - IR.Operation.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - ), - IR.Operation.mock( - name: "TestMutation", - type: .mutation, - source: """ - mutation TestMutation { - update { - result - } - } - """ - ), - IR.Operation.mock( - name: "TestSubscription", - type: .subscription, - source: """ - subscription TestSubscription { - watched - } - """ - ) - ].map(OperationManifestItem.init) - - let expected = """ - { - "8ed9fcbb8ef3c853ad0ecdc920eb8216608bd7c3b32258744e9289ec0372eb30" : { - "name": "TestQuery", - "source": "query TestQuery { test }" - }, - "551253009bea9350463d15e24660e8a935abc858cd161623234fb9523b0c0717" : { - "name": "TestMutation", - "source": "mutation TestMutation { update { result } }" - }, - "9b56a2829263b4d81b4eb9865470a6971c8e40e126e2ff92db51f15d0a4cb7ba" : { - "name": "TestSubscription", - "source": "subscription TestSubscription { watched }" - } - } - """ - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equal(expected)) - } - - func test__render__givenReferencedFragments_shouldOutputJSONFormat() throws { - // given - let operations = [ - IR.Operation.mock( - name: "Friends", - type: .query, - source: """ - query Friends { - friends { - ...Name - } - } - """, - referencedFragments: [ - .mock( - "Name", - type: .mock(), - source: """ - fragment Name on Friend { - name - } - """ - ) - ] - ) - ].map(OperationManifestItem.init) - - let expected = #""" - { - "efc7785ac9768b2be96e061911b97c9c898df41561dda36d9435e94994910f67" : { - "name": "Friends", - "source": "query Friends { friends { ...Name } }\nfragment Name on Friend { name }" - } - } - """# - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equal(expected)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/LocalCacheMutationDefinitionTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/LocalCacheMutationDefinitionTemplateTests.swift deleted file mode 100644 index 904c93b4c4..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/LocalCacheMutationDefinitionTemplateTests.swift +++ /dev/null @@ -1,771 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class LocalCacheMutationDefinitionTemplateTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: IR.Operation! - var config: ApolloCodegenConfiguration! - var subject: LocalCacheMutationDefinitionTemplate! - - override func setUp() { - super.setUp() - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - config = .mock() - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - operation = nil - config = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubjectAndOperation(named operationName: String = "TestOperation") throws { - ir = try .mock(schema: schemaSDL, document: document) - let operationDefinition = try XCTUnwrap(ir.compilationResult[operation: operationName]) - operation = ir.build(operation: operationDefinition) - subject = LocalCacheMutationDefinitionTemplate( - operation: operation, - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: - Access Level Tests - - func test__generate__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsInSchemaModule_generatesWithPublicAccess() throws { - // given - let expected = - """ - public class TestOperationLocalCacheMutation: LocalCacheMutation { - public static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .swiftPackageManager, - operations: .inSchemaModule - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_whenModuleTypeIsEmbeddedInTargetWithPublicAccessModifier_andOperationsInSchemaModule_generatesWithPublicAccess() throws { - // given - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - public static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .public), - operations: .inSchemaModule - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_whenModuleTypeIsEmbeddedInTargetWithInternalAccessModifier_andOperationsInSchemaModule_generatesWithInternalAccess() throws { - // given - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .internal), - operations: .inSchemaModule - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsRelativeWithPublicAccessModifier_generatesWithPublicAccess() throws { - // given - let expected = - """ - public class TestOperationLocalCacheMutation: LocalCacheMutation { - public static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil, accessModifier: .public) - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsRelativeWithInternalAccessModifier_generatesWithInternalAccess() throws { - // given - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil, accessModifier: .internal) - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsAbsoluteWithPublicAccessModifier_generatesWithPublicAccess() throws { - // given - let expected = - """ - public class TestOperationLocalCacheMutation: LocalCacheMutation { - public static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .swiftPackageManager, - operations: .absolute(path: "", accessModifier: .public) - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsAbsoluteWithInternalAccessModifier_generatesWithInternalAccess() throws { - // given - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - - """ - - config = .mock(output: .mock( - moduleType: .swiftPackageManager, - operations: .absolute(path: "", accessModifier: .internal) - )) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Operation Definition - - func test__generate__givenQuery_generatesLocalCacheMutation() throws { - // given - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate_givenQuery_configIncludesMarkOperationDefinitionsAsFinal_generatesFinalLocalCacheMutation() throws { - // given - let expected = - """ - final class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - """ - - config = .mock(options: .init(markOperationDefinitionsAsFinal: true)) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - - func test__generate__givenQueryWithLowercasing_generatesCorrectlyCasedLocalCacheMutation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query lowercaseOperation($variable: String = "TestVar") @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - class LowercaseOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - - """ - - // when - try buildSubjectAndOperation(named: "lowercaseOperation") - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithNameEndingInLocalCacheMutation_generatesLocalCacheMutationWithoutDoubledTypeSuffix() throws { - // given - document = """ - query TestOperationLocalCacheMutation @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .query - - """ - - // when - try buildSubjectAndOperation(named: "TestOperationLocalCacheMutation") - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenMutation_generatesLocalCacheMutation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Mutation { - addAnimal: Animal! - } - - type Animal { - species: String! - } - """ - - document = """ - mutation TestOperation @apollo_client_ios_localCacheMutation { - addAnimal { - species - } - } - """ - - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .mutation - - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenSubscription_generatesSubscriptionOperation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Subscription { - streamAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - subscription TestOperation @apollo_client_ios_localCacheMutation { - streamAnimals { - species - } - } - """ - - let expected = - """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - static let operationType: GraphQLOperationType = .subscription - - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQuery_generatesSelectionSetsAsMutable() throws { - // given - let expected = - """ - struct Data: TestSchema.MutableSelectionSet { - var __data: DataDict - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__generate__givenLowercasedSchemaName_generatesSelectionSetsWithFirstUppercasedNamespace() throws { - // given - let expected = - """ - struct Data: Myschema.MutableSelectionSet { - var __data: DataDict - """ - - // when - config = .mock(schemaNamespace: "myschema") - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__generate__givenUppercasedSchemaName_generatesSelectionSetsWithUppercasedNamespace() throws { - // given - let expected = - """ - struct Data: MYSCHEMA.MutableSelectionSet { - var __data: DataDict - """ - - // when - config = .mock(schemaNamespace: "MYSCHEMA") - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_swiftPackageManager_generatesClassDefinition_withPublicModifier() throws { - // given - config = .mock(.swiftPackageManager) - try buildSubjectAndOperation() - - let expected = """ - public class TestOperationLocalCacheMutation: LocalCacheMutation { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_other_generatesClassDefinition_withPublicModifier() throws { - // given - config = .mock(.other) - try buildSubjectAndOperation() - - let expected = """ - public class TestOperationLocalCacheMutation: LocalCacheMutation { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenModuleType_embeddedInTarget_generatesClassDefinition_noPublicModifier() throws { - // given - config = .mock(.embeddedInTarget(name: "MyOtherProject")) - try buildSubjectAndOperation() - - let expected = """ - class TestOperationLocalCacheMutation: LocalCacheMutation { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Variables - - func test__generate__givenQueryWithScalarVariable_generatesQueryOperationWithVariable() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation($variable: String!) @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable: String - - public init(variable: String) { - self.variable = variable - } - - public var __variables: GraphQLOperation.Variables? { ["variable": variable] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithMutlipleScalarVariables_generatesQueryOperationWithVariables() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - intField: Int! - } - """ - - document = """ - query TestOperation($variable1: String!, $variable2: Boolean!, $variable3: Int!) @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable1: String - public var variable2: Bool - public var variable3: Int - - public init( - variable1: String, - variable2: Bool, - variable3: Int - ) { - self.variable1 = variable1 - self.variable2 = variable2 - self.variable3 = variable3 - } - - public var __variables: GraphQLOperation.Variables? { [ - "variable1": variable1, - "variable2": variable2, - "variable3": variable3 - ] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithNullableScalarVariable_generatesQueryOperationWithVariable() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation($variable: String = "TestVar") @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable: GraphQLNullable - - public init(variable: GraphQLNullable = "TestVar") { - self.variable = variable - } - - public var __variables: GraphQLOperation.Variables? { ["variable": variable] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } - - // MARK: Initializer Rendering Config - Tests - - func test__render_givenLocalCacheMutation_configIncludesLocalCacheMutations_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - } - - init( - """ - - config = ApolloCodegenConfiguration.mock( - schemaNamespace: "TestSchema", - options: .init( - selectionSetInitializers: [.localCacheMutations] - ) - ) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 18, ignoringExtraLines: true)) - } - - func test__render_givenLocalCacheMutation_configIncludesSpecificLocalCacheMutations_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = - """ - } - - init( - """ - - config = ApolloCodegenConfiguration.mock( - schemaNamespace: "TestSchema", - options: .init( - selectionSetInitializers: [.operation(named: "TestOperation")] - ) - ) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 18, ignoringExtraLines: true)) - } - - func test__render_givenLocalCacheMutation_configDoesNotIncludesLocalCacheMutations_doesNotRenderInitializer() throws - { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - config = ApolloCodegenConfiguration.mock( - schemaNamespace: "TestSchema", - options: .init( - selectionSetInitializers: [.namedFragments] - ) - ) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(" /// AllAnimal", atLine: 20, ignoringExtraLines: true)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockInterfacesTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockInterfacesTemplateTests.swift deleted file mode 100644 index 9a626286af..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockInterfacesTemplateTests.swift +++ /dev/null @@ -1,164 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class MockInterfacesTemplateTests: XCTestCase { - var ir: IR! - var subject: MockInterfacesTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - interfaces: OrderedSet, - testMocks: ApolloCodegenConfiguration.TestMockFileOutput = .swiftPackage() - ) { - let config = ApolloCodegenConfiguration.mock(output: .mock(testMocks: testMocks)) - - subject = MockInterfacesTemplate( - graphQLInterfaces: interfaces, - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Boilerplate tests - - func test__target__isTestMockFile() { - buildSubject(interfaces: []) - - expect(self.subject.target).to(equal(.testMockFile)) - } - - // MARK: Typealias Tests - - func test__render__givenSingleInterfaceType_generatesExtensionWithTypealias() { - // given - let Pet = GraphQLInterfaceType.mock("Pet") - buildSubject(interfaces: [Pet]) - - let expected = """ - public extension MockObject { - typealias Pet = Interface - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenMultipleInterfaceTypes_generatesExtensionWithTypealiasesCorrectlyCased() { - // given - let InterfaceA = GraphQLInterfaceType.mock("InterfaceA") - let InterfaceB = GraphQLInterfaceType.mock("interfaceB") - let InterfaceC = GraphQLInterfaceType.mock("Interfacec") - buildSubject(interfaces: [InterfaceA, InterfaceB, InterfaceC]) - - let expected = """ - public extension MockObject { - typealias InterfaceA = Interface - typealias InterfaceB = Interface - typealias Interfacec = Interface - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Access Level Tests - - func test__render__givenInterfaceType_whenTestMocksIsSwiftPackage_shouldRenderWithPublicAccess() throws { - // given - buildSubject(interfaces: [GraphQLInterfaceType.mock("Pet")], testMocks: .swiftPackage()) - - let expected = """ - public extension MockObject { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenInterfaceType_whenTestMocksAbsolute_withPublicAccessModifier_shouldRenderWithPublicAccess() throws { - // given - buildSubject( - interfaces: [GraphQLInterfaceType.mock("Pet")], - testMocks: .absolute(path: "", accessModifier: .public) - ) - - let expected = """ - public extension MockObject { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenInterfaceType_whenTestMocksAbsolute_withInternalAccessModifier_shouldRenderWithInternalAccess() throws { - // given - buildSubject( - interfaces: [GraphQLInterfaceType.mock("Pet")], - testMocks: .absolute(path: "", accessModifier: .internal) - ) - - let expected = """ - extension MockObject { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test__render__usingReservedKeyword__generatesTypeWithSuffix() { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - let interface = GraphQLInterfaceType.mock(keyword) - buildSubject(interfaces: [interface]) - - let expected = """ - public extension MockObject { - typealias \(keyword.firstUppercased)_Interface = Interface - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockObjectTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockObjectTemplateTests.swift deleted file mode 100644 index 92f8453907..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockObjectTemplateTests.swift +++ /dev/null @@ -1,1024 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class MockObjectTemplateTests: XCTestCase { - - var ir: IR! - var subject: MockObjectTemplate! - - override func tearDown() { - subject = nil - ir = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - name: String = "Dog", - interfaces: [GraphQLInterfaceType] = [], - schemaNamespace: String = "TestSchema", - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .swiftPackageManager, - testMocks: ApolloCodegenConfiguration.TestMockFileOutput = .swiftPackage(), - warningsOnDeprecatedUsage: ApolloCodegenConfiguration.Composition = .exclude - ) { - let config = ApolloCodegenConfiguration.mock( - schemaNamespace: schemaNamespace, - output: .mock(moduleType: moduleType, testMocks: testMocks), - options: .init(warningsOnDeprecatedUsage: warningsOnDeprecatedUsage) - ) - ir = IR.mock(compilationResult: .mock()) - - subject = MockObjectTemplate( - graphqlObject: GraphQLObjectType.mock(name, interfaces: interfaces), - config: ApolloCodegen.ConfigurationContext(config: config), - ir: ir - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Boilerplate tests - - func test__target__isTestMockFile() { - buildSubject() - - expect(self.subject.target).to(equal(.testMockFile)) - } - - func test__render__givenSchemaType_generatesExtension() { - // given - buildSubject(name: "Dog", moduleType: .swiftPackageManager) - - let expected = """ - public class Dog: MockObject { - public static let objectType: Object = TestSchema.Objects.Dog - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Casing Tests - - func test__render__givenSchemaTypeWithLowercaseName_generatesCapitalizedClassName() { - // given - buildSubject(name: "dog") - - let expected = """ - public class Dog: MockObject { - public static let objectType: Object = TestSchema.Objects.Dog - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenLowercasedSchemaName_generatesFirstUppercasedSchemaNameReferences() { - // given - buildSubject(schemaNamespace: "lowercased") - - let expected = """ - public static let objectType: Object = Lowercased.Objects.Dog - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 2, ignoringExtraLines: true)) - } - - func test__render__givenUppercasedSchemaName_generatesCapitalizedSchemaNameReferences() { - // given - buildSubject(schemaNamespace: "UPPER") - - let expected = """ - public static let objectType: Object = UPPER.Objects.Dog - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 2, ignoringExtraLines: true)) - } - - func test__render__givenCapitalizedSchemaName_generatesCapitalizedSchemaNameReferences() { - // given - buildSubject(schemaNamespace: "MySchema") - - let expected = """ - public static let objectType: Object = MySchema.Objects.Dog - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 2, ignoringExtraLines: true)) - } - - // MARK: Mock Field Tests - - func test__render__givenSchemaType_generatesFieldAccessors() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let Cat: GraphQLType = .entity(.mock("Cat")) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string())), - "customScalar": .mock("customScalar", type: .nonNull(.scalar(.mock(name: "CustomScalar")))), - "optionalString": .mock("optionalString", type: .string()), - "object": .mock("object", type: Cat), - "objectList": .mock("objectList", type: .list(.nonNull(Cat))), - "objectNestedList": .mock("objectNestedList", type: .list(.nonNull(.list(.nonNull(Cat))))), - "objectOptionalList": .mock("objectOptionalList", type: .list(Cat)), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("customScalar") public var customScalar - @Field("object") public var object - @Field<[Cat]>("objectList") public var objectList - @Field<[[Cat]]>("objectNestedList") public var objectNestedList - @Field<[Cat?]>("objectOptionalList") public var objectOptionalList - @Field("optionalString") public var optionalString - @Field("string") public var string - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render__givenFieldsWithLowercaseTypeNames_generatesFieldAccessors() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let Cat: GraphQLType = .entity(.mock("cat")) - - subject.graphqlObject.fields = [ - "customScalar": .mock("customScalar", type: .nonNull(.scalar(.mock(name: "customScalar")))), - "enumType": .mock("enumType", type: .enum(.mock(name: "enumType"))), - "object": .mock("object", type: Cat), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("customScalar") public var customScalar - @Field>("enumType") public var enumType - @Field("object") public var object - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render__givenFieldsWithSwiftReservedKeyworkNames_generatesFieldsEscapedWithBackticks() { - // given - buildSubject(moduleType: .swiftPackageManager) - - subject.graphqlObject.fields = [ - "associatedtype": .mock("associatedtype", type: .nonNull(.string())), - "class": .mock("class", type: .nonNull(.string())), - "deinit": .mock("deinit", type: .nonNull(.string())), - "enum": .mock("enum", type: .nonNull(.string())), - "extension": .mock("extension", type: .nonNull(.string())), - "fileprivate": .mock("fileprivate", type: .nonNull(.string())), - "func": .mock("func", type: .nonNull(.string())), - "import": .mock("import", type: .nonNull(.string())), - "init": .mock("init", type: .nonNull(.string())), - "inout": .mock("inout", type: .nonNull(.string())), - "internal": .mock("internal", type: .nonNull(.string())), - "let": .mock("let", type: .nonNull(.string())), - "operator": .mock("operator", type: .nonNull(.string())), - "private": .mock("private", type: .nonNull(.string())), - "precedencegroup": .mock("precedencegroup", type: .nonNull(.string())), - "protocol": .mock("protocol", type: .nonNull(.string())), - "Protocol": .mock("Protocol", type: .nonNull(.string())), - "public": .mock("public", type: .nonNull(.string())), - "rethrows": .mock("rethrows", type: .nonNull(.string())), - "static": .mock("static", type: .nonNull(.string())), - "struct": .mock("struct", type: .nonNull(.string())), - "subscript": .mock("subscript", type: .nonNull(.string())), - "typealias": .mock("typealias", type: .nonNull(.string())), - "var": .mock("var", type: .nonNull(.string())), - "break": .mock("break", type: .nonNull(.string())), - "case": .mock("case", type: .nonNull(.string())), - "catch": .mock("catch", type: .nonNull(.string())), - "continue": .mock("continue", type: .nonNull(.string())), - "default": .mock("default", type: .nonNull(.string())), - "defer": .mock("defer", type: .nonNull(.string())), - "do": .mock("do", type: .nonNull(.string())), - "else": .mock("else", type: .nonNull(.string())), - "fallthrough": .mock("fallthrough", type: .nonNull(.string())), - "for": .mock("for", type: .nonNull(.string())), - "guard": .mock("guard", type: .nonNull(.string())), - "if": .mock("if", type: .nonNull(.string())), - "in": .mock("in", type: .nonNull(.string())), - "repeat": .mock("repeat", type: .nonNull(.string())), - "return": .mock("return", type: .nonNull(.string())), - "throw": .mock("throw", type: .nonNull(.string())), - "switch": .mock("switch", type: .nonNull(.string())), - "where": .mock("where", type: .nonNull(.string())), - "while": .mock("while", type: .nonNull(.string())), - "as": .mock("as", type: .nonNull(.string())), - "false": .mock("false", type: .nonNull(.string())), - "is": .mock("is", type: .nonNull(.string())), - "nil": .mock("nil", type: .nonNull(.string())), - "self": .mock("self", type: .nonNull(.string())), - "Self": .mock("Self", type: .nonNull(.string())), - "super": .mock("super", type: .nonNull(.string())), - "throws": .mock("throws", type: .nonNull(.string())), - "true": .mock("true", type: .nonNull(.string())), - "try": .mock("try", type: .nonNull(.string())), - "Type": .mock("Type", type: .nonNull(.string())), - "Any": .mock("Any", type: .nonNull(.string())), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("Any") public var `Any` - @Field("Protocol") public var `Protocol` - @Field("Self") public var `Self` - @Field("Type") public var `Type` - @Field("as") public var `as` - @Field("associatedtype") public var `associatedtype` - @Field("break") public var `break` - @Field("case") public var `case` - @Field("catch") public var `catch` - @Field("class") public var `class` - @Field("continue") public var `continue` - @Field("default") public var `default` - @Field("defer") public var `defer` - @Field("deinit") public var `deinit` - @Field("do") public var `do` - @Field("else") public var `else` - @Field("enum") public var `enum` - @Field("extension") public var `extension` - @Field("fallthrough") public var `fallthrough` - @Field("false") public var `false` - @Field("fileprivate") public var `fileprivate` - @Field("for") public var `for` - @Field("func") public var `func` - @Field("guard") public var `guard` - @Field("if") public var `if` - @Field("import") public var `import` - @Field("in") public var `in` - @Field("init") public var `init` - @Field("inout") public var `inout` - @Field("internal") public var `internal` - @Field("is") public var `is` - @Field("let") public var `let` - @Field("nil") public var `nil` - @Field("operator") public var `operator` - @Field("precedencegroup") public var `precedencegroup` - @Field("private") public var `private` - @Field("protocol") public var `protocol` - @Field("public") public var `public` - @Field("repeat") public var `repeat` - @Field("rethrows") public var `rethrows` - @Field("return") public var `return` - @Field("self") public var `self` - @Field("static") public var `static` - @Field("struct") public var `struct` - @Field("subscript") public var `subscript` - @Field("super") public var `super` - @Field("switch") public var `switch` - @Field("throw") public var `throw` - @Field("throws") public var `throws` - @Field("true") public var `true` - @Field("try") public var `try` - @Field("typealias") public var `typealias` - @Field("var") public var `var` - @Field("where") public var `where` - @Field("while") public var `while` - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render__givenFieldType_Interface_named_Actor_generatesFieldsWithNamespace() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let Actor_Interface = GraphQLInterfaceType.mock("Actor") - - subject.graphqlObject.fields = [ - "actor": .mock("actor", type: .entity(Actor_Interface)), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("actor") public var actor - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render__givenFieldType_Union_named_Actor_generatesFieldsWithNamespace() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let Actor_Union = GraphQLUnionType.mock("Actor") - - subject.graphqlObject.fields = [ - "actor": .mock("actor", type: .entity(Actor_Union)), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("actor") public var actor - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render__givenFieldType_Object_named_Actor_generatesFieldsWithoutNamespace() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let Actor_Object = GraphQLObjectType.mock("Actor") - - subject.graphqlObject.fields = [ - "actor": .mock("actor", type: .entity(Actor_Object)), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("actor") public var actor - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - // MARK: Conflicting Field Name Tests - - func test_render_givenConflictingFieldName_generatesPropertyWithFieldName() { - // given - buildSubject() - - subject.graphqlObject.fields = [ - "hash": .mock("hash", type: .nonNull(.string())) - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - var hash: String? { - get { _data["hash"] as? String } - set { _setScalar(newValue, for: \\.hash) } - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - // MARK: Convenience Initializer Tests - - func test__render__givenSchemaType_generatesConvenienceInitializer() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let Cat: GraphQLType = .entity(GraphQLObjectType.mock("Cat")) - let Animal: GraphQLType = .entity(GraphQLInterfaceType.mock("Animal")) - let Pet: GraphQLType = .entity(GraphQLUnionType.mock("Pet")) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string())), - "stringList": .mock("stringList", type: .list(.nonNull(.string()))), - "stringNestedList": .mock("stringNestedList", type: .list(.list(.nonNull(.string())))), - "stringOptionalList": .mock("stringOptionalList", type: .list(.string())), - "customScalar": .mock("customScalar", type: .nonNull(.scalar(.mock(name: "CustomScalar")))), - "customScalarList": .mock("customScalarList", type: .list(.nonNull(.scalar(.mock(name: "CustomScalar"))))), - "customScalarOptionalList": .mock("customScalarOptionalList", type: .list(.scalar(.mock(name: "CustomScalar")))), - "optionalString": .mock("optionalString", type: .string()), - "object": .mock("object", type: Cat), - "objectList": .mock("objectList", type: .list(.nonNull(Cat))), - "objectNestedList": .mock("objectNestedList", type: .list(.nonNull(.list(.nonNull(Cat))))), - "objectOptionalList": .mock("objectOptionalList", type: .list(Cat)), - "interface": .mock("interface", type: Animal), - "interfaceList": .mock("interfaceList", type: .list(.nonNull(Animal))), - "interfaceNestedList": .mock("interfaceNestedList", type: .list(.nonNull(.list(.nonNull(Animal))))), - "interfaceOptionalList": .mock("interfaceOptionalList", type: .list(Animal)), - "union": .mock("union", type: Pet), - "unionList": .mock("unionList", type: .list(.nonNull(Pet))), - "unionNestedList": .mock("unionNestedList", type: .list(.nonNull(.list(.nonNull(Pet))))), - "unionOptionalList": .mock("unionOptionalList", type: .list(Pet)), - "enumType": .mock("enumType", type: .enum(.mock(name: "enumType"))), - "enumList": .mock("enumList", type: .list(.nonNull(.enum(.mock(name: "enumType"))))), - "enumOptionalList": .mock("enumOptionalList", type: .list(.enum(.mock(name: "enumType")))) - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - } - - public extension Mock where O == Dog { - convenience init( - customScalar: TestSchema.CustomScalar? = nil, - customScalarList: [TestSchema.CustomScalar]? = nil, - customScalarOptionalList: [TestSchema.CustomScalar]? = nil, - enumList: [GraphQLEnum]? = nil, - enumOptionalList: [GraphQLEnum]? = nil, - enumType: GraphQLEnum? = nil, - interface: AnyMock? = nil, - interfaceList: [AnyMock]? = nil, - interfaceNestedList: [[AnyMock]]? = nil, - interfaceOptionalList: [AnyMock?]? = nil, - object: Mock? = nil, - objectList: [Mock]? = nil, - objectNestedList: [[Mock]]? = nil, - objectOptionalList: [Mock?]? = nil, - optionalString: String? = nil, - string: String? = nil, - stringList: [String]? = nil, - stringNestedList: [[String]]? = nil, - stringOptionalList: [String]? = nil, - union: AnyMock? = nil, - unionList: [AnyMock]? = nil, - unionNestedList: [[AnyMock]]? = nil, - unionOptionalList: [AnyMock?]? = nil - ) { - self.init() - _setScalar(customScalar, for: \\.customScalar) - _setScalarList(customScalarList, for: \\.customScalarList) - _setScalarList(customScalarOptionalList, for: \\.customScalarOptionalList) - _setScalarList(enumList, for: \\.enumList) - _setScalarList(enumOptionalList, for: \\.enumOptionalList) - _setScalar(enumType, for: \\.enumType) - _setEntity(interface, for: \\.interface) - _setList(interfaceList, for: \\.interfaceList) - _setList(interfaceNestedList, for: \\.interfaceNestedList) - _setList(interfaceOptionalList, for: \\.interfaceOptionalList) - _setEntity(object, for: \\.object) - _setList(objectList, for: \\.objectList) - _setList(objectNestedList, for: \\.objectNestedList) - _setList(objectOptionalList, for: \\.objectOptionalList) - _setScalar(optionalString, for: \\.optionalString) - _setScalar(string, for: \\.string) - _setScalarList(stringList, for: \\.stringList) - _setScalarList(stringNestedList, for: \\.stringNestedList) - _setScalarList(stringOptionalList, for: \\.stringOptionalList) - _setEntity(union, for: \\.union) - _setList(unionList, for: \\.unionList) - _setList(unionNestedList, for: \\.unionNestedList) - _setList(unionOptionalList, for: \\.unionOptionalList) - } - } - - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine( - expected, - atLine: 8 + self.subject.graphqlObject.fields.count, - ignoringExtraLines: false) - ) - } - - func test__render__givenSchemaTypeWithoutFields_doesNotgenerateConvenienceInitializer() { - // given - buildSubject(moduleType: .swiftPackageManager) - - let expected = """ - } - - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine( - expected, - atLine: 8 + self.subject.graphqlObject.fields.count, - ignoringExtraLines: false) - ) - } - - func test__render__givenFieldsWithSwiftReservedKeyworkNames_generatesConvenienceInitializerParamatersEscapedWithBackticksAndInternalNames() { - // given - buildSubject(moduleType: .swiftPackageManager) - - subject.graphqlObject.fields = [ - "associatedtype": .mock("associatedtype", type: .nonNull(.string())), - "class": .mock("class", type: .nonNull(.string())), - "deinit": .mock("deinit", type: .nonNull(.string())), - "enum": .mock("enum", type: .nonNull(.string())), - "extension": .mock("extension", type: .nonNull(.string())), - "fileprivate": .mock("fileprivate", type: .nonNull(.string())), - "func": .mock("func", type: .nonNull(.string())), - "import": .mock("import", type: .nonNull(.string())), - "init": .mock("init", type: .nonNull(.string())), - "inout": .mock("inout", type: .nonNull(.string())), - "internal": .mock("internal", type: .nonNull(.string())), - "let": .mock("let", type: .nonNull(.string())), - "operator": .mock("operator", type: .nonNull(.string())), - "private": .mock("private", type: .nonNull(.string())), - "precedencegroup": .mock("precedencegroup", type: .nonNull(.string())), - "protocol": .mock("protocol", type: .nonNull(.string())), - "Protocol": .mock("Protocol", type: .nonNull(.string())), - "public": .mock("public", type: .nonNull(.string())), - "rethrows": .mock("rethrows", type: .nonNull(.string())), - "static": .mock("static", type: .nonNull(.string())), - "struct": .mock("struct", type: .nonNull(.string())), - "subscript": .mock("subscript", type: .nonNull(.string())), - "typealias": .mock("typealias", type: .nonNull(.string())), - "var": .mock("var", type: .nonNull(.string())), - "break": .mock("break", type: .nonNull(.string())), - "case": .mock("case", type: .nonNull(.string())), - "catch": .mock("catch", type: .nonNull(.string())), - "continue": .mock("continue", type: .nonNull(.string())), - "default": .mock("default", type: .nonNull(.string())), - "defer": .mock("defer", type: .nonNull(.string())), - "do": .mock("do", type: .nonNull(.string())), - "else": .mock("else", type: .nonNull(.string())), - "fallthrough": .mock("fallthrough", type: .nonNull(.string())), - "for": .mock("for", type: .nonNull(.string())), - "guard": .mock("guard", type: .nonNull(.string())), - "if": .mock("if", type: .nonNull(.string())), - "in": .mock("in", type: .nonNull(.string())), - "repeat": .mock("repeat", type: .nonNull(.string())), - "return": .mock("return", type: .nonNull(.string())), - "throw": .mock("throw", type: .nonNull(.string())), - "switch": .mock("switch", type: .nonNull(.string())), - "where": .mock("where", type: .nonNull(.string())), - "while": .mock("while", type: .nonNull(.string())), - "as": .mock("as", type: .nonNull(.string())), - "false": .mock("false", type: .nonNull(.string())), - "is": .mock("is", type: .nonNull(.string())), - "nil": .mock("nil", type: .nonNull(.string())), - "self": .mock("self", type: .nonNull(.string())), - "Self": .mock("Self", type: .nonNull(.string())), - "super": .mock("super", type: .nonNull(.string())), - "throws": .mock("throws", type: .nonNull(.string())), - "true": .mock("true", type: .nonNull(.string())), - "try": .mock("try", type: .nonNull(.string())), - "Type": .mock("Type", type: .nonNull(.string())), - "Any": .mock("Any", type: .nonNull(.string())), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - } - - public extension Mock where O == Dog { - convenience init( - `Any`: String? = nil, - `Protocol`: String? = nil, - `Self`: String? = nil, - `Type`: String? = nil, - `as`: String? = nil, - `associatedtype`: String? = nil, - `break`: String? = nil, - `case`: String? = nil, - `catch`: String? = nil, - `class`: String? = nil, - `continue`: String? = nil, - `default`: String? = nil, - `defer`: String? = nil, - `deinit`: String? = nil, - `do`: String? = nil, - `else`: String? = nil, - `enum`: String? = nil, - `extension`: String? = nil, - `fallthrough`: String? = nil, - `false`: String? = nil, - `fileprivate`: String? = nil, - `for`: String? = nil, - `func`: String? = nil, - `guard`: String? = nil, - `if`: String? = nil, - `import`: String? = nil, - `in`: String? = nil, - `init`: String? = nil, - `inout`: String? = nil, - `internal`: String? = nil, - `is`: String? = nil, - `let`: String? = nil, - `nil`: String? = nil, - `operator`: String? = nil, - `precedencegroup`: String? = nil, - `private`: String? = nil, - `protocol`: String? = nil, - `public`: String? = nil, - `repeat`: String? = nil, - `rethrows`: String? = nil, - `return`: String? = nil, - `self` self_value: String? = nil, - `static`: String? = nil, - `struct`: String? = nil, - `subscript`: String? = nil, - `super`: String? = nil, - `switch`: String? = nil, - `throw`: String? = nil, - `throws`: String? = nil, - `true`: String? = nil, - `try`: String? = nil, - `typealias`: String? = nil, - `var`: String? = nil, - `where`: String? = nil, - `while`: String? = nil - ) { - self.init() - _setScalar(`Any`, for: \\.`Any`) - _setScalar(`Protocol`, for: \\.`Protocol`) - _setScalar(`Self`, for: \\.`Self`) - _setScalar(`Type`, for: \\.`Type`) - _setScalar(`as`, for: \\.`as`) - _setScalar(`associatedtype`, for: \\.`associatedtype`) - _setScalar(`break`, for: \\.`break`) - _setScalar(`case`, for: \\.`case`) - _setScalar(`catch`, for: \\.`catch`) - _setScalar(`class`, for: \\.`class`) - _setScalar(`continue`, for: \\.`continue`) - _setScalar(`default`, for: \\.`default`) - _setScalar(`defer`, for: \\.`defer`) - _setScalar(`deinit`, for: \\.`deinit`) - _setScalar(`do`, for: \\.`do`) - _setScalar(`else`, for: \\.`else`) - _setScalar(`enum`, for: \\.`enum`) - _setScalar(`extension`, for: \\.`extension`) - _setScalar(`fallthrough`, for: \\.`fallthrough`) - _setScalar(`false`, for: \\.`false`) - _setScalar(`fileprivate`, for: \\.`fileprivate`) - _setScalar(`for`, for: \\.`for`) - _setScalar(`func`, for: \\.`func`) - _setScalar(`guard`, for: \\.`guard`) - _setScalar(`if`, for: \\.`if`) - _setScalar(`import`, for: \\.`import`) - _setScalar(`in`, for: \\.`in`) - _setScalar(`init`, for: \\.`init`) - _setScalar(`inout`, for: \\.`inout`) - _setScalar(`internal`, for: \\.`internal`) - _setScalar(`is`, for: \\.`is`) - _setScalar(`let`, for: \\.`let`) - _setScalar(`nil`, for: \\.`nil`) - _setScalar(`operator`, for: \\.`operator`) - _setScalar(`precedencegroup`, for: \\.`precedencegroup`) - _setScalar(`private`, for: \\.`private`) - _setScalar(`protocol`, for: \\.`protocol`) - _setScalar(`public`, for: \\.`public`) - _setScalar(`repeat`, for: \\.`repeat`) - _setScalar(`rethrows`, for: \\.`rethrows`) - _setScalar(`return`, for: \\.`return`) - _setScalar(self_value, for: \\.`self`) - _setScalar(`static`, for: \\.`static`) - _setScalar(`struct`, for: \\.`struct`) - _setScalar(`subscript`, for: \\.`subscript`) - _setScalar(`super`, for: \\.`super`) - _setScalar(`switch`, for: \\.`switch`) - _setScalar(`throw`, for: \\.`throw`) - _setScalar(`throws`, for: \\.`throws`) - _setScalar(`true`, for: \\.`true`) - _setScalar(`try`, for: \\.`try`) - _setScalar(`typealias`, for: \\.`typealias`) - _setScalar(`var`, for: \\.`var`) - _setScalar(`where`, for: \\.`where`) - _setScalar(`while`, for: \\.`while`) - } - } - - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine( - expected, - atLine: 8 + self.subject.graphqlObject.fields.count, - ignoringExtraLines: false) - ) - } - - // MARK: Access Level Tests - - func test__render__givenSchemaTypeAndFields_whenTestMocksIsSwiftPackage_shouldRenderWithPublicAccess() { - // given - buildSubject(name: "Dog", testMocks: .swiftPackage()) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string())) - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expectedClassDefinition = """ - public class Dog: MockObject { - public static let objectType: Object = TestSchema.Objects.Dog - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - """ - - let expectedExtensionDefinition = """ - public extension Mock where O == Dog { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expectedClassDefinition, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedExtensionDefinition, atLine: 11, ignoringExtraLines: true)) - } - - func test__render__givenSchemaType_whenTestMocksAbsolute_withPublicAccessModifier_shouldRenderWithPublicAccess() { - // given - buildSubject(name: "Dog", testMocks: .absolute(path: "", accessModifier: .public)) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string())) - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expectedClassDefinition = """ - public class Dog: MockObject { - public static let objectType: Object = TestSchema.Objects.Dog - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - """ - - let expectedExtensionDefinition = """ - public extension Mock where O == Dog { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expectedClassDefinition, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedExtensionDefinition, atLine: 11, ignoringExtraLines: true)) - } - - func test__render__givenSchemaType_whenTestMocksAbsolute_withInternalAccessModifier_shouldRenderWithInternalAccess() { - // given - buildSubject(name: "Dog", testMocks: .absolute(path: "", accessModifier: .internal)) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string())) - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expectedClassDefinition = """ - class Dog: MockObject { - static let objectType: Object = TestSchema.Objects.Dog - static let _mockFields = MockFields() - typealias MockValueCollectionType = Array> - - struct MockFields { - """ - - let expectedExtensionDefinition = """ - extension Mock where O == Dog { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expectedClassDefinition, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedExtensionDefinition, atLine: 11, ignoringExtraLines: true)) - } - - // MARK: - Deprecation Warnings - - func test__render_fieldAccessors__givenWarningsOnDeprecatedUsage_include_hasDeprecatedField_shouldGenerateWarning() throws { - // given - buildSubject(moduleType: .swiftPackageManager, warningsOnDeprecatedUsage: .include) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string()), deprecationReason: "Cause I said so!"), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type, deprecationReason: $0.deprecationReason) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @available(*, deprecated, message: "Cause I said so!") - @Field("string") public var string - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenWarningsOnDeprecatedUsage_exclude_hasDeprecatedField_shouldNotGenerateWarning() throws { - // given - buildSubject(moduleType: .swiftPackageManager, warningsOnDeprecatedUsage: .exclude) - - subject.graphqlObject.fields = [ - "string": .mock("string", type: .nonNull(.string()), deprecationReason: "Cause I said so!"), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type, deprecationReason: $0.deprecationReason) - }, - to: subject.graphqlObject - ) - - let expected = """ - public struct MockFields { - @Field("string") public var string - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test__render__givenObjectUsingReservedKeyword_generatesTypeWithSuffix() { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject(name: keyword, moduleType: .swiftPackageManager) - - subject.graphqlObject.fields = [ - "name": .mock("string", type: .nonNull(.string())), - ] - - ir.fieldCollector.add( - fields: subject.graphqlObject.fields.values.map { - .mock($0.name, type: $0.type) - }, - to: subject.graphqlObject - ) - - let expected = """ - public class \(keyword.firstUppercased)_Object: MockObject { - public static let objectType: Object = TestSchema.Objects.\(keyword.firstUppercased)_Object - public static let _mockFields = MockFields() - public typealias MockValueCollectionType = Array> - - public struct MockFields { - @Field("string") public var string - } - } - - public extension Mock where O == \(keyword.firstUppercased)_Object { - convenience init( - string: String? = nil - ) { - self.init() - _setScalar(string, for: \\.string) - } - } - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockUnionsTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockUnionsTemplateTests.swift deleted file mode 100644 index 0392a165e2..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/MockUnionsTemplateTests.swift +++ /dev/null @@ -1,161 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class MockUnionsTemplateTests: XCTestCase { - var ir: IR! - var subject: MockUnionsTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - unions: OrderedSet, - testMocks: ApolloCodegenConfiguration.TestMockFileOutput = .swiftPackage() - ) { - let config = ApolloCodegenConfiguration.mock(output: .mock(testMocks: testMocks)) - - subject = MockUnionsTemplate( - graphQLUnions: unions, - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Boilerplate tests - - func test__target__isTestMockFile() { - buildSubject(unions: []) - - expect(self.subject.target).to(equal(.testMockFile)) - } - - // MARK: Typealias Tests - - func test__render__givenSingleUnionType_generatesExtensionWithTypealias() { - // given - let Pet = GraphQLUnionType.mock("Pet") - buildSubject(unions: [Pet]) - - let expected = """ - public extension MockObject { - typealias Pet = Union - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenMultipleUnionTypes_generatesExtensionWithTypealiasesCorrectlyCased() { - // given - let UnionA = GraphQLUnionType.mock("UnionA") - let UnionB = GraphQLUnionType.mock("unionB") - let UnionC = GraphQLUnionType.mock("Unionc") - buildSubject(unions: [UnionA, UnionB, UnionC]) - - let expected = """ - public extension MockObject { - typealias UnionA = Union - typealias UnionB = Union - typealias Unionc = Union - } - - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Access Level Tests - - func test_render_givenUnionType_whenTestMocksIsSwiftPackage_shouldRenderWithPublicAccess() { - // given - let Pet = GraphQLUnionType.mock("Pet") - buildSubject(unions: [Pet], testMocks: .swiftPackage()) - - let expected = """ - public extension MockObject { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenUnionType_whenTestMocksAbsolute_withPublicAccessModifier_shouldRenderWithPublicAccess() { - // given - let Pet = GraphQLUnionType.mock("Pet") - buildSubject(unions: [Pet], testMocks: .absolute(path: "", accessModifier: .public)) - - let expected = """ - public extension MockObject { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenUnionType_whenTestMocksAbsolute_withInternalAccessModifier_shouldRenderWithInternalAccess() { - // given - let Pet = GraphQLUnionType.mock("Pet") - buildSubject(unions: [Pet], testMocks: .absolute(path: "", accessModifier: .internal)) - - let expected = """ - extension MockObject { - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test__render__usingReservedKeyword__generatesTypeWithSuffix() { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - let union = GraphQLUnionType.mock(keyword) - buildSubject(unions: [union]) - - let expected = """ - public extension MockObject { - typealias \(keyword.firstUppercased)_Union = Union - } - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/ObjectTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/ObjectTemplateTests.swift deleted file mode 100644 index 4cbfcc6a90..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/ObjectTemplateTests.swift +++ /dev/null @@ -1,194 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class ObjectTemplateTests: XCTestCase { - - var subject: ObjectTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - name: String = "Dog", - interfaces: [GraphQLInterfaceType] = [], - documentation: String? = nil, - config: ApolloCodegenConfiguration = .mock() - ) { - subject = ObjectTemplate( - graphqlObject: GraphQLObjectType.mock( - name, - interfaces: interfaces, - documentation: documentation - ), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Boilerplate tests - - func test_render_generatesClosingBrace() { - // given - buildSubject() - - // when - let actual = renderSubject() - - // then - expect(actual).to(endWith("\n)")) - } - - // MARK: Class Definition Tests - - func test_render_givenSchemaType_generatesSwiftClassDefinitionCorrectlyCased() { - // given - buildSubject(name: "dog") - - let expected = """ - static let Dog = Object( - typename: "dog", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenSchemaTypeImplementsInterfaces_schemaEmbeddedInTarget_generatesImplementedInterfacesWithSchemaNamespace() { - // given - buildSubject(interfaces: [ - GraphQLInterfaceType.mock("Animal", fields: ["species": GraphQLField.mock("species", type: .scalar(.string()))]), - GraphQLInterfaceType.mock("Pet", fields: ["name": GraphQLField.mock("name", type: .scalar(.string()))]) - ] - ) - - let expected = """ - implementedInterfaces: [ - TestSchema.Interfaces.Animal.self, - TestSchema.Interfaces.Pet.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - func test_render_givenSchemaTypeImplementsInterfaces_schemaNotEmbeddedInTarget_generatesImplementedInterfacesNotInSchemaNameSpace() { - // given - buildSubject( - interfaces: [ - GraphQLInterfaceType.mock("Animal", fields: ["species": GraphQLField.mock("species", type: .scalar(.string()))]), - GraphQLInterfaceType.mock("Pet", fields: ["name": GraphQLField.mock("name", type: .scalar(.string()))]) - ], - config: .mock(.swiftPackageManager) - ) - - let expected = """ - implementedInterfaces: [ - Interfaces.Animal.self, - Interfaces.Pet.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - func test_render_givenNoImplemented_generatesEmpytArray() { - // given - buildSubject() - - let expected = """ - implementedInterfaces: [] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - static let Dog = Object( - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .exclude)) - ) - - let expected = """ - static let Dog = Object( - """ - - // when - let rendered = renderSubject() - - // then - expect(rendered).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test_render_usingReservedKeyword_shouldHaveSuffixedType() { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject(name: keyword) - - let expected = """ - static let \(keyword.firstUppercased)_Object = Object( - typename: "\(keyword)", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift deleted file mode 100644 index ef259a99b7..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift +++ /dev/null @@ -1,998 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class OperationDefinitionTemplateTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: IR.Operation! - var config: ApolloCodegenConfiguration! - var subject: OperationDefinitionTemplate! - - override func setUp() { - super.setUp() - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - config = .mock() - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - operation = nil - config = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubjectAndOperation(named operationName: String = "TestOperation") throws { - ir = try .mock(schema: schemaSDL, document: document) - let operationDefinition = try XCTUnwrap(ir.compilationResult[operation: operationName]) - operation = ir.build(operation: operationDefinition) - subject = OperationDefinitionTemplate( - operation: operation, - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: - Operation Definition - - func test__generate__givenQuery_generatesQueryOperation() throws { - // given - let expected = - """ - class TestOperationQuery: GraphQLQuery { - static let operationName: String = "TestOperation" - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate_givenQuery_configIncludesMarkOperationDefinitionsAsFinal_generatesFinalQueryDefinitions() throws { - // given - let expected = - """ - final class TestOperationQuery: GraphQLQuery { - static let operationName: String = "TestOperation" - """ - - config = .mock(options: .init(markOperationDefinitionsAsFinal: true)) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithNameEndingInQuery_generatesQueryOperationWithoutDoubledTypeSuffix() throws { - // given - document = """ - query TestOperationQuery { - allAnimals { - species - } - } - """ - - let expected = - """ - class TestOperationQuery: GraphQLQuery { - static let operationName: String = "TestOperationQuery" - """ - - // when - try buildSubjectAndOperation(named: "TestOperationQuery") - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenMutationWithNameEndingInQuery_generatesQueryOperationWithBothSuffixes() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Mutation { - addAnimal: Animal! - } - - type Animal { - species: String! - } - """ - - document = """ - mutation TestOperationQuery { - addAnimal { - species - } - } - """ - - let expected = - """ - class TestOperationQueryMutation: GraphQLMutation { - static let operationName: String = "TestOperationQuery" - """ - - // when - try buildSubjectAndOperation(named: "TestOperationQuery") - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenMutation_generatesMutationOperation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Mutation { - addAnimal: Animal! - } - - type Animal { - species: String! - } - """ - - document = """ - mutation TestOperation { - addAnimal { - species - } - } - """ - - let expected = - """ - class TestOperationMutation: GraphQLMutation { - static let operationName: String = "TestOperation" - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenSubscription_generatesSubscriptionOperation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Subscription { - streamAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - subscription TestOperation { - streamAnimals { - species - } - } - """ - - let expected = - """ - class TestOperationSubscription: GraphQLSubscription { - static let operationName: String = "TestOperation" - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithLowercasing_generatesCorrectlyCasedQueryOperation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query lowercaseOperation($variable: String = "TestVar") { - allAnimals { - species - } - } - """ - - let expected = - """ - class LowercaseOperationQuery: GraphQLQuery { - static let operationName: String = "lowercaseOperation" - static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #\"query lowercaseOperation($variable: String = \"TestVar\") { allAnimals { __typename species } }\"# - """ - - // when - try buildSubjectAndOperation(named: "lowercaseOperation") - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Selection Set Declaration - - func test__generate__givenOperationSelectionSet_rendersDeclaration() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - let expected = """ - struct Data: TestSchema.SelectionSet { - let __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - - static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Query } - """ - - // when - try buildSubjectAndOperation() - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } - - // MARK: - Selection Set Initializers - - func test__generate_givenOperationSelectionSet_configIncludesOperations_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - let expected = - """ - init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - config = .mock(options: .init(selectionSetInitializers: [.operations])) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 50, ignoringExtraLines: true)) - } - - func test__generate_givenOperationSelectionSet_configIncludesSpecificOperation_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - let expected = - """ - init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - config = .mock(options: .init(selectionSetInitializers: [ - .operation(named: "TestOperation") - ])) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 50, ignoringExtraLines: true)) - } - - func test__render_givenOperationSelectionSet_configDoesNotIncludeOperations_doesNotRenderInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - config = .mock(options: .init(selectionSetInitializers: [.namedFragments])) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(" }", atLine: 35, ignoringExtraLines: true)) - } - - func test__render_givenOperationSelectionSet_configIncludeSpecificOperationWithOtherName_doesNotRenderInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - config = .mock(options: .init(selectionSetInitializers: [ - .operation(named: "OtherOperation") - ])) - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(" }", atLine: 35, ignoringExtraLines: true)) - } - - // MARK: - Variables - - func test__generate__givenQueryWithScalarVariable_generatesQueryOperationWithVariable() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation($variable: String!) { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable: String - - public init(variable: String) { - self.variable = variable - } - - public var __variables: Variables? { ["variable": variable] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithMutlipleScalarVariables_generatesQueryOperationWithVariables() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - intField: Int! - } - """ - - document = """ - query TestOperation($variable1: String!, $variable2: Boolean!, $variable3: Int!) { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable1: String - public var variable2: Bool - public var variable3: Int - - public init( - variable1: String, - variable2: Bool, - variable3: Int - ) { - self.variable1 = variable1 - self.variable2 = variable2 - self.variable3 = variable3 - } - - public var __variables: Variables? { [ - "variable1": variable1, - "variable2": variable2, - "variable3": variable3 - ] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithNullableScalarVariable_generatesQueryOperationWithVariable() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation($variable: String = "TestVar") { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable: GraphQLNullable - - public init(variable: GraphQLNullable = "TestVar") { - self.variable = variable - } - - public var __variables: Variables? { ["variable": variable] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__generate__givenQueryWithCapitalizedVariable_generatesQueryOperationWithLowercaseVariable() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation($Variable: String) { - allAnimals { - species - } - } - """ - - let expected = - """ - public var variable: GraphQLNullable - - public init(variable: GraphQLNullable) { - self.variable = variable - } - - public var __variables: Variables? { ["Variable": variable] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: Variables - Reserved Keywords + Special Names - - func test__generate__givenQueryWithSwiftReservedKeywordNames_generatesQueryOperationWithVariablesBackticked() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - intField: Int! - } - """ - - document = """ - query TestOperation( - $as: String - $associatedtype: String - $break: String - $case: String - $catch: String - $class: String - $continue: String - $default: String - $defer: String - $deinit: String - $do: String - $else: String - $enum: String - $extension: String - $fallthrough: String - $false: String - $fileprivate: String - $for: String - $func: String - $guard: String - $if: String - $import: String - $in: String - $init: String - $inout: String - $internal: String - $is: String - $let: String - $nil: String - $operator: String - $precedencegroup: String - $private: String - $protocol: String - $public: String - $repeat: String - $rethrows: String - $return: String - $static: String - $struct: String - $subscript: String - $super: String - $switch: String - $throw: String - $throws: String - $true: String - $try: String - $typealias: String - $var: String - $where: String - $while: String - ) { - allAnimals { - species - } - } - """ - - let expected = - """ - public var `as`: GraphQLNullable - public var `associatedtype`: GraphQLNullable - public var `break`: GraphQLNullable - public var `case`: GraphQLNullable - public var `catch`: GraphQLNullable - public var `class`: GraphQLNullable - public var `continue`: GraphQLNullable - public var `default`: GraphQLNullable - public var `defer`: GraphQLNullable - public var `deinit`: GraphQLNullable - public var `do`: GraphQLNullable - public var `else`: GraphQLNullable - public var `enum`: GraphQLNullable - public var `extension`: GraphQLNullable - public var `fallthrough`: GraphQLNullable - public var `false`: GraphQLNullable - public var `fileprivate`: GraphQLNullable - public var `for`: GraphQLNullable - public var `func`: GraphQLNullable - public var `guard`: GraphQLNullable - public var `if`: GraphQLNullable - public var `import`: GraphQLNullable - public var `in`: GraphQLNullable - public var `init`: GraphQLNullable - public var `inout`: GraphQLNullable - public var `internal`: GraphQLNullable - public var `is`: GraphQLNullable - public var `let`: GraphQLNullable - public var `nil`: GraphQLNullable - public var `operator`: GraphQLNullable - public var `precedencegroup`: GraphQLNullable - public var `private`: GraphQLNullable - public var `protocol`: GraphQLNullable - public var `public`: GraphQLNullable - public var `repeat`: GraphQLNullable - public var `rethrows`: GraphQLNullable - public var `return`: GraphQLNullable - public var `static`: GraphQLNullable - public var `struct`: GraphQLNullable - public var `subscript`: GraphQLNullable - public var `super`: GraphQLNullable - public var `switch`: GraphQLNullable - public var `throw`: GraphQLNullable - public var `throws`: GraphQLNullable - public var `true`: GraphQLNullable - public var `try`: GraphQLNullable - public var `typealias`: GraphQLNullable - public var `var`: GraphQLNullable - public var `where`: GraphQLNullable - public var `while`: GraphQLNullable - - public init( - `as`: GraphQLNullable, - `associatedtype`: GraphQLNullable, - `break`: GraphQLNullable, - `case`: GraphQLNullable, - `catch`: GraphQLNullable, - `class`: GraphQLNullable, - `continue`: GraphQLNullable, - `default`: GraphQLNullable, - `defer`: GraphQLNullable, - `deinit`: GraphQLNullable, - `do`: GraphQLNullable, - `else`: GraphQLNullable, - `enum`: GraphQLNullable, - `extension`: GraphQLNullable, - `fallthrough`: GraphQLNullable, - `false`: GraphQLNullable, - `fileprivate`: GraphQLNullable, - `for`: GraphQLNullable, - `func`: GraphQLNullable, - `guard`: GraphQLNullable, - `if`: GraphQLNullable, - `import`: GraphQLNullable, - `in`: GraphQLNullable, - `init`: GraphQLNullable, - `inout`: GraphQLNullable, - `internal`: GraphQLNullable, - `is`: GraphQLNullable, - `let`: GraphQLNullable, - `nil`: GraphQLNullable, - `operator`: GraphQLNullable, - `precedencegroup`: GraphQLNullable, - `private`: GraphQLNullable, - `protocol`: GraphQLNullable, - `public`: GraphQLNullable, - `repeat`: GraphQLNullable, - `rethrows`: GraphQLNullable, - `return`: GraphQLNullable, - `static`: GraphQLNullable, - `struct`: GraphQLNullable, - `subscript`: GraphQLNullable, - `super`: GraphQLNullable, - `switch`: GraphQLNullable, - `throw`: GraphQLNullable, - `throws`: GraphQLNullable, - `true`: GraphQLNullable, - `try`: GraphQLNullable, - `typealias`: GraphQLNullable, - `var`: GraphQLNullable, - `where`: GraphQLNullable, - `while`: GraphQLNullable - ) { - self.`as` = `as` - self.`associatedtype` = `associatedtype` - self.`break` = `break` - self.`case` = `case` - self.`catch` = `catch` - self.`class` = `class` - self.`continue` = `continue` - self.`default` = `default` - self.`defer` = `defer` - self.`deinit` = `deinit` - self.`do` = `do` - self.`else` = `else` - self.`enum` = `enum` - self.`extension` = `extension` - self.`fallthrough` = `fallthrough` - self.`false` = `false` - self.`fileprivate` = `fileprivate` - self.`for` = `for` - self.`func` = `func` - self.`guard` = `guard` - self.`if` = `if` - self.`import` = `import` - self.`in` = `in` - self.`init` = `init` - self.`inout` = `inout` - self.`internal` = `internal` - self.`is` = `is` - self.`let` = `let` - self.`nil` = `nil` - self.`operator` = `operator` - self.`precedencegroup` = `precedencegroup` - self.`private` = `private` - self.`protocol` = `protocol` - self.`public` = `public` - self.`repeat` = `repeat` - self.`rethrows` = `rethrows` - self.`return` = `return` - self.`static` = `static` - self.`struct` = `struct` - self.`subscript` = `subscript` - self.`super` = `super` - self.`switch` = `switch` - self.`throw` = `throw` - self.`throws` = `throws` - self.`true` = `true` - self.`try` = `try` - self.`typealias` = `typealias` - self.`var` = `var` - self.`where` = `where` - self.`while` = `while` - } - - public var __variables: Variables? { [ - "as": `as`, - "associatedtype": `associatedtype`, - "break": `break`, - "case": `case`, - "catch": `catch`, - "class": `class`, - "continue": `continue`, - "default": `default`, - "defer": `defer`, - "deinit": `deinit`, - "do": `do`, - "else": `else`, - "enum": `enum`, - "extension": `extension`, - "fallthrough": `fallthrough`, - "false": `false`, - "fileprivate": `fileprivate`, - "for": `for`, - "func": `func`, - "guard": `guard`, - "if": `if`, - "import": `import`, - "in": `in`, - "init": `init`, - "inout": `inout`, - "internal": `internal`, - "is": `is`, - "let": `let`, - "nil": `nil`, - "operator": `operator`, - "precedencegroup": `precedencegroup`, - "private": `private`, - "protocol": `protocol`, - "public": `public`, - "repeat": `repeat`, - "rethrows": `rethrows`, - "return": `return`, - "static": `static`, - "struct": `struct`, - "subscript": `subscript`, - "super": `super`, - "switch": `switch`, - "throw": `throw`, - "throws": `throws`, - "true": `true`, - "try": `try`, - "typealias": `typealias`, - "var": `var`, - "where": `where`, - "while": `while` - ] } - """ - - // when - try buildSubjectAndOperation() - - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test__generate__givenInputObjectUsingReservedKeyword_rendersAsEscapedType() throws { - // given - schemaSDL = """ - input Type { - id: String! - } - - type Query { - getUser(type: Type!): User - } - - type User { - id: String! - name: String! - role: String! - } - """ - - document = """ - query TestOperation($type: Type!) { - getUser(type: $type) { - name - } - } - """ - - let expectedOne = """ - public var type: Type_InputObject - """ - - let expectedTwo = """ - public init(type: Type_InputObject) { - """ - - // when - try buildSubjectAndOperation() - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expectedOne, atLine: 8, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedTwo, atLine: 10, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplate_DocumentType_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplate_DocumentType_Tests.swift deleted file mode 100644 index 9c9a434153..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplate_DocumentType_Tests.swift +++ /dev/null @@ -1,501 +0,0 @@ -import XCTest -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class OperationDefinitionTemplate_DocumentType_Tests: XCTestCase { - - var config: ApolloCodegenConfiguration! - var definition: CompilationResult.OperationDefinition! - var referencedFragments: OrderedSet! - var operationIdentifier: String! - - override func setUp() { - super.setUp() - definition = CompilationResult.OperationDefinition.mock() - } - - override func tearDown() { - super.tearDown() - config = nil - definition = nil - referencedFragments = nil - operationIdentifier = nil - } - - func buildConfig( - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .swiftPackageManager, - operations: ApolloCodegenConfiguration.OperationsFileOutput = .inSchemaModule, - operationDocumentFormat: ApolloCodegenConfiguration.OperationDocumentFormat = .definition, - cocoapodsCompatibleImportStatements: Bool = false - ) { - config = .mock( - output: .mock(moduleType: moduleType, operations: operations), - options: .init( - operationDocumentFormat: operationDocumentFormat, - cocoapodsCompatibleImportStatements: cocoapodsCompatibleImportStatements - ) - ) - } - - func renderDocumentType() throws -> String { - let config = ApolloCodegen.ConfigurationContext(config: config) - let mockTemplateRenderer = MockTemplateRenderer( - target: .operationFile, - template: "", - config: config - ) - - return OperationDefinitionTemplate.DocumentType.render( - try XCTUnwrap(definition), - identifier: operationIdentifier, - fragments: referencedFragments ?? [], - config: config, - accessControlRenderer: mockTemplateRenderer.accessControlModifier(for: .member) - ).description - } - - // MARK: Query string formatting tests - - func test__generate__givenSingleLineFormat_generatesWithOperationDefinition() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - operationDocumentFormat: .definition - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query NameQuery { name }"# - )) - """ - expect(actual).to(equalLineByLine(expected)) - } - - func test__generate__givenSingleLineFormat_withInLineQuotes_generatesWithOperationDefinition_withInLineQuotes() throws { - // given - definition.source = - """ - query NameQuery($filter: String = "MyName") { - name - } - """ - - buildConfig( - operationDocumentFormat: .definition - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query NameQuery($filter: String = "MyName") { name }"# - )) - """ - expect(actual).to(equalLineByLine(expected)) - } - - func test__generate__givenIncludesFragment_formatSingleLine_generatesWithOperationDefinitionAndFragment() throws { - // given - referencedFragments = [ - .mock("NameFragment"), - ] - - definition.source = - """ - query NameQuery { - ...NameFragment - } - """ - - buildConfig( - operationDocumentFormat: .definition - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query NameQuery { ...NameFragment }"#, - fragments: [NameFragment.self] - )) - """ - expect(actual).to(equalLineByLine(expected)) - } - - func test__generate__givenIncludesFragment_fragmentNameStartsWithLowercase_generatesWithOperationDefinitionAndFragment_withFirstUppercased() throws { - // given - referencedFragments = [ - .mock("nameFragment"), - ] - - definition.source = - """ - query NameQuery { - ...nameFragment - } - """ - - buildConfig( - operationDocumentFormat: .definition - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query NameQuery { ...nameFragment }"#, - fragments: [NameFragment.self] - )) - """ - expect(actual).to(equalLineByLine(expected)) - } - - func test__generate__givenIncludesManyFragments_formatSingleLine_generatesWithOperationDefinitionAndFragment() throws { - // given - referencedFragments = [ - .mock("Fragment1"), - .mock("Fragment2"), - .mock("Fragment3"), - .mock("Fragment4"), - .mock("FragmentWithLongName1234123412341234123412341234"), - ] - - definition.source = - """ - query NameQuery { - ...Fragment1 - ...Fragment2 - ...Fragment3 - ...Fragment4 - ...FragmentWithLongName1234123412341234123412341234 - } - """ - - buildConfig( - operationDocumentFormat: .definition - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - definition: .init( - #"query NameQuery { ...Fragment1 ...Fragment2 ...Fragment3 ...Fragment4 ...FragmentWithLongName1234123412341234123412341234 }"#, - fragments: [Fragment1.self, Fragment2.self, Fragment3.self, Fragment4.self, FragmentWithLongName1234123412341234123412341234.self] - )) - """ - expect(actual).to(equalLineByLine(expected)) - } - - func test__generate__givenAPQ_automaticallyPersist_generatesWithOperationDefinitionAndIdentifier() throws { - // given - operationIdentifier = "1ec89997a185c50bacc5f62ad41f27f3070f4a950d72e4a1510a4c64160812d5" - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - operationDocumentFormat: [.definition, .operationId] - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "1ec89997a185c50bacc5f62ad41f27f3070f4a950d72e4a1510a4c64160812d5", - definition: .init( - #\"query NameQuery { name }\"# - )) - """ - expect(actual).to(equalLineByLine(expected)) - } - - func test__generate__givenAPQ_persistedOperationsOnly_generatesWithIdentifierOnly() throws { - // given - operationIdentifier = "1ec89997a185c50bacc5f62ad41f27f3070f4a950d72e4a1510a4c64160812d5" - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - operationDocumentFormat: .operationId - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - operationIdentifier: "1ec89997a185c50bacc5f62ad41f27f3070f4a950d72e4a1510a4c64160812d5" - ) - """ - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Namespacing tests - - func test__generate__givenCocoapodsCompatibleImportStatements_true_shouldUseCorrectNamespace() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - cocoapodsCompatibleImportStatements: true - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: Apollo.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__generate__givenCocoapodsCompatibleImportStatements_false_shouldUseCorrectNamespace() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - cocoapodsCompatibleImportStatements: false - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Access Level Tests - - func test__accessLevel__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsInSchemaModule_shouldRenderWithPublicAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .swiftPackageManager, - operations: .inSchemaModule - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__accessLevel__givenQuery_whenModuleTypeIsEmbeddedInTargetWithPublicAccessModifier_andOperationsInSchemaModule_shouldRenderWithPublicAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .public), - operations: .inSchemaModule - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__accessLevel__givenQuery_whenModuleTypeIsEmbeddedInTargetWithInternalAccessModifier_andOperationsInSchemaModule_shouldRenderWithInternalAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .internal), - operations: .inSchemaModule - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__accessLevel__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsRelativeWithPublicAccessModifier_shouldRenderWithPublicAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil, accessModifier: .public) - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__accessLevel__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsRelativeWithInternalAccessModifier_shouldRenderWithInternalAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil, accessModifier: .internal) - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__accessLevel__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsAbsoluteWithPublicAccessModifier_shouldRenderWithPublicAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .swiftPackageManager, - operations: .absolute(path: "", accessModifier: .public) - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - public static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__accessLevel__givenQuery_whenModuleTypeIsSwiftPackageManager_andOperationsAbsoluteWithInternalAccessModifier_shouldRenderWithInternalAccess() throws { - // given - definition.source = - """ - query NameQuery { - name - } - """ - - buildConfig( - moduleType: .swiftPackageManager, - operations: .absolute(path: "", accessModifier: .internal) - ) - - // when - let actual = try renderDocumentType() - - // then - let expected = - """ - static let operationDocument: ApolloAPI.OperationDocument = .init( - """ - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinition_VariableDefinition_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinition_VariableDefinition_Tests.swift deleted file mode 100644 index 5d4a918441..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinition_VariableDefinition_Tests.swift +++ /dev/null @@ -1,729 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class OperationDefinition_VariableDefinition_Tests: XCTestCase { - - var subject: CompilationResult.VariableDefinition! - var template: OperationDefinitionTemplate! - - override func tearDown() { - subject = nil - template = nil - - super.tearDown() - } - - private func buildTemplate( - configOutput: ApolloCodegenConfiguration.FileOutput = .mock(), - options: ApolloCodegenConfiguration.OutputOptions = .init() - ) { - template = OperationDefinitionTemplate( - operation: .mock(), - config: .init(config: .mock(output: configOutput, options: options)) - ) - } - - func test__renderOperationVariableProperty_givenDefaultValue_generatesCorrectParameterNoInitializerDefault() throws { - // given - subject = .mock("variable", type: .scalar(.string()), defaultValue: .string("Value")) - - let expected = "public var variable: GraphQLNullable" - - // when - buildTemplate() - let actual = template.VariableProperties([subject]).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableProperty_givenAllUppercaseVariableName_generatesCorrectlyCasedVariable() throws { - // given - subject = .mock("VARIABLE", type: .string(), defaultValue: nil) - - let expected = "public var variable: GraphQLNullable" - - // when - buildTemplate() - let actual = template.VariableProperties([subject]).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableProperty_givenMixedCaseVariableName_generatesCorrectlyCasedVariable() throws { - // given - subject = .mock("VariableName", type: .string(), defaultValue: nil) - - let expected = "public var variableName: GraphQLNullable" - - // when - buildTemplate() - let actual = template.VariableProperties([subject]).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter_givenAllUppercaseVariableName_generatesCorrectlyCasedVariable() throws { - // given - subject = .mock("VARIABLE", type: .string(), defaultValue: nil) - - let expected = "variable: GraphQLNullable" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter_givenMixedCaseVariableName_generatesCorrectlyCasedVariable() throws { - // given - subject = .mock("VariableName", type: .string(), defaultValue: nil) - - let expected = "variableName: GraphQLNullable" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableAccessor_givenAllUppercaseVariableName_generatesCorrectlyCasedVariable() throws { - // given - subject = .mock("VARIABLE", type: .string(), defaultValue: nil) - - let expected = "public var __variables: Variables? { [\"VARIABLE\": variable] }" - - // when - buildTemplate() - let actual = template.VariableAccessors([subject]).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableAccessor_givenMixedCaseVariableName_generatesCorrectlyCasedVariable() throws { - // given - subject = .mock("VariableName", type: .string(), defaultValue: nil) - - let expected = "public var __variables: Variables? { [\"VariableName\": variableName] }" - - // when - buildTemplate() - let actual = template.VariableAccessors([subject]).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter_includeDefaultTrue__givenAllInputFieldTypes_nilDefaultValues__generatesCorrectParametersWithoutInitializer() throws { - // given - let tests: [(variable: CompilationResult.VariableDefinition, expected: String)] = [ - ( - .mock( - "stringField", - type: .scalar(.string()), - defaultValue: nil - ), - "stringField: GraphQLNullable" - ), - ( - .mock( - "intField", - type: .scalar(.integer()), - defaultValue: nil - ), - "intField: GraphQLNullable" - ), - ( - .mock( - "boolField", - type: .scalar(.boolean()), - defaultValue: nil - ), - "boolField: GraphQLNullable" - ), - ( - .mock( - "floatField", - type: .scalar(.float()), - defaultValue: nil - ), - "floatField: GraphQLNullable" - ), - ( - .mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: nil - ), - "enumField: GraphQLNullable>" - ), - ( - .mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - GraphQLInputField.mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: nil - ), - "inputField: GraphQLNullable" - ), - ( - .mock( - "listField", - type: .list(.scalar(.string())), - defaultValue: nil - ), - "listField: GraphQLNullable<[String?]>" - ) - ] - - for test in tests { - // when - buildTemplate() - let actual = template.VariableParameter(test.variable).description - - // then - expect(actual).to(equal(test.expected)) - } - } - - func test__renderOperationVariableParameter__givenAllInputFieldTypes_withDefaultValues__generatesCorrectParametersWithInitializer() throws { - // given - let tests: [(variable: CompilationResult.VariableDefinition, expected: String)] = [ - ( - .mock( - "stringField", - type: .scalar(.string()), - defaultValue: .string("Value") - ), - "stringField: GraphQLNullable = \"Value\"" - ), - ( - .mock( - "stringFieldNullDefaultValue", - type: .scalar(.string()), - defaultValue: .null - ), - "stringFieldNullDefaultValue: GraphQLNullable = .null" - ), - ( - .mock( - "intField", - type: .scalar(.integer()), - defaultValue: .int(300) - ), - "intField: GraphQLNullable = 300" - ), - ( - .mock( - "boolField", - type: .scalar(.boolean()), - defaultValue: .boolean(true) - ), - "boolField: GraphQLNullable = true" - ), - ( - .mock( - "boolField", - type: .scalar(.boolean()), - defaultValue: .boolean(false) - ), - "boolField: GraphQLNullable = false" - ), - ( - .mock( - "floatField", - type: .scalar(.float()), - defaultValue: .float(12.3943) - ), - "floatField: GraphQLNullable = 12.3943" - ), - ( - .mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: .enum("CaseONE") - ), - "enumField: GraphQLNullable> = .init(.caseONE)" - ), - ( - .mock( - "enumField", - type: .nonNull(.enum(.mock(name: "EnumValue"))), - defaultValue: .enum("CaseONE") - ), - "enumField: GraphQLEnum = .init(.caseONE)" - ), - ( - .mock( - "listField", - type: .list(.scalar(.string())), - defaultValue: .list([.string("1"), .string("2")]) - ), - """ - listField: GraphQLNullable<[String?]> = ["1", "2"] - """ - ), - ( - .mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - .mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: .object(["innerStringField": .string("Value")]) - ), - """ - inputField: GraphQLNullable = .init( - TestSchema.InnerInputObject(innerStringField: "Value") - ) - """ - ), - ] - - for test in tests { - // when - buildTemplate() - let actual = template.VariableParameter(test.variable).description - - // then - expect(actual).to(equal(test.expected)) - } - } - - func test__renderOperationVariableParameter__givenInputFieldType_withDefaultValue__generatesCorrectParametersWithInitializer_withNamespaceWhenRequired() throws { - // given - let variable: CompilationResult.VariableDefinition = .mock( - "inputField", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - .mock("innerStringField", type: .scalar(.string()), defaultValue: nil) - ] - )), - defaultValue: .object(["innerStringField": .string("Value")]) - ) - - let expectedWithNamespace = """ - inputField: GraphQLNullable = .init( - TestSchema.InnerInputObject(innerStringField: "Value") - ) - """ - - let expectedNoNamespace = """ - inputField: GraphQLNullable = .init( - InnerInputObject(innerStringField: "Value") - ) - """ - - let tests: [(config: ApolloCodegenConfiguration.FileOutput, expected: String)] = [ - (.mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil)), expectedWithNamespace), - (.mock(moduleType: .swiftPackageManager, operations: .absolute(path: "custom")), expectedWithNamespace), - (.mock(moduleType: .swiftPackageManager, operations: .inSchemaModule), expectedNoNamespace), - (.mock(moduleType: .other, operations: .relative(subpath: nil)), expectedWithNamespace), - (.mock(moduleType: .other, operations: .absolute(path: "custom")), expectedWithNamespace), - (.mock(moduleType: .other, operations: .inSchemaModule), expectedNoNamespace), - (.mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .relative(subpath: nil)), expectedWithNamespace), - (.mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .absolute(path: "custom")), expectedWithNamespace), - (.mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .inSchemaModule), expectedNoNamespace) - ] - - for test in tests { - // when - buildTemplate(configOutput: test.config) - let actual = template.VariableParameter(variable).description - - // then - expect(actual).to(equal(test.expected)) - } - } - - func test__renderOperationVariableParameter_includeDefaultTrue__givenNullable_nestedInputObject_withDefaultValues__generatesCorrectParametersWithInitializer() throws { - // given - subject = .mock( - "inputField", - type: .inputObject(.mock( - "InputObject", - fields: [ - .mock("innerStringField", type: .scalar(.string()), defaultValue: nil), - .mock("innerIntField", type: .scalar(.integer()), defaultValue: nil), - .mock("innerFloatField", type: .scalar(.float()), defaultValue: nil), - .mock("innerBoolField", type: .scalar(.boolean()), defaultValue: nil), - .mock("innerListField", type: .list(.scalar(.string())), defaultValue: nil), - .mock("innerEnumField", type: .enum(.mock(name: "EnumValue")), defaultValue: nil), - .mock("innerInputObject", - type: .inputObject(.mock( - "InnerInputObject", - fields: [ - .mock("innerStringField", type: .scalar(.string()), defaultValue: nil), - .mock("innerListField", type: .list(.enum(.mock(name: "EnumList"))), defaultValue: nil), - .mock("innerIntField", type: .scalar(.integer()), defaultValue: nil), - .mock("innerEnumField", type: .enum(.mock(name: "EnumValue")), defaultValue: nil), - ] - )), - defaultValue: nil - ) - ] - )), - defaultValue: .object([ - "innerStringField": .string("ABCD"), - "innerIntField": .int(123), - "innerFloatField": .float(12.3456), - "innerBoolField": .boolean(true), - "innerListField": .list([.string("A"), .string("B")]), - "innerEnumField": .enum("CaseONE"), - "innerInputObject": .object([ - "innerStringField": .string("EFGH"), - "innerListField": .list([.enum("CaseTwo"), .enum("CaseThree")]), - ]) - ]) - ) - - let expected = """ - inputField: GraphQLNullable = .init( - TestSchema.InputObject( - innerStringField: "ABCD", - innerIntField: 123, - innerFloatField: 12.3456, - innerBoolField: true, - innerListField: ["A", "B"], - innerEnumField: .init(.caseONE), - innerInputObject: .init( - TestSchema.InnerInputObject( - innerStringField: "EFGH", - innerListField: [.init(.caseTwo), .init(.caseThree)] - ) - ) - ) - ) - """ - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__renderOperationVariableParameter_includeDefaultTrue__givenNotNullable_nestedInputObject_withDefaultValues__generatesCorrectParametersWithInitializer() throws { - // given - subject = .mock( - "inputField", - type: .nonNull(.inputObject(.mock( - "InputObject", - fields: [ - .mock("innerStringField", type: .scalar(.string()), defaultValue: nil), - .mock("innerIntField", type: .scalar(.integer()), defaultValue: nil), - .mock("innerFloatField", type: .scalar(.float()), defaultValue: nil), - .mock("innerBoolField", type: .scalar(.boolean()), defaultValue: nil), - .mock("innerListField", type: .list(.scalar(.string())), defaultValue: nil), - .mock("innerEnumField", type: .enum(.mock(name: "EnumValue")), defaultValue: nil), - .mock("innerInputObject", - type: .nonNull(.inputObject(.mock( - "InnerInputObject", - fields: [ - .mock("innerStringField", type: .scalar(.string()), defaultValue: nil), - .mock("innerListField", type: .list(.enum(.mock(name: "EnumList"))), defaultValue: nil), - .mock("innerIntField", type: .scalar(.integer()), defaultValue: nil), - .mock("innerEnumField", type: .enum(.mock(name: "EnumValue")), defaultValue: nil), - ] - ))), - defaultValue: nil - ) - ] - ))), - defaultValue: .object([ - "innerStringField": .string("ABCD"), - "innerIntField": .int(123), - "innerFloatField": .float(12.3456), - "innerBoolField": .boolean(true), - "innerListField": .list([.string("A"), .string("B")]), - "innerEnumField": .enum("CaseONE"), - "innerInputObject": .object([ - "innerStringField": .string("EFGH"), - "innerListField": .list([.enum("CaseTwo"), .enum("CaseThree")]), - ]) - ]) - ) - - let expected = """ - inputField: TestSchema.InputObject = TestSchema.InputObject( - innerStringField: "ABCD", - innerIntField: 123, - innerFloatField: 12.3456, - innerBoolField: true, - innerListField: ["A", "B"], - innerEnumField: .init(.caseONE), - innerInputObject: TestSchema.InnerInputObject( - innerStringField: "EFGH", - innerListField: [.init(.caseTwo), .init(.caseThree)] - ) - ) - """ - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__renderOperationVariableParameter__givenEnumCaseConversion_default_givenEnumField_withDefaultValue__generatesCorrectParametersWithInitializer() throws { - // given - let tests: [(variable: CompilationResult.VariableDefinition, expected: String)] = [ - ( - .mock( - "enumField", - type: .enum(.mock(name: "EnumValue")), - defaultValue: .enum("CaseONE") - ), - "enumField: GraphQLNullable> = .init(.CaseONE)" - ), - ( - .mock( - "enumField", - type: .nonNull(.enum(.mock(name: "EnumValue"))), - defaultValue: .enum("CaseONE") - ), - "enumField: GraphQLEnum = .init(.CaseONE)" - ), - ] - - for test in tests { - // when - buildTemplate(options: .init(conversionStrategies: .init(enumCases: .none))) - let actual = template.VariableParameter(test.variable).description - - // then - expect(actual).to(equal(test.expected)) - } - } - - // MARK: Nullable Field Tests - - func test__renderOperationVariableParameter__given_NullableField_NoDefault__generates_NullableParameter_Initializer() throws { - // given - subject = .mock("nullable", type: .scalar(.integer()), defaultValue: nil) - - let expected = "nullable: GraphQLNullable" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableField_WithDefault__generates_NullableParameter_NoInitializerDefault() throws { - // given - subject = .mock("nullableWithDefault", type: .scalar(.integer()), defaultValue: .int(3)) - - let expected = "nullableWithDefault: GraphQLNullable = 3" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NonNullableField_NoDefault__generates_NonNullableNonOptionalParameter_NoInitializerDefault() throws { - // given - subject = .mock("nonNullable", type: .nonNull(.scalar(.integer())), defaultValue: nil) - - let expected = "nonNullable: Int" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NonNullableField_WithDefault__generates_NonNullableNonOptionalParameter_WithInitializerDefault() throws { - // given - subject = .mock("nonNullableWithDefault", type: .nonNull(.scalar(.integer())), defaultValue: .int(3)) - - let expected = "nonNullableWithDefault: Int = 3" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableList_NullableItem_NoDefault__generates_NullableParameter_OptionalItem_NoInitializerDefault() throws { - // given - subject = .mock("nullableListNullableItem", type: .list(.scalar(.string())), defaultValue: nil) - - let expected = "nullableListNullableItem: GraphQLNullable<[String?]>" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableList_NullableItem_WithDefault__generates_NullableParameter_OptionalItem_WithInitializerDefault() throws { - // given - subject = .mock("nullableListNullableItemWithDefault", - type: .list(.scalar(.string())), - defaultValue: .list([.string("val")])) - - let expected = "nullableListNullableItemWithDefault: GraphQLNullable<[String?]> = [\"val\"]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableList_NullableItem_WithDefault_includingNullElement_generates_NullableParameter_OptionalItem_WithInitializerDefault() throws { - // given - subject = .mock("nullableListNullableItemWithDefault", - type: .list(.scalar(.string())), - defaultValue: .list([.string("val"), .null])) - - let expected = "nullableListNullableItemWithDefault: GraphQLNullable<[String?]> = [\"val\", nil]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableList_NonNullableItem_NoDefault__generates_NullableParameter_NonOptionalItem_NoInitializerDefault() throws { - // given - subject = .mock("nullableListNonNullableItem", - type: .list(.nonNull(.scalar(.string()))), - defaultValue: nil) - - let expected = "nullableListNonNullableItem: GraphQLNullable<[String]>" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableList_NonNullableItem_WithDefault__generates_NullableParameter_NonOptionalItem_WithInitializerDefault() throws { - // given - subject = .mock("nullableListNonNullableItemWithDefault", type: .list(.nonNull(.scalar(.string()))), defaultValue: .list([.string("val")])) - - let expected = "nullableListNonNullableItemWithDefault: GraphQLNullable<[String]> = [\"val\"]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NonNullableList_NullableItem_NoDefault__generates_NonNullableNonOptionalParameter_OptionalItem_NoInitializerDefault() throws { - // given - subject = .mock("nonNullableListNullableItem", type: .nonNull(.list(.scalar(.string()))), defaultValue: nil) - - let expected = "nonNullableListNullableItem: [String?]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NonNullableList_NullableItem_WithDefault__generates_OptionalParameter_OptionalItem_WithInitializerDefault() throws { - // given - subject = .mock("nonNullableListNullableItemWithDefault", - type: .nonNull(.list(.scalar(.string()))), - defaultValue: .list([.string("val")])) - - let expected = "nonNullableListNullableItemWithDefault: [String?] = [\"val\"]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NonNullableList_NonNullableItem_NoDefault__generates_NonNullableNonOptionalParameter_NonOptionalItem_NoInitializerDefault() throws { - // given - subject = .mock("nonNullableListNonNullableItem", - type: .nonNull(.list(.nonNull(.scalar(.string())))), - defaultValue: nil) - - let expected = "nonNullableListNonNullableItem: [String]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NonNullableList_NonNullableItem_WithDefault__generates_OptionalParameter_NonOptionalItem_WithInitializerDefault() throws { - // given - subject = .mock("nonNullableListNonNullableItemWithDefault", - type: .nonNull(.list(.nonNull(.scalar(.string())))), - defaultValue: .list([.string("val")])) - - let expected = "nonNullableListNonNullableItemWithDefault: [String] = [\"val\"]" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - - func test__renderOperationVariableParameter__given_NullableListOfNullableEnum_NoDefault__generates_NullableParameter_OptionalItem_NoInitializerNilDefault() throws { - // given - subject = .mock("nullableListNullableItem", - type: .list(.enum(.mock(name: "EnumValue"))), - defaultValue: nil) - - let expected = "nullableListNullableItem: GraphQLNullable<[GraphQLEnum?]>" - - // when - buildTemplate() - let actual = template.VariableParameter(subject).description - - // then - expect(actual).to(equal(expected)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/PersistedQueriesOperationManifestTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/PersistedQueriesOperationManifestTemplateTests.swift deleted file mode 100644 index 73e58738f1..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/PersistedQueriesOperationManifestTemplateTests.swift +++ /dev/null @@ -1,224 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class PersistedQueriesOperationManifestTemplateTests: XCTestCase { - var subject: PersistedQueriesOperationManifestTemplate! - - override func setUp() { - super.setUp() - - subject = PersistedQueriesOperationManifestTemplate(config: .init(config: .mock())) - } - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: Render tests - - func test__render__givenSingleOperation_shouldOutputJSONFormat() throws { - // given - let operation = IR.Operation.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - ) - - let expected = """ - { - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "8ed9fcbb8ef3c853ad0ecdc920eb8216608bd7c3b32258744e9289ec0372eb30", - "body": "query TestQuery { test }", - "name": "TestQuery", - "type": "query" - } - ] - } - """ - - let operations = [operation].map(OperationManifestItem.init) - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenMultipleOperations_shouldOutputJSONFormat() throws { - // given - let operations = [ - IR.Operation.mock( - name: "TestQuery", - type: .query, - source: """ - query TestQuery { - test - } - """ - ), - IR.Operation.mock( - name: "TestMutation", - type: .mutation, - source: """ - mutation TestMutation { - update { - result - } - } - """ - ), - IR.Operation.mock( - name: "TestSubscription", - type: .subscription, - source: """ - subscription TestSubscription { - watched - } - """ - ) - ].map(OperationManifestItem.init) - - let expected = """ - { - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "8ed9fcbb8ef3c853ad0ecdc920eb8216608bd7c3b32258744e9289ec0372eb30", - "body": "query TestQuery { test }", - "name": "TestQuery", - "type": "query" - }, - { - "id": "551253009bea9350463d15e24660e8a935abc858cd161623234fb9523b0c0717", - "body": "mutation TestMutation { update { result } }", - "name": "TestMutation", - "type": "mutation" - }, - { - "id": "9b56a2829263b4d81b4eb9865470a6971c8e40e126e2ff92db51f15d0a4cb7ba", - "body": "subscription TestSubscription { watched }", - "name": "TestSubscription", - "type": "subscription" - } - ] - } - """ - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenReferencedFragments_shouldOutputJSONFormat() throws { - // given - let operations = [ - IR.Operation.mock( - name: "Friends", - type: .query, - source: """ - query Friends { - friends { - ...Name - } - } - """, - referencedFragments: [ - .mock( - "Name", - type: .mock(), - source: """ - fragment Name on Friend { - name - } - """ - ) - ] - ) - ].map(OperationManifestItem.init) - - let expected = #""" - { - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "efc7785ac9768b2be96e061911b97c9c898df41561dda36d9435e94994910f67", - "body": "query Friends { friends { ...Name } }\nfragment Name on Friend { name }", - "name": "Friends", - "type": "query" - } - ] - } - """# - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equalLineByLine(expected)) - } - - func test__render__givenOperations_shouldOutputJSONFormatBodyFormatted() throws { - // given - subject = PersistedQueriesOperationManifestTemplate( - config: .init(config: .mock()) - ) - - let operations = [ - IR.Operation.mock( - name: "Friends", - type: .query, - source: """ - query Friends { - friends { - ...Name - } - } - """, - referencedFragments: [ - .mock( - "Name", - type: .mock(), - source: """ - fragment Name on Friend { - name - } - """ - ) - ] - ) - ].map(OperationManifestItem.init) - - let expected = #""" - { - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "efc7785ac9768b2be96e061911b97c9c898df41561dda36d9435e94994910f67", - "body": "query Friends { friends { ...Name } }\nfragment Name on Friend { name }", - "name": "Friends", - "type": "query" - } - ] - } - """# - - // when - let rendered = subject.render(operations: operations) - - expect(rendered).to(equalLineByLine(expected)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaConfigurationTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaConfigurationTemplateTests.swift deleted file mode 100644 index 8f3c3e91aa..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaConfigurationTemplateTests.swift +++ /dev/null @@ -1,145 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class SchemaConfigurationTemplateTests: XCTestCase { - var subject: SchemaConfigurationTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - name: String = "testSchema", - config: ApolloCodegenConfiguration = ApolloCodegenConfiguration.mock(.swiftPackageManager) - ) { - subject = SchemaConfigurationTemplate( - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderTemplate() -> String { - subject.template.description - } - - private func renderDetachedTemplate() -> String? { - subject.detachedTemplate?.description - } - - // MARK: Header Tests - - func test__render_header__rendersEditableHeaderTemplateWithReason() throws { - // given - let expected = """ - // @generated - // This file was automatically generated and can be edited to - // provide custom configuration for a generated GraphQL schema. - // - // Any changes to this file will not be overwritten by future - // code generation execution. - - """ - - buildSubject() - // when - - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: Boilerplate Tests - - func test__render__rendersTemplate() throws { - // given - let expected = """ - public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } - } - - """ - - buildSubject() - // when - - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: false)) - } - - // MARK: Access Level Tests - - func test__render__givenModuleEmbeddedInTarget_withPublicAccessModifier_rendersTemplate_withPublicAccess() throws { - // given - let expected = """ - enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } - } - - """ - - buildSubject(config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .public))) - // when - - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: false)) - } - - func test__render__givenModuleEmbeddedInTarget_withInternalAccessModifier_rendersTemplate_withInternalAccess() throws { - // given - let expected = """ - enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } - } - - """ - - buildSubject(config: .mock(.embeddedInTarget(name: "TestTarget", accessModifier: .internal))) - // when - - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: false)) - } - - func test__render_givenCocoapodsCompatibleImportStatements_true__rendersTemplateWithApolloTargetName() throws { - // given - let expected = """ - enum SchemaConfiguration: Apollo.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - // Implement this function to configure cache key resolution for your schema types. - return nil - } - } - - """ - - buildSubject(config: .mock(options: .init(cocoapodsCompatibleImportStatements: true))) - // when - - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: false)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaMetadataTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaMetadataTemplateTests.swift deleted file mode 100644 index 0124a86658..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaMetadataTemplateTests.swift +++ /dev/null @@ -1,606 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class SchemaMetadataTemplateTests: XCTestCase { - var subject: SchemaMetadataTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - referencedTypes: IR.Schema.ReferencedTypes = .init([]), - documentation: String? = nil, - config: ApolloCodegenConfiguration = ApolloCodegenConfiguration.mock() - ) { - subject = SchemaMetadataTemplate( - schema: IR.Schema(referencedTypes: referencedTypes, documentation: documentation), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderTemplate() -> String { - subject.template.description - } - - private func renderDetachedTemplate() -> String? { - subject.detachedTemplate?.description - } - - // MARK: Typealias & Protocol Tests - - func test__render__givenModuleEmbeddedInTarget_withInternalAccessModifier_shouldGenerateIDTypealias_withInternalAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "CustomTarget", accessModifier: .internal))) - - let expected = """ - typealias ID = String - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleEmbeddedInTarget_withPublicAccessModifier_shouldGenerateIDTypealias_withPublicAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "CustomTarget", accessModifier: .public))) - - let expected = """ - typealias ID = String - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleSwiftPackageManager_shouldGenerateIDTypealias_withPublicAccess() { - // given - buildSubject(config: .mock(.swiftPackageManager)) - - let expected = """ - public typealias ID = String - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleOther_shouldGenerateIDTypealias_withPublicAccess() { - // given - buildSubject(config: .mock(.other)) - - let expected = """ - public typealias ID = String - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenModuleEmbeddedInTarget_withInternalAccessModifier_shouldGenerateDetachedProtocols_withTypealias_withCorrectCasing_withInternalAccess() { - // given - buildSubject( - config: .mock( - .embeddedInTarget(name: "CustomTarget", accessModifier: .internal), - schemaNamespace: "aName" - ) - ) - - let expectedTemplate = """ - typealias SelectionSet = AName_SelectionSet - - typealias InlineFragment = AName_InlineFragment - - typealias MutableSelectionSet = AName_MutableSelectionSet - - typealias MutableInlineFragment = AName_MutableInlineFragment - - """ - - let expectedDetached = """ - protocol AName_SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet - where Schema == AName.SchemaMetadata {} - - protocol AName_InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - - protocol AName_MutableSelectionSet: ApolloAPI.MutableRootSelectionSet - where Schema == AName.SchemaMetadata {} - - protocol AName_MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - """ - - // when - let actualTemplate = renderTemplate() - let actualDetached = renderDetachedTemplate() - - // then - expect(actualTemplate) - .to(equalLineByLine(expectedTemplate, atLine: 3, ignoringExtraLines: true)) - expect(actualDetached) - .to(equalLineByLine(expectedDetached)) - } - - func test__render__givenModuleEmbeddedInTarget_withPublicAccessModifier_shouldGenerateDetachedProtocols_withTypealias_withCorrectCasing_withPublicAccess() { - // given - buildSubject( - config: .mock( - .embeddedInTarget(name: "CustomTarget", accessModifier: .public), - schemaNamespace: "aName" - ) - ) - - let expectedTemplate = """ - typealias SelectionSet = AName_SelectionSet - - typealias InlineFragment = AName_InlineFragment - - typealias MutableSelectionSet = AName_MutableSelectionSet - - typealias MutableInlineFragment = AName_MutableInlineFragment - - """ - - let expectedDetached = """ - public protocol AName_SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol AName_InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - - public protocol AName_MutableSelectionSet: ApolloAPI.MutableRootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol AName_MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - """ - - // when - let actualTemplate = renderTemplate() - let actualDetached = renderDetachedTemplate() - - // then - expect(actualTemplate) - .to(equalLineByLine(expectedTemplate, atLine: 3, ignoringExtraLines: true)) - expect(actualDetached) - .to(equalLineByLine(expectedDetached)) - } - - func test__render__givenModuleSwiftPackageManager_shouldGenerateEmbeddedProtocols_noTypealias_withCorrectCasing_withPublicModifier() { - // given - buildSubject( - config: .mock( - .swiftPackageManager, - schemaNamespace: "aName" - ) - ) - - let expectedTemplate = """ - public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - - public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - """ - - // when - let actualTemplate = renderTemplate() - let actualDetached = renderDetachedTemplate() - - // then - expect(actualTemplate) - .to(equalLineByLine(expectedTemplate, atLine: 3, ignoringExtraLines: true)) - expect(actualDetached) - .to(beNil()) - } - - func test__render__givenModuleOther_shouldGenerateEmbeddedProtocols_noTypealias_withCorrectCasing_withPublicModifier() { - // given - buildSubject( - config: .mock( - .other, - schemaNamespace: "aName" - ) - ) - - let expectedTemplate = """ - public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - - public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment - where Schema == AName.SchemaMetadata {} - """ - - // when - let actualTemplate = renderTemplate() - let actualDetached = renderDetachedTemplate() - - // then - expect(actualTemplate) - .to(equalLineByLine(expectedTemplate, atLine: 3, ignoringExtraLines: true)) - expect(actualDetached) - .to(beNil()) - } - - func test__render__given_cocoapodsCompatibleImportStatements_true_shouldGenerateEmbeddedProtocols_withApolloTargetName() { - // given - buildSubject( - config: .mock( - .other, - options: .init(cocoapodsCompatibleImportStatements: true), - schemaNamespace: "aName" - ) - ) - - let expectedTemplate = """ - public protocol SelectionSet: Apollo.SelectionSet & Apollo.RootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol InlineFragment: Apollo.SelectionSet & Apollo.InlineFragment - where Schema == AName.SchemaMetadata {} - - public protocol MutableSelectionSet: Apollo.MutableRootSelectionSet - where Schema == AName.SchemaMetadata {} - - public protocol MutableInlineFragment: Apollo.MutableSelectionSet & Apollo.InlineFragment - where Schema == AName.SchemaMetadata {} - """ - - // when - let actualTemplate = renderTemplate() - let actualDetached = renderDetachedTemplate() - - // then - expect(actualTemplate) - .to(equalLineByLine(expectedTemplate, atLine: 3, ignoringExtraLines: true)) - expect(actualDetached) - .to(beNil()) - } - - // MARK: Schema Tests - - func test__render__givenModuleEmbeddedInTarget_withInternalAccessModifier_shouldGenerateEnumDefinition_withInternalAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "MockTarget", accessModifier: .internal))) - - let expected = """ - enum SchemaMetadata: ApolloAPI.SchemaMetadata { - static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 11, ignoringExtraLines: true)) - } - - func test__render__givenModuleEmbeddedInTarget_withPublicAccessModifier_shouldGenerateEnumDefinition_withPublicAccess() { - // given - buildSubject(config: .mock(.embeddedInTarget(name: "MockTarget", accessModifier: .public))) - - let expected = """ - enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 11, ignoringExtraLines: true)) - } - - func test__render__givenModuleSwiftPackageManager_shouldGenerateEnumDefinition_withPublicModifier() { - // given - buildSubject(config: .mock(.swiftPackageManager)) - - let expected = """ - public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 15, ignoringExtraLines: true)) - } - - func test__render__givenModuleOther_shouldGenerateEnumDefinition_withPublicModifier() { - // given - buildSubject(config: .mock(.other)) - - let expected = """ - public enum SchemaMetadata: ApolloAPI.SchemaMetadata { - public static let configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 15, ignoringExtraLines: true)) - } - - func test__render__givenCocoapodsCompatibleImportStatements_true_shouldGenerateEnumDefinition_withApolloTargetName() { - // given - buildSubject(config: .mock(options: .init(cocoapodsCompatibleImportStatements: true))) - - let expected = """ - enum SchemaMetadata: Apollo.SchemaMetadata { - static let configuration: Apollo.SchemaConfiguration.Type = SchemaConfiguration.self - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 11, ignoringExtraLines: true)) - } - - func test__render__givenWithReferencedObjects_generatesObjectTypeFunctionCorrectlyCased() { - // given - buildSubject( - referencedTypes: .init([ - GraphQLObjectType.mock("objA"), - GraphQLObjectType.mock("objB"), - GraphQLObjectType.mock("objC"), - ]), - config: .mock(schemaNamespace: "objectSchema") - ) - - let expected = """ - static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "objA": return ObjectSchema.Objects.ObjA - case "objB": return ObjectSchema.Objects.ObjB - case "objC": return ObjectSchema.Objects.ObjC - default: return nil - } - } - } - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render__givenWithReferencedOtherTypes_generatesObjectTypeNotIncludingNonObjectTypesFunction() { - // given - buildSubject( - referencedTypes: .init([ - GraphQLObjectType.mock("ObjectA"), - GraphQLInterfaceType.mock("InterfaceB"), - GraphQLUnionType.mock("UnionC"), - GraphQLScalarType.mock(name: "ScalarD"), - GraphQLEnumType.mock(name: "EnumE"), - GraphQLInputObjectType.mock("InputObjectC"), - ]), - config: .mock(schemaNamespace: "ObjectSchema") - ) - - let expected = """ - static func objectType(forTypename typename: String) -> Object? { - switch typename { - case "ObjectA": return ObjectSchema.Objects.ObjectA - default: return nil - } - } - } - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render__givenModuleEmbeddedInTarget_withInternalAccessModifier_rendersTypeNamespaceEnums_withInternalAccess() { - // given - buildSubject( - referencedTypes: .init([ - GraphQLObjectType.mock("ObjectA"), - GraphQLInterfaceType.mock("InterfaceB"), - GraphQLUnionType.mock("UnionC"), - GraphQLScalarType.mock(name: "ScalarD"), - GraphQLEnumType.mock(name: "EnumE"), - GraphQLInputObjectType.mock("InputObjectC"), - ]), - config: .mock( - .embeddedInTarget(name: "TestTarget", accessModifier: .internal), - schemaNamespace: "ObjectSchema" - ) - ) - - let expected = """ - enum Objects {} - enum Interfaces {} - enum Unions {} - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 22)) - } - - func test__render__givenModuleEmbeddedInTarget_withPublicAccessModifier_rendersTypeNamespaceEnums_withPublicAccess() { - // given - buildSubject( - referencedTypes: .init([ - GraphQLObjectType.mock("ObjectA"), - GraphQLInterfaceType.mock("InterfaceB"), - GraphQLUnionType.mock("UnionC"), - GraphQLScalarType.mock(name: "ScalarD"), - GraphQLEnumType.mock(name: "EnumE"), - GraphQLInputObjectType.mock("InputObjectC"), - ]), - config: .mock( - .embeddedInTarget(name: "TestTarget", accessModifier: .public), - schemaNamespace: "ObjectSchema" - ) - ) - - let expected = """ - enum Objects {} - enum Interfaces {} - enum Unions {} - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 22)) - } - - func test__render__givenModuleSwiftPackageManager_rendersTypeNamespaceEnums_withPublicAccess() { - // given - buildSubject( - referencedTypes: .init([ - GraphQLObjectType.mock("ObjectA"), - GraphQLInterfaceType.mock("InterfaceB"), - GraphQLUnionType.mock("UnionC"), - GraphQLScalarType.mock(name: "ScalarD"), - GraphQLEnumType.mock(name: "EnumE"), - GraphQLInputObjectType.mock("InputObjectC"), - ]), - config: .mock( - .swiftPackageManager, - schemaNamespace: "ObjectSchema" - ) - ) - - let expected = """ - public enum Objects {} - public enum Interfaces {} - public enum Unions {} - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 26)) - } - - func test__render__givenModuleOther_rendersTypeNamespaceEnums_withPublicAccess() { - // given - buildSubject( - referencedTypes: .init([ - GraphQLObjectType.mock("ObjectA"), - GraphQLInterfaceType.mock("InterfaceB"), - GraphQLUnionType.mock("UnionC"), - GraphQLScalarType.mock(name: "ScalarD"), - GraphQLEnumType.mock(name: "EnumE"), - GraphQLInputObjectType.mock("InputObjectC"), - ]), - config: .mock( - .other, - schemaNamespace: "ObjectSchema" - ) - ) - - let expected = """ - public enum Objects {} - public enum Interfaces {} - public enum Unions {} - - """ - - // when - let actual = renderTemplate() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 26)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - enum SchemaMetadata: ApolloAPI.SchemaMetadata { - """ - - // when - let rendered = renderTemplate() - - // then - expect(rendered).to(equalLineByLine(expected, atLine: 11, ignoringExtraLines: true)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .exclude)) - ) - - let expected = """ - enum SchemaMetadata: ApolloAPI.SchemaMetadata { - """ - - // when - let rendered = renderTemplate() - - // then - expect(rendered).to(equalLineByLine(expected, atLine: 11, ignoringExtraLines: true)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaModuleNamespaceTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaModuleNamespaceTemplateTests.swift deleted file mode 100644 index 8f7a797c28..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SchemaModuleNamespaceTemplateTests.swift +++ /dev/null @@ -1,102 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -import Nimble -import ApolloInternalTestHelpers - -class SchemaModuleNamespaceTemplateTests: XCTestCase { - - // MARK: Casing Tests - - func test__render__givenLowercaseSchemaName_generatesCapitalizedEnum() throws { - // given - let expected = """ - enum Schema { } - - """ - - // when - let subject = SchemaModuleNamespaceTemplate( - config: .init(config: .mock(schemaNamespace: "schema")) - ) - let actual = subject.template.description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenUppercaseSchemaName_generatesUppercasedEnum() throws { - // given - let expected = """ - enum SCHEMA { } - - """ - - // when - let subject = SchemaModuleNamespaceTemplate( - config: .init(config: .mock(schemaNamespace: "SCHEMA")) - ) - let actual = subject.template.description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenCapitalizedSchemaName_generatesCapitalizedEnum() throws { - // given - let expected = """ - enum MySchema { } - - """ - - // when - let subject = SchemaModuleNamespaceTemplate( - config: .init(config: .mock(schemaNamespace: "MySchema")) - ) - let actual = subject.template.description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Access Level Tests - - func test__render__givenModuleEmbeddedInTarget_withInternalModifier_rendersTemplate_withInternalAccess() throws { - // given - let expected = """ - enum MySchema { } - - """ - - // when - let subject = SchemaModuleNamespaceTemplate( - config: .init(config: .mock( - schemaNamespace: "MySchema", - output: .mock(moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .internal)) - )) - ) - let actual = subject.template.description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__render__givenModuleEmbeddedInTarget_withPublicModifier_rendersTemplate_withPublicAccess() throws { - // given - let expected = """ - public enum MySchema { } - - """ - - // when - let subject = SchemaModuleNamespaceTemplate( - config: .init(config: .mock( - schemaNamespace: "MySchema", - output: .mock(moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .public)) - )) - ) - let actual = subject.template.description - - // then - expect(actual).to(equalLineByLine(expected)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift deleted file mode 100644 index 8a67dcfa7d..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift +++ /dev/null @@ -1,7073 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class SelectionSetTemplateTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: IR.Operation! - var subject: SelectionSetTemplate! - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - operation = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - func buildSubjectAndOperation( - named operationName: String = "TestOperation", - configOutput: ApolloCodegenConfiguration.FileOutput = .mock(), - inflectionRules: [ApolloCodegenLib.InflectionRule] = [], - schemaDocumentation: ApolloCodegenConfiguration.Composition = .exclude, - warningsOnDeprecatedUsage: ApolloCodegenConfiguration.Composition = .exclude, - conversionStrategies: ApolloCodegenConfiguration.ConversionStrategies = .init(), - cocoapodsImportStatements: Bool = false - ) throws { - ir = try .mock(schema: schemaSDL, document: document) - let operationDefinition = try XCTUnwrap(ir.compilationResult[operation: operationName]) - operation = ir.build(operation: operationDefinition) - let config = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: "TestSchema", - output: configOutput, - options: .init( - additionalInflectionRules: inflectionRules, - schemaDocumentation: schemaDocumentation, - cocoapodsCompatibleImportStatements: cocoapodsImportStatements, - warningsOnDeprecatedUsage: warningsOnDeprecatedUsage, - conversionStrategies: conversionStrategies - ) - )) - let mockTemplateRenderer = MockTemplateRenderer( - target: .operationFile, - template: "", - config: config - ) - subject = SelectionSetTemplate( - definition: .operation(self.operation), - generateInitializers: false, - config: config, - renderAccessControl: mockTemplateRenderer.accessControlModifier(for: .member) - ) - } - - // MARK: - Tests - - func test__render_rendersClosingBracket() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(String(actual.reversed())).to(equalLineByLine("}", ignoringExtraLines: true)) - } - - // MARK: Parent Type - - func test__render_parentType__givenParentTypeAs_Object_rendersParentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Animal } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_parentType__givenParentTypeAs_Interface_rendersParentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Interfaces.Animal } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_parentType__givenParentTypeAs_Union_rendersParentType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Dog { - species: String! - } - - union Animal = Dog - """ - - document = """ - query TestOperation { - allAnimals { - ... on Dog { - species - } - } - } - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Unions.Animal } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_parentType__givenCocoapodsImportStatements_true_rendersParentTypeWithApolloNamespace() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Dog { - species: String! - } - - union Animal = Dog - """ - - document = """ - query TestOperation { - allAnimals { - ... on Dog { - species - } - } - } - """ - - let expected = """ - public static var __parentType: Apollo.ParentType { TestSchema.Unions.Animal } - """ - - // when - try buildSubjectAndOperation(cocoapodsImportStatements: true) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - // MARK: - Selections - - func test__render_selections__givenCocoapodsImportStatements_true_rendersSelectionsWithApolloNamespace() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - FieldName: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - FieldName - } - } - """ - - let expected = """ - public static var __selections: [Apollo.Selection] { [ - .field("__typename", String.self), - .field("FieldName", String.self), - ] } - """ - - // when - try buildSubjectAndOperation(cocoapodsImportStatements: true) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenNilDirectSelections_doesNotRenderSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Dog { - species: String! - nested: Nested! - } - - type Nested { - a: Int! - b: Int! - } - - interface Animal { - nested: Nested! - } - """ - - document = """ - query TestOperation { - allAnimals { - nested { - a - } - ... on Dog { - species - } - } - } - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Nested } - - """ - - // when - try buildSubjectAndOperation() - let asDog_Nested = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "nested"] as? IR.EntityField - ) - - let actual = subject.render(field: asDog_Nested) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_selections__givenCustomRootTypes_doesNotGenerateTypenameField() throws { - // given - schemaSDL = """ - schema { - query: RootQueryType - mutation: RootMutationType - } - - type RootQueryType { - allAnimals: [Animal!] - } - - type RootMutationType { - feedAnimal: Animal! - } - - type Animal { - FieldName: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - FieldName - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal]?.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Selections - Fields - - func test__render_selections__givenScalarFieldSelections_rendersAllFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - string_optional: String - int: Int! - int_optional: Int - float: Float! - float_optional: Float - boolean: Boolean! - boolean_optional: Boolean - custom: Custom! - custom_optional: Custom - custom_required_list: [Custom!]! - custom_optional_list: [Custom!] - list_required_required: [String!]! - list_optional_required: [String!] - list_required_optional: [String]! - list_optional_optional: [String] - nestedList_required_required_required: [[String!]!]! - nestedList_required_required_optional: [[String]!]! - nestedList_required_optional_optional: [[String]]! - nestedList_required_optional_required: [[String!]]! - nestedList_optional_required_required: [[String!]!] - nestedList_optional_required_optional: [[String]!] - nestedList_optional_optional_required: [[String!]] - nestedList_optional_optional_optional: [[String]] - } - - scalar Custom - """ - - document = """ - query TestOperation { - allAnimals { - string - string_optional - int - int_optional - float - float_optional - boolean - boolean_optional - custom - custom_optional - custom_required_list - custom_optional_list - list_required_required - list_optional_required - list_required_optional - list_optional_optional - nestedList_required_required_required - nestedList_required_required_optional - nestedList_required_optional_optional - nestedList_required_optional_required - nestedList_optional_required_required - nestedList_optional_required_optional - nestedList_optional_optional_required - nestedList_optional_optional_optional - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("string", String.self), - .field("string_optional", String?.self), - .field("int", Int.self), - .field("int_optional", Int?.self), - .field("float", Double.self), - .field("float_optional", Double?.self), - .field("boolean", Bool.self), - .field("boolean_optional", Bool?.self), - .field("custom", TestSchema.Custom.self), - .field("custom_optional", TestSchema.Custom?.self), - .field("custom_required_list", [TestSchema.Custom].self), - .field("custom_optional_list", [TestSchema.Custom]?.self), - .field("list_required_required", [String].self), - .field("list_optional_required", [String]?.self), - .field("list_required_optional", [String?].self), - .field("list_optional_optional", [String?]?.self), - .field("nestedList_required_required_required", [[String]].self), - .field("nestedList_required_required_optional", [[String?]].self), - .field("nestedList_required_optional_optional", [[String?]?].self), - .field("nestedList_required_optional_required", [[String]?].self), - .field("nestedList_optional_required_required", [[String]]?.self), - .field("nestedList_optional_required_optional", [[String?]]?.self), - .field("nestedList_optional_optional_required", [[String]?]?.self), - .field("nestedList_optional_optional_optional", [[String?]?]?.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenAllUppercase_generatesCorrectCasing() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - FIELDNAME: String - } - """ - - document = """ - query TestOperation { - allAnimals { - FIELDNAME - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("FIELDNAME", String?.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenCustomScalar_rendersFieldSelectionsWithNamespaceInAllConfigurations() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - custom: Custom! - custom_optional: Custom - custom_required_list: [Custom!]! - custom_optional_list: [Custom!] - lowercaseCustom: lowercaseCustom! - } - - scalar Custom - scalar lowercaseCustom - """ - - document = """ - query TestOperation { - allAnimals { - custom - custom_optional - custom_required_list - custom_optional_list - lowercaseCustom - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("custom", TestSchema.Custom.self), - .field("custom_optional", TestSchema.Custom?.self), - .field("custom_required_list", [TestSchema.Custom].self), - .field("custom_optional_list", [TestSchema.Custom]?.self), - .field("lowercaseCustom", TestSchema.LowercaseCustom.self), - ] } - """ - - let tests: [ApolloCodegenConfiguration.FileOutput] = [ - .mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .inSchemaModule), - .mock(moduleType: .other, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .other, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .other, operations: .inSchemaModule), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .inSchemaModule) - ] - - for test in tests { - // when - try buildSubjectAndOperation(configOutput: test) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - } - - func test__render_selections__givenEnumField_rendersFieldSelectionsWithNamespaceInAllConfigurations() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - testEnum: TestEnum! - testEnumOptional: TestEnumOptional - lowercaseEnum: lowercaseEnum! - } - - enum TestEnum { - CASE_ONE - } - - enum TestEnumOptional { - CASE_ONE - } - - enum lowercaseEnum { - CASE_ONE - } - """ - - document = """ - query TestOperation { - allAnimals { - testEnum - testEnumOptional - lowercaseEnum - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("testEnum", GraphQLEnum.self), - .field("testEnumOptional", GraphQLEnum?.self), - .field("lowercaseEnum", GraphQLEnum.self), - ] } - """ - - let tests: [ApolloCodegenConfiguration.FileOutput] = [ - .mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .inSchemaModule), - .mock(moduleType: .other, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .other, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .other, operations: .inSchemaModule), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .inSchemaModule) - ] - - for test in tests { - // when - try buildSubjectAndOperation(configOutput: test) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - } - - func test__render_selections__givenFieldWithUppercasedName_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - FieldName: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - FieldName - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("FieldName", String.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFieldWithAlias_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - aliased: string - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("string", alias: "aliased", String.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenEntityFieldWithNameNotMatchingType_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - predator: Animal! - lowercaseType: lowercaseType! - species: String! - } - - type lowercaseType { - a: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - lowercaseType { - a - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("predator", Predator.self), - .field("lowercaseType", LowercaseType.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Selections - Fields - Reserved Keywords & Special Names - - func test__render_selections__givenFieldsWithSwiftReservedKeywordNames_rendersFieldsNotBacktickEscaped() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - associatedtype: String! - class: String! - deinit: String! - enum: String! - extension: String! - fileprivate: String! - func: String! - import: String! - init: String! - inout: String! - internal: String! - let: String! - operator: String! - private: String! - precedencegroup: String! - protocol: String! - Protocol: String! - public: String! - rethrows: String! - static: String! - struct: String! - subscript: String! - typealias: String! - var: String! - break: String! - case: String! - catch: String! - continue: String! - default: String! - defer: String! - do: String! - else: String! - fallthrough: String! - for: String! - guard: String! - if: String! - in: String! - repeat: String! - return: String! - throw: String! - switch: String! - where: String! - while: String! - as: String! - false: String! - is: String! - nil: String! - self: String! - Self: String! - super: String! - throws: String! - true: String! - try: String! - _: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - associatedtype - class - deinit - enum - extension - fileprivate - func - import - init - inout - internal - let - operator - private - precedencegroup - protocol - Protocol - public - rethrows - static - struct - subscript - typealias - var - break - case - catch - continue - default - defer - do - else - fallthrough - for - guard - if - in - repeat - return - throw - switch - where - while - as - false - is - nil - self - Self - super - throws - true - try - _ - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("associatedtype", String.self), - .field("class", String.self), - .field("deinit", String.self), - .field("enum", String.self), - .field("extension", String.self), - .field("fileprivate", String.self), - .field("func", String.self), - .field("import", String.self), - .field("init", String.self), - .field("inout", String.self), - .field("internal", String.self), - .field("let", String.self), - .field("operator", String.self), - .field("private", String.self), - .field("precedencegroup", String.self), - .field("protocol", String.self), - .field("Protocol", String.self), - .field("public", String.self), - .field("rethrows", String.self), - .field("static", String.self), - .field("struct", String.self), - .field("subscript", String.self), - .field("typealias", String.self), - .field("var", String.self), - .field("break", String.self), - .field("case", String.self), - .field("catch", String.self), - .field("continue", String.self), - .field("default", String.self), - .field("defer", String.self), - .field("do", String.self), - .field("else", String.self), - .field("fallthrough", String.self), - .field("for", String.self), - .field("guard", String.self), - .field("if", String.self), - .field("in", String.self), - .field("repeat", String.self), - .field("return", String.self), - .field("throw", String.self), - .field("switch", String.self), - .field("where", String.self), - .field("while", String.self), - .field("as", String.self), - .field("false", String.self), - .field("is", String.self), - .field("nil", String.self), - .field("self", String.self), - .field("Self", String.self), - .field("super", String.self), - .field("throws", String.self), - .field("true", String.self), - .field("try", String.self), - .field("_", String.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenEntityFieldWithUnderscorePrefixedName_rendersFieldSelectionsWithTypeFirstUppercased() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - _oneUnderscore: Animal! - __twoUnderscore: Animal! - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - _oneUnderscore { - species - } - __twoUnderscore { - species - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("_oneUnderscore", _OneUnderscore.self), - .field("__twoUnderscore", __TwoUnderscore.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenEntityFieldWithSwiftKeywordAndApolloReservedTypeNames_rendersFieldSelectionsWithTypeNameSuffixed() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - self: Animal! - parentType: Animal! - dataDict: Animal! - documentType: Animal! - selection: Animal! - schema: Animal! - fragmentContainer: Animal! - string: Animal! - bool: Animal! - int: Animal! - float: Animal! - double: Animal! - iD: Animal! - any: Animal! - protocol: Animal! - type: Animal! - species: String! - _: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - self { - species - } - parentType { - species - } - dataDict { - species - } - documentType { - species - } - selection { - species - } - schema { - species - } - fragmentContainer { - species - } - string { - species - } - bool { - species - } - int { - species - } - float { - species - } - double { - species - } - iD { - species - } - any { - species - } - protocol { - species - } - type { - species - } - _ { - species - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("self", Self_SelectionSet.self), - .field("parentType", ParentType_SelectionSet.self), - .field("dataDict", DataDict_SelectionSet.self), - .field("documentType", DocumentType_SelectionSet.self), - .field("selection", Selection_SelectionSet.self), - .field("schema", Schema_SelectionSet.self), - .field("fragmentContainer", FragmentContainer_SelectionSet.self), - .field("string", String_SelectionSet.self), - .field("bool", Bool_SelectionSet.self), - .field("int", Int_SelectionSet.self), - .field("float", Float_SelectionSet.self), - .field("double", Double_SelectionSet.self), - .field("iD", ID_SelectionSet.self), - .field("any", Any_SelectionSet.self), - .field("protocol", Protocol_SelectionSet.self), - .field("type", Type_SelectionSet.self), - .field("_", __SelectionSet.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Selections - Fields - Arguments - - func test__render_selections__givenFieldWithArgumentWithConstantValue_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string(variable: Int): String! - } - """ - - document = """ - query TestOperation { - allAnimals { - aliased: string(variable: 3) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("string", alias: "aliased", String.self, arguments: ["variable": 3]), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFieldWithArgumentWithNullConstantValue_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string(variable: Int): String! - } - """ - - document = """ - query TestOperation { - allAnimals { - aliased: string(variable: null) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("string", alias: "aliased", String.self, arguments: ["variable": .null]), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFieldWithArgumentWithVariableValue_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string(variable: Int): String! - } - """ - - document = """ - query TestOperation($var: Int) { - allAnimals { - aliased: string(variable: $var) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("string", alias: "aliased", String.self, arguments: ["variable": .variable("var")]), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFieldWithArgumentOfInputObjectTypeWithNullableFields_withConstantValues_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string(input: TestInput): String! - } - - input TestInput { - string: String - int: Int - float: Float - bool: Boolean - list: [String] - enum: TestEnum - innerInput: InnerInput - } - - input InnerInput { - string: String - enumList: [TestEnum] - } - - enum TestEnum { - CaseOne - CaseTwo - } - """ - - document = """ - query TestOperation { - allAnimals { - aliased: string(input: { - string: "ABCD", - int: 3, - float: 123.456, - bool: true, - list: ["A", "B"], - enum: CaseOne, - innerInput: { - string: "EFGH", - enumList: [CaseOne, CaseTwo] - } - }) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("string", alias: "aliased", String.self, arguments: ["input": [ - "string": "ABCD", - "int": 3, - "float": 123.456, - "bool": true, - "list": ["A", "B"], - "enum": "CaseOne", - "innerInput": [ - "string": "EFGH", - "enumList": ["CaseOne", "CaseTwo"] - ] - ]]), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Selections - Type Cases - - func test__render_selections__givenTypeCases_rendersTypeCaseSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - } - - interface Pet { - int: Int! - } - - interface lowercaseInterface { - int: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - int - } - ... on lowercaseInterface { - int - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .inlineFragment(AsPet.self), - .inlineFragment(AsLowercaseInterface.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Selections - Fragments - - func test__render_selections__givenFragments_rendersFragmentSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...FragmentA - ...lowercaseFragment - } - } - - fragment FragmentA on Animal { - int - } - - fragment lowercaseFragment on Animal { - string - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .fragment(FragmentA.self), - .fragment(LowercaseFragment.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Selections - Include/Skip - - func test__render_selections__givenFieldWithIncludeCondition_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - fieldName @include(if: $a) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "a", .field("fieldName", String.self)), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFieldWithSkipCondition_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($b: Boolean!) { - allAnimals { - fieldName @skip(if: $b) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: !"b", .field("fieldName", String.self)), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFieldWithMultipleConditions_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($b: Boolean!) { - allAnimals { - fieldName @skip(if: $b) @include(if: $a) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: !"b" && "a", .field("fieldName", String.self)), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenMergedFieldsWithMultipleConditions_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($b: Boolean!) { - allAnimals { - fieldName @skip(if: $b) @include(if: $a) - fieldName @skip(if: $c) - fieldName @include(if: $d) @skip(if: $e) - fieldName @include(if: $f) - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: (!"b" && "a") || !"c" || ("d" && !"e") || "f", .field("fieldName", String.self)), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenMultipleSelectionsWithSameIncludeConditions_rendersFieldSelections() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - fieldB: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - fieldA @include(if: $a) - fieldB @include(if: $a) - ... on Pet @include(if: $a) { - fieldA - } - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - fieldA - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "a", [ - .field("fieldA", String.self), - .field("fieldB", String.self), - .inlineFragment(AsPetIfA.self), - .inlineFragment(IfA.self), - ]), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFragmentWithNonMatchingTypeAndInclusionCondition_rendersTypeCaseSelectionWithInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - - type Pet { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Pet { - int - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "a", .inlineFragment(AsPetIfA.self)), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenInlineFragmentOnSameTypeWithConditions_rendersInlineFragmentSelectionSetAccessorWithCorrectName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... on Animal @include(if: $a) { - fieldA - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .include(if: "a", .inlineFragment(IfA.self)), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenFragmentWithInclusionConditionThatMatchesScope_rendersFragmentSelectionWithoutInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - - type Pet { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Pet { - int - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .fragment(FragmentA.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet", if: "a"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: Selections - __typename Selection - - func test__render_selections__givenEntityRootSelectionSet_rendersTypenameSelection() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - fieldName - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("fieldName", String.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenInlineFragment_doesNotRenderTypenameSelection() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - - interface Pet { - fieldName: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - fieldName - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("fieldName", String.self), - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render_selections__givenOperationRootSelectionSet_doesNotRenderTypenameSelection() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!]! - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - fieldName - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("allAnimals", [AllAnimal].self), - ] } - """ - - // when - try buildSubjectAndOperation() - let queryRoot = try XCTUnwrap( - operation[field: "query"] as? IR.EntityField - ) - - let actual = subject.render(field: queryRoot) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: Merged Sources - - func test__render_mergedSources__givenMergedTypeCasesFromSingleMergedTypeCaseSource_rendersMergedSources() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - name: String! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - predator { - ... on Pet { - name - } - } - ... on Dog { - name - predator { - species - } - } - } - } - """ - - let expected = """ - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - TestOperationQuery.Data.AllAnimal.Predator.AsPet.self, - TestOperationQuery.Data.AllAnimal.AsDog.Predator.self - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "predator"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asDog_predator_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__render_mergedSources__givenTypeCaseMergedFromFragmentWithOtherMergedFields_rendersMergedSources() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet { - favoriteToy: Item - } - - type Item { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...PredatorDetails - species - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - favoriteToy { - ...PetToy - } - } - } - - fragment PetToy on Item { - name - } - """ - - let expected = """ - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - TestOperationQuery.Data.AllAnimal.Predator.self, - PredatorDetails.AsPet.self - ] } - """ - - // when - try buildSubjectAndOperation() - let predator_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: predator_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - /// Test for edge case in [#2949](https://github.com/apollographql/apollo-ios/issues/2949) - /// - /// When the `MergedSource` would have duplicate naming, due to child fields with the same name - /// (or alias), the fully qualified name must be used. In this example, a `MergedSource` of - /// `Predator.Predator` the first usage of the name `Predator` would be referencing the nearest - /// enclosing type (ie. `TestOperationQuery.Predator.Predator`), so it is looking for another - /// `Predator` type in that scope, which does not exist - /// (ie. `TestOperationQuery.Predator.Predator.Predator`). - /// - /// To correct this we must always use the fully qualified name including the operation name and - /// `Data` objects to ensure we are referring to the correct type. - func test__render_mergedSources__givenMergedTypeCaseWithConflictingNames_rendersMergedSourceWithFullyQualifiedName() throws { - // given - schemaSDL = """ - type Query { - predators: [Animal!]! - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - name: String! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - predators { - species - predator { - ... on Pet { - name - } - } - ... on Dog { - name - predator { - species - } - } - } - } - """ - - let expected = """ - public static var __mergedSources: [any ApolloAPI.SelectionSet.Type] { [ - TestOperationQuery.Data.Predator.Predator.AsPet.self, - TestOperationQuery.Data.Predator.AsDog.Predator.self - ] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "predators"]?[as: "Dog"]?[field: "predator"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asDog_predator_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - // MARK: - Field Accessors - Scalar - - func test__render_fieldAccessors__givenScalarFields_rendersAllFieldAccessors() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - string_optional: String - int: Int! - int_optional: Int - float: Float! - float_optional: Float - boolean: Boolean! - boolean_optional: Boolean - custom: Custom! - custom_optional: Custom - custom_required_list: [Custom!]! - custom_optional_list: [Custom!] - list_required_required: [String!]! - list_optional_required: [String!] - list_required_optional: [String]! - list_optional_optional: [String] - nestedList_required_required_required: [[String!]!]! - nestedList_required_required_optional: [[String]!]! - nestedList_required_optional_optional: [[String]]! - nestedList_required_optional_required: [[String!]]! - nestedList_optional_required_required: [[String!]!] - nestedList_optional_required_optional: [[String]!] - nestedList_optional_optional_required: [[String!]] - nestedList_optional_optional_optional: [[String]] - } - - scalar Custom - """ - - document = """ - query TestOperation { - allAnimals { - string - string_optional - int - int_optional - float - float_optional - boolean - boolean_optional - custom - custom_optional - custom_required_list - custom_optional_list - list_required_required - list_optional_required - list_required_optional - list_optional_optional - nestedList_required_required_required - nestedList_required_required_optional - nestedList_required_optional_optional - nestedList_required_optional_required - nestedList_optional_required_required - nestedList_optional_required_optional - nestedList_optional_optional_required - nestedList_optional_optional_optional - } - } - """ - - let expected = """ - public var string: String { __data["string"] } - public var string_optional: String? { __data["string_optional"] } - public var int: Int { __data["int"] } - public var int_optional: Int? { __data["int_optional"] } - public var float: Double { __data["float"] } - public var float_optional: Double? { __data["float_optional"] } - public var boolean: Bool { __data["boolean"] } - public var boolean_optional: Bool? { __data["boolean_optional"] } - public var custom: TestSchema.Custom { __data["custom"] } - public var custom_optional: TestSchema.Custom? { __data["custom_optional"] } - public var custom_required_list: [TestSchema.Custom] { __data["custom_required_list"] } - public var custom_optional_list: [TestSchema.Custom]? { __data["custom_optional_list"] } - public var list_required_required: [String] { __data["list_required_required"] } - public var list_optional_required: [String]? { __data["list_optional_required"] } - public var list_required_optional: [String?] { __data["list_required_optional"] } - public var list_optional_optional: [String?]? { __data["list_optional_optional"] } - public var nestedList_required_required_required: [[String]] { __data["nestedList_required_required_required"] } - public var nestedList_required_required_optional: [[String?]] { __data["nestedList_required_required_optional"] } - public var nestedList_required_optional_optional: [[String?]?] { __data["nestedList_required_optional_optional"] } - public var nestedList_required_optional_required: [[String]?] { __data["nestedList_required_optional_required"] } - public var nestedList_optional_required_required: [[String]]? { __data["nestedList_optional_required_required"] } - public var nestedList_optional_required_optional: [[String?]]? { __data["nestedList_optional_required_optional"] } - public var nestedList_optional_optional_required: [[String]?]? { __data["nestedList_optional_optional_required"] } - public var nestedList_optional_optional_optional: [[String?]?]? { __data["nestedList_optional_optional_optional"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 35, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenCustomScalarFields_rendersFieldAccessorsWithNamespaceWhenRequiredInAllConfigurations() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - custom: Custom! - custom_optional: Custom - custom_required_list: [Custom!]! - custom_optional_list: [Custom!] - lowercaseScalar: lowercaseScalar! - } - - scalar Custom - scalar lowercaseScalar - """ - - document = """ - query TestOperation { - allAnimals { - custom - custom_optional - custom_required_list - custom_optional_list - lowercaseScalar - } - } - """ - - let expected = """ - public var custom: TestSchema.Custom { __data["custom"] } - public var custom_optional: TestSchema.Custom? { __data["custom_optional"] } - public var custom_required_list: [TestSchema.Custom] { __data["custom_required_list"] } - public var custom_optional_list: [TestSchema.Custom]? { __data["custom_optional_list"] } - public var lowercaseScalar: TestSchema.LowercaseScalar { __data["lowercaseScalar"] } - """ - - let tests: [ApolloCodegenConfiguration.FileOutput] = [ - .mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .inSchemaModule), - .mock(moduleType: .other, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .other, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .other, operations: .inSchemaModule), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .inSchemaModule) - ] - - for test in tests { - // when - try buildSubjectAndOperation(configOutput: test) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - } - - func test__render_fieldAccessors__givenEnumField_rendersFieldAccessorsWithNamespacedInAllConfigurations() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - testEnum: TestEnum! - testEnumOptional: TestEnumOptional - lowercaseEnum: lowercaseEnum! - } - - enum TestEnum { - CASE_ONE - } - - enum TestEnumOptional { - CASE_ONE - } - - enum lowercaseEnum { - CASE_ONE - } - """ - - document = """ - query TestOperation { - allAnimals { - testEnum - testEnumOptional - lowercaseEnum - } - } - """ - - let expected = """ - public var testEnum: GraphQLEnum { __data["testEnum"] } - public var testEnumOptional: GraphQLEnum? { __data["testEnumOptional"] } - public var lowercaseEnum: GraphQLEnum { __data["lowercaseEnum"] } - """ - - let tests: [ApolloCodegenConfiguration.FileOutput] = [ - .mock(moduleType: .swiftPackageManager, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .swiftPackageManager, operations: .inSchemaModule), - .mock(moduleType: .other, operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .other, operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .other, operations: .inSchemaModule), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .relative(subpath: nil, accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget"), operations: .absolute(path: "custom", accessModifier: .public)), - .mock(moduleType: .embeddedInTarget(name: "CustomTarget", accessModifier: .public), operations: .inSchemaModule) - ] - - for test in tests { - // when - try buildSubjectAndOperation(configOutput: test) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - } - - func test__render_fieldAccessors__givenFieldWithUpperCaseName_rendersFieldAccessorWithLowercaseName() throws { - // given - schemaSDL = """ - type Query { - AllAnimals: [Animal!] - } - - type Animal { - FieldName: String! - } - - scalar Custom - """ - - document = """ - query TestOperation { - AllAnimals { - FieldName - } - } - """ - - let expected = """ - public var fieldName: String { __data["FieldName"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "AllAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenFieldWithAllUpperCaseName_rendersFieldAccessorWithLowercaseName() throws { - // given - schemaSDL = """ - type Query { - AllAnimals: [Animal!] - } - - type Animal { - FIELDNAME: String! - } - """ - - document = """ - query TestOperation { - AllAnimals { - FIELDNAME - } - } - """ - - let expected = """ - public var fieldname: String { __data["FIELDNAME"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "AllAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenFieldWithAlias_rendersAllFieldAccessors() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - } - - scalar Custom - """ - - document = """ - query TestOperation { - allAnimals { - aliasedFieldName: string - } - } - """ - - let expected = """ - public var aliasedFieldName: String { __data["aliasedFieldName"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenMergedScalarField_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - a: String! - } - - type Dog { - b: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - a - ... on Dog { - b - } - } - } - """ - - let expected = """ - public var b: String { __data["b"] } - public var a: String { __data["a"] } - """ - - // when - try buildSubjectAndOperation() - let dog = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"] - ) - - let actual = subject.render(inlineFragment: dog) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenFieldWithSnakeCaseName_rendersFieldAccessorAsCamelCase() throws { - // given - schemaSDL = """ - type Query { - AllAnimals: [Animal!] - } - - type Animal { - field_name: String! - } - """ - - document = """ - query TestOperation { - AllAnimals { - field_name - } - } - """ - - let expected = """ - public var fieldName: String { __data["field_name"] } - """ - - // when - try buildSubjectAndOperation(conversionStrategies: .init(fieldAccessors: .camelCase)) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "AllAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenFieldWithSnakeCaseUppercaseName_rendersFieldAccessorAsCamelCase() throws { - // given - schemaSDL = """ - type Query { - AllAnimals: [Animal!] - } - - type Animal { - FIELD_NAME: String! - } - """ - - document = """ - query TestOperation { - AllAnimals { - FIELD_NAME - } - } - """ - - let expected = """ - public var fieldName: String { __data["FIELD_NAME"] } - """ - - // when - try buildSubjectAndOperation(conversionStrategies: .init(fieldAccessors: .camelCase)) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "AllAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - // MARK: Field Accessors - Reserved Keywords + Special Names - - func test__render_fieldAccessors__givenFieldsWithSwiftReservedKeywordNames_rendersFieldsBacktickEscaped() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - associatedtype: String! - class: String! - deinit: String! - enum: String! - extension: String! - fileprivate: String! - func: String! - import: String! - init: String! - inout: String! - internal: String! - let: String! - operator: String! - private: String! - precedencegroup: String! - protocol: String! - Protocol: String! - public: String! - rethrows: String! - static: String! - struct: String! - subscript: String! - typealias: String! - var: String! - break: String! - case: String! - catch: String! - continue: String! - default: String! - defer: String! - do: String! - else: String! - fallthrough: String! - for: String! - guard: String! - if: String! - in: String! - repeat: String! - return: String! - throw: String! - switch: String! - where: String! - while: String! - as: String! - false: String! - is: String! - nil: String! - self: String! - Self: String! - super: String! - throws: String! - true: String! - try: String! - _: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - associatedtype - class - deinit - enum - extension - fileprivate - func - import - init - inout - internal - let - operator - private - precedencegroup - protocol - Protocol - public - rethrows - static - struct - subscript - typealias - var - break - case - catch - continue - default - defer - do - else - fallthrough - for - guard - if - in - repeat - return - throw - switch - where - while - as - false - is - nil - self - Self - super - throws - true - try - } - } - """ - - let expected = """ - public var `associatedtype`: String { __data["associatedtype"] } - public var `class`: String { __data["class"] } - public var `deinit`: String { __data["deinit"] } - public var `enum`: String { __data["enum"] } - public var `extension`: String { __data["extension"] } - public var `fileprivate`: String { __data["fileprivate"] } - public var `func`: String { __data["func"] } - public var `import`: String { __data["import"] } - public var `init`: String { __data["init"] } - public var `inout`: String { __data["inout"] } - public var `internal`: String { __data["internal"] } - public var `let`: String { __data["let"] } - public var `operator`: String { __data["operator"] } - public var `private`: String { __data["private"] } - public var `precedencegroup`: String { __data["precedencegroup"] } - public var `protocol`: String { __data["protocol"] } - public var `protocol`: String { __data["Protocol"] } - public var `public`: String { __data["public"] } - public var `rethrows`: String { __data["rethrows"] } - public var `static`: String { __data["static"] } - public var `struct`: String { __data["struct"] } - public var `subscript`: String { __data["subscript"] } - public var `typealias`: String { __data["typealias"] } - public var `var`: String { __data["var"] } - public var `break`: String { __data["break"] } - public var `case`: String { __data["case"] } - public var `catch`: String { __data["catch"] } - public var `continue`: String { __data["continue"] } - public var `default`: String { __data["default"] } - public var `defer`: String { __data["defer"] } - public var `do`: String { __data["do"] } - public var `else`: String { __data["else"] } - public var `fallthrough`: String { __data["fallthrough"] } - public var `for`: String { __data["for"] } - public var `guard`: String { __data["guard"] } - public var `if`: String { __data["if"] } - public var `in`: String { __data["in"] } - public var `repeat`: String { __data["repeat"] } - public var `return`: String { __data["return"] } - public var `throw`: String { __data["throw"] } - public var `switch`: String { __data["switch"] } - public var `where`: String { __data["where"] } - public var `while`: String { __data["while"] } - public var `as`: String { __data["as"] } - public var `false`: String { __data["false"] } - public var `is`: String { __data["is"] } - public var `nil`: String { __data["nil"] } - public var `self`: String { __data["self"] } - public var `self`: String { __data["Self"] } - public var `super`: String { __data["super"] } - public var `throws`: String { __data["throws"] } - public var `true`: String { __data["true"] } - public var `try`: String { __data["try"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine( - expected, - atLine: 11 + allAnimals.selectionSet.selections.direct!.fields.count, - ignoringExtraLines: true) - ) - } - - func test__render_fieldAccessors__givenEntityFieldWithUnderscorePrefixedName_rendersFieldWithTypeFirstUppercased() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - _oneUnderscore: Animal! - __twoUnderscore: Animal! - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - _oneUnderscore { - species - } - __twoUnderscore { - species - } - } - } - """ - - let expected = """ - public var _oneUnderscore: _OneUnderscore { __data["_oneUnderscore"] } - public var __twoUnderscore: __TwoUnderscore { __data["__twoUnderscore"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine( - expected, - atLine: 11 + allAnimals.selectionSet.selections.direct!.fields.count, - ignoringExtraLines: true) - ) - } - - func test__render_fieldAccessors__givenEntityFieldWithSwiftKeywordAndApolloReservedTypeNames_rendersFieldAccessorWithTypeNameSuffixed() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - self: Animal! - parentType: Animal! - dataDict: Animal! - selection: Animal! - schema: Animal! - fragmentContainer: Animal! - string: Animal! - bool: Animal! - int: Animal! - float: Animal! - double: Animal! - iD: Animal! - any: Animal! - protocol: Animal! - type: Animal! - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - self { - species - } - parentType { - species - } - dataDict { - species - } - selection { - species - } - schema { - species - } - fragmentContainer { - species - } - string { - species - } - bool { - species - } - int { - species - } - float { - species - } - double { - species - } - iD { - species - } - any { - species - } - protocol { - species - } - type { - species - } - } - } - """ - - let expected = """ - public var `self`: Self_SelectionSet { __data["self"] } - public var parentType: ParentType_SelectionSet { __data["parentType"] } - public var dataDict: DataDict_SelectionSet { __data["dataDict"] } - public var selection: Selection_SelectionSet { __data["selection"] } - public var schema: Schema_SelectionSet { __data["schema"] } - public var fragmentContainer: FragmentContainer_SelectionSet { __data["fragmentContainer"] } - public var string: String_SelectionSet { __data["string"] } - public var bool: Bool_SelectionSet { __data["bool"] } - public var int: Int_SelectionSet { __data["int"] } - public var float: Float_SelectionSet { __data["float"] } - public var double: Double_SelectionSet { __data["double"] } - public var iD: ID_SelectionSet { __data["iD"] } - public var any: Any_SelectionSet { __data["any"] } - public var `protocol`: Protocol_SelectionSet { __data["protocol"] } - public var type: Type_SelectionSet { __data["type"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine( - expected, - atLine: 11 + allAnimals.selectionSet.selections.direct!.fields.count, - ignoringExtraLines: true) - ) - } - - // MARK: Field Accessors - Entity - - func test__render_fieldAccessors__givenDirectEntityField_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - lowercaseType: lowercaseType! - } - - type lowercaseType { - a: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - lowercaseType { - a - } - } - } - """ - - let expected = """ - public var predator: Predator { __data["predator"] } - public var lowercaseType: LowercaseType { __data["lowercaseType"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenDirectEntityFieldWithAlias_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - aliasedPredator: predator { - species - } - } - } - """ - - let expected = """ - public var aliasedPredator: AliasedPredator { __data["aliasedPredator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenDirectEntityFieldAsOptional_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - } - } - """ - - let expected = """ - public var predator: Predator? { __data["predator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenDirectEntityFieldAsList_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - predators { - species - } - } - } - """ - - let expected = """ - public var predators: [Predator]? { __data["predators"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldWithDirectSelectionsAndMergedFromFragment_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - name: String! - predator: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...PredatorDetails - predator { - name - } - } - } - - fragment PredatorDetails on Animal { - predator { - species - } - } - """ - - let expected = """ - public var predator: Predator { __data["predator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - // MARK: Field Accessors - Merged Fragment - - func test__render_fieldAccessors__givenEntityFieldMergedFromFragment_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...PredatorDetails - } - } - - fragment PredatorDetails on Animal { - predator { - species - } - } - """ - - let expected = """ - public var predator: PredatorDetails.Predator { __data["predator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromFragmentEntityNestedInEntity_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - ...PredatorDetails - } - } - - fragment PredatorDetails on Animal { - predator { - height { - feet - } - } - } - """ - - let expected = """ - public var species: String { __data["species"] } - public var height: PredatorDetails.Predator.Height { __data["height"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromFragmentInTypeCaseWithEntityNestedInEntity_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface Pet { - predator: Animal! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - ...PredatorDetails - } - } - - fragment PredatorDetails on Pet { - predator { - height { - feet - } - } - } - """ - - let expected = """ - public var height: PredatorDetails.Predator.Height { __data["height"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asPet_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_asPet_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 9, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromTypeCaseInFragment_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface Pet { - height: Height! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - ...PredatorDetails - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - height { - feet - } - } - } - """ - - let predator_expected = """ - public var species: String { __data["species"] } - - """ - - let predator_asPet_expected = """ - public var species: String { __data["species"] } - public var height: PredatorDetails.AsPet.Height { __data["height"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let allAnimals_predator_asPet = try XCTUnwrap(allAnimals_predator[as: "Pet"]) - - let allAnimals_predator_actual = subject.render(field: allAnimals_predator) - let allAnimals_predator_asPet_actual = subject.render(inlineFragment: allAnimals_predator_asPet) - - // then - expect(allAnimals_predator_actual).to(equalLineByLine(predator_expected, atLine: 13, ignoringExtraLines: true)) - expect(allAnimals_predator_asPet_actual).to(equalLineByLine(predator_asPet_expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromFragmentWithEntityNestedInEntityTypeCase_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface Pet { - height: Height! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - ...PredatorDetails - } - } - - fragment PredatorDetails on Animal { - predator { - ... on Pet { - height { - feet - } - } - } - } - """ - - let predator_expected = """ - public var species: String { __data["species"] } - - """ - - let predator_asPet_expected = """ - public var species: String { __data["species"] } - public var height: PredatorDetails.Predator.AsPet.Height { __data["height"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let allAnimals_predator_asPet = try XCTUnwrap(allAnimals_predator[as: "Pet"]) - - let allAnimals_predator_actual = subject.render(field: allAnimals_predator) - let allAnimals_predator_asPet_actual = subject.render(inlineFragment: allAnimals_predator_asPet) - - // then - expect(allAnimals_predator_actual).to(equalLineByLine(predator_expected, atLine: 12, ignoringExtraLines: true)) - expect(allAnimals_predator_asPet_actual).to(equalLineByLine(predator_asPet_expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenTypeCaseMergedFromFragmentWithOtherMergedFields_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet { - favoriteToy: Item - } - - type Item { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...PredatorDetails - species - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - favoriteToy { - ...PetToy - } - } - } - - fragment PetToy on Item { - name - } - """ - - let predator_expected = """ - public var asPet: AsPet? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let predator_actual = subject.render(field: predator) - - // then - expect(predator_actual) - .to(equalLineByLine(predator_expected, atLine: 15, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenTypeCaseMergedFromFragmentWithNoOtherMergedFields_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet { - favoriteToy: Item - } - - type Item { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...PredatorDetails - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - favoriteToy { - ...PetToy - } - } - } - - fragment PetToy on Item { - name - } - """ - - let predator_expected = """ - public var asPet: AsPet? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let predator_actual = subject.render(field: predator) - - // then - expect(predator_actual) - .to(equalLineByLine(predator_expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedAsRootOfNestedFragment_rendersFieldAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet { - favoriteToy: Item - } - - type Item { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...PredatorDetails - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - favoriteToy { - ...PetToy - } - } - } - - fragment PetToy on Item { - name - } - """ - - let predator_asPet_expected = """ - public var favoriteToy: FavoriteToy? { __data["favoriteToy"] } - """ - - // when - try buildSubjectAndOperation() - let predator_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"]?[as: "Pet"] - ) - - let predator_asPet_actual = subject.render(inlineFragment: predator_asPet) - - // then - expect(predator_asPet_actual) - .to(equalLineByLine(predator_asPet_expected, atLine: 13, ignoringExtraLines: true)) - } - - // MARK: Field Accessors - Merged From Parent - - func test__render_fieldAccessors__givenEntityFieldMergedFromParent_notOperationRoot_rendersFieldAccessorWithNameNotIncludingParent() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - type Dog implements Animal { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - species - } - ... on Dog { - name - } - } - } - """ - - let expected = """ - public var name: String { __data["name"] } - public var predator: Predator { __data["predator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asDog) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromParent_atOperationRoot_rendersFieldAccessorWithFullyQualifiedName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type AdminQuery { - name: String! - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - ... on AdminQuery { - name - } - } - """ - - let expected = """ - public var name: String { __data["name"] } - public var allAnimals: [TestOperationQuery.Data.AllAnimal]? { __data["allAnimals"] } - """ - - // when - try buildSubjectAndOperation() - let query_asAdminQuery = try XCTUnwrap( - operation[field: "query"]?[as: "AdminQuery"] - ) - - let actual = subject.render(inlineFragment: query_asAdminQuery) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromSiblingTypeCase_notOperationRoot_rendersFieldAccessorWithNameNotIncludingSharedParent() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - predator { - species - } - } - ... on Dog { - name - } - } - } - """ - - let expected = """ - public var name: String { __data["name"] } - public var predator: AsPet.Predator { __data["predator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asDog) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromSiblingTypeCase_atOperationRoot_rendersFieldAccessorWithFullyQualifiedName() throws { - // given - schemaSDL = """ - type Query { - role: String! - } - - type AdminQuery implements ModeratorQuery { - name: String! - allAnimals: [Animal!] - } - - interface ModeratorQuery { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation { - ... on ModeratorQuery { - allAnimals { - species - } - } - ... on AdminQuery { - name - } - } - """ - - let expected = """ - public var name: String { __data["name"] } - public var allAnimals: [TestOperationQuery.Data.AsModeratorQuery.AllAnimal]? { __data["allAnimals"] } - """ - - // when - try buildSubjectAndOperation() - let query_asAdminQuery = try XCTUnwrap( - operation[field: "query"]?[as: "AdminQuery"] - ) - - let actual = subject.render(inlineFragment: query_asAdminQuery) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldNestedInEntityFieldMergedFromParent_rendersFieldAccessorWithCorrectName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - type Dog implements Animal { - name: String! - species: String! - predator: Animal! - height: Height! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - height { - feet - } - } - ... on Dog { - predator { - species - } - } - } - } - """ - - let expected = """ - public var species: String { __data["species"] } - public var height: AllAnimal.Predator.Height { __data["height"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_asDog_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldNestedInEntityFieldInMatchingTypeCaseMergedFromParent_rendersFieldAccessorWithCorrectName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - height: Height! - } - - type Dog implements Animal & Pet { - name: String! - species: String! - predator: Animal! - height: Height! - } - - type Height { - feet: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - predator { - height { - feet - } - } - } - ... on Dog { - predator { - species - } - } - } - } - """ - - let expected = """ - public var species: String { __data["species"] } - public var height: AllAnimal.AsPet.Predator.Height { __data["height"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_asDog_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - // MARK: Field Accessors - Include/Skip - - func test__render_fieldAccessor__givenNonNullFieldWithIncludeCondition_rendersAsOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - fieldName @include(if: $a) - } - } - """ - - let expected = """ - public var fieldName: String? { __data["fieldName"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessor__givenNonNullFieldWithSkipCondition_rendersAsOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - fieldName @skip(if: $a) - } - } - """ - - let expected = """ - public var fieldName: String? { __data["fieldName"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenEntityFieldMergedFromParentWithInclusionCondition_rendersFieldAccessorAsOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - type Dog implements Animal { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - predator @include(if: $a) { - species - } - ... on Dog { - name - } - } - } - """ - - let expected = """ - public var name: String { __data["name"] } - public var predator: Predator? { __data["predator"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asDog) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessor__givenNonNullFieldMergedFromParentWithIncludeConditionThatMatchesScope_rendersAsNotOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - a: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - fieldName @include(if: $a) - ... @include(if: $a) { - a - } - } - } - """ - - let expected = """ - public var a: String { __data["a"] } - public var fieldName: String { __data["fieldName"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_ifA = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a"] - ) - - let actual = subject.render(inlineFragment: allAnimals_ifA) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessor__givenNonNullFieldWithIncludeConditionThatMatchesScope_rendersAsNotOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals @include(if: $a) { - fieldName @include(if: $a) - } - } - """ - - let expected = """ - public var fieldName: String { __data["fieldName"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessor__givenNonNullFieldMergedFromNestedEntityInNamedFragmentWithIncludeCondition_doesNotRenderField() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - child: Child! - } - - type Child { - a: String! - b: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...ChildFragment @include(if: $a) - child { - a - } - } - } - - fragment ChildFragment on Animal { - child { - b - } - } - """ - - let expected = """ - public var a: String { __data["a"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_child = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "child"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_child) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessor__givenNonNullFieldMergedFromNestedEntityInNamedFragmentWithIncludeCondition_inConditionalFragment_rendersFieldAsNonOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - child: Child! - } - - type Child { - a: String! - b: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...ChildFragment @include(if: $a) - child { - a - } - } - } - - fragment ChildFragment on Animal { - child { - b - } - } - """ - - let expected = """ - public var a: String { __data["a"] } - public var b: String { __data["b"] } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_child = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a"]?[field: "child"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_child) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - - - // MARK: - Inline Fragment Accessors - - func test__render_inlineFragmentAccessors__givenDirectTypeCases_rendersTypeCaseAccessorWithCorrectName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - name: String! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - ... on Pet { - name - } - ... on Dog { - name - } - } - } - """ - - let expected = """ - public var asPet: AsPet? { _asInlineFragment() } - public var asDog: AsDog? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessors__givenMergedTypeCasesFromSingleMergedTypeCaseSource_rendersTypeCaseAccessorWithCorrectName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - name: String! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - predator { - ... on Pet { - name - } - } - ... on Dog { - name - predator { - species - } - } - } - } - """ - - let expected = """ - public var asPet: AsPet? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_asDog_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - // MARK: Inline Fragment Accessors - Include/Skip - - func test__render_inlineFragmentAccessors__givenInlineFragmentOnDifferentTypeWithCondition_renders() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... on Pet @include(if: $a) { - fieldA - } - } - } - """ - - let expected = """ - public var asPetIfA: AsPetIfA? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessors__givenInlineFragmentOnDifferentTypeWithSkipCondition_renders() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... on Pet @skip(if: $a) { - fieldA - } - } - } - """ - - let expected = """ - public var asPetIfNotA: AsPetIfNotA? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessors__givenInlineFragmentOnDifferentTypeWithMultipleConditions_renders() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... on Pet @include(if: $a) @skip(if: $b) { - fieldA - } - } - } - """ - - let expected = """ - public var asPetIfAAndNotB: AsPetIfAAndNotB? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessors__givenInlineFragmentOnSameTypeWithMultipleConditions_renders() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... on Animal @include(if: $a) @skip(if: $b) { - fieldA - } - } - } - """ - - let expected = """ - public var ifAAndNotB: IfAAndNotB? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessor__givenNamedFragmentMatchingParentTypeWithInclusionCondition_renders() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - int - } - """ - - let expected = """ - public var ifA: IfA? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessor__givenInlineFragmentAndNamedFragmentOnSameTypeWithInclusionCondition_rendersBothInlineFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - string: String! - int: Int! - } - - type Bird implements Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... on Bird { - string - } - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Bird { - int - } - """ - - let expected = """ - public var asBird: AsBird? { _asInlineFragment() } - public var asBirdIfA: AsBirdIfA? { _asInlineFragment() } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - // MARK: - Fragment Accessors - - func test__render_fragmentAccessor__givenFragments_rendersFragmentAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...FragmentA - ...lowercaseFragment - } - } - - fragment FragmentA on Animal { - int - } - - fragment lowercaseFragment on Animal { - string - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var fragmentA: FragmentA { _toFragment() } - public var lowercaseFragment: LowercaseFragment { _toFragment() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_fragmentAccessor__givenInheritedFragmentFromParent_rendersFragmentAccessor() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - string: String! - int: Int! - } - - type Cat implements Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...FragmentA - ... on Cat { - string - } - } - } - - fragment FragmentA on Animal { - int - } - - fragment lowercaseFragment on Animal { - string - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var fragmentA: FragmentA { _toFragment() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asCat = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Cat"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asCat) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 15, ignoringExtraLines: true)) - } - - // MARK: - Fragment Accessors - Include Skip - - func test__render_fragmentAccessor__givenFragmentOnSameTypeWithInclusionCondition_rendersFragmentAccessorAsOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - ...lowercaseFragment - } - } - - fragment FragmentA on Animal { - int - } - - fragment lowercaseFragment on Animal { - string - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var lowercaseFragment: LowercaseFragment { _toFragment() } - public var fragmentA: FragmentA? { _toFragment() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_fragmentAccessor__givenFragmentOnSameTypeWithInclusionConditionThatMatchesScope_rendersFragmentAccessorAsNotOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals @include(if: $a) { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - int - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var fragmentA: FragmentA { _toFragment() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fragmentAccessor__givenFragmentOnSameTypeWithInclusionConditionThatPartiallyMatchesScope_rendersFragmentAccessorAsOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!, $b: Boolean!) { - allAnimals @include(if: $a) { - ...FragmentA @include(if: $a) @include(if: $b) - } - } - - fragment FragmentA on Animal { - int - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var fragmentA: FragmentA? { _toFragment() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render_fragmentAccessor__givenFragmentMergedFromParent_withInclusionConditionThatMatchesScope_rendersFragmentAccessorAsNotOptional() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - int - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var fragmentA: FragmentA { _toFragment() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals_ifA = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a"] - ) - - let actual = subject.render(inlineFragment: allAnimals_ifA) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - // MARK: - Nested Selection Sets - - func test__render_nestedSelectionSets__givenDirectEntityFieldAsList_rendersNestedSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - predators { - species - } - } - } - """ - - let expected = """ - public var predators: [Predator]? { __data["predators"] } - - /// AllAnimal.Predator - public struct Predator: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSets__givenDirectEntityFieldAsList_withIrregularPluralizationRule_rendersNestedSelectionSetWithCorrectSingularName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - people: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - people { - species - } - } - } - """ - - let expected = """ - public var people: [Person]? { __data["people"] } - - /// AllAnimal.Person - public struct Person: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSets__givenDirectEntityFieldAsNonNullList_withIrregularPluralizationRule_rendersNestedSelectionSetWithCorrectSingularName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - people: [Animal!]! - } - """ - - document = """ - query TestOperation { - allAnimals { - people { - species - } - } - } - """ - - let expected = """ - public var people: [Person] { __data["people"] } - - /// AllAnimal.Person - public struct Person: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSets__givenDirectEntityFieldAsList_withCustomIrregularPluralizationRule_rendersNestedSelectionSetWithCorrectSingularName() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - people: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - people { - species - } - } - } - """ - - let expected = """ - public var people: [Peep]? { __data["people"] } - - /// AllAnimal.Peep - public struct Peep: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation(inflectionRules: [ - ApolloCodegenLib.InflectionRule.irregular(singular: "Peep", plural: "people") - ]) - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - /// Explicit test for edge case surfaced in issue - /// [#1825](https://github.com/apollographql/apollo-ios/issues/1825) - func test__render_nestedSelectionSets__givenDirectEntityField_withTwoObjects_oneWithPluralizedNameAsObject_oneWithSingularNameAsList_rendersNestedSelectionSetsWithCorrectNames() throws { - // given - schemaSDL = """ - type Query { - badge: [Badge] - badges: ProductBadge - } - - type Badge { - a: String - } - - type ProductBadge { - b: String - } - """ - - document = """ - query TestOperation { - badge { - a - } - badges { - b - } - } - """ - - let expected = """ - public var badge: [Badge?]? { __data["badge"] } - public var badges: Badges? { __data["badges"] } - - /// Badge - public struct Badge: TestSchema.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Badge } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("a", String?.self), - ] } - - public var a: String? { __data["a"] } - } - - /// Badges - public struct Badges: TestSchema.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.ProductBadge } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("b", String?.self), - ] } - - public var b: String? { __data["b"] } - } - """ - - // when - try buildSubjectAndOperation() - - let query = try XCTUnwrap( - operation[field: "query"] as? IR.EntityField - ) - - let actual = subject.render(field: query) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - /// Explicit test for edge case surfaced in issue - /// [#1825](https://github.com/apollographql/apollo-ios/issues/1825) - func test__render_nestedSelectionSets__givenDirectEntityField_withTwoObjectsNonNullFields_oneWithPluralizedNameAsObject_oneWithSingularNameAsList_rendersNestedSelectionSetsWithCorrectNames() throws { - // given - schemaSDL = """ - type Query { - badge: [Badge!]! - badges: ProductBadge! - } - - type Badge { - a: String - } - - type ProductBadge { - b: String - } - """ - - document = """ - query TestOperation { - badge { - a - } - badges { - b - } - } - """ - - let expected = """ - public var badge: [Badge] { __data["badge"] } - public var badges: Badges { __data["badges"] } - - /// Badge - public struct Badge: TestSchema.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Badge } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("a", String?.self), - ] } - - public var a: String? { __data["a"] } - } - - /// Badges - public struct Badges: TestSchema.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.ProductBadge } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("b", String?.self), - ] } - - public var b: String? { __data["b"] } - } - """ - - // when - try buildSubjectAndOperation() - - let query = try XCTUnwrap( - operation[field: "query"] as? IR.EntityField - ) - - let actual = subject.render(field: query) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSets__givenEntityFieldMergedFromTwoSources_rendersMergedSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - height: Height! - } - - interface WarmBlooded implements Animal { - species: String! - predator: Animal! - height: Height! - } - - type Dog implements Animal & Pet & WarmBlooded { - name: String! - species: String! - predator: Animal! - height: Height! - } - - type Height { - feet: Int! - meters: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - predator { - height { - feet - } - } - } - ... on WarmBlooded { - predator { - height { - meters - } - } - } - ... on Dog { - predator { - species - } - } - } - } - """ - - let expected = """ - public var species: String { __data["species"] } - public var height: Height { __data["height"] } - - /// AllAnimal.AsDog.Predator.Height - public struct Height: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_asDog_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenEntityFieldMergedFromFragment_doesNotRendersSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...PredatorDetails - } - } - - fragment PredatorDetails on Animal { - predator { - species - } - } - """ - - let expected = """ - public var predator: PredatorDetails.Predator { __data["predator"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var predatorDetails: PredatorDetails { _toFragment() } - } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenEntityFieldMergedFromFragmentWithLowercaseName_rendersFragmentNestedSelctionSetNameCorrectlyCased() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...predatorDetails - } - } - - fragment predatorDetails on Animal { - predator { - species - } - } - """ - - let expected = """ - public var predator: PredatorDetails.Predator { __data["predator"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var predatorDetails: PredatorDetails { _toFragment() } - } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenEntityFieldMergedFromNestedFragmentInTypeCase_withNoOtherMergedFields_doesNotRendersSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - height: Height! - } - - interface WarmBlooded implements Animal { - species: String! - predator: Animal! - height: Height! - } - - type Height { - meters: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...WarmBloodedDetails - } - } - } - - fragment WarmBloodedDetails on WarmBlooded { - species - ...HeightInMeters - } - - fragment HeightInMeters on Animal { - height { - meters - } - } - """ - - let allAnimals_expected = """ - public var predator: Predator { __data["predator"] } - - /// AllAnimal.Predator - public struct Predator: TestSchema.SelectionSet { - """ - - let allAnimals_predator_expected = """ - public var asWarmBlooded: AsWarmBlooded? { _asInlineFragment() } - - /// AllAnimal.Predator.AsWarmBlooded - public struct AsWarmBlooded: TestSchema.InlineFragment { - """ - - let allAnimals_predator_asWarmBlooded_expected = """ - public var species: String { __data["species"] } - public var height: HeightInMeters.Height { __data["height"] } - - public struct Fragments: FragmentContainer { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public var warmBloodedDetails: WarmBloodedDetails { _toFragment() } - public var heightInMeters: HeightInMeters { _toFragment() } - } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - let allAnimals_predator = try XCTUnwrap( - allAnimals[field: "predator"] as? IR.EntityField - ) - let allAnimals_predator_asWarmBlooded = try XCTUnwrap( - allAnimals_predator[as: "WarmBlooded"] - ) - - let allAnimals_actual = subject.render(field: allAnimals) - let allAnimals_predator_actual = subject.render(field: allAnimals_predator) - let allAnimals_predator_asWarmBlooded_actual = subject - .render(inlineFragment: allAnimals_predator_asWarmBlooded) - - // then - expect(allAnimals_actual) - .to(equalLineByLine(allAnimals_expected, atLine: 12, ignoringExtraLines: true)) - expect(allAnimals_predator_actual) - .to(equalLineByLine(allAnimals_predator_expected, atLine: 12, ignoringExtraLines: true)) - expect(allAnimals_predator_asWarmBlooded_actual) - .to(equalLineByLine(allAnimals_predator_asWarmBlooded_expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSets__givenDirectSelection_typeCase_rendersNestedSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - name: String! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - ... on Pet { - name - } - } - } - """ - - let expected = """ - public var asPet: AsPet? { _asInlineFragment() } - - /// AllAnimal.AsPet - public struct AsPet: TestSchema.InlineFragment { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 15, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenMergedTypeCasesFromSingleMergedTypeCaseSource_rendersTypeCaseSelectionSetAsCompositeInlineFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet implements Animal { - species: String! - predator: Animal! - name: String! - } - - type Dog implements Animal & Pet { - species: String! - predator: Animal! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - predator { - ... on Pet { - name - } - } - ... on Dog { - name - predator { - species - } - } - } - } - """ - - let expected = """ - public var asPet: AsPet? { _asInlineFragment() } - - /// AllAnimal.AsDog.Predator.AsPet - public struct AsPet: TestSchema.InlineFragment, ApolloAPI.CompositeInlineFragment { - """ - - // when - try buildSubjectAndOperation() - let allAnimals_asDog_predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Dog"]?[field: "predator"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals_asDog_predator) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenInlineFragmentOnSameTypeWithMultipleConditions_renders() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldA: String! - } - - interface Pet { - fieldA: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... @include(if: $a) @skip(if: $b) { - fieldA - } - } - } - """ - - let expected = """ - public var ifAAndNotB: IfAAndNotB? { _asInlineFragment() } - - /// AllAnimal.IfAAndNotB - public struct IfAAndNotB: TestSchema.InlineFragment { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenNamedFragmentOnSameTypeWithInclusionCondition_rendersConditionalSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...FragmentA @include(if: $a) - } - } - - fragment FragmentA on Animal { - int - } - """ - - let expected = """ - /// AllAnimal.IfA - public struct IfA: TestSchema.InlineFragment { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 21, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenTypeCaseMergedFromFragmentWithOtherMergedFields_rendersTypeCaseAsCompositeInlineFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet { - favoriteToy: Item - } - - type Item { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...PredatorDetails - species - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - favoriteToy { - ...PetToy - } - } - } - - fragment PetToy on Item { - name - } - """ - - let predator_expected = """ - /// AllAnimal.Predator.AsPet - public struct AsPet: TestSchema.InlineFragment, ApolloAPI.CompositeInlineFragment { - """ - - // when - try buildSubjectAndOperation() - let predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let predator_actual = subject.render(field: predator) - - // then - expect(predator_actual) - .to(equalLineByLine(predator_expected, atLine: 24, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet__givenTypeCaseMergedFromFragmentWithNoOtherMergedFields_rendersTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predator: Animal! - } - - interface Pet { - favoriteToy: Item - } - - type Item { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predator { - ...PredatorDetails - } - } - } - - fragment PredatorDetails on Animal { - ... on Pet { - favoriteToy { - ...PetToy - } - } - } - - fragment PetToy on Item { - name - } - """ - - let predator_expected = """ - /// AllAnimal.Predator.AsPet - public struct AsPet: TestSchema.InlineFragment, ApolloAPI.CompositeInlineFragment { - """ - - // when - try buildSubjectAndOperation() - let predator = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predator"] as? IR.EntityField - ) - - let predator_actual = subject.render(field: predator) - - // then - expect(predator_actual) - .to(equalLineByLine(predator_expected, atLine: 21, ignoringExtraLines: true)) - } - - // MARK: Nested Selection Sets - Reserved Keywords + Special Names - - func test__render_nestedSelectionSet__givenEntityFieldWithSwiftKeywordAndApolloReservedTypeNames_rendersSelectionSetWithNameSuffixed() throws { - let fieldNames = SwiftKeywords.TypeNamesToSuffix - for fieldName in fieldNames { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - \(fieldName.firstLowercased): Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - \(fieldName.firstLowercased) { - species - } - } - } - """ - - let expected = """ - /// AllAnimal.\(fieldName.firstUppercased)_SelectionSet - public struct \(fieldName.firstUppercased)_SelectionSet: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let predator_actual = subject.render(field: allAnimals) - - // then - expect(predator_actual) - .to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - } - - // MARK: - InlineFragment RootEntityType Tests - - func test__render_nestedTypeCase__rendersRootEntityType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - name - } - } - } - """ - - let expected = """ - /// AllAnimal.AsPet - public struct AsPet: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = TestOperationQuery.Data.AllAnimal - """ - - // when - try buildSubjectAndOperation() - let allAnimals_AsPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_AsPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - func test__render_doublyNestedTypeCase__rendersRootEntityType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - } - - interface WarmBlooded { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on WarmBlooded { - ... on Pet { - name - } - } - } - } - """ - - let expected = """ - /// AllAnimal.AsWarmBlooded.AsPet - public struct AsPet: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = TestOperationQuery.Data.AllAnimal - """ - - // when - try buildSubjectAndOperation() - let allAnimals_AsPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "WarmBlooded"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_AsPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - func test__render_nestedTypeCaseWithNameConflictingWithChild__rendersRootEntityType() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - predators { - ... on Pet { - name - } - predators { - species - } - } - } - } - """ - - let expected = """ - /// AllAnimal.Predator.AsPet - public struct AsPet: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = TestOperationQuery.Data.AllAnimal.Predator - """ - - // when - try buildSubjectAndOperation() - let predators_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[field: "predators"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: predators_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - /// Test for edge case in [#2949](https://github.com/apollographql/apollo-ios/issues/2949) - /// - /// When the `RootEntityType` would have duplicate naming, due to child fields with the same name - /// (or alias), the fully qualified name must be used. In this example, a `RootEntityType` of - /// `Predator.Predator` the first usage of the name `Predator` would be referencing the nearest - /// enclosing type (ie. `TestOperationQuery.Predator.Predator`), so it is looking for another - /// `Predator` type in that scope, which does not exist - /// (ie. `TestOperationQuery.Predator.Predator.Predator`). - /// - /// To correct this we must always use the fully qualified name including the operation name and - /// `Data` objects to ensure we are referring to the correct type. - func test__render_nestedTypeCaseWithNameConflictingWithChildAtQueryRoot__rendersRootEntityTypeWithFullyQualifiedName() throws { - // given - schemaSDL = """ - type Query { - predators: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - } - """ - - document = """ - query TestOperation { - predators { - predators { - ... on Pet { - name - } - } - } - } - """ - - let expected = """ - /// Predator.Predator.AsPet - public struct AsPet: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = TestOperationQuery.Data.Predator.Predator - """ - - // when - try buildSubjectAndOperation() - let predators_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "predators"]?[field: "predators"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: predators_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - func test__render_conditionalFragmentOnQueryRoot__rendersRootEntityType() throws { - // given - schemaSDL = """ - type Query { - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - ...Details @include(if: $a) - } - - fragment Details on Query { - name - } - """ - - let expected = """ - /// IfA - public struct IfA: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = TestOperationQuery.Data - """ - - // when - try buildSubjectAndOperation() - let query_ifA = try XCTUnwrap( - operation[field: "query"]?[if: "a"] - ) - - let actual = subject.render(inlineFragment: query_ifA) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - func test__render_conditionalTypeCaseFragmentOnQueryRoot__rendersRootEntityType() throws { - // given - schemaSDL = """ - type Query { - name: String! - } - - interface AdminQuery { - adminName: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - ...AdminDetails @include(if: $a) - } - - fragment AdminDetails on AdminQuery { - adminName - } - """ - - let expected = """ - /// AsAdminQueryIfA - public struct AsAdminQueryIfA: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = TestOperationQuery.Data - """ - - // when - try buildSubjectAndOperation() - let query_ifA = try XCTUnwrap( - operation[field: "query"]?[as: "AdminQuery", if: "a"] - ) - - let actual = subject.render(inlineFragment: query_ifA) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - func test__render_typeCaseInFragmentOnQueryRoot__rendersRootEntityTypeNamespacedToFragment() throws { - // given - schemaSDL = """ - type Query { - predators: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - } - """ - - document = """ - query TestOperation { - ...Details - } - - fragment Details on Query { - predators { - predators { - ... on Pet { - name - } - } - } - } - """ - - let expected = """ - /// Predator.Predator.AsPet - public struct AsPet: TestSchema.InlineFragment { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public typealias RootEntityType = Details.Predator.Predator - """ - - // when - try buildSubjectAndOperation() - let detailsFragment = try XCTUnwrap( - operation[fragment: "Details"] - ) - let detailsFragment_predators_predators_asPet = try XCTUnwrap( - detailsFragment.fragment.rootField - .selectionSet[field: "predators"]?[field: "predators"]?[as: "Pet"] - ) - - let fragmentTemplate = SelectionSetTemplate( - definition: .namedFragment(detailsFragment.fragment), - generateInitializers: false, - config: self.subject.config, - renderAccessControl: self.subject.renderAccessControl() - ) - - let actual = fragmentTemplate.render(inlineFragment: detailsFragment_predators_predators_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 1, ignoringExtraLines: true)) - } - - // MARK: - Documentation Tests - - func test__render_nestedSelectionSet__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - predators { - species - } - } - } - """ - - let expected = """ - public var predators: [Predator]? { __data["predators"] } - - /// AllAnimal.Predator - /// - /// Parent Type: `Animal` - public struct Predator: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation(schemaDocumentation: .include) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render_nestedSelectionSet_givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - predators { - species - } - } - } - """ - - let expected = """ - public var predators: [Predator]? { __data["predators"] } - - /// AllAnimal.Predator - public struct Predator: TestSchema.SelectionSet { - """ - - // when - try buildSubjectAndOperation(schemaDocumentation: .exclude) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - "This field is a string." - string: String! - } - - scalar Custom - """ - - document = """ - query TestOperation { - allAnimals { - string - } - } - """ - - let expected = """ - /// This field is a string. - public var string: String { __data["string"] } - """ - - // when - try buildSubjectAndOperation(schemaDocumentation: .include) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - "This field is a string." - string: String! - } - - scalar Custom - """ - - document = """ - query TestOperation { - allAnimals { - string - } - } - """ - - let expected = """ - public var string: String { __data["string"] } - """ - - // when - try buildSubjectAndOperation(schemaDocumentation: .exclude) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - // MARK: - Deprecation Warnings - - func test__render_fieldAccessors__givenWarningsOnDeprecatedUsage_include_hasDeprecatedField_withDocumentation_shouldGenerateWarningBelowDocumentation() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - "This field is a string." - string: String! @deprecated(reason: "Cause I said so!") - } - """ - - document = """ - query TestOperation { - allAnimals { - string - } - } - """ - - let expected = """ - /// This field is a string. - @available(*, deprecated, message: "Cause I said so!") - public var string: String { __data["string"] } - """ - - // when - try buildSubjectAndOperation( - schemaDocumentation: .include, - warningsOnDeprecatedUsage: .include - ) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__givenWarningsOnDeprecatedUsage_exclude_hasDeprecatedField_shouldNotGenerateWarning() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! @deprecated - } - """ - - document = """ - query TestOperation { - allAnimals { - string - } - } - """ - - let expected = """ - public var string: String { __data["string"] } - """ - - // when - try buildSubjectAndOperation(warningsOnDeprecatedUsage: .exclude) - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_selections__givenWarningsOnDeprecatedUsage_include_usesDeprecatedArgument__shouldGenerateWarning() throws { - // given - schemaSDL = """ - type Query { - animal: Animal - } - - type Animal { - friend(name: String, species: String @deprecated(reason: "Who cares?")): Animal - species: String - } - """ - - document = """ - query TestOperation($name: String, $species: String) { - animal { - friend(name: $name, species: $species) { - species - } - } - } - """ - - let expected = """ - #warning("Argument 'species' of field 'friend' is deprecated. Reason: 'Who cares?'") - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friend", Friend?.self, arguments: [ - "name": .variable("name"), - "species": .variable("species") - ]), - ] } - """ - - // when - try buildSubjectAndOperation( - warningsOnDeprecatedUsage: .include - ) - let animal = try XCTUnwrap( - operation[field: "query"]?[field: "animal"] as? IR.EntityField - ) - - let actual = subject.render(field: animal) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenWarningsOnDeprecatedUsage_exclude_usesDeprecatedArgument__shouldNotGenerateWarning() throws { - // given - schemaSDL = """ - type Query { - animal: Animal - } - - type Animal { - friend(name: String, species: String @deprecated(reason: "Who cares?")): Animal - species: String - } - """ - - document = """ - query TestOperation($name: String, $species: String) { - animal { - friend(name: $name, species: $species) { - species - } - } - } - """ - - let expected = """ - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friend", Friend?.self, arguments: [ - "name": .variable("name"), - "species": .variable("species") - ]), - ] } - """ - - // when - try buildSubjectAndOperation( - warningsOnDeprecatedUsage: .exclude - ) - let animal = try XCTUnwrap( - operation[field: "query"]?[field: "animal"] as? IR.EntityField - ) - - let actual = subject.render(field: animal) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenWarningsOnDeprecatedUsage_include_usesMultipleDeprecatedArgumentsSameField__shouldGenerateWarningAllWarnings() throws { - // given - schemaSDL = """ - type Query { - animal: Animal - } - - type Animal { - friend( - name: String @deprecated(reason: "Someone broke it."), - species: String @deprecated(reason: "Who cares?") - ): Animal - species: String - } - """ - - document = """ - query TestOperation($name: String, $species: String) { - animal { - friend(name: $name, species: $species) { - species - } - } - } - """ - - let expected = """ - #warning("Argument 'name' of field 'friend' is deprecated. Reason: 'Someone broke it.'"), - #warning("Argument 'species' of field 'friend' is deprecated. Reason: 'Who cares?'") - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friend", Friend?.self, arguments: [ - "name": .variable("name"), - "species": .variable("species") - ]), - ] } - """ - - // when - try buildSubjectAndOperation( - warningsOnDeprecatedUsage: .include - ) - let animal = try XCTUnwrap( - operation[field: "query"]?[field: "animal"] as? IR.EntityField - ) - - let actual = subject.render(field: animal) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__render_selections__givenWarningsOnDeprecatedUsage_include_usesMultipleDeprecatedArgumentsDifferentFields__shouldGenerateWarningAllWarnings() throws { - // given - schemaSDL = """ - type Query { - animal: Animal - } - - type Animal { - friend(name: String @deprecated(reason: "Someone broke it.")): Animal - species(species: String @deprecated(reason: "Redundant")): String - } - """ - - document = """ - query TestOperation($name: String, $species: String) { - animal { - friend(name: $name) { - species - } - species(species: $species) - } - } - """ - - let expected = """ - #warning("Argument 'name' of field 'friend' is deprecated. Reason: 'Someone broke it.'"), - #warning("Argument 'species' of field 'species' is deprecated. Reason: 'Redundant'") - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("friend", Friend?.self, arguments: ["name": .variable("name")]), - .field("species", String?.self, arguments: ["species": .variable("species")]), - ] } - """ - - // when - try buildSubjectAndOperation( - warningsOnDeprecatedUsage: .include - ) - let animal = try XCTUnwrap( - operation[field: "query"]?[field: "animal"] as? IR.EntityField - ) - - let actual = subject.render(field: animal) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Type Tests - - func test__render_enumType__usingReservedKeyword_rendersAsSuffixedType() throws { - // given - schemaSDL = """ - type Query { - getUser: User - } - - type User { - id: String! - name: String! - type: Type! - } - - enum Type { - ADMIN - MEMBER - } - """ - - document = """ - query TestOperation { - getUser { - type - } - } - """ - - let expectedOne = """ - .field("type", GraphQLEnum.self), - """ - - let expectedTwo = """ - public var type: GraphQLEnum { __data["type"] } - """ - - // when - try buildSubjectAndOperation() - let user = try XCTUnwrap( - operation[field: "query"]?[field: "getUser"] as? IR.EntityField - ) - - let actual = subject.render(field: user) - - // then - expect(actual).to(equalLineByLine(expectedOne, atLine: 9, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedTwo, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_NamedFragmentType__usingReservedKeyword_rendersAsSuffixedType() throws { - // given - schemaSDL = """ - type Query { - getUser: User - } - - type User { - id: String! - name: String! - type: UserRole! - } - - enum UserRole { - ADMIN - MEMBER - } - """ - - document = """ - query TestOperation { - getUser { - ...Type - } - } - - fragment Type on User { - name - type - } - """ - - let expectedOne = """ - .fragment(Type_Fragment.self), - """ - - let expectedTwo = """ - public var type: Type_Fragment { _toFragment() } - """ - - // when - try buildSubjectAndOperation() - let user = try XCTUnwrap( - operation[field: "query"]?[field: "getUser"] as? IR.EntityField - ) - - let actual = subject.render(field: user) - - // then - expect(actual).to(equalLineByLine(expectedOne, atLine: 9, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedTwo, atLine: 19, ignoringExtraLines: true)) - } - - func test__render_CustomScalarType__usingReservedKeyword_rendersAsSuffixedType() throws { - // given - schemaSDL = """ - scalar Type - - type Query { - getUser: User - } - - type User { - id: String! - name: String! - type: Type! - } - """ - - document = """ - query TestOperation { - getUser { - type - } - } - """ - - let expectedOne = """ - .field("type", TestSchema.Type_Scalar.self), - """ - - let expectedTwo = """ - public var type: TestSchema.Type_Scalar { __data["type"] } - """ - - // when - try buildSubjectAndOperation() - let user = try XCTUnwrap( - operation[field: "query"]?[field: "getUser"] as? IR.EntityField - ) - - let actual = subject.render(field: user) - - // then - expect(actual).to(equalLineByLine(expectedOne, atLine: 9, ignoringExtraLines: true)) - expect(actual).to(equalLineByLine(expectedTwo, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_InterfaceType__usingReservedKeyword_rendersAsSuffixedType() throws { - // given - schemaSDL = """ - interface Type { - name: String! - } - - type Query { - getUser: Type - } - - type User implements Type { - id: String! - } - """ - - document = """ - query TestOperation { - getUser { - name - } - } - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Interfaces.Type_Interface } - """ - - // when - try buildSubjectAndOperation() - let user = try XCTUnwrap( - operation[field: "query"]?[field: "getUser"] as? IR.EntityField - ) - - let actual = subject.render(field: user) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_UnionType__usingReservedKeyword_rendersAsSuffixedType() throws { - // given - schemaSDL = """ - union Type = User | Admin - - type Query { - getUser: Type - } - - type User { - id: String! - name: String! - } - - type Admin { - id: String! - role: String! - } - """ - - document = """ - query TestOperation { - getUser { - ... on User { - name - } - ... on Admin { - role - } - } - } - - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Unions.Type_Union } - """ - - // when - try buildSubjectAndOperation() - let user = try XCTUnwrap( - operation[field: "query"]?[field: "getUser"] as? IR.EntityField - ) - - let actual = subject.render(field: user) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__render_ObjectType__usingReservedKeyword_rendersAsSuffixedType() throws { - // given - schemaSDL = """ - type Query { - getType: Type - } - - type Type { - id: String! - name: String! - } - """ - - document = """ - query TestOperation { - getType { - name - } - } - """ - - let expected = """ - public static var __parentType: ApolloAPI.ParentType { TestSchema.Objects.Type_Object } - """ - - // when - try buildSubjectAndOperation() - let user = try XCTUnwrap( - operation[field: "query"]?[field: "getType"] as? IR.EntityField - ) - - let actual = subject.render(field: user) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift deleted file mode 100644 index 76ea47b284..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift +++ /dev/null @@ -1,2136 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class SelectionSetTemplate_Initializers_Tests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: IR.Operation! - var subject: SelectionSetTemplate! - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - operation = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - func buildSubjectAndOperation( - named operationName: String = "TestOperation", - schemaNamespace: String = "TestSchema", - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .swiftPackageManager, - operations: ApolloCodegenConfiguration.OperationsFileOutput = .inSchemaModule - ) throws { - ir = try .mock(schema: schemaSDL, document: document) - let operationDefinition = try XCTUnwrap(ir.compilationResult[operation: operationName]) - operation = ir.build(operation: operationDefinition) - let config = ApolloCodegenConfiguration.mock( - schemaNamespace: schemaNamespace, - output: .mock(moduleType: moduleType, operations: operations), - options: .init() - ) - let mockTemplateRenderer = MockTemplateRenderer( - target: .operationFile, - template: "", - config: .init(config: config) - ) - subject = SelectionSetTemplate( - definition: .operation(self.operation), - generateInitializers: true, - config: ApolloCodegen.ConfigurationContext(config: config), - renderAccessControl: mockTemplateRenderer.accessControlModifier(for: .member) - ) - } - - func buildSubjectAndFragment( - named fragmentName: String = "TestFragment", - schemaNamespace: String = "TestSchema", - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .swiftPackageManager, - operations: ApolloCodegenConfiguration.OperationsFileOutput = .inSchemaModule - ) throws -> IR.NamedFragment { - ir = try .mock(schema: schemaSDL, document: document) - let fragmentDefinition = try XCTUnwrap(ir.compilationResult[fragment: fragmentName]) - let fragment = ir.build(fragment: fragmentDefinition) - let config = ApolloCodegenConfiguration.mock( - schemaNamespace: schemaNamespace, - output: .mock(moduleType: moduleType, operations: operations), - options: .init() - ) - let mockTemplateRenderer = MockTemplateRenderer( - target: .operationFile, - template: "", - config: .init(config: config) - ) - subject = SelectionSetTemplate( - definition: .namedFragment(fragment), - generateInitializers: true, - config: ApolloCodegen.ConfigurationContext(config: config), - renderAccessControl: mockTemplateRenderer.accessControlModifier(for: .member) - ) - return fragment - } - - func buildSimpleObjectSchemaAndDocument() { - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - } - - // MARK: - Access Level Tests - - func test__render__givenSelectionSet_whenModuleType_swiftPackageManager_andOperations_inSchemaModule_shouldRenderWithPublicAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - public init( - """ - - try buildSubjectAndOperation( - moduleType: .swiftPackageManager, - operations: .inSchemaModule - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render__givenSelectionSet_whenModuleType_EmbededInTargetWithPublicAccessModifier_andOperations_inSchemaModule_shouldRenderWithPublicAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - public init( - """ - - try buildSubjectAndOperation( - moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .public), - operations: .inSchemaModule - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render__givenSelectionSet_whenModuleType_EmbededInTargetWithInternalAccessModifier_andOperations_inSchemaModule_shouldRenderWithInternalAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - init( - """ - - try buildSubjectAndOperation( - moduleType: .embeddedInTarget(name: "TestTarget", accessModifier: .internal), - operations: .inSchemaModule - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render__givenSelectionSet_whenModuleType_swiftPackageManager_andOperations_relativeWithPublicAccessModifier_shouldRenderWithPublicAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - public init( - """ - - try buildSubjectAndOperation( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil, accessModifier: .public) - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render__givenSelectionSet_whenModuleType_swiftPackageManager_andOperations_relativeWithInternalAccessModifier_shouldRenderWithInternalAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - init( - """ - - try buildSubjectAndOperation( - moduleType: .swiftPackageManager, - operations: .relative(subpath: nil, accessModifier: .internal) - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render__givenSelectionSet_whenModuleType_swiftPackageManager_andOperations_absoluteWithPublicAccessModifier_shouldRenderWithPublicAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - public init( - """ - - try buildSubjectAndOperation( - moduleType: .swiftPackageManager, - operations: .absolute(path: "", accessModifier: .public) - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render__givenSelectionSet_whenModuleType_swiftPackageManager_andOperations_absoluteWithInternalAccessModifier_shouldRenderWithInternalAccess() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = """ - init( - """ - - try buildSubjectAndOperation( - moduleType: .swiftPackageManager, - operations: .absolute(path: "", accessModifier: .internal) - ) - - let basic = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: basic) - - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - // MARK: Object Type Tests - - func test__render_givenSelectionSetOnObjectType_parametersDoNotIncludeTypenameFieldAndObjectTypeIsRenderedDirectly() throws { - // given - buildSimpleObjectSchemaAndDocument() - - let expected = - """ - public init( - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_givenSelectionSetOnInterfaceType_parametersIncludeTypenameField() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - species - } - } - """ - - let expected = - """ - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_givenSelectionSetOnUnionType_parametersIncludeFulfilledFragmentsWithUnion() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - - type Cat { - species: String! - } - - union AnimalUnion = Dog | Cat - """ - - document = """ - query TestOperation { - allAnimals { - species - ... on AnimalUnion { - ... on Dog { - name - } - } - } - } - """ - - let expected = - """ - public init( - name: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Dog.typename, - "name": name, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsAnimalUnion.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsAnimalUnion.AsDog.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals_asAnimalUnion_asDog = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "AnimalUnion"]?[as: "Dog"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asAnimalUnion_asDog) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_givenNestedTypeCaseSelectionSetOnInterfaceTypeNotInheritingFromParentInterface_fulfilledFragmentsIncludesAllTypeCasesInScope() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - interface Pet { - species: String! - } - - interface WarmBlooded { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - ... on WarmBlooded { - species - } - } - } - } - """ - - let expected = - """ - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals_asPet_asWarmBlooded = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet"]?[as: "WarmBlooded"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asPet_asWarmBlooded) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_givenNestedTypeCasesMergedFromSibling_fulfilledFragmentsIncludesAllTypeCasesInScope() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - interface Pet { - species: String! - } - - interface WarmBlooded { - species: String! - } - - type Cat implements Animal & Pet & WarmBlooded { - species: String! - isJellicle: Boolean! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - ... on WarmBlooded { - species - } - } - ... on Cat { - isJellicle - } - } - } - """ - - let expected = - """ - public init( - isJellicle: Bool, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Cat.typename, - "isJellicle": isJellicle, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsCat.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals_asCat = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Cat"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asCat) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - // MARK: Selection Tests - - func test__render_given_scalarFieldSelections_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - string_optional: String - int: Int! - int_optional: Int - float: Float! - float_optional: Float - boolean: Boolean! - boolean_optional: Boolean - custom: Custom! - custom_optional: Custom - custom_required_list: [Custom!]! - custom_optional_list: [Custom!] - list_required_required: [String!]! - list_optional_required: [String!] - list_required_optional: [String]! - list_optional_optional: [String] - nestedList_required_required_required: [[String!]!]! - nestedList_required_required_optional: [[String]!]! - nestedList_required_optional_optional: [[String]]! - nestedList_required_optional_required: [[String!]]! - nestedList_optional_required_required: [[String!]!] - nestedList_optional_required_optional: [[String]!] - nestedList_optional_optional_required: [[String!]] - nestedList_optional_optional_optional: [[String]] - } - - scalar Custom - """ - - document = """ - query TestOperation { - allAnimals { - string - string_optional - int - int_optional - float - float_optional - boolean - boolean_optional - custom - custom_optional - custom_required_list - custom_optional_list - list_required_required - list_optional_required - list_required_optional - list_optional_optional - nestedList_required_required_required - nestedList_required_required_optional - nestedList_required_optional_optional - nestedList_required_optional_required - nestedList_optional_required_required - nestedList_optional_required_optional - nestedList_optional_optional_required - nestedList_optional_optional_optional - } - } - """ - - let expected = """ - public init( - string: String, - string_optional: String? = nil, - int: Int, - int_optional: Int? = nil, - float: Double, - float_optional: Double? = nil, - boolean: Bool, - boolean_optional: Bool? = nil, - custom: TestSchema.Custom, - custom_optional: TestSchema.Custom? = nil, - custom_required_list: [TestSchema.Custom], - custom_optional_list: [TestSchema.Custom]? = nil, - list_required_required: [String], - list_optional_required: [String]? = nil, - list_required_optional: [String?], - list_optional_optional: [String?]? = nil, - nestedList_required_required_required: [[String]], - nestedList_required_required_optional: [[String?]], - nestedList_required_optional_optional: [[String?]?], - nestedList_required_optional_required: [[String]?], - nestedList_optional_required_required: [[String]]? = nil, - nestedList_optional_required_optional: [[String?]]? = nil, - nestedList_optional_optional_required: [[String]?]? = nil, - nestedList_optional_optional_optional: [[String?]?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "string": string, - "string_optional": string_optional, - "int": int, - "int_optional": int_optional, - "float": float, - "float_optional": float_optional, - "boolean": boolean, - "boolean_optional": boolean_optional, - "custom": custom, - "custom_optional": custom_optional, - "custom_required_list": custom_required_list, - "custom_optional_list": custom_optional_list, - "list_required_required": list_required_required, - "list_optional_required": list_optional_required, - "list_required_optional": list_required_optional, - "list_optional_optional": list_optional_optional, - "nestedList_required_required_required": nestedList_required_required_required, - "nestedList_required_required_optional": nestedList_required_required_optional, - "nestedList_required_optional_optional": nestedList_required_optional_optional, - "nestedList_required_optional_required": nestedList_required_optional_required, - "nestedList_optional_required_required": nestedList_optional_required_required, - "nestedList_optional_required_optional": nestedList_optional_required_optional, - "nestedList_optional_optional_required": nestedList_optional_optional_required, - "nestedList_optional_optional_optional": nestedList_optional_optional_optional, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 62, ignoringExtraLines: true)) - } - - func test__render_given_differentCasedFields_rendersInitializerWithCorrectCasing() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - FIELDONE: String! - FieldTwo: String! - fieldthree: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - FIELDONE - FieldTwo - fieldthree - } - } - """ - - let expected = """ - public init( - fieldone: String, - fieldTwo: String, - fieldthree: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "FIELDONE": fieldone, - "FieldTwo": fieldTwo, - "fieldthree": fieldthree, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 20, ignoringExtraLines: true)) - } - - func test__render_given_fieldWithAlias_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - aliased: species - } - } - """ - - let expected = """ - public init( - aliased: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "aliased": aliased, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_listField_rendersInitializerWithListFieldTransformedToFieldData() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friends: [Animal!]! - } - """ - - document = """ - query TestOperation { - allAnimals { - friends { - species - } - } - } - """ - - let expected = """ - public init( - friends: [Friend] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_optionalListField_rendersInitializerWithListFieldTransformedToFieldData() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friends: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - friends { - species - } - } - } - """ - - let expected = """ - public init( - friends: [Friend]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_optionalListOfOptionalsField_rendersInitializerWithListFieldTransformedToFieldData() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friends: [Animal] - } - """ - - document = """ - query TestOperation { - allAnimals { - friends { - species - } - } - } - """ - - let expected = """ - public init( - friends: [Friend?]? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_entityFieldSelection_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - friend { - species - } - } - } - """ - - let expected = """ - public init( - friend: Friend - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "friend": friend._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_abstractEntityFieldSelectionWithNoFields_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - friend: Animal! - } - - type Cat implements Animal { - species: String! - friend: Animal! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Cat { - friend { - species - } - } - } - } - """ - - let expected = """ - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_entityFieldListSelection_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friends: [Animal!]! - } - """ - - document = """ - query TestOperation { - allAnimals { - friends { - species - } - } - } - """ - - let expected = #""" - public init( - friends: [Friend] - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "friends": friends._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """# - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_entityFieldSelection_nullable_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal - } - """ - - document = """ - query TestOperation { - allAnimals { - friend { - species - } - } - } - """ - - let expected = """ - public init( - friend: Friend? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "friend": friend._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - - func test__render_given_mergedSelection_rendersInitializer() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - age: Int! - } - - interface Pet implements Animal { - species: String! - age: Int! - } - """ - - document = """ - query TestOperation { - allAnimals { - age - ... on Pet { - species - } - } - } - """ - - let expected = - """ - public init( - __typename: String, - species: String, - age: Int - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - "age": age, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_given_mergedOnly_SelectionSet_rendersInitializer() throws { - // given - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - height: Height - } - - interface Pet implements Animal { - height: Height - } - - type Cat implements Animal & Pet { - breed: String! - height: Height - } - - type Height { - feet: Int - inches: Int - } - """ - - document = """ - query TestOperation { - allAnimals { - height { - inches - } - ... on Pet { - height { - feet - } - } - ... on Cat { - breed - } - } - } - """ - - let expected = - """ - public init( - inches: Int? = nil, - feet: Int? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Height.typename, - "inches": inches, - "feet": feet, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsCat.Height.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.Height.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.Height.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let asCat_height = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Cat"]?[field: "height"] as? IR.EntityField - ) - - let actual = subject.render(field: asCat_height) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - // MARK: Named Fragment Tests - - func test__render_givenNamedFragmentSelection_fulfilledFragmentsIncludesNamedFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - let expected = - """ - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(AnimalDetails.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 23, ignoringExtraLines: true)) - } - - func test__render_givenNamedFragmentSelectionNestedInNamedFragment_fulfilledFragmentsIncludesNamedFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - name: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - ...Fragment2 - } - - fragment Fragment2 on Animal { - name - } - """ - - let expected = - """ - public init( - __typename: String, - name: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(Fragment2.self), - ObjectIdentifier(AnimalDetails.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 25, ignoringExtraLines: true)) - } - - func test__render_givenTypeCaseWithNamedFragmentMergedFromParent_fulfilledFragmentsIncludesNamedFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - interface Pet { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ... on Pet { - ...AnimalDetails - } - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - let expected = - """ - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AnimalDetails.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals_asPet = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: allAnimals_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 23, ignoringExtraLines: true)) - } - - func test__render_givenNamedFragmentWithNonMatchingType_fulfilledFragmentsOnlyIncludesNamedFragmentOnTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - interface Pet { - species: String! - } - """ - - document = """ - query TestOperation { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Pet { - species - } - """ - - let allAnimals_expected = - """ - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - let allAnimals_asPet_expected = - """ - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), - ObjectIdentifier(AnimalDetails.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - let allAnimals_asPet = try XCTUnwrap(allAnimals[as: "Pet"]) - - let allAnimals_actual = subject.render(field: allAnimals) - let allAnimals_asPet_actual = subject.render(inlineFragment: allAnimals_asPet) - - // then - expect(allAnimals_actual).to(equalLineByLine( - allAnimals_expected, atLine: 16, ignoringExtraLines: true)) - - expect(allAnimals_asPet_actual).to(equalLineByLine( - allAnimals_asPet_expected, atLine: 23, ignoringExtraLines: true)) - } - - /// Verifies the fix for [#2989](https://github.com/apollographql/apollo-ios/issues/2989). - /// - /// When a fragment merges a type case from another fragment, the initializer at that type case - /// scope needs to include both the root and type case selection sets of the merged fragment. - /// - /// In this test, we are verifying that the `PredatorFragment.AsPet` selection set is included in - /// `fulfilledFragments`. - func test__render_givenNamedFragmentReferencingNamedFragmentInitializedAsTypeCaseFromChildFragment_fulfilledFragmentsIncludesChildFragmentTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - predators: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - ...Fragment1 - } - } - - fragment Fragment1 on Animal { - predators { - ...PredatorFragment - } - } - - fragment PredatorFragment on Animal { - ... on Pet { - ...PetFragment - } - } - - fragment PetFragment on Pet { - name - } - """ - - let expected = - """ - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(Fragment1.Predator.self), - ObjectIdentifier(Fragment1.Predator.AsPet.self), - ObjectIdentifier(PetFragment.self), - ObjectIdentifier(PredatorFragment.self), - ObjectIdentifier(PredatorFragment.AsPet.self) - ] - )) - } - """ - - // when - let fragment = try buildSubjectAndFragment(named: "Fragment1") - - let predators_asPet = try XCTUnwrap( - fragment[field: "predators"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: predators_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 26, ignoringExtraLines: true)) - } - - /// Verifies fix for [#2989](https://github.com/apollographql/apollo-ios/issues/2989). - /// - /// When a fragment merges a type case from another fragment, the initializer at that type case - /// scope needs to include both the root and type case selection sets of the merged fragment. - /// - /// In this test, we are verifying that the `PredatorFragment.Predator.AsPet` selection set is included in - /// `fulfilledFragments`. - func test__render_givenNamedFragmentWithNestedFieldMergedFromChildNamedFragmentInitializedAsTypeCaseFromChildFragment_fulfilledFragmentsIncludesChildFragmentTypeCase() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - predators: [Animal!] - } - - interface Pet { - name: String! - predators: [Animal!] - } - """ - - document = """ - query TestOperation { - allAnimals { - ...Fragment1 - } - } - - fragment Fragment1 on Animal { - ...PredatorFragment - } - - fragment PredatorFragment on Animal { - predators { - ... on Pet { - ...PetFragment - } - } - } - - fragment PetFragment on Pet { - name - } - """ - - let expected = - """ - public init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(Fragment1.Predator.self), - ObjectIdentifier(Fragment1.Predator.AsPet.self), - ObjectIdentifier(PetFragment.self), - ObjectIdentifier(PredatorFragment.Predator.self), - ObjectIdentifier(PredatorFragment.Predator.AsPet.self) - ] - )) - } - """ - - // when - let fragment = try buildSubjectAndFragment(named: "Fragment1") - - let predators_asPet = try XCTUnwrap( - fragment[field: "predators"]?[as: "Pet"] - ) - - let actual = subject.render(inlineFragment: predators_asPet) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 24, ignoringExtraLines: true)) - } - - // MARK: - Include/Skip Tests - - func test__render_given_fieldWithInclusionCondition_rendersInitializerWithOptionalParameter() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal! - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - name @include(if: $a) - } - } - """ - - let expected = """ - public init( - name: String? = nil - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "name": name, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__render_given_inlineFragmentWithInclusionCondition_rendersInitializerWithFulfilledFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal! - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ... @include(if: $a) { - name - } - friend { - species - } - } - } - """ - - let expected = """ - public init( - name: String, - friend: Friend - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "name": name, - "friend": friend._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a"] - ) - - let actual = subject.render(inlineFragment: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_given_inlineFragmentWithMultipleInclusionConditions_rendersInitializerWithFulfilledFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal! - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!, $b: Boolean!) { - allAnimals { - ... @include(if: $a) @skip(if: $b) { - name - } - friend { - species - } - } - } - """ - - let expected = """ - public init( - name: String, - friend: Friend - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "name": name, - "friend": friend._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfAAndNotB.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a" && !"b"] - ) - - let actual = subject.render(inlineFragment: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_given_inlineFragmentWithNestedInclusionConditions_rendersInitializerWithFulfilledFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal! - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!, $b: Boolean!) { - allAnimals { - ... @include(if: $a) { - ... @skip(if: $b) { - name - } - } - friend { - species - } - } - } - """ - - let expected = """ - public init( - name: String, - friend: Friend - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "name": name, - "friend": friend._fieldData, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.IfNotB.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a"]?[if: !"b"] - ) - - let actual = subject.render(inlineFragment: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_given_inlineFragmentWithInclusionConditionNestedInEntityWithOtherInclusionCondition_rendersInitializerWithFulfilledFragments() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - species: String! - friend: Animal! - name: String! - } - """ - - document = """ - query TestOperation($a: Boolean!, $b: Boolean!) { - allAnimals { - ... @include(if: $a) { - friend { - ... @skip(if: $b) { - name - } - species - } - } - } - } - """ - - let expected = """ - public init( - name: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": TestSchema.Objects.Animal.typename, - "name": name, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.Friend.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.Friend.IfNotB.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals_friend = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"]?[if: "a"]?[field: "friend"]?[if: !"b"] - ) - - let actual = subject.render(inlineFragment: allAnimals_friend) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - // MARK: Named Fragment & Include/Skip Tests - - func test__render_givenNamedFragmentWithInclusionCondition_fulfilledFragmentsOnlyIncludesNamedFragmentOnInlineFragmentForInclusionCondition() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - interface Pet { - species: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) { - allAnimals { - ...AnimalDetails @include(if: $a) - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - let allAnimals_expected = - """ - public init( - __typename: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) - ] - )) - } - """ - - let allAnimals_ifA_expected = - """ - public init( - __typename: String, - species: String - ) { - self.init(_dataDict: DataDict( - data: [ - "__typename": __typename, - "species": species, - ], - fulfilledFragments: [ - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self), - ObjectIdentifier(AnimalDetails.self) - ] - )) - } - """ - - // when - try buildSubjectAndOperation() - - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let allAnimals_actual = subject.render(field: allAnimals) - - let allAnimals_ifA = try XCTUnwrap(allAnimals[if: "a"]) - - let allAnimals_ifA_actual = subject.render(inlineFragment: allAnimals_ifA) - - // then - expect(allAnimals_actual).to(equalLineByLine( - allAnimals_expected, atLine: 23, ignoringExtraLines: true)) - expect(allAnimals_ifA_actual).to(equalLineByLine( - allAnimals_ifA_expected, atLine: 23, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift deleted file mode 100644 index 6f262e88f7..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift +++ /dev/null @@ -1,526 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class SelectionSetTemplate_LocalCacheMutationTests: XCTestCase { - - var schemaSDL: String! - var document: String! - var ir: IR! - var operation: IR.Operation! - var subject: SelectionSetTemplate! - - override func setUp() { - super.setUp() - } - - override func tearDown() { - schemaSDL = nil - document = nil - ir = nil - operation = nil - subject = nil - super.tearDown() - } - - // MARK: - Helpers - - func buildSubjectAndOperation( - schemaNamespace: String = "TestSchema", - named operationName: String = "TestOperation", - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .swiftPackageManager, - operations: ApolloCodegenConfiguration.OperationsFileOutput = .inSchemaModule - ) throws { - ir = try .mock(schema: schemaSDL, document: document) - let operationDefinition = try XCTUnwrap(ir.compilationResult[operation: operationName]) - operation = ir.build(operation: operationDefinition) - let config = ApolloCodegen.ConfigurationContext( - config: .mock( - schemaNamespace: schemaNamespace, - output: .mock(moduleType: moduleType, operations: operations) - ) - ) - let mockTemplateRenderer = MockTemplateRenderer( - target: .operationFile, - template: "", - config: config - ) - subject = SelectionSetTemplate( - definition: .operation(self.operation), - generateInitializers: false, - config: config, - renderAccessControl: mockTemplateRenderer.accessControlModifier(for: .member) - ) - } - - // MARK: - Declaration Tests - - func test__renderForEntityField__rendersDeclarationAsMutableSelectionSet() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ... on Dog { - name - } - } - } - """ - - let expected = """ - public struct AllAnimal: TestSchema.MutableSelectionSet { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 2, ignoringExtraLines: true)) - } - - func test__renderForInlineFragment__rendersDeclarationAsMutableInlineFragment() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ... on Dog { - name - } - } - } - """ - - let expected = """ - public struct AsDog: TestSchema.MutableInlineFragment { - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 18, ignoringExtraLines: true)) - } - - // MARK: - Accessor Tests - - func test__render_dataDict__rendersDataDictAsVar() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expected = """ - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - func test__render_fragmentContainer_dataDict__rendersDataDictAsVar() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - string: String! - int: Int! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ...FragmentA - } - } - - fragment FragmentA on Animal { - int - } - """ - - let expected = """ - public struct Fragments: FragmentContainer { - public var __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 17, ignoringExtraLines: true)) - } - - func test__render_fieldAccessors__rendersFieldAccessorWithGetterAndSetter() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - type Animal { - fieldName: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - fieldName - } - } - """ - - let expected = """ - public var fieldName: String { - get { __data["fieldName"] } - set { __data["fieldName"] = newValue } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_inlineFragmentAccessors__rendersAccessorWithGetterAndSetter() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ... on Dog { - name - } - } - } - """ - - let expected = """ - public var asDog: AsDog? { - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 12, ignoringExtraLines: true)) - } - - func test__render_namedFragmentAccessors__givenFragmentWithNoConditions_rendersAccessorWithGetterModifierAndSetterUnavailable() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ...AnimalDetails - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - let expected = """ - public var animalDetails: AnimalDetails { - get { _toFragment() } - _modify { var f = animalDetails; yield &f; __data = f.__data } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 21, ignoringExtraLines: true)) - } - - func test__render_namedFragmentAccessors__givenFragmentWithConditions_rendersAccessorAsOptionalWithGetterAndSetter() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query TestOperation($a: Boolean!) @apollo_client_ios_localCacheMutation { - allAnimals { - ...AnimalDetails @include(if: $a) - } - } - - fragment AnimalDetails on Animal { - species - } - """ - - let expected = """ - public var animalDetails: AnimalDetails? { - get { _toFragment() } - _modify { var f = animalDetails; yield &f; if let newData = f?.__data { __data = newData } } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } - } - """ - - // when - try buildSubjectAndOperation() - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - expect(actual).to(equalLineByLine(expected, atLine: 21, ignoringExtraLines: true)) - } - - // MARK: - Casing Tests - - func test__casingForMutableInlineFragment__givenLowercasedSchemaName_generatesFirstUppercasedNamespace() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ... on Dog { - name - } - } - } - """ - - // when - try buildSubjectAndOperation(schemaNamespace: "myschema") - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - let expected = """ - public struct AsDog: Myschema.MutableInlineFragment { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 18, ignoringExtraLines: true)) - } - - func test__casingForMutableInlineFragment__givenUppercasedSchemaName_generatesUppercasedNamespace() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ... on Dog { - name - } - } - } - """ - - // when - try buildSubjectAndOperation(schemaNamespace: "MYSCHEMA") - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - let expected = """ - public struct AsDog: MYSCHEMA.MutableInlineFragment { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 18, ignoringExtraLines: true)) - } - - func test__casingForMutableInlineFragment__givenCapitalizedSchemaName_generatesCapitalizedNamespace() throws { - // given - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - type Dog { - name: String! - } - """ - - document = """ - query TestOperation @apollo_client_ios_localCacheMutation { - allAnimals { - ... on Dog { - name - } - } - } - """ - - // when - try buildSubjectAndOperation(schemaNamespace: "MySchema") - let allAnimals = try XCTUnwrap( - operation[field: "query"]?[field: "allAnimals"] as? IR.EntityField - ) - - let actual = subject.render(field: allAnimals) - - // then - let expected = """ - public struct AsDog: MySchema.MutableInlineFragment { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 18, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SwiftPackageManagerModuleTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SwiftPackageManagerModuleTemplateTests.swift deleted file mode 100644 index a3902dacc5..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SwiftPackageManagerModuleTemplateTests.swift +++ /dev/null @@ -1,440 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -import Nimble - -class SwiftPackageManagerModuleTemplateTests: XCTestCase { - var subject: SwiftPackageManagerModuleTemplate! - - override func tearDown() { - super.tearDown() - subject = nil - } - - // MARK: Helpers - - private func buildSubject( - testMockConfig: ApolloCodegenConfiguration.TestMockFileOutput = .none, - config: ApolloCodegenConfiguration = .mock(schemaNamespace: "TestModule") - ) { - subject = .init( - testMockConfig: testMockConfig, - config: .init(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Boilerplate Tests - - func test__boilerplate__generatesCorrectSwiftToolsVersion() { - // given - buildSubject() - - let expected = """ - // swift-tools-version:5.7 - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__boilerplate__generatesRequiredImports() { - // given - buildSubject() - - let expected = """ - import PackageDescription - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - // MARK: PackageDescription tests - - func test__packageDescription__givenLowercaseSchemaName_generatesPackageDefinitionWithCapitalizedName() { - // given - buildSubject(config: .mock(schemaNamespace: "module")) - - let expected = """ - let package = Package( - name: "Module", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 5, ignoringExtraLines: true)) - } - - func test__packageDescription__givenUppercaseSchemaName_generatesPackageDefinitionWithUppercasedName() { - // given - buildSubject(config: .mock(schemaNamespace: "MODULE")) - - let expected = """ - let package = Package( - name: "MODULE", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 5, ignoringExtraLines: true)) - } - - func test__packageDescription__givenCapitalizedSchemaName_generatesPackageDefinitionWithCapitalizedName() { - // given - buildSubject(config: .mock(schemaNamespace: "NewModule")) - - let expected = """ - let package = Package( - name: "NewModule", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 5, ignoringExtraLines: true)) - } - - func test__packageDescription__generatesPlatforms() { - // given - buildSubject() - - let expected = """ - platforms: [ - .iOS(.v12), - .macOS(.v10_14), - .tvOS(.v12), - .watchOS(.v5), - ], - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) - } - - func test__packageDescription__givenLowercasedSchemaName_generatesProductWithCapitalizedName() { - // given - buildSubject(config: .mock(schemaNamespace: "newmodule")) - - let expected = """ - products: [ - .library(name: "Newmodule", targets: ["Newmodule"]), - ], - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__packageDescription__givenUppercasedSchemaName_generatesProductWithUppercasedName() { - // given - buildSubject(config: .mock(schemaNamespace: "NEWMODULE")) - - let expected = """ - products: [ - .library(name: "NEWMODULE", targets: ["NEWMODULE"]), - ], - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__packageDescription__givenCapitalizedSchemaName_generatesProductWithCapitalizedName() { - // given - buildSubject(config: .mock(schemaNamespace: "NewModule")) - - let expected = """ - products: [ - .library(name: "NewModule", targets: ["NewModule"]), - ], - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__packageDescription__generatesNoDependencies() { - // given - buildSubject() - - let expected = """ - dependencies: [ - .package(url: "https://github.com/apollographql/apollo-ios.git", from: "1.0.0"), - ], - """ - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 16, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfigNone_withLowercaseSchemaName_generatesTargetWithCapitalizedName() { - // given - buildSubject(config: .mock(schemaNamespace: "testmodule")) - - let expected = """ - targets: [ - .target( - name: "Testmodule", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 19, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfigNone_withUppercaseSchemaName_generatesTargetWithUppercasedName() { - // given - buildSubject(config: .mock(schemaNamespace: "TEST")) - - let expected = """ - targets: [ - .target( - name: "TEST", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 19, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfigNone_withCapitalizedSchemaName_generatesTargetWithCapitalizedName() { - // given - buildSubject(config: .mock(schemaNamespace: "TestModule")) - - let expected = """ - targets: [ - .target( - name: "TestModule", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 19, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_absolute_generatesTargets() { - // given - buildSubject(testMockConfig: .absolute(path: "path")) - - let expected = """ - targets: [ - .target( - name: "TestModule", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 19, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_swiftPackage_noTargetName_generatesProduct() { - // given - buildSubject(testMockConfig: .swiftPackage()) - - let expected = """ - products: [ - .library(name: "TestModule", targets: ["TestModule"]), - .library(name: "TestModuleTestMocks", targets: ["TestModuleTestMocks"]), - ], - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - - func test__packageDescription__givenTestMockConfig_swiftPackage_noTargetName_generatesTargets() { - // given - buildSubject(testMockConfig: .swiftPackage()) - - let expected = """ - targets: [ - .target( - name: "TestModule", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - .target( - name: "TestModuleTestMocks", - dependencies: [ - .product(name: "ApolloTestSupport", package: "apollo-ios"), - .target(name: "TestModule"), - ], - path: "./TestMocks" - ), - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 20, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_swiftPackage_withTargetName_generatesProduct() { - // given - buildSubject(testMockConfig: .swiftPackage(targetName: "CustomMocks")) - - let expected = """ - products: [ - .library(name: "TestModule", targets: ["TestModule"]), - .library(name: "CustomMocks", targets: ["CustomMocks"]), - ], - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 13, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_swiftPackage_withTargetName_generatesTargets() { - // given - buildSubject(testMockConfig: .swiftPackage(targetName: "CustomMocks")) - - let expected = """ - targets: [ - .target( - name: "TestModule", - dependencies: [ - .product(name: "ApolloAPI", package: "apollo-ios"), - ], - path: "./Sources" - ), - .target( - name: "CustomMocks", - dependencies: [ - .product(name: "ApolloTestSupport", package: "apollo-ios"), - .target(name: "TestModule"), - ], - path: "./CustomMocks" - ), - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 20, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_withLowercaseSchemaName_generatesTestMockTargetWithCapitalizedTargetDependency() { - // given - buildSubject( - testMockConfig: .swiftPackage(targetName: "CustomMocks"), - config: .mock(schemaNamespace: "testmodule")) - - let expected = """ - .target(name: "Testmodule"), - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 32, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_withUppercaseSchemaName_generatesTestMockTargetWithUppercaseTargetDependency() { - // given - buildSubject( - testMockConfig: .swiftPackage(targetName: "CustomMocks"), - config: .mock(schemaNamespace: "MODULE")) - - let expected = """ - .target(name: "MODULE"), - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 32, ignoringExtraLines: true)) - } - - func test__packageDescription__givenTestMockConfig_withCapitalizedSchemaName_generatesTestMockTargetWithCapitalizedTargetDependency() { - // given - buildSubject( - testMockConfig: .swiftPackage(targetName: "CustomMocks"), - config: .mock(schemaNamespace: "MyModule")) - - let expected = """ - .target(name: "MyModule"), - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 32, ignoringExtraLines: true)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_OperationFile_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_OperationFile_Tests.swift deleted file mode 100644 index 1af7e799ec..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_OperationFile_Tests.swift +++ /dev/null @@ -1,403 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -@testable import ApolloCodegenInternalTestHelpers -import Nimble - -class TemplateRenderer_OperationFile_Tests: XCTestCase { - - // MARK: Helpers - - private func buildConfig( - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - schemaNamespace: String = "testSchema", - operations: ApolloCodegenConfiguration.OperationsFileOutput, - cocoapodsCompatibleImportStatements: Bool = false - ) -> ApolloCodegenConfiguration { - ApolloCodegenConfiguration.mock( - schemaNamespace: schemaNamespace, - input: .init(schemaPath: "MockInputPath", operationSearchPaths: []), - output: .mock(moduleType: moduleType, operations: operations), - options: .init(cocoapodsCompatibleImportStatements: cocoapodsCompatibleImportStatements) - ) - } - - private func buildSubject(config: ApolloCodegenConfiguration = .mock()) -> MockFileTemplate { - MockFileTemplate(target: .operationFile, config: ApolloCodegen.ConfigurationContext(config: config)) - } - - // MARK: Render Target .operationFile Tests - - func test__renderTargetOperationFile__givenAllSchemaTypesOperationsCombinations_shouldIncludeHeaderComment() { - // given - let expected = """ - // @generated - // This file was automatically generated and should not be edited. - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput - )] = [ - (schemaTypes: .swiftPackageManager, operations: .relative(subpath: nil)), - (schemaTypes: .swiftPackageManager, operations: .absolute(path: "path")), - (schemaTypes: .swiftPackageManager, operations: .inSchemaModule), - (schemaTypes: .other, operations: .relative(subpath: nil)), - (schemaTypes: .other, operations: .absolute(path: "path")), - (schemaTypes: .other, operations: .inSchemaModule), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "path")), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - - func test__renderTargetOperationFile__givenAllSchemaTypesOperationsCombinations_conditionallyIncludeImportStatements() { - // given - let expectedAPI = """ - @_exported import ApolloAPI - - """ - - let expectedAPIAndSchema = """ - @_exported import ApolloAPI - import TestSchema - - """ - - let expectedAPIAndTarget = """ - @_exported import ApolloAPI - import MockApplication - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedAPI - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedAPI - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil), - expectation: expectedAPIAndTarget - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path"), - expectation: expectedAPIAndTarget - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule, - expectation: expectedAPI - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: 4, ignoringExtraLines: true)) - } - } - - func test__renderTargetOperationFile__given_cocoapodsCompatibleImportStatements_true_allSchemaTypesOperationsCombinations_conditionallyIncludeImportStatements() { - // given - let expectedAPI = """ - @_exported import Apollo - - """ - - let expectedAPIAndSchema = """ - @_exported import Apollo - import TestSchema - - """ - - let expectedAPIAndTarget = """ - @_exported import Apollo - import MockApplication - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedAPI - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedAPIAndSchema - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedAPI - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil), - expectation: expectedAPIAndTarget - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path"), - expectation: expectedAPIAndTarget - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule, - expectation: expectedAPI - ) - ] - - for test in tests { - let config = buildConfig( - moduleType: test.schemaTypes, - operations: test.operations, - cocoapodsCompatibleImportStatements: true - ) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: 4, ignoringExtraLines: true)) - } - } - - func test__renderTargetOperationFile__givenAllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - root { - nested - } - """ - - let expectedPublicNamespace = """ - public extension TestSchema { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - extension TestSchema { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 7 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 7 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 7 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 7 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 7 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 7 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - // MARK: Casing Tests - - func test__casing__givenLowercasedSchemaName_shouldGenerateFirstUppercasedNamespace() { - // given - - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "testschema", - operations: .inSchemaModule) - - let subject = buildSubject(config: config) - - let expected = """ - public extension Testschema { - """ - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__casing__givenUppercasedSchemaName_shouldGenerateUppercasedNamespace() { - // given - - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "TESTSCHEMA", - operations: .inSchemaModule) - - let subject = buildSubject(config: config) - - let expected = """ - public extension TESTSCHEMA { - """ - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } - - func test__casing__givenCapitalizedSchemaName_shouldGenerateCapitalizedNamespace() { - // given - - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "TestSchema", - operations: .inSchemaModule) - - let subject = buildSubject(config: config) - - let expected = """ - public extension TestSchema { - """ - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_SchemaFile_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_SchemaFile_Tests.swift deleted file mode 100644 index 04ec952e4d..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_SchemaFile_Tests.swift +++ /dev/null @@ -1,1296 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -@testable import ApolloCodegenInternalTestHelpers -import Nimble - -class TemplateRenderer_SchemaFile_Tests: XCTestCase { - - // MARK: Helpers - - private func buildConfig( - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - schemaNamespace: String = "testSchema", - operations: ApolloCodegenConfiguration.OperationsFileOutput, - cocoapodsCompatibleImportStatements: Bool = false - ) -> ApolloCodegenConfiguration { - ApolloCodegenConfiguration.mock( - schemaNamespace: schemaNamespace, - input: .init(schemaPath: "MockInputPath", operationSearchPaths: []), - output: .mock(moduleType: moduleType, operations: operations), - options: .init(cocoapodsCompatibleImportStatements: cocoapodsCompatibleImportStatements) - ) - } - - private func buildSubject( - config: ApolloCodegenConfiguration = .mock(), - targetFileType: TemplateTarget.SchemaFileType = .schemaMetadata - ) -> MockFileTemplate { - MockFileTemplate( - target: .schemaFile(type: targetFileType), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - // MARK: Render Target .schemaFile Tests - - func test__renderTargetSchemaFile__givenAllSchemaTypesOperationsCombinations_shouldIncludeHeaderComment() { - // given - let expected = """ - // @generated - // This file was automatically generated and should not be edited. - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput - )] = [ - (schemaTypes: .swiftPackageManager, operations: .relative(subpath: nil)), - (schemaTypes: .swiftPackageManager, operations: .absolute(path: "path")), - (schemaTypes: .swiftPackageManager, operations: .inSchemaModule), - (schemaTypes: .other, operations: .relative(subpath: nil)), - (schemaTypes: .other, operations: .absolute(path: "path")), - (schemaTypes: .other, operations: .inSchemaModule), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "path")), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - - func test__renderTargetSchemaFile__givenAllSchemaTypesOperationsCombinations_shouldIncludeImportStatement() { - // given - let expected = """ - import ApolloAPI - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil) - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path") - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil) - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path") - ), - ( - schemaTypes: .other, - operations: .inSchemaModule - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil) - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path") - ), - ( - .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } - } - - func test__renderTargetSchemaFile__given_cocoapodsCompatibleImportStatements_true_allSchemaTypesOperationsCombinations_shouldIncludeImportStatement() { - // given - let expected = """ - import Apollo - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil) - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path") - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil) - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path") - ), - ( - schemaTypes: .other, - operations: .inSchemaModule - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil) - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path") - ), - ( - .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule - ) - ] - - for test in tests { - let config = buildConfig( - moduleType: test.schemaTypes, - operations: test.operations, - cocoapodsCompatibleImportStatements: true - ) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } - } - - func test__renderTargetSchemaFile__given_schemaTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - root { - nested - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .schemaMetadata) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_schemaCacheKeyResolutionExtensionTypeFile_AllSchemaTypesOperationsCombinations_doesNotWrapInNamespace() { - // given - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil), - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path"), - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule, - atLine: 6 - ) - ] - - let expected = """ - detached { - nested - } - - root { - nested - } - """ - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .schemaConfiguration) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_enumTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - root { - nested - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .enum) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_inputObjectTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - root { - nested - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .inputObject) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_customScalarTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - root { - nested - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .customScalar) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_objectTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - public extension Objects { - root { - nested - } - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema.Objects { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema.Objects { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .object) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_interfaceTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - public extension Interfaces { - root { - nested - } - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema.Interfaces { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema.Interfaces { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .interface) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - func test__renderTargetSchemaFile__given_unionTypeFile_AllSchemaTypesOperationsCombinations_conditionallyWrapInNamespace() { - // given - let expectedNoNamespace = """ - detached { - nested - } - - public extension Unions { - root { - nested - } - } - """ - - let expectedPublicNamespace = """ - detached { - nested - } - - public extension TestSchema.Unions { - root { - nested - } - } - """ - - let expectedInternalNamespace = """ - detached { - nested - } - - extension TestSchema.Unions { - root { - nested - } - } - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - expectation: String, - atLine: Int - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - expectation: expectedNoNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .relative(subpath: nil), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .relative(subpath: nil), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .absolute(path: "path"), - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .absolute(path: "path"), - expectation: expectedInternalNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - operations: .inSchemaModule, - expectation: expectedPublicNamespace, - atLine: 6 - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication", accessModifier: .internal), - operations: .inSchemaModule, - expectation: expectedInternalNamespace, - atLine: 6 - ) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config, targetFileType: .union) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(test.expectation, atLine: test.atLine)) - } - } - - // MARK: Casing Tests - - func test__casing__givenLowercasedSchemaName_whenSchemaAndComponentNamespace_shouldGenerateFirstUppercasedNamespace() { - // given - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "testschema", - operations: .inSchemaModule) - - let subject = buildSubject(config: config, targetFileType: .union) - - // when - let actual = subject.render() - - // then - let expected = """ - public extension Testschema.Unions { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } - - func test__casing__givenUppercasedSchemaName_whenSchemaAndComponentNamespace_shouldGenerateUppercasedNamespace() { - // given - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "TESTSCHEMA", - operations: .inSchemaModule) - - let subject = buildSubject(config: config, targetFileType: .union) - - // when - let actual = subject.render() - - // then - let expected = """ - public extension TESTSCHEMA.Unions { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } - - func test__casing__givenCapitalizedSchemaName_whenSchemaAndComponentNamespace_shouldGenerateCapitalizedNamespace() { - // given - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "TestSchema", - operations: .inSchemaModule) - - let subject = buildSubject(config: config, targetFileType: .union) - - // when - let actual = subject.render() - - // then - let expected = """ - public extension TestSchema.Unions { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } - - func test__casing__givenLowercasedSchemaName_whenOnlySchemaNamespace_shouldGenerateFirstUppercasedNamespace() { - // given - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "testschema", - operations: .inSchemaModule) - - let subject = buildSubject(config: config, targetFileType: .customScalar) - - // when - let actual = subject.render() - - // then - let expected = """ - public extension Testschema { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } - - func test__casing__givenUppercasedSchemaName_whenOnlySchemaNamespace_shouldGenerateUppercasedNamespace() { - // given - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "TESTSCHEMA", - operations: .inSchemaModule) - - let subject = buildSubject(config: config, targetFileType: .customScalar) - - // when - let actual = subject.render() - - // then - let expected = """ - public extension TESTSCHEMA { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } - - func test__casing__givenCapitalizedSchemaName_whenOnlySchemaNamespace_shouldGenerateCapitalizedNamespace() { - // given - let config = buildConfig( - moduleType: .embeddedInTarget(name: "MockApplication", accessModifier: .public), - schemaNamespace: "TestSchema", - operations: .inSchemaModule) - - let subject = buildSubject(config: config, targetFileType: .customScalar) - - // when - let actual = subject.render() - - // then - let expected = """ - public extension TestSchema { - """ - - expect(actual).to(equalLineByLine(expected, atLine: 10, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_TestMockFile_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_TestMockFile_Tests.swift deleted file mode 100644 index 8909aaddbd..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateRenderer_TestMockFile_Tests.swift +++ /dev/null @@ -1,156 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -@testable import ApolloCodegenInternalTestHelpers -import Nimble - -class TemplateRenderer_TestMockFile_Tests: XCTestCase { - - // MARK: Helpers - - private func buildConfig( - moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - schemaNamespace: String = "testSchema", - operations: ApolloCodegenConfiguration.OperationsFileOutput, - cocoapodsCompatibleImportStatements: Bool = false - ) -> ApolloCodegenConfiguration { - ApolloCodegenConfiguration.mock( - schemaNamespace: schemaNamespace, - input: .init(schemaPath: "MockInputPath", operationSearchPaths: []), - output: .mock(moduleType: moduleType, operations: operations), - options: .init(cocoapodsCompatibleImportStatements: cocoapodsCompatibleImportStatements) - ) - } - - private func buildSubject(config: ApolloCodegenConfiguration = .mock()) -> MockFileTemplate { - MockFileTemplate(target: .testMockFile, config: ApolloCodegen.ConfigurationContext(config: config)) - } - - // MARK: Render Target .schemaFile Tests - - func test__renderTargetTestMockFile__givenAllSchemaTypesOperationsCombinations_shouldIncludeHeaderComment() { - // given - let expected = """ - // @generated - // This file was automatically generated and should not be edited. - - """ - - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput - )] = [ - (schemaTypes: .swiftPackageManager, operations: .relative(subpath: nil)), - (schemaTypes: .swiftPackageManager, operations: .absolute(path: "path")), - (schemaTypes: .swiftPackageManager, operations: .inSchemaModule), - (schemaTypes: .other, operations: .relative(subpath: nil)), - (schemaTypes: .other, operations: .absolute(path: "path")), - (schemaTypes: .other, operations: .inSchemaModule), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .relative(subpath: nil)), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .absolute(path: "path")), - (schemaTypes: .embeddedInTarget(name: "MockApplication"), operations: .inSchemaModule) - ] - - for test in tests { - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - - func test__renderTargetSchemaFile__givenAllSchemaTypesOperationsCombinations_conditionallyImportSchemaModule() { - // given - let tests: [( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType, - operations: ApolloCodegenConfiguration.OperationsFileOutput, - importModuleName: String - )] = [ - ( - schemaTypes: .swiftPackageManager, - operations: .relative(subpath: nil), - importModuleName: "TestSchema" - ), - ( - schemaTypes: .swiftPackageManager, - operations: .absolute(path: "path"), - importModuleName: "TestSchema" - ), - ( - schemaTypes: .swiftPackageManager, - operations: .inSchemaModule, - importModuleName: "TestSchema" - ), - ( - schemaTypes: .other, - operations: .relative(subpath: nil), - importModuleName: "TestSchema" - ), - ( - schemaTypes: .other, - operations: .absolute(path: "path"), - importModuleName: "TestSchema" - ), - ( - schemaTypes: .other, - operations: .inSchemaModule, - importModuleName: "TestSchema" - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .relative(subpath: nil), - importModuleName: "MockApplication" - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .absolute(path: "path"), - importModuleName: "MockApplication" - ), - ( - schemaTypes: .embeddedInTarget(name: "MockApplication"), - operations: .inSchemaModule, - importModuleName: "MockApplication" - ) - ] - - for test in tests { - let expected = """ - import ApolloTestSupport - import \(test.importModuleName) - - """ - let config = buildConfig(moduleType: test.schemaTypes, operations: test.operations) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } - } - - func test__renderTargetSchemaFile__given_cocoapodsCompatibleImportStatements_true_importTargetNameIsApollo() { - // given - let expected = """ - import Apollo - import TestSchema - - """ - let config = buildConfig( - moduleType: .swiftPackageManager, - operations: .inSchemaModule, - cocoapodsCompatibleImportStatements: true - ) - let subject = buildSubject(config: config) - - // when - let actual = subject.render() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 4, ignoringExtraLines: true)) - } -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateString_DeprecationMessage_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateString_DeprecationMessage_Tests.swift deleted file mode 100644 index 3c532262ab..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateString_DeprecationMessage_Tests.swift +++ /dev/null @@ -1,419 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -final class TemplateString_DeprecationMessage_Tests: XCTestCase { - - let config = ApolloCodegen.ConfigurationContext(config: .mock( - options: .init( - warningsOnDeprecatedUsage: .include - ) - )) - - // MARK: - Swift @available Attribute Tests - - func test__availableAttribute__givenDeprecationMessageWithNullCharacter_shouldEscapeNullCharacter() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \0 (escaped null character)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \0 (escaped null character)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__availableAttribute__givenDeprecationMessageWithBackslash_shouldEscapeBackslash() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \\ (escaped backslash)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \\ (escaped backslash)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__availableAttribute__givenDeprecationMessageWithHorizontalTab_shouldEscapeHorizontalTab() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \t (escaped horizontal tab)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \t (escaped horizontal tab)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__availableAttribute__givenDeprecationMessageWithLineFeed_shouldEscapeLineFeed() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \n (escaped line feed)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \n (escaped line feed)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__availableAttribute__givenDeprecationMessageWithCarriageReturn_shouldEscapeCarriageReturn() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \r (escaped carriage return)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \r (escaped carriage return)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__availableAttribute__givenDeprecationMessageWithDoubleQuote_shouldEscapeDoubleQuote() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \" (escaped double quote)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \" (escaped double quote)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__availableAttribute__givenDeprecationMessageWithSingleQuote_shouldEscapeSingleQuote() throws { - // given - let subject = TemplateString(""" - \(deprecationReason: "message with \' (escaped single quote)", config: config) - """) - - let expected = #""" - @available(*, deprecated, message: "message with \' (escaped single quote)") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: Swift #warning Directive Tests - - func test__warningDirective__givenDeprecationMessageWithNullCharacter_shouldEscapeNullCharacter() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \0 (escaped null character)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \0 (escaped null character)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__warningDirective__givenDeprecationMessageWithBackslash_shouldEscapeBackslash() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \\ (escaped backslash)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \\ (escaped backslash)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__warningDirective__givenDeprecationMessageWithHorizontalTab_shouldEscapeHorizontalTab() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \t (escaped horizontal tab)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \t (escaped horizontal tab)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__warningDirective__givenDeprecationMessageWithLineFeed_shouldEscapeLineFeed() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \n (escaped line feed)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \n (escaped line feed)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__warningDirective__givenDeprecationMessageWithCarriageReturn_shouldEscapeCarriageReturn() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \r (escaped carriage return)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \r (escaped carriage return)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__warningDirective__givenDeprecationMessageWithDoubleQuote_shouldEscapeDoubleQuote() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \" (escaped double quote)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \" (escaped double quote)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - func test__warningDirective__givenDeprecationMessageWithSingleQuote_shouldEscapeSingleQuote() throws { - // given - let subject = TemplateString(""" - \(field: "fieldOne", argument: "argOne", warningReason: "message with \' (escaped single quote)") - """) - - let expected = #""" - #warning("Argument 'argOne' of field 'fieldOne' is deprecated. Reason: 'message with \' (escaped single quote)'") - """# - - // then - let actual = subject.description - - expect(actual).to(equalLineByLine(expected)) - } - - // MARK: SDL-to-Generation Test - // - // These tests ensure that when given escaped characters in SDL the generation of Swift code works as - // expected from frontend parsing all the way to rendering of attributes, comments and warnings. - // There is a test here for all the places that the GraphQL schema supports the @deprecated - // directive. - - func test__field__givenSDLDeprecationMessageWithDoubleQuotes_shouldEscapeDoubleQuotes() throws { - // given - let schemaSDL = #""" - type Query { - animal: Animal - } - - type Animal { - genus: String @deprecated(reason: "message with all allowed escape characters: \\ and \" and \t and \n and \r.") - } - """# - - let document = """ - query GetAnimal { - animal { - genus - } - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: document) - let operation = ir.build(operation: try XCTUnwrap(ir.compilationResult[operation: "GetAnimal"])) - let subject = SelectionSetTemplate( - definition: .operation(operation), - generateInitializers: true, - config: config, - renderAccessControl: { "does not matter" }() - ) - - let expected = #""" - @available(*, deprecated, message: "message with all allowed escape characters: \\ and \" and \t and \n and \r.") - """# - - // then - let animal = try XCTUnwrap( - operation[field: "query"]?[field: "animal"] as? IR.EntityField - ) - - let actual = subject.render(field: animal) - - expect(actual).to(equalLineByLine(expected, atLine: 14, ignoringExtraLines: true)) - } - - func test__inputField_givenSDLDeprecationMessageWithDoubleQuotes_shouldEscapeDoubleQuotes() throws { - // given - let schemaSDL = #""" - type Query { - animal(filter: Filter): Animal - } - - type Animal { - name: String - } - - input Filter { - genus: String @deprecated(reason: "message with all allowed escape characters: \\ and \" and \t and \n and \r.") - } - """# - - let document = """ - query GetAnimal($filter: Filter) { - animal(filter: $filter) { - name - } - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: document) - let inputObject = ir.schema.referencedTypes.inputObjects[0] - - let subject = InputObjectTemplate(graphqlInputObject: inputObject, config: config) - - let expected = #""" - @available(*, deprecated, message: "message with all allowed escape characters: \\ and \" and \t and \n and \r.") - """# - - // then - let actual = subject.render() - - expect(actual).to(equalLineByLine(expected, atLine: 23, ignoringExtraLines: true)) - } - - func test__enum__givenSDLDeprecationMessageWithDoubleQuotes_shouldNotEscapeDoubleQuotes() throws { - // given - let schemaSDL = #""" - type Query { - animal: Animal - } - - type Animal { - name: String - size: Size - } - - enum Size { - tiny @deprecated(reason: "message with all allowed escape characters: \\ and \" and \t and \n and \r.") - small - large - } - """# - - let document = """ - query GetAnimal { - animal { - name - size - } - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: document) - let `enum` = ir.schema.referencedTypes.enums[0] - - let subject = EnumTemplate(graphqlEnum: `enum`, config: config) - - let expected = #""" - /// **Deprecated**: message with all allowed escape characters: \\ and \" and \t and \n and \r. - """# - - // then - let actual = subject.render() - - expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true)) - } - - func test__argument__givenSDLDeprecationMessageWithDoubleQuotes_shouldEscapeDoubleQuotes() throws { - // given - let schemaSDL = #""" - type Query { - animal: Animal - } - - type Animal { - species: String - predators(genus: String @deprecated(reason: "message with all allowed escape characters: \\ and \" and \t and \n and \r."), species: String): Animal - } - """# - - let document = """ - query GetAnimal($genus: String) { - animal { - species - predators(genus: $genus) { - species - } - } - } - """ - - let ir = try IR.mock(schema: schemaSDL, document: document) - let operation = ir.build(operation: try XCTUnwrap(ir.compilationResult[operation: "GetAnimal"])) - let subject = SelectionSetTemplate( - definition: .operation(operation), - generateInitializers: true, - config: config, - renderAccessControl: { "does not matter" }() - ) - - let expected = #""" - #warning("Argument 'genus' of field 'predators' is deprecated. Reason: 'message with all allowed escape characters: \\ and \" and \t and \n and \r.'") - """# - - // then - let animal = try XCTUnwrap( - operation[field: "query"]?[field: "animal"] as? IR.EntityField - ) - let actual = subject.render(field: animal) - - expect(actual).to(equalLineByLine(expected, atLine: 9, ignoringExtraLines: true)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateString_Documentation_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateString_Documentation_Tests.swift deleted file mode 100644 index 2b7c0f06e5..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/TemplateString_Documentation_Tests.swift +++ /dev/null @@ -1,178 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib - -class TemplateString_Documentation_Tests: XCTestCase { - - // MARK: Helpers - - override func tearDown() { - super.tearDown() - } - - func test__appendInterpolation_documentation__givenSingleLineString_returnsStringInDocComment() throws { - // given - let documentation = "This is some great documentation!" - - let expected = """ - /// This is some great documentation! - var test: String = "Test" - """ - - // when - let actual = TemplateString(""" - \(forceDocumentation: documentation) - var test: String = "Test" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenDocumentationIndented_returnsStringInDocComment() throws { - // given - let documentation = "This is some great documentation!" - - let expected = """ - /// This is some great documentation! - var test: String = "Test" - """ - - // when - let actual = TemplateString(""" - \(forceDocumentation: documentation) - var test: String = "Test" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenNil_removesDocumentationLine() throws { - // given - let expected = """ - var testA: String = "TestA" - var testB: String = "TestB" - """ - - // when - let actual = TemplateString(""" - var testA: String = "TestA" - \(forceDocumentation: nil) - var testB: String = "TestB" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenEmpty_removesDocumentationLine() throws { - // given - let expected = """ - var testA: String = "TestA" - var testB: String = "TestB" - """ - - // when - let actual = TemplateString(""" - var testA: String = "TestA" - \(forceDocumentation: "") - var testB: String = "TestB" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenStringWithNewlineCharacter_returnsStringInMultilineDocComment() throws { - // given - let documentation = "This is some great documentation!\nWith two lines!" - - let expected = """ - /// This is some great documentation! - /// With two lines! - var test: String = "Test" - """ - - // when - let actual = TemplateString(""" - \(forceDocumentation: documentation) - var test: String = "Test" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenMultilineString_returnsStringInMultilineDocComment() throws { - // given - let documentation = """ - This is some great documentation! - With two lines! - """ - - let expected = """ - /// This is some great documentation! - /// With two lines! - var test: String = "Test" - """ - - // when - let actual = TemplateString(""" - \(forceDocumentation: documentation) - var test: String = "Test" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenMultilineStringWithIndentedLine_returnsStringInMultilineDocComment() throws { - // given - let documentation = """ - This is some great documentation! - With two lines! - """ - - let expected = """ - /// This is some great documentation! - /// With two lines! - var test: String = "Test" - """ - - // when - let actual = TemplateString(""" - \(forceDocumentation: documentation) - var test: String = "Test" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - - func test__appendInterpolation_documentation__givenMultilineStringWithEmptyLine_returnsStringInMultilineDocComment() throws { - // given - let documentation = """ - This is some great documentation! - - With empty line! - """ - - let expected = """ - /// This is some great documentation! - /// - /// With empty line! - var test: String = "Test" - """ - - // when - let actual = TemplateString(""" - \(forceDocumentation: documentation) - var test: String = "Test" - """).description - - // then - expect(actual).to(equalLineByLine(expected)) - } - -} diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/UnionTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/UnionTemplateTests.swift deleted file mode 100644 index 900087b9e5..0000000000 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/UnionTemplateTests.swift +++ /dev/null @@ -1,283 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloAPI - -class UnionTemplateTests: XCTestCase { - var subject: UnionTemplate! - - override func tearDown() { - subject = nil - - super.tearDown() - } - - // MARK: - Helpers - - private func buildSubject( - name: String = "ClassroomPet", - documentation: String? = nil, - config: ApolloCodegenConfiguration = .mock() - ) { - subject = UnionTemplate( - graphqlUnion: GraphQLUnionType.mock( - name, - types: [ - GraphQLObjectType.mock("cat"), - GraphQLObjectType.mock("bird"), - GraphQLObjectType.mock("rat"), - GraphQLObjectType.mock("petRock") - ], - documentation: documentation - ), - config: ApolloCodegen.ConfigurationContext(config: config) - ) - } - - private func renderSubject() -> String { - subject.template.description - } - - // MARK: Boilerplate tests - - func test_render_generatesClosingParen() throws { - // given - buildSubject() - - // when - let actual = renderSubject() - - // then - expect(actual).to(endWith("\n)")) - } - - // MARK: CasingTests - - func test_render_givenLowercaseSchemaName_generatesUsingCapitalizedSchemaName() throws { - // given - buildSubject(config: .mock(schemaNamespace: "lowercased")) - - let expected = """ - possibleTypes: [ - Lowercased.Objects.Cat.self, - Lowercased.Objects.Bird.self, - Lowercased.Objects.Rat.self, - Lowercased.Objects.PetRock.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - func test_render_givenUppercaseSchemaName_generatesUsingUppercaseSchemaName() throws { - // given - buildSubject(config: .mock(schemaNamespace: "UPPER")) - - let expected = """ - possibleTypes: [ - UPPER.Objects.Cat.self, - UPPER.Objects.Bird.self, - UPPER.Objects.Rat.self, - UPPER.Objects.PetRock.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - func test_render_givenCapitalizedSchemaName_generatesUsingCapitalizedSchemaName() throws { - // given - buildSubject(config: .mock(schemaNamespace: "MySchema")) - - let expected = """ - possibleTypes: [ - MySchema.Objects.Cat.self, - MySchema.Objects.Bird.self, - MySchema.Objects.Rat.self, - MySchema.Objects.PetRock.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - // MARK: Class Generation Tests - - func test_render_generatesSwiftEnumDefinition() throws { - // given - buildSubject() - - let expected = """ - static let ClassroomPet = Union( - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - - func test_render_givenSchemaUnionWithLowercaseName_generatesSwiftEnumDefinitionAsUppercase() throws { - // given - buildSubject(name: "classroomPet") - - let expected = """ - static let ClassroomPet = Union( - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test_render_givenSchemaUnion_generatesNameProperty() throws { - // given - buildSubject() - - let expected = """ - name: "ClassroomPet", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 2, ignoringExtraLines: true)) - } - - func test_render_givenSchemaUnionWithLowercaseName_generatesNamePropertyAsLowercase() throws { - // given - buildSubject(name: "classroomPet") - - let expected = """ - name: "classroomPet", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 2, ignoringExtraLines: true)) - } - - func test_render_givenSchemaUnion_schemaTypesEmbeddedInTarget_generatesPossibleTypesPropertyWithSchameNamespace() throws { - // given - buildSubject() - - let expected = """ - possibleTypes: [ - TestSchema.Objects.Cat.self, - TestSchema.Objects.Bird.self, - TestSchema.Objects.Rat.self, - TestSchema.Objects.PetRock.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - func test_render_givenSchemaUnion_schemaTypesNotEmbeddedInTarget_generatesPossibleTypesPropertyWithoutSchemaNamespace() throws { - // given - buildSubject(config: .mock(.swiftPackageManager)) - - let expected = """ - possibleTypes: [ - Objects.Cat.self, - Objects.Bird.self, - Objects.Rat.self, - Objects.PetRock.self - ] - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, atLine: 3, ignoringExtraLines: true)) - } - - // MARK: Documentation Tests - - func test__render__givenSchemaDocumentation_include_hasDocumentation_shouldGenerateDocumentationComment() throws { - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .include)) - ) - - let expected = """ - /// \(documentation) - static let ClassroomPet = Union( - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - func test__render__givenSchemaDocumentation_exclude_hasDocumentation_shouldNotGenerateDocumentationComment() throws { - // given - // given - let documentation = "This is some great documentation!" - buildSubject( - documentation: documentation, - config: .mock(options: .init(schemaDocumentation: .exclude)) - ) - - let expected = """ - static let ClassroomPet = Union( - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - - // MARK: - Reserved Keyword Tests - - func test_render_usingReservedKeyword_shouldHaveSuffixedType() throws { - let keywords = ["Type", "type"] - - keywords.forEach { keyword in - // given - buildSubject(name: keyword) - - let expected = """ - static let \(keyword.firstUppercased)_Union = Union( - name: "\(keyword)", - """ - - // when - let actual = renderSubject() - - // then - expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true)) - } - } - -} diff --git a/Tests/ApolloCodegenTests/Extensions/GraphQLNamedType+SwiftTests.swift b/Tests/ApolloCodegenTests/Extensions/GraphQLNamedType+SwiftTests.swift deleted file mode 100644 index 3ea07351f8..0000000000 --- a/Tests/ApolloCodegenTests/Extensions/GraphQLNamedType+SwiftTests.swift +++ /dev/null @@ -1,30 +0,0 @@ -import XCTest -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers -import Nimble - -class GraphQLNamedType_SwiftTests: XCTestCase { - func test_swiftName_givenGraphQLScalar_boolean_providesCompatibleSwiftName() { - let graphqlNamedType = GraphQLType.scalar(.boolean()) - - expect(graphqlNamedType.namedType.swiftName).to(equal("Bool")) - } - - func test_swiftName_givenGraphQLScalar_int_providesCompatibleSwiftName() { - let graphqlNamedType = GraphQLType.scalar(.integer()) - - expect(graphqlNamedType.namedType.swiftName).to(equal("Int")) - } - - func test_swiftName_givenGraphQLScalar_float_providesCompatibleSwiftName() { - let graphqlNamedType = GraphQLType.scalar(.float()) - - expect(graphqlNamedType.namedType.swiftName).to(equal("Double")) - } - - func test_swiftName_givenGraphQLScalar_string_providesCompatibleSwiftName() { - let graphqlNamedType = GraphQLType.scalar(.string()) - - expect(graphqlNamedType.namedType.swiftName).to(equal("String")) - } -} diff --git a/Tests/ApolloCodegenTests/Extensions/String+Data.swift b/Tests/ApolloCodegenTests/Extensions/String+Data.swift deleted file mode 100644 index 32a9a56f34..0000000000 --- a/Tests/ApolloCodegenTests/Extensions/String+Data.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -extension String { - var asData: Data { self.data(using: .utf8)! } -} - -extension Data { - var asString: String { String(data: self, encoding: .utf8)! } -} diff --git a/Tests/ApolloCodegenTests/FileManagerExtensionTests.swift b/Tests/ApolloCodegenTests/FileManagerExtensionTests.swift deleted file mode 100644 index 493fc3ec9d..0000000000 --- a/Tests/ApolloCodegenTests/FileManagerExtensionTests.swift +++ /dev/null @@ -1,774 +0,0 @@ -import Foundation -import XCTest -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib -import Nimble - -class FileManagerExtensionTests: XCTestCase { - lazy var uniquePath: String = { - CodegenTestHelper.outputFolderURL().appendingPathComponent(UUID().uuidString) - }().path - - lazy var uniqueError: Error = { - NSError(domain: "FileManagerExtensionTest", code: Int.random(in: 1...100)) - }() - - lazy var uniqueData: Data = { - let length = Int(128) - let bytes = [UInt32](repeating: 0, count: length).map { _ in arc4random() } - return Data(bytes: bytes, count: length) - }() - - // MARK: Presence - - func test_doesFileExist_givenFileExistsAndIsDirectory_shouldReturnFalse() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - })) - - // then - expect(mocked.doesFileExist(atPath: self.uniquePath)).to(beFalse()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesFileExist_givenFileExistsAndIsNotDirectory_shouldReturnTrue() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - })) - - // then - expect(mocked.doesFileExist(atPath: self.uniquePath)).to(beTrue()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesFileExist_givenFileDoesNotExistAndIsDirectory_shouldReturnFalse() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - })) - - // then - expect(mocked.doesFileExist(atPath: self.uniquePath)).to(beFalse()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesFileExist_givenFileDoesNotExistAndIsNotDirectory_shouldReturnFalse() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - })) - - // then - expect(mocked.doesFileExist(atPath: self.uniquePath)).to(beFalse()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesDirectoryExist_givenFilesExistsAndIsDirectory_shouldReturnTrue() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - })) - - // then - expect(mocked.doesDirectoryExist(atPath: self.uniquePath)).to(beTrue()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesDirectoryExist_givenFileExistsAndIsNotDirectory_shouldReturnFalse() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - })) - - // then - expect(mocked.doesDirectoryExist(atPath: self.uniquePath)).to(beFalse()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesDirectoryExist_givenFileDoesNotExistAndIsDirectory_shouldReturnFalse() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - })) - - // then - expect(mocked.doesDirectoryExist(atPath: self.uniquePath)).to(beFalse()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_doesDirectoryExist_givenFileDoesNotExistAndIsNotDirectory_shouldFalse() { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - })) - - // then - expect(mocked.doesDirectoryExist(atPath: self.uniquePath)).to(beFalse()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - // MARK: Deletion - - func test_deleteFile_givenFileExistsAndIsDirectory_shouldThrow() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - })) - - // then - expect(try mocked.deleteFile(atPath: self.uniquePath)) - .to(throwError(FileManagerPathError.notAFile(path: self.uniquePath))) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteFile_givenFileExistsAndIsNotDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - - })) - mocked.mock(closure: .removeItem({ path in - expect(path).to(equal(self.uniquePath)) - })) - - // then - expect(try mocked.deleteFile(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteFile_givenFileExistsAndIsNotDirectoryAndError_shouldThrow() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - - })) - mocked.mock(closure: .removeItem({ path in - expect(path).to(equal(self.uniquePath)) - - throw self.uniqueError - })) - - // then - expect(try mocked.deleteFile(atPath: self.uniquePath)).to(throwError(self.uniqueError)) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteFile_givenFileDoesNotExistAndIsDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - })) - - // then - expect(try mocked.deleteFile(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteFile_givenFileDoesNotExistAndIsNotDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - })) - - // then - expect(try mocked.deleteFile(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteDirectory_givenFileExistsAndIsDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - - })) - mocked.mock(closure: .removeItem({ path in - expect(path).to(equal(self.uniquePath)) - })) - - // then - expect(try mocked.deleteDirectory(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteDirectory_givenFileExistsAndIsDirectoryAndError_shouldThrow() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - - })) - mocked.mock(closure: .removeItem({ path in - expect(path).to(equal(self.uniquePath)) - - throw self.uniqueError - })) - - // then - expect(try mocked.deleteDirectory(atPath: self.uniquePath)).to(throwError(self.uniqueError)) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteDirectory_givenFileExistsAndIsNotDirectory_shouldThrow() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - - })) - - // then - expect(try mocked.deleteDirectory(atPath: self.uniquePath)) - .to(throwError(FileManagerPathError.notADirectory(path: self.uniquePath))) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteDirectory_givenFileDoesNotExistAndIsDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - })) - - // then - expect(try mocked.deleteDirectory(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_deleteDirectory_givenFileDoesNotExistAndIsNotDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - })) - - // then - expect(try mocked.deleteDirectory(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - // MARK: Creation - - func test_createFile_givenContainingDirectoryDoesExistAndFileCreated_shouldNotThrow() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - - })) - mocked.mock(closure: .createFile({ path, data, attr in - expect(path).to(equal(self.uniquePath)) - expect(data).to(equal(self.uniqueData)) - expect(attr).to(beNil()) - - return true - - })) - - // then - expect( - try mocked.createFile(atPath: self.uniquePath, data:self.uniqueData) - ).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createFile_givenContainingDirectoryDoesExistAndFileNotCreated_shouldThrow() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - - })) - mocked.mock(closure: .createFile({ path, data, attr in - expect(path).to(equal(self.uniquePath)) - expect(data).to(equal(self.uniqueData)) - expect(attr).to(beNil()) - - return false - - })) - - // then - expect( - try mocked.createFile(atPath: self.uniquePath, data:self.uniqueData - )).to(throwError(FileManagerPathError.cannotCreateFile(at: self.uniquePath))) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createFile_givenContainingDirectoryDoesNotExistAndFileCreated_shouldNotThrow() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - - })) - mocked.mock(closure: .createFile({ path, data, attr in - expect(path).to(equal(self.uniquePath)) - expect(data).to(equal(self.uniqueData)) - expect(attr).to(beNil()) - - return true - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attr in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attr).to(beNil()) - })) - - // then - expect( - try mocked.createFile(atPath: self.uniquePath, data:self.uniqueData) - ).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createFile_givenContainingDirectoryDoesNotExistAndFileNotCreated_shouldThrow() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - - })) - mocked.mock(closure: .createFile({ path, data, attr in - expect(path).to(equal(self.uniquePath)) - expect(data).to(equal(self.uniqueData)) - expect(attr).to(beNil()) - - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attr in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attr).to(beNil()) - })) - - // then - expect( - try mocked.createFile(atPath: self.uniquePath, data:self.uniqueData) - ).to(throwError(FileManagerPathError.cannotCreateFile(at: self.uniquePath))) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createFile_givenContainingDirectoryDoesNotExistAndError_shouldThrow() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attr in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attr).to(beNil()) - - throw self.uniqueError - })) - - // then - expect(try mocked.createFile( - atPath: self.uniquePath, - data:self.uniqueData - )).to(throwError(self.uniqueError)) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createFile_givenOverwriteFalse_whenFileExists_shouldNotThrow_shouldNotOverwrite() throws { - // given - let filePath = URL(fileURLWithPath: self.uniquePath).path - let directoryPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager(strict: true) - - mocked.mock(closure: .fileExists({ path, isDirectory in - switch path { - case directoryPath: isDirectory?.pointee = true - case filePath: isDirectory?.pointee = false - default: fail("Unknown path - \(path)") - } - - return true - - })) - mocked.mock(closure: .createFile({ path, data, attr in - fail("Tried to create file when overwrite was false") - - return false - })) - - // then - expect( - try mocked.createFile( - atPath: self.uniquePath, - data:self.uniqueData, - overwrite: false - ) - ).notTo(throwError()) - } - - func test_createContainingDirectory_givenFileExistsAndIsDirectory_shouldReturnEarly() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - - })) - - // then - expect(try mocked.createContainingDirectoryIfNeeded(forPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createContainingDirectory_givenFileExistsAndIsNotDirectory_shouldSucceed() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - })) - - // then - expect(try mocked.createContainingDirectoryIfNeeded(forPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createContainingDirectory_givenFileDoesNotExistAndIsDirectory_shouldSucceed() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - })) - - // then - expect(try mocked.createContainingDirectoryIfNeeded(forPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createContainingDirectory_givenFileDoesNotExistAndIsNotDirectory_shouldSucceed() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - })) - - // then - expect(try mocked.createContainingDirectoryIfNeeded(forPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createContainingDirectory_givenError_shouldThrow() throws { - // given - let parentPath = URL(fileURLWithPath: self.uniquePath).deletingLastPathComponent().path - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(parentPath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(parentPath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - - throw self.uniqueError - })) - - // then - expect(try mocked.createContainingDirectoryIfNeeded(forPath: self.uniquePath)) - .to(throwError(self.uniqueError)) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createDirectory_givenFileExistsAndIsDirectory_shouldReturnEarly() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return true - - })) - - // then - expect(try mocked.createDirectoryIfNeeded(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createDirectory_givenFileExistsAndIsNotDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return true - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(self.uniquePath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - })) - - // then - expect(try mocked.createDirectoryIfNeeded(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createDirectory_givenFileDoesNotExistAndIsDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = true - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(self.uniquePath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - })) - - // then - expect(try mocked.createDirectoryIfNeeded(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createDirectory_givenFileDoesNotExistAndIsNotDirectory_shouldSucceed() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(self.uniquePath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - })) - - // then - expect(try mocked.createDirectoryIfNeeded(atPath: self.uniquePath)).notTo(throwError()) - expect(mocked.allClosuresCalled).to(beTrue()) - } - - func test_createDirectory_givenError_shouldThrow() throws { - // given - let mocked = MockApolloFileManager() - - mocked.mock(closure: .fileExists({ path, isDirectory in - expect(path).to(equal(self.uniquePath)) - expect(isDirectory).notTo(beNil()) - - isDirectory?.pointee = false - return false - - })) - mocked.mock(closure: .createDirectory({ path, createIntermediates, attributes in - expect(path).to(equal(self.uniquePath)) - expect(createIntermediates).to(beTrue()) - expect(attributes).to(beNil()) - - throw self.uniqueError - })) - - // then - expect(try mocked.createDirectoryIfNeeded(atPath: self.uniquePath)) - .to(throwError(self.uniqueError)) - expect(mocked.allClosuresCalled).to(beTrue()) - } -} diff --git a/Tests/ApolloCodegenTests/Frontend/CompilationResultSchemaDocumentationTests.swift b/Tests/ApolloCodegenTests/Frontend/CompilationResultSchemaDocumentationTests.swift deleted file mode 100644 index ffaef59252..0000000000 --- a/Tests/ApolloCodegenTests/Frontend/CompilationResultSchemaDocumentationTests.swift +++ /dev/null @@ -1,367 +0,0 @@ -import XCTest -import Nimble -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class CompilationResultSchemaDocumentationTests: XCTestCase { - - var schemaSDL: String! - var document: String! - - override func setUpWithError() throws { - try super.setUpWithError() - - } - - override func tearDown() { - schemaSDL = nil - document = nil - - super.tearDown() - } - - // MARK: - Helpers - - func compileFrontend() throws -> CompilationResult { - let frontend = try GraphQLJSFrontend() - return try frontend.compile( - schema: schemaSDL, - document: document - ) - } - - // MARK: - Tests - - func testCompile_givenSchemaTypeDocumentation_includesSchemaDocumentation() throws { - let documentation = "The Schema Docs" - - schemaSDL = """ - "\(documentation)" - schema { - query: Query - } - - type Query { - a: String! - } - """ - - document = """ - query Test { - a - } - """ - - let compilationResult = try compileFrontend() - - expect(compilationResult.schemaDocumentation).to(equal(documentation)) - } - - func testCompile_givenMultilineDocumentation_includesDocumentation() throws { - let documentation = """ - The Root Query Object - What a great object! - """ - - schemaSDL = """ - ""\" - \(documentation) - ""\" - type Query { - a: String! - } - """ - - document = """ - query Test { - a - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "Query"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenObjectTypeWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - "\(documentation)" - type Query { - a: String! - } - """ - - document = """ - query Test { - a - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "Query"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenInterfaceTypeWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a: CustomInterface! - } - - "\(documentation)" - interface CustomInterface { - b: String! - } - """ - - document = """ - query Test { - a { - b - } - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "CustomInterface"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenUnionTypeWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a: CustomUnion! - } - - "\(documentation)" - union CustomUnion = One | Two - - type One { - one: String! - } - - type Two { - two: String! - } - """ - - document = """ - query Test { - a { - ... on One { - one - } - } - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "CustomUnion"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenScalarTypeWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a: CustomScalar! - } - - "\(documentation)" - scalar CustomScalar - """ - - document = """ - query Test { - a - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "CustomScalar"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenEnumTypeWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a: TestEnum! - } - - "\(documentation)" - enum TestEnum { - A - B - } - """ - - document = """ - query Test { - a - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "TestEnum"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenEnumValuesWithDocumentation_includesDocumentation() throws { - let documentation_A = "Enum case A" - let documentation_B = "Enum case B" - - schemaSDL = """ - type Query { - a: TestEnum! - } - - enum TestEnum { - "\(documentation_A)" - A - "\(documentation_B)" - B - } - """ - - document = """ - query Test { - a - } - """ - - let compilationResult = try compileFrontend() - let TestEnum = compilationResult[type: "TestEnum"] as? GraphQLEnumType - - expect(TestEnum?.values[0].documentation).to(equal(documentation_A)) - expect(TestEnum?.values[1].documentation).to(equal(documentation_B)) - } - - func testCompile_givenInputObjectTypeWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a(input: CustomInput!): String! - } - - "\(documentation)" - input CustomInput { - b: String! - } - """ - - document = """ - query Test($input: CustomInput!) { - a(input: $input) - } - """ - - let compilationResult = try compileFrontend() - let actual = compilationResult[type: "CustomInput"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenInputFieldWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a(input: CustomInput!): String! - } - - input CustomInput { - "\(documentation)" - b: String! - } - """ - - document = """ - query Test($input: CustomInput!) { - a(input: $input) - } - """ - - let compilationResult = try compileFrontend() - let CustomInput = compilationResult[type: "CustomInput"] as? GraphQLInputObjectType - let actual = CustomInput?.fields["b"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenFieldWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a: CustomType! - } - - type CustomType { - "\(documentation)" - b: String! - } - """ - - document = """ - query Test { - a { - b - } - } - """ - - let compilationResult = try compileFrontend() - let CustomType = compilationResult[type: "CustomType"] as? GraphQLObjectType - let actual = CustomType?.fields["b"] - - expect(actual?.documentation).to(equal(documentation)) - } - - func testCompile_givenFieldArgumentWithDocumentation_includesDocumentation() throws { - let documentation = "This is some great documentation!" - - schemaSDL = """ - type Query { - a: CustomType! - } - - type CustomType { - b( - "\(documentation)" - argument: String! - ): String! - } - """ - - document = """ - query Test { - a { - b(argument: "Value") - } - } - """ - - let compilationResult = try compileFrontend() - let CustomType = compilationResult[type: "CustomType"] as? GraphQLObjectType - let actual = CustomType?.fields["b"]?.arguments.first - - expect(actual?.documentation).to(equal(documentation)) - } -} diff --git a/Tests/ApolloCodegenTests/Frontend/CompilationTests.swift b/Tests/ApolloCodegenTests/Frontend/CompilationTests.swift deleted file mode 100644 index 8c6440488a..0000000000 --- a/Tests/ApolloCodegenTests/Frontend/CompilationTests.swift +++ /dev/null @@ -1,561 +0,0 @@ -import XCTest -import Nimble -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class CompilationTests: XCTestCase { - - var schemaSDL: String! - var schemaJSON: String! - var document: String! - - override func setUpWithError() throws { - try super.setUpWithError() - - } - - override func tearDown() { - schemaSDL = nil - schemaJSON = nil - document = nil - - super.tearDown() - } - - // MARK: - Helpers - - func useStarWarsSchema() throws { - schemaJSON = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - } - - func compileFrontend( - schemaNamespace: String = "TestSchema", - enableCCN: Bool = false - ) throws -> CompilationResult { - let frontend = try GraphQLJSFrontend() - let config = ApolloCodegen.ConfigurationContext(config: .mock( - schemaNamespace: schemaNamespace, - experimentalFeatures: .init(clientControlledNullability: enableCCN) - )) - - if let schemaSDL = schemaSDL { - return try frontend.compile( - schema: schemaSDL, - document: document, - config: config - ) - } else if let schemaJSON = schemaJSON { - return try frontend.compile( - schemaJSON: schemaJSON, - document: document, - config: config - ) - } else { - throw TestError("No Schema!") - } - } - - // MARK: - Tests - - func test__compile__givenSingleQuery() throws { - // given - try useStarWarsSchema() - - document = """ - query HeroAndFriendsNames($episode: Episode) { - hero(episode: $episode) { - name - friends { - name - } - } - } - """ - - let compilationResult = try compileFrontend() - - let operation = try XCTUnwrap(compilationResult.operations.first) - XCTAssertEqual(operation.name, "HeroAndFriendsNames") - XCTAssertEqual(operation.operationType, .query) - XCTAssertEqual(operation.rootType.name, "Query") - - XCTAssertEqual(operation.variables[0].name, "episode") - XCTAssertEqual(operation.variables[0].type.typeReference, "Episode") - - let heroField = try XCTUnwrap(operation.selectionSet.firstField(for: "hero")) - XCTAssertEqual(heroField.name, "hero") - XCTAssertEqual(heroField.type.typeReference, "Character") - - let episodeArgument = try XCTUnwrap(heroField.arguments?.first) - XCTAssertEqual(episodeArgument.name, "episode") - XCTAssertEqual(episodeArgument.value, .variable("episode")) - - let friendsField = try XCTUnwrap(heroField.selectionSet?.firstField(for: "friends")) - XCTAssertEqual(friendsField.name, "friends") - XCTAssertEqual(friendsField.type.typeReference, "[Character]") - - XCTAssertEqualUnordered(compilationResult.referencedTypes.map(\.name), - ["Human", "Droid", "Query", "Episode", "Character", "String"]) - } - - func test__compile__givenSingleQuery_withClientControlledNullability() throws { - // given - try useStarWarsSchema() - - document = """ - query HeroAndFriendsNames($id: ID) { - human(id: $id) { - name - mass! - appearsIn[!]? - } - } - """ - - let compilationResult = try compileFrontend(enableCCN: true) - - let operation = try XCTUnwrap(compilationResult.operations.first) - XCTAssertEqual(operation.name, "HeroAndFriendsNames") - XCTAssertEqual(operation.operationType, .query) - XCTAssertEqual(operation.rootType.name, "Query") - - XCTAssertEqual(operation.variables[0].name, "id") - XCTAssertEqual(operation.variables[0].type.typeReference, "ID") - - let heroField = try XCTUnwrap(operation.selectionSet.firstField(for: "human")) - XCTAssertEqual(heroField.name, "human") - XCTAssertEqual(heroField.type.typeReference, "Human") - - let episodeArgument = try XCTUnwrap(heroField.arguments?.first) - XCTAssertEqual(episodeArgument.name, "id") - XCTAssertEqual(episodeArgument.value, .variable("id")) - - let friendsField = try XCTUnwrap(heroField.selectionSet?.firstField(for: "mass")) - XCTAssertEqual(friendsField.name, "mass") - XCTAssertEqual(friendsField.type.typeReference, "Float!") - - let appearsInField = try XCTUnwrap(heroField.selectionSet?.firstField(for: "appearsIn")) - XCTAssertEqual(appearsInField.name, "appearsIn") - XCTAssertEqual(appearsInField.type.typeReference, "[Episode!]") - - XCTAssertEqualUnordered(compilationResult.referencedTypes.map(\.name), - ["ID", "Query", "Human", "Droid", "String", "Float", "Episode", "Character"]) - } - - func test__compile__givenOperationWithRecognizedDirective_hasDirective() throws { - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - - directive @testDirective on QUERY - """ - - document = """ - query Test @testDirective { - allAnimals { - species - } - } - """ - - let expectedDirectives: [CompilationResult.Directive] = [ - .mock("testDirective") - ] - - let compilationResult = try compileFrontend() - - - let operation = try XCTUnwrap(compilationResult.operations.first) - expect(operation.directives).to(equal(expectedDirectives)) - } - - /// Tests that we automatically add the local cache mutation directive to the schema - /// during codegen. - func test__compile__givenSchemaSDL_queryWithLocalCacheMutationDirective_notInSchema_hasDirective() throws { - schemaSDL = """ - type Query { - allAnimals: [Animal!] - } - - interface Animal { - species: String! - } - """ - - document = """ - query Test @apollo_client_ios_localCacheMutation { - allAnimals { - species - } - } - """ - - let expectedDirectives: [CompilationResult.Directive] = [ - .mock("apollo_client_ios_localCacheMutation") - ] - - let compilationResult = try compileFrontend() - - - let operation = try XCTUnwrap(compilationResult.operations.first) - expect(operation.directives).to(equal(expectedDirectives)) - } - - /// Tests that we automatically add the local cache mutation directive to the schema - /// during codegen. - func test__compile__givenSchemaJSON_queryWithLocalCacheMutationDirective_notInSchema_hasDirective() throws { - try useStarWarsSchema() - - document = """ - query HeroAndFriendsNames($id: ID) @apollo_client_ios_localCacheMutation { - human(id: $id) { - name - mass - appearsIn - } - } - """ - - let expectedDirectives: [CompilationResult.Directive] = [ - .mock("apollo_client_ios_localCacheMutation") - ] - - let compilationResult = try compileFrontend() - - - let operation = try XCTUnwrap(compilationResult.operations.first) - expect(operation.directives).to(equal(expectedDirectives)) - } - - func test__compile__givenInputObject_withListFieldWithDefaultValueEmptyArray() throws { - // given - schemaSDL = """ - type Query { - allAnimals(list: TestInput!): [Animal!]! - } - - input TestInput { - listField: [String!] = [] - } - - interface Animal { - species: String! - } - """ - - document = """ - query ListInputTest($input: TestInput!) { - allAnimals(list: $input) { - species - } - } - """ - - // when - let compilationResult = try compileFrontend() - - let inputObject = try XCTUnwrap( - compilationResult.referencedTypes.first { $0.name == "TestInput"} as? GraphQLInputObjectType - ) - let listField = try XCTUnwrap(inputObject.fields["listField"]) - let defaultValue = try XCTUnwrap(listField.defaultValue) - - // then - expect(defaultValue).to(equal(GraphQLValue.list([]))) - } - - func test__compile__givenUniqueSchemaName_shouldNotThrow() throws { - // given - schemaSDL = """ - type Query { - animal(favourite: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!] - nonNullPredators: [Animal!]! - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($favourite: String!) { - animal(favourite: $favourite) { - id - species - height { - centimeters - } - predators { - species - } - nonNullPredators { - species - } - } - } - """ - - // then - XCTAssertNoThrow(try compileFrontend(schemaNamespace: "MySchema")) - } - - func test__compile__givenSchemaName_matchingScalarFieldAndInputValueName_shouldNotThrow() throws { - // given - schemaSDL = """ - type Query { - animal(species: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!] - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($species: String!) { - animal(species: $species) { - species - } - } - """ - - // then - XCTAssertNoThrow(try compileFrontend(schemaNamespace: "species")) - } - - func test__compile__givenSchemaName_matchingEntityFieldName_shouldThrow() throws { - // given - schemaSDL = """ - type Query { - animal(favourite: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!] - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($favourite: String!) { - animal(favourite: $favourite) { - species - height { - centimeters - } - } - } - """ - - // then - XCTAssertThrowsError(try compileFrontend(schemaNamespace: "height")) { error in - XCTAssertTrue((error as! ApolloCodegenLib.JavaScriptError).description.contains(""" - Schema name "height" conflicts with name of a generated object API. \ - Please choose a different schema name. - """ - )) - } - } - - func test__compile__givenSingularSchemaName_matchingPluralizedNullableListFieldName_shouldThrow() throws { - // given - schemaSDL = """ - type Query { - animal(favourite: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!] - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($favourite: String!) { - animal(favourite: $favourite) { - species - predators { - species - } - } - } - """ - - // then - XCTAssertThrowsError(try compileFrontend(schemaNamespace: "predator")) { error in - XCTAssertTrue((error as! ApolloCodegenLib.JavaScriptError).description.contains(""" - Schema name "predator" conflicts with name of a generated object API. \ - Please choose a different schema name. - """ - )) - } - } - - func test__compile__givenSingularSchemaName_matchingPluralizedNonNullListFieldName_shouldThrow() throws { - // given - schemaSDL = """ - type Query { - animal(favourite: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($favourite: String!) { - animal(favourite: $favourite) { - species - predators { - species - } - } - } - """ - - // then - XCTAssertThrowsError(try compileFrontend(schemaNamespace: "predator")) { error in - XCTAssertTrue((error as! ApolloCodegenLib.JavaScriptError).description.contains(""" - Schema name "predator" conflicts with name of a generated object API. \ - Please choose a different schema name. - """ - )) - } - } - - func test__compile__givenPluralizedSchemaName_matchingPluralizedNullableListFieldName_shouldNotThrow() throws { - // given - schemaSDL = """ - type Query { - animal(favourite: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!] - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($favourite: String!) { - animal(favourite: $favourite) { - species - predators { - species - } - } - } - """ - - // then - XCTAssertNoThrow(try compileFrontend(schemaNamespace: "predators")) - } - - func test__compile__givenPluralizedSchemaName_matchingPluralizedNonNullListFieldName_shouldNotThrow() throws { - // given - schemaSDL = """ - type Query { - animal(favourite: String!): Animal - } - - interface Animal { - id: ID! - species: String! - height: Height! - predators: [Animal!]! - } - - type Height { - centimeters: Int! - inches: Int! - } - """ - - document = """ - query FavouriteAnimal($favourite: String!) { - animal(favourite: $favourite) { - species - predators { - species - } - } - } - """ - - // then - XCTAssertNoThrow(try compileFrontend(schemaNamespace: "predators")) - } - -} - -fileprivate extension CompilationResult.SelectionSet { - // This is a helper method that is really only suitable for testing because getting just the first - // occurrence of a field is of limited use when generating code. - func firstField(for responseKey: String) -> CompilationResult.Field? { - for selection in selections { - guard case let .field(field) = selection else { - continue - } - - if field.responseKey == responseKey { - return field - } - } - - return nil - } -} diff --git a/Tests/ApolloCodegenTests/Frontend/DocumentParsingAndValidationTests.swift b/Tests/ApolloCodegenTests/Frontend/DocumentParsingAndValidationTests.swift deleted file mode 100644 index d42cad9538..0000000000 --- a/Tests/ApolloCodegenTests/Frontend/DocumentParsingAndValidationTests.swift +++ /dev/null @@ -1,306 +0,0 @@ -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class DocumentParsingAndValidationTests: XCTestCase { - - var codegenFrontend: GraphQLJSFrontend! - var schema: GraphQLSchema! - - override func setUpWithError() throws { - try super.setUpWithError() - - codegenFrontend = try GraphQLJSFrontend() - - let introspectionResult = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - - schema = try codegenFrontend.loadSchema( - from: [try codegenFrontend.makeSource(introspectionResult, filePath: "schema.json")] - ) - } - - override func tearDown() { - codegenFrontend = nil - schema = nil - - super.tearDown() - } - - func testParseDocument() throws { - let source = try codegenFrontend.makeSource(""" - query HeroAndFriendsNames($episode: Episode) { - hero(episode: $episode) { - name - friends { - name - } - } - } - """, filePath: "HeroAndFriendsNames.graphql") - - let document = try codegenFrontend.parseDocument(source) - - XCTAssertEqual(document.filePath, "HeroAndFriendsNames.graphql") - } - - func testParseDocumentWithSyntaxError() throws { - let source = try codegenFrontend.makeSource(""" - query HeroAndFriendsNames($episode: Episode) { - hero[episode: foo] - } - """, filePath: "HeroAndFriendsNames.graphql") - - XCTAssertThrowsError(try codegenFrontend.parseDocument(source)) { error in - whileRecordingErrors { - let error = try XCTDowncast(error as AnyObject, to: GraphQLError.self) - XCTAssert(try XCTUnwrap(error.message).starts(with: "Syntax Error")) - - let sourceLocations = try XCTUnwrap(error.sourceLocations) - XCTAssertEqual(sourceLocations.count, 1) - - XCTAssertEqual(sourceLocations[0].filePath, "HeroAndFriendsNames.graphql") - XCTAssertEqual(sourceLocations[0].lineNumber, 2) - } - } - } - - func testValidateDocument() throws { - let source = try codegenFrontend.makeSource(""" - query HeroAndFriendsNames($episode: Episode) { - hero(episode: $episode) { - name - email - ...FriendsNames - } - } - """, filePath: "HeroAndFriendsNames.graphql") - - let document = try codegenFrontend.parseDocument(source) - - let validationErrors = try codegenFrontend.validateDocument( - schema: schema, - document: document, - validationOptions: .mock() - ) - - XCTAssertEqual(validationErrors.map(\.message), [ - """ - Cannot query field "email" on type "Character". - """, - """ - Unknown fragment "FriendsNames". - """ - ]) - - XCTAssertEqual(document.filePath, "HeroAndFriendsNames.graphql") - } - - func testParseAndValidateMultipleDocuments() throws { - let source1 = try codegenFrontend.makeSource(""" - query HeroAndFriendsNames($episode: Episode) { - hero(episode: $episode) { - name - ...FriendsNames - } - } - """, filePath: "HeroAndFriendsNames.graphql") - - let source2 = try codegenFrontend.makeSource(""" - query HeroName($episode: Episode) { - hero(episode: $episode) { - name - } - } - """, filePath: "HeroName.graphql") - - let source3 = try codegenFrontend.makeSource(""" - fragment FriendsNames on Character { - friends { - name - } - } - """, filePath: "FriendsNames.graphql") - - let document1 = try codegenFrontend.parseDocument(source1) - let document2 = try codegenFrontend.parseDocument(source2) - let document3 = try codegenFrontend.parseDocument(source3) - - let document = try codegenFrontend.mergeDocuments([document1, document2, document3]) - XCTAssertEqual(document.definitions.count, 3) - - let validationErrors = try codegenFrontend.validateDocument( - schema: schema, - document: document, - validationOptions: .mock() - ) - - XCTAssertEqual(validationErrors.count, 0) - } - - // Errors during validation may contain multiple source locations. In the case of a field conflict - // for example, both fields would be associated with the same error. These locations - // may even come from different source files, so we need to test for that explicitly because - // handling that situation required a workaround (see `GraphQLError.sourceLocations`). - func testValidationErrorThatSpansMultipleDocuments() throws { - let source1 = try codegenFrontend.makeSource(""" - query HeroName($episode: Episode) { - hero(episode: $episode) { - foo: appearsIn - ...HeroName - } - } - """, filePath: "HeroName.graphql") - - let source2 = try codegenFrontend.makeSource(""" - fragment HeroName on Character { - foo: name - } - """, filePath: "HeroNameFragment.graphql") - - let document1 = try codegenFrontend.parseDocument(source1) - let document2 = try codegenFrontend.parseDocument(source2) - - let document = try codegenFrontend.mergeDocuments([document1, document2]) - XCTAssertEqual(document.definitions.count, 2) - - let validationErrors = try codegenFrontend.validateDocument( - schema: schema, - document: document, - validationOptions: .mock() - ) - - XCTAssertEqual(validationErrors.count, 1) - let validationError = validationErrors[0] - - XCTAssertEqual(validationError.message, """ - Fields "foo" conflict because "appearsIn" and "name" are different fields. \ - Use different aliases on the fields to fetch both if this was intentional. - """) - - let sourceLocations = try XCTUnwrap(validationError.sourceLocations) - XCTAssertEqual(sourceLocations.count, 2) - - XCTAssertEqual(sourceLocations[0].filePath, "HeroName.graphql") - XCTAssertEqual(sourceLocations[0].lineNumber, 3) - - XCTAssertEqual(sourceLocations[1].filePath, "HeroNameFragment.graphql") - XCTAssertEqual(sourceLocations[1].lineNumber, 2) - } - - func test__validateDocument__givenFieldNameDisallowed_throwsError() throws { - let disallowedFields = ["__data", "fragments", "Fragments"] - - for field in disallowedFields { - let schema = try codegenFrontend.loadSchema( - from: [try codegenFrontend.makeSource( - """ - type Query { - \(field): String! - } - """ - , filePath: "schema.graphqls")]) - - let source = try codegenFrontend.makeSource(""" - query TestQuery { - \(field) - } - """, filePath: "TestQuery.graphql") - - let document = try codegenFrontend.parseDocument(source) - - let validationErrors = try codegenFrontend.validateDocument( - schema: schema, - document: document, - validationOptions: .mock() - ) - - XCTAssertEqual(validationErrors.map(\.message), [ - """ - Field name "\(field)" is not allowed because it conflicts with generated \ - object APIs. Please use an alias to change the field name. - """, - ]) - - XCTAssertEqual(document.filePath, "TestQuery.graphql") - } - } - - func test__validateDocument__givenInputParameterNameDisallowed_throwsError() throws { - let disallowedName = ["self", "Self", "_"] - - for name in disallowedName { - let schema = try codegenFrontend.loadSchema( - from: [try codegenFrontend.makeSource( - """ - type Query { - test(param: String!): String! - } - """ - , filePath: "schema.graphqls")]) - - let source = try codegenFrontend.makeSource(""" - query TestQuery($\(name): String!) { - test(param: $\(name)) - } - """, filePath: "TestQuery.graphql") - - let document = try codegenFrontend.parseDocument(source) - - let validationErrors = try codegenFrontend.validateDocument( - schema: schema, - document: document, - validationOptions: .mock() - ) - - XCTAssertEqual(validationErrors.map(\.message), [ - """ - Input Parameter name "\(name)" is not allowed because it conflicts with generated \ - object APIs. - """, - ]) - - XCTAssertEqual(document.filePath, "TestQuery.graphql") - } - } - - func test__validateDocument__givenInputParameterNameIsSchemaName_throwsError() throws { - let disallowedName = ["AnimalKingdomAPI", "animalKingdomAPI"] - - for name in disallowedName { - let schema = try codegenFrontend.loadSchema( - from: [try codegenFrontend.makeSource( - """ - type Query { - test(param: String!): String! - } - """ - , filePath: "schema.graphqls")]) - - let source = try codegenFrontend.makeSource(""" - query TestQuery($\(name): String!) { - test(param: $\(name)) - } - """, filePath: "TestQuery.graphql") - - let document = try codegenFrontend.parseDocument(source) - - let validationErrors = try codegenFrontend.validateDocument( - schema: schema, - document: document, - validationOptions: .mock(schemaNamespace: "AnimalKingdomAPI") - ) - - XCTAssertEqual(validationErrors.map(\.message), [ - """ - Input Parameter name "\(name)" is not allowed because it conflicts with generated \ - object APIs. - """, - ]) - - XCTAssertEqual(document.filePath, "TestQuery.graphql") - } - } -} diff --git a/Tests/ApolloCodegenTests/Frontend/SchemaIntrospectionTests.swift b/Tests/ApolloCodegenTests/Frontend/SchemaIntrospectionTests.swift deleted file mode 100644 index b9708e38d7..0000000000 --- a/Tests/ApolloCodegenTests/Frontend/SchemaIntrospectionTests.swift +++ /dev/null @@ -1,95 +0,0 @@ -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class SchemaIntrospectionTests: XCTestCase { - - var codegenFrontend: GraphQLJSFrontend! - var schema: GraphQLSchema! - - override func setUpWithError() throws { - try super.setUpWithError() - - codegenFrontend = try GraphQLJSFrontend() - - let introspectionResult = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - - schema = try codegenFrontend.loadSchema( - from: [try codegenFrontend.makeSource(introspectionResult, filePath: "schema.json")] - ) - } - - override func tearDown() { - codegenFrontend = nil - schema = nil - - super.tearDown() - } - - func testGetFieldsForObjectType() throws { - let droidType = try XCTDowncast(XCTUnwrap(schema.getType(named: "Droid")), to: GraphQLObjectType.self) - XCTAssertEqual(droidType.name, "Droid") - - let fields = droidType.fields - - XCTAssertEqual(fields["name"]?.name, "name") - XCTAssertEqual(fields["name"]?.type.typeReference, "String!") - - XCTAssertEqual(fields["friends"]?.name, "friends") - XCTAssertEqual(fields["friends"]?.type.typeReference, "[Character]") - } - - func testGetPossibleTypesForInterface() throws { - let characterType = try XCTDowncast(XCTUnwrap(schema.getType(named: "Character")), to: GraphQLAbstractType.self) - XCTAssertEqual(characterType.name, "Character") - - try XCTAssertEqualUnordered(schema.getPossibleTypes(characterType).map(\.name), ["Human", "Droid"]) - } - - func testGetPossibleTypesForUnion() throws { - let searchResultType = try XCTDowncast(XCTUnwrap(schema.getType(named: "SearchResult")), to: GraphQLAbstractType.self) - XCTAssertEqual(searchResultType.name, "SearchResult") - - try XCTAssertEqualUnordered(schema.getPossibleTypes(searchResultType).map(\.name), ["Human", "Droid", "Starship"]) - } - - func testGetTypesForUnion() throws { - let searchResultType = try XCTDowncast(XCTUnwrap(schema.getType(named: "SearchResult")), to: GraphQLUnionType.self) - XCTAssertEqual(searchResultType.name, "SearchResult") - - XCTAssertEqualUnordered(searchResultType.types.map(\.name), ["Human", "Droid", "Starship"]) - } - - func testEnumType() throws { - let episodeType = try XCTDowncast(XCTUnwrap(schema.getType(named: "Episode")), to: GraphQLEnumType.self) - XCTAssertEqual(episodeType.name, "Episode") - - XCTAssertEqual(episodeType.documentation, "The episodes in the Star Wars trilogy") - - XCTAssertEqual(episodeType.values.map(\.name.value), ["NEWHOPE", "EMPIRE", "JEDI"]) - XCTAssertEqual(episodeType.values.map(\.documentation), [ - "Star Wars Episode IV: A New Hope, released in 1977.", - "Star Wars Episode V: The Empire Strikes Back, released in 1980.", - "Star Wars Episode VI: Return of the Jedi, released in 1983." - ]) - } - - func testInputObjectType() throws { - let episodeType = try XCTDowncast(XCTUnwrap(schema.getType(named: "ReviewInput")), to: GraphQLInputObjectType.self) - XCTAssertEqual(episodeType.name, "ReviewInput") - - XCTAssertEqual(episodeType.documentation, "The input object sent when someone is creating a new review") - - XCTAssertEqual(episodeType.fields["stars"]?.type.typeReference, "Int!") - XCTAssertEqual(episodeType.fields["stars"]?.documentation, "0-5 stars") - - XCTAssertEqual(episodeType.fields["commentary"]?.type.typeReference, "String") - XCTAssertEqual(episodeType.fields["commentary"]?.documentation, "Comment about the movie, optional") - - XCTAssertEqual(episodeType.fields["favorite_color"]?.type.typeReference, "ColorInput") - XCTAssertEqual(episodeType.fields["favorite_color"]?.documentation, "Favorite color, optional") - } -} diff --git a/Tests/ApolloCodegenTests/Frontend/SchemaLoadingTests.swift b/Tests/ApolloCodegenTests/Frontend/SchemaLoadingTests.swift deleted file mode 100644 index 0279bb61cc..0000000000 --- a/Tests/ApolloCodegenTests/Frontend/SchemaLoadingTests.swift +++ /dev/null @@ -1,87 +0,0 @@ -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class SchemaLoadingTests: XCTestCase { - - var codegenFrontend: GraphQLJSFrontend! - - override func setUpWithError() throws { - try super.setUpWithError() - - codegenFrontend = try GraphQLJSFrontend() - } - - override func tearDown() { - codegenFrontend = nil - - super.tearDown() - } - - func testParseSchemaFromIntrospectionResult() throws { - let introspectionResult = try String( - contentsOf: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - - let schema = try codegenFrontend.loadSchema( - from: [try codegenFrontend.makeSource(introspectionResult, filePath: "schema.json")] - ) - - let characterType = try XCTUnwrap(schema.getType(named: "Character")) - XCTAssertEqual(characterType.name, "Character") - } - - func testParseSchemaFromSDL() throws { - let source = try codegenFrontend.makeSource( - from: ApolloCodegenInternalTestHelpers.Resources.StarWars.JSONSchema - ) - let schema = try codegenFrontend.loadSchema(from: [source]) - - let characterType = try XCTUnwrap(schema.getType(named: "Character")) - XCTAssertEqual(characterType.name, "Character") - } - - func testParseSchemaFromSDLWithSyntaxError() throws { - let source = try codegenFrontend.makeSource(""" - type Query { - foo - } - """, filePath: "schema.graphqls") - - XCTAssertThrowsError(try codegenFrontend.loadSchema(from: [source])) { error in - whileRecordingErrors { - let error = try XCTDowncast(error as AnyObject, to: GraphQLError.self) - XCTAssert(try XCTUnwrap(error.message).starts(with: "Syntax Error")) - - XCTAssertEqual(error.sourceLocations?.count, 1) - XCTAssertEqual(error.sourceLocations?[0].filePath, "schema.graphqls") - XCTAssertEqual(error.sourceLocations?[0].lineNumber, 3) - } - } - } - - func testParseSchemaFromSDLWithValidationErrors() throws { - let source = try codegenFrontend.makeSource(""" - type Query { - foo: Foo - bar: Bar - } - """, filePath: "schema.graphqls") - - XCTAssertThrowsError(try codegenFrontend.loadSchema(from: [source])) { error in - whileRecordingErrors { - print(error) - if let error1 = error as? GraphQLSchemaValidationError { - print(error1) - } - let error = try XCTDowncast(error as AnyObject, to: GraphQLSchemaValidationError.self) - - let validationErrors = error.validationErrors - XCTAssertEqual(validationErrors.count, 2) - XCTAssertEqual(validationErrors[0].message, "Unknown type \"Foo\".") - XCTAssertEqual(validationErrors[1].message, "Unknown type \"Bar\".") - } - } - } -} diff --git a/Tests/ApolloCodegenTests/GlobTests.swift b/Tests/ApolloCodegenTests/GlobTests.swift deleted file mode 100644 index f47c54dac8..0000000000 --- a/Tests/ApolloCodegenTests/GlobTests.swift +++ /dev/null @@ -1,609 +0,0 @@ -import XCTest -import Nimble -@testable import ApolloCodegenLib -import ApolloCodegenInternalTestHelpers - -class GlobTests: XCTestCase { - var baseURL: URL! - let fileManager = ApolloFileManager.default - - // MARK: Setup - - override func setUpWithError() throws { - try super.setUpWithError() - - baseURL = CodegenTestHelper.outputFolderURL().appendingPathComponent("Glob/\(UUID().uuidString)") - try fileManager.createDirectoryIfNeeded(atPath: baseURL.path) - } - - override func tearDownWithError() throws { - try ApolloFileManager.default.deleteDirectory(atPath: baseURL.path) - - try super.tearDownWithError() - } - - // MARK: Helpers - - private func create(files: [String]) throws { - for file in files { - try self.fileManager.createFile(atPath: file) - } - } - - private func changeCurrentDirectory(to directory: String) throws { - try fileManager.createDirectoryIfNeeded(atPath: directory) - expect(self.fileManager.base.changeCurrentDirectoryPath(directory)).to(beTrue()) - } - - // MARK: Tests - - func test_match_givenSinglePattern_usingAnyWildcard_whenNoMatch_shouldReturnEmpty() throws { - // given - let pattern = baseURL.appendingPathComponent("*.xyz").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("other/file.xyz").path - ]) - - // then - let results = try Glob([pattern]).match() - - expect(results).to(beEmpty()) - } - - func test_match_givenSinglePattern_usingAnyWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = baseURL.appendingPathComponent("*.one").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path - ])) - } - - func test_match_givenSinglePattern_usingAnyWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = baseURL.appendingPathComponent("file.*").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("another.one").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("file.one").path, - ])) - } - - func test_match_givenSinglePattern_usingSingleWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = baseURL.appendingPathComponent("fil?.one").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("filez.one").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path - ])) - } - - func test_match_givenSinglePattern_usingSingleWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = baseURL.appendingPathComponent("other/file.o?e").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/file.two").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/file.one").path, - ])) - } - - func test_match_givenMultiplePattern_usingAnyWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = [ - baseURL.appendingPathComponent("a/file.*").path, - baseURL.appendingPathComponent("a/*.ext").path - ] - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/another.file").path, - baseURL.appendingPathComponent("other/file.ext").path, - baseURL.appendingPathComponent("other/file.two").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path - ])) - } - - func test_match_givenMultiplePattern_usingAnyWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("a/file.*").path, - baseURL.appendingPathComponent("other/file.*").path - ] - - // when - try create(files: [ - baseURL.appendingPathComponent("file.ext").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/another.file").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/another.file").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/file.one").path, - ])) - } - - func test_match_givenMultiplePattern_usingSingleWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = [ - baseURL.appendingPathComponent("a/file.?ne").path, - baseURL.appendingPathComponent("other/file.?xt").path - ] - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path - ])) - } - - func test_match_givenMultiplePattern_usingSingleWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = [ - baseURL.appendingPathComponent("a/file.o?e").path, - baseURL.appendingPathComponent("other/file.o?e").path - ] - - // when - try create(files: [ - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/file.two").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/file.one").path, - ])) - } - - func test_match_givenSinglePattern_usingCombinedWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = baseURL.appendingPathComponent("*.o?e").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path - ])) - } - - func test_match_givenMultiplePattern_usingCombinedWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = [ - baseURL.appendingPathComponent("file.*").path, - baseURL.appendingPathComponent("other/file.o?e").path - ] - - // when - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("another.file").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/another.file").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("other/file.oye").path, - baseURL.appendingPathComponent("other/file.one").path, - ])) - } - - func test_match_givenGlobstarPattern_usingAnyWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = baseURL.appendingPathComponent("a/b/c/d/**/*.one").path - - // when - try create(files: [ - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path - ])) - } - - func test_match_givenGlobstarPattern_usingAnyWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = baseURL.appendingPathComponent("a/b/c/d/**/file.*").path - - // when - try create(files: [ - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("a/b/c/d/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - ])) - } - - func test_match_givenGlobstarPattern_usingSingleWildcard_whenSingleMatch_shouldReturnSingle() throws { - // given - let pattern = baseURL.appendingPathComponent("a/b/c/d/**/?ile.one").path - - // when - try create(files: [ - baseURL.appendingPathComponent("a/b/c/d/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path - ])) - } - - func test_match_givenGlobstarPattern_usingCombinedWildcard_whenMultipleMatch_shouldReturnMultiple() throws { - // given - let pattern = baseURL.appendingPathComponent("a/b/c/d/**/fil?.*").path - - // when - try create(files: [ - baseURL.appendingPathComponent("a/b/c/d/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/another.file").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("a/b/c/d/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - ])) - } - - func test_match_givenPattern_withExcludeNotFirst_shouldThrow() throws { - // given - let pattern = baseURL.appendingPathComponent("a/b/c/d/**/!file.swift").path - - // then - expect(try Glob([pattern]).match()).to(throwError(Glob.MatchError.invalidExclude(path: pattern))) - } - - func test_match_givenGlobstarPattern_usingPathExclude_whenMultipleMatch_shouldExclude() throws { - // given - let pattern = [ - baseURL.appendingPathComponent("a/b/c/d/**/file.*").path, - "!" + baseURL.appendingPathComponent("a/b/c/d/**/file.two").path, - ] - - // when - try create(files: [ - baseURL.appendingPathComponent("a/b/c/d/file.two").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.ext").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("a/b/c/d/e/f/file.ext").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - ])) - } - - func test_match_givenRelativePattern_usingNoPrefix_andRootCurrentDirectory_shouldUseCurrentDirectory() throws { - // given - let pattern = ["**/*.one"] - - // when - try changeCurrentDirectory(to: baseURL.path) - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - ])) - } - - func test_match_givenRelativePattern_usingNoPrefix_andSubfolderCurrentDirectory_shouldUseCurrentDirectory() throws { - // given - let pattern = ["**/*.one"] - - // when - try changeCurrentDirectory(to: baseURL.appendingPathComponent("a/").path) - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path - ])) - } - - func test_match_givenRelativePattern_usingSingleDotPrefix_shouldUseCurrentDirectory() throws { - // given - let pattern = ["./**/*.one"] - - // when - try changeCurrentDirectory(to: baseURL.path) - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - ])) - } - - func test_match_givenRelativePattern_usingNoPrefix_andRelativeToRootURL_shouldUseGivenRootURL() throws { - // given - let pattern = ["**/*.one"] - - // when - let rootURL = baseURL.appendingPathComponent("a/", isDirectory: true).standardizedFileURL - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern, relativeTo: rootURL).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path - ])) - } - - func test_match_givenRelativePattern_usingSingleDotPrefix_andRelativeToRootURL_shouldUseGivenRootURL() throws { - // given - let pattern = ["./**/*.one"] - - // when - let rootURL = baseURL.appendingPathComponent("a/", isDirectory: true).standardizedFileURL - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern, relativeTo: rootURL).match()).to(equal([ - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path - ])) - } - - func test_match_givenRelativePattern_withNoGlob_andRelativeToRootURL_shouldUsePathRelativeToRootURL() throws { - // given - let pattern = ["../file.one"] - - // when - let rootURL = baseURL.appendingPathComponent("relativeRoot/", isDirectory: true).standardizedFileURL - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("relativeRoot/file.one").path, - ]) - - // then - expect(try Glob(pattern, relativeTo: rootURL).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path, - ])) - } - - func test_match_givenAbsolutePattern_withGlob_andRelativeToRootURL_shouldUseAbsolutePathNotRelativeToRootURL() throws { - // given - // Absolute pattern beginning with `baseURL` folowed gy globstar - let pattern = [baseURL.appendingPathComponent("**/*.one").path] - - // when - let rootURL = baseURL.appendingPathComponent("empty/", isDirectory: true).standardizedFileURL - - try create(files: [ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("file.two").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.two").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("other/file.oye").path - ]) - - // then - expect(try Glob(pattern, relativeTo: rootURL).match()).to(equal([ - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("other/file.one").path, - baseURL.appendingPathComponent("a/file.one").path, - baseURL.appendingPathComponent("a/b/file.one").path, - baseURL.appendingPathComponent("a/b/c/file.one").path, - baseURL.appendingPathComponent("a/b/c/d/e/f/file.one").path, - ])) - } - - func test_match_givenAbsolutePattern_shouldMatch() throws { - // given - let pattern = baseURL.appendingPathComponent("other/file.xyz").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.xyz").path, - baseURL.appendingPathComponent("file.one").path, - baseURL.appendingPathComponent("other/file.xyz").path, - baseURL.appendingPathComponent("other/file.two").path - ]) - - // then - expect(try Glob([pattern]).match()).to(equal([ - baseURL.appendingPathComponent("other/file.xyz").path - ])) - } - - func test_match_givenExcludedDirectories_shouldNotMatchExcludedFiles() throws { - // given - let pattern = baseURL.appendingPathComponent("**/file.xyz").path - - // when - try create(files: [ - baseURL.appendingPathComponent("file.xyz").path, - baseURL.appendingPathComponent("nested/file.xyz").path, - baseURL.appendingPathComponent("nested/two/file.xyz").path, - baseURL.appendingPathComponent("DoNotInclude/file.xyz").path, - baseURL.appendingPathComponent("nested/DoNotInclude/file.xyz").path - ]) - - // then - expect(try Glob([pattern]).match(excludingDirectories: ["DoNotInclude"])).to(equal([ - baseURL.appendingPathComponent("file.xyz").path, - baseURL.appendingPathComponent("nested/file.xyz").path, - baseURL.appendingPathComponent("nested/two/file.xyz").path - ])) - } - -} diff --git a/Tests/ApolloCodegenTests/Info.plist b/Tests/ApolloCodegenTests/Info.plist deleted file mode 100644 index 64d65ca495..0000000000 --- a/Tests/ApolloCodegenTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Tests/ApolloCodegenTests/PluralizerTests.swift b/Tests/ApolloCodegenTests/PluralizerTests.swift deleted file mode 100644 index d2aedb6537..0000000000 --- a/Tests/ApolloCodegenTests/PluralizerTests.swift +++ /dev/null @@ -1,78 +0,0 @@ -import Foundation -import XCTest -@testable import ApolloCodegenLib - -class PluralizerTests: XCTestCase { - - func testSingularization_givenSimpleWord_shouldSingularize() { - let pluralizer = Pluralizer() - let pluralized = "Cats" - let singular = pluralizer.singularize(pluralized) - XCTAssertEqual(singular, "Cat") - } - - func testPluralization_givenSimpleWord_shouldPluralize() { - let pluralizer = Pluralizer() - let singular = "Cat" - let pluralized = pluralizer.pluralize(singular) - XCTAssertEqual(pluralized, "Cats") - } - - func testSingularization_addingSingularizationRule_shouldSingularize() { - let defaultPluralizer = Pluralizer() - let pluralized = "Atlases" - let beforeRule = defaultPluralizer.singularize(pluralized) - - // This should be wrong because we haven't applied the rule yet. - XCTAssertEqual(beforeRule, "Atlase") - - let pluralizerWithRule = Pluralizer(rules: [ - .singularization(pluralRegex: "(atlas)(es)?$", replacementRegex: "$1") - ]) - - let afterRule = pluralizerWithRule.singularize(pluralized) - - // Now that we've applied the rule, this should be correct - XCTAssertEqual(afterRule, "Atlas") - } - - func testPluralization_addingPluralizationRule_shouldPluralize() { - let defaultPluralizer = Pluralizer() - let singular = "Atlas" - let beforeRule = defaultPluralizer.pluralize(singular) - - // This should be wrong because we haven't applied the rule yet. - XCTAssertEqual(beforeRule, "Atlas") - - let pluralizerWithRule = Pluralizer(rules: [ - .pluralization(singularRegex: "(atla)s", replacementRegex: "$1ses") - ]) - let singularized = pluralizerWithRule.pluralize(singular) - - // Now that we've applied the rule, this should be correct - XCTAssertEqual(singularized, "Atlases") - } - - func testPluralization_givenSpecificCasing_shouldNotChangeCasing() { - let pluralizer = Pluralizer() - let singular = "CAT" - let pluralized = pluralizer.pluralize(singular) - XCTAssertEqual(pluralized, "CATs") - - let singularWithLowercase = "CaT" - let pluralizedWithLowercase = pluralizer.pluralize(singularWithLowercase) - XCTAssertEqual(pluralizedWithLowercase, "CaTs") - } - - func testSingularization_givenCasedSuffix_shouldSingularize() { - let pluralizer = Pluralizer() - let pluralizedAllCaps = "CTAS" - let singularizedAllCaps = pluralizer.singularize(pluralizedAllCaps) - XCTAssertEqual(singularizedAllCaps, "CTA") - - let pluralizedWithOneLowercase = "CTAs" - let singularizedWithOneLowercase = pluralizer.singularize(pluralizedWithOneLowercase) - XCTAssertEqual(singularizedWithOneLowercase, "CTA") - } - -} diff --git a/Tests/ApolloCodegenTests/Resources/introspection_response.json b/Tests/ApolloCodegenTests/Resources/introspection_response.json deleted file mode 100644 index a860f3deb2..0000000000 --- a/Tests/ApolloCodegenTests/Resources/introspection_response.json +++ /dev/null @@ -1 +0,0 @@ -{"data":{"__schema":{"queryType":{"name":"Query"},"mutationType":{"name":"Mutation"},"subscriptionType":null,"types":[{"kind":"OBJECT","name":"Query","description":"the schema allows the following query:","fields":[{"name":"posts","description":"","args":[],"type":{"kind":"LIST","name":null,"ofType":{"kind":"OBJECT","name":"Post","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"author","description":"","args":[{"name":"id","description":"","type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Int","ofType":null}},"defaultValue":null}],"type":{"kind":"OBJECT","name":"Author","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"Post","description":"","fields":[{"name":"id","description":"","args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Int","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"title","description":"","args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"author","description":"","args":[],"type":{"kind":"OBJECT","name":"Author","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"votes","description":"","args":[],"type":{"kind":"SCALAR","name":"Int","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"SCALAR","name":"Int","description":"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ","fields":null,"inputFields":null,"interfaces":null,"enumValues":null,"possibleTypes":null},{"kind":"SCALAR","name":"String","description":"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.","fields":null,"inputFields":null,"interfaces":null,"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"Author","description":"","fields":[{"name":"id","description":"","args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Int","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"firstName","description":"","args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"lastName","description":"","args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"posts","description":"","args":[],"type":{"kind":"LIST","name":null,"ofType":{"kind":"OBJECT","name":"Post","ofType":null}},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"Mutation","description":"this schema allows the following mutation:","fields":[{"name":"upvotePost","description":"","args":[{"name":"postId","description":"","type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Int","ofType":null}},"defaultValue":null}],"type":{"kind":"OBJECT","name":"Post","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"__Schema","description":"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.","fields":[{"name":"types","description":"A list of all types supported by this server.","args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Type","ofType":null}}}},"isDeprecated":false,"deprecationReason":null},{"name":"queryType","description":"The type that query operations will be rooted at.","args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Type","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"mutationType","description":"If this server supports mutation, the type that mutation operations will be rooted at.","args":[],"type":{"kind":"OBJECT","name":"__Type","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"subscriptionType","description":"If this server support subscription, the type that subscription operations will be rooted at.","args":[],"type":{"kind":"OBJECT","name":"__Type","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"directives","description":"A list of all directives supported by this server.","args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Directive","ofType":null}}}},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"__Type","description":"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.","fields":[{"name":"kind","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"ENUM","name":"__TypeKind","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"name","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"description","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"fields","description":null,"args":[{"name":"includeDeprecated","description":null,"type":{"kind":"SCALAR","name":"Boolean","ofType":null},"defaultValue":"false"}],"type":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Field","ofType":null}}},"isDeprecated":false,"deprecationReason":null},{"name":"interfaces","description":null,"args":[],"type":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Type","ofType":null}}},"isDeprecated":false,"deprecationReason":null},{"name":"possibleTypes","description":null,"args":[],"type":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Type","ofType":null}}},"isDeprecated":false,"deprecationReason":null},{"name":"enumValues","description":null,"args":[{"name":"includeDeprecated","description":null,"type":{"kind":"SCALAR","name":"Boolean","ofType":null},"defaultValue":"false"}],"type":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__EnumValue","ofType":null}}},"isDeprecated":false,"deprecationReason":null},{"name":"inputFields","description":null,"args":[],"type":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__InputValue","ofType":null}}},"isDeprecated":false,"deprecationReason":null},{"name":"ofType","description":null,"args":[],"type":{"kind":"OBJECT","name":"__Type","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"ENUM","name":"__TypeKind","description":"An enum describing what kind of type a given `__Type` is.","fields":null,"inputFields":null,"interfaces":null,"enumValues":[{"name":"SCALAR","description":"Indicates this type is a scalar.","isDeprecated":false,"deprecationReason":null},{"name":"OBJECT","description":"Indicates this type is an object. `fields` and `interfaces` are valid fields.","isDeprecated":false,"deprecationReason":null},{"name":"INTERFACE","description":"Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.","isDeprecated":false,"deprecationReason":null},{"name":"UNION","description":"Indicates this type is a union. `possibleTypes` is a valid field.","isDeprecated":false,"deprecationReason":null},{"name":"ENUM","description":"Indicates this type is an enum. `enumValues` is a valid field.","isDeprecated":false,"deprecationReason":null},{"name":"INPUT_OBJECT","description":"Indicates this type is an input object. `inputFields` is a valid field.","isDeprecated":false,"deprecationReason":null},{"name":"LIST","description":"Indicates this type is a list. `ofType` is a valid field.","isDeprecated":false,"deprecationReason":null},{"name":"NON_NULL","description":"Indicates this type is a non-null. `ofType` is a valid field.","isDeprecated":false,"deprecationReason":null}],"possibleTypes":null},{"kind":"SCALAR","name":"Boolean","description":"The `Boolean` scalar type represents `true` or `false`.","fields":null,"inputFields":null,"interfaces":null,"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"__Field","description":"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.","fields":[{"name":"name","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"String","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"description","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"args","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__InputValue","ofType":null}}}},"isDeprecated":false,"deprecationReason":null},{"name":"type","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Type","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"isDeprecated","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"deprecationReason","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"__InputValue","description":"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.","fields":[{"name":"name","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"String","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"description","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"type","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__Type","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"defaultValue","description":"A GraphQL-formatted string representing the default value for this input value.","args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"__EnumValue","description":"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.","fields":[{"name":"name","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"String","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"description","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"isDeprecated","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"deprecationReason","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"OBJECT","name":"__Directive","description":"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.","fields":[{"name":"name","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"String","ofType":null}},"isDeprecated":false,"deprecationReason":null},{"name":"description","description":null,"args":[],"type":{"kind":"SCALAR","name":"String","ofType":null},"isDeprecated":false,"deprecationReason":null},{"name":"locations","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"ENUM","name":"__DirectiveLocation","ofType":null}}}},"isDeprecated":false,"deprecationReason":null},{"name":"args","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"LIST","name":null,"ofType":{"kind":"NON_NULL","name":null,"ofType":{"kind":"OBJECT","name":"__InputValue","ofType":null}}}},"isDeprecated":false,"deprecationReason":null},{"name":"onOperation","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"isDeprecated":true,"deprecationReason":"Use `locations`."},{"name":"onFragment","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"isDeprecated":true,"deprecationReason":"Use `locations`."},{"name":"onField","description":null,"args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"isDeprecated":true,"deprecationReason":"Use `locations`."}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":null},{"kind":"ENUM","name":"__DirectiveLocation","description":"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.","fields":null,"inputFields":null,"interfaces":null,"enumValues":[{"name":"QUERY","description":"Location adjacent to a query operation.","isDeprecated":false,"deprecationReason":null},{"name":"MUTATION","description":"Location adjacent to a mutation operation.","isDeprecated":false,"deprecationReason":null},{"name":"SUBSCRIPTION","description":"Location adjacent to a subscription operation.","isDeprecated":false,"deprecationReason":null},{"name":"FIELD","description":"Location adjacent to a field.","isDeprecated":false,"deprecationReason":null},{"name":"FRAGMENT_DEFINITION","description":"Location adjacent to a fragment definition.","isDeprecated":false,"deprecationReason":null},{"name":"FRAGMENT_SPREAD","description":"Location adjacent to a fragment spread.","isDeprecated":false,"deprecationReason":null},{"name":"INLINE_FRAGMENT","description":"Location adjacent to an inline fragment.","isDeprecated":false,"deprecationReason":null},{"name":"SCHEMA","description":"Location adjacent to a schema definition.","isDeprecated":false,"deprecationReason":null},{"name":"SCALAR","description":"Location adjacent to a scalar definition.","isDeprecated":false,"deprecationReason":null},{"name":"OBJECT","description":"Location adjacent to an object type definition.","isDeprecated":false,"deprecationReason":null},{"name":"FIELD_DEFINITION","description":"Location adjacent to a field definition.","isDeprecated":false,"deprecationReason":null},{"name":"ARGUMENT_DEFINITION","description":"Location adjacent to an argument definition.","isDeprecated":false,"deprecationReason":null},{"name":"INTERFACE","description":"Location adjacent to an interface definition.","isDeprecated":false,"deprecationReason":null},{"name":"UNION","description":"Location adjacent to a union definition.","isDeprecated":false,"deprecationReason":null},{"name":"ENUM","description":"Location adjacent to an enum definition.","isDeprecated":false,"deprecationReason":null},{"name":"ENUM_VALUE","description":"Location adjacent to an enum value definition.","isDeprecated":false,"deprecationReason":null},{"name":"INPUT_OBJECT","description":"Location adjacent to an input object type definition.","isDeprecated":false,"deprecationReason":null},{"name":"INPUT_FIELD_DEFINITION","description":"Location adjacent to an input object field definition.","isDeprecated":false,"deprecationReason":null}],"possibleTypes":null}],"directives":[{"name":"skip","description":"Directs the executor to skip this field or fragment when the `if` argument is true.","locations":["FIELD","FRAGMENT_SPREAD","INLINE_FRAGMENT"],"args":[{"name":"if","description":"Skipped when true.","type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"defaultValue":null}]},{"name":"include","description":"Directs the executor to include this field or fragment only when the `if` argument is true.","locations":["FIELD","FRAGMENT_SPREAD","INLINE_FRAGMENT"],"args":[{"name":"if","description":"Included when true.","type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"Boolean","ofType":null}},"defaultValue":null}]},{"name":"deprecated","description":"Marks an element of a GraphQL schema as no longer supported.","locations":["FIELD_DEFINITION","ENUM_VALUE"],"args":[{"name":"reason","description":"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).","type":{"kind":"SCALAR","name":"String","ofType":null},"defaultValue":"\"No longer supported\""}]}]}}} diff --git a/Tests/ApolloCodegenTests/SourcePackages/.keep b/Tests/ApolloCodegenTests/SourcePackages/.keep deleted file mode 100644 index f31659afa4..0000000000 --- a/Tests/ApolloCodegenTests/SourcePackages/.keep +++ /dev/null @@ -1 +0,0 @@ -This file exists to preserve folder structure in git. diff --git a/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift b/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift deleted file mode 100644 index 5c0a9cef62..0000000000 --- a/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift +++ /dev/null @@ -1,526 +0,0 @@ -import Foundation -import Nimble -import OrderedCollections -@testable import ApolloCodegenLib -import ApolloInternalTestHelpers - -protocol SelectionShallowMatchable { - typealias Field = IR.Field - typealias InlineFragment = IR.InlineFragmentSpread - typealias NamedFragment = IR.NamedFragmentSpread - - var fields: OrderedDictionary { get } - var inlineFragments: OrderedDictionary { get } - var namedFragments: OrderedDictionary { get } - - var isEmpty: Bool { get } -} - -extension IR.DirectSelections: SelectionShallowMatchable { } -extension IR.DirectSelections.ReadOnly: SelectionShallowMatchable {} -extension IR.MergedSelections: SelectionShallowMatchable { } -extension IR.EntityTreeScopeSelections: SelectionShallowMatchable { - var inlineFragments: OrderedDictionary { [:] } -} - -typealias SelectionMatcherTuple = (fields: [ShallowFieldMatcher], - typeCases: [ShallowInlineFragmentMatcher], - fragments: [ShallowFragmentSpreadMatcher]) - -// MARK - Custom Matchers - -func beEmpty() -> Predicate { - return Predicate.simple("be empty") { actualExpression in - guard let actual = try actualExpression.evaluate() else { return .fail } - return PredicateStatus(bool: actual.isEmpty) - } -} - -/// A Matcher that matches that the AST `MergedSelections` are equal, but does not check any nested -/// selection sets of the `fields`, `typeCases`, and `fragments`. This is used for conveniently -/// checking the `MergedSelections` without having to mock out the entire nested selection sets. -func shallowlyMatch( - _ expectedValue: SelectionMatcherTuple -) -> Predicate { - return satisfyAllOf([ - shallowlyMatch(expectedValue.fields).mappingActualTo { $0?.fields.values }, - shallowlyMatch(expectedValue.typeCases).mappingActualTo { $0?.inlineFragments.values.map(\.selectionSet) }, - shallowlyMatch(expectedValue.fragments).mappingActualTo { $0?.namedFragments.values } - ]) -} - -func shallowlyMatch( - _ expectedValue: [ShallowSelectionMatcher] -) -> Predicate { - var expectedFields: [ShallowFieldMatcher] = [] - var expectedTypeCases: [ShallowInlineFragmentMatcher] = [] - var expectedFragments: [ShallowFragmentSpreadMatcher] = [] - - for selection in expectedValue { - switch selection { - case let .shallowField(field): expectedFields.append(field) - case let .shallowInlineFragment(inlineFragment): expectedTypeCases.append(inlineFragment) - case let .shallowFragmentSpread(fragment): expectedFragments.append(fragment) - } - } - - return shallowlyMatch((expectedFields, expectedTypeCases, expectedFragments)) -} - -// MARK: - SelectionsMatcher - -struct SelectionsMatcher { - let direct: [ShallowSelectionMatcher]? - let merged: [ShallowSelectionMatcher] - let mergedSources: OrderedSet - - let ignoreMergedSelections: Bool - - public init( - direct: [ShallowSelectionMatcher]?, - merged: [ShallowSelectionMatcher] = [], - mergedSources: OrderedSet = [], - ignoreMergedSelections: Bool = false - ) { - self.direct = direct - self.merged = merged - self.mergedSources = mergedSources - self.ignoreMergedSelections = ignoreMergedSelections - } - -} - -func shallowlyMatch( - _ expectedValue: SelectionsMatcher -) -> Predicate { - let directPredicate: Predicate = expectedValue.direct == nil - ? beNil() - : shallowlyMatch(expectedValue.direct!) - - var matchers: [Predicate] = [ - directPredicate.mappingActualTo { $0?.selections.direct }, - ] - - if !expectedValue.ignoreMergedSelections { - matchers.append(contentsOf: [ - shallowlyMatch(expectedValue.merged).mappingActualTo { $0?.selections.merged }, - equal(expectedValue.mergedSources).mappingActualTo { $0?.selections.merged.mergedSources } - ]) - } - - return satisfyAllOf(matchers) -} - -// MARK: - SelectionSetMatcher - -struct SelectionSetMatcher { - let parentType: GraphQLCompositeType - let inclusionConditions: [CompilationResult.InclusionCondition]? - let selections: SelectionsMatcher - - private init( - parentType: GraphQLCompositeType, - inclusionConditions: [CompilationResult.InclusionCondition]?, - directSelections: [ShallowSelectionMatcher]?, - mergedSelections: [ShallowSelectionMatcher], - mergedSources: OrderedSet, - ignoreMergedSelections: Bool - ) { - self.parentType = parentType - self.inclusionConditions = inclusionConditions - self.selections = SelectionsMatcher( - direct: directSelections, - merged: mergedSelections, - mergedSources: mergedSources, - ignoreMergedSelections: ignoreMergedSelections - ) - } - - public init( - parentType: GraphQLCompositeType, - inclusionConditions: [CompilationResult.InclusionCondition]? = nil, - directSelections: [ShallowSelectionMatcher]? = [], - mergedSelections: [ShallowSelectionMatcher] = [], - mergedSources: OrderedSet = [] - ) { - self.init( - parentType: parentType, - inclusionConditions: inclusionConditions, - directSelections: directSelections, - mergedSelections: mergedSelections, - mergedSources: mergedSources, - ignoreMergedSelections: false - ) - } - - public static func directOnly( - parentType: GraphQLCompositeType, - inclusionConditions: [CompilationResult.InclusionCondition]? = nil, - directSelections: [ShallowSelectionMatcher]? = [] - ) -> SelectionSetMatcher { - self.init( - parentType: parentType, - inclusionConditions: inclusionConditions, - directSelections: directSelections, - mergedSelections: [], - mergedSources: [], - ignoreMergedSelections: true - ) - } -} - -func shallowlyMatch( - _ expectedValue: SelectionSetMatcher -) -> Predicate { - let expectedInclusionConditions = IR.InclusionConditions.allOf( - expectedValue.inclusionConditions ?? [] - ).conditions - - let inclusionPredicate: Predicate = expectedInclusionConditions == nil - ? beNil() - : equal(expectedInclusionConditions!) - - return satisfyAllOf([ - equal(expectedValue.parentType).mappingActualTo { $0?.parentType }, - inclusionPredicate.mappingActualTo { $0?.inclusionConditions }, - shallowlyMatch(expectedValue.selections) - ]) -} - -// MARK: - Shallow Selection Matcher - -public enum ShallowSelectionMatcher { - case shallowField(ShallowFieldMatcher) - case shallowInlineFragment(ShallowInlineFragmentMatcher) - case shallowFragmentSpread(ShallowFragmentSpreadMatcher) - - public static func field( - _ name: String, - alias: String? = nil, - type: GraphQLType? = nil, - inclusionConditions: AnyOf? = nil, - arguments: [CompilationResult.Argument]? = nil - ) -> ShallowSelectionMatcher { - .shallowField(ShallowFieldMatcher( - name: name, alias: alias, type: type, - inclusionConditions: inclusionConditions, arguments: arguments) - ) - } - - public static func inlineFragment( - parentType: GraphQLCompositeType, - inclusionConditions: [IR.InclusionCondition]? = nil - ) -> ShallowSelectionMatcher { - .shallowInlineFragment(ShallowInlineFragmentMatcher( - parentType: parentType, inclusionConditions: inclusionConditions - )) - } - - public static func fragmentSpread( - _ name: String, - type: GraphQLCompositeType, - inclusionConditions: AnyOf? = nil - ) -> ShallowSelectionMatcher { - .shallowFragmentSpread(ShallowFragmentSpreadMatcher( - name: name, - type: type, - inclusionConditions: inclusionConditions - )) - } - - public static func fragmentSpread( - _ fragment: CompilationResult.FragmentDefinition, - inclusionConditions: AnyOf - ) -> ShallowSelectionMatcher { - .shallowFragmentSpread(ShallowFragmentSpreadMatcher( - name: fragment.name, - type: fragment.type, - inclusionConditions: inclusionConditions - )) - } - - public static func fragmentSpread( - _ fragment: CompilationResult.FragmentDefinition, - inclusionConditions: [IR.InclusionCondition]? = nil - ) -> ShallowSelectionMatcher { - .shallowFragmentSpread(ShallowFragmentSpreadMatcher( - name: fragment.name, - type: fragment.type, - inclusionConditions: inclusionConditions - )) - } -} - -// MARK: - Shallow Field Matcher - -public struct ShallowFieldMatcher: Equatable, CustomDebugStringConvertible { - let name: String - let alias: String? - let type: GraphQLType? - let inclusionConditions: AnyOf? - let arguments: [CompilationResult.Argument]? - - public static func mock( - _ name: String, - alias: String? = nil, - type: GraphQLType? = nil, - inclusionConditions: AnyOf? = nil, - arguments: [CompilationResult.Argument]? = nil - ) -> ShallowFieldMatcher { - self.init( - name: name, alias: alias, type: type, - inclusionConditions: inclusionConditions, arguments: arguments - ) - } - - public var debugDescription: String { - TemplateString(""" - \(name): \(type.debugDescription)\(ifLet: inclusionConditions, { - " \($0.debugDescription)" - }) - """).description - } -} - -public func shallowlyMatch( - _ expectedValue: [ShallowFieldMatcher] -) -> Predicate where T.Element == IR.Field { - return Predicate.define { actual in - return shallowlyMatch(expected: expectedValue, actual: try actual.evaluate()) - } -} - -public func shallowlyMatch( - _ expectedValue: [ShallowSelectionMatcher] -) -> Predicate where T.Element == IR.Field { - return Predicate.define { actual in - let expectedAsFields: [ShallowFieldMatcher] = try expectedValue.map { - guard case let .shallowField(field) = $0 else { - throw TestError("Selection \($0) is not a field!") - } - return field - } - return try shallowlyMatch(expectedAsFields).satisfies(actual) - } -} - -public func shallowlyMatch( - expected: [ShallowFieldMatcher], - actual: T? -) -> PredicateResult where T.Element == IR.Field { - let message: ExpectationMessage = .expectedActualValueTo("have fields equal to \(expected)") - - guard let actual = actual, - expected.count == actual.count else { - return PredicateResult(status: .fail, message: message.appended(details: "Fields Did Not Match!")) - } - - for (index, field) in zip(expected, actual).enumerated() { - guard shallowlyMatch(expected: field.0, actual: field.1) else { - return PredicateResult( - status: .fail, - message: message.appended( - details: "Expected fields[\(index)] to equal \(field.0), got \(field.1)." - ) - ) - } - } - - return PredicateResult(status: .matches, message: message) -} - -fileprivate func shallowlyMatch(expected: ShallowFieldMatcher, actual: IR.Field) -> Bool { - func matchType() -> Bool { - guard let type = expected.type else { return true } - return type == actual.type - } - return expected.name == actual.name && - expected.alias == actual.alias && - expected.arguments == actual.arguments && - expected.inclusionConditions == actual.inclusionConditions && - matchType() -} - -// MARK: - Shallow InlineFragment Matcher - -public struct ShallowInlineFragmentMatcher: Equatable, CustomDebugStringConvertible { - let parentType: GraphQLCompositeType - let inclusionConditions: IR.InclusionConditions? - - init( - parentType: GraphQLCompositeType, - inclusionConditions: [IR.InclusionCondition]? - ) { - self.parentType = parentType - if let inclusionConditions = inclusionConditions { - self.inclusionConditions = IR.InclusionConditions.allOf(inclusionConditions).conditions - } else { - self.inclusionConditions = nil - } - } - - public static func mock( - parentType: GraphQLCompositeType, - inclusionConditions: [IR.InclusionCondition]? = nil - ) -> ShallowInlineFragmentMatcher { - self.init(parentType: parentType, inclusionConditions: inclusionConditions) - } - - public var debugDescription: String { - TemplateString(""" - ... on \(parentType.debugDescription)\(ifLet: inclusionConditions, { " \($0.debugDescription)"}) - """).description - } -} - -public func shallowlyMatch( - _ expectedValue: [ShallowInlineFragmentMatcher] -) -> Predicate where T.Element == IR.SelectionSet { - return Predicate.define { actual in - return shallowlyMatch(expected: expectedValue, actual: try actual.evaluate()) - } -} - -fileprivate func shallowlyMatch( - expected: [ShallowInlineFragmentMatcher], - actual: T? -) -> PredicateResult where T.Element == IR.SelectionSet { - let message: ExpectationMessage = .expectedActualValueTo("have typeCases equal to \(expected)") - guard let actual = actual, - expected.count == actual.count else { - return PredicateResult(status: .fail, message: message.appended(details: "Inline Fragments Did Not Match!")) - } - - for (index, typeCase) in zip(expected, actual).enumerated() { - guard shallowlyMatch(expected: typeCase.0, actual: typeCase.1) else { - return PredicateResult( - status: .fail, - message: message.appended( - details: "Expected typeCases[\(index)] to equal \(typeCase.0), got \(typeCase.1)." - ) - ) - } - } - - return PredicateResult(status: .matches, message: message) -} - -fileprivate func shallowlyMatch(expected: ShallowInlineFragmentMatcher, actual: IR.SelectionSet) -> Bool { - return expected.parentType == actual.typeInfo.parentType && - expected.inclusionConditions == actual.inclusionConditions -} - -// MARK: - Shallow Fragment Spread Matcher - -public struct ShallowFragmentSpreadMatcher: Equatable, CustomDebugStringConvertible { - let name: String - let type: GraphQLCompositeType - let inclusionConditions: AnyOf? - - init( - name: String, - type: GraphQLCompositeType, - inclusionConditions: [IR.InclusionCondition]? - ) { - self.name = name - self.type = type - if let inclusionConditions = inclusionConditions, - let evaluatedConditions = IR.InclusionConditions.allOf(inclusionConditions).conditions { - self.inclusionConditions = AnyOf(evaluatedConditions) - } else { - self.inclusionConditions = nil - } - } - - init( - name: String, - type: GraphQLCompositeType, - inclusionConditions: AnyOf? - ) { - self.name = name - self.type = type - self.inclusionConditions = inclusionConditions - } - - public static func mock( - _ name: String, - type: GraphQLCompositeType, - inclusionConditions: AnyOf? = nil - ) -> ShallowFragmentSpreadMatcher { - self.init(name: name, type: type, inclusionConditions: inclusionConditions) - } - - public static func mock( - _ fragment: CompilationResult.FragmentDefinition, - inclusionConditions: AnyOf? = nil - ) -> ShallowFragmentSpreadMatcher { - self.init(name: fragment.name, type: fragment.type, inclusionConditions: inclusionConditions) - } - - public var debugDescription: String { - TemplateString(""" - fragment \(name) on \(type.debugDescription)\(ifLet: inclusionConditions, { - " \($0.debugDescription)" - }) - """).description - } -} - -public func shallowlyMatch( - _ expectedValue: [ShallowFragmentSpreadMatcher] -) -> Predicate where T.Element == IR.NamedFragmentSpread { - return Predicate.define { actual in - return shallowlyMatch(expected: expectedValue, actual: try actual.evaluate()) - } -} - -public func shallowlyMatch( - _ expectedValue: [CompilationResult.FragmentDefinition] -) -> Predicate where T.Element == IR.NamedFragmentSpread { - return Predicate.define { actual in - return shallowlyMatch(expected: expectedValue.map { .mock($0) }, actual: try actual.evaluate()) - } -} - -fileprivate func shallowlyMatch( - expected: [ShallowFragmentSpreadMatcher], - actual: T? -) -> PredicateResult where T.Element == IR.NamedFragmentSpread { - let message: ExpectationMessage = .expectedActualValueTo("have fragments equal to \(expected)") - guard let actual = actual, - expected.count == actual.count else { - return PredicateResult(status: .fail, message: message.appended(details: "Fragments Did Not Match!")) - } - - for (index, fragment) in zip(expected, actual).enumerated() { - guard shallowlyMatch(expected: fragment.0, actual: fragment.1) else { - return PredicateResult( - status: .fail, - message: message.appended( - details: "Expected fragments[\(index)] to equal \(fragment.0), got \(fragment.1)." - ) - ) - } - } - - return PredicateResult(status: .matches, message: message) -} - -fileprivate func shallowlyMatch(expected: ShallowFragmentSpreadMatcher, actual: IR.NamedFragmentSpread) -> Bool { - return expected.name == actual.fragment.name && - expected.type == actual.fragment.type && - expected.inclusionConditions == actual.inclusionConditions -} - -// MARK: - Predicate Mapping - -extension Nimble.Predicate { - func mappingActualTo( - _ actualMapper: @escaping ((U?) throws -> T?) - ) -> Predicate { - Predicate.define { (actual: Expression) in - let newActual = actual.cast(actualMapper) - return try self.satisfies(newActual) - } - } -} diff --git a/Tests/ApolloCodegenTests/TestHelpers/LineByLineComparison.swift b/Tests/ApolloCodegenTests/TestHelpers/LineByLineComparison.swift deleted file mode 100644 index 8ae50c6092..0000000000 --- a/Tests/ApolloCodegenTests/TestHelpers/LineByLineComparison.swift +++ /dev/null @@ -1,126 +0,0 @@ -import Foundation -import Nimble -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -/// A Nimble matcher that compares two strings line-by-line. -/// -/// - Parameters: -/// - expectedValue: The expected string to match against -/// - atLine: [optional] The line in the actual value where matching should begin. -/// This parameter is 1 indexed, representing actual line number, not 0 indexed. -/// If provided, the actual value will be compared to the lines at the given range. -/// Defaults to `nil`. -public func equalLineByLine( - _ expectedValue: String, - atLine startLine: Int = 1, - ignoringExtraLines: Bool = false -) -> Predicate { - return Predicate.define() { actual in - let actualString = try actual.evaluate() - - guard let actualLines = actualString?.lines(startingAt: startLine) else { - return PrettyPrintedFailureResult( - actual: actualString, - message: .fail("Insufficient Lines. Check `atLine` value.") - ) - } - - let expectedLines = expectedValue.components(separatedBy: "\n") - - var expectedLinesBuffer: [String] = expectedLines.reversed() - - for index in actualLines.indices { - let actualLine = actualLines[index] - guard let expectedLine = expectedLinesBuffer.popLast() else { - if ignoringExtraLines { - return PredicateResult( - status: .matches, - message: .expectedTo("be equal") - ) - } else { - return PrettyPrintedFailureResult( - actual: actualString, - message: .fail("Expected \(expectedLines.count + startLine - 1) lines, actual ended at line \(actualLines.count + startLine - 1)") - ) - } - } - - if actualLine != expectedLine { - return PrettyPrintedFailureResult( - actual: actualString, - message: .fail("Line \(index + 1) did not match. Expected \"\(expectedLine)\", got \"\(actualLine)\".") - ) - } - } - - guard expectedLinesBuffer.isEmpty else { - return PredicateResult( - status: .fail, - message: .fail("Expected \(expectedLines.count), actual ended at line \(actualLines.count).") - ) - } - - return PredicateResult( - status: .matches, - message: .expectedTo("be equal") - ) - } -} - -fileprivate func PrettyPrintedFailureResult( - actual: String?, - message: ExpectationMessage -) -> PredicateResult { - if let actual = actual { - print ("Actual Document:") - print(actual) - } - return PredicateResult( - status: .fail, - message: message - ) -} - -extension String { - fileprivate func lines(startingAt startLine: Int) -> ArraySlice? { - let allLines = self.components(separatedBy: "\n") - guard allLines.count >= startLine else { return nil } - return allLines[(startLine - 1).. Predicate { - return Predicate.define() { actual in - guard ApolloFileManager.default.doesFileExist(atPath: expectedFileURL.path) else { - return PredicateResult( - status: .fail, - message: .fail("File not found at \(expectedFileURL)") - ) - } - - var fileContents = try String(contentsOf: expectedFileURL) - if trimImports { - fileContents = fileContents - .components(separatedBy: "\n") - .filter { !$0.hasPrefix("import ") } - .joined(separator: "\n") - } - - let expected = fileContents.trimmingCharacters(in: .whitespacesAndNewlines) - - return try equalLineByLine(expected).satisfies(actual) - } -} diff --git a/Tests/ApolloCodegenTests/URLDownloaderTests.swift b/Tests/ApolloCodegenTests/URLDownloaderTests.swift deleted file mode 100644 index 4994aacc73..0000000000 --- a/Tests/ApolloCodegenTests/URLDownloaderTests.swift +++ /dev/null @@ -1,139 +0,0 @@ -@testable import ApolloCodegenLib -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -import XCTest - -fileprivate class FailingNetworkSession: NetworkSession { - func loadData(with urlRequest: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask? { - XCTFail("You must call setRequestHandler before using downloader!") - - return nil - } -} - -class URLDownloaderTests: XCTestCase { - let urlRequest = URLRequest(url: TestURL.mockServer.url) - let downloadURL = URL(string: "file://anywhere/nowhere/somewhere")! - let defaultTimeout = 0.5 - var downloader: URLDownloader! - var session: NetworkSession! - - override func setUp() { - downloader = URLDownloader(session: FailingNetworkSession()) - session = nil - } - - override func tearDown() { - downloader = nil - session = nil - } - - private func setRequestHandler(statusCode: Int, data: Data? = nil, error: Error? = nil, abandon: Bool = false) { - session = MockNetworkSession(statusCode: statusCode, data: data, error: error, abandon: abandon) - downloader = URLDownloader(session: session) - } - - func testDownloadError_withCustomError_shouldThrow() throws { - let statusCode = 400 - let domain = "ApolloCodegenTests" - let error = NSError(domain: domain, code: NSURLErrorNotConnectedToInternet, userInfo: nil) - - setRequestHandler(statusCode: statusCode, error: error) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch (let error as NSError) { - XCTAssertEqual(error.domain, domain) - XCTAssertEqual(error.code, NSURLErrorNotConnectedToInternet) - } - } - - func testDownloadError_withBadResponse_shouldThrow() throws { - let statusCode = 500 - let responseString = "Internal Error" - - setRequestHandler(statusCode: statusCode, data: responseString.data(using: .utf8)) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch URLDownloader.DownloadError.badResponse(let code, let response) { - XCTAssertEqual(code, statusCode) - XCTAssertEqual(response, responseString) - } catch { - XCTFail("Unexpected error received: \(error)") - } - } - - func testDownloadError_withEmptyResponseData_shouldThrow() throws { - setRequestHandler(statusCode: 200, data: Data()) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch URLDownloader.DownloadError.emptyDataReceived { - // Expected response - } catch { - XCTFail("Unexpected error received: \(error)") - } - } - - func testDownloadError_withNoResponseData_shouldThrow() throws { - setRequestHandler(statusCode: 200) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch URLDownloader.DownloadError.noDataReceived { - // Expected response - } catch { - XCTFail("Unexpected error received: \(error)") - } - } - - func testDownloadError_whenExceedingTimeout_shouldThrow() throws { - setRequestHandler(statusCode: 200, abandon: true) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch URLDownloader.DownloadError.downloadTimedOut(let timeout) { - XCTAssertEqual(timeout, defaultTimeout) - } catch { - XCTFail("Unexpected error received: \(error)") - } - } - - func testDownloadError_withIncorrectResponseType_shouldThrow() throws { - class CustomNetworkSession: NetworkSession { - func loadData(with urlRequest: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask? { - completionHandler(nil, URLResponse(), nil) - - return nil - } - } - - let downloader = URLDownloader(session: CustomNetworkSession()) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch URLDownloader.DownloadError.responseNotHTTPResponse { - // Expected response - } catch { - XCTFail("Unexpected error received: \(error)") - } - } - - func testDownloader_withCorrectResponse_shouldNotThrow() { - let statusCode = 200 - let responseString = "Success!" - let downloadURL = CodegenTestHelper.outputFolderURL().appendingPathComponent("urldownloader.txt") - - setRequestHandler(statusCode: statusCode, data: responseString.data(using: .utf8)) - - do { - try downloader.downloadSynchronously(urlRequest, to: downloadURL, timeout: defaultTimeout) - } catch { - XCTFail("Unexpected error received: \(error)") - } - - let output = try? String(contentsOf: downloadURL) - XCTAssertEqual(output, responseString) - } -} diff --git a/Tests/ApolloCodegenTests/URLExtensionsTests.swift b/Tests/ApolloCodegenTests/URLExtensionsTests.swift deleted file mode 100644 index 13370b55c0..0000000000 --- a/Tests/ApolloCodegenTests/URLExtensionsTests.swift +++ /dev/null @@ -1,99 +0,0 @@ -import Foundation -import XCTest -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class URLExtensionsTests: XCTestCase { - - func testGettingParentFolderURL() { - let apolloCodegenTests = FileFinder.findParentFolder() - - let expectedParent = CodegenTestHelper.sourceRootURL() - .appendingPathComponent("Tests") - - let parent = apolloCodegenTests.parentFolderURL() - XCTAssertEqual(parent, expectedParent) - } - - func testGettingChildFolderURL() { - let testsFolderURL = CodegenTestHelper.sourceRootURL() - .appendingPathComponent("Tests") - - let expectedChild = FileFinder.findParentFolder() - - let child = testsFolderURL.childFolderURL(folderName: "ApolloCodegenTests") - XCTAssertEqual(child, expectedChild) - } - - func testGettingChildFileURL() throws { - let apolloCodegenTests = FileFinder.findParentFolder() - - let expectedFileURL = URL(fileURLWithPath: #file) - - let fileURL = try apolloCodegenTests.childFileURL(fileName: "URLExtensionsTests.swift") - - XCTAssertEqual(fileURL, expectedFileURL) - } - - func testGettingChildFileURLWithEmptyFilenameThrows() { - let starWars = CodegenTestHelper.starWarsFolderURL() - - do { - _ = try starWars.childFileURL(fileName: "") - XCTFail("That should have thrown") - } catch { - switch error { - case ApolloURLError.fileNameIsEmpty: - // This is what we want - break - default: - XCTFail("Unexpected error: \(error)") - } - } - } - - func testGettingHiddenChildFileURL() throws { - let parentURL = FileFinder.findParentFolder() - let filename = ".hiddenFile" - - let expectedURL = parentURL.appendingPathComponent(filename, isDirectory: false) - let childURL = try parentURL.childFileURL(fileName: filename) - - XCTAssertEqual(childURL, expectedURL) - } - - func testIsDirectoryForExistingDirectory() { - let parentDirectory = FileFinder.findParentFolder() - XCTAssertTrue(ApolloFileManager.default.doesDirectoryExist(atPath: parentDirectory.path)) - XCTAssertTrue(parentDirectory.isDirectoryURL) - } - - func testIsDirectoryForExistingFile() { - let currentFileURL = FileFinder.fileURL() - XCTAssertTrue(ApolloFileManager.default.doesFileExist(atPath: currentFileURL.path)) - XCTAssertFalse(currentFileURL.isDirectoryURL) - } - - func testIsSwiftFileForExistingFile() { - let currentFileURL = FileFinder.fileURL() - XCTAssertTrue(ApolloFileManager.default.doesFileExist(atPath: currentFileURL.path)) - XCTAssertTrue(currentFileURL.isSwiftFileURL) - } - - func testIsSwiftFileForNonExistentFileWithSingleExtension() { - let currentDirectory = FileFinder.findParentFolder() - let doesntExist = currentDirectory.appendingPathComponent("test.swift") - - XCTAssertFalse(ApolloFileManager.default.doesFileExist(atPath: doesntExist.path)) - XCTAssertTrue(doesntExist.isSwiftFileURL) - } - - func testIsSwiftFileForNonExistentFileWithMultipleExtensions() { - let currentDirectory = FileFinder.findParentFolder() - let doesntExist = currentDirectory.appendingPathComponent("test.graphql.swift") - - XCTAssertFalse(ApolloFileManager.default.doesFileExist(atPath: doesntExist.path)) - XCTAssertTrue(doesntExist.isSwiftFileURL) - } - -} diff --git a/Tests/ApolloInternalTestHelpers/ApolloInternalTestHelpers.h b/Tests/ApolloInternalTestHelpers/ApolloInternalTestHelpers.h deleted file mode 100644 index e780c4d711..0000000000 --- a/Tests/ApolloInternalTestHelpers/ApolloInternalTestHelpers.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -//! Project version number for ApolloInternalTestHelpers. -FOUNDATION_EXPORT double ApolloInternalTestHelpersVersionNumber; - -//! Project version string for ApolloInternalTestHelpers. -FOUNDATION_EXPORT const unsigned char ApolloInternalTestHelpersVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import diff --git a/Tests/ApolloInternalTestHelpers/AsyncResultObserver.swift b/Tests/ApolloInternalTestHelpers/AsyncResultObserver.swift deleted file mode 100644 index 5938f39920..0000000000 --- a/Tests/ApolloInternalTestHelpers/AsyncResultObserver.swift +++ /dev/null @@ -1,70 +0,0 @@ -import XCTest - -/// `AsyncResultObserver` is a helper class that can be used to test `Result` values received through a completion handler against one or more expectations. It is primarily useful if you expect the completion handler to be called multiple times, when receiving a fetch result from the cache and then from the server for example. -/// -/// The main benefit is that it avoids having to manually keep track of expectations and mutable closures (like `verifyResult`), which can make code hard to read and is prone to mistakes. Instead, you can use a result observer to create multiple expectations that will be automatically fulfilled in order when results are received. Often, you'll also want to run assertions against the result, which you can do by passing in an optional handler that is specific to that expectation. These handlers are throwing, which means you can use `result.get()` and `XCTUnwrap` for example. Thrown errors will automatically be recorded as failures in the test case (with the right line numbers, etc.). -/// -/// By default, expectations returned from `AsyncResultObserver` only expect to be called once, which is similar to how other built-in expectations work. Unexpected fulfillments will result in test failures. Usually this is what you want, and you add additional expectations with their own assertions if you expect further results. -/// If multiple fulfillments of a single expectation are expected however, you can use the standard `expectedFulfillmentCount` property to change that. -public class AsyncResultObserver where Failure: Error { - public typealias ResultHandler = (Result) throws -> Void - - private class AsyncResultExpectation: XCTestExpectation { - let file: StaticString - let line: UInt - let handler: ResultHandler - - init(description: String, file: StaticString = #filePath, line: UInt = #line, handler: @escaping ResultHandler) { - self.file = file - self.line = line - self.handler = handler - - super.init(description: description) - } - } - - private let testCase: XCTestCase - - // We keep track of the file and line number associated with the constructor as a fallback, in addition te keeping - // these for each expectation. That way, we can still show a failure within the context of the test in case unexpected - // results are received (which by definition do not have an associated expectation). - private let file: StaticString - private let line: UInt - - private var expectations: [AsyncResultExpectation] = [] - - public init(testCase: XCTestCase, file: StaticString = #filePath, line: UInt = #line) { - self.testCase = testCase - self.file = file - self.line = line - } - - public func expectation(description: String, file: StaticString = #filePath, line: UInt = #line, resultHandler: @escaping ResultHandler) -> XCTestExpectation { - let expectation = AsyncResultExpectation(description: description, file: file, line: line, handler: resultHandler) - expectation.assertForOverFulfill = true - - expectations.append(expectation) - - return expectation - } - - public func handler(_ result: Result) { - guard let expectation = expectations.first else { - XCTFail("Unexpected result received by handler", file: file, line: line) - return - } - - do { - try expectation.handler(result) - } catch { - testCase.record(error, file: expectation.file, line: expectation.line) - } - - expectation.fulfill() - - if expectation.numberOfFulfillments >= expectation.expectedFulfillmentCount { - expectations.removeFirst() - } - } -} - diff --git a/Tests/ApolloInternalTestHelpers/Info.plist b/Tests/ApolloInternalTestHelpers/Info.plist deleted file mode 100644 index fbe1e6b314..0000000000 --- a/Tests/ApolloInternalTestHelpers/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Tests/ApolloInternalTestHelpers/InterceptorTester.swift b/Tests/ApolloInternalTestHelpers/InterceptorTester.swift deleted file mode 100644 index ac76b2d36c..0000000000 --- a/Tests/ApolloInternalTestHelpers/InterceptorTester.swift +++ /dev/null @@ -1,80 +0,0 @@ -import Apollo - -/// Use this interceptor tester to isolate a single `ApolloInterceptor` vs. having to create an -/// `InterceptorRequestChain` and end the interceptor list with `JSONResponseParsingInterceptor` -/// to get a parsed `GraphQLResult` for the standard request chain callback. -public class InterceptorTester { - let interceptor: any ApolloInterceptor - - public init(interceptor: any ApolloInterceptor) { - self.interceptor = interceptor - } - - public func intercept( - request: Apollo.HTTPRequest, - response: Apollo.HTTPResponse? = nil, - completion: @escaping (Result) -> Void - ) { - let requestChain = ResponseCaptureRequestChain({ result in - completion(result) - }) - - self.interceptor.interceptAsync( - chain: requestChain, - request: request, - response: response) { _ in } - } -} - -fileprivate class ResponseCaptureRequestChain: RequestChain { - var isCancelled: Bool = false - let completion: (Result) -> Void - - init(_ completion: @escaping (Result) -> Void) { - self.completion = completion - } - - func kickoff( - request: Apollo.HTTPRequest, - completion: @escaping (Result, Error>) -> Void - ) {} - - func proceedAsync( - request: Apollo.HTTPRequest, - response: Apollo.HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) { - self.completion(.success(response?.rawData)) - } - - func proceedAsync( - request: HTTPRequest, - response: HTTPResponse?, - interceptor: any ApolloInterceptor, - completion: @escaping (Result, Error>) -> Void - ) { - self.completion(.success(response?.rawData)) - } - - func cancel() {} - - func retry( - request: Apollo.HTTPRequest, - completion: @escaping (Result, Error>) -> Void - ) {} - - func handleErrorAsync( - _ error: Error, - request: Apollo.HTTPRequest, - response: Apollo.HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) { - self.completion(.failure(error)) - } - - func returnValueAsync( - for request: Apollo.HTTPRequest, - value: Apollo.GraphQLResult, - completion: @escaping (Result, Error>) -> Void - ) {} -} diff --git a/Tests/ApolloInternalTestHelpers/Matchable.swift b/Tests/ApolloInternalTestHelpers/Matchable.swift deleted file mode 100644 index 3e368b5240..0000000000 --- a/Tests/ApolloInternalTestHelpers/Matchable.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import ApolloAPI - -public protocol Matchable { - associatedtype Base - static func ~=(pattern: Self, value: Base) -> Bool -} - -extension JSONDecodingError: Matchable { - public typealias Base = Error - public static func ~=(pattern: JSONDecodingError, value: Error) -> Bool { - guard let value = value as? JSONDecodingError else { - return false - } - - switch (value, pattern) { - case (.missingValue, .missingValue), (.nullValue, .nullValue), (.wrongType, .wrongType), (.couldNotConvert, .couldNotConvert): - return true - default: - return false - } - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockApolloStore.swift b/Tests/ApolloInternalTestHelpers/MockApolloStore.swift deleted file mode 100644 index 4883f6725a..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockApolloStore.swift +++ /dev/null @@ -1,32 +0,0 @@ -@testable import Apollo -@testable import ApolloAPI - -extension ApolloStore { - - public static func mock(cache: NormalizedCache = NoCache()) -> ApolloStore { - ApolloStore(cache: cache) - } - -} - -/// A `NormalizedCache` that does not cache any data. Used for tests that don't require testing -/// caching behavior. -public class NoCache: NormalizedCache { - - public init() { } - - public func loadRecords(forKeys keys: Set) throws -> [String : RecordRow] { - return [:] - } - - public func merge(records: RecordSet) throws -> Set { - return Set() - } - - public func removeRecord(for key: String) throws { } - - public func removeRecords(matching pattern: String) throws { } - - public func clear() throws { } - -} diff --git a/Tests/ApolloInternalTestHelpers/MockGraphQLServer.swift b/Tests/ApolloInternalTestHelpers/MockGraphQLServer.swift deleted file mode 100644 index 402c8bf6d5..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockGraphQLServer.swift +++ /dev/null @@ -1,107 +0,0 @@ -@testable import Apollo -@testable import ApolloAPI -import XCTest - -/// A `MockGraphQLServer` can be used during tests to check whether expected GraphQL requests are received, and to respond with appropriate test data for a particular request. -/// -/// You usually create a mock server in the test's `setUpWithError`, and use it to initialize a `MockNetworkTransport` that is in turn used to initialize an `ApolloClient`: -/// ``` -/// let server = MockGraphQLServer() -/// let networkTransport = MockNetworkTransport(server: server, store: store) -/// let client = ApolloClient(networkTransport: networkTransport, store: store) -/// ``` -/// A mock server should be configured to expect particular operation types, and invokes the passed in request handler when a request of that type comes in. Because the request allows access to `operation`, you can return different responses based on query variables for example: - -/// ``` -/// let serverExpectation = server.expect(HeroNameQuery.self) { request in -/// [ -/// "data": [ -/// "hero": [ -/// "name": request.operation.episode == .empire ? "Luke Skywalker" : "R2-D2", -/// "__typename": "Droid" -/// ] -/// ] -/// ] -/// } -/// ``` -/// By default, expectations returned from `MockGraphQLServer` only expect to be called once, which is similar to how other built-in expectations work. Unexpected fulfillments will result in test failures. But if multiple fulfillments are expected, you can use the standard `expectedFulfillmentCount` property to change that. For example, some of the concurrent tests expect the server to receive the same number of request as the number of invoked fetch operations, so in that case we can use: - -/// ``` -/// serverExpectation.expectedFulfillmentCount = numberOfFetches -/// ``` -public class MockGraphQLServer { - enum ServerError: Error, CustomStringConvertible { - case unexpectedRequest(String) - - public var description: String { - switch self { - case .unexpectedRequest(let requestDescription): - return "Mock GraphQL server received an unexpected request: \(requestDescription)" - } - } - } - - public typealias RequestHandler = (HTTPRequest) -> JSONObject - - private class RequestExpectation: XCTestExpectation { - let file: StaticString - let line: UInt - let handler: RequestHandler - - init(description: String, file: StaticString = #filePath, line: UInt = #line, handler: @escaping RequestHandler) { - self.file = file - self.line = line - self.handler = handler - - super.init(description: description) - } - } - - private let queue = DispatchQueue(label: "com.apollographql.MockGraphQLServer") - - public init() { } - - // Since RequestExpectation is generic over a specific GraphQLOperation, we can't store these in the dictionary - // directly. Moreover, there is no way to specify the type relationship that holds between the key and value. - // To work around this, we store values as Any and use a generic subscript as a type-safe way to access them. - private var requestExpectations: [AnyHashable: Any] = [:] - - private subscript(_ operationType: Operation.Type) -> RequestExpectation? { - get { - requestExpectations[ObjectIdentifier(operationType)] as! RequestExpectation? - } - - set { - requestExpectations[ObjectIdentifier(operationType)] = newValue - } - } - - public func expect(_ operationType: Operation.Type, file: StaticString = #filePath, line: UInt = #line, requestHandler: @escaping (HTTPRequest) -> JSONObject) -> XCTestExpectation { - return queue.sync { - let expectation = RequestExpectation(description: "Served request for \(String(describing: operationType))", file: file, line: line, handler: requestHandler) - expectation.assertForOverFulfill = true - - self[operationType] = expectation - - return expectation - } - } - - func serve(request: HTTPRequest, completionHandler: @escaping (Result) -> Void) where Operation: GraphQLOperation { - let operationType = type(of: request.operation) - - if let expectation = self[operationType] { - // Dispatch after a small random delay to spread out concurrent requests and simulate somewhat real-world conditions. - queue.asyncAfter(deadline: .now() + .milliseconds(Int.random(in: 10...50))) { - completionHandler(.success(expectation.handler(request))) - expectation.fulfill() - } - - } else { - queue.async { - completionHandler(.failure(ServerError.unexpectedRequest(String(describing: operationType)))) - } - } - - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockHTTPRequest.swift b/Tests/ApolloInternalTestHelpers/MockHTTPRequest.swift deleted file mode 100644 index ebe72f26f6..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockHTTPRequest.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Apollo -import ApolloAPI - -extension HTTPRequest { - public static func mock(operation: Operation) -> HTTPRequest { - return HTTPRequest( - graphQLEndpoint: TestURL.mockServer.url, - operation: operation, - contentType: "application/json", - clientName: "test-client", - clientVersion: "test-version", - additionalHeaders: [:] - ) - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockHTTPResponse.swift b/Tests/ApolloInternalTestHelpers/MockHTTPResponse.swift deleted file mode 100644 index 2c000630e6..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockHTTPResponse.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Apollo -import ApolloAPI - -extension HTTPResponse { - public static func mock( - statusCode: Int = 200, - headerFields: [String : String] = [:], - data: Data = Data() - ) -> HTTPResponse { - return HTTPResponse( - response: .mock( - statusCode: statusCode, - headerFields: headerFields - ), - rawData: data, - parsedResponse: nil - ) - } -} - -extension HTTPURLResponse { - public static func mock( - url: URL = TestURL.mockServer.url, - statusCode: Int = 200, - httpVersion: String? = nil, - headerFields: [String : String]? = nil - ) -> HTTPURLResponse { - return HTTPURLResponse( - url: url, - statusCode: statusCode, - httpVersion: httpVersion, - headerFields: headerFields - )! - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockInterceptorProvider.swift b/Tests/ApolloInternalTestHelpers/MockInterceptorProvider.swift deleted file mode 100644 index f3a29119a2..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockInterceptorProvider.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Apollo - -public struct MockInterceptorProvider: InterceptorProvider { - let interceptors: [any ApolloInterceptor] - - public init(_ interceptors: [any ApolloInterceptor]) { - self.interceptors = interceptors - } - - public func interceptors(for operation: Operation) -> [any ApolloInterceptor] { - self.interceptors - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockLocalCacheMutation.swift b/Tests/ApolloInternalTestHelpers/MockLocalCacheMutation.swift deleted file mode 100644 index 534ad168ed..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockLocalCacheMutation.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation -import ApolloAPI - -open class MockLocalCacheMutation: LocalCacheMutation { - open class var operationType: GraphQLOperationType { .query } - - public typealias Data = SelectionSet - - open var __variables: GraphQLOperation.Variables? - - public init() {} - -} - -open class MockLocalCacheMutationFromMutation: - MockLocalCacheMutation { - override open class var operationType: GraphQLOperationType { .mutation } -} - -open class MockLocalCacheMutationFromSubscription: - MockLocalCacheMutation { - override open class var operationType: GraphQLOperationType { .subscription } -} - -public protocol MockMutableRootSelectionSet: MutableRootSelectionSet -where Schema == MockSchemaMetadata {} - -public extension MockMutableRootSelectionSet { - static var __parentType: ParentType { Object.mock } - - init() { - self.init(_dataDict: DataDict( - data: [:], - fulfilledFragments: [ObjectIdentifier(Self.self)] - )) - } -} - -public protocol MockMutableInlineFragment: MutableSelectionSet, InlineFragment -where Schema == MockSchemaMetadata {} diff --git a/Tests/ApolloInternalTestHelpers/MockNetworkTransport.swift b/Tests/ApolloInternalTestHelpers/MockNetworkTransport.swift deleted file mode 100644 index 67cd018320..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockNetworkTransport.swift +++ /dev/null @@ -1,98 +0,0 @@ -import Foundation -@testable import Apollo -@testable import ApolloAPI - -public final class MockNetworkTransport: RequestChainNetworkTransport { - public init( - server: MockGraphQLServer = MockGraphQLServer(), - store: ApolloStore, - clientName: String = "MockNetworkTransport_ClientName", - clientVersion: String = "MockNetworkTransport_ClientVersion" - ) { - super.init(interceptorProvider: TestInterceptorProvider(store: store, server: server), - endpointURL: TestURL.mockServer.url) - self.clientName = clientName - self.clientVersion = clientVersion - } - - struct TestInterceptorProvider: InterceptorProvider { - let store: ApolloStore - let server: MockGraphQLServer - - func interceptors( - for operation: Operation - ) -> [any ApolloInterceptor] where Operation: GraphQLOperation { - return [ - MaxRetryInterceptor(), - CacheReadInterceptor(store: self.store), - MockGraphQLServerInterceptor(server: server), - ResponseCodeInterceptor(), - JSONResponseParsingInterceptor(), - AutomaticPersistedQueryInterceptor(), - CacheWriteInterceptor(store: self.store), - ] - } - } -} - -private final class MockTask: Cancellable { - func cancel() { - // no-op - } -} - -private class MockGraphQLServerInterceptor: ApolloInterceptor { - let server: MockGraphQLServer - - public var id: String = UUID().uuidString - - init(server: MockGraphQLServer) { - self.server = server - } - - public func interceptAsync(chain: RequestChain, request: HTTPRequest, response: HTTPResponse?, completion: @escaping (Result, Error>) -> Void) where Operation: GraphQLOperation { - server.serve(request: request) { result in - let httpResponse = HTTPURLResponse(url: TestURL.mockServer.url, - statusCode: 200, - httpVersion: nil, - headerFields: nil)! - - switch result { - case .failure(let error): - chain.handleErrorAsync(error, - request: request, - response: response, - completion: completion) - case .success(let body): - let data = try! JSONSerializationFormat.serialize(value: body) - let response = HTTPResponse(response: httpResponse, - rawData: data, - parsedResponse: nil) - chain.proceedAsync(request: request, - response: response, - interceptor: self, - completion: completion) - } - } - } -} - -public class MockWebSocketTransport: NetworkTransport { - public var clientName, clientVersion: String - - public init(clientName: String, clientVersion: String) { - self.clientName = clientName - self.clientVersion = clientVersion - } - - public func send( - operation: Operation, - cachePolicy: CachePolicy, - contextIdentifier: UUID?, - context: RequestContext?, - callbackQueue: DispatchQueue, - completionHandler: @escaping (Result, Error>) -> Void - ) -> Cancellable where Operation : GraphQLOperation { - return MockTask() - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockOperation.swift b/Tests/ApolloInternalTestHelpers/MockOperation.swift deleted file mode 100644 index 2d6ef68e5c..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockOperation.swift +++ /dev/null @@ -1,97 +0,0 @@ -@testable import ApolloAPI - -open class MockOperation: GraphQLOperation { - public typealias Data = SelectionSet - - open class var operationType: GraphQLOperationType { .query } - - open class var operationName: String { "MockOperationName" } - - open class var operationDocument: OperationDocument { - .init(definition: .init("Mock Operation Definition")) - } - - open var __variables: Variables? - - public init() {} - -} - -open class MockQuery: MockOperation, GraphQLQuery { - public static func mock() -> MockQuery where SelectionSet == MockSelectionSet { - MockQuery() - } -} - -open class MockMutation: MockOperation, GraphQLMutation { - - public override class var operationType: GraphQLOperationType { .mutation } - - public static func mock() -> MockMutation where SelectionSet == MockSelectionSet { - MockMutation() - } -} - -open class MockSubscription: MockOperation, GraphQLSubscription { - - public override class var operationType: GraphQLOperationType { .subscription } - - public static func mock() -> MockSubscription where SelectionSet == MockSelectionSet { - MockSubscription() - } -} - -// MARK: - MockSelectionSets - -@dynamicMemberLookup -open class AbstractMockSelectionSet: RootSelectionSet, Hashable { - public typealias Schema = S - public typealias Fragments = F - - open class var __selections: [Selection] { [] } - open class var __parentType: ParentType { Object.mock } - - public var __data: DataDict = .empty() - - public required init(_dataDict: DataDict) { - self.__data = _dataDict - } - - public subscript(dynamicMember key: String) -> T? { - __data[key] - } - - public subscript(dynamicMember key: String) -> T? { - __data[key] - } - - public static func == (lhs: MockSelectionSet, rhs: MockSelectionSet) -> Bool { - lhs.__data == rhs.__data - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(__data) - } -} - -public typealias MockSelectionSet = AbstractMockSelectionSet - -open class MockFragment: MockSelectionSet, Fragment { - public typealias Schema = MockSchemaMetadata - - open class var fragmentDefinition: StaticString { "" } -} - -open class MockTypeCase: MockSelectionSet, InlineFragment { - public typealias RootEntityType = MockSelectionSet -} - -open class ConcreteMockTypeCase: MockSelectionSet, InlineFragment { - public typealias RootEntityType = T -} - -extension DataDict { - public static func empty() -> DataDict { - DataDict(data: [:], fulfilledFragments: []) - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockSchemaMetadata.swift b/Tests/ApolloInternalTestHelpers/MockSchemaMetadata.swift deleted file mode 100644 index df55d3d99e..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockSchemaMetadata.swift +++ /dev/null @@ -1,111 +0,0 @@ -@testable import Apollo -@testable import ApolloAPI - -extension Object { - public static let mock = Object(typename: "Mock", implementedInterfaces: []) -} - -public class MockSchemaMetadata: SchemaMetadata { - public init() { } - - public static var _configuration: SchemaConfiguration.Type = SchemaConfiguration.self - public static var configuration: ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self - - private static let testObserver = TestObserver() { _ in - stub_objectTypeForTypeName = nil - stub_cacheKeyInfoForType_Object = nil - } - - public static var stub_objectTypeForTypeName: ((String) -> Object?)? { - didSet { - if stub_objectTypeForTypeName != nil { testObserver.start() } - } - } - - public static var stub_cacheKeyInfoForType_Object: ((Object, ObjectData) -> CacheKeyInfo?)? { - get { - _configuration.stub_cacheKeyInfoForType_Object - } - set { - _configuration.stub_cacheKeyInfoForType_Object = newValue - if newValue != nil { testObserver.start() } - } - } - - public static func objectType(forTypename __typename: String) -> Object? { - if let stub = stub_objectTypeForTypeName { - return stub(__typename) - } - - return Object(typename: __typename, implementedInterfaces: []) - } - - public class SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static var stub_cacheKeyInfoForType_Object: ((Object, ObjectData) -> CacheKeyInfo?)? - - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - stub_cacheKeyInfoForType_Object?(type, object) - } - } -} - - -// MARK - Mock Cache Key Providers - -public protocol MockStaticCacheKeyProvider { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? -} - -extension MockStaticCacheKeyProvider { - public static var resolver: (Object, ObjectData) -> CacheKeyInfo? { - cacheKeyInfo(for:object:) - } -} - -public struct IDCacheKeyProvider: MockStaticCacheKeyProvider { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - try? .init(jsonValue: object["id"]) - } -} - -public struct MockCacheKeyProvider { - let id: String - - public init(id: String) { - self.id = id - } - - public func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - .init(id: id, uniqueKeyGroup: nil) - } -} - -// MARK: - Custom Mock Schemas - -public enum MockSchema1: SchemaMetadata { - public static var configuration: SchemaConfiguration.Type = MockSchema1Configuration.self - - public static func objectType(forTypename __typename: String) -> Object? { - Object(typename: __typename, implementedInterfaces: []) - } -} - -public enum MockSchema1Configuration: SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - CacheKeyInfo(id: "one") - } -} - -public enum MockSchema2: SchemaMetadata { - public static var configuration: SchemaConfiguration.Type = MockSchema2Configuration.self - - public static func objectType(forTypename __typename: String) -> Object? { - Object(typename: __typename, implementedInterfaces: []) - } -} - -public enum MockSchema2Configuration: SchemaConfiguration { - public static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - CacheKeyInfo(id: "two") - } -} diff --git a/Tests/ApolloInternalTestHelpers/MockURLProtocol.swift b/Tests/ApolloInternalTestHelpers/MockURLProtocol.swift deleted file mode 100644 index e70926bbaf..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockURLProtocol.swift +++ /dev/null @@ -1,56 +0,0 @@ -import Foundation - -public class MockURLProtocol: URLProtocol { - - override class public func canInit(with request: URLRequest) -> Bool { - return true - } - - override class public func canonicalRequest(for request: URLRequest) -> URLRequest { - return request - } - - override public func startLoading() { - guard let url = self.request.url, - let handler = RequestProvider.requestHandlers[url] else { - fatalError("No MockRequestHandler available for URL.") - } - - DispatchQueue.main.asyncAfter(deadline: .now() + Double.random(in: 0.0...0.25)) { - defer { - RequestProvider.requestHandlers.removeValue(forKey: url) - } - - do { - let result = try handler(self.request) - - switch result { - case let .success((response, data)): - self.client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .notAllowed) - - if let data = data { - self.client?.urlProtocol(self, didLoad: data) - } - - self.client?.urlProtocolDidFinishLoading(self) - case let .failure(error): - self.client?.urlProtocol(self, didFailWithError: error) - } - - } catch { - self.client?.urlProtocol(self, didFailWithError: error) - } - } - } - - override public func stopLoading() { - } - -} - -public protocol MockRequestProvider { - typealias MockRequestHandler = ((URLRequest) throws -> Result<(HTTPURLResponse, Data?), Error>) - - // Dictionary of mock request handlers where the `key` is the URL of the request. - static var requestHandlers: [URL: MockRequestHandler] { get set } -} diff --git a/Tests/ApolloInternalTestHelpers/MockURLSession.swift b/Tests/ApolloInternalTestHelpers/MockURLSession.swift deleted file mode 100644 index 3cff26929d..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockURLSession.swift +++ /dev/null @@ -1,75 +0,0 @@ -import Foundation -import Apollo -import ApolloAPI - -public final class MockURLSessionClient: URLSessionClient { - - @Atomic public var lastRequest: URLRequest? - @Atomic public var requestCount = 0 - - public var jsonData: JSONObject? - public var data: Data? - var responseData: Data? { - if let data = data { return data } - if let jsonData = jsonData { - return try! JSONSerializationFormat.serialize(value: jsonData) - } - return nil - } - public var response: HTTPURLResponse? - public var error: Error? - - private let callbackQueue: DispatchQueue - - public init(callbackQueue: DispatchQueue? = nil, response: HTTPURLResponse? = nil, data: Data? = nil) { - self.callbackQueue = callbackQueue ?? .main - self.response = response - self.data = data - } - - public override func sendRequest(_ request: URLRequest, - rawTaskCompletionHandler: URLSessionClient.RawCompletion? = nil, - completion: @escaping URLSessionClient.Completion) -> URLSessionTask { - self.$lastRequest.mutate { $0 = request } - self.$requestCount.increment() - - // Capture data, response, and error instead of self to ensure we complete with the current state - // even if it is changed before the block runs. - callbackQueue.async { [responseData, response, error] in - rawTaskCompletionHandler?(responseData, response, error) - - if let error = error { - completion(.failure(error)) - } else { - guard let data = responseData else { - completion(.failure(URLSessionClientError.dataForRequestNotFound(request: request))) - return - } - - guard let response = response else { - completion(.failure(URLSessionClientError.noHTTPResponse(request: request))) - return - } - - completion(.success((data, response))) - } - } - - let mockTaskType: URLSessionDataTaskMockProtocol.Type = URLSessionDataTaskMock.self - let mockTask = mockTaskType.init() as! URLSessionDataTaskMock - return mockTask - } -} - -protocol URLSessionDataTaskMockProtocol { - init() -} - -private final class URLSessionDataTaskMock: URLSessionDataTask, URLSessionDataTaskMockProtocol { - - override func resume() { - // No-op - } - - override func cancel() {} -} diff --git a/Tests/ApolloInternalTestHelpers/MockWebSocket.swift b/Tests/ApolloInternalTestHelpers/MockWebSocket.swift deleted file mode 100644 index 624f93f499..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockWebSocket.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation -@testable import ApolloWebSocket - -public class MockWebSocket: WebSocketClient { - - public var request: URLRequest - public var callbackQueue: DispatchQueue = DispatchQueue.main - public var delegate: WebSocketClientDelegate? = nil - public var isConnected: Bool = false - - public required init(request: URLRequest, protocol: WebSocket.WSProtocol) { - self.request = request - - self.request.setValue(`protocol`.description, forHTTPHeaderField: WebSocket.Constants.headerWSProtocolName) - } - - open func reportDidConnect() { - callbackQueue.async { - self.delegate?.websocketDidConnect(socket: self) - } - } - - open func write(string: String) { - callbackQueue.async { - self.delegate?.websocketDidReceiveMessage(socket: self, text: string) - } - } - - open func write(ping: Data, completion: (() -> ())?) { - } - - public func disconnect(forceTimeout: TimeInterval?) { - } - - public func connect() { - } -} - -public class ProxyableMockWebSocket: MockWebSocket, SOCKSProxyable { - public var enableSOCKSProxy: Bool = false -} diff --git a/Tests/ApolloInternalTestHelpers/MockWebSocketDelegate.swift b/Tests/ApolloInternalTestHelpers/MockWebSocketDelegate.swift deleted file mode 100644 index 3b5701ff65..0000000000 --- a/Tests/ApolloInternalTestHelpers/MockWebSocketDelegate.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation -@testable import ApolloWebSocket - -public class MockWebSocketDelegate: WebSocketClientDelegate { - public var didReceiveMessage: ((String) -> Void)? - - public init() {} - - public func websocketDidConnect(socket: WebSocketClient) {} - - public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {} - - public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) { - didReceiveMessage?(text) - } - - public func websocketDidReceiveData(socket: WebSocketClient, data: Data) {} -} diff --git a/Tests/ApolloInternalTestHelpers/Resources/a.txt b/Tests/ApolloInternalTestHelpers/Resources/a.txt deleted file mode 100644 index 651cda1a9b..0000000000 --- a/Tests/ApolloInternalTestHelpers/Resources/a.txt +++ /dev/null @@ -1 +0,0 @@ -Alpha file content. diff --git a/Tests/ApolloInternalTestHelpers/Resources/b.txt b/Tests/ApolloInternalTestHelpers/Resources/b.txt deleted file mode 100644 index 7cc0a57915..0000000000 --- a/Tests/ApolloInternalTestHelpers/Resources/b.txt +++ /dev/null @@ -1 +0,0 @@ -Bravo file content. diff --git a/Tests/ApolloInternalTestHelpers/Resources/c.txt b/Tests/ApolloInternalTestHelpers/Resources/c.txt deleted file mode 100644 index 3adae37d8a..0000000000 --- a/Tests/ApolloInternalTestHelpers/Resources/c.txt +++ /dev/null @@ -1 +0,0 @@ -Charlie file content. diff --git a/Tests/ApolloInternalTestHelpers/SQLiteTestCacheProvider.swift b/Tests/ApolloInternalTestHelpers/SQLiteTestCacheProvider.swift deleted file mode 100644 index 8f01ed7157..0000000000 --- a/Tests/ApolloInternalTestHelpers/SQLiteTestCacheProvider.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation -import Apollo -import ApolloSQLite - -public class SQLiteTestCacheProvider: TestCacheProvider { - /// Execute a test block rather than return a cache synchronously, since cache setup may be - /// asynchronous at some point. - public static func withCache(initialRecords: RecordSet? = nil, fileURL: URL? = nil, execute test: (NormalizedCache) throws -> ()) rethrows { - let fileURL = fileURL ?? temporarySQLiteFileURL() - let cache = try! SQLiteNormalizedCache(fileURL: fileURL, initialRecords: initialRecords) - try test(cache) - } - - public static func makeNormalizedCache(_ completionHandler: (Result, Error>) -> ()) { - let fileURL = temporarySQLiteFileURL() - let cache = try! SQLiteNormalizedCache(fileURL: fileURL) - completionHandler(.success((cache, nil))) - } - - public static func temporarySQLiteFileURL() -> URL { - let temporaryDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory()) - - // Create a folder with a random UUID to hold the SQLite file, since creating them in the - // same folder this close together will cause DB locks when you try to delete between tests. - let folder = temporaryDirectoryURL.appendingPathComponent(UUID().uuidString) - try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) - - return folder.appendingPathComponent("db.sqlite3") - } -} diff --git a/Tests/ApolloInternalTestHelpers/String+Data.swift b/Tests/ApolloInternalTestHelpers/String+Data.swift deleted file mode 100644 index 6b6c8d3c8a..0000000000 --- a/Tests/ApolloInternalTestHelpers/String+Data.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -public extension String { - func crlfFormattedData() -> Data { - return replacingOccurrences(of: "\n\n", with: "\r\n\r\n").data(using: .utf8)! - } -} diff --git a/Tests/ApolloInternalTestHelpers/TestCacheProvider.swift b/Tests/ApolloInternalTestHelpers/TestCacheProvider.swift deleted file mode 100644 index 8afadc21be..0000000000 --- a/Tests/ApolloInternalTestHelpers/TestCacheProvider.swift +++ /dev/null @@ -1,64 +0,0 @@ -import XCTest -@testable import Apollo - -public typealias TearDownHandler = () throws -> () -public typealias TestDependency = (Resource, TearDownHandler?) - -public protocol TestCacheProvider: AnyObject { - static func makeNormalizedCache(_ completionHandler: (Result, Error>) -> ()) -} - -public class InMemoryTestCacheProvider: TestCacheProvider { - public static func withCache(initialRecords: Apollo.RecordSet?, execute test: (Apollo.NormalizedCache) throws -> ()) rethrows { - let cache = InMemoryNormalizedCache(records: initialRecords ?? [:]) - try test(cache) - } - - public static func makeNormalizedCache(_ completionHandler: (Result, Error>) -> ()) { - let cache = InMemoryNormalizedCache() - completionHandler(.success((cache, nil))) - } -} - -public protocol CacheDependentTesting { - var cacheType: TestCacheProvider.Type { get } - var cache: NormalizedCache! { get } -} - -extension CacheDependentTesting where Self: XCTestCase { - public func makeNormalizedCache() throws -> NormalizedCache { - var result: Result = .failure(XCTestError(.timeoutWhileWaiting)) - - let expectation = XCTestExpectation(description: "Initialized normalized cache") - - cacheType.makeNormalizedCache() { [weak self] testDependencyResult in - guard let self = self else { return } - - result = testDependencyResult.map { testDependency in - let (cache, tearDownHandler) = testDependency - - if let tearDownHandler = tearDownHandler { - self.addTeardownBlock { - do { - try tearDownHandler() - } catch { - self.record(error) - } - } - } - - return cache - } - - expectation.fulfill() - } - - wait(for: [expectation], timeout: 1) - - return try result.get() - } - - public func mergeRecordsIntoCache(_ records: RecordSet) { - _ = try! cache.merge(records: records) - } -} diff --git a/Tests/ApolloInternalTestHelpers/TestError.swift b/Tests/ApolloInternalTestHelpers/TestError.swift deleted file mode 100644 index 7bf8e579e5..0000000000 --- a/Tests/ApolloInternalTestHelpers/TestError.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation - -public struct TestError: Error, CustomDebugStringConvertible { - let message: String? - - public init(_ message: String? = nil) { - self.message = message - } - - public var debugDescription: String { - message ?? "TestError" - } - -} diff --git a/Tests/ApolloInternalTestHelpers/TestFileHelper.swift b/Tests/ApolloInternalTestHelpers/TestFileHelper.swift deleted file mode 100644 index f675744a33..0000000000 --- a/Tests/ApolloInternalTestHelpers/TestFileHelper.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// TestFileHelper.swift -// ApolloTests -// -// Created by Ellen Shapiro on 3/18/20. -// Copyright © 2020 Apollo GraphQL. All rights reserved. -// - -import Foundation -import Apollo - -public struct TestFileHelper { - - public static func testParentFolder(for file: StaticString = #file) -> URL { - let fileAsString = file.withUTF8Buffer { - String(decoding: $0, as: UTF8.self) - } - let url = URL(fileURLWithPath: fileAsString) - return url.deletingLastPathComponent() - } - - public static func uploadServerFolder(from file: StaticString = #file) -> URL { - self.testParentFolder(for: file) - .deletingLastPathComponent() // test root - .deletingLastPathComponent() // source root - .appendingPathComponent("SimpleUploadServer") - } - - public static func uploadsFolder(from file: StaticString = #file) -> URL { - self.uploadServerFolder(from: file) - .appendingPathComponent("uploads") - } - - public static func fileURLForFile(named name: String, extension fileExtension: String) -> URL { - return self.testParentFolder() - .appendingPathComponent("Resources") - .appendingPathComponent(name) - .appendingPathExtension(fileExtension) - } -} diff --git a/Tests/ApolloInternalTestHelpers/TestIsolatedFileManager.swift b/Tests/ApolloInternalTestHelpers/TestIsolatedFileManager.swift deleted file mode 100644 index 083346d4fe..0000000000 --- a/Tests/ApolloInternalTestHelpers/TestIsolatedFileManager.swift +++ /dev/null @@ -1,144 +0,0 @@ -import Foundation -import XCTest - -/// A test helper object that manages creation and deletion of files in a temporary directory -/// that ensures test isolation. -/// -/// **Creating a `TestIsolatedFileManager` sets the current working directory for the -/// current process to it's `directoryURL`.** After the test finishes, the current working -/// directory is reset to its previous value. -/// -/// All files and directories created by this class will be automatically deleted upon test -/// completion prior to the test case's `tearDown()` function being called. -/// -/// You can create a file manager from within a specific unit test with the -/// `testIsolatedFileManager()` function on `XCTestCase`. -public class TestIsolatedFileManager { - - public let directoryURL: URL - public let fileManager: FileManager - private let previousWorkingDirectory: String - - /// The paths for the files written to by the ``ApolloFileManager``. - public private(set) var writtenFiles: Set = [] - - fileprivate init(directoryURL: URL, fileManager: FileManager) throws { - self.directoryURL = directoryURL - self.fileManager = fileManager - - try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true) - previousWorkingDirectory = fileManager.currentDirectoryPath - fileManager.changeCurrentDirectoryPath(directoryURL.path) - } - - func cleanUp() throws { - fileManager.changeCurrentDirectoryPath(previousWorkingDirectory) - try fileManager.removeItem(at: directoryURL) - } - - /// Creates a file in the test directory. - /// - /// - Parameters: - /// - data: File content - /// - filename: Target name of the file. This should not include any path information - /// - /// - Returns: - /// - The full path of the created file. - @discardableResult - public func createFile( - containing data: Data, - named fileName: String, - inDirectory subDirectory: String? = nil - ) throws -> String { - let fileDirectoryURL: URL - if let subDirectory { - fileDirectoryURL = directoryURL.appendingPathComponent(subDirectory, isDirectory: true) - try fileManager.createDirectory(at: fileDirectoryURL, withIntermediateDirectories: true) - } else { - fileDirectoryURL = directoryURL - } - - let filePath: String = fileDirectoryURL - .resolvingSymlinksInPath() - .appendingPathComponent(fileName, isDirectory: false).path - - guard fileManager.createFile(atPath: filePath, contents: data) else { - throw Error.cannotCreateFile(at: filePath) - } - - writtenFiles.insert(filePath) - return filePath - } - - @discardableResult - public func createFile( - body: @autoclosure () -> String, - named fileName: String, - inDirectory directory: String? = nil - ) throws -> String { - let bodyString = body() - guard let data = bodyString.data(using: .utf8) else { - throw Error.cannotEncodeFileData(from: bodyString) - } - - return try createFile( - containing: data, - named: fileName, - inDirectory: directory - ) - } - - public enum Error: Swift.Error { - case cannotCreateFile(at: String) - case cannotEncodeFileData(from: String) - - public var errorDescription: String { - switch self { - case .cannotCreateFile(let path): - return "Cannot create file at \(path)" - case .cannotEncodeFileData(let body): - return "Cannot encode provided body string into UTF-8 data. Body:\n\(body)" - } - } - } - -} - -public extension XCTestCase { - - /// Creates a `TestIsolatedFileManager` for the current test. - /// - /// **Creating a `TestIsolatedFileManager` sets the current working directory for the - /// current process to it's `directoryURL`.** After the test finishes, the current working - /// directory is reset to its previous value. - func testIsolatedFileManager( - with fileManager: FileManager = .default - ) throws -> TestIsolatedFileManager { - let manager = try TestIsolatedFileManager( - directoryURL: computeTestTempDirectoryURL(), - fileManager: fileManager - ) - - addTeardownBlock { - try manager.cleanUp() - } - - return manager - } - - private func computeTestTempDirectoryURL() -> URL { - let directoryURL: URL - if #available(macOS 13.0, iOS 16.0, tvOS 16.0, *) { - directoryURL = URL(filePath: NSTemporaryDirectory(), directoryHint: .isDirectory) - } else { - directoryURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true) - } - - return directoryURL - .appendingPathComponent("ApolloTests") - .appendingPathComponent(name - .trimmingCharacters(in: CharacterSet(charactersIn: "-[]")) - .replacingOccurrences(of: " ", with: "_") - ) - } -} diff --git a/Tests/ApolloInternalTestHelpers/TestObserver.swift b/Tests/ApolloInternalTestHelpers/TestObserver.swift deleted file mode 100644 index 437ae83e1e..0000000000 --- a/Tests/ApolloInternalTestHelpers/TestObserver.swift +++ /dev/null @@ -1,43 +0,0 @@ -import Apollo -import XCTest - -public class TestObserver: NSObject, XCTestObservation { - - private let onFinish: (XCTestCase) -> Void - - @Atomic private var isStarted: Bool = false - let stopAfterEachTest: Bool - - public init( - startOnInit: Bool = true, - stopAfterEachTest: Bool = true, - onFinish: @escaping ((XCTestCase) -> Void) - ) { - self.stopAfterEachTest = stopAfterEachTest - self.onFinish = onFinish - super.init() - - if startOnInit { start() } - } - - public func start() { - guard !isStarted else { return } - $isStarted.mutate { - XCTestObservationCenter.shared.addTestObserver(self) - $0 = true - } - } - - public func stop() { - guard isStarted else { return } - $isStarted.mutate { - XCTestObservationCenter.shared.removeTestObserver(self) - $0 = false - } - } - - public func testCaseDidFinish(_ testCase: XCTestCase) { - onFinish(testCase) - if stopAfterEachTest { stop() } - } -} diff --git a/Tests/ApolloInternalTestHelpers/TestURLs.swift b/Tests/ApolloInternalTestHelpers/TestURLs.swift deleted file mode 100644 index 4b1a886050..0000000000 --- a/Tests/ApolloInternalTestHelpers/TestURLs.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation - -/// URLs used in testing -public enum TestURL { - case mockServer - case mockPort8080 - - public var url: URL { - let urlString: String - switch self { - case .mockServer: - urlString = "http://localhost/dummy_url" - case .mockPort8080: - urlString = "http://localhost:8080/graphql" - } - - return URL(string: urlString)! - } -} diff --git a/Tests/ApolloInternalTestHelpers/XCTAssertHelpers.swift b/Tests/ApolloInternalTestHelpers/XCTAssertHelpers.swift deleted file mode 100644 index 28cd5564de..0000000000 --- a/Tests/ApolloInternalTestHelpers/XCTAssertHelpers.swift +++ /dev/null @@ -1,159 +0,0 @@ -import XCTest -@testable import Apollo - -public func XCTAssertEqual(_ expression1: @autoclosure () throws -> [T : U]?, _ expression2: @autoclosure () throws -> [T : U]?, file: StaticString = #filePath, line: UInt = #line) rethrows { - let optionalValue1 = try expression1() - let optionalValue2 = try expression2() - - let message = { - "(\"\(String(describing: optionalValue1))\") is not equal to (\"\(String(describing: optionalValue2))\")" - } - - switch (optionalValue1, optionalValue2) { - case (.none, .none): - break - case let (value1 as NSDictionary, value2 as NSDictionary): - XCTAssertEqual(value1, value2, message(), file: file, line: line) - default: - XCTFail(message(), file: file, line: line) - } -} - -public func XCTAssertEqualUnordered(_ expression1: @autoclosure () throws -> C1, _ expression2: @autoclosure () throws -> C2, file: StaticString = #filePath, line: UInt = #line) rethrows where Element: Hashable, C1.Element == Element, C2.Element == Element { - let collection1 = try expression1() - let collection2 = try expression2() - - // Convert to sets to ignore ordering and only check whether all elements are accounted for, - // but also check count to detect duplicates. - XCTAssertEqual(collection1.count, collection2.count, file: file, line: line) - XCTAssertEqual(Set(collection1), Set(collection2), file: file, line: line) -} - -public func XCTAssertMatch(_ valueExpression: @autoclosure () throws -> Pattern.Base, _ patternExpression: @autoclosure () throws -> Pattern, file: StaticString = #filePath, line: UInt = #line) rethrows { - let value = try valueExpression() - let pattern = try patternExpression() - - let message = { - "(\"\(value)\") does not match (\"\(pattern)\")" - } - - if case pattern = value { return } - - XCTFail(message(), file: file, line: line) -} - -// We need overloaded versions instead of relying on default arguments -// due to https://bugs.swift.org/browse/SR-1534 - -public func XCTAssertSuccessResult(_ expression: @autoclosure () throws -> Result, file: StaticString = #file, line: UInt = #line) rethrows { - try XCTAssertSuccessResult(expression(), file: file, line: line, {_ in }) -} - -public func XCTAssertSuccessResult(_ expression: @autoclosure () throws -> Result, file: StaticString = #file, line: UInt = #line, _ successHandler: (_ value: Success) throws -> Void) rethrows { - let result = try expression() - - switch result { - case .success(let value): - try successHandler(value) - case .failure(let error): - XCTFail("Expected success, but result was an error: \(String(describing: error))", file: file, line: line) - } -} - -public func XCTAssertFailureResult(_ expression: @autoclosure () throws -> Result, file: StaticString = #file, line: UInt = #line) rethrows { - try XCTAssertFailureResult(expression(), file: file, line: line, {_ in }) -} - -public func XCTAssertFailureResult(_ expression: @autoclosure () throws -> Result, file: StaticString = #file, line: UInt = #line, _ errorHandler: (_ error: Error) throws -> Void) rethrows { - let result = try expression() - - switch result { - case .success(let success): - XCTFail("Expected failure, but result was successful: \(String(describing: success))", file: file, line: line) - case .failure(let error): - try errorHandler(error) - } -} - -/// Checks that the condition is eventually true with a given timeout (default 1 second). -/// -/// This assertion runs the run loop for 0.01 second after each time it checks the condition until -/// the condition is true or the timeout is reached. -/// -/// - Parameters: -/// - test: An autoclosure for the condition to test for truthiness. -/// - timeout: The timeout, at which point the test will fail. Defaults to 1 second. -/// - message: A message to send on failure. -public func XCTAssertTrueEventually(_ test: @autoclosure () -> Bool, timeout: TimeInterval = 1.0, message: String = "", file: StaticString = #file, line: UInt = #line) { - let runLoop = RunLoop.current - let timeoutDate = Date(timeIntervalSinceNow: timeout) - repeat { - if test() { - return - } - runLoop.run(until: Date(timeIntervalSinceNow: 0.01)) - } while Date().compare(timeoutDate) == .orderedAscending - - XCTFail(message, file: file, line: line) -} - -/// Checks that the condition is eventually false with a given timeout (default 1 second). -/// -/// This assertion runs the run loop for 0.01 second after each time it checks the condition until -/// the condition is false or the timeout is reached. -/// -/// - Parameters: -/// - test: An autoclosure for the condition to test for falsiness. -/// - timeout: The timeout, at which point the test will fail. Defaults to 1 second. -/// - message: A message to send on failure. -public func XCTAssertFalseEventually(_ test: @autoclosure () -> Bool, timeout: TimeInterval = 1.0, message: String = "", file: StaticString = #file, line: UInt = #line) { - XCTAssertTrueEventually(!test(), timeout: timeout, message: message, file: file, line: line) -} - -/// Downcast an expression to a specified type. -/// -/// Generates a failure when the downcast doesn't succeed. -/// -/// - Parameters: -/// - expression: An expression to downcast to `ExpectedType`. -/// - file: The file in which failure occurred. Defaults to the file name of the test case in which this function was called. -/// - line: The line number on which failure occurred. Defaults to the line number on which this function was called. -/// - Returns: A value of type `ExpectedType`, the result of evaluating and downcasting the given `expression`. -/// - Throws: An error when the downcast doesn't succeed. It will also rethrow any error thrown while evaluating the given expression. -public func XCTDowncast(_ expression: @autoclosure () throws -> AnyObject, to type: ExpectedType.Type, file: StaticString = #filePath, line: UInt = #line) throws -> ExpectedType { - let object = try expression() - - guard let expected = object as? ExpectedType else { - throw XCTFailure("Expected type to be \(ExpectedType.self), but found \(Swift.type(of: object))", file: file, line: line) - } - - return expected -} - -/// An error which causes the current test to cease executing and fail when it is thrown. -/// Similar to `XCTSkip`, but without marking the test as skipped. -public struct XCTFailure: Error, CustomNSError { - - public init(_ message: @autoclosure () -> String = "", file: StaticString = #filePath, line: UInt = #line) { - XCTFail(message(), file: file, line: line) - } - - /// The domain of the error. - public static let errorDomain = XCTestErrorDomain - - /// The error code within the given domain. - public let errorCode: Int = 0 - - /// The user-info dictionary. - public let errorUserInfo: [String : Any] = [ - // Make sure the thrown error doesn't show up as a test failure, because we already record - // a more detailed failure (with the right source location) ourselves. - "XCTestErrorUserInfoKeyShouldIgnore": true - ] -} - -public extension Optional { - func xctUnwrapped(file: StaticString = #filePath, line: UInt = #line) throws -> Wrapped { - try XCTUnwrap(self, file: file, line: line) - } -} diff --git a/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift b/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift deleted file mode 100644 index 58fd0db4bf..0000000000 --- a/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift +++ /dev/null @@ -1,77 +0,0 @@ -import XCTest - -extension XCTestExpectation { - /// Private API for accessing the number of times an expectation has been fulfilled. - public var numberOfFulfillments: Int { - value(forKey: "numberOfFulfillments") as! Int - } -} - -public extension XCTestCase { - /// Record the specified`error` as an `XCTIssue`. - func record(_ error: Error, compactDescription: String? = nil, file: StaticString = #filePath, line: UInt = #line) { - var issue = XCTIssue(type: .thrownError, compactDescription: compactDescription ?? String(describing: error)) - - issue.associatedError = error - - let location = XCTSourceCodeLocation(filePath: file, lineNumber: line) - issue.sourceCodeContext = XCTSourceCodeContext(location: location) - - record(issue) - } - - /// Invoke a throwing closure, and record any thrown errors without rethrowing. This is useful if you need to run code that may throw - /// in a place where throwing isn't allowed, like `measure` blocks. - func whileRecordingErrors(file: StaticString = #file, line: UInt = #line, _ perform: () throws -> Void) { - do { - try perform() - } catch { - // Respect XCTestErrorUserInfoKeyShouldIgnore key that is used by XCTUnwrap, XCTSkip, and our own XCTFailure. - let shouldIgnore = (((error as NSError).userInfo["XCTestErrorUserInfoKeyShouldIgnore"] as? Bool) == true) - if !shouldIgnore { - record(error, file: file, line: line) - } - } - } - - /// Wrapper around `XCTContext.runActivity` to allow for future extension. - func runActivity(_ name: String, perform: (XCTActivity) throws -> Result) rethrows -> Result { - return try XCTContext.runActivity(named: name, block: perform) - } -} - -@testable import Apollo -@testable import ApolloAPI - -public extension XCTestCase { - /// Make an `AsyncResultObserver` for receiving results of the specified GraphQL operation. - func makeResultObserver(for operation: Operation, file: StaticString = #filePath, line: UInt = #line) -> AsyncResultObserver, Error> { - return AsyncResultObserver(testCase: self, file: file, line: line) - } -} - -public protocol StoreLoading { - static var defaultWaitTimeout: TimeInterval { get } - var store: ApolloStore! { get } -} - -public extension StoreLoading { - static var defaultWaitTimeout: TimeInterval { 1.0 } -} - -extension StoreLoading where Self: XCTestCase { - public func loadFromStore( - operation: Operation, - file: StaticString = #filePath, - line: UInt = #line, - resultHandler: @escaping AsyncResultObserver, Error>.ResultHandler - ) { - let resultObserver = makeResultObserver(for: operation, file: file, line: line) - - let expectation = resultObserver.expectation(description: "Loaded query from store", file: file, line: line, resultHandler: resultHandler) - - store.load(operation, resultHandler: resultObserver.handler) - - wait(for: [expectation], timeout: Self.defaultWaitTimeout) - } -} diff --git a/Tests/ApolloPerformanceTests/Info.plist b/Tests/ApolloPerformanceTests/Info.plist deleted file mode 100644 index 64d65ca495..0000000000 --- a/Tests/ApolloPerformanceTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Tests/ApolloPerformanceTests/ParsingPerformanceTests.swift b/Tests/ApolloPerformanceTests/ParsingPerformanceTests.swift deleted file mode 100644 index 54809e5889..0000000000 --- a/Tests/ApolloPerformanceTests/ParsingPerformanceTests.swift +++ /dev/null @@ -1,107 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloInternalTestHelpers -import GitHubAPI - -class ParsingPerformanceTests: XCTestCase { - - func testParseResult() throws { - let query = IssuesAndCommentsForRepositoryQuery() - - let response = try loadResponse(for: query) - - measure { - whileRecordingErrors { - let (result, _) = try response.parseResult() - - let data = try XCTUnwrap(result.data) - XCTAssertEqual(data.repository?.name, "apollo-ios") - } - } - } - - func testParseResultFast() throws { - let query = IssuesAndCommentsForRepositoryQuery() - - let response = try loadResponse(for: query) - - measure { - whileRecordingErrors { - let result = try response.parseResultFast() - - let data = try XCTUnwrap(result.data) - XCTAssertEqual(data.repository?.name, "apollo-ios") - } - } - } - - func testMultipartResponseParsingInterceptor() throws { - var rawData: String = "" - for _ in 0..<1000 { - rawData.append(""" - --graphql - content-type: application/json - - { - "payload": { - "data": { - "ticker": 1 - } - } - } - --graphql - """) - } - - let request = JSONRequest( - operation: MockSubscription.mock(), - graphQLEndpoint: TestURL.mockServer.url, - clientName: "ApolloPerformanceTest", - clientVersion: "0", - additionalHeaders: [ - "Accept" : "multipart/mixed;boundary=\"graphql\";subscriptionSpec=1.0,application/json", - ]) - let response = HTTPResponse>( - response: HTTPURLResponse( - url: TestURL.mockServer.url, - statusCode: 200, - httpVersion: nil, - headerFields: [ - "Content-Type": "multipart/mixed;boundary=graphql", - ])!, - rawData: rawData.crlfFormattedData(), - parsedResponse: nil) - - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectedData = "{\"data\":{\"ticker\":1}}".data(using: .utf8) - - measure { - subject.intercept(request: request, response: response) { result in - XCTAssertSuccessResult(result) - XCTAssertEqual(try! result.get(), expectedData) - } - } - } - - // MARK - Helpers - - func loadResponse( - for query: Query, - file: StaticString = #file, - line: UInt = #line - ) throws -> GraphQLResponse { - let bundle = Bundle(for: type(of: self)) - - guard let url = bundle.url(forResource: Query.operationName, withExtension: "json") else { - throw XCTFailure("Missing response file for query: \(Query.operationName)", - file: file, - line: line) - } - - let data = try Data(contentsOf: url) - let body = try JSONSerialization.jsonObject(with: data, options: []) as! JSONObject - - return GraphQLResponse(operation: query, body: body) - } -} diff --git a/Tests/ApolloPerformanceTests/Responses/IssuesAndCommentsForRepository.json b/Tests/ApolloPerformanceTests/Responses/IssuesAndCommentsForRepository.json deleted file mode 100644 index 68798d8188..0000000000 --- a/Tests/ApolloPerformanceTests/Responses/IssuesAndCommentsForRepository.json +++ /dev/null @@ -1 +0,0 @@ -{"data":{"repository":{"__typename":"Repository","name":"apollo-ios","issues":{"__typename":"IssueConnection","nodes":[{"__typename":"Issue","title":"Xcode 12 Beta Archive issue ","author":{"__typename":"User","login":"nkmrh","id":"MDQ6VXNlcjU2NDQ0MjA=","name":"Hajime Nakamura"},"body":"I failed to archive app with 12.0 beta 2 and I found that other libraries have similar issues.\r\n\r\n- https://github.com/airbnb/lottie-ios/issues/1214\r\n- https://github.com/Alamofire/Alamofire/issues/3240\r\n\r\n# Error message\r\n\r\n```\r\nUndefined symbols for architecture armv7:\r\n \"type metadata for Swift._StringObject.Variant\", referenced from:\r\n outlined init with take of Swift._StringObject.Variant in ApolloStore.o\r\nld: symbol(s) not found for architecture armv7\r\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\r\n```\r\n\r\n# Environment\r\nApollo version: 0.28.0\r\nXcode version: 12.0 beta 2 (12A6163b)\r\nSwift version: 5.3 (swiftlang-1200.0.16.13 clang-1200.0.22.25)\r\nPlatform(s) running Apollo: iOS\r\nmacOS version running Xcode: 10.15.5","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Weird! I'm literally testing the new beta right now, and I was just able to build and test `0.29.1` with Xcode 12 b2 without any problem. Have you cleaned your build folder and/or done the [derived data dance](http://derivedata.dance) recently? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":">Have you cleaned your build folder and/or done the derived data dance recently?\r\n\r\nI've tried it but it hasn't helped...\r\n\r\nCould you try setting the build configuration to release? ~~It seems that the optimization level is related.~~ Or try archive.","author":{"__typename":"User","login":"nkmrh","id":"MDQ6VXNlcjU2NDQ0MjA=","name":"Hajime Nakamura"}},{"__typename":"IssueComment","body":"Can't really do archive on a framework, but can confirm this is showing up if I switch the Run action to build for release. \r\n\r\nIt looks like the issue is [some kind of bug with substrings in the beta](https://developer.apple.com/forums/thread/649918?answerId=614735022#614735022). Unfortunately because we support older versions of iOS, disabling armv7 support in the library isn't really a good option for us. \r\n\r\nIt also looks like the workaround for our library isn't as simple as [Lottie's](https://github.com/airbnb/lottie-ios/pull/1215) - we're not using `prefix` and `suffix` methods on `String` anywhere in the main `Apollo` lib, and I'm getting an error on compilation in release mode with a totally different file than you are (`GraphQLResultNormalizer.o`) that's not doing any super-obvious string manipulation. \r\n\r\nIf you have some time to dig around, I'd encourage you to. At this point I've got enough on my plate that something clearly acknowledged by Apple as a bug and which only affects release builds on a beta Xcode is not going to be something I prioritize digging into on my own. Will definitely check back in on this with subsequent beta releases though. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"https://github.com/zhangao0086/DKImagePickerController/issues/669","author":{"__typename":"User","login":"OmarJalil","id":"MDQ6VXNlcjI1NTIwMDE1","name":"Jalil"}},{"__typename":"IssueComment","body":"@designatednerd Thank you for your research. I want to wait for this bug to be fixed in a future Xcode version.","author":{"__typename":"User","login":"nkmrh","id":"MDQ6VXNlcjU2NDQ0MjA=","name":"Hajime Nakamura"}},{"__typename":"IssueComment","body":"I am experiencing this issue as well, which prevented Carthage from building Apollo. I mentioned the issue in the Xcode 12 thread: https://github.com/apollographql/apollo-ios/pull/1280\r\n\r\nI fixed the issue here: https://github.com/danl3v/apollo-ios/tree/0.29.1-xcode12 and it works fine. Feel free to cherry-pick the latest commit to another version of apollo as required. Hopefully Apple will fix its substring issue","author":{"__typename":"User","login":"danl3v","id":"MDQ6VXNlcjg4MzE4OA==","name":"Daniel Levy"}},{"__typename":"IssueComment","body":"Xcode 12 beta 3 just came out, and I am now no longer able to reproduce this by switching the run action to build for release. \r\n\r\n@danl3v @nkmrh Can you please confirm that this is no longer an issue on the `betas/xcode-12` branch for you? Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Will do early next week","author":{"__typename":"User","login":"danl3v","id":"MDQ6VXNlcjg4MzE4OA==","name":"Daniel Levy"}},{"__typename":"IssueComment","body":"@designatednerd @danl3v I confirmed the issue on the `betas/xcode-12 ` branch with Xcode 12.0 beta 3. Unfortunately the one reproduced :(","author":{"__typename":"User","login":"nkmrh","id":"MDQ6VXNlcjU2NDQ0MjA=","name":"Hajime Nakamura"}},{"__typename":"IssueComment","body":"@nkmrh Weird! Did you do `Clean Build Folder` before trying to archive? I double-checked that I'd done that before trying to do the run action as build for release and it still worked. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd I checked the betas/xcode-12 branch again and the build was successful but when I add it to a simple project with cocoapods, it still fails to build... (archive is still failing)","author":{"__typename":"User","login":"nkmrh","id":"MDQ6VXNlcjU2NDQ0MjA=","name":"Hajime Nakamura"}},{"__typename":"IssueComment","body":"Interesting....I'll poke at that today. Thanks!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd I tried it with Xcode 12 beta 4, it solved!","author":{"__typename":"User","login":"nkmrh","id":"MDQ6VXNlcjU2NDQ0MjA=","name":"Hajime Nakamura"}},{"__typename":"IssueComment","body":"Excellent! I'm going to close this issue out then - if anyone has issues archiving on Beta 4 or after, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Beta 4 works for us!","author":{"__typename":"User","login":"danl3v","id":"MDQ6VXNlcjg4MzE4OA==","name":"Daniel Levy"}}]}},{"__typename":"Issue","title":"[Web] - Installation panel doesn't expand content","author":{"__typename":"User","login":"wongzigii","id":"MDQ6VXNlcjczODQyODg=","name":"Zigii Wong"},"body":"![image](https://user-images.githubusercontent.com/7384288/86875928-2ad0f500-c116-11ea-8d1f-804f25c74d0f.png)\r\n\r\nClicking the Installation panel doesn't show the content.\r\n\r\nChrome 83.0.4103.116 64-bit","comments":{"__typename":"IssueCommentConnection","nodes":[]}},{"__typename":"Issue","title":"[Web] - Installation panel doesn't expand content","author":{"__typename":"User","login":"wongzigii","id":"MDQ6VXNlcjczODQyODg=","name":"Zigii Wong"},"body":"![image](https://user-images.githubusercontent.com/7384288/86875928-2ad0f500-c116-11ea-8d1f-804f25c74d0f.png)\r\n\r\nClicking the Installation panel doesn't show the content.\r\n\r\nChrome 83.0.4103.116 64-bit","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Oops! I'll let our docs team know, thank you for the heads up!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Fixed by https://github.com/apollographql/apollo-ios/pull/1306\r\n\r\nCheck it out here: https://www.apollographql.com/docs/ios/installation/","author":{"__typename":"User","login":"trevorblades","id":"MDQ6VXNlcjEyMTY5MTc=","name":"Trevor Blades"}},{"__typename":"IssueComment","body":"Thanks @trevorblades, you rock!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"通过 CocoaPods 导入 Apollo 丢失 WebSocket","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null},"body":"通过 CocoaPods 导入 Apollo 丢失 WebSocket\r\nPodfile 文件中添加 pod 'Apollo', '~> 0.29.0' 执行pod install 完成后 在工程 Pods 中 只有 Apollo/Core 文件 无法找到 Apollo/WebSocket \r\n引用 import ApolloWebSocket 报错 \" No such module 'ApolloWebSocket' \"\r\n\r\n如下图:\r\nPodfile文件:\r\n\"WeChatf75880a9f15d2f78d3d97ec0cd4bc4d9\"\r\n\r\npod search Apollo\r\n\"pod_search_apollo\"\r\n\r\npod install 完成后\r\n\"pod_install\"\r\n\r\n使用代码\r\n\"code\"\r\n\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Google translated:\r\n\r\n> Importing Apollo via CocoaPods loses WebSocket\r\n> Add pod'Apollo' in the Podfile file,'~> 0.29.0' After executing pod install, only Apollo/Core files cannot be found in the project Pods.\r\n> Quoting import ApolloWebSocket reports error \"No such module'ApolloWebSocket'\"\r\n>\r\n> As shown below:\r\n> Podfile\r\n\r\nYou need to add the `Apollo/WebSocket` subspec in order to access the WebSocket library - it is not included by default, only the core libraries are included by default. So your podfile should look like this if you want to use the web socket library: \r\n\r\n```\r\npod 'Apollo', '~>0.29.0'\r\npod 'Apollo/WebSocket', '~>0.29.0'\r\n```","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"ok","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null}}]}},{"__typename":"Issue","title":"Figure out how to test cache key generation with JSON objects","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"},"body":"#1281 addresses an issue where cache keys were being unstably generated when one of the items was a JSON array. I haven't been able to find an API that takes JSON arrays, so we need to find an alternate method of testing key generation for this. Don't want to hold up an actual fix for the issue until I can figure this out, so making this issue to come back to it.","comments":{"__typename":"IssueCommentConnection","nodes":[]}},{"__typename":"Issue","title":"Fatal error (\"Optional is only JSONEncodable if Wrapped is\") when trying to update SqlNormalizedCache manually after a successful mutation operation","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"},"body":"While using Apollo iOS 0.29.1, I appear to be running into an issue similar to the one reported [here](https://github.com/apollographql/apollo-ios/issues/1271). I asked for help with this issue in [Spectrum](https://spectrum.chat/apollo/apollo-ios/updating-cache-after-insert-mutation~71008cf0-6ccf-4474-95bb-ac22c83e9616), and @designatednerd asked me to create a new issue.\r\n\r\nI'm trying to update the SqlNormalizedCache (which is setup and working properly) using the result of a successful mutation operation:\r\n\r\n```\r\napollo.perform(mutation: InsertTaskResponseMutation(taskId: 1, response: \"\")) { result in\r\n guard\r\n let resultData = try? result.get().data,\r\n let taskResponseDetails = resultData.insertTaskResponses?.returning.first?.fragments.taskResponseDetails\r\n else {\r\n return\r\n }\r\n\r\n apollo.store.withinReadWriteTransaction({ transaction in\r\n try! transaction.write(object: taskResponseDetails, withKey: \"task_responses-\\(taskResponseDetails.id)\")\r\n })\r\n}\r\n```\r\n\r\nThis is throwing a fatal error in \"JSONStandardTypeConversions.swift\" at line 109:\r\n\r\n\"Screen\r\n\r\nPrinting the description of `self`:\r\n\r\n```\r\nPrinting description of self:\r\n▿ Optional\r\n - some : 07/08/2020\r\n```\r\n\r\nIn this case, `self` is a property on the `response` property, which is a custom `jsonb` type. Here's the type alias:\r\n\r\n```\r\npublic typealias jsonb = [String : Any?]\r\n\r\nextension Dictionary: JSONDecodable {\r\n public init(jsonValue value: JSONValue) throws {\r\n guard let dictionary = value as? Dictionary else {\r\n throw JSONDecodingError.couldNotConvert(value: value, to: Dictionary.self)\r\n }\r\n \r\n self = dictionary\r\n }\r\n}\r\n```\r\n\r\nAnd here's the query:\r\n\r\n```\r\nquery ChallengeTaskResponse($taskResponseId: Int) {\r\n challenge_responses(where: {id: {_eq: $taskResponseId}}) {\r\n ...ChallengeTaskResponseDetails\r\n }\r\n}\r\n```\r\n\r\nThe mutation:\r\n\r\n```\r\nmutation InsertTaskResponse($response: jsonb) {\r\n insert_task_responses(objects: {response: $response}) {\r\n returning {\r\n ...TaskResponseDetails\r\n }\r\n }\r\n}\r\n```\r\n\r\nAnd, finally, the fragment that's used by both the query and the mutation:\r\n\r\n```\r\nfragment TaskResponseDetails on task_responses {\r\n id\r\n response // The 'jsonb' custom data type\r\n}\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"The problem definitely seems to be in the fact that the value type in the dictionary is `Optional`, and that's what it's trying to use to create a key. \r\n\r\nDoes it work to typealias it to `[String: JSONDecodable?]` instead?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'll test that here shortly and report back.","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"@nateirwin Were you ever able to get this tested out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd: I started to dive into this, ran into a minor issue (that's project-specific and I just need to push through), then got pulled into another issue altogether. This is still critical for our project and it's next on my list, so I'll get to it soon.\r\n\r\nI'm happy to close this and re-open when I've had the chance to test, if that's helpful.","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"Nah, leave it open for now, I'll keep annoying you about it from time to time 😇","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Ok, reporting back :-)\r\n\r\nSwitching the typealias to `public typealias jsonb = [String : JSONDecodable?]` throws an error when loading a query that has a `jsonb` property on it:\r\n\r\n```\r\nPrinting description of error:\r\n▿ GraphQLResultError\r\n ▿ path : communities.0.organization_community_memberships.1.organization.paper_maps.0.paper_map.status\r\n ▿ head : Optional\r\n ▿ some : \r\n ▿ underlying : JSONDecodingError\r\n ▿ couldNotConvert : 2 elements\r\n ▿ value : 24 elements\r\n ▿ 0 : 2 elements\r\n - key : status\r\n - value : Uploading tiles complete\r\n ▿ 1 : 2 elements\r\n - key : min_zoom\r\n - value : 9\r\n ▿ 2 : 2 elements\r\n - key : extent_max_lon\r\n - value : -100.1\r\n ▿ 3 : 2 elements\r\n - key : extent_min_lat\r\n - value : 37.1\r\n ▿ 4 : 2 elements\r\n - key : tileset\r\n - value : tileset_548\r\n ▿ 5 : 2 elements\r\n - key : pdfPath\r\n - value : https://test.xyz/test.pdf\r\n ▿ 6 : 2 elements\r\n - key : updated_at\r\n - value : 2019-07-29T15:04:09.623Z\r\n ▿ 7 : 2 elements\r\n - key : extent_max_lat\r\n - value : 34.1\r\n ▿ 8 : 2 elements\r\n - key : localTilesPath\r\n - value : https://test.xyz/tiles/\r\n ▿ 9 : 2 elements\r\n - key : geotiff_path\r\n - value : /image_georef.tif\r\n ▿ 10 : 2 elements\r\n - key : geotiff_3857_path\r\n - value : /image_georef_3857.tif\r\n ▿ 11 : 2 elements\r\n - key : name\r\n - value : Name Here\r\n ▿ 12 : 2 elements\r\n - key : max_zoom\r\n - value : 15\r\n ▿ 13 : 2 elements\r\n - key : id\r\n - value : 548\r\n ▿ 14 : 2 elements\r\n - key : temp_georefTilesPath\r\n - value : \r\n - super : NSObject\r\n ▿ 15 : 2 elements\r\n - key : ground_control_points\r\n - value : [[1071.640625,2925.1640625,-122.104733996093,37.714753539402],[1355.44921875,2053.29296875,-122.09752430208,37.7391649876836],[1192.0390625,1299.8125,-122.105021746829,37.7592430319794],[669.765625,594.1796875,-122.124813348055,37.7770496273366]]\r\n ▿ 16 : 2 elements\r\n - key : png_path\r\n - value : /final.png\r\n ▿ 17 : 2 elements\r\n - key : page_number\r\n - value : { ... }\r\n ▿ 18 : 2 elements\r\n - key : image_width\r\n - value : 2550\r\n ▿ 19 : 2 elements\r\n - key : created_at\r\n - value : 2019-07-29T14:57:07.796Z\r\n ▿ 20 : 2 elements\r\n - key : georefTilesPath\r\n - value : https://test.xyz/tiles_georef\r\n ▿ 21 : 2 elements\r\n - key : image_height\r\n - value : 3300\r\n ▿ 22 : 2 elements\r\n - key : extent_min_lon\r\n - value : -115.1\r\n ▿ 23 : 2 elements\r\n - key : file_type\r\n - value : pdf\r\n - to : Swift.Dictionary>\r\n```\r\n\r\nI'm guessing maybe it's bonking on the `null` values? Honestly, we've run into so many issues with this custom `jsonb` scalar type that I'm considering trying to back out of using it altogether.","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"Hm, shouldn't be bonking on nulls, we've got something that [theoretically should be handling that](https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/JSONStandardTypeConversions.swift#L89). From the underlying error it looks like it's freaking out about the `status` key which is just a String. \r\n\r\nI think a bigger question this brings up is why this data needs to be returned as an arbitrary JSON blob in the first place - why isn't this data returned as something typed? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Well, `status` is the name of the `jsonb` property, which (I think) should be of type `[String: JSONDecodable?]` because of the type alias:\r\n\r\n```\r\npublic typealias jsonb = [String : JSONDecodable?]\r\n\r\nextension Dictionary: JSONDecodable {\r\n public init(jsonValue value: JSONValue) throws {\r\n guard let dictionary = value as? Dictionary else {\r\n throw JSONDecodingError.couldNotConvert(value: value, to: Dictionary.self)\r\n }\r\n \r\n self = dictionary\r\n }\r\n}\r\n```\r\n\r\nThat's why I'm scratching my head about this. Maybe my next step is setting some more breakpoints in JSONStandardTypeConversions.swift?","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"Looking at the JSON, `status` seems to be a key and value of the dictionary which isn't getting deserialized - can you throw in a breakpoint and print out the raw JSON string (or use a proxying tool to see it) that's coming through? That might help.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Sure, here you go (sorry about the delay):\r\n\r\n```\r\n{\r\n \"data\": {\r\n \"communities\": [\r\n {\r\n \"organization_community_memberships\": [\r\n {\r\n \"id\": 467,\r\n \"organization\": {\r\n \"paper_maps\": [\r\n {\r\n \"id\": 557,\r\n \"paper_map\": {\r\n \"description\": \"null\",\r\n \"id\": 322,\r\n \"name\": \"Name Here\",\r\n \"status\": {\r\n \"id\": 548,\r\n \"name\": \"Name Here\",\r\n \"status\": \"Uploading tiles complete\",\r\n \"pdfPath\": \"https://test.xyz/test.pdf\",\r\n \"max_zoom\": 15,\r\n \"min_zoom\": 9,\r\n \"png_path\": \"/final.png\",\r\n \"file_type\": \"pdf\",\r\n \"created_at\": \"2019-07-29T14:57:07.796Z\",\r\n \"updated_at\": \"2019-07-29T15:04:09.623Z\",\r\n \"image_width\": 2550,\r\n \"page_number\": null,\r\n \"geotiff_path\": \"/image_georef.tif\",\r\n \"image_height\": 3300,\r\n \"extent_max_lat\": \"34.1\",\r\n \"extent_max_lon\": \"-100.1\",\r\n \"extent_min_lat\": \"37.1\",\r\n \"extent_min_lon\": \"-115.1\",\r\n \"localTilesPath\": \"https://test.xyz/tiles/\",\r\n \"mapbox_tileset\": \"trailheadlabs.paper_map_548\",\r\n \"georefTilesPath\": \"https://test.xyz/tiles_georef\",\r\n \"geotiff_3857_path\": \"/image_georef_3857.tif\",\r\n \"temp_georefTilesPath\": null,\r\n \"ground_control_points\": \"[[1071.640625,2925.1640625,-122.104733996093,37.714753539402],[1355.44921875,2053.29296875,-122.09752430208,37.7391649876836],[1192.0390625,1299.8125,-122.105021746829,37.7592430319794],[669.765625,594.1796875,-122.124813348055,37.7770496273366]]\"\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}\r\n```","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"Ah, ok, `status` is _also_ the name of the property of the dictionary, not just one of the things in the dictionary. \r\n\r\nOne thing it didn't occur to me to ask: Is your `Dictionary` initializer getting hit at all? I wonder if it may need to be constrained to the key and value types you're using","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"It is getting hit, and it's throwing when that same `status` property that holds the dictionary.","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"Here's a thought - have you got an extension that implements `JSONEncodable`? It looks like you're only implementing `JSONDecodable` above","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hmm, this is what I get when I start to implement `JSONEncodable`:\r\n\r\n\"Screen","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"Aha, [that is indeed implemented in the library](https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/JSONStandardTypeConversions.swift#L114). \r\n\r\nOK, I'll mess around with this some to try and figure out what's going on here. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks for your help!","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"@nateirwin please try pulling the branch #1317 is opened from and seeing if that fixes your issue. You can put the `typealias` back to `[String: Any?]`. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yep, that fixes the issue!!!","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}},{"__typename":"IssueComment","body":"This has shipped with `0.30.0` - ready to go for SPM and Carthage, in the process of pushing to trunk on Cocoapods. 🎉","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"More generalized types","author":{"__typename":"User","login":"TimBroddin","id":"MDQ6VXNlcjUyODI4Nw==","name":"Tim Broddin"},"body":"Hi,\r\n\r\nI'm kinda new to Apollo iOS, so sorry if my question is kinda stupid. I'm passing a lot of data around in my (SwiftUI) app and the typing kinda drives me crazy. Right now I'm accepting arguments with types like `LetterPartsQuery.Data.ArtistsSplittedInLetterPart.Artist` & `HomePageQuery.Data.Post.Artist` and it's becoming harder and harder to manage this. \r\n\r\nWhat's the quickest way to having easier types to juggle arround (like just `Artist` in my example above).\r\n\r\nThanks a lot!","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I'm a firm believer in \"There's no such thing as a stupid question, only an asshole answer.\" 😇 That said, this is definitely NOT a stupid question. \r\n\r\nOne thing that helps explain the way we generate this code is that for each operation, we only want to make available those properties and types that you've actually requested, rather than all possible properties and types. This means we have some fairly nested structures like the ones you're seeing. \r\n\r\nOne work around for this is to use [GraphQL fragments](https://graphql.org/learn/queries/#fragments). Our codegen will take anyplace that uses a fragment and generate a fragment type that can be reused across multiple operations. \r\n\r\nThey're still more annoying to use than I'd like (this is something I'm working on in Swift Codegen, but that's slightly blocked at the moment), but they are at least the same reusable type. \r\n\r\nDoes that help? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks a lot! This will make my code readable again 😄 ","author":{"__typename":"User","login":"TimBroddin","id":"MDQ6VXNlcjUyODI4Nw==","name":"Tim Broddin"}}]}},{"__typename":"Issue","title":"Serialize or recreate mutation","author":{"__typename":"User","login":"pggawlowski","id":"MDQ6VXNlcjY0OTY2OTU2","name":null},"body":"What I am trying to achieve is mutation archivization. \r\nMy first try was NSKeyedArchiver.archivedData, however currently it is impossible. \r\nSo I decided to try to serialize and store jsonObject and/or variables and later, when back online, recreate mutation query.\r\n\r\n```\r\nlet object = mutation.variables?.jsonObject ?? [:]\r\ndo {\r\n let recreatedMutation = try TestMutation.Data(jsonObject: object, variables: nil)\r\n} catch {\r\n print(error)\r\n}\r\n```\r\n\r\nHowever it results in `Apollo.JSONDecodingError.missingValue`\r\n\r\nAny suggestions how to serialize and store mutations/queries or recreate them from stored data.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"It'd probably help for me to understand the use case - why do you need to persist the mutation itself?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"We have to deal with cache sync. So one concept is to introduce some kind of mutations persistency. Currently we are successfully mutating cache but we also have to push it away when connection is restored.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"I think I'm a bit confused - are you talking about persisting the **result** of a mutation, or the mutation itself? \r\n\r\nWhat I think is happening is that you're trying to persist the mutation itself so you can push changes you've made locally up to a server. Is that correct? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Exactly! :) ","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"So part of the problem is that you're trying to use the nested `TestMutation.Data` type - that type is used for recreating the **result** of the mutation, not the mutation itself. \r\n\r\nYou basically have to create the mutation the same way you would have if you weren't making it locally. So if your generated initializer is `TestMutation(parameter: String)`, then you want to persist the value of `parameter` and then send that mutation again. \r\n\r\nWhat you're trying to do is persist the variables JSON object, but there isn't an initializer for queries that takes that JSON object that you can pass what you're saving directly to. You could probably make a throwing initializer (in another file so it doesn't get overwritten by codegen) for the mutation that pulls that JSON back out, then tries to make the appropriate query from the JSON. \r\n\r\nYou'd have to have some notion of what query the JSON was for, though - it might be better to have some custom `Codable` types that can persist information about both the query type and the parameter values you need to persist. \r\n\r\nThere is definitely not a built-in way to do this, though. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@pgawlowski Anything else I can help with here? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"It's fine. Thank you very much! ","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"Cool - I'm going to close this issue out then. Thanks!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"How Can I set authorisation header for Apollo Client?","author":{"__typename":"User","login":"Prathap-iOS","id":"MDQ6VXNlcjU4Mzk2NTI2","name":"Prathap Reddy"},"body":"I am using Apollo Client. I got the access token after login. I have set the access token as authorisation header like this.\r\n\r\nfunc setApolloClient(accessToken: String) {\r\n self.apolloClient = {\r\n let authPayloads = [\"Authorization\": \"Bearer \\(accessToken)\"]\r\n let configuration = URLSessionConfiguration.default\r\n configuration.httpAdditionalHeaders = authPayloads\r\n configuration.requestCachePolicy = .reloadIgnoringLocalCacheData\r\n let endpointURL = URL(string: graphEndpoint)!\r\n return ApolloClient(networkTransport: HTTPNetworkTransport(url: endpointURL))\r\n }()\r\n }\r\n\r\nI am sending this authorisation header to a query to get the user details. It return success. But, I have no idea where it went wrong. I am not getting user details. I am getting Try again later. @designatednerd Is there any other way to set authorisation header?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I suspect \r\n\r\n```swift\r\nlet authPayloads = [\"Authorization\": \"Bearer (accessToken)\"]\r\n``` \r\n\r\nshould be \r\n\r\n```swift\r\nlet authPayloads = [\"Authorization\": \"Bearer \\(accessToken)\"]`\r\n```\r\n\r\nOtherwise you're sending the literal string `(accessToken)` as your access token rather than using string interpolation, which looks like what you want to do. \r\n\r\nIf that's not the issue, let me know and I can dig deeper - other than that your setup seems pretty straightforward. \r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd I used let authPayloads = [\"Authorization\": \"Bearer \\ (accessToken)\"]. But this one also not working.","author":{"__typename":"User","login":"Prathap-iOS","id":"MDQ6VXNlcjU4Mzk2NTI2","name":"Prathap Reddy"}},{"__typename":"IssueComment","body":"You still need the `\\` before the first paren in `(accessToken)`, otherwise it'll be sent as a string literal. \r\n\r\nAre you able to use a proxy tool like [Charles](https://www.charlesproxy.com/) or [MiTM Proxy](https://mitmproxy.org/) to see what the final headers going out over the network are? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yeah I used \\ before (accessToken). But There is no proper result. I am not using any proxies.","author":{"__typename":"User","login":"Prathap-iOS","id":"MDQ6VXNlcjU4Mzk2NTI2","name":"Prathap Reddy"}},{"__typename":"IssueComment","body":"I was asking if you could try using a proxy to see if you can see what the final headers are - that way you can see exactly what's going over the network. \r\n\r\nI would also double check with your backend that they take the token as a `Bearer` token - that's standard practice, but I've definitely seen a lot of backends that don't adhere to that.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd my backend team is following the same standard. They taken token as **Bearer** token.","author":{"__typename":"User","login":"Prathap-iOS","id":"MDQ6VXNlcjU4Mzk2NTI2","name":"Prathap Reddy"}},{"__typename":"IssueComment","body":"OK I was double checking what you're doing, and I missed the most obvious thing: The `URLSessionConfiguration` is not being passed into anything, so the configuration you're correctly setting up is not being given to anything to be used. Instead of this at the very end: \r\n\r\n```swift\r\nreturn ApolloClient(networkTransport: HTTPNetworkTransport(url: endpointURL))\r\n```\r\n\r\ntry this: \r\n\r\n```swift\r\nlet client = URLSessionClient(sessionConfiguration: configuration)\r\nreturn ApolloClient(networkTransport: HTTPNetworkTransport(url: endpointURL), client: client)\r\n```","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd Thanks. It's working fine. \r\n\r\nHere is my working code for setting up authorization header.\r\n\r\n`func getApolloClient(headerRequired:Bool = true) -> ApolloClient {\r\n let tokenValue = SessionManager.shared.getToken().TokenValue\r\n let authPayloads = [\"Authorization\": \"Bearer \\(tokenValue)\"]\r\n let configuration = URLSessionConfiguration.default\r\n configuration.httpAdditionalHeaders = authPayloads\r\n configuration.requestCachePolicy = .reloadIgnoringLocalCacheData\r\n let client = URLSessionClient(sessionConfiguration: configuration)\r\n let endpointURL = URL(string: graphEndpoint)!\r\n return ApolloClient(networkTransport: HTTPNetworkTransport(url: endpointURL, client: client))\r\n }`","author":{"__typename":"User","login":"Prathap-iOS","id":"MDQ6VXNlcjU4Mzk2NTI2","name":"Prathap Reddy"}},{"__typename":"IssueComment","body":"@Prathap-iOS great! Mind if we close this out?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Since @Prathap-iOS has noted that solution works, I'm going to go ahead and close this out. If you're having a similar problem, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"How to use the --passthrough-custom-scalar flag","author":{"__typename":"User","login":"ijl0322","id":"MDQ6VXNlcjE1OTAxNTMx","name":"Isabel Lee"},"body":"Hi, \r\n\r\nI'm trying to use the --passthrough-custom-scalar flag:\r\n\r\n`\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --passthrough-custom-scalar --localSchemaFile=\"schema.json\" API.swift`\r\n\r\nAnd getting this error `Error: Unexpected argument: API.swift`\r\n\r\nI'm using Apollo 0.29.1 and Xcode 11.5. Any help would be appreciated, Thanks!\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"It's `--passthroughCustomScalars`, Pascal case instead of kebab case and plural instead of singular. I think that may be causing the parsing to fail.\r\n\r\nIf fixing that doesn't fix it, I'd switch it to after `--localSchemaFile` - that might be looking for multiple arguments but I can't remember off the top of my head. \r\n\r\nLet me know which one (or both) works!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"The Pascal case works !! Thank you so much for your help! ","author":{"__typename":"User","login":"ijl0322","id":"MDQ6VXNlcjE1OTAxNTMx","name":"Isabel Lee"}}]}},{"__typename":"Issue","title":" Getting 'No operations found to generate` error when trying to use `ID` in query","author":{"__typename":"User","login":"dpatel-git","id":"MDQ6VXNlcjY4NDM2NTk1","name":null},"body":"I am working on an iOS application to communicate with our GraphQL backend using Apollo's GraphQL library. With the query below, I am able to generate Swift code that I can use to query backend.\r\n\r\n`query mobileApp {\r\n app(id: \"content/mobileApp\") {\r\n title\r\n } \r\n}`\r\n\r\nI am using the following commands to generate Swift code\r\n\r\n`../../Pods/Apollo/scripts/apollo/bin/run client:codegen --target=swift --includes ../app.graphql --localSchemaFile=./downloaded_schema.json API.swift`\r\n\r\nHowever, if I replace the string literal passed into the app(...) with ID like this\r\n\r\n`query mobileApp {\r\n app(id: ID!) {\r\n title\r\n } \r\n}`\r\n\r\nrunning the same codegen command fails with the following error.\r\n\r\n`Generating query files with 'swift' target\r\n → No operations or fragments found to generate code for.\r\nError: No operations or fragments found to generate code for.\r\n at write (~/Downloads/ios-app/Pods/Apollo/scripts/apollo/lib/commands/client/codegen.js:65:39)\r\n at Task.task (~/Downloads/ios-app/Pods/Apollo/scripts/apollo/lib/commands/client/codegen.js:90:46)`\r\n\r\nIt seems that the script is not able to find a declaration of ID. Hoping that someone can point me in the right direction, thanks","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I'm not sure why it's saying there are no operations rather than there's an error in your declaration, but there's an error in your declaration. \r\n\r\nTo pass in a parameter, you need to declare that parameter in the query's declaration, then pass it into the query itself: \r\n\r\n```graphql\r\nquery mobileApp($id: ID!) { \r\n app(id: $id) {\r\n title\r\n }\r\n}\r\n```\r\n\r\nHope that gets you going!\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I think codegen script could be defaulting to `No Operations ...` error if it's able to come to a conclusion. \r\n\r\nAnyways, making the changes you suggested fixed the error.\r\n\r\nSuper thanks.","author":{"__typename":"User","login":"dpatel-git","id":"MDQ6VXNlcjY4NDM2NTk1","name":null}}]}},{"__typename":"Issue","title":"Fragments imported into multiple graphql queries","author":{"__typename":"User","login":"piv199","id":"MDQ6VXNlcjgyOTMxOTE=","name":"Olexii Pyvovarov"},"body":"Hi, quite new to graphql and trying to establish best practices in the project.\r\n\r\nHave found an article about fragments: https://www.apollographql.com/docs/ios/fragments/\r\n\r\nI wonder whether there is an ability to import Fragment.graphql (which defines fragment only) into another graphql file with query that uses that fragment?\r\n\r\n```\r\nFragment.graphql\r\nfragment A { }\r\n```\r\n\r\n```\r\nQuery.grapqhl\r\nquery {\r\n property {\r\n ...A\r\n }\r\n}\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Yep, as long as they're in the same module you should be able to do that!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"(you won't need to import fragment.graphql, the codegen should be able to see all fragments defined in the module)","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd Thanks! Sorry for opening the issue... I did all right but the problem was in fragment naming - it was the same as model entity thus I had segmentation fault and not found errors... Thanks for help!\r\n","author":{"__typename":"User","login":"piv199","id":"MDQ6VXNlcjgyOTMxOTE=","name":"Olexii Pyvovarov"}}]}},{"__typename":"Issue","title":"Keys with nil values are removed","author":{"__typename":"User","login":"docallag","id":"MDQ6VXNlcjM1MzIzMQ==","name":"David O'Callaghan"},"body":"Hi,\r\nI'm just wondering why keys with nil values are removed on queries/mutations? \r\n\r\nSpecifically the **withNilValuesRemoved** extension method in **GraphQLInputValue.swift**\r\n\r\nThanks,\r\nDave","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Good question! So you can see a little bit of why in [this test](https://github.com/apollographql/apollo-ios/blob/main/Tests/ApolloTests/InputValueEncodingTests.swift#L74) and [this test](https://github.com/apollographql/apollo-ios/blob/main/Tests/ApolloTests/InputValueEncodingTests.swift#L80). \r\n\r\nFor input values, passing `nil` and passing `.some(nil)` have different meanings. Passing `nil` means \"I am not providing a value here.\" Passing `.some(nil)` means \"I am providing a value, and it is explicitly nil.\" The `nil`s are filtered out, the `.some(nil)`s are not.\r\n\r\nThis has effects on the server side: If you send `null` to the server, it will overwrite whatever was already in your server-side database with `null`. If you don't send anything to the server, anything which was already there and isn't explicitly being changed will remain untouched. \r\n\r\nIn the swift Codegen stuff I'm working on there's going to be a [`GraphQLOptional`](https://github.com/apollographql/apollo-ios/blob/main/Sources/ApolloCore/GraphQLOptional.swift#L3) type that should capture this a bit more clearly than the current codegen, but unfortunately that's still a ways out (😭). \r\n\r\nDoes that make more sense? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Oh that's perfect! I can use `.some(nil)` to stop it being filtered out.\r\n\r\nThanks so much for the quick reply 🤩","author":{"__typename":"User","login":"docallag","id":"MDQ6VXNlcjM1MzIzMQ==","name":"David O'Callaghan"}}]}},{"__typename":"Issue","title":"Does every table need an \"id\" or \"","author":{"__typename":"User","login":"joshuarobs","id":"MDQ6VXNlcjUyOTQ2ODgx","name":null},"body":"","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"(closing this in favor of #1326)","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Does every table need an \"id\" or \"_id\" field for its data to be cached properly?","author":{"__typename":"User","login":"joshuarobs","id":"MDQ6VXNlcjUyOTQ2ODgx","name":null},"body":"According to Apollo Client React here: https://www.apollographql.com/docs/react/caching/cache-configuration/#generating-unique-identifiers the way data is identified and if any changes have been made is as described:\r\n\r\n````\r\nTo do so, it combines the object's __typename with its id or _id field (whichever is defined).\r\nThese two values are separated by a colon (:).\r\n````\r\n\r\nThere seems to be an option for React where a different field other than `id` can be used, especially if there is another field set as the primary key on the db.\r\n\r\nIs there a way to do this for Apollo iOS? If not, does that mean we have to make all tables in our database have some sort of `id` or `_id` field?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! This is handled rather differently on iOS at the moment. Here's [a detailed doc about our caching on iOS](https://www.apollographql.com/docs/ios/caching/). \r\n\r\nThe short answer of how to set a custom key is to take a look at the [Controlling Normalization section](https://www.apollographql.com/docs/ios/caching/#controlling-normalization), where you can find information about the `cacheKeyForObject` function you can use to set custom cache keys on iOS. \r\n\r\nDoes that answer your question? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yes it does, thanks!","author":{"__typename":"User","login":"joshuarobs","id":"MDQ6VXNlcjUyOTQ2ODgx","name":null}},{"__typename":"IssueComment","body":"@designatednerd Also, forgot to ask one more quick question: is `cacheKeyForObject` set only once throughout the whole Apollo object? That is, if we set it to `id`, does that mean every table that ever gets queried needs to have an `id` field? What about if we have most tables with a unique `id` but some tables don't have it and use other primary keys?","author":{"__typename":"User","login":"joshuarobs","id":"MDQ6VXNlcjUyOTQ2ODgx","name":null}},{"__typename":"IssueComment","body":"There is only one closure per store (set through the client), but you can do some stuff by extracting the value of `__typename` from the JSON you get in order to have it work differently for different things. \r\n\r\nYou also can just return `nil` if `id` is nil, and a default cache key based on the path of the request will be generated. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Inline GQL","author":{"__typename":"User","login":"ericlewis","id":"MDQ6VXNlcjY3NDUwMw==","name":"Eric Lewis"},"body":"This might be old hat and I know it’s not a great issue but need to write down somewhere:\r\n\r\nYou should be able to describe fragments or query’s with inline strings as opposed to colocating with graphql files. \r\n\r\nIt probs seems minor but from a DX perspective the whole co-locating things a big deal. \r\n\r\nCreating more folder structure to organize is less good than just having the query in a used component. This is probably more true of SwiftUI than anything, and I have some SwiftUI stuff to contribute if folks want it. ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! There's definitely some significant obstacles to this at the moment, particularly around how things are ingested for code generation. Right now, we only ingest from `.graphql` files rather than from any arbitrary file, and without having to worry about what is a Swift `String` that contains a GraphQL query or anything like that. \r\n\r\nThis is definitely an enhancement to consider for the long term, but I'll be honest, we've got way bigger problems to solve first. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"don't see this happening to be fair, more likely would be some kind of DSL","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"Thats' an interesting idea - I think the main issues I see with it are a) How would we ensure that queries are valid? and b) How would we generate the classes necessary for parsing the result? \r\n\r\nDefinitely going to think on that when I get back to this issue though. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Swift scripting codegen error: \"Error: Cannot find module './errors/pretty-print'\"","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"},"body":"macOS 10.15.6\r\nXcode 11.6\r\n\r\nWe're using Swift scripting for Codegen in our project. It was working fine until recently. The only change that occurred (that I can think of) is macOS and Xcode updated. I'm getting the following error:\r\n\r\n```\r\n[DEBUG - ApolloCodegenLib:CLIDownloader.swift:43] - Zip file with the CLI is already downloaded!\r\nSHASUM of downloaded file: c2b1215eb8e82ec9d777f4b1590ed0f60960a23badadd889e4d129eb08866f14\r\n[DEBUG - ApolloCodegenLib:CLIExtractor.swift:57] - Binary already extracted!\r\n[ERROR - ApolloCodegenLib:Basher.swift:62] - internal/modules/cjs/loader.js:638\r\n throw err;\r\n ^\r\n\r\nError: Cannot find module './errors/pretty-print'\r\n at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)\r\n at Function.Module._load (internal/modules/cjs/loader.js:562:25)\r\n at Module.require (internal/modules/cjs/loader.js:692:17)\r\n at require (internal/modules/cjs/helpers.js:25:18)\r\n at Object. (/Users/nateirwin/Development/trailheadlabs/outerspatial-ios/Codegen/ApolloCLI/apollo/node_modules/@oclif/errors/lib/handle.js:6:24)\r\n at Module._compile (internal/modules/cjs/loader.js:778:30)\r\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)\r\n at Module.load (internal/modules/cjs/loader.js:653:32)\r\n at tryModuleLoad (internal/modules/cjs/loader.js:593:12)\r\n at Function.Module._load (internal/modules/cjs/loader.js:585:3)\r\n\r\nProgram ended with exit code: 1\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"That's very odd, that shouldn't have changed anything in the path - I did not have any migration issues when I migrated my machine to those versions. \r\n\r\nWhat I'd suggest is deleting the extracted files from the `tar.gz` file and letting it re-extract. I have no idea what could have changed in there, but re-extracting from the zip file is a good way to make sure you've got everything. Let me know if this works.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"That worked, thanks!","author":{"__typename":"User","login":"nateirwin","id":"MDQ6VXNlcjEwNDQz","name":"Nate Irwin"}}]}},{"__typename":"Issue","title":"Apollo 0.29.0 - 0.30.0 failed to build in Travis","author":{"__typename":"User","login":"hendyevan","id":"MDQ6VXNlcjk4Mjk3Mg==","name":"Hendy Evan"},"body":"Hi, i have an issue in Travis when build my apps using apollo.\r\n\"Screen\r\nIt's said there is no module `ApolloCore`, but when i run in xcode and archive it using xcode, it went well. No issue arises when using Xcode.\r\n\r\nI tried to downgrade to version `0.28.0` and it works well in Travis. No error occured.\r\nIs there any configuration for Travis to build `Apollo` pod?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! I'm not sure what your build looks like in Travis, but the issue is around a macro that's used by CocoaPods. CocoaPods pulls every sub-spec into a single big library, so we had to add [this macro](https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/Bundle%2BHelpers.swift#L2) to tell the compiler not to try to import the `ApolloCore` module when using CocoaPods. It sounds like that macro is getting properly populated when you build/archive locally. \r\n\r\nWhat's the command you're using to build on Travis? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"This is command from my Travis :\r\n\r\n```\r\nlanguage: swift\r\nosx_image: xcode11.5\r\nxcode_project: Project.xcworkspace\r\n\r\ncache:\r\n - bundler\r\n - cocoapods\r\n\r\nbefore_install:\r\n - gem install bundler\r\n - bundle install\r\n - pod install\r\n\r\njobs:\r\n allow_failures:\r\n - env: code-coverage\r\n include:\r\n - stage: deploy\r\n before_script: curl -sL firebase.tools | upgrade=true bash\r\n script: bundle exec fastlane deploy\r\n after_success: bundle exec fastlane archive\r\n```\r\n\r\nAnd for my fastlane I'm using `Gym` :\r\n```\r\nprivate_lane :ios_build do |options|\r\n scheme = options[:scheme]\r\n export_method = options[:export_method]\r\n output_name = options[:output_name]\r\n key_name = options[:development]\r\n\r\n gym(\r\n workspace: \"Project.xcworkspace\",\r\n scheme: scheme,\r\n configuration: scheme,\r\n silent: true,\r\n clean: true,\r\n suppress_xcode_output: false,\r\n export_method: export_method,\r\n output_name: output_name,\r\n xcargs: \"ARCHIVE=YES\",\r\n skip_profile_detection: true,\r\n codesigning_identity: key_name,\r\n analyze_build_time: true\r\n )\r\n end\r\n```","author":{"__typename":"User","login":"hendyevan","id":"MDQ6VXNlcjk4Mjk3Mg==","name":"Hendy Evan"}},{"__typename":"IssueComment","body":"I would maybe look at adding `COCOAPODS=YES` to your `xcargs` via `gym` if nothing else works - i would also check that the configuration that you're passing in to `gym` has that variable set. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I've add `COCOAPOD=YES` to `gym` and it's still fail to build in Travis.\r\n```\r\ngym(\r\n workspace: \"Project.xcworkspace\",\r\n scheme: scheme,\r\n configuration: scheme,\r\n silent: true,\r\n clean: true,\r\n suppress_xcode_output: false,\r\n export_method: export_method,\r\n output_name: output_name,\r\n xcargs: \"ARCHIVE=YES COCOAPODS=YES\",\r\n skip_profile_detection: true,\r\n codesigning_identity: key_name,\r\n analyze_build_time: true\r\n )\r\n```\r\n\r\n","author":{"__typename":"User","login":"hendyevan","id":"MDQ6VXNlcjk4Mjk3Mg==","name":"Hendy Evan"}},{"__typename":"IssueComment","body":"IIRC it needs a comma and not a space - what about looking at the configuration you're using - does that have `COCOAPODS=YES` (or 1) set up? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Already add comma in gym `xcargs: \"ARCHIVE=YES, COCOAPODS=YES\"` and in my configuration there is already an argument `COCOAPODS=1`. But it's still give me the same error in travis.\r\n\"Screen\r\n","author":{"__typename":"User","login":"hendyevan","id":"MDQ6VXNlcjk4Mjk3Mg==","name":"Hendy Evan"}},{"__typename":"IssueComment","body":"It looks like in the Release scheme there's a space before `COCOAPODS=1` - what happens if you delete that space?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi, we already add several condition in `xcargs` regarding this issue using `COCOAPODS=0`, `COCOAPODS=1` and `COCOAPODS=YES`. but still no luck. any clue @designatednerd ?","author":{"__typename":"User","login":"budioktaviyan","id":"MDQ6VXNlcjIwMzE0OTM=","name":"Budi Oktaviyan"}},{"__typename":"IssueComment","body":"> It looks like in the Release scheme there's a space before `COCOAPODS=1` - what happens if you delete that space?\r\n\r\nThat's not a space, maybe because it's have another config in first line so it's appear like a space.\r\n\"Screen\r\nAnyway for travis build, we use schema `alpha & beta`. And still no luck ","author":{"__typename":"User","login":"hendyevan","id":"MDQ6VXNlcjk4Mjk3Mg==","name":"Hendy Evan"}},{"__typename":"IssueComment","body":"Hmmm...I wonder if there's an issue because `$(inherited)` is in there twice. \r\n\r\nHonestly, I'm not sure what to tell you - it's clear that the `#if !COCOAPODS` compile gate isn't working on Travis, but I'm really not sure why. \r\n\r\nIf you run the fastlane script locally, do you see the same errors? That could start to point you in the right direction. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@budioktaviyan @hendyevan Were y'all ever able to figure out what was going on here, or at least get the fastlane script to run locally? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi @designatednerd , I ever run it locally using `fastlane` and got same issue. So basically, we use `gym` action on fastlane to bundle our app. Apart from that, we also trying to build + archive using xcode, and it works!\r\n\r\nIDK why, is it a `fastlane` problem or something else ?","author":{"__typename":"User","login":"budioktaviyan","id":"MDQ6VXNlcjIwMzE0OTM=","name":"Budi Oktaviyan"}},{"__typename":"IssueComment","body":"That indicates there's likely some kind of configuration issue that's being hit by fastlane - the good news is it's a lot easier to debug that when it can be reproduced locally. I would try using some of the tips from [Fastlane's troubleshooting guide](https://docs.fastlane.tools/codesigning/troubleshooting/), particularly the use of the `--verbose` flag that might give you a better indicator of what's going wrong. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@hendyevan Were you able to get the verbose output and see what might be happening? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi @designatednerd, so the issue actually come from fastlane ? What did you expect from `verbose` build ? did you have any clue ?","author":{"__typename":"User","login":"budioktaviyan","id":"MDQ6VXNlcjIwMzE0OTM=","name":"Budi Oktaviyan"}},{"__typename":"IssueComment","body":"Hi, sorry, I was on vacation last week!\r\n\r\nIt seems like Fastlane is using a build configuration that isn't picking up the `COCOAPODS` setting, I was hoping that the `verbose` build would give you more information about what configuration you're using and what settings are set in that configuration. That might help you figure out more info about what you need to pass into Fastlane to get it to use a build configuration that _does_ use the `COCOAPODS` setting. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Were you ever able to figure out what was happening? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi @designatednerd , sorry for slow response. We are still in the middle of project and the deadline is very tight. We will inform you later as soon as possible after we try it in local and using `verbose` as you suggest.","author":{"__typename":"User","login":"hendyevan","id":"MDQ6VXNlcjk4Mjk3Mg==","name":"Hendy Evan"}},{"__typename":"IssueComment","body":"Hi @designatednerd,\r\n\r\nSorry for late response. So, we're just running like this ?\r\n```bundle exec fastlane lane --verbose```\r\n\r\nisn't it ?","author":{"__typename":"User","login":"budioktaviyan","id":"MDQ6VXNlcjIwMzE0OTM=","name":"Budi Oktaviyan"}},{"__typename":"IssueComment","body":"I believe so - there's instructions in the troubleshooting guide I linked earlier that are going to be more accurate than anything I can give you. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hey all - I'm going to close this out since I haven't heard back in a few weeks. My best recommendation would be to get things building locally with Fastlane since you can get feedback much more easily than you can from Travis itself. I've generally found in the past that once something is building locally with Fastlane, it's much more likely to succeed on any CI platform if you're building using fastlane on that platform. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Adjusting the reconnection behaviour of `WebSocketTransport`","author":{"__typename":"User","login":"ketenshi","id":"MDQ6VXNlcjY4MDY2OTc=","name":"Eugene Kwong"},"body":"Hello!\r\n\r\nI have a similar setup to https://github.com/apollographql/apollo-ios/pull/1224 but with the caveat of requiring the user to login again in some cases. With an invalid `connectingPayload` the server closes the connection immediately, and `WebSocketTransport` will keep retrying. The `connectingPayload` can be updated with the new authentication token after the user logs in again.\r\n\r\nI would like to add in the ability to either prevent `WebSocketTransport` from reconnecting or be able to pause the websocket. \r\n\r\nIf we go the route of adjusting the reconnection behaviour I was thinking of adding something similar to `HTTPNetworkTransportRetryDelegate` but that kind of goes against the idea of passing `reconnect` as part of the initialization. So maybe having a getter/setter might be best.\r\n\r\nHope that I can get some guidance/feedback on this. Thanks!","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Does `closeConnection` on `WebSocketTransport` do what you need it to? That explicitly sets `reconnect.value` to false. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'd like to keep existing `subscriptions` so unfortunately `closeConnection` isn't viable.","author":{"__typename":"User","login":"ketenshi","id":"MDQ6VXNlcjY4MDY2OTc=","name":"Eugene Kwong"}},{"__typename":"IssueComment","body":"So you're thinking more like this: \r\n\r\n```swift\r\n public func pauseWebSocketConnection() {\r\n self.reconnect.value = false\r\n self.websocket.disconnect()\r\n }\r\n \r\n public func resumeWebSocketConnection(autoReconnect: Bool = true) {\r\n self.reconnect.value = autoReconnect\r\n self.websocket.connect()\r\n }\r\n```\r\n\r\nI think that could work with a sufficient documentation warning that if you call `pause` you have to manually call `resume`. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yes that's essentially what I want. Thanks for the suggestion, I'll have something in the next few days.","author":{"__typename":"User","login":"ketenshi","id":"MDQ6VXNlcjY4MDY2OTc=","name":"Eugene Kwong"}},{"__typename":"IssueComment","body":"Eh, if that's all you need i'll just do it and throw in a test 😇","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Ok, thank you so much!","author":{"__typename":"User","login":"ketenshi","id":"MDQ6VXNlcjY4MDY2OTc=","name":"Eugene Kwong"}},{"__typename":"IssueComment","body":"> 好的,非常感谢你!\r\n\r\n你好 我想问下 如果 在 APP 进入后台时,手动断开长连接. APP 重新唤起时连接长连接呢","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null}},{"__typename":"IssueComment","body":"This has shipped with `0.31.0`. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Apollo Codegen generates different Operation IDs than Apollo Server","author":{"__typename":"User","login":"Nickersoft","id":"MDQ6VXNlcjIxMDQxMjk=","name":"Tyler Nickerson"},"body":"Hey all,\r\n\r\nTonight I noticed that the operation ID Apollo Codegen creates when generating Swift code for your schema is slightly different than what the Apollo Server expects, causing APQs to fail and throw a `provided sha does not match query` error. \r\n\r\nBasically the SHA that Apollo Codegen creates adds line breaks between each GraphQL operation before it calculates the SHA of the string (seen [here](https://github.com/apollographql/apollo-tooling/blob/8e78c50a21c17a071f7b6890de446b4582e8d04a/packages/apollo-codegen-core/src/compiler/visitors/generateOperationId.ts#L26)). However, when Apollo iOS sends queries to the server, it does so without any line breaks using Swift's `.appending()` method. Then when the server calculates the SHA, due to the lack of line breaks, the operation ID is different and the error is thrown. Strangely enough, however, I noticed the StarWars API actually [manually adds line breaks](https://github.com/apollographql/apollo-ios/blob/06c357b7e98fb7abcddc02ca8aeb96cc8475d263/Sources/StarWarsAPI/API.swift#L1051) in its generated code, which mine doesn't. \r\n\r\nI believe I'm using the latest version of Apollo Codegen and Apollo iOS. I'm happy to patch a fix – it's just a matter of what needs to be changed. I'm afraid touching `apollo-tooling` would affect more repos that might depend on it, so I thought it'd be safer to open an issue here and propose adding the line breaks to the generated Swift.\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Closing, as it looks like the `apollo-tooling` upstream does add a line break during Swift Codegen, but the CLI on my system may be out of date. Will reopen if cannot find a resolution.","author":{"__typename":"User","login":"Nickersoft","id":"MDQ6VXNlcjIxMDQxMjk=","name":"Tyler Nickerson"}},{"__typename":"IssueComment","body":"@Nickersoft I would strongly recommend using the version the SDK downloads - it's set up to make sure you don't have to fight with node and mess with \"which version of the CLI works with which version of the SDK?\". You can check out the most recent version of our [installation docs](https://www.apollographql.com/docs/ios/installation/) or our new [Swift scripting docs](https://www.apollographql.com/docs/ios/swift-scripting/) to see how to set this up. \r\n\r\nI'd also recommend using version `0.29.x` of the iOS SDK - this includes some fixes that ensure the hash that you get from your iOS operation matches what's generated by the CLI, even with Fragments.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd Hey, thanks for the comment despite me opening an issue a little prematurely haha – I didn't realize the Apollo version set in the Codegen `Package.swift` affects the version of the CLI it downloads, and sure enough, I was on 0.28.x when the newline fix was pushed on 0.30.x. Updating it to download the new CLI fixed the problem :) ","author":{"__typename":"User","login":"Nickersoft","id":"MDQ6VXNlcjIxMDQxMjk=","name":"Tyler Nickerson"}},{"__typename":"IssueComment","body":"Yeah you bet - thought it would be helpful for anyone who stumbles across this via google :P","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Cache: Transaction write object results in no change.","author":{"__typename":"User","login":"pggawlowski","id":"MDQ6VXNlcjY0OTY2OTU2","name":null},"body":"```\r\n do {\r\n var response = try transaction.readObject(ofType: Package.self, withKey: packageId)\r\n response.status = entry.status\r\n \r\n try transaction.write(object: response, withKey: packageId) \r\n let confirmChange = try transaction.readObject(ofType: Package.self, withKey: packageId)\r\n print(confirmChange)\r\n } catch {\r\n print(error)\r\n }\r\n\r\n```\r\n\r\nI digged down until ApolloStore -> `func mergePromise(records: RecordSet)`.\r\nResult is giving me succes `fulfill(cacheKey)` with cacheKey \"123.status\" which is correct packageId and correct field I was trying to manipulate. \r\n\r\nHowever confirmChange object has unchanged status. My `cacheKeyForObject` for both store and client are set. \r\nIs it sth I am doing wrong or writeObject is not working the way I think?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"The issue is that the transactions aren't guaranteed to be synchronous, so `transaction.write` may not have finished before `transaction.read` is called. \r\n\r\nYou'd need to use [`withinWriteTransaction`](https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/ApolloStore.swift#L149) in order to validate the change. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Actual problem was: invalid cacheKeys. Sorry for wasting Tour time.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"No worries - thanks for following up with what actually happened! I'm gonna go ahead and close this issue out. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"长连接手动断开和重连","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null},"body":"你好\r\n如何在 APP 进入后台时,手动断开长连接,从新打卡 APP 时再重新连接长连接?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Via Google Translate since I don't speak Chinese: \r\n\r\n> Hello there\r\n> How to manually disconnect the long connection when the APP enters the background, and then reconnect the long connection when the APP is newly clocked in?\r\n\r\nAre you asking about subscriptions or some other kind of long connection? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"你好.订阅消息. WebSocketTransport\r\n\"WeChat67a3558698ad0ab1125ec3110a335a58\"\r\n如果使用方法.我想在 APP 进入后台时,断开.在 APP重新打开的时候重新连接?\r\n初学者请多见谅!\r\n","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null}},{"__typename":"IssueComment","body":"> Hello. Subscribe to news. WebSocketTransport\r\n\r\n[Here's Apple's documentation on handling lifecycle changes](https://developer.apple.com/documentation/uikit/app_and_environment/managing_your_app_s_life_cycle) - The short answer is that you will probably want to call `closeConnection` on the `webSocketTransport` in your App Delegate's `applicationWillResignActive` method and restart the susbcription in `applicationDidBecomeActive`. \r\n\r\nNote that names are different in the Scene delegate if you're using that, but I don't think you are since you're using a singleton rather than per-scene instances of `Network`. \r\n\r\nLet me know if that helps!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"是的,这个地方使用的是单例.多个订阅消息在这里接受,然后进行分发处理.\r\n需要在 UIApplicationWillResignActiveNotification 时,断开订阅连接\r\n UIApplicationDidBecomeActiveNotification 重新连接订阅\r\n\r\n是通过 self.webSocketTransport.closeConnection() 断开订阅么","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null}},{"__typename":"IssueComment","body":"你好.我通过 调用 self.webSocketTransport.closeConnection() ,已经可以断开连接了. 在 UIApplicationDidBecomeActiveNotification 的时候怎么重新建立连接呢?\r\n![image](https://user-images.githubusercontent.com/10558372/89000672-86b02780-d32a-11ea-8df8-59fee24addf6.png)\r\n","author":{"__typename":"User","login":"tanchendong1992","id":"MDQ6VXNlcjEwNTU4Mzcy","name":null}},{"__typename":"IssueComment","body":"Google translated: \r\n\r\n> Hello. I can disconnect by calling self.webSocketTransport.closeConnection(). How to re-establish the connection when UIApplicationDidBecomeActiveNotification?\r\n\r\nAh, because `addSubscribe` won't work if the web socket isn't connected, and right now there's not a way to tell the websocket to reconnect non-automatically. \r\n\r\nThe good news is #1335 will add the ability to reconnect more easily. Until then you'll probably need to hack it by using either `updateHeaderValues` or `updateConnectingPayload` to force a reconnection. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"#1335 is merged to `main` if you want to use it immediately, it'll come out probably sometime later this week in an official release. I'm going to close this out. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"RFC: Networking Updates","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"},"body":"This is the technical outline of a proposal to make major changes to our primary networking interface from the current `HTTPNetworkTransport` to a `RequestChainNetworkTransport` which uses a chain of interceptor objects to set up and process the results of network requests.\r\n\r\nNote that this is going to be a **🎉 Spectacularly 🎉** breaking change - while very surface level APIs will remain basically the same, if you're doing anything remotely advanced, this will necessitate some changes, but the idea is to break it now so we don't have to break it way worse later.\r\n\r\nI would **REALLY** love feedback on this before I start working towards making this the default option. You can see the code changes in-place in [this PR](https://github.com/apollographql/apollo-ios/pull/1341). I will be updating this RFC with feedback as it is received. \r\n\r\n## Why The Change?\r\n\r\n`HTTPNetworkTransport` allows you to hook into various delegates to accomplish various things. There are several limitations to this approach: \r\n\r\n- Users can only do things that are specifically supported by delegates.\r\n- Asynchronous use of delegates without callbacks is basically impossible.\r\n- Any time we want to add a new feature, we need to add a new delegate method and handle it, creating additional complexity.\r\n- There is no flexibility in terms of order of operations, particularly around whether data should be returned to the UI before being written to the cache.\r\n\r\nThe other major issue driving this update is that the current networking stack is *deeply* tied to the current cache architecture. This isn't ideal for many reasons, the biggest of which is that the cache likely to change in relation to the [Swift Codegen Rewrite](https://github.com/apollographql/apollo-ios/issues/939). \r\n\r\n## What is proposed? \r\n\r\nThe proposed new architecture uses the Interceptor pattern to create a customizable request chain. This means users can hook into the system at any point during the request creation or data processing process. \r\n\r\nThis also means that the pieces which will need to be swapped out for the Swift Codegen Rewrite are more clearly defined, and less tied to the actual parsing operation. \r\n\r\nFinally, this also opens the opportunity for different patterns than we already support, such as writing to the cache *after* returning data to the UI instead of before, or creating an array of interceptors which hit the network first, then hit the cache if nothing was returned. \r\n\r\n### New Protocols\r\n\r\n- **`FlexibleDecoder`**: This is mostly going to be helpful for the `Codable` implementation down the line, but this will allow anything conforming to `Decoder` to be used to decode data.\r\n- **`Parseable`**: This is a wrapper that allows us to continue to support non-`Codable` parsing alongside `Codable` parsing, while keeping us able to constrain and construct things generically. A default implementation for `Codable` will be provided.\r\n- **`ApolloInterceptor`**: This is an interface which allows you to add an asynchronous handler to perform any necessary work, such as fetching credentials and reading or writing from the cache, asynchronously. \r\n \r\n ```swift\r\n public protocol ApolloInterceptor: class {\r\n \r\n /// Called when this interceptor should do its work.\r\n ///\r\n /// - Parameters:\r\n /// - chain: The chain the interceptor is a part of.\r\n /// - request: The request, as far as it has been constructed\r\n /// - response: [optional] The response, if received\r\n /// - completion: The completion block to fire when data needs to be returned to the UI.\r\n func interceptAsync(\r\n chain: RequestChain,\r\n request: HTTPRequest,\r\n response: HTTPResponse?,\r\n completion: @escaping (Result, Error>) -> Void)\r\n }\r\n ```\r\n \r\n Default implementations of `ApolloInterceptor` for both Legacy (ie, non Swift Codegen) networking and Swift Codegen networking will be provided.\r\n- **`InterceptorProvider`** This protocol will be used to quickly create a new array of interceptors for a given request:\r\n\r\n ```swift\r\n public protocol InterceptorProvider {\r\n \r\n /// Creates a new array of interceptors when called\r\n ///\r\n /// - Parameter operation: The operation to provide interceptors for\r\n func interceptors(for operation: Operation) -> [ApolloInterceptor]\r\n }\r\n ```\r\n This design allows for both flexibility (you can return different interceptors for different types of requests, for instance) and isolation (each request will have its own unique set of interceptors, reducing the possibility of different requests stomping on each other). \r\n \r\n Two default interceptor providers are set up: \r\n - **`LegacyInterceptorProvider`** will provide interceptors mimicking the current stack \r\n - **`CodableInterceptorProvider`** will provide interceptors for the forthcoming Swift Codegen Rewrite's network stack. \r\n- **`ApolloErrorInterceptor`** will allow you to have additional checks whenever an error is about to be returned. This will be optional to implement, and no default implementation is provided.\r\n\r\n ```swift\r\n /// Asynchronously handles the receipt of an error at any point in the chain.\r\n ///\r\n /// - Parameters:\r\n /// - error: The received error\r\n /// - chain: The chain the error was received on\r\n /// - request: The request, as far as it was constructed\r\n /// - response: [optional] The response, if received\r\n /// - completion: The completion closure to fire when the operation has completed. Note that if you call `retry` on the chain, you will not want to call the completion block in this method.\r\n func handleErrorAsync(\r\n error: Error,\r\n chain: RequestChain,\r\n request: HTTPRequest,\r\n response: HTTPResponse?,\r\n completion: @escaping (Result, Error>) -> Void)\r\n ```\r\n \r\n### New Classes\r\n\r\n- **`HTTPRequest`** This object will hold all the information related to a request before it hits the network, with the `toURLRequest()` method creating an actual `URLRequest` based on all the information in the request. This is subclass-able (and will mostly be using subclasses). \r\n\r\n ```swift\r\n open class HTTPRequest {\r\n\r\n open var graphQLEndpoint: URL\r\n open var operation: Operation\r\n open var contentType: String\r\n open var additionalHeaders: [String: String]\r\n open var clientName: String? = nil\r\n open var clientVersion: String? = nil\r\n open var retryCount: Int = 0\r\n public let cachePolicy: CachePolicy\r\n\r\n public init(graphQLEndpoint: URL,\r\n operation: Operation,\r\n contentType: String,\r\n additionalHeaders: [String: String],\r\n cachePolicy: CachePolicy = .default)\r\n \r\n open func toURLRequest() throws -> URLRequest\r\n\r\n open func addHeader(name: String, value: String)\r\n }\r\n ```\r\n \r\n - **`JSONRequest`** subclass of `HTTPRequest` will handle creating requests with JSON, which will be the vast majority of requests with operations. This is where handling of auto-persisted queries is also layered in: \r\n\r\n ```swift\r\n public class JSONRequest: HTTPRequest {\r\n \r\n public let requestCreator: RequestCreator\r\n \r\n public let autoPersistQueries: Bool\r\n public let useGETForQueries: Bool\r\n public let useGETForPersistedQueryRetry: Bool\r\n public var isPersistedQueryRetry = false\r\n \r\n public let serializationFormat = JSONSerializationFormat.self\r\n\r\n public init(operation: Operation,\r\n graphQLEndpoint: URL,\r\n additionalHeaders: [String: String] = [:],\r\n cachePolicy: CachePolicy = .default,\r\n autoPersistQueries: Bool = false,\r\n useGETForQueries: Bool = false,\r\n useGETForPersistedQueryRetry: Bool = false,\r\n requestCreator: RequestCreator = ApolloRequestCreator())\r\n }\r\n ```\r\n \r\n - **`UploadRequest`** subclass of `HTTPRequest` will handle multipart file uploads:\r\n\r\n ```swift\r\n public class UploadRequest: HTTPRequest {\r\n \r\n public let requestCreator: RequestCreator\r\n public let files: [GraphQLFile]\r\n public let manualBoundary: String? \r\n public let serializationFormat = JSONSerializationFormat.self\r\n \r\n public init(graphQLEndpoint: URL,\r\n operation: Operation,\r\n additionalHeaders: [String: String] = [:],\r\n files: [GraphQLFile],\r\n manualBoundary: String? = nil,\r\n requestCreator: RequestCreator = ApolloRequestCreator()) \r\n }\r\n ```\r\n\r\n- **`HTTPResponse`** will represent the objects returned and/or parsed from the server:\r\n\r\n ```swift\r\n /// Designated initializer\r\n ///\r\n /// - Parameters:\r\n /// - response: The `HTTPURLResponse` received from the server.\r\n /// - rawData: The raw, unparsed data received from the server.\r\n /// - parsedResponse: [optional] The response parsed into the `ParsedValue` type. Will be nil if not yet parsed, or if parsing failed.\r\n public class HTTPResponse {\r\n public var httpResponse: HTTPURLResponse\r\n public var rawData: Data\r\n public var parsedResponse: GraphQLResult?\r\n }\r\n ```\r\n\r\n- **‌`RequestChain`** will handle the interaction with the network for a single operation. \r\n\r\n ```swift\r\n public class RequestChain: Cancellable {\r\n\r\n /// Creates a chain with the given interceptor array\r\n public init(interceptors: [ApolloInterceptor])\r\n \r\n /// Kicks off the request from the beginning of the interceptor array.\r\n ///\r\n /// - Parameters:\r\n /// - request: The request to send.\r\n /// - completion: The completion closure to call when the request has completed.\r\n public func kickoff(\r\n request: HTTPRequest, \r\n completion: @escaping (Result) -> Void)\r\n \r\n /// Proceeds to the next interceptor in the array.\r\n /// \r\n /// - Parameters:\r\n /// - request: The in-progress request object\r\n /// - response: [optional] The in-progress response object, if received yet\r\n /// - completion: The completion closure to call when data has been processed and should be returned to the UI.\r\n public func proceedAsync(\r\n request: HTTPRequest, \r\n response: HTTPResponse?,\r\n completion: @escaping (Result) -> Void)\r\n \r\n /// Cancels the entire chain of interceptors.\r\n public func cancel()\r\n \r\n /// Restarts the request starting from the first inteceptor.\r\n ///\r\n /// - Parameters:\r\n /// - request: The request to retry\r\n /// - completion: The completion closure to call when the request has completed.\r\n public func retry(\r\n request: HTTPRequest,\r\n completion: @escaping (Result) -> Void)\r\n }\r\n ```\r\n- **`RequestChainNetworkTransport`** provides an implementation of `NetworkTransport` which uses an `InterceptorProvider` to create a request chain for each request. \r\n ```swift\r\n public class RequestChainNetworkTransport: NetworkTransport {\r\n \r\n public init(interceptorProvider: InterceptorProvider,\r\n endpointURL: URL,\r\n additionalHeaders: [String: String] = [:],\r\n autoPersistQueries: Bool = false,\r\n cachePolicy: CachePolicy = .default,\r\n requestCreator: RequestCreator = ApolloRequestCreator(),\r\n useGETForQueries: Bool = false,\r\n useGETForPersistedQueryRetry: Bool = false)\r\n }\r\n ```\r\n\r\n### Changes to existing Protocols and Classes\r\n\r\n- **`ApolloStore`** will no longer require a `GraphQLQuery` explicitly for fetching data from the store. It will instead return an error if the `GraphQLOperationType` is not `.query`. This change is necessary to avoid going down an enormous rabbit hole with generics since `GraphQLOperation` has an associated type. \r\n- The **`NetworkTransport`** protocol will get a new method to be implemented: \r\n\r\n ```swift\r\n func sendForResult(operation: Operation,\r\n completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable\r\n ```\r\n \r\n This will avoid the double-wrapping of `GraphQLResponse` around the `GraphQLResult` so that only the `GraphQLResult` is actually returned. The `send` method will eventually be deprecated and removed. \r\n- **`ApolloClient`** will get a new `sendForResult` method which calls into the `sendForResult` method added to `NetworkTransport`.\r\n\r\n## How will this work in practice? \r\n\r\nInstantiating a new legacy client manually will look like this: \r\n\r\n```swift\r\nlazy var legacyClient: ApolloClient = {\r\n let url = URL(string: \"http://localhost:8080/graphql\")!\r\n \r\n let store = ApolloStore(cache: InMemoryNormalizedCache())\r\n let provider = LegacyInterceptorProvider(store: store)\r\n let transport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: url)\r\n \r\n return ApolloClient(networkTransport: transport)\r\n}()\r\n```\r\n\r\nIdeally I'll be able to transparently swap out the existing `HTTPNetworkTransport` for this so that this would be the under-the-hood setup on `ApolloClient`, but this may involve a transition period. \r\n\r\nCalls to the client will look like this: \r\n\r\n```swift\r\nlegacyClient.fetchForResult(query: HeroNameQuery()) { result in\r\n switch result {\r\n case .success(let graphQLResult):\r\n print(graphQLResult.data?.hero?.name ?? \"Name not found\")\r\n case .failure(let error):\r\n print(\"Unexpected error: \\(error)\")\r\n }\r\n}\r\n```\r\n\r\nNote that this is VERY similar to how they look on the surface at the moment, which is intentional. \r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Overall this looks great. I only have 2 small questions: \r\n- Do you think it is possible to add an `ErrorType: Error` generic type to the signature of `handleErrorAsync` in the `ApolloErrorInterceptor`? I would love to be able to return typed errors, and this generic parameter could simply default to `Error` itself if not specified.\r\n- Do you have any plan to add an official `ApolloCombine` module?","author":{"__typename":"User","login":"TizianoCoroneo","id":"MDQ6VXNlcjE1MzQwMzgy","name":"TizianoCoroneo"}},{"__typename":"IssueComment","body":"1. I'll have to mess around with this and see how it works - my recollection is that it would cause much more complex typing issues, but I'll see what we can do. \r\n2. Eventually, but it's going to be after all the codegen rewrites. There is a [community Combine package](https://github.com/joel-perry/ApolloCombine) if you're looking for something immediately","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> Instantiating a **new legacy** client\r\n\r\nHeh, this was kinda funny to me.\r\n\r\n---\r\n\r\n> `public let requestCreator: RequestCreator`\r\n\r\nShould the request creator live on _all_ requests? Said another way, what's the rationale behind only allowing `JSONRequests` to have this property?\r\n\r\n> Do you think it is possible to add an `ErrorType: Error` generic type to the signature of` handleErrorAsync`\r\n\r\n+1 to this, but definitely not critical for the context of this RFC. I feel like typed errors could be it's own whole RFC/PR too!\r\n\r\n\r\n> **ApolloStore will no longer require a GraphQLQuery explicitly for fetching data from the store**. It will instead return an error if the GraphQLOperationType is not .query. This change is necessary to avoid going down an enormous rabbit hole with generics since GraphQLOperation has an associated type.\r\n\r\nI'm a little bit fuzzy on what this change is. If not a `GraphQLQuery`, what will the input for data fetching from the store be? Can you clarify for me?\r\n\r\n---\r\n\r\nAll told, this seems solid! One of our big use cases in the GitHub app for the current delegate implementation of this is to logout on HTTP 401 status codes, so it seems like that should make this a little simpler (just need an interceptor to throw an error when those responses come back).\r\n\r\nHoller if you want some feedback directly on https://github.com/apollographql/apollo-ios/pull/1341 as well!","author":{"__typename":"User","login":"eliperkins","id":"MDQ6VXNlcjEwNTE0NTM=","name":"Eli Perkins"}},{"__typename":"IssueComment","body":">> Instantiating a new legacy client\r\n\r\n> Heh, this was kinda funny to me.\r\n\r\nHa, that's what I get for working on this doc for so long, I completely glossed that over 🙃\r\n\r\n>> public let requestCreator: RequestCreator\r\n\r\n> Should the request creator live on all requests? Said another way, what's the rationale behind only allowing JSONRequests to have this property?\r\n\r\nMy thought that was only `HTTPRequest` subclasses that actually need to use it should have access to it - `JSONRequest` and a forthcoming `UploadRequest` would be the places I'm thinking. At this point both of those subclasses would need it, but I don't know that it makes sense to tie that to the base class at this time. Would be interesting to hear your thoughts on that.\r\n\r\n>> ApolloStore will no longer require a GraphQLQuery explicitly for fetching data from the store. It will instead return an error if the GraphQLOperationType is not .query. This change is necessary to avoid going down an enormous rabbit hole with generics since GraphQLOperation has an associated type.\r\n\r\n> I'm a little bit fuzzy on what this change is. If not a GraphQLQuery, what will the input for data fetching from the store be? Can you clarify for me?\r\n\r\nBasically, we have the `GraphQLOperation` protocol, with an associated type of `Data`, and its three sub-protocols, `GraphQLQuery`, `GraphQLMutation`, and `GraphQLSubscription`. Previously, we were limiting what operations could read from the cache to `GraphQLQuery`, since in theory that's the only place getting something from the cache would matter. \r\n\r\n`HTTPRequest` only requires a specification of `GraphQLOperation`, but when making a call into the cache, we can't use the `Blah is GraphQLQuery` method of figuring out whether a `GraphQLOperation` is a query because of the `associatedType` on `GraphQLOperation`. \r\n\r\nI tried about 15 different workarounds for this and this is the only one that wasn't monstrously over-complicated - everything else involved some mild-to-completely bizarre type erasure strategies. I'm not totally against those, but I think in this case the benefits of going that way were vastly outweighed just changing the gating of this a bit.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"and if you have specific feedback on #1341 I'd love to hear it - just be aware that there's definitely a lot that's WIP (thus the TODOs)","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"OK, I've done some poking around on the request for a typed error parameter, and I don't think it's going to be doable at the interceptor level.\r\n\r\nWhen I tried to add this in, any existing `Error` I tried to return would cause a \"Cannot convert value\" build failure: \r\n\"Screen\r\n\"Screen\r\n\r\nIt'd make the interceptors a lot harder to keep independent if they all had to have exactly the same type of error. It also wouldn't be possible for me to have default implementations return errors without having `TypedError` conform to some other protocol that allows me to return an underlying arbitrary error. Ultimately, I think that adds too much complexity for general use cases.\r\n\r\nI think if you want to write your own typed wrapper that takes whatever's returned and feeds it into something with an `underlying` error that's easier to switch on, that could work. But I think requiring everything have to be the same type at a protocol level is going to lead to a hell of a lot more confusion than it solves. \r\n\r\nWould love to hear feedback on this finding.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"One of the things that's nice about the `ApolloLink` abstraction used for the web version of Apollo Client is that the link chain is more like a linked list, rather than an array, with each link deciding how to forward the request on to the rest of the chain (and how to process the response), without needing an overarching `RequestChain` to manage the list of links.\r\n\r\nConcretely, this kind of approach would probably mean the `InterceptorProvider` would return a single `ApolloInterceptor` (analogous to `ApolloLink`), representing the head of the linked list, rather than a `[ApolloInterceptor]` array. The last interceptor in the chain (the tail of the list) would be responsible for performing the actual HTTP request, in most cases—but not always!\r\n\r\nSometimes you want to terminate the chain with something that makes an HTTP request, but other times the terminal link might provide its own data (for example, mock data during tests). Sometimes you might want to split a request between multiple downstream links, or choose among several servers that can handle different kinds of requests (or load-balance the same type of request between multiple servers, entirely on the client). It's hard to represent branching structures like that as an array, because it's no longer really a list, but a dynamic tree. But if each interceptor gets to make its own decisions about how it passes requests to the rest of the chain (and how it handles the responses), the branching can be hidden as an implementation detail, with each interceptor abstracting over everything downstream from it.\r\n\r\nI don't know enough Swift to anticipate specific ways in which this approach might be tricky, but it seems like it should be possible to give the interceptor chain more of a recursive, potentially tree-like structure. That's worked pretty well on the web, in the sense that I haven't had to worry very much about the `ApolloLink` system, even as I've changed large portions of the rest of the library.\r\n\r\nFor reference, here's an overview of `ApolloLink` concepts that I've found useful in the past: https://www.apollographql.com/docs/link/overview/","author":{"__typename":"User","login":"benjamn","id":"MDQ6VXNlcjU3NTA=","name":"Ben Newman"}},{"__typename":"IssueComment","body":"I think one huge, huge difference is that things like cancellation, retry, and thread management can be handled through javascript's `Observable` reactive system. \r\n\r\nThat just isn't doable without either using Combine (which would require dropping everything below iOS 12, and is unfortunately a non-starter with a number of our larger users) or adding some kind of Reactive library as a dependency (which I am loathe to do because of the *massive* number of dependency conflicts it could introduce). \r\n\r\nHowever, I think you're right that splitting out methods for request setup vs response handling is a good idea - this could at least help reduce the number of things that need to be optional on `HTTPResponse`. \r\n\r\nWill futz with this tomorrow. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd I'm glad you brought that up!\r\n\r\nWhile I agree that `Observable`s are an easier pill to swallow in JavaScript, and they do figure prominently in the `ApolloLink` API, I specifically do not think it's necessary to replicate their behavior here.\r\n\r\nI should also mention that `Observable` is not implemented natively in JS, so you still need some sort of library, and (if I'm being honest) the API doesn't fully deliver on any of those benefits you mentioned, so I think it's fair to say the acceptance of `Observable` in JS (compared to the resistance to Combine in iOS) is a matter of culture/taste/evangelism.\r\n\r\nOn the topic of cancellation, one approach that does work is to pass some sort of context object explicitly down through the chain (and back up), so that each link/interceptor can check whether the request has been cancelled at points where aborting would be safe. `Observable`s don't provide any useful notion of context, even if you wanted it, but you can design a pipeline/interceptor/chain system like this to provide a strongly typed context object everywhere it's needed, I believe.\r\n\r\nOn the topic of retrying, the [`RetryLink`](https://github.com/apollographql/apollo-client/blob/master/src/link/retry/retryLink.ts) subclass of `ApolloLink` has been successful in part because the retry logic can be hidden behind the same abstraction that any other `ApolloLink` provides. From the perspective of links earlier in the chain, a request that succeeded after several retries looks exactly like one that succeeded on the first try, except that it might have taken a bit longer. If retrying was something you could implement in a perfectly generic way for all interceptors, it might make sense to hoist it to a higher layer of the system (maybe into `RequestChain`), but in practice retrying tends to be sensitive to application concerns (different logic for different queries, even), so I think it makes sense to push it down into a part of the system that can be customized by application developers.\r\n\r\nI think we can agree it's important for interceptors to be able to perform any kind of async work as an implementation detail, which requires a uniformly asynchronous API. Both `Observable` and Combine provide that kind of API, but they are both probably overkill, or at the very least they would need to earn their way into a system like this. I believe you that Combine is not worth it for iOS, but then again I'm not sure `Observable` is totally defensible for JS applications, either.","author":{"__typename":"User","login":"benjamn","id":"MDQ6VXNlcjU3NTA=","name":"Ben Newman"}},{"__typename":"IssueComment","body":"> When I tried to add this in, any existing `Error` I tried to return would cause a \"Cannot convert value\" build failure:\r\n\r\nfrom this error it looks like you changed the signature of `handleErrorAsync` to:\r\n```swift\r\nfunc handleErrorAsync(\r\n error: TypedError,\r\n chain: RequestChain,\r\n request: HTTPRequest,\r\n response: HTTPResponse,\r\n completion: @escaping (Result) -> Void)\r\n```\r\n\r\nwhile I was thinking something like: \r\n```swift\r\nfunc handleErrorAsync(\r\n error: Error, // keep this one untyped so that you can pass anything you need\r\n chain: RequestChain,\r\n request: HTTPRequest,\r\n response: HTTPResponse,\r\n completion: @escaping (Result) -> Void) // but allow users to wrap the internal errors in their own custom types\r\n```\r\nso that you can give a default implementation that does not wrap the error type: \r\n```swift \r\nextension ApolloErrorInterceptor where TypedError == Error {\r\n// default interceptor with a untyped completionHandler\r\n```\r\n\r\nsorry I wasn't clear with the previous message. Thank you for fiddling with this!\r\n\r\n> +1 to this, but definitely not critical for the context of this RFC. I feel like typed errors could be it's own whole RFC/PR too!\r\n\r\n@designatednerd would you prefer to move this conversation in a separate issue?","author":{"__typename":"User","login":"TizianoCoroneo","id":"MDQ6VXNlcjE1MzQwMzgy","name":"TizianoCoroneo"}},{"__typename":"IssueComment","body":"@TizianoCoroneo Yeah if I left it with `Error` as the incoming error, I got that same `Cannot convert value` problem in the method in question - I'll take a look at your suggestion later today though","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@benjamn I think one thing that's helpful context to understand is that the basis for this architecture is the [`ApolloInterceptor` type in Android](https://github.com/apollographql/apollo-android/tree/master/apollo-runtime/src/main/java/com/apollographql/apollo/interceptor). This itself is based on [`OkHttp` library's `Interceptor` type](https://square.github.io/okhttp/interceptors/) that's used very widely throughout the Android ecosystem for networking.\r\n\r\nIn `OkHttp`, there's a chain that takes an array of interceptors. Each interceptor in the array needs to call `proceed` before it can keep going, and then each one calls `intercept` to handle the result. There's a few issues with that architecture as-is (mostly around things being implicitly asynchronous instead of explicitly asynchronous), which are generally dealt with by `ApolloInterceptor`'s changes to the architecture.\r\n\r\nStill futzing around, but I thought that'd be useful context.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@TizianoCoroneo I've pushed some stuff to a branch ominously named `nope/typed-errors` if you want to take a look - basically, what you're looking for is not possible without associated types which sends this wholllllllllle mess down a huge rabbit hole. This is a huge piece of why the generic constraint is on the function rather than set up as an `associatedType` in the first place. If you see a better way please definitely feel free to open a PR to that branch!\r\n\r\nAll: I did make some improvements that make it easier to reason about what data's coming back through (basically: Got rid of the need for `Parseable` and moved to `GraphQLResult` as the type being returned in the completion closure), I'll update the RFC tomorrow or Monday to match the updated implementation details. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I tried to play around with it, and I confirm that the ominous name of the branch is accurate. I found no way to avoid having the `TypedError` bubble up to the `RequestChain`, and from there going everywhere else.\r\nThanks for trying this anyway 😄 ","author":{"__typename":"User","login":"TizianoCoroneo","id":"MDQ6VXNlcjE1MzQwMzgy","name":"TizianoCoroneo"}},{"__typename":"IssueComment","body":"Still looking at some of the stuff @benjamn and I were talking about, but I've updated the issue to match what's in the code at the moment.\r\n\r\nTL;DR - I was able to simplify by constraining to `Operation.Data` on `GraphQLOperation` instead of to the more generic `Parseable`. In the end, the result of a GraphQL operation is actually what we handle, so making it even more generic didn't really anything (and in fact made it harder to real with errors that are within `GraphQLResult`, which is part of what a lot of folks want to be able to do. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"More updates:\r\n- Moved `HTTPResponse` to being optional on the interceptor and related methods rather than having its properties be optional. This makes it way clearer whether a response has been received from the network or not. \r\n- Moved error declaration within each individual interceptor for clarity\r\n\r\n@benjamn: While I think the linked-list idea is more flexible, I don't know the additional flexibility it provides gets you much more than what we have in \"This interceptor can be async and take as long as it pleases to do stuff, so you can fire off a bunch of additional network requests and wait for them to call `proceed` if you feel like it.\" \r\n\r\nI think the overwhelming majority of interceptors are not going to do that, and I think the simplicity, especially from a retry standpoint, of \"Here's a list of interceptors in the order they should be executed, GO!\" is a lot better fit for the way this is used on iOS than a linked list would be. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"More updates are up - I don't think any fundamentally change anything already in here, but I do have a couple questions: \r\n\r\n1. Is there anyone using the `context: UnsafeMutableRawPointer?` on the various send/fetch methods for `ApolloClient` _in a way that could not be replaced by this change_? I took it out for now but I figured It's worth asking.\r\n2. I'm extremely tempted to rip out the current `HTTPNetworkTransport` that `RequestChainNetworkTransport` is replacing altogether, largely because I would need to keep a whole bunch of knotted code in `ApolloClient` around that facilitates caching longer than I'd like to. However, I'd like to hear y'all's thoughts about ripping the band-aid in a single release (with a migration guide) vs. doing a bridge release that still has `HTTPNetworkTransport` and its associated ick with a bunch of deprecation warnings. \r\n\r\n For what it's worth I've updated all the tests that aren't specifically _for_ the `HTTPNetworkTransport` to use either a `RequestChainNetworkTransport`, or a `MockNetworkTransport` which inherits from it, and everything is back to passing. I don't think that fully captures the extent to which this would create work for developers using the more advanced delegate features, but I do think for people using less advanced features it shows that everything *should* work the same. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> 1. Is there anyone using the `context: UnsafeMutableRawPointer?` on the various send/fetch methods for ApolloClient in a way that could not be replaced by this change? I took it out for now but I figured It's worth asking.\r\n\r\nNot using it here 🤷‍♂️ feels like a pretty cumbersome API to use effectively right now, so removing it seems alright, as long as we don't think others are using it.\r\n\r\n> I'm extremely tempted to rip out the current ` that RequestChainNetworkTransport is replacing altogether, largely because I would need to keep a whole bunch of knotted code in ApolloClient around that facilitates caching longer than I'd like to. However, I'd like to hear y'all's thoughts about ripping the band-aid in a single release (with a migration guide) vs. doing a bridge release that still has HTTPNetworkTransport and its associated ick with a bunch of deprecation warnings.\r\n\r\nI think it's alright to remove this in favor of `RequestChainNetworkTransport`. Is there a way to deprecate it, and replace it's impl with `RequestChainNetworkTransport`? If it feels like more overhead to maintain, API-wise, I think it's fine to force consumers over to use `RequestChainNetworkTransport` instead, since it solves the same problems that supplying a custom `HTTPNetworkTransport` was doing.","author":{"__typename":"User","login":"eliperkins","id":"MDQ6VXNlcjEwNTE0NTM=","name":"Eli Perkins"}},{"__typename":"IssueComment","body":"> feels like a pretty cumbersome API to use effectively right now,\r\n\r\nWholeheartedly agreed, I want to come up with something way better (and that does not involve the word `Unsafe`)\r\n\r\n> replace it's impl with`RequestChainNetworkTransport`\r\n\r\nI don't think it's a great idea because there's a bunch of stuff with delegates that would be a bit of a hot mess to handle. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'm going to close out this RFC as I'm getting ready to beta off of #1341 - I just updated the [client initialization documentation](https://deploy-preview-1341--apollo-ios-docs.netlify.app/docs/ios/initialization/), which hopefully will give a good idea of how this should all be working.\r\n\r\nIn terms of differences from what's outlined in the RFC, at this time the main difference is that I moved retry counting off the `HTTPRequest` itself and onto the `MaxRetryInterceptor`. \r\n\r\nFurther comments should be left on #1341 - thank you all for the feedback!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"getting \"The network connection was lost\" sometimes, while Calling API's","author":{"__typename":"User","login":"guru-mtech","id":"MDQ6VXNlcjY0NjU4ODQw","name":null},"body":"I cannot get the grapgql responces sometimes and getting following messages in console. Though My Internet connection completely normal and and speed is about 10MBps, I am getting follwing error sometimes!!\r\n\r\n\r\n2020-08-02 01:07:00.435742+0530 Dwell[16526:884485] Task <080DA3DA-F4E7-4F5C-9DE3-D2B77A55F81B>.<8> HTTP load failed, 159275/0 bytes (error code: -1005 [4:-4])\r\n2020-08-02 01:07:00.461811+0530 Dwell[16526:884303] Task <080DA3DA-F4E7-4F5C-9DE3-D2B77A55F81B>.<8> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 \"The network connection was lost.\" UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x6000014c4300 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 \"(null)\" UserInfo={NSErrorPeerAddressKey={length = 16, capacity = 16, bytes = 0x10021f9b12da60e20000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <080DA3DA-F4E7-4F5C-9DE3-D2B77A55F81B>.<8>, _NSURLErrorRelatedURLSessionTaskErrorKey=(\r\n \"LocalDataTask <080DA3DA-F4E7-4F5C-9DE3-D2B77A55F81B>.<8>\"\r\n), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://localhost:8091/graphql, NSErrorFailingURLKey=https://localhost:8091/graphql, _kCFStreamErrorDomainKey=4}\r\nThe operation couldn’t be completed. (Apollo.URLSessionClient.URLSessionClientError error 2.)\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! That error is coming from Apple's URL loading system, not from Apollo. I've got no idea why that would be happening with `localhost` - that shouldn't even be going out of your local network. \r\n\r\nI don't _think_ it's `http` vs `https` since that would theoretically be a different error, but it might be worth giving it a shot since most of the time `localhost` doesn't have SSL set up. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Since I haven't heard anything back here in a couple weeks, I'm going to close this issue out. @guru-mtech if you're still having problems, feel free to reopen. Anyone else having similar problems, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Error \"Variable \"$id\" is never used\" not fail build process","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"},"body":"when generate API.swift with graphql file that has unuse variables.\r\nan error `Variable \"xxx\" is never used in operation \"xxx\"` is log but build process is success and run an app normally\r\n```\r\nquery Repo($id: ID!) {\r\n currentuser {\r\n id\r\n }\r\n}\r\n\r\n```\r\n\r\n\r\nbut on other error, the build process will fail \r\n\r\nEx. generate API.swift with below graphql result an error \r\n\r\n`error: Cannot query field \"something\" on type \"Query\". Did you mean \"setting\"?` \r\n\r\nand build process is fail\r\n```\r\nquery Repo {\r\n currentuser {\r\n id\r\n }\r\n something\r\n}\r\n```\r\n\r\nPS: Apollo version 0.27.1","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I would first recommend updating to a more recent version of the SDK - IIRC this was a bug in the underlying CLI that has since been addressed. If that doesn't help, let me know. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"update to Apollo 0.30.0 doesn't help. ","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"```\r\nVariable \"$id\" is never used in operation \"Repo\".\r\n\r\nCommand PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure\r\n```\r\n\r\n\r\nError from log when build with\r\n\r\n```\r\nquery Repo($id: ID!) {\r\n currentuser {\r\n id\r\n }\r\n}\r\n```","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"OK - are you using the shell script or the Swift Scripting method to run your codegen? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'm not sure about that.\r\n\r\nI add a run script phase on Build Phase that has script below with shell = sh \r\n```\r\nPATH=$PATH:/usr/local/opt/node@8/bin\r\nSCRIPT_PATH=\"${PODS_ROOT}/Apollo/scripts\"\r\n\r\nif [ -z \"${XCS_BOT_NAME}\" ]; then\r\n\r\ncd \"${SRCROOT}/${TARGET_NAME}\"\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./GraphQL/**/*.graphql --localSchemaFile=\"GraphQL/Generated/schema.json\" GraphQL/Generated/API.swift --customScalarsPrefix=GraphQL\r\nfi\r\n\r\n```","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"Yep that's the shell script method. Can you confirm that in your schema `currentuser` requires a non-optional `id`, meaning an `ID!`? If it only requires an `ID` (without the exclamation point) then that might be the source of the issue. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"`currentuser ` does not require any variables.`$id: ID!` is just unuse variable that i forgot to remove. it can change to any variable Ex. `Repo($abcd: String!)` or ` Repo($test: Int!)`\r\n\r\nif RepoQuery never called or called with given variable Ex. `RepoQuery(abcd: \"a\")` it'll build success with error that mention before but will throw an `Variable $abcd is never used in operation \"Repo\"` from the server","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"> `currentuser` does not require any variable\r\n\r\nI'm almost positive this is why it's not exiting, then. When the error is more of a \"Hey, you forgot to remove this, but there are no real consequences to not using this\" rather than a \"Nope, this is not a valid query\", we don't want to fail the entire build. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I understand that it's not a fatal error for an entire app. but if the query is sent to graphql server it'll always fail due to graphql default validation rule(if I understand it correctly). \r\nSo, I think it's not different from invalid query because the query always fails if sends to server","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"Hm...what server are you using? I think that might be a server implementation detail, but I could be wrong. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"`apollo-server-express` from https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-express\r\n","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"`GraphQL operation is only valid if all variables defined by an operation are used `\r\nfrom graphql-js [line](https://github.com/graphql/graphql-js/blob/80471134f1152c69da2cc27518a127991cc801b9/src/validation/rules/NoUnusedVariablesRule.d.ts#L7\r\n)\r\n\r\nI'm not sure that the server can choose to enable/disable this rule but I think it enable by default.","author":{"__typename":"User","login":"Mangese","id":"MDQ6VXNlcjIxNTEyNTI4","name":"Mangese"}},{"__typename":"IssueComment","body":"Ahhh got it. OK, will talk to some tooling folks on this.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"(FYI that team is super backed up, so it may take some time)","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"So our tooling folks are working on a new Rust-based parsing and validation of schema + queries, it will have to land with that. \r\n\r\nI believe the reason it's not in there right now is because it would cause errors when people were using it in watch mode (mostly useful for JS) and it got disabled for that. However, I'm going to be working to make sure there's at least a mode that can be selected in new Rust stuff to bomb out on errors like this. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Crashlytics reported: \"Crashed: com.apollographql.DataLoader\"","author":{"__typename":"User","login":"Kharauzov","id":"MDQ6VXNlcjE4MjQzNTI1","name":"Serhii Kharauzov"},"body":"Hi 👋, We have a version of iOS Apollo SDK: 0.27.0\r\n\r\nWe've got many crashes:\r\n\r\nURLSessionClient.swift line 85\r\nURLSessionClient.sendRequest(_:rawTaskCompletionHandler:completion:)\r\n\r\nCrashed: com.apollographql.DataLoader\r\nEXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000\r\n\r\nWill be thankful for any suggestion or help 🙏🏼\r\n\r\nIt happened for different iOS versions and different devices.\r\nHere is a stack trace:\r\n```\r\nApollo\r\nURLSessionClient.swift - Line 85\r\nURLSessionClient.sendRequest(_:rawTaskCompletionHandler:completion:) + 85\r\n2\r\nApollo\r\nHTTPNetworkTransport.swift - Line 159\r\nHTTPNetworkTransport.send(operation:isPersistedQueryRetry:files:completionHandler:) + 159\r\n3\r\nApollo\r\nApolloClient.swift - Line 70\r\nApolloClient.send(operation:shouldPublishResultToStore:context:resultHandler:) + 70\r\n4\r\nApollo\r\nApolloClient.swift - Line 287\r\nFetchQueryOperation.fetchFromNetwork() + 287\r\n5\r\nApollo\r\nApolloClient.swift - Line 282\r\nclosure #1 in FetchQueryOperation.start() + 282\r\n6\r\nApollo\r\nApolloStore.swift - Line 193\r\nclosure #2 in ApolloStore.load(query:resultHandler:) + 193\r\n7\r\nApollo\r\nPromise.swift - Line 142\r\nclosure #1 in closure #1 in Promise.catch(_:) + 142\r\n8\r\nApollo\r\n - Line 4351240464\r\npartial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351240464\r\n9\r\nApollo\r\n - Line 4351234200\r\nclosure #1 in Promise.resolve(_:) + 4351234200\r\n10\r\nApollo\r\n - Line 4351232104\r\nPromise.resolve(_:) + 4351232104\r\n11\r\nApollo\r\nPromise.swift - Line 213\r\nPromise.reject(_:) + 213\r\n12\r\nApollo\r\nPromise.swift - Line 122\r\nclosure #1 in closure #1 in Promise.andThen(_:) + 122\r\n13\r\nApollo\r\n - Line 4351240464\r\npartial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351240464\r\n14\r\nApollo\r\n - Line 4351234200\r\nclosure #1 in Promise.resolve(_:) + 4351234200\r\n15\r\nApollo\r\n - Line 4351232104\r\nPromise.resolve(_:) + 4351232104\r\n16\r\nApollo\r\nPromise.swift - Line 213\r\nPromise.reject(_:) + 213\r\n17\r\nApollo\r\nPromise.swift - Line 165\r\nclosure #1 in closure #1 in Promise.map(_:) + 165\r\n18\r\nApollo\r\npartial apply for closure #1 in closure #1 in Promise.map(_:) + 4351241932\r\n19\r\nApollo\r\n - Line 4351240464\r\npartial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351240464\r\n20\r\nApollo\r\n - Line 4351234200\r\nclosure #1 in Promise.resolve(_:) + 4351234200\r\n21\r\nApollo\r\n - Line 4351232104\r\nPromise.resolve(_:) + 4351232104\r\n22\r\nApollo\r\nPromise.swift - Line 213\r\nPromise.reject(_:) + 213\r\n23\r\nApollo\r\nPromise.swift - Line 142\r\nclosure #1 in closure #1 in Promise.catch(_:) + 142\r\n24\r\nApollo\r\n - Line 4351240464\r\npartial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351240464\r\n25\r\nApollo\r\n - Line 4351234200\r\nclosure #1 in Promise.resolve(_:) + 4351234200\r\n26\r\nApollo\r\n - Line 4351232104\r\nPromise.resolve(_:) + 4351232104\r\n27\r\nApollo\r\nPromise.swift - Line 213\r\nPromise.reject(_:) + 213\r\n28\r\nApollo\r\nPromise.swift - Line 122\r\nclosure #1 in closure #1 in Promise.andThen(_:) + 122\r\n29\r\nApollo\r\n - Line 4351240464\r\npartial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351240464\r\n30\r\nApollo\r\n - Line 4351234200\r\nclosure #1 in Promise.resolve(_:) + 4351234200\r\n31\r\nApollo\r\n - Line 4351232104\r\nPromise.resolve(_:) + 4351232104\r\n32\r\nApollo\r\nPromise.swift - Line 213\r\nPromise.reject(_:) + 213\r\n33\r\nApollo\r\nPromise.swift - Line 142\r\nclosure #1 in closure #1 in Promise.catch(_:) + 142\r\n34\r\nApollo\r\nPromise.swift - Line 238\r\nclosure #1 in Promise.whenResolved(_:) + 238\r\n35\r\nApollo\r\nPromise.swift - Line 4351205536\r\nPromise.whenResolved(_:) + 4351205536\r\n36\r\nApollo\r\nPromise.swift - Line 136\r\npartial apply for closure #1 in Promise.catch(_:) + 136\r\n37\r\nApollo\r\nPromise.swift - Line 68\r\nPromise.init(_:) + 68\r\n38\r\nApollo\r\nPromise.swift - Line 135\r\nclosure #1 in closure #1 in Promise.flatMap(_:) + 135\r\n39\r\nApollo\r\npartial apply for closure #1 in closure #1 in Promise.map(_:) + 4351241932\r\n40\r\nApollo\r\n - Line 4351240464\r\npartial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351240464\r\n41\r\nApollo\r\nspecialized closure #1 in Promise.resolve(_:) + 4351233008\r\n42\r\nApollo\r\nspecialized Promise.fulfill(_:) + 4350994784\r\n43\r\nApollo\r\n - Line 4350998216\r\npartial apply for specialized Promise.fulfill(_:) + 4350998216\r\n44\r\nApollo\r\nPromise.swift - Line 163\r\nspecialized closure #1 in closure #1 in Promise.map(_:) + 163\r\n45\r\nApollo\r\npartial apply for specialized closure #1 in closure #1 in Promise.map(_:) + 4351244372\r\n46\r\nApollo\r\n - Line 4351244132\r\npartial apply for specialized thunk for @escaping @callee_guaranteed (@in_guaranteed Result) -> () + 4351244132\r\n47\r\nApollo\r\n - Line 4351232400\r\nspecialized closure #1 in Promise.resolve(_:) + 4351232400\r\n48\r\nApollo\r\nPromise.swift - Line 4350994980\r\nspecialized Promise.fulfill(_:) + 4350994980\r\n49\r\nApollo\r\n - Line 4351012708\r\npartial apply for specialized thunk for @escaping @callee_guaranteed (@in_guaranteed B) -> () + 4351012708\r\n50\r\nApollo\r\nDataLoader.swift - Line 53\r\nspecialized closure #3 in closure #1 in DataLoader.dispatch() + 53\r\n51\r\nApollo\r\n - Line 4351012380\r\npartial apply for specialized thunk for @escaping @callee_guaranteed (@guaranteed [B]) -> (@error @owned Error) + 4351012380\r\n52\r\nApollo\r\nPromise.swift - Line 122\r\nspecialized closure #1 in Promise.andThen(_:) + 122\r\n53\r\nApollo\r\nDataLoader.swift - Line 4351009748\r\nspecialized closure #1 in DataLoader.dispatch() + 4351009748\r\n54\r\nApollo\r\n - Line 4350967396\r\nthunk for @escaping @callee_guaranteed () -> () + 4350967396\r\n```\r\n\r\n\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hello, this was addressed in [0.27.1](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md#v0271), I recommend updating your client. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd , hello👋 Roger that. We've already updated to the latest version 0.30.0. \r\nWe'll see soon if it solves the issue.\r\nThanks.","author":{"__typename":"User","login":"Kharauzov","id":"MDQ6VXNlcjE4MjQzNTI1","name":"Serhii Kharauzov"}},{"__typename":"IssueComment","body":"OK great - I'm going to close this since it was a known issue with 0.27.0. If you're still seeing problems with this on 0.30.0, please open a new issue and we'll figure it out. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Getting \"The request timed out.\" sometimes while calling query and mutation.","author":{"__typename":"User","login":"DiwakarThapa","id":"MDQ6VXNlcjI5OTE3Nzk5","name":"diwakar thapa"},"body":"Hello!!! \r\nSometimes when I open the app I cannot get the **response of the first query** it requests rather I get the following **timeout error message** on Xcode debug console. I tried every possible solution found on StackOverflow but could find any effective solution and also could not figure out why **\"The request timed out.\"** has occurred in the first place. Our Android team is also experiencing similar issues. On the **server-side**, the timeout interval is **65 seconds**. so, I set request timeout interval **65 seconds** but it didn't work. \r\n\r\n**Console Error**\r\n```\r\nError Domain=NSURLErrorDomain Code=-1001 \"The request timed out.\" UserInfo={_kCFStreamErrorCodeKey=-2103, NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <1874F8BE-FA0F-45E1-8A51-96F290D85883>.<2>, NSURLErrorRelatedURLSessionTaskErrorKey=(\r\n \"LocalDataTask <1874F8BE-FA0F-45E1-8A51-96F290D85883>.<2>\"\r\n), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://example.graphql, NSErrorFailingURLKey=https://example.graphql, _kCFStreamErrorDomainKey=4}\r\n```\r\n**Is this apollo-ios terminating the request itself or server-side error?** ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"This is an error from Apple's URL loading system, the timeout is happening there. Are you saying that the timeout is happening before the 65 seconds that you set it to? Or just that it's still happening? The fact that your Android app is also having a similar problem points pretty squarely at your server.\r\n\r\nAlso am I correct in assuming that the url string here `https://example.graphql` is a placeholder for your real URL? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd `https://example.graphql` is a placeholder for our real URL? timeout is happening at 65 seconds.","author":{"__typename":"User","login":"DiwakarThapa","id":"MDQ6VXNlcjI5OTE3Nzk5","name":"diwakar thapa"}},{"__typename":"IssueComment","body":"Yeah that sounds like the request timeout is working as expected and the issue is that the request is, in fact, timing out, and that the issue is most likely going to be on your server side. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"thank you @designatednerd ","author":{"__typename":"User","login":"DiwakarThapa","id":"MDQ6VXNlcjI5OTE3Nzk5","name":"diwakar thapa"}},{"__typename":"IssueComment","body":"@designatednerd I forget to mention one thing, on **graphql playground** if we request the same query or mutation multiple times the response arrives without \"The request timed out. \" error but on the app side sometimes \"The request timed out. \" error appears. why is that?","author":{"__typename":"User","login":"DiwakarThapa","id":"MDQ6VXNlcjI5OTE3Nzk5","name":"diwakar thapa"}},{"__typename":"IssueComment","body":"GraphQL playground generally runs on your the same server as your endpoint, so in theory it's just making local calls. It's also possible that there's some kind of credential that is available through the web that's not going through to mobile. I wish I could narrow it down for you but unfortunately there are about a zillion things that could go wrong here. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@DiwakarThapa did you find a solution for your Problem? In our application, we have the same behaviour. Sometimes we run into a timeout, but the GraphQL Playground is always working.","author":{"__typename":"User","login":"DaTebe","id":"MDQ6VXNlcjEyOTY3MzA1","name":"DaTebe"}}]}},{"__typename":"Issue","title":"extensions property on GraphQLResult","author":{"__typename":"User","login":"paulkite","id":"MDQ6VXNlcjQwOTMwMDc=","name":"Paul Kite"},"body":"Hello! Curious if there are any plans to implement the `extensions` hash map support on `GraphQLResult`. I see the Android implementation has this and would love to be able to have the same ability to use this as well.\r\n\r\nThanks!","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"This [is implemented on `GraphQLError`](https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/GraphQLError.swift#L33) on our end. Are you using it in a non-error capacity? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yes. Our team sends non-error information through `extensions`.","author":{"__typename":"User","login":"paulkite","id":"MDQ6VXNlcjQwOTMwMDc=","name":"Paul Kite"}},{"__typename":"IssueComment","body":"OK - looking at [the spec](https://spec.graphql.org/June2018/#sec-Response-Format) it does appear `extensions` is allowed at the root of the response. \r\n\r\nI'm somewhat swamped at the moment - if you want to make a PR you're more than welcome to (just make sure to add tests!) but I'll try to get to it as I can if not. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thank you so much for the response!","author":{"__typename":"User","login":"paulkite","id":"MDQ6VXNlcjQwOTMwMDc=","name":"Paul Kite"}},{"__typename":"IssueComment","body":"@designatednerd Just curious, what's the usual turnaround on PRs from the community to getting into a release?","author":{"__typename":"User","login":"paulkite","id":"MDQ6VXNlcjQwOTMwMDc=","name":"Paul Kite"}},{"__typename":"IssueComment","body":"Usually fairly quick if they're small. It'd almost certainly be faster than waiting for me to have bandwidth 😛 ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"This shipped as part of 0.32.0!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"GraphQLQueryWatcher - fetch and watch flow.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null},"body":"Let's discuss watchers, cache and their flow.\r\n\r\nCold start of application - no cache at all. \r\n**Here are my debug logs:**\r\n```\r\nisReachable true //Reachability change\r\nUser: nil //No user logged in \r\napollo.watch(query: SyncManagerQuery(), cachePolicy: .returnCacheDataDontFetch) \r\nWatch SyncManagerQuery // We are interested ONLY in cached data.\r\nWatch SyncManagerQuery error //Error cache is empty. It's ok\r\nMissing value //Error description - missing value. Because cache is empty. \r\n\r\n```\r\n\r\nHere everything seems to be fine. We are starting application for the first time. Cache is empty. Query watcher is being triggered and is returning error because of lack of data in cache.\r\n\r\nNow let's move forward and log in.\r\n\r\n```\r\nOptional() //Now we've got user\r\nfetch. apollo.fetch(query: SyncManagerQuery(), cachePolicy: .fetchIgnoringCacheData) \r\nFetch Sync FETCH //Ignoring cache data is still creating cache am I right?\r\nSync Fetch success //Fetch is successful \r\nBUT NOTHING IS HAPPENING :(\r\n```\r\n\r\n**Question 1:** Why watcher is not reacting? It is being stored in a parent object. \r\n`private var syncWatcher: GraphQLQueryWatcher?`\r\nand is initialized before fetch trigger.\r\n\r\nOk let's start over again. Close the application and start again with already existing cache. \r\n\r\n```\r\nisReachable true //We've got internet\r\nOptional() //We've got user\r\nFetch Sync FETCH //Above conditions are triggering FETCH\r\nWatch SyncManagerQuery //Hmm watch is also starting? Not that scary ok, it is just executing for the first time?\r\nWatch SyncManagerQuery success //Success - because we already have cache so it's ok\r\nSync Fetch success //In the meantime FETCH just finished\r\nWatch SyncManagerQuery // **1*** So it is triggering watch. Not sure why.\r\nWatch SyncManagerQuery error //Error :(The operation couldn’t be completed. (Apollo.URLSessionClient.URLSessionClientError error 2.) **2**\r\nWatch SyncManagerQuery // But hey it is trying once again \r\nWatch SyncManagerQuery success // And this time we've got a success.\r\n```\r\n\r\n**Question 2:** - Fetch result had no changes at all. It was exactly the same. Is watcher reacting to just cache update or is it verifying actual changes?\r\n**Question 3:** - Why it fails? And the retry is normal behavior after failure or is it a side effect of sth else?\r\n\r\n\r\nOk let's start over again. Exactly same conditions. We already have cache.\r\n```\r\n\r\nisReachable true //We've got internet\r\nOptional() //We've got user\r\nFetch Sync FETCH //Starting fetch\r\nWatch SyncManagerQuery \r\nWatch SyncManagerQuery success //Watching cache successful\r\nSync Fetch success //Fetching data successful, cache is being refreshed\r\nWatch SyncManagerQuery //And this is probably triggering watch \r\nWatch SyncManagerQuery success //Watch is successful\r\nWatch SyncManagerQuery //**1** But what is happening? Why it is triggering once again?\r\nWatch SyncManagerQuery success\r\n\r\n```\r\n**Question 4:** - why my watch query seems to be triggering twice after fetch? ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! I renumbered your questions so it would be clearer which one i'm responding to once I get more information here. Some things that would be helpful to understand: \r\n\r\n- Are you using the SQLite cache or the in-memory cache? \r\n- In the second code block (just before question 1), you are still running the watcher which was started in the first code block, and that's what you're expecting to get hit when you've added \"But nothing is happening\", correct?\r\n- After Question 1, you say \"close the application and start again\" - do you mean that you just exit the application then go back into it, or that you force-quit the application? \r\n- For the 3rd and 4th sets of logs, are you specifying a cache policy or using the default `.returnCacheDataElseFetch`? \r\n- Where in the application lifecycle are you setting up your watcher? Is it possible that the watcher could be getting set up multiple times? \r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"1. SQLite cache\r\n2. That is the same app session. So yeah watcher is still up and running.\r\n3. Reset the application. New session. SQLite cache already exists. Just wanted to check how watcher is going to act with existing cache and initializing once again.\r\n4. Watch is always using returnCacheDataDontFetch, fetch is alwasy using fetchIgnoringCacheData\r\n5. Not possible in that case. My AppDelegate is starting the whole FlowControlAgent which is Singleton here.\r\n\r\nAll problems seems to be similar to \"cold start\" problem described here \r\nhttps://github.com/apollographql/apollo-ios/issues/99 \r\n","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"Yeah, this from @martijnwalraven in #99 definitely seems to explain why your first watcher isn't called:\r\n\r\n> Because your watch uses `.returnCacheDataDontFetch`, and the cache is initially empty, it will never get a valid response in that case.\r\n\r\nIs there a chance you could send me a small repro project? I should at least be able to try to figure out why the `watch` is getting called twice, but it'd be pretty hard to do without something to debug. You can email it to ellen at apollographql dot com. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'll do my best to prepare some sample however now I'm out of time. Hopefully will send you sth around weekend. \r\nRight now, well, I can live with double watcher :) ","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"@pgawlowski Were you ever able to get a sample together? If not, do you mind if we close this issue out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hey @designatednerd \r\n\r\nSorry for not providing my sample code. It's still on my personal ToDo however I am totally sucked into other work. Let's close this issue right now. Hope I will provide some sample that will be helpful to validate this issue in some time - maybe during my vacations :) \r\n\r\nThanks for everything!","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}}]}},{"__typename":"Issue","title":"Cache and queries, unable to fetch record by ID.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null},"body":"So let's start with sth like this. Fetch and cache using SQLite normalized cache.\r\n```\r\nquery Sync {\r\n\tviewer {\r\n\t\tthings {\r\n\t\t\tnodes {\r\n\t\t\t\tid\r\n }\r\n }\r\n }\r\n}\r\n\r\n```\r\nHere is our cacheKeyForObject\r\n\r\n ```\r\n client.cacheKeyForObject = { (object) in\r\n if\r\n let id = object[\"id\"] as? String,\r\n let type = object[\"__typename\"] as? String {\r\n return [id, type]\r\n }\r\n // No id or typename, don't do caching\r\n return nil\r\n } \r\n\r\n```\r\nI also tried the basic one \r\n`client.cacheKeyForObject = { $0[\"id\"] }`\r\n\r\nWe've got (or at least out backend claims that we've got) unique ID's.\r\nNext I want to perform query with cachePolicy: `.returnCacheDataDontFetch`.\r\n\r\n```\r\nquery ThingActionConnection($thingId: ID!) {\r\n thing: node(id: $thingId) {\r\n ...on Thing {\r\n id\r\n }\r\n }\r\n} \r\n```\r\n\r\nResult is `GraphQLResultError(path: thing, underlying: Apollo.JSONDecodingError.missingValue)`\r\nThe more I dig down into apollo and caching the less I know how exactly this supposed to work. \r\n\r\nNetwork call is giving us correct results. What is more I checked local sqliteDB and there is a results with this particular `$thingId`. \r\n\r\nAndroid developer is getting results with ease. On our side, JSONDecodingError. \r\nI am nearly 100% sure that the problem is with cacheKeyForObject or ios apollo is unable to handle nodes here?\r\n\r\n@edit\r\nSame goes for \r\n```\r\n\r\nquery ThingActionTest($thingId: ID!) {\r\n viewer {\r\n thing(id: $thingId) {\r\n id\r\n }\r\n }\r\n}\r\n\r\n```\r\n\r\n@edit 2:\r\n\r\nInteresting fact is - direct cache access with same id works totally fine.\r\n\r\n```\r\n apolloClient.store.withinReadTransaction({ transaction in\r\n do {\r\n let variables = [\"isReady\": false]\r\n let data = try transaction.readObject(ofType: ThingAction.self, withKey: actionId, variables: variables)\r\n print(data)\r\n } catch {\r\n print(error.localizedDescription)\r\n }\r\n })\r\n```\r\nThis is only giving me more confusion about query execution on cache.\r\n\r\nI also noticed that direct cache access using query is giving me some confusing error.\r\n`Error at path \"thing)\": missingValue`\r\nWhy it is printing ')' character there? \r\n@edit ok it's just a typo in GraphqlExecutor.swift line 36.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"> The more I dig down into apollo and caching the less I know how exactly this supposed to work.\r\n\r\nWelcome to my last year, my friend 🙃. And also to why I'm planning to simplify a bunch of stuff in the Cache as part of phases 2-3 of the swift codegen rewrite if it's at all possible.\r\n\r\nI can tell you for sure that iOS and Android have no cache compatibility guarantees right now, and that I *think* the issue is that you're using a fragment on a node, and that you don't have the `id` on the node itself - that means that the node won't have an ID, and it won't go into the cache. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I finally figured it out. The problem was missing variables. \r\n\r\nHowever what I noticed is that sometimes when I am asking for data one by one I am getting\r\n`GraphQLResultError(path: lock.id, underlying: Apollo.JSONDecodingError.missingValue)` without any particular reason. Because starting exactly the same `withinReadTransaction` few seconds later is giving me correct response.\r\n","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"Is it giving you that error maybe because the data has not yet been populated? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Data is populated. \r\nI am executing exactly the same load and it can give a results like:\r\n\"I've got data.\"\r\n\"I've got data.\"\r\n\"I've got data.\"\r\nGraphQLResultError(path: lock.id, underlying: Apollo.JSONDecodingError.missingValue)\r\nGraphQLResultError(path: lock.id, underlying: Apollo.JSONDecodingError.missingValue)\r\n\"I've got data.\"\r\n\r\nNo fetching or repopulating cache in between.\r\nUser is offline and no cache manupulations are happening. I just wondered if there is a chance of some sort data access race here?\r\n\r\nI digged down ino the sql file and found that when I am getting this error the reference ID of one object is missing and right after getting data back there is a new one, different than previous (before missing value) one.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}},{"__typename":"IssueComment","body":"There is definitely a possibility of a data race, there are some known issues with threading in the cache at the moment.\r\n\r\nI'd really need to see your exact code to figure out what's going on with your references - the reference ID should be stable, but any number of things could be happening here to mess that up. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@pgawlowski Were you ever able to resolve this issue? Anything I can do to help here or do you mind if I close this out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hey @designatednerd \r\nActually yes. The main problem was old cache + messed id's. \r\nThank you for your help.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null}}]}},{"__typename":"Issue","title":"How to download schema.json with apollo client for an endpoint with url params and multi headers?","author":{"__typename":"User","login":"XiaoxiaYao","id":"MDQ6VXNlcjIyODk5MDk2","name":"MichaelYao"},"body":"Hi,\r\n\r\nI am trying to download a schema.json file from an endpoint. However, I don't know how to config the the url params and multi headers? Please check the pic below:\r\n![image](https://user-images.githubusercontent.com/22899096/89851786-e5de2980-dbbf-11ea-9a36-1c3499af4dc2.png)\r\nI am able to use graphql in graphiql. But don't know how to config in terminal. I tried:\r\n`apollo client:download-schema --endpoint=https://xxxxxxxxxxx/graphql/ --header='xxxxx-API-Key:xxxx;xxxxx-k:xxxxxx' --data='co=US'`\r\nHowever still no luck. Can anyone help me with this? I did not any doc about this ...so I am here. I don't know how to specify co=US and how to separate the headers with ,(comma) or ; (semi comma) Thank you in advance. Thanks.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! Each header must be passed in separately like so: `--header=\"Header-Key: Header Value\" --header=\"Header-Key-2: Header Value 2\"`\r\n\r\nThere is also a way to set this up using the [Swift Scripting lib](https://www.apollographql.com/docs/ios/swift-scripting) using the [`ApolloSchemaDownloader`](https://www.apollographql.com/docs/ios/swift-scripting/#downloading-a-schema). ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> Hi! Each header must be passed in separately like so: `--header=\"Header-Key: Header Value\" --header=\"Header-Key-2: Header Value 2\"`\r\n> \r\n> There is also a way to set this up using the [Swift Scripting lib](https://www.apollographql.com/docs/ios/swift-scripting) using the [`ApolloSchemaDownloader`](https://www.apollographql.com/docs/ios/swift-scripting/#downloading-a-schema).\r\n\r\nThank you. Sorry, one more thing. Do you know how to deal with url params? co=US? How should I set it?","author":{"__typename":"User","login":"XiaoxiaYao","id":"MDQ6VXNlcjIyODk5MDk2","name":"MichaelYao"}},{"__typename":"IssueComment","body":"URL params should just be the same as a normal URL - `https://example.com?paramName=paramValue¶m2name=param2Value`","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Cool. I will have a try. Thank you @designatednerd. Have a nice day!","author":{"__typename":"User","login":"XiaoxiaYao","id":"MDQ6VXNlcjIyODk5MDk2","name":"MichaelYao"}},{"__typename":"IssueComment","body":"@XiaoxiaYao Mind if we close this issue out then? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'm gonna close this out - @XiaoxiaYao if you have further problems please reopen. Anyone else experiencing similar problems, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Changing converting logic for custom objects","author":{"__typename":"User","login":"Shiaulis","id":"MDQ6VXNlcjEzNjAxNzQ4","name":"Andrius Shiaulis"},"body":"Hey awesome Apollo team. I have a question related to custom scalar objects.\r\nWe are moving towards using GraphQL and I'm trying to adapt it for our requests. The problem occurs whenever I'm trying to convert custom objects from our response.\r\nOur backend is using `JSON` type for legacy information. Codegen is trying to convert it to a string:\r\n![image](https://user-images.githubusercontent.com/13601748/90020057-f8d42500-dcb7-11ea-8132-dc3b28699b36.png)\r\n\r\nIs there any way to specify that we don't want that object to be converted to a string?\r\nFor now I know only one solution: pass `--passthroughCustomScalars` key, but the downside of this approach is that I need to create global typealias or type for with `JSON` name for the whole project. Is there any way to not convert the object at all so it can convert ANY type or some more specific name like `ApolloJSON` so in that case name would be more specific?\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Okay I found codegen Readme file :) At least I can make prefix for custom scalars by passing it with codegen option:\r\n```\r\n--customScalarsPrefix=\"Apollo\"\r\n```","author":{"__typename":"User","login":"Shiaulis","id":"MDQ6VXNlcjEzNjAxNzQ4","name":"Andrius Shiaulis"}},{"__typename":"IssueComment","body":"Yep, there's also a `namespace` option that wraps all your stuff in a big `enum` to namespace it. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"HTTPNetworkTransport's URLSessionClient possible [ lost calls / memory leak ]","author":{"__typename":"User","login":"EggYoke","id":"MDQ6VXNlcjY5NjM3NTc4","name":null},"body":"Hi team!\r\nFirst of all, thanks for an awesome framework that makes the lives of so many of us that much easier 😄\r\n\r\nWe have run into a [lost calls / memory leak] issue.\r\nWe believe it is closely linked to issue https://github.com/apollographql/apollo-ios/issues/1292.\r\n\r\n### SETUP\r\nDependency manager: SPM\r\nApollo-iOS version: 0.30.0\r\nSetup: Instanced (not a Singleton)\r\n\r\nAlso we provide a `URLSessionClient` that runs on a background callbackQueue to the `HTTPNetworkTransport`:\r\n```\r\nURLSessionClient(\r\n sessionConfiguration: URLSessionConfiguration.background(withIdentifier: \"background\"),\r\n callbackQueue: .some(operation)\r\n)\r\n```\r\n\r\n### INTENDED OUTCOME\r\nWe expect that the calls of all instanced ApolloClients return successfully.\r\nWe also expect that ApolloClients that are not retained in our code get deallocated from the system memory.\r\n\r\n### ACTUAL OUTCOME\r\nWe first noticed that for some reason, new instances of `ApolloClient` (those created after the first instance is not retained in our code anymore) never return from their calls This has made us notice that the created `URLSessionClient`s, `HTTPNetworkTransport`s and `ApolloClient`s are never deallocated properly causing a memory leak.\r\n\r\n### REPRODUCTION STEPS\r\n1 - Make a call with the setup described above.\r\n2 - Remove the retained instance of the ApolloClient.\r\n3 - Create a new ApolloClient and make a new call.\r\n4 - Call does not come back / memory leak occurs.\r\n5 - Repeat from step 2 to create a new unwanted retained instance of `URLSessionClient`, `HTTPNetworkTransport` and `ApolloClient`.\r\n\r\n### OUR CONCLUSIONS\r\nThis part should be taken with a grain of salt as we are not Apollo experts. That said, it is the only conclusion that survived our tests. Having found this https://stackoverflow.com/questions/62612056/why-dispatchqueue-global-still-alive-after-deinit on StackOverflow, we think that the problem stems from the queue keeping alive the instance of the `URLSession` created in `URLSessionClient` in some fashion.\r\n\r\nThis causes multiple retains climbing up the dependence graph of:\r\n- URLSession\r\n- URLSessionClient\r\n- HTTPNetworkTransport\r\n- ApolloClient\r\n- Objects in our code that calls ApolloClient ...\r\n\r\n### OUR SOLUTION\r\nAdding the following to `HTTPNetworkTransport` fixes both our issues:\r\n```\r\ndeinit {\r\n self.client.session.invalidateAndCancel()\r\n}\r\n```\r\n\r\nWe understand that this is most probably not the solution you will want to implement but it might help as a starting point to formulate something that will not jeopardize others that use your framework.\r\n\r\n### OUR INVESTIGATION\r\nIt should be said that we took the liberty to try this as there was code in the `URLSessionClient` for `deinit` that clears all tasks. We surmised that clearing the tasks in that situation did not cause a problem for calls in progress, meaning that clients of the framework should not expect the calls to complete if they stop holding their instance of `ApolloClient`.\r\n\r\nBut we noticed that the `deinit` in the `URLSessionClient` was never called even when its parent `HTTPNetworkTransport` `deinit` was called. We then noticed that the `HTTPNetworkTransport` was never deallocated even though its `deinit` was called.\r\n\r\nThat made us realize that something further down the line was probably holding things recursively. Implementing our solution, everything gets deallocated and for some reason, further ApolloClients return their calls successfully.\r\n\r\n### CONCLUSION\r\nAdvice on how to go forward from here would be greatly appreciated.\r\nThanks in advance for your help. We stand ready to answer any of your questions should you have some.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! Thanks for the extremely detailed report. Very, very odd that `deinit` would get called without the `HTTPNetworkTransport` actually being deallocated - usually the telltale sign of a memory leak is that `deinit` never gets called at all. \r\n\r\nIs this only happening with background sessions, or is it also happening with normal sessions? Or are you using a background configuration for all sessions? \r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi again!\r\n\r\nTo answer your question, we are using a background configuration for all sessions. As for normal sessions, we do see some memory leaks but they do not impede calls. Maybe the following will be useful.\r\n\r\nWe tried many configurations, mainly:\r\n- not using a URLSessionClient\r\n- using a URLSessionClient with a `.background` configuration and a callbackQueue `.main`\r\n- using a URLSessionClient with a `.background` configuration and a callbackQueue `.some`\r\n\r\nOnly the configuration of `.background` with a callbackQueue `.some` is suitable for us. Otherwise, some computations happen on the main thread when Apollo decodes our objects which brings the application to a crawl. (This is probably due to a specific situation in our code).\r\n\r\n### OUR TESTS\r\nHere are our results with those configurations in both instance setup and singleton setup. The main things we got out of it are that with an instance setup:\r\n- Calls do not come back if we provide a URLSessionClient\r\n- We always see URLSessionClients being kept in memory. In instruments, some are identified as leaks, some are not.\r\n\r\nWe hope this is clear and it did not confuse you to what's happening. As always, we are here if you need more info 😃.\r\n\r\nNo URLSessionClient\r\n---\r\n\r\n#### Instance\r\n✅ Calls come back\r\n✅ Does not retain objects holding ApolloClient instance in our code\r\n🛑 Retain orphaned UrlSessionClients and shows a leak in instruments\r\n\r\n#### Singleton\r\n✅ Calls come back\r\n✅ Does not retain objects holding ApolloClient instance in our code\r\n✅ Does not retain orphaned UrlSessionClients\r\n\r\n\r\nURLSessionClient with callback queue .main\r\n---\r\n\r\n#### Instance\r\n🛑 Calls do not come back\r\n🛑 Retains objects holding ApolloClient instance in our code\r\n🛑 Retains orphaned UrlSessionClients but does not show a leak in instruments\r\n\r\n#### Singleton\r\n✅ Calls come back\r\n✅ Does not retain objects holding ApolloClient instance in our code\r\n✅ Does not retain orphaned UrlSessionClients\r\n\r\n\r\nURLSessionClient with callback queue .some\r\n---\r\n\r\n#### Instance\r\n🛑 Calls do not come back\r\n🛑 Retains objects holding ApolloClient instance in our code\r\n🛑 Retains orphaned UrlSessionClients but does not show a leak in instruments\r\n\r\n#### Singleton\r\n✅ Calls come back\r\n✅ Does not retain objects holding ApolloClient instance in our code\r\n✅ Does not retain orphaned UrlSessionClients","author":{"__typename":"User","login":"EggYoke","id":"MDQ6VXNlcjY5NjM3NTc4","name":null}},{"__typename":"IssueComment","body":"I'm going to take a look deeper at this on Monday but one thing to be aware of is that there is no such thing as \"No `URLSessionClient` - a default one will be created for you if you're using `HTTPNetworkTransport`. It uses `.main` as its default queue, so I'm not sure what would be different between that and passing in your own. \r\n\r\nAdditionally: How are you setting up the instances? Is it possible that ARC is clobbering them because they are not properly retained somewhere and one of the assorted `weak self` calls winds up being nil? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks!\r\n\r\nFor the `URLSessionClient`, we figured that one was created on the Apollo framework side if not provided. Seeing the disparity in behaviour, we thought of sending you our observations on that as well. Maybe the difference between providing ours compared to the one by default is that we always put a `URLSessionConfiguration.background` instead of the `.default` one provided by Apollo.\r\n\r\nAs for how we retain instances, if you are talking about the `URLSessionClient`, we create it and give it to the `HTTPNetworkTransport`. It is all done in the same method and we do not retain either the `URLSessionClient` or the `HTTPNetworkTransport`. If you are talking about the `ApolloClient`, we tested swapping the `ApolloClient` for a mock that implements the same methods. We see no retain on our side.","author":{"__typename":"User","login":"EggYoke","id":"MDQ6VXNlcjY5NjM3NTc4","name":null}},{"__typename":"IssueComment","body":"So where do you retain the `ApolloClient` which you've handed the `HTTPNetworkTransport` to? Basically, I have a suspicion that the whole stack is getting hammered by ARC before the call returns if the instance is not being held onto somewhere. That would explain why in the `Instance` case listed above calls don't come back.\r\n\r\nAgain, if you have some sample code to share, that would be most helpful.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"The `ApolloClient` is retained by a **repo** object. When the object is instantiated it is injected with a new `ApolloClient` instance and uses it to make its calls.\r\n\r\nThe first time a user navigates to where a call is needed, we create a repo and start a call, it comes back correctly. The second time a user navigates to where a call is needed, we create a new repo and start a call, it never comes back. We keep those instances alive until they are not needed anymore or the user navigates away. In any case, when we create the second `ApolloClient` instance, nothing returns from the call even if held for over 10 minutes.\r\n\r\nI was able to confirm that calls not coming back happens if we provide a `URLSessionConfiguration` that is `.background`.\r\n\r\nAlso, sorry about the late notice but in debug environment, if we provide a `URLSessionConfiguration` that is `.background`, we often hit line 225 of the `URLSessionClient`:\r\n`assertionFailure(\"No data found for task \\(dataTask.taskIdentifier), cannot append received data\")`\r\n","author":{"__typename":"User","login":"EggYoke","id":"MDQ6VXNlcjY5NjM3NTc4","name":null}},{"__typename":"IssueComment","body":"I was able to replicate easily with the iOSTutorial project. What is the easiest way to send you that project amended to reproduce?","author":{"__typename":"User","login":"EggYoke","id":"MDQ6VXNlcjY5NjM3NTc4","name":null}},{"__typename":"IssueComment","body":"Email! ellen at apollographql dot com. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@EggYoke The sample you sent was very helpful, thank you. The underlying problem was a retain cycle as outlined in #1366. \r\n\r\nThe secondary problem is that you're attempting to create multiple background sessions with the same identifier at the same time, which the system won't let you do. I found that after the changes in #1366 were applied, I was able to get things to work with a background session by just using `UUID().uuidString` as the identifier, as this prevents any collisions in session name. \r\n\r\nHonestly, I wouldn't really recommend using background sessions for everything as it's kind of overkill, but if you need to for reasons I'm missing, that should at least unblock you.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"This has shipped with `0.31.0` - if you're still having issues with that version, please open a new issue and we'll try to figure it out. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thank you very much for the fast response.\r\nOur calls come back successfully and none of our objects are retained anymore.\r\nThis fixed all our issues, awesome job! 👍 ","author":{"__typename":"User","login":"EggYoke","id":"MDQ6VXNlcjY5NjM3NTc4","name":null}}]}},{"__typename":"Issue","title":"Cannot load underlying module for 'Apollo' for unit test target","author":{"__typename":"User","login":"dpatel-git","id":"MDQ6VXNlcjY4NDM2NTk1","name":null},"body":"Hello folks,\r\n\r\nI have following setup.\r\n\r\nXcode 11.3.1 (also tried on 11.6 without success)\r\nApollo 0.29.1\r\nCocoapods 1.9.2\r\n\r\nI am able to compile and run my application, but get the following error when I try to compile the unit test target\r\n\r\n```:0: error: cannot load underlying module for 'Apollo'```\r\n\r\nHere is how I have declared the app and test targets in podfile\r\n\r\n```\r\ntarget 'MyApp' do\r\n pod 'Apollo', Apollo\r\n target 'MyAppTests' do\r\n pod 'OHHTTPStubs', OHHTTPStubs\r\n end\r\nend\r\n```\r\nI have set `MyApp` as host application for the test target\r\n\r\nAny help is appreciated, thanks\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"It looks like your `MyAppTests` is missing an `inherit! :search_paths`. See the 2nd example [in the Podfile docs](https://guides.cocoapods.org/using/the-podfile.html). ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks, that fixed the issue.","author":{"__typename":"User","login":"dpatel-git","id":"MDQ6VXNlcjY4NDM2NTk1","name":null}}]}},{"__typename":"Issue","title":"GraphQLQueryWatcher doesn't update its dependent keys","author":{"__typename":"User","login":"teodorpenkov","id":"MDQ6VXNlcjU2MjIyODg=","name":"Teodor Penkov"},"body":"With the `0.23.0` release Apollo changed the way it stores keys in the `QueryWatcher` https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/GraphQLQueryWatcher.swift#L73-L83\r\n\r\nThe problem with this is that the watcher doesn't update its `dependentKeys` like it should. There is a commit that does that but I couldn't follow why it was changed:\r\nhttps://github.com/apollographql/apollo-ios/commit/2b07e69e71a0621795b7089fda84c0ca744ba202\r\n\r\nThe problem that we are experiencing is that we are updating a query in the store with `ReadWriteTransaction` and in the previous versions the updated query captured the newly dependent keys, therefore when a change occured it was propagated to the result handler and now it's not.\r\n\r\nWhat's the reason behind this change and how can we workaround this? Was there a problem with the previous implementation in 0.22.0 https://github.com/apollographql/apollo-ios/blob/0.22.0/Sources/Apollo/GraphQLQueryWatcher.swift#L66-L68","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi, the commit you referenced was part of #1156 which went out with `0.28.0`, not `0.23.0`. You can see a detailed explanation of the bug in #1155. \r\n\r\nWhat version are you actually on right now? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"hey @designatednerd thanks for reaching out.\r\n\r\nI'm using `0.28.0` but I think the problem that I experience is on every version after `0.23.0`.\r\n\r\nOur use case is pagination using the Apollo cache.\r\nWe are doing one `main` query followed by 0 or more `fetch more` queries (based on page info and scroll events) each `fetch more` query updates the main one with its nodes and page info. We've been using this method for a while and it worked pretty well, the reason for that is that the \"main\" query was updating its dependent keys (the nodes from the fetch more queries) and after the commits I mentioned it stopped working.\r\n\r\nMutation values gets to the store correctly but after `didChangeKeys` gets called this results in a watcher's result handler being called with the old values rather than the updated values from the mutation.\r\n\r\nI will run through the commits and PR's that you mentioned and will try to figure out what the problem with the previous behavior was.","author":{"__typename":"User","login":"teodorpenkov","id":"MDQ6VXNlcjU2MjIyODg=","name":"Teodor Penkov"}},{"__typename":"IssueComment","body":"So I know some stuff changed around `0.22.0` that was the motivation for these changes that went out with `0.28.0`, but otherwise I'm not really seeing anything that changed. If you have any suggestions or a PR, I'm more than happy to try them out!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'd either suggest reverting to `0.22.0`'s implementation https://github.com/apollographql/apollo-ios/blob/0.22.0/Sources/Apollo/GraphQLQueryWatcher.swift#L66-L68\r\n\r\nor adding `self.dependentKeys = graphQLresult.dependentKeys` before this line https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/GraphQLQueryWatcher.swift#L79\r\n\r\nIf you don't see problem with that I'm happy to open a PR.","author":{"__typename":"User","login":"teodorpenkov","id":"MDQ6VXNlcjU2MjIyODg=","name":"Teodor Penkov"}},{"__typename":"IssueComment","body":"@designatednerd thanks for the links that you shared. I've checked them and I found the root cause of the problem.\r\n\r\n\"Screen\r\n\r\nI'm pretty sure that if we bring back those lines it wouldn't break anything.","author":{"__typename":"User","login":"teodorpenkov","id":"MDQ6VXNlcjU2MjIyODg=","name":"Teodor Penkov"}},{"__typename":"IssueComment","body":"Hi! Sorry, I was on vacation last week. \r\n\r\nI read [your explanation](https://github.com/apollographql/apollo-ios/pull/1156#discussion_r476476875) here and I think I get it. I'll take a look at this today or tomorrow and see what I can figure out. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Primary Maintainer Out Of Office August 23-30","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"},"body":"I will be taking a break in a place that (not coincidentally) has terrible internet connectivity the week of August 24th. \r\n\r\nKeep opening issues and PRs while I'm out, but please be aware that they will not be addressed until August 31st or thereafter. Thank you for your patience!","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I'm back! ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Ambiguous for type lookup in this context error","author":{"__typename":"User","login":"Shiaulis","id":"MDQ6VXNlcjEzNjAxNzQ4","name":"Andrius Shiaulis"},"body":"Hey hey! Another question from my side :) \r\nIn our backend response contains 2 data fields `userCompanies` and `userCompany` that share type. \r\n![image](https://user-images.githubusercontent.com/13601748/90987179-b81abc80-e591-11ea-9e96-ded615f5630e.png)\r\nThe problem is that code generation creates 2 totally equal structures:\r\n![image](https://user-images.githubusercontent.com/13601748/90987269-573fb400-e592-11ea-8292-1a365a37b737.png)\r\n\r\nIn documentation explorer in GraphiQL I don't see any issues:\r\n![image](https://user-images.githubusercontent.com/13601748/90987304-9837c880-e592-11ea-9f5f-af004aa50ca8.png)\r\n\r\nSo should I still look for a fix on backend side? Is there any way to explain that these data fields share type?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Im getting the exact same problem.\r\n\r\n```swift\r\npublic struct Author: GraphQLSelectionSet {\r\n public static let possibleTypes: [String] = [\"Staff\", \"Customer\"]\r\npublic struct Author: GraphQLSelectionSet {\r\n public static let possibleTypes: [String] = [\"ArticleAuthor\"]\r\n```","author":{"__typename":"User","login":"kylebrowning","id":"MDQ6VXNlcjExMzAyMw==","name":"Kyle Browning"}},{"__typename":"IssueComment","body":"Yeah - this is where the depluralization for type names we're using in the typescript codegen kind of falls apart. The workaround is to use field aliases:\r\n\r\n```graphql\r\nquery MyQuery {\r\n user {\r\n id\r\n userCompany: company // <-- alias\r\n userCompanies\r\n }\r\n}\r\n```\r\n\r\nThis way what's called `userCompany` on your server will be called `company` locally, making the type for that property `Company` and the type for `userCompanies` will be `UserCompany`. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd, thanks for the clarification 👍 ","author":{"__typename":"User","login":"Shiaulis","id":"MDQ6VXNlcjEzNjAxNzQ4","name":"Andrius Shiaulis"}},{"__typename":"IssueComment","body":"@Shiaulis did that work? If so, can we close this out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Worked for us. ","author":{"__typename":"User","login":"kylebrowning","id":"MDQ6VXNlcjExMzAyMw==","name":"Kyle Browning"}},{"__typename":"IssueComment","body":"Thanks, let's close it","author":{"__typename":"User","login":"Shiaulis","id":"MDQ6VXNlcjEzNjAxNzQ4","name":"Andrius Shiaulis"}}]}},{"__typename":"Issue","title":"Error: Unable to read file › schema.json. ENOENT: no such file or directory, open 'schema.json'","author":{"__typename":"User","login":"fatma95","id":"MDQ6VXNlcjEyMTc1NDE3","name":"Fatma Mohamed"},"body":"I followed all the correct steps in the document, schema.json and graphql files are on the right places however I always get this error and build fails please help.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! So I'll need a bit more information to help diagnose this. Can you answer a few questions: \r\n\r\n- Have you confirmed that `schema.json` is downloaded and exists where you think it is on your filesystem? \r\n- Are you using the Swift Scripting wrapper or the shell script? \r\n- Can you paste a link to the set of instructions you are following? \r\n\r\nThank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi! I haven't heard back on this issue in over a week so I'm going to close it out - @fatma95 please reopen if you still need help, anyone else with a similar problem, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"No data found for task x, cannot append received data","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"},"body":"One of our tests hitting assert in `URLSessionClient.swift:230` in on CI after updating to latest version (0.31.0).\r\nIt's not networking stack test so don't think we doing anything specific to hit that assert. Looking at code that would indicate some kind race condition...","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Weird! Is it possible it's something leaking over from an older test? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"can't see anything relevant, also it don't happen every run","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"```swift\r\npublic func invalidate() {\r\n self.clearAllTasks()\r\n self.session?.invalidateAndCancel()\r\n self.session = nil\r\n }\r\n```\r\n\r\nshouldn't `self.session?.invalidateAndCancel()` be before `self.clearAllTasks()`? Will try change and see if our tests passes more reliably ","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"Hi! Yeah flipping the cleanup order likely wouldn't help since some tasks are still in-flight, I suspect I need to actually cancel all the in-flight tasks. Thanks for the heads up on this!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Haha damn it, looks like there's a key piece of info about `invalidateAndCancel` that's only in the docs docs and not in the headerdoc: \r\n\r\n\"Screen\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Shipped with version `0.32.1`!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi @designatednerd,\r\n\r\nI am encountering this issue in `0.33.0`, looking at #1383 I'm not quite certain it addressed the root issue given the shared `URLSession` isn't being used in `URLSessionClient`? I have a fairly reproducible case where this `invalidate` logic is getting hit but I'm still encountering this assertion error afterwards, confirmed with some debugging its definitely the same instance floating around. \r\n\r\nThat all said, it does seem that the issue is resolved by calling `invalidateAndCancel` prior to calling the `clear` block (as is currently done in the else branch). I've tested this quite a bit and have been unable to trigger the assertion failure anymore. I'll go ahead and open a PR for you to take a look, hopefully it helps!","author":{"__typename":"User","login":"philfi","id":"MDQ6VXNlcjM5NTY0NjE1","name":null}},{"__typename":"IssueComment","body":"Can confirm that it's not solved in 0.33.0. Just got assert while running tests on iOS12\r\n\r\n\"Screenshot\r\n","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"still happening in 0.36.0 (iOS12 simulator)","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}}]}},{"__typename":"Issue","title":"Crash at runtime when upgrading to 0.31.0 on URLSessionClient.swift, line 95","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"},"body":"Hey guys,\r\n\r\nSo I have an app that works perfectly with 0.30.0 but when upgrading to 0.31.0 I get a crash soon after the app launches:\r\n\r\n```\r\nFatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file /Users/XXX/Library/Developer/Xcode/DerivedData/XXX-bzyicfzsqzelixabxktyzmboxbaj/SourcePackages/checkouts/apollo-ios/Sources/Apollo/URLSessionClient.swift, line 95\r\n```\r\n\r\nThe issue is one this line :\r\n\r\n```\r\nlet task = self.session.dataTask(with: request)\r\n```\r\n\r\nhere `session` is nil.\r\n\r\nLet me know if you need anything else as I can reproduce the crash 100% of the time. Many thanks","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! That's awfully weird, since the session is instantiated in the initializer. Can you share the code you're using to create your client, as well as where in the app lifecycle that's happening? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Something that occurred to me is that in `0.31.0` we added a mechanism to make sure the `URLSession` is properly terminated so as not to create a retain cycle - you can probably throw a breakpoint in [here](https://github.com/apollographql/apollo-ios/blob/d95b4463f78a15fba7e3de2017817a391e9714f0/Sources/Apollo/URLSessionClient.swift#L63) to see if that's getting hit before you get to whatever's creating the data task.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hey @designatednerd !\r\n\r\nFirst, thank you very much for answering so quickly, appreciate it :)\r\n\r\nI think your guess of adding a breakpoint into the `invalidate` method of `URLSessionClient` was a good idea. It turns out that when our app starts, we are initializing an `HTTPNetworkTransport` to use into a `SplitNetworkTransport` without any authentication, and when we authenticate (a few seconds after the app starts) we replace that `HTTPNetworkTransport` with a new one, simply by dereferencing the old one and keeping a pointer on a new `SplitNetworkTransport` that contains this new client.\r\n\r\nI think that what may happen is that the first client may have started some work in background, and when it gets destroyed this work hasn't finished, leading to this crash as the `session` is already nil. Could that be possible? ","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"That's possible - I've added some code in #1383 that should cancel any inflight operations on a `URLSessionClient` when `invalidate()` gets called, but I'm not sure if it'll address this crash since it's happening before the task is even added, which means `invalidate` has probably been called on a different thread.\r\n\r\nDefinitely sounds like a race condition is happening here - out of curiosity why are you fully replacing the client rather than using one of the delegate methods to handle authentication?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd Just tested, still crashing.\r\n\r\nI'm not 100% sure why we are replacing the client as I'm not the one who wrote that code, but as far as I understand it's because we are using `SplitNetworkTransport` and we are recreating the websocket so we need to also recreate the http client.","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"From here, I see a couple of workaround options: \r\n\r\n- Hanging on to the instance of `HTTPNetworkTransport` and using that when you have to recreate the web socket rather than creating a fully new transport\r\n- Taking a look at recent changes to the web socket transport, particularly around disconnecting and reconnecting, and seeing if any of those will prevent you from having to recreate. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I took the first option which works, so ok for me now but I guess you still have a race condition somewhere. Thank you very much for your help","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"Yeah for sure - I'm going to have to dig deeper into this but a lot of things are changing with the updated networking stack, so I'd like to get that out before digging back into this.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@benoitletondor We've just shipped something that will allow you to delay starting the websocket after initialization, which in theory should allow you to not have to replace the `SplitNetworkClient`. Do you mind pulling `0.36.0` and letting me know if that gets you to where you need to be? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hey @designatednerd ,\r\n\r\nThank you for your help on that. Indeed, it would work for my use case as we can avoid starting the websocket until we have a proper authentication. As I said last time I already followed your advice of keeping the `HTTPNetworkTransport` instance so it's not really needed anymore on my side.\r\n\r\nThanks","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"@benoitletondor Do you mind if I close out this issue then? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Be my guest ;) ","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}}]}},{"__typename":"Issue","title":"ApolloCodegen.run does not throw error when validation of GraphQL query document fails","author":{"__typename":"User","login":"michaelxbarrett","id":"MDQ6VXNlcjMzODIyNjEz","name":null},"body":"From the tutorial:\r\n```\r\ndo {\r\n // Actually attempt to generate code.\r\n try ApolloCodegen.run(from: targetRootURL,\r\n with: cliFolderURL,\r\n options: codegenOptions)\r\n} catch {\r\n // This makes the error message in Xcode a lot more legible.\r\n exit(1)\r\n}\r\n```\r\n\r\nWhen there is an error in the query, the message `Validation of GraphQL query document failed` is logged and outputted to the console with a stacktrace, but no error is thrown in this case.\r\n\r\n\r\nStack trace:\r\n```\r\nValidation of GraphQL query document failed\r\n at Object.validateQueryDocument (Codegen/ApolloCLI/apollo/node_modules/apollo-language-server/lib/errors/validation.js:35:38)\r\n at Object.generate [as default] (Codegen/ApolloCLI/apollo/lib/generate.js:23:18)\r\n at write (Codegen/ApolloCLI/apollo/lib/commands/client/codegen.js:84:54)\r\n at Task.task (Codegen/ApolloCLI/apollo/lib/commands/client/codegen.js:104:46)\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"To clarify: Do you mean that the `exit(1)` is not called because no error is thrown from `run` itself, or that `exit(1)` does not constitute throwing an error? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Also, what version of the SDK are you using? I think there was an issue a couple versions back with our JS CLI where it wouldn't throw errors properly on failure, which should be resolved now.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@michaelxbarrett Were you able to address this by updating? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Since I haven't heard back in 3 weeks, I'm going to close this out. @michaelxbarrett Please reopen if you're still experiencing problems. Anyone else with similar problems, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Query watcher not being called when cache is updated on an element of a collection that is added after calling watch","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"},"body":"Hi everyone,\r\n\r\nI've been trying a lot of things on that one and wasn't able to find a way to fix my problem. So in my app I'm having a list of conversations, so I'm creating a `watch` on a query that returns the list of conversations, this is something like that:\r\n\r\n```\r\nuser {\r\n uuid\r\n firstName\r\n lastName\r\n conversations {\r\n uuid\r\n unreadMessagesCount\r\n }\r\n}\r\n```\r\n\r\n> In the app we use the `uuid` key to handle cache, so we make sure to always pass `uuid` in our queries to automatically handle cache update.\r\n\r\nSo the role of the watcher I'm talking about is both to update existing conversations and also be able to catch when a new conversation is created (it can happen and not be initiated by the user, we then trigger an event from the backend that is listen from a subscription in the app). When this event happens it returns something like that\r\n\r\n```\r\nevent {\r\n newConversation {\r\n conversation {\r\n uuid\r\n unreadMessagesCount\r\n // This is the part that adds the new conversation to the existing ones of the users in the cache\r\n user {\r\n uuid\r\n conversations {\r\n uuid\r\n unreadMessagesCount\r\n }\r\n } \r\n }\r\n }\r\n}\r\n```\r\n\r\nIt works great, meaning that when this event happens, the watcher is being called with the newly created conversation, but the issue is that any new cache update for that specific conversation doesn't trigger the watcher again.\r\n\r\nAfter investigating a bit, I realised that the cache is being updated because if I'm adding 3 new messages into the new conversation (setting the `unreadMessagesCount` to 3), the watcher doesn't get called but then if I add 1 new message into an old one, the watcher is being called with both the new message on the old conversation and the 3 new on the new one. \r\n\r\nSo it really seems like `watch` is not being called again for changes on an item that wasn't in a collection when the `watch` was initially made. I've also take a look at https://github.com/apollographql/apollo-ios/issues/281 and making a `fetch` on the same query again after the event doesn't fix the issue.\r\n\r\nLet me know if I'm not clear on something as the whole thing is a bit complicated to explain.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! Can you take a look at v0.32.0 - I fixed something in query watchers in terms of updating dependent keys that I *think* should help with this. If it doesn't, let me know. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hey @designatednerd \r\n\r\nSure, if #1377 is resolved too I will be able to test that tomorrow. If that's not the case I guess I won't be able","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"Hey @designatednerd \r\n\r\nI tested and I can confirm 0.32.0 fixes the issue, thank you very much for your help.","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"Reopening this one as the bug seems to be back with 0.34.0 :/ Let me know if you need help on my side","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"@designatednerd I haven't tested 0.33.0 so I'm not sure when the regression happened","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"That's odd, because the test added is passing - I actually spent quite a bit of time making it pass. 🙃 Do you mind opening a new issue with a link to this one since it's in a different version? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Sure","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}}]}},{"__typename":"Issue","title":"Availability of framework with Xcode 12 and iOS version 8","author":{"__typename":"User","login":"novinfard","id":"MDQ6VXNlcjYxMTYwNw==","name":"Soheil Novinfard"},"body":"Is it possible to use the framework with Xcode 12 and iOS version 8? Currently it asks me to upgrade to iOS version 9 with Xcode 12","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"iOS 9 is our minimum supported version regardless of Xcode version. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@novinfard Any further questions or do you mind if I close this issue out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Crash while checking graphQLResult with 0.32 and 0.32.1","author":{"__typename":"User","login":"jsm174","id":"MDQ6VXNlcjExOTcxMzc=","name":"Jason Millard"},"body":"Hello. Yesterday I upgraded to 0.32 and immediately started getting crashes anytime one of our services is checking a `graphQLResult`:\r\n\r\n```\r\ncase let .success(graphQLResult):\r\n```\r\n\r\nI downgraded to 0.31 and it started working again. I saw that 0.32.1 was released and figured I'd give it a try, but I'm seeing the same behavior.\r\n\r\nI know this isn't much to go on, but:\r\n\r\n![Screen Shot 2020-09-11 at 9 36 16 AM](https://user-images.githubusercontent.com/1197137/92932578-14476280-f413-11ea-9b8a-02df220cfcfd.png)\r\n\r\n(FWIW, that first preflight is just refreshing oauth tokens if necessary)\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"So, I apologize but I think it is working after all. \r\n\r\nI think maybe after I did a pod update, it never actually rebuilt apollo.\r\n\r\nI will close this. ","author":{"__typename":"User","login":"jsm174","id":"MDQ6VXNlcjExOTcxMzc=","name":"Jason Millard"}},{"__typename":"IssueComment","body":"No worries, that can definitely happen. Thanks for the update!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"codegen produces Swift code that doesn't compile","author":{"__typename":"User","login":"rlimberger","id":"MDQ6VXNlcjQ4NDEyNDI=","name":"Rene Limberger"},"body":"My scheme defines a GQL query named ```shipmentETAs``` and a type ```shipmentETA```. Codegen generates Swift code which incorrectly changes parts of the query and type name to lowercase. As a result, the Swift code generated by codegen doesn't compile.\r\n\r\nSchema:\r\n```\r\n {\r\n \"name\": \"shipmentETAs\",\r\n \"description\": \"\",\r\n \"args\": [\r\n {\r\n \"name\": \"params\",\r\n \"description\": \"\",\r\n \"type\": {\r\n \"kind\": \"NON_NULL\",\r\n \"name\": null,\r\n \"ofType\": {\r\n \"kind\": \"INPUT_OBJECT\",\r\n \"name\": \"QueryShipmentETAParams\",\r\n \"ofType\": null\r\n }\r\n },\r\n \"defaultValue\": null\r\n }\r\n ],\r\n \"type\": {\r\n \"kind\": \"NON_NULL\",\r\n \"name\": null,\r\n \"ofType\": {\r\n \"kind\": \"LIST\",\r\n \"name\": null,\r\n \"ofType\": {\r\n \"kind\": \"OBJECT\",\r\n \"name\": \"ShipmentETA\",\r\n \"ofType\": null\r\n }\r\n }\r\n },\r\n \"isDeprecated\": false,\r\n \"deprecationReason\": null\r\n }\r\n```\r\n\r\nResulting Swift code:\r\n```\r\n public var shipmentEtAs: [ShipmentEta?] {\r\n get {\r\n return (resultMap[\"shipmentETAs\"] as! [ResultMap?]).map { (value: ResultMap?) -> ShipmentEtA? in value.flatMap { (value: ResultMap) -> ShipmentEtA in ShipmentEtA(unsafeResultMap: value) } }\r\n }\r\n set {\r\n resultMap.updateValue(newValue.map { (value: ShipmentEtA?) -> ResultMap? in value.flatMap { (value: ShipmentEtA) -> ResultMap in value.resultMap } }, forKey: \"shipmentETAs\")\r\n }\r\n }\r\n\r\npublic struct ShipmentEta: GraphQLSelectionSet {\r\n...\r\n```\r\n\r\nCompiler error:\r\n`Cannot find type 'ShipmentEtA' in scope`\r\n\r\nSwift 5.3\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Urgh, this is one of the things I'm working on getting rid of with Swift Codegen - this is all handled under the hood in the Typescript codegen in a way that's really, really opaque. Unfortunately for now the only real way to work around it is to alias the name of the field to not have multiple uppercase characters in a row. \r\n\r\nI don't know your schema but here's a general stab at what I think an updated query would look like: \r\n\r\n```query\r\nquery ShipmentArrives($id: ID!) {\r\n shipment(id: $id) {\r\n id\r\n shipmentETA: shipmentEstimate\r\n }\r\n}\r\n```\r\n\r\nLet me know if that works!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks so much @designatednerd ! The alias worked! \r\n```\r\nquery ShipmentEstimates($siteId: ID!) {\r\n shipmentEstimates: shipmentETAs(params: {siteId: $siteId}) {\r\n ...\r\n }\r\n}\r\n```","author":{"__typename":"User","login":"rlimberger","id":"MDQ6VXNlcjQ4NDEyNDI=","name":"Rene Limberger"}},{"__typename":"IssueComment","body":"Woot! Mind if we close this out - I'm already tracking the casing stuff in other tickets. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Fix Apple Silicon on Xcode 12 GM","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"},"body":"Related to #1280. In testing for the Xcode 12 GM everything's working swimmingly via my Intel mac but the DTK is throwing fits that I can't seem to solve at the moment, mostly related to `unable to load standard library` issues. ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"OK well it turns out I am both less dumb than I originally thought for not being able to get this to work, _and_ dumber than I thought for not realizing I shouldn't download the GM on the DTK. \r\n\r\nThe Apple Silicon stuff was not included with the GM since that ships to the public, and AS stuff should still be using the beta track (still Xcode 12b6 for now, probably a 12.1 beta sometime soon). \r\n\r\nClosing this out since everything still works on the most recent version of Xcode to support Apple Silicon, 12.0b6. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Apollo 0.33.0 + Xcode 11.7. Use of unknown directive '#filePath'.","author":{"__typename":"User","login":"Hazeaze","id":"MDQ6VXNlcjgzNTE4NzQ=","name":null},"body":"Hi.\r\nI use SPM for the third-party libraries, updated Apollo from 0.32.1 to 0.33.0, and on the app build, I faced with the problem in the `FileFinder.swift`, where received an error `Use of unknown directive '#filePath'`.\r\n\r\n![image](https://user-images.githubusercontent.com/8351874/93308812-91fcdb00-f824-11ea-9050-275be2b39282.png)\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I got the same error","author":{"__typename":"User","login":"Parilar","id":"MDQ6VXNlcjgxNTk2NDY=","name":"Lars Hallek"}},{"__typename":"IssueComment","body":"`#filePath` is new in Swift 5.3, which ships with Xcode 12. You will need to use Xcode 12 for versions `0.33.0` and higher.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'm going to close this out since this is intended behavior. Enjoy Xcode 12!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Exclude Apollo Playground from the main project file to make Carthage faster","author":{"__typename":"User","login":"manicmaniac","id":"MDQ6VXNlcjE2NzIzOTM=","name":"Ryosuke Ito"},"body":"Apollo Playground, which introduced in Apollo 0.33.0 as [a scheme in Apollo.xcoderpoj](https://github.com/apollographql/apollo-ios/blob/0.33.0/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo%20Playground.xcscheme), makes Carthage build slower, and to make matters worse, building Apollo Playground fails in Xcode older than 12 (https://github.com/apollographql/apollo-ios/issues/1391).\r\n\r\nI guess most Apollo users don't want to build Apollo Playground at the time they install dependencies.\r\nHowever, Carthage doesn't provide a convenient way to exclude a specific scheme as discussed in https://github.com/Carthage/Carthage/issues/2529.\r\n\r\nSo to solve this problem, could you exclude Apollo Playground scheme from Apollo.xcodeproj and move it to another xcodeproj or another repo?\r\n\r\n```sh\r\n$ carthage bootstrap --platform iOS --no-use-binaries --cache-builds\r\n*** Checking out ApolloDeveloperKit at \"ce9fd3e1c75c074ae77632a8fe21be635219401b\"\r\n*** Checking out apollo-ios at \"0.33.0\"\r\n*** No cache found for apollo-ios, building with all downstream dependencies\r\n*** xcodebuild output can be found in /var/folders/tm/wy8sj46s6yq4rlfgsxyvd1l80000gn/T/carthage-xcodebuild.Plidos.log\r\n*** Building scheme \"Apollo\" in Apollo.xcodeproj\r\n*** Building scheme \"ApolloCore\" in Apollo.xcodeproj\r\n*** Building scheme \"Apollo Playground\" in Apollo.xcodeproj\r\nld Failed\r\n Task failed with exit code 65:\r\n /usr/bin/xcrun xcodebuild -project /Users/manicmaniac/Projects/manicmaniac/ApolloDeveloperKit/InstallTests/Carthage/Checkouts/apollo-ios/Apollo.xcodeproj -scheme Apollo\\ Playground -configuration Release -derivedDataPath /Users/manicmaniac/Library/Caches/org.carthage.CarthageKit/DerivedData/11.5_11E608c/apollo-ios/0.33.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/tm/wy8sj46s6yq4rlfgsxyvd1l80000gn/T/apollo-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/manicmaniac/Projects/manicmaniac/ApolloDeveloperKit/InstallTests/Carthage/Checkouts/apollo-ios)\r\n\r\nThis usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/tm/wy8sj46s6yq4rlfgsxyvd1l80000gn/T/carthage-xcodebuild.Plidos.log\r\nmake: *** [carthage] Error 1\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Have you tried using the [`carthage-build-workaround` script outlined in the release notes?](https://github.com/apollographql/apollo-ios/releases/tag/0.33.0) There's some other nonsense going on with Carthage that I think may be causing the build failures rather than this scheme. \r\n\r\nAs for time reduction, the problem is that if that scheme isn't shared, the playgrounds won't build because it needs different sub-libraries than any of the other schemes. \r\n\r\nI can't for the life of me figure out why Carthage is so against excluding schemes. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> Have you tried using the carthage-build-workaround script outlined in the release notes?\r\n\r\nAh, my bad 😓 \r\nWith the workaround script and Xcode 12, I confirmed it works.\r\n\r\n```sh\r\n$ ./carthage-build-workaround.sh\r\n/tmp/static.xcconfig.hvN4SB\r\n*** Fetching apollo-ios\r\n*** Checking out apollo-ios at \"0.33.0\"\r\n*** xcodebuild output can be found in /var/folders/tm/wy8sj46s6yq4rlfgsxyvd1l80000gn/T/carthage-xcodebuild.6GUdYX.log\r\n*** Building scheme \"Apollo\" in Apollo.xcodeproj\r\n*** Building scheme \"ApolloCodegenLib\" in Apollo.xcodeproj\r\n*** Building scheme \"Apollo Playground\" in Apollo.xcodeproj\r\n*** Building scheme \"ApolloSQLite\" in Apollo.xcodeproj\r\n*** Building scheme \"ApolloCore\" in Apollo.xcodeproj\r\n*** Building scheme \"ApolloWebSocket\" in Apollo.xcodeproj\r\n```","author":{"__typename":"User","login":"manicmaniac","id":"MDQ6VXNlcjE2NzIzOTM=","name":"Ryosuke Ito"}},{"__typename":"IssueComment","body":"Cool - do you mind if we close this out with the answer as \"No\" for removing the `Apollo Playground` scheme? I understand it's inconvenient, but it's not inconvenient that often. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yes, let me close this issue and thank you very much for your support 👍 ","author":{"__typename":"User","login":"manicmaniac","id":"MDQ6VXNlcjE2NzIzOTM=","name":"Ryosuke Ito"}}]}},{"__typename":"Issue","title":"Looking for recommendation for Pagination + Watching flow","author":{"__typename":"User","login":"bharath2020","id":"MDQ6VXNlcjkwMzUzNg==","name":null},"body":"_(Have this question [posted ](https://spectrum.chat/apollo/apollo-ios/looking-for-recommendation-to-perform-pagination-watch-in-ios-and-android-clients~a15afb8b-21fb-49a6-a80c-dd2ef097c8ad) in Spectrum chat as well, Adding here for better reach. Apologize for noise.)_\r\n\r\n# Problem\r\n\r\nWe have done some experiments in adopting pagination and encountered a few issues. I am looking for a recommendation on how to extract paginated results that do achieve two of my main goals. For the context, we have a mobile application that has screens that show paginated content that allows infinite vertical scrolling.\r\n\r\n1. Perform pagination in a responsible manner without any lag on the UI\r\n2. Ability to watch any changes to the items retrieved across all pages\r\n\r\nFor example, assume the following schema\r\n\r\n```\r\ntype PageResult {\r\n cursor: String\r\n hasMore: Bool\r\n items: [String]\r\n}\r\nquery {\r\n getItems(cursor: String): PageResult\r\n}\r\n```\r\n\r\nHere are the approaches we tried:\r\n\r\n## Approach 1: Follow the suggestion as per the [Apollo iOS tutorial blog](https://www.apollographql.com/docs/ios/tutorial/tutorial-pagination/)\r\n\r\n1. Load the first page with no cursor with cache policy that writes data back to the cache\r\n2. Load the second page with the cursor and follow the same for the next pages with cache policy that writes data back to the cache\r\n\r\n### Issues with Approach 1\r\n\r\n#### 1. Zombie records:\r\n\r\nFollowing the query path approach to generate cache key, the First page will be written under cache key \"QUERY\\_ROOT.getPage-cursor\", while subsequent pages will hold the items under the cache key \"QUERY\\_ROOT.getItems-cursor-page2cursor\", \"QUERY\\_ROOT.getItems-cursor-page3cursor\", and so on..\r\n\r\nIn our case, The page cursors are generated run time and only valid until the first page is refreshed again to get a new cursor. Following this approach, We notice that all the pages that were previously fetched will never be deleted after re-fetching the first page and hence get accumulated as the user fetches more pages and re-fetches leading to larger cache size over time. Not to mention the more number of records, the higher the read time.\r\n\r\n#### 2. Cannot watch updates to items from the second page onwards:\r\n\r\nWe want to set up a GraphQLQueryWatcher on the paginated query, such that any changes to the items, including items from all the pages retrieved so far. However, Looking at the implementation of the GraphQLQueryWatcher, it appears that with this approach, Watcher will notify only for the items returned from the first page since dependent keys for the watcher includes only keys from the first page.\r\n\r\n## Approach 2: Manually merge data from subsequent pages into the first page\r\n\r\nIn order to solve the Approach #1 Issue #2, We took inspiration from [Apollo react Pagination](https://www.apollographql.com/docs/react/data/pagination/#cursor-based) which does the following:\r\n\r\n1. Load the first page with no cursor with cache policy that writes data back to the cache\r\n2. Load the second page, and so on, with `fetchIgnoringCacheCompletely` cache policy and manually write the data into the First-page query.\r\n\r\n### Issues with Approach 2\r\n\r\n#### 1. Writes are slow\r\n\r\nAs we can notice in Step #2, we merge the previous page with data pulled from the next page and re-write the entire data back. As we fetch more pages, the write latency increases.\r\n\r\n#### 2 Latency of reading the first page exponentially increases\r\n\r\nSince we merge data from all pages into the first page, reading the first page exponentially increases based on the number of items present in the cache. This is more evident with queries that have an increasing number of attributes that are non-scalar data types in the query as the batch loader does round trip to the database for each attribute. With our sample of data, the read time for a query with medium complex schema has clocked 10 seconds to read 150 items on an iPhone XS device.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hey @bharath2020 - just a heads up that I'm bogged down at the moment but this is a *very* good question that I need to work on a better answer to (and that we should have a *way* better answer to overall for mobile), and I think messing around with the tutorial is probably a good place to start with it. And you are very correct that 10 seconds to read 150 items is 🤮. \r\n\r\nIn terms of what you can try while I'm digging out from under what I'm dealing with now, there's the `cacheKeyForObject` closure that you can use to generate a custom cache key. For most items you should be able to cache by ID, and that should avoid having to rewrite all the data if it's not necessary. \r\n\r\nI'm going to leave this open for the community to respond more - I know this has been done well, but my knowledge of details isn't there because I'm focused on other parts of the SDK at the moment. \r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks, @designatednerd for the response.\r\n\r\n> For most items you should be able to cache by ID, and that should avoid having to rewrite all the data if it's not necessary.\r\n\r\nInteresting. In approach #2, Given that I am appending items from `morePage` back to `firstPage` and issuing a re-write of data for the first-page query, I am curious how would the store understand to not overwrite data referencing items in the first page? In other words, I understand `cacheKeyForObject` would reduce the number of records written to the database, but even with normalized cache, there would be unnecessary overwrites (in this case the items in the first page) that would add to the write latency. Please correct me If I am wrong.\r\n\r\nP.S. I have cacheKeyForObject enabled in my sample, and timings were taken after. The only part where I would not be able to generate a cache key is for the `PageResult` type, as `cacheKeyForObject` does not expose the variables (or field arguments) used to generate the type, in this case, it is the `cursor` provided for `getItems(cursor:)` query.","author":{"__typename":"User","login":"bharath2020","id":"MDQ6VXNlcjkwMzUzNg==","name":null}},{"__typename":"IssueComment","body":"Again, my knowledge of the cache is not as deep as it should be, but my understanding is you'd be rewriting the references with IDs rather than the entire object and its entire tree of changes. This almost certainly has some unnecessary work, but it would likely constitute a lot *less* unnecessary work than without the `cacheKeyForObject`. \r\n\r\nAnd again, this is not working as well as we want it to. We have some changes to the cache slated for [phases 2 and 3 of the ongoing Swift codegen rewrite](https://github.com/apollographql/apollo-ios/issues/939), and making things less annoying for pagination is one of the major things I want to do within that work. \r\n\r\nWish I had a better answer for you. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Got it. I played a little bit with batch reading objects from the database. I will give it a try to see if we can do the batch updates within a transaction. Right now, each roundtrip to the SQLite database is in its own transaction and I am guessing that is causing the reads to slow down. I have in the past read a huge number of items from SQLite and latency was fine.\r\n\r\nI will see if it makes any difference in the same and post it back.","author":{"__typename":"User","login":"bharath2020","id":"MDQ6VXNlcjkwMzUzNg==","name":null}},{"__typename":"IssueComment","body":"OK - do you mind if we close out this issue? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Ok","author":{"__typename":"User","login":"bharath2020","id":"MDQ6VXNlcjkwMzUzNg==","name":null}}]}},{"__typename":"Issue","title":"It expected a JSON schema introspection result, but got an HTML response instead.","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null},"body":"Hello,\r\n\r\nI am trying to run a script first time but i am receiving below error. \r\n\r\n**Unexpected token < in JSON at position 0\r\n Error: Apollo tried to introspect a running GraphQL service at \r\n http://10.10.10.10/graphql\r\n It expected a JSON schema introspection result, but got an HTML response \r\n instead.\r\n You may need to add headers to your request or adjust your endpoint url.**\r\n\r\nHere is my Script\r\n\r\n # Type a script or drag a script file from your workspace to insert its path.\r\n # Go to the build root and search up the chain to find the Derived Data Path where the source packages are checked out.\r\n DERIVED_DATA_CANDIDATE=\"${BUILD_ROOT}\"\r\n\r\n while ! [ -d \"${DERIVED_DATA_CANDIDATE}/SourcePackages\" ]; do\r\n if [ \"${DERIVED_DATA_CANDIDATE}\" = / ]; then\r\n echo >&2 \"error: Unable to locate SourcePackages directory from BUILD_ROOT: '${BUILD_ROOT}'\"\r\n exit 1\r\n fi\r\n\r\n DERIVED_DATA_CANDIDATE=\"$(dirname \"${DERIVED_DATA_CANDIDATE}\")\"\r\n done\r\n\r\n # Grab a reference to the directory where scripts are checked out\r\n SCRIPT_PATH=\"${DERIVED_DATA_CANDIDATE}/SourcePackages/checkouts/apollo-ios/scripts\"\r\n\r\n if [ -z \"${SCRIPT_PATH}\" ]; then\r\n echo >&2 \"error: Couldn't find the CLI script in your checked out SPM packages; make sure to add the framework to your project.\"\r\n exit 1\r\n fi\r\n\r\n #cd \"${SRCROOT}/${TARGET_NAME}\"\r\n #\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=\"schema.json\" API.swift\r\n\r\n SCRIPT_PATH=\"${PODS_ROOT}/Apollo/scripts\"\r\n cd \"${SRCROOT}/${TARGET_NAME}\"\r\n \"${SCRIPT_PATH}\"/run-bundled-codegen.sh schema:download --endpoint=http:///graphql schema.json\r\n\r\nXCode Version : 11.3.1\r\nApollo : 0.24.1\r\nInstalled Apollo pod.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi, it looks like the endpoint hasn't had the `` placeholder replaced yet - the `http:///graphql` in your error message makes it look like that's just being stripped out entirely by the CLI. \r\n\r\nUnrelated to your immediate issue, I would strongly recommend running `schema:download` before running `codegen:generate` since codegen uses the result of downloading the schema. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"As of now i am trying to download schema.json from CLI with the following command.\r\n\r\n`apollo schema:download --endpoint=http:///graphql schema.json\r\n`\r\n\r\nBut still i am getting the same error. I didnt get placeholder (in your comment, can you please clarify)\r\n\r\nI have updated my question where i written down a dummy server url","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}},{"__typename":"IssueComment","body":"Hey I am able to download schema.json file from other public graphql url.\r\n\r\nBut now i am facing another error. I am using POD for apollo now.\r\n\r\nRun Script : \r\n\r\n`SCRIPT_PATH=\"${PODS_ROOT}/Apollo/scripts\"\r\ncd \"${SRCROOT}/${TARGET_NAME}\"\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=\"schema.json\" API.swift\r\n`\r\n\r\nError :\r\n\r\nLoading Apollo Project [started]\r\nLoading Apollo Project [completed]\r\nGenerating query files [started]\r\nGenerating query files with 'swift' target [title changed]\r\nGenerating query files with 'swift' target [failed]\r\n→ Apollo does not support anonymous operations\r\n GraphQLError: Apollo does not support anonymous operations\r\nCommand PhaseScriptExecution failed with a nonzero exit code\r\n\r\n\r\nIf its not legal then can i raise new issue with this error and close this one","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}},{"__typename":"IssueComment","body":"You need to make sure you give your query a name - otherwise the codegen won't know what name to give the class containing the query. \r\n\r\nSo it has to look like this: \r\n\r\n```graphql\r\nFetchUser($id: ID!) {\r\n user(id: $id) {\r\n name\r\n [etc]\r\n }\r\n}\r\n```\r\n\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks.. this works.","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}},{"__typename":"IssueComment","body":"Hello, \r\n\r\nI am receiving this error right now.\r\n\r\nERROR : Received error response: Field \"country\" argument \"code\" of type \"ID!\" is required, but it was not provided.\r\n\r\nGraphQL : https://countries.trevorblades.com/graphql\r\n\r\nQuery : \r\n\r\n query AllCountry {\r\n country {\r\n name\r\n }\r\n }\r\n\r\niOS Swift Code : \r\n\r\n NetworkClient.sharedInstance().fetch(query: AllCountryQuery()) { result in\r\n \r\n switch result {\r\n case .success(let GraphQLResult) :\r\n print(GraphQLResult.data?.country as Any)\r\n \r\n \r\n \r\n case .failure(let error) :\r\n print(\"ERROR :\", error.localizedDescription)\r\n }\r\n }\r\n","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}},{"__typename":"IssueComment","body":"I think the error is telling you exactly what the problem is: `Field \"country\" argument \"code\" of type \"ID!\" is required, but it was not provided.` You need to make sure you're passing in a country code for this query.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Fixed. Thanks","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}}]}},{"__typename":"Issue","title":"Swift Package Manager + Xcode 12.0: Target 'arm64-apple-ios-simulator' missing","author":{"__typename":"User","login":"jzeisweiss","id":"MDQ6VXNlcjQyNjEyNTg=","name":"Jimmy Zeisweiss"},"body":"Hello,\r\n\r\nI can no longer use \"Preview\" for SwiftUI or build to a simulator due to the following error.:\r\n\r\n```\r\nerror: could not find module 'Apollo' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64\r\nimport Apollo\r\n```\r\n**Xcode Version**: 12.0 (12A7209)\r\n**Apollo Version**: 33.0\r\n\r\n_Note: I am having no problem building to a device._","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"@jzeisweiss Hi, what package manager are you using? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd - Hey Ellen, I am using Swift Package Manager.","author":{"__typename":"User","login":"jzeisweiss","id":"MDQ6VXNlcjQyNjEyNTg=","name":"Jimmy Zeisweiss"}},{"__typename":"IssueComment","body":"Are you using it on the Developer Transition Kit (I ask since it's looking for the `arm64-apple-ios-simulator` slice)? They took all the Apple Silicon stuff out of 12.0 and put it back in the 12.2 beta, so you'd need to use that if you are. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I am not using the Silicon ARM-Based prototype Mac from the Developer Transition Kit. I am using a 2018 Mac Mini and a 2018 MacBook Pro. However, I did find a workaround. I went in and changed the project settings to:\r\n\"Build Settings\" > \"Build Active Architecture Only\" > Set to \"YES\". This fixed my issue and I can now see the SwiftUI previews as well as build to simulators. Thank you for the speedy responses!\r\n\r\n**Source**: https://stackoverflow.com/questions/56957632/could-not-find-module-for-target-x86-64-apple-ios-simulator","author":{"__typename":"User","login":"jzeisweiss","id":"MDQ6VXNlcjQyNjEyNTg=","name":"Jimmy Zeisweiss"}},{"__typename":"IssueComment","body":"Ah yeah, that'll do it for sure - thank you for sharing your fix! Do you mind if we close this issue out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Networking Beta: Convenience constructors for HTTPRequest and JSONRequest","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"},"body":"In my use case i have to append to the `URLRequest.query` before a request is actually sent and that was fairly straight forward with the old network stack using `HTTPNetworkTransportPreflightDelegate.networkTransport(_:willSend:)` \r\n\r\nWith the new network stack things have gotten a bit more complex but i was able to come up with a solution involving a custom `ApolloInterceptor` that turns a given `JSONRequest` into a custom subclass which overrides `toURLRequest()`.\r\n\r\nSo to make implementation of custom HTTPRequests more easy i suggest you to add some convenience constructors for `HTTPRequest` and `JSONRequest` that take a single argument of their own type. This would let me get rid of this bunch of constructor arguments like this:\r\n\r\n```\r\n let customRequest = CustomJSONRequest(jsonRequest)\r\n```\r\n\r\ninstead of this:\r\n``` \r\n let customRequest = CustomJSONRequest(\r\n operation: jsonRequest.operation,\r\n graphQLEndpoint: jsonRequest.graphQLEndpoint,\r\n contextIdentifier: jsonRequest.contextIdentifier,\r\n clientName: jsonRequest.additionalHeaders[\"apollographql-client-name\"] ?? \"\",\r\n clientVersion: jsonRequest.additionalHeaders[\"apollographql-client-version\"] ?? \"\",\r\n additionalHeaders: jsonRequest.additionalHeaders,\r\n cachePolicy: jsonRequest.cachePolicy,\r\n autoPersistQueries: jsonRequest.autoPersistQueries,\r\n useGETForQueries: jsonRequest.useGETForQueries,\r\n useGETForPersistedQueryRetry: jsonRequest.useGETForPersistedQueryRetry,\r\n requestCreator: jsonRequest.requestCreator\r\n )\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"The override is the correct way of doing this - I'm not quite clear why the `super init`, which has a bunch of default parameters, isn't the way you're doing this, though. Can you go into a bit more detail on that? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"When looking for a way to get my `CustomHTTPRequest` with its overriden `toURLRequest()` into place i learned about the concept of `ApolloInterceptor` in the new network stack architecture.\r\n\r\nTherefore i have implemented a custom interceptor to replace the original `HTTPRequest` instance with one of `CustomHTTPRequest` as a substitution. Basically what i'm trying to do here is to create a copy of the request _with whatever particular values its properties have_ but extend its original functionality.\r\n\r\nIf there is something i have misunderstood or a better approach to achive this i'm glad to get enlighted.","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"}},{"__typename":"IssueComment","body":"OK! I think I see what the problem is here: While the `RequestChain` can take an arbitrary subclass of `HTTPRequest`, there's no way to say \"You should use this specific subclass\" from the level of the `RequestChainNetworkTransport`, so as of right now you're having to recreate the request at the interceptor level. \r\n\r\nIt sounds like the issue is that there needs to be a way to specify the request type that's customizable at that level, so that you can actually use the custom type you've created. \r\n\r\nDoes that sound accurate? I'm gonna poke at some ideas on this. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Indeed, if subclassing `HTTPRequest` is the intended way to go, a more simple way to place that type into the processing is greatly appreciated.","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"}},{"__typename":"IssueComment","body":"@knox Please see #1405 . You may have opened a trapdoor to a bigger change but it's a good one 😄 ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Wow i didn't mean to ask for moving mountains but opening `RequestChainNetworkTransport` and `constructRequest(for:cachePolicy:contextIdentifier:)` seems to perfectly fit my needs.","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"}},{"__typename":"IssueComment","body":"Haha, this worked as designed: You pointed out that I hadn't provided an access point to something, so I added it. Then by adding it I realized something else that was annoying me could change. 😇","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"With 0.34.0-rc.2 i was able to implement a clean and simple solution to my use case.","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"}}]}},{"__typename":"Issue","title":"Download Schema.json but server has CSRF Token protection","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null},"body":"Hello,\r\n\r\nI want to download a schema.json file but our server is protected with CSRF Token so which command i need to use to download a schema file and how can i send --header with CSRF token (From where i can get CSRF token means from our server guy or is apollo-client give/generate for downloading schema & passing in --header) ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! Please check out the instructions for [doing this in Bash](https://www.apollographql.com/docs/ios/downloading-schema/) and/or [doing this with the Swift Scripting tools](https://www.apollographql.com/docs/ios/swift-scripting/#downloading-a-schema). Do those docs answer your questions? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi! Since this is pretty clearly documented and I haven't heard anything back in a week, I'm going to close this out - @tapannathvani if you're still having problems please reopen. Anyone else having similar problems, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"is apollo provide internet check class?","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null},"body":"I am trying to check internet connection in my project.. and looking in apollo-ios library also like if you guys providing any reachability type class so without adding any other library or framework i can use your class to check connection\r\n\r\nIf yes then please provide documentation link and if not then please let me know how can i achieve this? and can i check internet connectivity in HTTPNetworkTransportPreflightDelegate (will send) method or in should send method? ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"We do not provide an internet check class, nor do we have plans to do so. \r\n\r\nIf you're using iOS 12 and above, the recommend way of doing things is [using `NWPathMonitor`](https://medium.com/@rwbutler/nwpathmonitor-the-new-reachability-de101a5a8835). If you're storing the most recent result from `NWPathMonitor` the preflight delegate would be a reasonable place to check it. \r\n\r\nPlease note that the Preflight delegate will be going away with `0.34.0` - you can check out the updated networking beta in #1386, and the PR has links to updated documentation. It would probably be fairly easy to add an interceptor that does that network check in the new networking stack. \r\n\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Can we know when can we have 0.34.0?","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}},{"__typename":"IssueComment","body":"Release candidate 2 is available now, gonna let it bake over the weekend and put it out monday night (US-Central time) if I don't hear any major showstoppers.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks for the quick response.","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}}]}},{"__typename":"Issue","title":"No such file or directory: run-bundled-codegen.sh","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null},"body":"I imported via cocoa pods the Apollo, actually it installed 0.30. \r\n\r\nI added exactly the same script as here:\r\nhttps://www.apollographql.com/docs/ios/installation/#troubleshooting \r\nschema.json is under project folder, under the target folder name.\r\nBut I keep receiving:\r\n![image](https://user-images.githubusercontent.com/6308120/94440933-75588f80-01a2-11eb-8095-c1d6862880b1.png)\r\nActually there is no data on SourcePackages folder about Apollo scripts.\r\n\r\nCould you help me?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi, it looks like you're using the Swift Package Manager run script rather than the CocoaPods run script [outlined in this step of the setup instructions](https://www.apollographql.com/docs/ios/installation/#adding-a-code-generation-build-step), because the CocoaPods script should be looking in `Pods/apollo-ios/scripts` rather than doing the weird dance of diving through derived data that the SPM script has to do.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"OMG!!! True. Wee can close the ticket!!!! ","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null}}]}},{"__typename":"Issue","title":"How to inject HTTP headers before fetching a query","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null},"body":"Do you know a mechanism to do that?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"This is covered in the [Advanced Client Creation](https://www.apollographql.com/docs/ios/initialization/) section of our docs. \r\n\r\nFair warning that this will be changing significantly very soon with the release of what's now in RC for #1386 (which I'm hoping to release tonight). The PR has a link to the updated docs for advanced client creation as well. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Error not parsed","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null},"body":"Hi,\r\n\r\nI have a GraphQL which is returning the following:\r\n![image](https://user-images.githubusercontent.com/6308120/94543867-da67c000-024a-11eb-803f-e76731c18064.png)\r\nBut the generated code is not parsing the error, but just giving data:\r\n![image](https://user-images.githubusercontent.com/6308120/94543972-fa977f00-024a-11eb-8689-7fa93a3d05f9.png)\r\nCould you help to identify how to get the errors?\r\n\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Weird - that does look like properly formatted JSON for the error - can you confirm what version of the SDK, Xcode, and Swift you're using here? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"SDK 0.33.0\r\nXcode 11.5 \r\nSwift 5","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null}},{"__typename":"IssueComment","body":"I've got no idea why that's not parsing the error - I put a test together and this is passing (different `\"data\"` key name since I'm using a local type for this test): \r\n\r\n```swift\r\nfunc testGH1415() throws {\r\n let json = \"\"\"\r\n{\r\n \"data\": {\r\n \"hero\": null\r\n },\r\n \"errors\": [\r\n {\r\n \"message\": \"Exception while fetching data (lastViewedProducts) : Customer not logged in\",\r\n \"locations\": [\r\n {\r\n \"line\": 2,\r\n \"column\": 3\r\n }\r\n ],\r\n \"path\": [\r\n \"lastViewedProducts\"\r\n ],\r\n \"extensions\": {}\r\n }\r\n ]\r\n}\r\n\"\"\"\r\n let data = try XCTUnwrap(json.data(using: .utf8),\r\n \"Couldn't create json data\")\r\n \r\n let deserialized = try JSONSerializationFormat.deserialize(data: data)\r\n let jsonObject = try XCTUnwrap(deserialized as? JSONObject)\r\n let response = GraphQLResponse(operation: HeroNameQuery(), body: jsonObject)\r\n \r\n let result = try response.parseResultFast()\r\n XCTAssertNil(result.data)\r\n XCTAssertNotNil(result.errors)\r\n \r\n let error = try XCTUnwrap(result.errors?.first)\r\n XCTAssertEqual(error.message, \"Exception while fetching data (lastViewedProducts) : Customer not logged in\")\r\n XCTAssertEqual(error.locations, [\r\n GraphQLError.Location(line: 2, column: 3),\r\n ])\r\n XCTAssertNotNil(error.extensions)\r\n}\r\n```","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Overwrite whole cache after fetch.","author":{"__typename":"User","login":"pgawlowski","id":"MDQ6VXNlcjk4NDUwMjQ=","name":null},"body":"Hello again.\r\n\r\nMy application is trying to archive offline first mode.\r\nWe are using BigQuery to fetch all the data required for app to be usable and focus on offline cache mutations with custom made syc feature. \r\n\r\nThe problem is that after synchronization we are trying to refresh whole cache data. Some of our tasks can fail, most will be successful.\r\nTo avoid too much noise with cache handling, right after syc we are refetching BigQuery once again. \r\nAnd here is our problem. Mutations we performed in offline mode are still present, no matter the fact of success of failure during sync it is because backend is creating it's own unique ID's here and we are just generating UUID as a placeholder. The source of truth is server. So in case of BigQuery fetch I would like to totally teardown current cache and recreate it with BigQuery result.\r\n\r\nCalling clearCache before BigQuery seems to be a little bit risky. I mean there is a risk of loosing data if sth goes wrong with BigQuery.\r\n\r\nAny ideas how to handle?\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Oof, that's a tough one. This is part of why sync is so hard (and frankly why I have zero interest in handling it on our end). \r\n\r\nThe first thing that jumps to mind is making a second instance of whatever cache you're using, swapping in a store with that cache, and then putting the old one back if things fail. I won't say that won't be a giant pain, but off the top of my head that's at least something that will keep the old data in case your `BigQuery` fails. \r\n\r\nLike I said though, sync is really hard. I don't think there's going to be a simple, straightforward solution to this problem. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@pgawlowski Anything else I can help with here or do you mind if I close this out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Since I haven't heard back in a week, I'm going to close this out. @pgawlowski feel free to reopen if you have more questions - anyone else with similar problems, please open a separate issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Question about ApolloInterceptor","author":{"__typename":"User","login":"dchohfi","id":"MDQ6VXNlcjUwODYzNg==","name":"Diego Chohfi"},"body":"Hey, amazing rewrite of the http architecture, good naming and nice usage of open/close principles.\r\n\r\nJust one stuff, I'm not sure how many times the `interceptAsync` method gets called, as it receives both request and an option response, I think this will be called twice, I'm correct?\r\n\r\nIf this is correct, talking about an interceptor that adds authentication token to the request, might be better to check if we don't have the response yet? Should I only add the token if the response is nil?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Each interceptor is called once - they're called in sequence based on the order of the array passed in from the `InterceptorProvider`. So if you want to put a token in, you can probably just add the token adding interceptor to the beginning of that array. \r\n\r\nYou can see an example of this in the [updated tutorial here](https://www.apollographql.com/docs/ios/tutorial/tutorial-mutations/#add-authentication-handling).","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"So the interceptor isn't called before each request and after each response?","author":{"__typename":"User","login":"dchohfi","id":"MDQ6VXNlcjUwODYzNg==","name":"Diego Chohfi"}},{"__typename":"IssueComment","body":"Thank your for your response! Now I get it, sorry about that.","author":{"__typename":"User","login":"dchohfi","id":"MDQ6VXNlcjUwODYzNg==","name":"Diego Chohfi"}}]}},{"__typename":"Issue","title":"JSONRequest losing headers when useGETForQueries is true","author":{"__typename":"User","login":"dchohfi","id":"MDQ6VXNlcjUwODYzNg==","name":"Diego Chohfi"},"body":"## Bug report\r\n\r\nAfter migrating my project to the new version, I'm not able to use a service that has authentication via header.\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.0\r\n- Xcode version: 12.0.1\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nCreate an interceptor that adds a header to the request, the NetworkTransporter must have `useGETForQueries=true`.\r\n\r\n## Further details\r\n\r\nWhen the method `toURLRequest` gets called, the request gets recreated and all headers are lost, including the defaults added by apollo. After digging into the code, I found that the library is instantiating a new `URLRequest` instead of just changing the URL.\r\n\r\nhttps://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/JSONRequest.swift#L101","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I would love to send a PR to fix it, just want to confirm first if this is what is happening.","author":{"__typename":"User","login":"dchohfi","id":"MDQ6VXNlcjUwODYzNg==","name":"Diego Chohfi"}}]}},{"__typename":"Issue","title":"Massive API.swift file ","author":{"__typename":"User","login":"RomanTysiachnik","id":"MDQ6VXNlcjMxNjUyMjY1","name":"Roman Tysiachnik"},"body":"## Feature request\r\n\r\nGenerate each query, mutation, fragment and scalar type in a separate file.\r\n\r\n## Motivation\r\n\r\nWe use Apollo in production on a pretty large project.\r\nRight now our generated `API.swift` file is almost 10 Mb and it has 255,000+ lines of code.\r\nAfter we create a new query/mutation, the file may be overwritten completely, that it is impossible to understand anything in git. \r\nMoreover, Xcode freezes for about a minute when we try to open that single file.\r\n\r\n| Code | Git mess |\r\n| :--: | :--: | \r\n| \"Screen | \"Screen |\r\n\r\n\r\n## Proposed solution\r\n\r\nAs far as all requests and types are public classes, it shouldn't be hard to put each of them in a separate file.\r\nAll those files can also be sorted in folders to make it much easier to navigate through the API.\r\nAPI ->\r\n--Scalars ->\r\n----Upload.swift\r\n--Fragments ->\r\n----UserFragment.swift\r\n--Queries ->\r\n----UserQuery.swift ->\r\n--Mutations ->\r\n----CreateUserMutation.swift\r\n\r\n#### Benefits\r\n\r\n- Each request/type in a separate file and it is easy to navigate among them;\r\n- No freezes when you accidentally open an API file and it freezes Xcode for minutes.\r\n- Only new updates of the API in source control. \r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"If you provide a folder path instead of a file path to the generate command, it will do exactly this: a separate file for everything.","author":{"__typename":"User","login":"TizianoCoroneo","id":"MDQ6VXNlcjE1MzQwMzgy","name":"TizianoCoroneo"}},{"__typename":"IssueComment","body":"@TizianoCoroneo \r\n\r\nCould you share an example, please? ","author":{"__typename":"User","login":"RomanTysiachnik","id":"MDQ6VXNlcjMxNjUyMjY1","name":"Roman Tysiachnik"}},{"__typename":"IssueComment","body":"This is the script as is in [the docs](https://www.apollographql.com/docs/ios/installation/):\r\n```bash\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=\"schema.json\" API.swift\r\n```\r\n\r\nIf you make a folder named `API` just next to your `API.swift` file, and then remove the `.swift` extension from the last argument of the script, it should work:\r\n```bash\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=\"schema.json\" API/\r\n```","author":{"__typename":"User","login":"TizianoCoroneo","id":"MDQ6VXNlcjE1MzQwMzgy","name":"TizianoCoroneo"}},{"__typename":"IssueComment","body":"I'm using Swift scripting to generate API from this [doc](https://www.apollographql.com/docs/ios/swift-scripting/):\r\n```swift\r\nApolloCodegen.run(\r\n from: queriesURL,\r\n with: apolloCLIURL,\r\n options: Options.codegen\r\n )\r\n```\r\n\r\nAnd I couldn't find a way to get rid of that massive file.","author":{"__typename":"User","login":"RomanTysiachnik","id":"MDQ6VXNlcjMxNjUyMjY1","name":"Roman Tysiachnik"}},{"__typename":"IssueComment","body":"Ok. I guess I've managed how to handle that, there's another `init` that allows you to specify output format:\r\n\r\n```swift\r\nlet operationIDsURL = outputURL\r\n .appendingPathComponent(\"operationIDs.json\")\r\n\r\nlet schemaURL = outputURL\r\n .appendingPathComponent(\"schema.json\")\r\n\r\n ApolloCodegenOptions(\r\n codegenEngine: .default,\r\n operationIDsURL: operationIDsURL,\r\n outputFormat: .multipleFiles(inFolderAtURL: outputURL),\r\n urlToSchemaFile: schemaURL\r\n )\r\n```\r\n\r\nClosing the issue :) ","author":{"__typename":"User","login":"RomanTysiachnik","id":"MDQ6VXNlcjMxNjUyMjY1","name":"Roman Tysiachnik"}},{"__typename":"IssueComment","body":"So, I'm noticing we're getting massive differences in file sizes from the generated output depending on if we use the `apollo codegen:generate` command through the NPM installed CLI vs. the **SwiftCodegenLib**.\r\n\r\nLike... one of our files is almost 20mb from **SwiftCodegenLib** but 224kb from the NPM CLI.\r\n\r\nWhat could be causing such as massive difference?","author":{"__typename":"User","login":"Mordil","id":"MDQ6VXNlcjM1MDY3NzY=","name":"Nathan Harris"}},{"__typename":"IssueComment","body":"I just compared the commands, and it looks like the default `mergeInFieldsFromFragmentSpreads: true` is the source of the \"bloat\".\r\n\r\nWhat is the cost/benefit of having that set to `true`, as it is by default?","author":{"__typename":"User","login":"Mordil","id":"MDQ6VXNlcjM1MDY3NzY=","name":"Nathan Harris"}},{"__typename":"IssueComment","body":"I'm very surprised to hear it's causing that big a jump. `mergeInFieldsFromFragmentSpreads` ensures that fields in spreads (the `...BlahFragment` operator) are actually on the returned object. It basically is the difference between calling `object.propertyFromFragment` and `object.fragment.propertyFromFragment` on literally everything, which can get REAL old. \r\n\r\n@Mordil you've got my email, can you send me before/after of your API.swift so i can validate assumptions? \r\n\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"In our codebase adding the `mergeInFieldsFromFragmentSpreads` option causes 220k+ lines of code to appear, mostly:\r\n- getter/setters for each property in the fragment\r\n- memberwise initializers that are omitted if a type contains a fragment (I found this behavior quite surprising; I would prefer to always have `init`s for testing purposes)\r\n\r\n(I have to admit that we overuse fragments, and that's the main culprit.)\r\n\r\nMight be interesting to use [dynamic member lookup with keypaths](https://www.avanderlee.com/swift/dynamic-member-lookup/) to reduce code bloat, so that the enclosing type can refer dynamically to the properties of the enclosed fragment. I guess this road will be explored in the context of the new Swift Codegen though, right?","author":{"__typename":"User","login":"TizianoCoroneo","id":"MDQ6VXNlcjE1MzQwMzgy","name":"TizianoCoroneo"}},{"__typename":"IssueComment","body":"Yes. Also representing fragments as protocols means that you can have the properties straight on the object without duplication. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Query watcher not being called when cache is updated on an element by another query/subscription/mutation","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"},"body":"## Bug report\r\n\r\nQuery watcher not being called when cache is updated on an element of a collection that is added after calling watch\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.0\r\n- Xcode version: 12.0.1\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nI've been trying a lot of things on that one and wasn't able to find a way to fix my problem. So in my app I'm having a list of conversations, so I'm creating a `watch` on a query that returns the list of conversations, this is something like that:\r\n\r\n```\r\nuser {\r\n uuid\r\n firstName\r\n lastName\r\n conversations {\r\n uuid\r\n unreadMessagesCount\r\n }\r\n}\r\n```\r\n\r\n> In the app we use the `uuid` key to handle cache, so we make sure to always pass `uuid` in our queries to automatically handle cache update.\r\n\r\nSo the role of the watcher I'm talking about is both to update existing conversations and also be able to catch when a new conversation is created (it can happen and not be initiated by the user, we then trigger an event from the backend that is listen from a subscription in the app). When this event happens it returns something like that\r\n\r\n```\r\nevent {\r\n newConversation {\r\n conversation {\r\n uuid\r\n unreadMessagesCount\r\n // This is the part that adds the new conversation to the existing ones of the users in the cache\r\n user {\r\n uuid\r\n conversations {\r\n uuid\r\n unreadMessagesCount\r\n }\r\n } \r\n }\r\n }\r\n}\r\n```\r\n\r\nIt works great, meaning that when this event happens, the watcher is being called with the newly created conversation, but the issue is that any new cache update for that specific conversation doesn't trigger the watcher again.\r\n\r\nAfter investigating a bit, I realised that the cache is being updated because if I'm adding 3 new messages into the new conversation (setting the `unreadMessagesCount` to 3), the watcher doesn't get called but then if I add 1 new message into an old one, the watcher is being called with both the new message on the old conversation and the 3 new on the new one. \r\n\r\nSo it really seems like `watch` is not being called again for changes on an item that wasn't in a collection when the `watch` was initially made. I've also take a look at https://github.com/apollographql/apollo-ios/issues/281 and making a `fetch` on the same query again after the event doesn't fix the issue.\r\n\r\nLet me know if I'm not clear on something as the whole thing is a bit complicated to explain.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"To add more to this, I feel like this is not related to collections only. If you have 1 query that watches something, then another query/mutation updates this cache indirectly (not using the same query, but another query that contains the same element with the same `uuid`), it doesn't work.","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"Do you have any thoughts on why the test that was added would be passing, but what you're working with would not be working?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'm afraid no, but all I can tell is that it works with 0.32.0 and not with 0.34.0","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"Hi @designatednerd,\r\n\r\nI think I have the same problem but not on a collection. My watcher is not triggered anymore since I have updated Apollo from 0.31.0 to 0.34.1. I have a watcher in cachePolicy .returnCacheDataAndFetch on this Query.\r\n\r\n```\r\nquery GetRide($rideId: ID!) {\r\n ride(id: $rideId) {\r\n ...EndRideFragment\r\n }\r\n}\r\n```\r\n\r\nAnd I have a mutation that updates my cache and normally triggers my watcher.\r\n```\r\nmutation StopRide($input: StopActiveRideInput!) {\r\n stopActiveRide(input: $input) {\r\n ride {\r\n ...EndRideFragment\r\n }\r\n }\r\n}\r\n```\r\nSince my Apollo pod upgrade, not working anymore. My watcher is not triggered when mutation payload updates my cache.","author":{"__typename":"User","login":"Narayane","id":"MDQ6VXNlcjQ5MjEzMDg=","name":"Sébastien BALARD"}},{"__typename":"IssueComment","body":"This is also occurring for me. 0.33.0 (non beta) worked; but not 0.34.0 or 0.34.1","author":{"__typename":"User","login":"dhritzkiv","id":"MDQ6VXNlcjEzNDk4NjU=","name":"Daniel Hritzkiv"}},{"__typename":"IssueComment","body":"@dhritzkiv That makes sense, the network stack and how it interacts with the cache changed completely in 0.34.0. \r\n\r\nApologies, I've been under the weather. I'm gonna do some digging starting tomorrow to try to figure out how I broke this without breaking the tests 🙃","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"No rush from me! I was able to roll back to 0.33.0 no problem","author":{"__typename":"User","login":"dhritzkiv","id":"MDQ6VXNlcjEzNDk4NjU=","name":"Daniel Hritzkiv"}},{"__typename":"IssueComment","body":"I can wait 1 week to have feedback from you @designatednerd on this issue.\r\nIf you need more time to investigate or to solve it, I could roll back to 0.33.0 to avoid blocking me in production","author":{"__typename":"User","login":"Narayane","id":"MDQ6VXNlcjQ5MjEzMDg=","name":"Sébastien BALARD"}},{"__typename":"IssueComment","body":"Same here, I rollbacked to 0.32.1 so no rush from me, and thanks for taking time investigating this!","author":{"__typename":"User","login":"benoitletondor","id":"MDQ6VXNlcjg2ODA1NA==","name":"Benoit Letondor"}},{"__typename":"IssueComment","body":"I'm trying to reproduce this issue to investigate what could be going on, but it's been hard because unfortunately our tests aren't set up to run in real life conditions, where concurrency may play a role. The existing watcher tests all continue to pass, and so do some new ones I've been adding.\r\n\r\nIt would be helpful to learn more about the way people who experience this are using the framework, and what behavior they are seeing:\r\n- How are you initializing and configuring the client, cache, store and network transport?\r\n- Are you calling methods on `ApolloClient` from the main thread or from a background thread? Do you receive results on the main queue as well, or are you passing in a custom queue?\r\n- Does the issue occur 100% of the time, or only sometimes?\r\n- Are there other operations in flight when this happens, or does it also happen with just a single watcher and a single related query or mutation?\r\n- Anything else unusual or noticeable?\r\n\r\nI know this is a long shot, but it would be even more helpful if anyone was able to share a project that reliably exhibits this issue.","author":{"__typename":"User","login":"martijnwalraven","id":"MDQ6VXNlcjU0NDg1","name":"Martijn Walraven"}},{"__typename":"IssueComment","body":"A few more thoughts after taking a closer look at this:\r\n\r\n1) It seems any operations using the `WebSocketTransport` always ignore the cache completely starting in 0.33 (I believe https://github.com/apollographql/apollo-ios/commit/444c465671c786659599a16da4b2d23d43648a74 is where this change was introduced). That means subscription results are not actually published to the store, and thus will not trigger watchers. (@benoitletondor I think that would at least explain your initial bug report).\r\n\r\n2) That doesn't yet explain why queries and mutations would also fail to trigger watchers (assuming those are not using the `WebSocketTransport`). There is a possibility for misconfiguration however, which would lead to inadvertently having multiple stores (see https://github.com/apollographql/apollo-ios/issues/1438). Could some of you be bitten by this maybe?\r\n\r\n3) Using a custom `NetworkTransport` also currently ignores the cache completely (see https://github.com/apollographql/apollo-ios/pull/1442 for an in progress PR to work around this). Any chance this could explain the behavior some of you are seeing?","author":{"__typename":"User","login":"martijnwalraven","id":"MDQ6VXNlcjU0NDg1","name":"Martijn Walraven"}},{"__typename":"IssueComment","body":"I'm not using WebSocketTransport, but 3. sound like it could be what's plaguing us! Will have some time in two weeks to poke around that","author":{"__typename":"User","login":"dhritzkiv","id":"MDQ6VXNlcjEzNDk4NjU=","name":"Daniel Hritzkiv"}},{"__typename":"IssueComment","body":"@martijnwalraven I guess 3. could be an explanation in my case, I have a custom `NetworkTransport` implementation (http request headers additions, checks on http response)\r\n\r\n`public func send(operation: Operation, completionHandler: @escaping (_ result: Result, Error>) -> Void) -> Cancellable` in 0.33\r\n\r\nbecomes\r\n\r\n`public func send(operation: Operation, cachePolicy: CachePolicy, contextIdentifier: UUID?, callbackQueue: DispatchQueue, completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable where Operation : GraphQLOperation` in 0.34\r\n\r\nI need to change\r\n```\r\ndo {\r\n let body = try self.serializationFormat.deserialize(data: data) as! JSONObject\r\n let response = GraphQLResponse(operation: operation, body: body)\r\n completionHandler(.success(response))\r\n} catch { }\r\n```\r\ninto\r\n```\r\ndo {\r\n let body = try self.serializationFormat.deserialize(data: data) as! JSONObject\r\n let response = GraphQLResponse(operation: operation, body: body)\r\n let result = try response.parseResultFast()\r\n completionHandler(.success(result))\r\n} catch { }\r\n```\r\nto try to conform my code to the new signature","author":{"__typename":"User","login":"Narayane","id":"MDQ6VXNlcjQ5MjEzMDg=","name":"Sébastien BALARD"}}]}},{"__typename":"Issue","title":"Why the response is not being triggered and no interceptors are dispatched?","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null},"body":"I'm building the client like this:\r\n![image](https://user-images.githubusercontent.com/6308120/94703838-90143b00-033f-11eb-8033-3f2727a09fbe.png)\r\nThis is my Interceptor Provider:\r\n![image](https://user-images.githubusercontent.com/6308120/94703879-9c989380-033f-11eb-8fab-ea802d571565.png)\r\nAnd this is an example of the query fetch:\r\n![image](https://user-images.githubusercontent.com/6308120/94703946-aae6af80-033f-11eb-93aa-b7670cb5c41d.png)\r\nIt is never stopping at result or at any interceptor, but console is dispatching:\r\n![image](https://user-images.githubusercontent.com/6308120/94704042-c81b7e00-033f-11eb-9ca7-ad9b833251b2.png)\r\n\r\nDo you have any idea what is wrong there?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"You are not actually including anything that calls the network, it looks like. You will need to include the `NetworkFetchInterceptor`, probably between request and response logging interceptors. \r\n\r\nI don't know why the response logging interceptor would be showing a 200 response when there's nothing that came through, because the request never went out to the network.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Obsolete type GraphQLHTTPResponseError","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"},"body":"## Bug report\r\n\r\nWith the new network stack (yeah!) a few types such as `GraphQLHTTPResponseError` became obsolte but did not get removed from code base yet.\r\n\r\n## Versions\r\n\r\n- `apollo-ios` SDK version: 0.34.0\r\n\r\n## Steps to reproduce\r\n\r\n\"Find usages\" of `GraphQLHTTPResponseError`, `GraphQLHTTPRequestError` and probably others.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"`GraphQLHTTPRequestError` is still used, but good catch on the response error. \r\n\r\nPlease note that \"find usages\" isn't the be-all, end-all, especially for enum types - always worth doing a text search through the full codebase. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"The problem here for me was that by not beeing broken because of a removed class my validations got semantically broken because they where still checking for that type.\r\n\r\nOf course you're right about `GraphQLHTTPRequestError`. I've mistaken that.\r\n\r\nBut still, regarding your advise to check for \"usages\" with full text search i have to strongly disagree. In fact i heavily rely on this kind of type based analysis and navigating through code and therefore i prefer AppCode over Xcode a lot because of it outstanding capabilities in that. You should give it a try.","author":{"__typename":"User","login":"knox","id":"MDQ6VXNlcjE2NDAx","name":"Mickey"}},{"__typename":"IssueComment","body":"I agree that it's helpful, but particularly when it comes to removing stuff, I've found it better to belt-and-suspenders things by actually searching out where something is used (even in AppCode, which I have used before). ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"This has been removed with `0.35.0`. If you find other unused types, please open a new issue. Thanks!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Enhance support for custom cache key resolver logic","author":{"__typename":"User","login":"qingqingliu","id":"MDQ6VXNlcjMzMDk3NjE=","name":null},"body":"## Feature request\r\n\r\nAdd similar support of [CacheKeyResolver](https://github.com/apollographql/apollo-android/blob/main/apollo-normalized-cache-api/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/CacheKeyResolver.kt) as from Android Apollo Client library. \r\n\r\n## Motivation\r\n\r\nCurrent iOS library provides cacheKeyForObject on ApolloClient that allows you to provide custom cache key for response, but there is no way for client app to provide custom cache key for request. This feature is needed in case client wants to use a different cache key for request\r\n\r\n## Proposed solution\r\n\r\nFollow Android pattern to introduce CacheKeyResolver on ApolloClient and support custom cache key for both response and request key.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"We're going to be looking in late 2020-early 2021 at getting our mobile caching more aligned, both across iOS and android and with our web cache, and this is one of the things I'll definitely be considering. \r\n\r\nI'm definitely open to discussion if you're interested in implementing this yourself.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks @designatednerd for the follow up. I see this is being part of bigger alignment between iOS and Android, I would probably wait for an overall proposal first. Happy to contribute though once the proposal is in place\r\n\r\nAs android side does seems have more feature supports like refetch, optimistic updates and custom cache key etc, wondering whether the direction for iOS would be following Android design pattern","author":{"__typename":"User","login":"qingqingliu","id":"MDQ6VXNlcjMzMDk3NjE=","name":null}},{"__typename":"IssueComment","body":"We're going to try to line up on what's best for both - the biggest issue right now is that iOS had a long period where no development took place (while Android was chugging along well with open-source contributions) and I'm still digging my way out of that hole. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Enum generation with `INIT` case","author":{"__typename":"User","login":"bezoadam","id":"MDQ6VXNlcjI1NjEzMTI1","name":"Adam Bezak"},"body":"## Bug report\r\n\r\nHi, enum is declared like this:\r\n![Snímka obrazovky 2020-10-01 o 8 26 56](https://user-images.githubusercontent.com/25613125/94775340-ede86780-03bf-11eb-9f4e-f9cb5bc9f5a0.png)\r\n\r\nand generated code throws these errors:\r\n![Snímka obrazovky 2020-10-01 o 8 27 08](https://user-images.githubusercontent.com/25613125/94775447-18d2bb80-03c0-11eb-9fe5-b6f6d12420ef.png)\r\n\r\nIt looks like there is problem with `INIT` case when using enum.\r\n\r\n## Versions\r\n\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 12.0.1\r\n- Swift version: 5\r\n\r\n## Steps to reproduce\r\n\r\nGenerate code with `init` in enum case.\r\n\r\nIs it problem on my side or bug in apollo codegen. Any possible fixes?\r\nThanks.\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"It's the codegen - it's not properly escaping the case named `init`, which is a reserved Swift keyword. Upcoming codegen should handle this better but it's gonna be a bit - is this schema already public or is it still being evolved? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Schema is partially public but I think there is not chance that there will be some changes. Anyway if I change `.init` to ``.init`` on lines where error is triggered, it disappears. But of course on next build code is regenerated. So I think this should be fixed in codegen.","author":{"__typename":"User","login":"bezoadam","id":"MDQ6VXNlcjI1NjEzMTI1","name":"Adam Bezak"}},{"__typename":"IssueComment","body":"Yeah, absolutely - fixing the current codegen is a pain (which is why it's being rewritten) so I was trying to make sure it was necessary before diving into it. 🙃","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thank you 👍 it is not necessary for me, I think i can handle it somehow (use temporary script to rename all `.init` cases to `\".init\"`)","author":{"__typename":"User","login":"bezoadam","id":"MDQ6VXNlcjI1NjEzMTI1","name":"Adam Bezak"}},{"__typename":"IssueComment","body":"You'd need to make it\r\n\r\n```swift\r\n`.init`\r\n```\r\n\r\n rather than `\".init\"`, but if you're ok with that, I'm very OK with not diving into typsecript hell 😇. If that's cool with you, mind if we close this one out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"When adding interceptors, they don't parse properly errors","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null},"body":"SDK 0.34.0\r\n\r\nI can fetch the data, response is received:\r\n![image](https://user-images.githubusercontent.com/6308120/94791351-cac9b200-03d7-11eb-9d99-78a0bacddbcf.png)\r\nBut when handling it:\r\n![image](https://user-images.githubusercontent.com/6308120/94791434-e92fad80-03d7-11eb-934b-7777241fbad7.png)\r\nIt is entering the failure, but with a totally separate error:\r\n![image](https://user-images.githubusercontent.com/6308120/94791471-f8166000-03d7-11eb-8e70-c9a48d108e87.png)\r\nActually, that error does not contain anything related to the errors data is receiving.\r\nEven with just the Network Interceptor:\r\n![image](https://user-images.githubusercontent.com/6308120/94791498-02d0f500-03d8-11eb-8877-bc49dd33a64e.png)\r\n\r\nCould you help there?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"If I use LegacyInterceptorProvider it does work","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null}},{"__typename":"IssueComment","body":"You don't have a parsing interceptor happening here, so the data is not being parsed by the time it gets to the end of the interceptor chain. The parsing isn't done by the chain itself, it's done by the individual interceptors.\r\n\r\nIf you're creating your own interceptor provider, you have to provide _all_ the interceptors that you're planning to use, including the ones that do the parsing. A good place to start is to copy the interceptors that are in `LegacyInterceptorProvider` and then add your custom interceptors to that array wherever you want them to execute. \r\n\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Is there anything else I can help with here, or can we close this issue out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"You can close it. Many thanks!\n\nEl mar., 6 oct. 2020 a las 0:43, Ellen Shapiro ()\nescribió:\n\n> Is there anything else I can help with here, or can we close this issue\n> out?\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> ,\n> or unsubscribe\n> \n> .\n>\n\n\n-- \n*Jose Ángel Zamora Cobo*\nTelecommunication Engineer\nAndroid/iOS Senior Software Engineer\n\n","author":{"__typename":"User","login":"angelu25","id":"MDQ6VXNlcjYzMDgxMjA=","name":null}}]}},{"__typename":"Issue","title":"Failed codegen when using GitHub GraphQL schema","author":{"__typename":"User","login":"mattia","id":"MDQ6VXNlcjExMTM4OA==","name":"Mattia Valzelli"},"body":"## Bug report\r\n\r\nWhile trying to use the [Swift scripting codegen tooling](https://www.apollographql.com/docs/ios/swift-scripting/) I was not able to generate the `API.swift` file given the corresponding schema file.\r\n\r\nAn error like this is generated \r\n\r\n> Field \"AcceptEnterpriseAdministratorInvitationInput.clientMutationId\" already exists in the schema. It cannot also be defined in this type extension.\r\n\r\n\r\nBut using the GraphQL verification tool available in the [same repo](https://github.com/octokit/graphql-schema) it passes. (running `npm start validate:ts`)\r\n\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 12.2 beta 2 (12B5025f)\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nSet up the project as described in the [Swift scripting guide](https://www.apollographql.com/docs/ios/swift-scripting/) and use the GitHub schema definition with the following files:\r\n - [schema.graphql](https://raw.githubusercontent.com/octokit/graphql-schema/master/schema.graphql)\r\n - [schema.json](https://raw.githubusercontent.com/octokit/graphql-schema/master/schema.json)\r\n\r\n## Further details\r\n\r\n

\r\n Example `main.swift`\r\n \r\n```swift\r\nimport ApolloCodegenLib\r\n\r\n// Grab the parent folder of this file on the filesystem\r\nlet parentFolderOfScriptFile = FileFinder.findParentFolder()\r\n\r\n// Use that to calculate the source root of both the\r\nlet sourceRootURL = parentFolderOfScriptFile\r\n .parentFolderURL() // Sources\r\n .parentFolderURL() // Codegen\r\n .parentFolderURL() // My Project\r\n\r\n// From the source root, figure out where your target\r\n// root is within your main project\r\nlet targetRootURL = sourceRootURL\r\n .childFolderURL(folderName: \"My Project\")\r\n\r\n// Set up the URL you want to use to download the project\r\nlet endpoint = URL(string: \"https://api.github.com/graphql\")!\r\n\r\n// Create an options object for downloading the schema\r\nlet schemaDownloadOptions = ApolloSchemaDownloadConfiguration(\r\n endpointURL: endpoint,\r\n headers: [\"Authorization: Bearer XXXXXXXXX\"],\r\n outputFolderURL: targetRootURL\r\n)\r\n\r\n// Calculate where you want to create the folder where the CLI will\r\n// be downloaded by the ApolloCodegenLib framework.\r\nlet cliFolderURL = sourceRootURL\r\n .childFolderURL(folderName: \"Codegen\")\r\n .childFolderURL(folderName: \"ApolloCLI\")\r\n\r\ndo {\r\n // Actually attempt to download the schema.\r\n try ApolloSchemaDownloader.run(with: cliFolderURL,\r\n options: schemaDownloadOptions)\r\n} catch {\r\n // This makes the error message in Xcode a lot more legible,\r\n // and prevents the script from continuing to try to generate\r\n // code if the schema download failed.\r\n exit(1)\r\n}\r\n\r\n// Create the default Codegen options object (assumes schema.json\r\n// is in the target root folder, all queries are in some kind\r\n// of subfolder of the target folder and will output as a\r\n// single file to API.swift in the target folder)\r\nlet codegenOptions = ApolloCodegenOptions(targetRootURL: targetRootURL)\r\n\r\ndo {\r\n // Actually attempt to generate code.\r\n try ApolloCodegen.run(from: targetRootURL,\r\n with: cliFolderURL,\r\n options: codegenOptions)\r\n} catch {\r\n // This makes the error message in Xcode a lot more legible.\r\n exit(1)\r\n}\r\n```\r\n
\r\n\r\nPlease let me know if I can help debug this. Also I am new to GraphQL, so I may be doing something wrong.\r\n\r\nThank you for this library!","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I've definitely seen this from the `.graphql` version of the GitHub schema before, but it looks from the code like you're downloading the JSON version of it. Can you please confirm that and attach a copy of the schema you're getting from GitHub so I can take a look? Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> I've definitely seen this from the `.graphql` version of the GitHub schema before, but it looks from the code like you're downloading the JSON version of it. Can you please confirm that and attach a copy of the schema you're getting from GitHub so I can take a look? Thank you!\r\n\r\nYes, of course. The schema I'm downloading is from the [octokit repo](https://github.com/octokit/graphql-schema).\r\nThe files are:\r\n - [schema.graphql](https://gist.github.com/mattia/d2cc50fdbfc1a90e58c4c35716677052)\r\n - [schema.json](https://gist.github.com/mattia/4545c6371577d3a7c7c17722bf7266f2).\r\n\r\nThank you and have a nice day!","author":{"__typename":"User","login":"mattia","id":"MDQ6VXNlcjExMTM4OA==","name":"Mattia Valzelli"}},{"__typename":"IssueComment","body":"OK looks like I had it backwards, it's the JSON that's giving the weird error and the SDL that seems to be working fine. If you update your schema download options to downloading SDL instead of the default JSON option, that should work: \r\n\r\n```swift\r\n// Create an options object for downloading the schema\r\nlet schemaDownloadOptions = ApolloSchemaDownloadConfiguration(\r\n schemaFileType: .schemaDefinitionLanguage,\r\n endpointURL: endpoint,\r\n headers: [\"Authorization: Bearer XXXXXXXXX\"],\r\n outputFolderURL: targetRootURL\r\n)\r\n```","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thanks for the reply. I've been real busy these days but I will try to come back to you in the next few days after trying your suggestion.\r\n\r\nThanks again! Have a nice day","author":{"__typename":"User","login":"mattia","id":"MDQ6VXNlcjExMTM4OA==","name":"Mattia Valzelli"}},{"__typename":"IssueComment","body":"OK cool - I'm going to close this issue out for now, please let us know if using the Schema Definition Language version of their schema doesn't work by reopening this issue. \r\n\r\nAnyone else having a similar problem, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Is it okay to git ignore API.swift?","author":{"__typename":"User","login":"prateek3255","id":"MDQ6VXNlcjIxMjc3MTc5","name":"Prateek Surana"},"body":"## Question\r\n\r\nSince API.swift is auto-generated, is it good practice to add it to `.gitignore`?\r\n\r\nWe tried adding it to `.gitignore` but whenever someone new clones the repo, the code fails to compile because of a broken reference to API.swift, and hence we have to manually pass it for the very first time.\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.32.1\r\n- Xcode version: 11.4\r\n- Swift version: 5.1","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"This is not a recommended practice - the exact problem you're having illustrates why this isn't a good idea. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Okay, thanks for the clarification","author":{"__typename":"User","login":"prateek3255","id":"MDQ6VXNlcjIxMjc3MTc5","name":"Prateek Surana"}}]}},{"__typename":"Issue","title":"Using a custom Date scalar","author":{"__typename":"User","login":"Renish-Development","id":"MDQ6VXNlcjQ3Njg0NzE5","name":"Renish_Development"},"body":"@cerupcat @jzhw0130: You should be able to pass `--passthrough-custom-scalars` to `apollo-codegen` to avoid generating a `typealias` to `String` for custom scalars. You can then add your own alias and conversion code, see [here](https://github.com/apollographql/apollo-ios/issues/23#issuecomment-261697349) for an example.\r\n\r\n_Originally posted by @martijnwalraven in https://github.com/apollographql/apollo-ios/issues/94#issuecomment-327287361_","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"How to use/implement Date type custom scalar in iOS?\r\n\r\nI'm working with GraphQL. I have successfully implement Query and Mutation in iOS app.\r\nI'm facing issue with Date Type. As per references, I have added --passthrough-custom-scalars in Run Script BUT I'm facing compilation issue.\r\n**I'm facing issue with \"--passthrough-custom-scalars\" variable. I have added below code in Run script but I'm facing an error.**\r\n\r\n```\r\nDERIVED_DATA_CANDIDATE=\"${BUILD_ROOT}\"\r\nwhile ! [ -d \"${DERIVED_DATA_CANDIDATE}/SourcePackages\" ]; do\r\nif [ \"${DERIVED_DATA_CANDIDATE}\" = / ]; then\r\necho >&2 \"error: Unable to locate SourcePackages directory from BUILD_ROOT: '${BUILD_ROOT}'\"\r\nexit 1\r\nfi\r\nDERIVED_DATA_CANDIDATE=\"$(dirname \"${DERIVED_DATA_CANDIDATE}\")\"\r\ndone\r\nSCRIPT_PATH=\"${DERIVED_DATA_CANDIDATE}/SourcePackages/checkouts/apollo-ios/scripts\"\r\nif [ -z \"${SCRIPT_PATH}\" ]; then\r\necho >&2 \"error: Couldn't find the CLI script in your checked out SPM packages; make sure to add the framework to your project.\"\r\nexit 1\r\nfi\r\ncd \"${SRCROOT}/${TARGET_NAME}\"\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./*/.graphql --localSchemaFile=\"schema.json\" API.swift\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh schema:download --endpoint=\"endpointURL\"\r\n#custom scalars\r\n**$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift --passthrough-custom-scalars**\r\n```\r\n\r\n**Code for Define Date Scalars**\r\n```swift\r\npublic typealias DateTime = Date\r\nextension DateTime: JSONDecodable, JSONEncodable {\r\n public init(jsonValue value: JSONValue) throws {\r\n guard let string = value as? String else {\r\n throw JSONDecodingError.couldNotConvert(value: value, to: String.self)\r\n }\r\n guard let date = ISO8601DateFormatter().date(from: string) else {\r\n throw JSONDecodingError.couldNotConvert(value: value, to: Date.self)\r\n }\r\n self = date\r\n }\r\n public var jsonValue: JSONValue {\r\n return ISO8601DateFormatter().string(from: self)\r\n }\r\n}\r\n```\r\n\r\n**I have reviewed schema JSON have a Date variable but API.swift still string type.**\r\nHere is my graphql mutation.\r\n```graphql\r\nmutation AddPeriod($uid:ID!, $start_time : Date!, $flow: PeriodFlowInput){\r\n addPeriod(uid:$uid, start_time : $start_time, flow: $flow){\r\n id\r\n start_time\r\n end_time\r\n flow {\r\n value\r\n flow_time\r\n }\r\n }\r\n}\r\n```\r\n\r\nHow can I pass date in GraphQL mutation. Please help me. Thanks in advance","author":{"__typename":"User","login":"Renish-Development","id":"MDQ6VXNlcjQ3Njg0NzE5","name":"Renish_Development"}},{"__typename":"IssueComment","body":"Hi @Renish-Development - I updated your comment to add some formatting. \r\n\r\nIt looks like your type is called `Date` rather than `DateTime`, which would mean I believe you need to have your typealias be:\r\n\r\n```swift\r\ntypealias Date = Swift.Date\r\n```\r\n\r\nAnd then have your extension be on `Date` rather than `DateTime`. Give that a shot, let me know how it goes.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd , \r\n\r\n**1. Swift Date is Not available. I'm using Xcode 12. Please look at the attached screen shot.**\r\n\r\n**2. I'm also facing issue with execute --passthrough-custom-scalars. Please let me know what I missed for custom scalars**\r\n\r\n**$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift --passthrough-custom-scalars**\r\n\r\n\"Screenshot\r\n","author":{"__typename":"User","login":"Renish-Development","id":"MDQ6VXNlcjQ3Njg0NzE5","name":"Renish_Development"}},{"__typename":"IssueComment","body":"Argh, I meant `Foundation.Date`. I always forget what's swift and what's foundation📈\r\n\r\nAnd `--output API.swift` has to be the last argument - move `--passthrough-custom-scalars` before that. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd , Its' not working. Please can I do any mistake or issue due to the updated version of Xcode 12. I'm using Xcode 12. Please check with your side and let me know it's work or not. Happy top share more information","author":{"__typename":"User","login":"Renish-Development","id":"MDQ6VXNlcjQ3Njg0NzE5","name":"Renish_Development"}},{"__typename":"IssueComment","body":"I did notice that the param is `--passthroughCustomScalars` rather than `--passthrough-custom-scalars` - that could be part of it. If that's not what's not working, please let me know in more detail what isn't working and in what way it is not working. Thanks. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Hi @Renish-Development is there anything more I can help with here or can we close this issue out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"You're far from the only person who's asked a ton of questions about this so I've added a page to our example playground to try and clarify this. Please see #1474 for further details","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd , Please add verify and step by step code or make tutorial as per latest version of GIT repo. Also I have not found proper documentation regarding custom scalar, pass token in API call, generate schema file with auth token and so on. I'm happy to help you anyway and if you can guide I will write tutorial for the same. Looking forward....","author":{"__typename":"User","login":"GlobesyncTechnologies","id":"MDQ6VXNlcjUzNDc1MDIx","name":"Renish | GlobeSync Technologies"}},{"__typename":"IssueComment","body":"@GlobesyncTechnologies Please see the PR I linked for an example of using a custom scalar. Please check out [our full tutorial](https://www.apollographql.com/docs/ios/tutorial) for full setup instructions. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Mismatched stores for ApolloClient/LegacyInterceptorProvider","author":{"__typename":"User","login":"danpalmer","id":"MDQ6VXNlcjIwMjQwMA==","name":"Dan Palmer"},"body":"## Bug report\r\n\r\nCaveat: this isn't quite a bug, perhaps more of a design bug, but we nearly shipped a bug in our app because of it. Also, I may just be missing things!\r\n\r\nThere are two ways to set up an `ApolloStore` for the networking in Apollo, and unless both are done, in the same way, I believe there can be inconsistencies.\r\n\r\nFor example, we previously did this in our `ApolloClient` setup:\r\n\r\n```swift\r\nlet networkTransport = HTTPNetworkTransport(url: baseURL)\r\nlet cache = InMemoryNormalizedCache()\r\nlet store = ApolloStore(cache: cache)\r\nlet client = ApolloClient(networkTransport: networkTransport, store: store)\r\n```\r\n\r\nWhen upgrading to the newest version of Apollo, we originally re-wrote this as:\r\n\r\n```swift\r\nlet provider = LegacyInterceptorProvider()\r\nlet networkTransport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: baseURL)\r\nlet cache = InMemoryNormalizedCache()\r\nlet store = ApolloStore(cache: cache)\r\nlet client = ApolloClient(networkTransport: networkTransport, store: store)\r\n```\r\n\r\nAs far as I can tell (please tell me if I'm wrong!) this has set up a store that is now not being used at all. We can still call `client.clearCache()` or `client.cacheKeyForObject` and it will use the store that we created, but this would _not_ affect the store being used by the interceptors.\r\n\r\nSimilarly, we could have configured a more complex cache setup, but that would not be used by the interceptors.\r\n\r\nIf we corrected this in the following way...\r\n\r\n```swift\r\nlet cache = InMemoryNormalizedCache()\r\nlet store = ApolloStore(cache: cache)\r\nlet provider = LegacyInterceptorProvider(store: store)\r\nlet networkTransport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: baseURL)\r\nlet client = ApolloClient(networkTransport: networkTransport)\r\n```\r\n\r\n...this would also introduce bugs because while our correct store is being used for the networking, `client.clearCache` or `client.cacheKeyForObject` are pointing to the `ApolloClient`'s default store from its init method.\r\n\r\n## Versions\r\n\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 12.0\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nSee above for the process that can lead to incorrect use. This is roughly the steps that we took while upgrading Apollo to 0.34.x – i.e. we went through two invalid implementations before reaching one that we believe is valid.\r\n\r\n## Further details\r\n\r\nAs mentioned above, this isn't really a bug, but I think it's a design issue that could be improved. My recommendation would be to eliminate the store from the `ApolloClient` entirely, and leave it up to the user to coordinate the store with their interceptor provider. Potentially the store could become part of the interceptor provider protocol so that the client could still back `cacheKeyForObject`/`clearCache` onto the provider's store.\r\n\r\nAn alternative would be to eliminate the store from the interceptor provider, and ensure that in the client the store is set correctly on the provider so that they always line up.\r\n\r\nLastly, if maintaining backwards compatibility is key, the store from the provider and the store from the client could be compared at the end of the client initialiser, and an error raised if they are not exactly the same object.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Is there a particular using you're not passing in the `store` parameter for `client` on that last version? eg: \r\n\r\n```swift\r\nlet cache = InMemoryNormalizedCache()\r\nlet store = ApolloStore(cache: cache)\r\nlet provider = LegacyInterceptorProvider(store: store)\r\nlet networkTransport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: baseURL)\r\nlet client = ApolloClient(networkTransport: networkTransport, store: store)\r\n```\r\n\r\nThat would ensure you have the same store in all places. \r\n\r\nI do agree it's a little overcomplicated at the moment - I do plan to keep evolving this, and I appreciate the feedback.\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> Is there a particular using you're not passing in the store parameter for client on that last version? eg:\r\n\r\nNot particularly, but we did go through this stage on the way to our fully working version, which is pretty much what you have in your example. The fact that there were multiple opportunities for human error in getting to that working solution suggests there's a better design possible.\r\n\r\nIdeally these would be caught by the type system, or made un-representable, as I don't believe they are states of the system with valid use-cases.\r\n\r\nWould you accept a PR to address this? If so, what's your preferred approach out of those options I outlined, or is there another way you'd like to solve this?","author":{"__typename":"User","login":"danpalmer","id":"MDQ6VXNlcjIwMjQwMA==","name":"Dan Palmer"}},{"__typename":"IssueComment","body":"If you're not using a custom interceptor provider, the default initializer for `ApolloClient` initializes all this stuff for you - is that more what you're thinking? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> If you're not using a custom interceptor provider, the default initializer for ApolloClient initializes all this stuff for you - is that more what you're thinking?\r\n\r\nI think that route is safe.\r\n\r\nWe were transitioning from the legacy networking stack where we used `HTTPNetworkTransportPreflightDelegate` though. To maintain compatibility we decided to use `LegacyInterceptorProvider` and add an additional interceptor that did what our preflight delegate implementation had previously done, hence ending up with needing to pass the store into two different places, and this getting out of sync in two different ways before we realised the implicit dependency between those two places.\r\n\r\nAlso, just realised that the 3rd code example in the issue body is roughly what's in `Network.swift` in the docs here: https://www.apollographql.com/docs/ios/tutorial/tutorial-mutations/ – following the docs here will result in an invalid construction of the networking stack I think.\r\n\r\nHaving thought about this a bit more, I think there's a more common way this could also be done incorrectly:\r\n\r\n```swift\r\nlet provider = LegacyInterceptorProvider()\r\nlet networkTransport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: baseURL)\r\nlet client = ApolloClient(networkTransport: networkTransport, store: store)\r\n```\r\n\r\nIf not manually constructing a store at all, but instantiating a custom interceptor provider, there are two different stores being used and therefore it's impossible to clear the cache of the \"real\" one, but no error would be raised clearing the cache of the unused one.\r\n\r\nIt's possible I've missed somewhere that the stores get \"joined up\" – I'm new to Swift and don't know much about the Apollo codebase and may not understand the intention here. Apologies if that's the case!\r\n\r\n- - -\r\n\r\nI think there are 3 possible options here (although very open to more suggestions!):\r\n\r\n1. Eliminate the store from the ApolloClient entirely, leave it up to the user to coordinate the store with their interceptor provider. User will need to hold a reference to it for setting/getting the cache key, or clearing the cache.\r\n\r\n2. Eliminate the store from the interceptor provider init, have the client inject it into the interceptor provider. This way the user only has one place to pass it in, and if they don't the default one is still the same.\r\n\r\n3. If maintaining backwards compatibility is key, the store from the provider and the store from the client could be compared at the end of the client initialiser, and an error raised if they are not exactly the same object.\r\n\r\n","author":{"__typename":"User","login":"danpalmer","id":"MDQ6VXNlcjIwMjQwMA==","name":"Dan Palmer"}},{"__typename":"IssueComment","body":"Good catch on the example in the tutorial, that's definitely an error.\r\n\r\nThere are (rare) instances where someone intentionally wants to use different stores, but you're right that most of the time, that's not the case. \r\n\r\nI think of the options you propose, 2 probably makes the most sense. I'll try to see what I can do here. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> There are (rare) instances where someone intentionally wants to use different stores, but you're right that most of the time, that's not the case.\r\n\r\nInteresting! I'm not sure I quite understand what the use-case is for the client to have a different store to the interceptor provider? I can't see how that client store gets used apart from by the user... which means if I've understood correctly, it's not plugged in to the Apollo internals?","author":{"__typename":"User","login":"danpalmer","id":"MDQ6VXNlcjIwMjQwMA==","name":"Dan Palmer"}},{"__typename":"IssueComment","body":"basically there are some people who use multiple clients with multiple stores, and there are some...odd ways people make that work. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I've shipped the PR removing the default stores with `0.36.0` - I took a couple swipes at doing something else besides that, but everything I tried wound up *far* more complicated than \"actually make people select what store they're passing\". \r\n\r\nGoing to close this one out, please open a new issue if you think you've got a better suggestion!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Nice one! PRs look good. Straightforward approach sounds good – I can't see myself making the mistakes above if this was in place. Better API ergonomics can come later if they're needed at all.\r\n\r\nThanks for your work on this!","author":{"__typename":"User","login":"danpalmer","id":"MDQ6VXNlcjIwMjQwMA==","name":"Dan Palmer"}}]}},{"__typename":"Issue","title":"Can not find 'GenericScalar' in scope","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null},"body":"## Bug report\r\n\r\nBackend is JWT and when i'll try to execute a mutation for tokenVerification it gives me an error. We have Payload (Scalar Type) as response it in. I have added --passthroughCustomScalars in run script also.\r\n\r\n`SCRIPT_PATH=\"${PODS_ROOT}/Apollo/scripts\"\r\ncd \"${SRCROOT}/${TARGET_NAME}\"\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=\"schema.json\" --passthroughCustomScalars API.swift\r\n`\r\n\r\n## Versions\r\n\r\n\r\n- `apollo-ios` SDK version: POD 0.34.0\r\n- Xcode version: XCode 12\r\n- Swift version: Swift 5\r\n\r\n## Steps to reproduce\r\n\r\nPlease add Scalar type response in mutation/query and try to build the project (first clear build folder)\r\n\r\n## Further details\r\n\r\nI have tried to do Type Conversion using this help : https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/JSONStandardTypeConversions.swift\r\n\r\nBut its not working as we are using swift 5 i think.\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! Can you clarify a bit: \r\n\r\n- What is the name of your custom scalar type, `Payload` or `GenericScalar`? \r\n- What is the underlying type of your custom scalar? It sounds like it's a string containing the JWT, I just want to double check\r\n- Have you tried using a `typealias` to define the scalar type? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@tapannathvani Hi, do you have answers to any of the questions I asked? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Closing this issue as i am not using Payload response data now.","author":{"__typename":"User","login":"tapannathvani","id":"MDQ6VXNlcjEwMzY4OTU1","name":null}}]}},{"__typename":"Issue","title":"Add example for direct writing to the cache","author":{"__typename":"User","login":"michael-mckenna","id":"MDQ6VXNlcjE0MDM1MTQ4","name":null},"body":"## Feature request\r\n\r\nAdd examples for writing directly to the cache, hopefully for all variants of the \"write\" function:\r\n```\r\ntransaction.write(object:withKey:)\r\ntransaction.write(data:forQuery:)\r\ntransaction.write(object:withKey:variables:)\r\n```\r\n\r\nLooks like only `read` and `update` are in the docs at the moment.\r\nhttps://github.com/apollographql/apollo-ios/blob/main/docs/source/caching.mdx#direct-cache-access\r\n\r\n## Motivation\r\n\r\nI'm new to GraphQL and using it for a side project has a learning experience. I don't want to get the whole server and datasource set up yet - would like to just do the iOS portion and have some sort of proof of concept going before pursuing it further. Because of this, I'm using the direct cache access exclusively for now. The extra examples in the readme will help me and future devs a lot. I come from using Realm and Core Data so this is quite a bit different for me.\r\n\r\n## Outstanding Questions\r\n\r\nIs there a sample app that utilizes direct cache access? If so, it'd be great to add a reference to that.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi, I can certainly add one, but I will say that the idea is that you avoid manually reading from or writing to the cache unless you absolutely have to, and let the store handle most of the nonsense around dealing with cache keys and things like that.\r\n\r\nIf it's your first time messing around with it and you just want to get an idea of how it works, I'd recommend checking out the app from the [Tutorial](https://www.apollographql.com/docs/ios/tutorial/), which uses a server that's already set up. You can then more easily inspect how things go into the in-memory cache or, if you want to, you can switch to using the SQLite cache and examine the SQLite database. \r\n\r\nThat will also allow you to have a base to mess around from if you are interested in seeing how the writing works if you need it.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd Just to clarify, it is still the expectation though that you should use manual cache updating after mutations / incoming subscriptions, correct? Recently I started to receive JSON `missingValue` errors in my cache updates and I'm not sure if it has anything to do with the major architectural changes that have been going on. ","author":{"__typename":"User","login":"Nickersoft","id":"MDQ6VXNlcjIxMDQxMjk=","name":"Tyler Nickerson"}},{"__typename":"IssueComment","body":"Subscriptions don't hit the cache at all at the moment - I wasn't part of that decision but it makes sense from a standpoint of \"This is constantly changing information, we don't necessarily want to cache all of it\", and also from a performance standpoint. So yes, that you'd need to do manually.\r\n\r\nMutation results can update the cache, though if you're not using a `cacheKeyForObject` function that says the cache key should be based on a unique identifier, you will need to update any related queries manually. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Can't update the RequestBodyCreator for WebSocketTransport","author":{"__typename":"User","login":"lowki93","id":"MDQ6VXNlcjU0NzMwMTc=","name":"budain"},"body":"## Bug report\r\n\r\nWe use `WebSocketTransport` and we need to override the `requestBodyCreator` parameters.\r\nWe define `CustomBodyCreator`:\r\n```\r\nstruct CustomBodyCreator: RequestBodyCreator {\r\n \r\n public func requestBody(\r\n for operation: Operation,\r\n sendOperationIdentifiers: Bool\r\n ) -> GraphQLMap {\r\n .....\r\n }\r\n \r\n}\r\n\r\n```\r\n\r\nwe put it when we initialize the `WebSocketTransport`: \r\n```\r\n WebSocketTransport(request: request, requestBodyCreator: CustomBodyCreator())\r\n```\r\n\r\nThe method call in `WebSocketTransport` don't use the method define in the procotol :\r\n```\r\n func sendHelper(operation: Operation, resultHandler: @escaping (_ result: Result) -> Void) -> String? {\r\n let body = requestBodyCreator.requestBody(for: operation, sendOperationIdentifiers: self.sendOperationIdentifiers)\r\n ....\r\n return sequenceNumber\r\n }\r\n```\r\nBut `requestBody` from our struct is never call.\r\n\r\nThere is a an extension for `RequestBodyCreator` that define the function in the protocol : \r\n```\r\nextension RequestBodyCreator {\r\n /// Creates a `GraphQLMap` out of the passed-in operation\r\n ///\r\n /// - Parameters:\r\n /// - operation: The operation to use\r\n /// - sendOperationIdentifiers: Whether or not to send operation identifiers. Defaults to false.\r\n /// - sendQueryDocument: Whether or not to send the full query document. Defaults to true.\r\n /// - autoPersistQuery: Whether to use auto-persisted query information. Defaults to false.\r\n /// - Returns: The created `GraphQLMap`\r\n public func requestBody(for operation: Operation,\r\n sendOperationIdentifiers: Bool = false,\r\n sendQueryDocument: Bool = true,\r\n autoPersistQuery: Bool = false) -> GraphQLMap {\r\n.....\r\n}\r\n```\r\n\r\nWhy can put this default implementation in `ApolloRequestBodyCreator` directly ?\r\n```\r\n// Helper struct to create requests independently of HTTP operations.\r\npublic struct ApolloRequestBodyCreator: RequestBodyCreator {\r\n // Internal init methods cannot be used in public methods\r\n public init() { }\r\n}\r\n```\r\n\r\nWhy we can't override this ?\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 12.0.1\r\n- Swift version: 5.2 \r\n\r\n## Further details\r\n\r\nWe need to override this to make `WebSocketTransport`with `AppSync`from AWS","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi, apologies for the delay, I was under the weather. \r\n\r\nYou can't override `ApolloRequestBodyCreator` because it's not intended to be overridden - that's why `RequestBodyCreator` is a protocol with a default implementation: That way your custom implementation can use the default implementation without having to implement it yourself if you don't need to. \r\n\r\nThat being said, there've been some changes to this class recently (mostly, removing all the stuff that was going on for uploads) that might make changes make sense. \r\n\r\nI'm not sure why your custom implementation wouldn't be getting called - I would double check that the request creator is being passed in everywhere you expect it to be by setting some breakpoints and validating whether you've got your `CustomRequestCreator` or an `ApolloRequestBodyCreator`, and then working backwards to try to figure out where things are going wrong. If it is the custom request creator, that's definitely a bug. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"OK updating a test, I am now seeing the issue you're having - looks like something I gave [literally an entire talk on](https://speakerdeck.com/designatednerd/protocols-all-the-way-down-dotswift-paris-january-2018?slide=63) just came to bite me because I have angered the gods of iOS development 🤦‍♀️ \r\n\r\nThe issue is the default implementation is getting called even if it's overridden when the only type the compiler knows about is the protocol itself. \r\n\r\nUnfortunately I think the approach in #1448 is going to break things too hard - it removes the ability for anyone to use the default implementation at all. I will make some changes with some tests to validate it works though. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"This has shipped with `0.35.0`. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Am running to this error `Cannot find 'HTTPNetworkTransport' in scope` and `Cannot find type 'HTTPNetworkTransportDelegate' in scope` when am trying to make calls, ApolloClient Version 0.34.1","author":{"__typename":"User","login":"gbrigens","id":"MDQ6VXNlcjQyMTAxNTY=","name":"Гералд Бирген"},"body":"Am running to this error `Cannot find 'HTTPNetworkTransport' in scope` and `Cannot find type 'HTTPNetworkTransportDelegate' in scope` when am trying to make calls, ApolloClient Version 0.34.1\r\n\r\nHere is my code;\r\n```\r\nfinal class Network {\r\n static let shared = Network()\r\n private lazy var networkTransport: NetworkTransport = {\r\n \r\n let transport = HTTPNetworkTransport(url: URL(string: \"https://exampe.com/grapghql\")!)\r\n transport.delegate = self\r\n \r\n return transport\r\n }()\r\n \r\n private(set) lazy var apollo = ApolloClient(networkTransport: self.networkTransport)\r\n}\r\n\r\nextension Network: HTTPNetworkTransportDelegate {\r\n func networkTransport(_ networkTransport: NetworkTransport, shouldSend request: URLRequest) -> Bool {\r\n return true\r\n }\r\n \r\n func networkTransport(_ networkTransport: NetworkTransport, willSend request: inout URLRequest) {\r\n \r\n let token = \"\"\r\n var headers = request.allHTTPHeaderFields ?? [String: String]()\r\n headers[\"Authorization\"] = \"Bearer \\(token)\"\r\n \r\n request.allHTTPHeaderFields = headers\r\n }\r\n}\r\n```\r\nI appreciate your feedback.\r\n\r\n_Originally posted by @gbrigens in https://github.com/apollographql/apollo-ios/issues/909#issuecomment-706535757_","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Hi! In 0.34.0 after an RFC and multiple betas, we released an updated networking stack which removed these methods in favor of a `RequestChainNetworkTransport`. Please see the [0.34.0 release notes](https://github.com/apollographql/apollo-ios/releases/tag/0.34.0) for links to updated documentation.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd this is my first time working with Apolloclient and GraphQL. I have ted the one from the link still running into errors `Cannot find 'NetworkInterceptorProvider' in scope`... Do you have an example that shows passing authorization headers?","author":{"__typename":"User","login":"gbrigens","id":"MDQ6VXNlcjQyMTAxNTY=","name":"Гералд Бирген"}},{"__typename":"IssueComment","body":"Yes, the [tutorial bit on additional mutations](https://www.apollographql.com/docs/ios/tutorial/tutorial-mutations/) has an example","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd thank you for your help, hope in future there will be more tutorials on iOS. I have been searching for content online and there isn't much compared to Android.","author":{"__typename":"User","login":"gbrigens","id":"MDQ6VXNlcjQyMTAxNTY=","name":"Гералд Бирген"}},{"__typename":"IssueComment","body":"Yes, definitely in the long term plan to beef that up.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Cannot query field \"currencyTypes\" on type \"Query\".","author":{"__typename":"User","login":"Hazem-Mohammed","id":"MDQ6VXNlcjU1Mjk4MDg0","name":null},"body":"Hello all,\r\n\r\nThis is my first time to work with GraphQl and i have a very weird issue if i try to add any new query to my .graphql file i get error Cannot query field on type\r\ni faced this issue once and the solution was simply download the new schema file and it is work just fine now it doesn't work and if the Backend add any new query and i try to use it i get the same error even after update the schema file.\r\n\r\nnow i have the same issue again and i have tried almost everything:\r\n1- remove schema and download the new one.\r\n2- remove the (Generate Apollo GraphQL API) and add it again\r\n3- remove apollo SDK and reinstall it (cocoapods)\r\n4- update apollo SDK to the latest version\r\n5- make sure the schema have the new query's (works fine with the android)\r\n\r\n1- screenshot from Altair GraphQl Client:\r\n\"Screen\r\n\r\n\r\n2- screenshot from Xcode:\r\n\"Screen\r\n\"Screen\r\n\r\n3- screenshot from schema file this one show that the query is there.\r\n\"Screen\r\n\r\n4- screenshot from .graphql file:\r\n\"Screen\r\n\r\ni really don't know what is the issue here i have tried to clean project file , restart Xcode, restart Mac and the 5 steps mentioned above with no result and the same schema file work just fine with the android team.\r\n\r\nany help will be much appreciated \r\n- `apollo-ios` SDK version: 0.33.0\r\n- Xcode version: 11.6\r\n- Swift version: 5","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"finally i solved the issue.\r\ni was downloading the schema file from terminal using this command:\r\napollo schema:download --endpoint=https://myEndPoint schema.json\r\n\r\nthat was working with me in past but for some unknown reason using this command cause the problem\r\n\r\nThe solution:\r\nDownload schema using CLI script:\r\nSCRIPT_PATH=\"${PODS_ROOT}/Apollo/scripts\"\r\ncd \"${SRCROOT}/${TARGET_NAME}\"\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh schema:download --endpoint=http://myEndPoint schema.json\r\n","author":{"__typename":"User","login":"Hazem-Mohammed","id":"MDQ6VXNlcjU1Mjk4MDg0","name":null}}]}},{"__typename":"Issue","title":"Crash in Alamofire","author":{"__typename":"User","login":"tspecht","id":"MDQ6VXNlcjYwMzE0NA==","name":null},"body":"## Bug report\r\n\r\nSince upgrading to the latest `0.34.0` release line with the revamped networking stack, we are seeing intermittent failures in conjunction with Alamofire. Is this a known issue?\r\n\r\n```\r\nCode Type: X86-64 (Native)\r\nParent Process: launchd_sim [2352]\r\nResponsible: SimulatorTrampoline [2256]\r\nUser ID: 501\r\n\r\nDate/Time: 2020-10-13 14:15:09.012 +0000\r\nOS Version: Mac OS X 10.15.5 (19F101)\r\nReport Version: 12\r\nAnonymous UUID: 4763FA26-E06C-409D-9FAC-0174438B0AC7\r\n\r\n\r\nTime Awake Since Boot: 2500 seconds\r\n\r\nSystem Integrity Protection: disabled\r\n\r\nCrashed Thread: 7 Dispatch queue: org.alamofire.session.rootQueue\r\n\r\nException Type: EXC_BAD_ACCESS (SIGSEGV)\r\nException Codes: KERN_INVALID_ADDRESS at 0x000027b7a55693a0\r\nException Note: EXC_CORPSE_NOTIFY\r\n\r\nTermination Signal: Segmentation fault: 11\r\nTermination Reason: Namespace SIGNAL, Code 0xb\r\nTerminating Process: exc handler [6910]\r\n\r\nVM Regions Near 0x27b7a55693a0:\r\n mapped file 000000011638b000-000000011caba000 [103.2M] r--/rwx SM=COW Object_id=254d583f\r\n--> \r\n MALLOC_NANO 0000600000000000-0000600008000000 [128.0M] rw-/rwx SM=ALI \r\n\r\nApplication Specific Information:\r\nCoreSimulator 704.12.2 - Device: iPhone 11 (********-****-****-****-************) - Runtime: iOS 13.7 (17H22) - DeviceType: iPhone 11\r\n\r\nThread 7 Crashed:: Dispatch queue: org.alamofire.session.rootQueue\r\n0 libobjc.A.dylib \t0x00007fff512b7c6a objc_retain + 10\r\n1 com.apple.Foundation \t0x00007fff259243bf NSKeyValueWillChange + 510\r\n2 com.apple.Foundation \t0x00007fff25923ff7 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 487\r\n3 com.apple.Foundation \t0x00007fff259249f2 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 68\r\n4 com.apple.Foundation \t0x00007fff2591f6da _NSSetLongLongValueAndNotify + 269\r\n5 com.apple.CFNetwork \t0x00007fff230f3bfc 0x7fff22f52000 + 1711100\r\n6 com.apple.Foundation \t0x00007fff2594f28c __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7\r\n7 com.apple.Foundation \t0x00007fff2594f1ad -[NSBlockOperation main] + 80\r\n8 com.apple.Foundation \t0x00007fff259520dc __NSOPERATION_IS_INVOKING_MAIN__ + 17\r\n9 com.apple.Foundation \t0x00007fff2594e3ee -[NSOperation start] + 731\r\n10 com.apple.Foundation \t0x00007fff25952a20 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17\r\n11 com.apple.Foundation \t0x00007fff25952540 __NSOQSchedule_f + 182\r\n12 libdispatch.dylib \t0x00007fff520e9344 _dispatch_block_async_invoke2 + 83\r\n13 libdispatch.dylib \t0x00007fff520dc8cb _dispatch_client_callout + 8\r\n14 libdispatch.dylib \t0x00007fff520e260c _dispatch_lane_serial_drain + 707\r\n15 libdispatch.dylib \t0x00007fff520e3044 _dispatch_lane_invoke + 388\r\n16 libdispatch.dylib \t0x00007fff520ed0c4 _dispatch_workloop_worker_thread + 626\r\n17 libsystem_pthread.dylib \t0x00007fff52301a3d _pthread_wqthread + 290\r\n18 libsystem_pthread.dylib \t0x00007fff52300b77 start_wqthread + 15\r\n```\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: `0.34.0`\r\n- Xcode version: 11.7 as well as 12.0\r\n- Swift version: 5.1 as well as 5.3\r\n\r\n## Steps to reproduce\r\n\r\nHappens intermittently, hard to come up with exact steps.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"That's a new one on me - under the hood we're using the same `URLSessionClient` that wraps `URLSession` as we were previously, so there shouldn't be anything messing with `URLSession` that wasn't already happening before. \r\n\r\nThe crash is happening on the Alamofire queue, but it looks like it's happening pretty deep within foundation when a block operation tries to change a value and it triggers KVO, and then something blows up. \r\n\r\nFew questions:\r\n- Have you seen this happen on device or just on sim? \r\n- Have you cleaned your build folder since this happened? \r\n- Did Alamofire also update versions or is it still an older version?\r\n- Are you using the apollo-alamofire wrapper (which is totally separate from this repo) or are you just using AF in parallel to what we're doing? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I see several people have 👍'd this - any further details from anyone would be helpful","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd we have been doing some more experiments on our end, the common denominator so far seems to be recent versions of Firebase. We opened a separate issue in their repository hoping to get some insights on that, would be helpful to know if any of the other users upvoting this here are also using Firebase in their projects. Wondering if there might be some method swizzling going on somewhere? 🤔 \r\n\r\nhttps://github.com/firebase/firebase-ios-sdk/issues/6734","author":{"__typename":"User","login":"tspecht","id":"MDQ6VXNlcjYwMzE0NA==","name":null}},{"__typename":"IssueComment","body":"Oh interesting - yes that definitely seems plausible. For what it's worth our codebase is entirely in Swift, which doesn't completely prevent us from using swizzling but does make it way more of a pain. Either way, we do not use any swizzling. \r\n\r\nFor others running into this issue, are you also using Firebase? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd I am also using Firebase","author":{"__typename":"User","login":"ethan021021","id":"MDQ6VXNlcjE1MzI5NjU4","name":"Ethan"}},{"__typename":"IssueComment","body":"OK - since the stack trace doesn't show anything from the Apollo API, we're not doing any swizzling that could cause the crashes in the stack trace, and there seems to be an issue with the Firebase SDK and other people having this issue seem to also be using Firebase, I'm going to close this issue and direct folks to the [Firebase issue where this is being discussed in significantly more detail](https://github.com/firebase/firebase-ios-sdk/issues/6734). \r\n\r\nThanks all for the heads up on this!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"run-bundled-codegen.sh: No such file or directory","author":{"__typename":"User","login":"mobile-simformsolutions","id":"MDQ6VXNlcjYzMjI1OTEz","name":null},"body":"## run-bundled-codegen.sh: No such file or directory\r\n\r\ni'm implementing this demo as per the documentation (https://www.apollographql.com/docs/ios/tutorial/tutorial-obtain-schema) but after adding script into build phase it will showing me this error:\r\n\r\n**Command PhaseScriptExecution failed with a nonzero exit code**\r\n**Script-3E447D9625386A88004AD507.sh: line 10: /run-bundled-codegen.sh: No such file or directory\r\nCommand PhaseScriptExecution failed with a nonzero exit code**\r\n\r\n![Screenshot 2020-10-16 at 10 32 30 AM](https://user-images.githubusercontent.com/63225913/96215184-e8337a00-0f9a-11eb-8a38-b02591340731.png)\r\n\r\n## Versions\r\n0.34.1\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 12.0.1\r\n- Swift version: 5","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"It looks like you may have skipped step 6, in which you add the build script where the script path is retrieved. It links to [these instructions](https://www.apollographql.com/docs/ios/installation/#adding-a-code-generation-build-step) which are separated out by package manager. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"got it thanks but one suggestion for documentation please make one section where whole script was there.","author":{"__typename":"User","login":"mobile-simformsolutions","id":"MDQ6VXNlcjYzMjI1OTEz","name":null}},{"__typename":"IssueComment","body":"Appreciate the feedback - for what it's worth the reason it's linked is because those instructions had been changing enough that having it in two places meant that it was going to constantly get out of sync. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Help wanted migrating to new Networking stack","author":{"__typename":"User","login":"taher-mosbah","id":"MDQ6VXNlcjIzMDAwODc=","name":"Mohamed Taher Mosbah"},"body":"## Question\r\nGreetings 👋 \r\n\r\nWe are trying to update our custom implementation of a `NetworkTransport` to the new networking stack in version 0.34 but can't seem to figure out where to start, we took a look at the release notes and the documentation `RequestChainNetworkTransport` seems promising but can't figure out how to achieve the same results.\r\n\r\nHere is the current implementation:\r\n\r\n```\r\nimport Foundation\r\nimport Apollo\r\n\r\n/// A network transport that uses HTTP POST requests to send GraphQL operations to a server, and that uses `URLSession` as the networking implementation.\r\npublic class ApolloHTTPGETNetworkTransport: NetworkTransport {\r\n public enum NetworkError: Swift.Error {\r\n case invalidURLComponents\r\n }\r\n\r\n let url: URL\r\n let session: URLSession\r\n let serializationFormat = JSONSerializationFormat.self\r\n let jsonEncoder = JSONEncoder()\r\n\r\n /// Creates a network transport with the specified server URL and session configuration.\r\n ///\r\n /// - Parameters:\r\n /// - url: The URL of a GraphQL server to connect to.\r\n /// - configuration: A session configuration used to configure the session. Defaults to `URLSessionConfiguration.default`.\r\n /// - sendOperationIdentifiers: Whether to send operation identifiers rather than full operation text, for use with servers that support query persistence. Defaults to false.\r\n public init(url: URL, configuration: URLSessionConfiguration = URLSessionConfiguration.default, sendOperationIdentifiers: Bool = false) {\r\n self.url = url\r\n self.session = URLSession(configuration: configuration)\r\n self.sendOperationIdentifiers = sendOperationIdentifiers\r\n }\r\n\r\n /// Send a GraphQL operation to a server and return a response.\r\n ///\r\n /// - Parameters:\r\n /// - operation: The operation to send.\r\n /// - completionHandler: A closure to call when a request completes.\r\n /// - response: The response received from the server, or `nil` if an error occurred.\r\n /// - error: An error that indicates why a request failed, or `nil` if the request was successful.\r\n /// - Returns: An object that can be used to cancel an in progress request.\r\n public func send(operation: Operation, completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable where Operation: GraphQLOperation {\r\n let query = requestBody(for: operation)\r\n guard var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else {\r\n completionHandler(.failure(NetworkError.invalidURLComponents))\r\n return EmptyCancellable()\r\n }\r\n urlComponents.queryItems = query.compactMap { queryMapItem -> URLQueryItem? in\r\n guard let queryMapItemValue = queryMapItem.value else { return nil }\r\n if let queryMapItemValue = queryMapItemValue as? JSONObject {\r\n guard let queryItemValue = ((try? String(data: JSONSerializationFormat.serialize(value: queryMapItemValue), encoding: .utf8)) as String??) else { return nil }\r\n return URLQueryItem(name: queryMapItem.key, value: queryItemValue)\r\n }\r\n if let queryMapItemValue = queryMapItemValue as? String {\r\n return URLQueryItem(name: queryMapItem.key, value: queryMapItemValue)\r\n }\r\n return nil\r\n }\r\n\r\n var request = URLRequest(url: url)\r\n request.setValue(\"application/json\", forHTTPHeaderField: \"Content-Type\")\r\n request.httpMethod = \"GET\"\r\n request.url = urlComponents.url\r\n let task = session.dataTask(with: request) { (data: Data?, response: URLResponse?, error: Swift.Error?) in\r\n if let error = error {\r\n completionHandler(.failure(error))\r\n return\r\n }\r\n\r\n guard let httpResponse = response as? HTTPURLResponse else {\r\n fatalError(\"Response should be an HTTPURLResponse\")\r\n }\r\n\r\n if !httpResponse.isSuccessful {\r\n completionHandler(.failure(GraphQLHTTPResponseError(body: data, response: httpResponse, kind: .errorResponse)))\r\n return\r\n }\r\n\r\n guard let data = data else {\r\n completionHandler(.failure(GraphQLHTTPResponseError(body: nil, response: httpResponse, kind: .invalidResponse)))\r\n return\r\n }\r\n\r\n do {\r\n guard let body = try self.serializationFormat.deserialize(data: data) as? JSONObject else {\r\n throw GraphQLHTTPResponseError(body: data, response: httpResponse, kind: .invalidResponse)\r\n }\r\n let response = GraphQLResponse(operation: operation, body: body)\r\n completionHandler(.success(response))\r\n } catch {\r\n completionHandler(.failure(error))\r\n }\r\n }\r\n\r\n task.resume()\r\n\r\n return task\r\n }\r\n\r\n private let sendOperationIdentifiers: Bool\r\n\r\n private func requestBody(for operation: Operation) -> GraphQLMap {\r\n if sendOperationIdentifiers {\r\n guard let operationIdentifier = operation.operationIdentifier else {\r\n preconditionFailure(\"To send operation identifiers, Apollo types must be generated with operationIdentifiers\")\r\n }\r\n return [\"id\": operationIdentifier, \"variables\": operation.variables]\r\n }\r\n return [\"query\": operation.queryDocument, \"variables\": operation.variables]\r\n }\r\n}\r\n\r\nfileprivate extension HTTPURLResponse {\r\n var isSuccessful: Bool {\r\n return (200..<300).contains(statusCode)\r\n }\r\n\r\n var statusCodeDescription: String {\r\n return HTTPURLResponse.localizedString(forStatusCode: statusCode)\r\n }\r\n\r\n var textEncoding: String.Encoding? {\r\n guard let encodingName = textEncodingName else { return nil }\r\n\r\n return String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding(encodingName as CFString)))\r\n }\r\n}\r\n\r\n```\r\n\r\nfeel free to ask me any questions about the code and thanks for your time !\r\n\r\n## Versions\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 120.1\r\n- Swift version: 5.3","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"So it looks like you could probably get to this point with what you're doing by passing in a custom `RequestBodyCreator` to `RequestChainNetworkTransport` and then setting the `useGETForQueries` parameter to `true` - I believe almost all the rest of this is handled for you automatically in the RCNT otherwise.\r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@taher-mosbah Anything else I can help with here? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"thanks for your answer, it's clear will try to implement as soon as I got the time 😄 ","author":{"__typename":"User","login":"taher-mosbah","id":"MDQ6VXNlcjIzMDAwODc=","name":"Mohamed Taher Mosbah"}}]}},{"__typename":"Issue","title":"Swift scripting error with xcode 12","author":{"__typename":"User","login":"jdevng","id":"MDQ6VXNlcjI2ODE3NDEw","name":null},"body":"## Bug report\r\n\r\nInitialization of Codegen directory at \r\n\r\nhttps://www.apollographql.com/docs/ios/swift-scripting/\r\n\r\nresults in error.\r\n\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.35\r\n- Xcode version: 12.0.1\r\n- Swift version: Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)\r\n\r\n## Steps to reproduce\r\n```\r\n\r\n% swift packet init --type executable\r\nerror: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-packet (No such file or directory)\r\n```\r\n\r\n\r\n## Further details\r\n\r\nPlease replace this line with any further details or context necessary to understand the problem. Delete this section if you don't have anything further to add.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I think you mean `swift package --init` rather than `swift packet --init`","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I'm blind. Will delete :) Thank you. Should learn to copy!","author":{"__typename":"User","login":"jdevng","id":"MDQ6VXNlcjI2ODE3NDEw","name":null}}]}},{"__typename":"Issue","title":"set the timeout of the ApolloCodegenLib","author":{"__typename":"User","login":"wongzigii","id":"MDQ6VXNlcjczODQyODg=","name":"Zigii Wong"},"body":"I am following the guide to download zip file with CLI.\r\nHow can I set the timeout of the ApolloCodegenLib:CLIDownloader ?\r\nMy network is so bad :(\r\n\r\n```\r\nswift run\r\n[DEBUG - ApolloCodegenLib:CLIDownloader.swift:72] - Downloading zip file with the CLI...\r\ndownloadTimedOut(after: 30.0)\r\n```","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"For anyone stumbling across this, all of the methods to call into the codegen lib should have a `timeout` parameter. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Create WebsocketTransport without connecting automatically","author":{"__typename":"User","login":"winstondu","id":"MDQ6VXNlcjgxNzQzMTA=","name":"Winston Du"},"body":"## Feature request\r\n\r\nCurrently, the designated initializer for the WebSocketTransport[ immediately connects the websocket. ](https://github.com/apollographql/apollo-ios/blob/cf537701e407bed1a13df6dd6288d641abdda42a/Sources/ApolloWebSocket/WebSocketTransport.swift#L128)\r\n\r\nWe wish to manually control when it does its first connection.\r\n\r\n## Motivation\r\n\r\nWe want to our app's webservers to able to handle load, and at high traffic times we actually want the ability to disable automatic websocket connections to our server at app startup.\r\n\r\n## Proposed solution\r\n\r\nAdd a parameter to the [designated initializer](https://github.com/apollographql/apollo-ios/blob/cf537701e407bed1a13df6dd6288d641abdda42a/Sources/ApolloWebSocket/WebSocketTransport.swift#L128) on whether the websocket should connect immediately on initialization. In otherwords, wrap the `websocket.connect()` call in an `if` statement.\r\n\r\nAdditional notes: \r\nBecause the mutex-locked `reconnect` parameter only comes into play after the the first disconnection (which can only happen after the first connection), that parameter does not affect things.\r\n \r\n## Outstanding Questions\r\n- It is up to the implementor to decide whether there should be a separate api for the first websocket connection, or if the developer can just call `reconnectWebSocket()`","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Seems like a reasonable request, and thank you for adding a PR! I'll keep feedback over on the PR just for the sake of clarity. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"allowSpecificHTTPSCertificateForHost warning in iOS 14","author":{"__typename":"User","login":"DiwakarThapa","id":"MDQ6VXNlcjI5OTE3Nzk5","name":"diwakar thapa"},"body":"I started receiving following warning on Xcode after I update my iPhone to iOS 14. How to fix this warning? \r\n ## Warning\r\nnil host used in call to allowSpecificHTTPSCertificateForHost: \r\nnil host used in call to allowAnyHTTPSCertificateForHost:\r\nnil host used in call to allowSpecificHTTPSCertificateForHost: \r\nnil host used in call to allowAnyHTTPSCertificateForHost:\r\n\r\n## Network Transport \r\nprivate var networkTransport: HTTPNetworkTransport {\r\n let configuration = URLSessionConfiguration.default\r\n configuration.timeoutIntervalForResource = 65\r\n configuration.timeoutIntervalForRequest = 65\r\n let client = URLSessionClient(sessionConfiguration: configuration)\r\n let transport = HTTPNetworkTransport(url: URL(string: self.baseUrl)!, client: client)\r\n transport.delegate = self\r\n return transport\r\n }\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.30.0\r\n- Xcode version: 11.2.1\r\n- Swift version: 5","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Wow, weird! Never seen that before. We're not doing anything that I'm aware of that should be calling any of those methods. \r\n\r\nWould be curious if this is still happening in versions `0.34.0` and above - we made some pretty significant changes to the networking stack there. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@DiwakarThapa Is there any further information you can share here? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Since I haven't heard back in a couple weeks, I'm going to close this out - @DiwakarThapa if you get more info feel free to reopen. Anyone else with a similar problem, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Initializer default values make it very easy to accidentally create 2 distinct ApolloStore's","author":{"__typename":"User","login":"namolnad","id":"MDQ6VXNlcjYxNDg0ODA=","name":"Dan Loman"},"body":"## Bug report\r\n\r\nCurrently it's very easy, through default initializer values, to end up with multiple ApolloStore's and the inability to properly invalidate your cache. I just spent a fair amount of time debugging this issue, which I think could be resolved by removing some default values in one or both the `ApolloClient`'s and `LegacyInterceptorProvider`'s initializers. The problem is as follows:\r\n\r\n``` swift\r\nlet interceptorProvider: LegacyInterceptorProvider = .init() // More likely to use your own subclass for authentication\r\nlet transport: RequestChainNetworkTransport = .init(\r\n interceptorProvider: interceptorProvider,\r\n endpointURL: baseUrl.appendingPathComponent(\"graphql\")\r\n)\r\nlet client: ApolloClient = .init(\r\n networkTransport: transport\r\n)\r\n```\r\n\r\nThe above code creates two separate `ApolloStore`'s with default caches of `InMemoryNormalizedCache()` for both the `LegacyInterceptorProvider` and for the `ApolloClient`. When going to invalidate your cache here, you will invalidate one of the caches (the ApolloStore one), but the InterceptorProvider's cache will remain untouched, which is where results seem to be fetched from, thus making it impossible to actually invalidate the cache. Without these default values, I believe this problem would be obvious to the developer.\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.0\r\n- Xcode version: 12.0.1\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nInitialize the ApolloClient using default values, as above.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Yeah this is basically a dupe of #1438 - I'm going to take a look at your solution, I was still pondering exactly how to get this set up in a friendlier way. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yup, definitely a dupe — sorry for missing that and thanks for taking a look!","author":{"__typename":"User","login":"namolnad","id":"MDQ6VXNlcjYxNDg0ODA=","name":"Dan Loman"}},{"__typename":"IssueComment","body":"This has shipped with `0.36.0`!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"graphql file with description","author":{"__typename":"User","login":"wongzigii","id":"MDQ6VXNlcjczODQyODg=","name":"Zigii Wong"},"body":"Any way to add description to graphql file? This results in errors in compile time.\r\n\r\nA good example would be:\r\n\r\n```\r\n\"\"\"\r\nA simple GraphQL schema which is well described.\r\n\"\"\"\r\nschema {\r\n query: Query\r\n}\r\n```\r\n\r\nhttp://spec.graphql.org/draft/#sec-Descriptions\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"In theory that should not result in errors - can you give an example of a file where this is resulting in errors, along with the errors? Any information around your setup would also be really helpful. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Just add \r\n\r\n \"\"\"\r\n A simple GraphQL schema which is well described.\r\n \"\"\"\r\n\r\nto the first line of any .graphql file and Build then you will see the error.\r\n\r\n Showing Recent Messages\r\n Error: Syntax error in \r\n\r\n file:///Users/mac/a.graphql: Syntax \r\n\r\n Error: Unexpected Name \"query\".\r\n\r\n","author":{"__typename":"User","login":"wongzigii","id":"MDQ6VXNlcjczODQyODg=","name":"Zigii Wong"}},{"__typename":"IssueComment","body":"Are you trying to add this to your operation graphQL files, or to the Schema graphQL file? This syntax is intended for the schema - you can see an example in [the version of the GitHub Schema we're using for some tests](https://github.com/apollographql/apollo-ios/blob/main/Sources/GitHubAPI/schema.docs.graphql). \r\n\r\nIf you were to try to add this to an operation's graphQL file like: \r\n\r\n```graphQL\r\n\"\"\"\r\nA simple GraphQL schema which is well described.\r\n\"\"\"\r\nquery UserInfo($id: ID!) {\r\n user(id: $id) {\r\n name\r\n }\r\n}\r\n```\r\n\r\nThat would not compile. Does that help? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@wongzigii Any thoughts on my response? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Good to know! Thanks @designatednerd ","author":{"__typename":"User","login":"wongzigii","id":"MDQ6VXNlcjczODQyODg=","name":"Zigii Wong"}}]}},{"__typename":"Issue","title":"Is there any way to have a hybrid cache instead of memory/disk exclusively?","author":{"__typename":"User","login":"malonehedges","id":"MDQ6VXNlcjEyMDkyMjk2","name":"Malone Hedges"},"body":"Is there any official (or community) support for a hybrid cache for Apollo iOS?","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Not at this time but I have had at least one customer talk to us about this. We're gonna be doing some heavy work around the cache in the next couple months but probably after that we can take a look. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Awesome, would love to adopt a hybrid cache when one is available","author":{"__typename":"User","login":"malonehedges","id":"MDQ6VXNlcjEyMDkyMjk2","name":"Malone Hedges"}}]}},{"__typename":"Issue","title":"some thoughts on Interceptors","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"},"body":"## Feedback\r\n\r\nI just update from 0.33.0 to 0.36.0 and want to share some thoughts on Interceptors.\r\n\r\n- confusing what does proceedAsync, handleErrorAsync, retry and kickoff do. If I have error in response and want to retry do I call retry? or kickoff?\r\n- `Request`ChainNetworkTransport but you pass response Interceptors to it (as request and response interceptors are the same list)\r\n- confusing that same call used for request and response, only way to check for response == nil in `interceptAsync`\r\n- `TokenAddingInterceptor` from docs adds Authorization header to request not depending if its request or response. Is that how it should be?\r\n- `RequestChainNetworkTransport` have `additionalHeaders` - shouldn't this be interceptor?\r\n- there is `AutomaticPersistedQueryInterceptor` and also `autoPersistQueries` on `RequestChainNetworkTransport` what should I use?\r\n- There is `LegacyInterceptorProvider` but something not \"legacy\" (`NetworkInterceptorProvider`) only mentioned in documentation. How do I create custom provider where I add only my interceptors and leave \"default\" ones untouched? `NetworkInterceptorProvider` from docs have 10 interceptors, `LegacyInterceptorProvider` have 7. Should I inherit from `LegacyInterceptorProvider` or should I copy one from docs and constantly track if new Interceptor will just appear in the list?\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.36.0\r\n- Swift version: 5.3","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"comment about `TokenAddingInterceptor` is invalid as it is inserted in first place (so it can't be response)","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"> confusing what does proceedAsync, handleErrorAsync, retry and kickoff do. If I have error in response and want to retry do I call retry? or kickoff?\r\n\r\n- `proceedAsync` is called anytime you want to have the chain proceed to the next interceptor\r\n- `handleErrorAsync` is called anytime you want to have the chain return an error to the original caller\r\n- `kickoff` should only be called by you when you want to start the chain from scratch.\r\n- `retry` should be called if you want to retry a request - it will [reset the interceptor index under the hood and call `kickoff` to restart the chain](https://github.com/apollographql/apollo-ios/blob/9c624bbcfa1c8b3b909ee0c53ec43ebb1a50e944/Sources/Apollo/RequestChain.swift#L129). You should use this method rather than trying to reset the index yourself. Basically, don't call `kickoff` on the chain from within an interceptor, call `retry`. \r\n\r\n> RequestChainNetworkTransport but you pass response Interceptors to it (as request and response interceptors are the same list) confusing that same call used for request and response, only way to check for response == nil in interceptAsync\r\n\r\nI'm not totally clear on what the question here is - is it \"Why are we using the same interceptors for preparing a request as handling a response?\" If yes, please confirm, if not, please clarify. Thanks. \r\n\r\n> TokenAddingInterceptor from docs adds Authorization header to request not depending if its request or response. Is that how it should be?\r\n\r\nYes - the idea of that is that you put it first so that it is the first change applied before a request goes out. \r\n\r\n> RequestChainNetworkTransport have additionalHeaders - shouldn't this be interceptor?\r\n\r\nThese are intended to be additional headers that must be added to every single request, and which do not change (for example, an API key or a language setting). The interceptors are intended for things which may change (for example, a user's authentication token). \r\n\r\n> there is AutomaticPersistedQueryInterceptor and also autoPersistQueries on RequestChainNetworkTransport what should I use?\r\n\r\nThe short answer is both - `autoPersistQueries` tells you whether auto-persisted queries should be used at all, and the interceptor does the work of checking for APQ-related errors and auto-retrying when needed. Essentially, `autoPersistQueries` tells you if you should send APQ hashes outgoing, and the interceptor handles incoming responses to tell if you need to retry due to an APQ failure. \r\n\r\n> There is LegacyInterceptorProvider but something not \"legacy\" (NetworkInterceptorProvider) only mentioned in documentation. How do I create custom provider where I add only my interceptors and leave \"default\" ones untouched? NetworkInterceptorProvider from docs have 10 interceptors, LegacyInterceptorProvider have 7. Should I inherit from LegacyInterceptorProvider or should I copy one from docs and constantly track if new Interceptor will just appear in the list?\r\n\r\nYou _can_ inherit from `LegacyInterceptorProvider`, and override the method providing the array of interceptors. This is easier if you're putting interceptors at the beginning or end of the array rather than interspersing them throughout. If they're interspersed, it's likely better create your own implementation of `InterceptorProvider` and using the array provided by `LegacyInterceptorProvider` as a starting point. \r\n\r\nI will call out in release notes if any changes are made to the `LegacyInterceptorProvider`, particularly new interceptors - the intent is that the core interceptors should not change. \r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I was going through a similar thinking process as @RolandasRazma yesterday doing the same 0.33->0.36 migration. Would be super helpful if you added these explanations to the documentation for other people. ","author":{"__typename":"User","login":"Nealsoni00","id":"MDQ6VXNlcjcwMTMxOTE=","name":"Neal Soni"}},{"__typename":"IssueComment","body":"Have y'all had a chance to read through [the updated client creation documentation](https://www.apollographql.com/docs/ios/initialization/#advanced-client-creation), particularly the [section on how the request chain works](https://www.apollographql.com/docs/ios/initialization/#how-the-requestchain-works)? I would be particularly interested in where you feel like that's not clear enough. Thanks!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I did, I think for me most confusion would have been averted if:\r\n\r\n- there would be 2 lists: pre server call and post server call having different call signature (no reply in \"pre\" ones)\r\n- there would be no \"Legacy\" in class names as it made not clear what to use\r\n- don't feel feel comfortable of just copying list of \"default\" interceptors as that list might change without the realising","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"> there would be 2 lists: pre server call and post server call having different call signature (no reply in \"pre\" ones)\r\n\r\nOne of the reasons I went with a single chain is we've had repeated feature requests to have the data associated with what was being requested passed through to the completion handler. I will be taking a look at some options based on feedback here, I think maybe there could be some other options that might make `NetworkTransport` unnecessary and allow the user to send data through any transport (ie, send it with a websocket if you really feel like it). \r\n\r\n> there would be no \"Legacy\" in class names as it made not clear what to use\r\n\r\nOK. I believe I tried to explain \"Legacy\" vs \"Codable\" as \"What we've been using\" vs \"What we will be using in the future\" in those docs, but it sounds like that didn't help. I'll try to clarify that.\r\n\r\n> don't feel feel comfortable of just copying list of \"default\" interceptors as that list might change without the realising\r\n\r\nI mean, that's going to be a problem no matter what if you need to intersperse different interceptors - if you're subclassing hte default list and relying on the default order in terms of where to insert your interceptors, that's going to cause problems too. Again, I can certainly commit to making sure I make it very clear in release notes when any of this changes. \r\n","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@RolandasRazma @Nealsoni00 I've just opened a PR with updated docs. Would love your feedback on #1484. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> One of the reasons I went with a single chain is we've had repeated feature requests to have the data associated \r\n\r\nEverything could still work as it does now under the hood. 2 list would allow to not have \"response\" in pre list\r\n\r\n> I mean, that's going to be a problem no matter what\r\n\r\nthat's not necessary true if there would be 2 lists as in most cases you need \"pre action\" and \"post action\"\r\n\r\n\r\nI already migrated and now it's more clear what's going on so I'm not advocating for a change. Most likely all new users will do better as they have no expectations ","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"> 2 list would allow to not have \"response\" in pre list\r\n\r\nThat's fair. \r\n\r\n> I'm not advocating for a change.\r\n\r\nI think if we're gonna make one it's better to do it sooner rather than later, honestly. I also need to think a few things over, to be honest.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"OK, I've merged #1464. I will continue to think about what could work to make it easier to deal with when an interceptor will be called - pre or post response - and see what I can come up with. However, I wanted to check - do you feel there's anything else here that still needs to be directly addressed before we can close this issue out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I will close it","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"@RolandasRazma thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Crash in 0.36.0","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"},"body":"## Bug report\r\n\r\nCrash using interceptors\r\n\r\n\"Screenshot\r\n\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.36.0\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nI have TokenAddingInterceptor that retrieves token from server and asynchronously calls `chain.proceedAsync`. I have check for TokenAddingInterceptor being released to not call up the chain on dealloc, so that's not the case.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"The crash is happening in the `URLSessionClient` rather than in any of the interceptors - it looks like the client either a) Hasn't had a chance to set up its `URLSession` or b) has had the session torn down. \r\n\r\nCan you share how you're setting up your `TokenAddingService`? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"There is nothing interesting to see there. It just check for token validity if it it expired updates it from server and calls back. I will try to trace/fix crash as it's blocking us, but as its another race condition its not going to be simple as I can't even replicate it reliably. Sometimes it crashes every run (tests) sometimes I hit https://github.com/apollographql/apollo-ios/issues/1376 and sometimes all tests passes without any problem :)","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"I can replicate it with example from https://www.apollographql.com/docs/ios/tutorial/tutorial-mutations/\r\n\r\n```swift\r\nclass TokenAddingInterceptor: ApolloInterceptor {\r\n func interceptAsync(chain: RequestChain, request: HTTPRequest, response: HTTPResponse?, completion: @escaping (Result, Error>) -> Void) {\r\n DispatchQueue.main.async { [weak self] in\r\n guard self != nil else { return }\r\n chain.proceedAsync(request: request, response: response, completion: completion)\r\n }\r\n }\r\n \r\n}\r\n```","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"This is how memory graph looks for crashing client\r\n\r\n\"Screenshot\r\n","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"NetworkFetchInterceptor:32 don't you need `self.currentTask?.cancel()` before it?\r\n\r\nP.S. adding cancel didn't stop crash, but still, don't you need it there? (made PR https://github.com/apollographql/apollo-ios/pull/1476)","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"Ok, what's happening is that `RequestChain` (created in `RequestChainNetworkTransport`) lifetime is longer than `LegacyInterceptorProvider` and `LegacyInterceptorProvider` does `shouldInvalidateClientOnDeinit` \r\n\r\n`RequestChain` is created in `RequestChainNetworkTransport`, `LegacyInterceptorProvider` is released invalidating client and `RequestChain` knows nothing about it. \r\n\r\nI managed to \"solve\" it by retaining link to chain in `RequestChainNetworkTransport` and canceling it in `deinit` - not sure if that's correct thing to do, as that would imply that I need to cancel it on send as well (or retain all references created by send)","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"sorry for spam @designatednerd ","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"I thought not retaining chain would help\r\n\r\n```swift\r\nclass TokenAddingInterceptor: ApolloInterceptor {\r\n func interceptAsync(chain: RequestChain, request: HTTPRequest, response: HTTPResponse?, completion: @escaping (Result, Error>) -> Void) {\r\n DispatchQueue.main.async { [weak self, weak chain] in\r\n guard self != nil else { return }\r\n chain?.proceedAsync(request: request, response: response, completion: completion)\r\n }\r\n }\r\n \r\n}\r\n```\r\n\r\nbut that's not the case - it is deallocated before we can update token and call to server never executed","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"right - if you let go of the chain there there's nothing hanging on to it, so ARC smashes it. \r\n\r\nI'm surprised the legacy interceptor provider is getting deallocated - that indicates that the Request Chain Network Transport itself is getting deallocated. I would really like to see how you're setting this stuff up for tests - it seems like maybe something is calling into an old instance of RCNT in different tests. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"`RequestChainNetworkTransport` is deallocated, but the problem is not that it is deallocated, the problem is that it doesn't cleanup properly while it does that\r\n\r\n```swift\r\nclass TokenAddingInterceptor: ApolloInterceptor {\r\n func interceptAsync(chain: RequestChain, request: HTTPRequest, response: HTTPResponse?, completion: @escaping (Result, Error>) -> Void) {\r\n DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) { [weak self] in\r\n guard self != nil else { return }\r\n chain?.proceedAsync(request: request, response: response, completion: completion)\r\n }\r\n }\r\n}\r\n\r\nlet transport = RequestChainNetworkTransport(...)\r\nlet apolloClient = ApolloClient(networkTransport: transport, ...)\r\napolloClient.fetch(query: ...)\r\n```\r\n\r\nwill make whole app crash in 1 second because `ApolloClient` will be deallocated together with `RequestChainNetworkTransport` while `RequestChain` will be retained by block (and it has to be)\r\n\r\nCrash will happen because deallocatingin `LegacyInterceptorProvider` will call `client.invalidate()` that will nil `URLSessionClient.sesion` and after 1 sec it will be accessed with force unwrap","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"this is the crash https://github.com/apollographql/apollo-ios/pull/1480","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"I guess easy workaround would be to remove force unwrap, but the real problem is that `RequestChain` don't know that it is no longer needed. Correct fix would be to add \"cancel\" for chain in `RequestChainNetworkTransport` as mentioned in https://github.com/apollographql/apollo-ios/issues/1473#issuecomment-717173144 the only difficulty it that there is multiple chains per transport and all of them needs to be cancelled","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"Created PR with workaround https://github.com/apollographql/apollo-ios/pull/1481 but somehow don't fee good about it :) It doe's work, but feels like some code smell","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"should I close this?","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"I'll close it when it actually ships","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"GraphQLError parsing issue in response?.parsedResponse ","author":{"__typename":"User","login":"StanislavCekunov","id":"MDQ6VXNlcjk3NzQ0Nzc=","name":null},"body":"Hello Apollo community,\r\nI am currently updating our codebase to support `RequestChainNetworkTransport` interface. \r\nIn a previous structure I used `HTTPNetworkTransportGraphQLErrorDelegate` to catch `GraphQLError` to initiate access token update and retryHandler to retry faild request. \r\n\r\nWith the new `RequestChain` structure I am perfoming same action inside ResponseCodeInterceptor. Though, `GraphQLError` is not being parced anymore. I am accessing it by `response?.parsedResponse?.errors`\r\n\r\nHere is the response raw data: \r\n`{\"errors\":[{\"message\":\"Access denied\",\"path\":[\"getUserDetails\"],\"locations\":[{\"line\":2,\"column\":1}],\"extensions\":{\"code\":\"accessTokenExpired\"}}],\"data\":null}`\r\n\r\nWould love to get some help or suggestions where is the right way to fetch `GraphQLError` this time.\r\nAm I doing something wrong? \r\nThanks\r\n\r\n## Versions\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.36.0\r\n- Swift version: 5.3\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I would probably do this check in an interceptor that runs after `LegacyParsingInterceptor` - that's where the actual parsing takes place, and after it's gone through that inteceptor, you should be able to access it using `response?.parsedResponse?.errors`. \r\n\r\nThe `ResponseCodeInterceptor` that's provided by default is mostly just checking to make sure the response code is something vaguely sane before attempting to parse the result","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Thank you @designatednerd !\r\nI have added a new interceptor `AccessTokenValidationInterceptor` right after `LegacyParsingInterceptor`. \r\nSolved. 🙌 \r\n\r\n","author":{"__typename":"User","login":"StanislavCekunov","id":"MDQ6VXNlcjk3NzQ0Nzc=","name":null}},{"__typename":"IssueComment","body":"@StanislavCekunov Mind if we close this out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Using same query with different set of fields","author":{"__typename":"User","login":"vani2","id":"MDQ6VXNlcjQ3MzQ5ODM=","name":"Ivan Vavilov"},"body":"## Question\r\n\r\nI have query of `draftProfile` and `profile`\r\n\r\n```GraphQL\r\nquery fetchProfile {\r\n draftProfile {\r\n firstName\r\n secondName\r\n },\r\n profile {\r\n firstName\r\n secondName \r\n }\r\n}\r\n```\r\n\r\nLater I need to make the same query but only `profile` object.\r\n\r\n```GraphQL\r\nquery fetchProfile {\r\n profile {\r\n firstName\r\n secondName \r\n }\r\n}\r\n``` \r\n\r\nIf I declare these two queries I get the error `There are multiple definitions for the `fetchProfile` operation. Please rename or remove all operations with the duplicated name before continuing.`.\r\n\r\nHow I can make it possible? \r\n\r\n## Versions\r\n\r\n- `apollo-ios` SDK version: 0.35\r\n- Xcode version: 12.0\r\n- Swift version: 5.3","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"You need to give the two queries different names at the `query fetchProfile` point. Maybe `query fetchProfileWithDraft` for that top one and just `fetchProfile` for the bottom one? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Oh, yes, that's easy. Thanks.","author":{"__typename":"User","login":"vani2","id":"MDQ6VXNlcjQ3MzQ5ODM=","name":"Ivan Vavilov"}}]}},{"__typename":"Issue","title":"XCode 12 : Could not find module ‘Apollo’ for target ‘arm64-apple-ios-simulator’; found: x86_64-apple-ios-simulator, x86_64","author":{"__typename":"User","login":"poorvasingh04","id":"MDQ6VXNlcjIwMDkwODU5","name":"Poorva Singh"},"body":"## Bug report\r\n\r\nXCode 12 : Could not find module ‘Apollo’ for target ‘arm64-apple-ios-simulator’; found: x86_64-apple-ios-simulator, x86_64\r\nUnable to build app against iOS simulator using XCode 12.\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.27.1 and 0.36.0\r\n- Xcode version: 12\r\n- Swift version: 5\r\n\r\n## Steps to reproduce\r\nBuild code against iOS simulator. I am using app to build against iOS simulator for UI tests.\r\n\r\n## Further details\r\n\r\nCode fails to compile. I also added following post install script in podfile:\r\n\r\npost_install do |pi|\r\n pi.pods_project.targets.each do |t|\r\n t.build_configurations.each do |config|\r\n config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'\r\n config.build_settings[\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\"] = \"arm64\"\r\n end\r\n end\r\nend\r\n\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"It looks like your post-install script's change `EXCLUDED_ARCHS` is actively excluding the `arm64` type that the compiler is looking for. Is there a particular reason why you're excluding that? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd yes. To compile with Xcode 12 against iOS simulator, we need to exclude arm64 architecture in app and all the linked pods. This is same issue as described here: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios","author":{"__typename":"User","login":"poorvasingh04","id":"MDQ6VXNlcjIwMDkwODU5","name":"Poorva Singh"}},{"__typename":"IssueComment","body":"Interesting - there's a related suggestion in there about making sure that `ONLY_ACTIVE_ARCH` is set to yes for your debug setup. In a sample CocoaPods app I've got where that's set up I have not seen this issue.\r\n\r\nI *think* as long as you're not building on a developer transition kit, setting that up should help with this, since it seems like Xcode is trying to build the universe, then complaining that the thing you specifically told it not to build isn't there.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd ONLY_ACTIVE_ARCH is already set to Yes","author":{"__typename":"User","login":"poorvasingh04","id":"MDQ6VXNlcjIwMDkwODU5","name":"Poorva Singh"}},{"__typename":"IssueComment","body":"🤔 That's...very odd if you're not on a developer transition kit. Are you on a developer transition kit? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd no. I am not in a developer transition kit. I am trying to build app against simulator for my UI tests but it fails with Xcode 12.1","author":{"__typename":"User","login":"poorvasingh04","id":"MDQ6VXNlcjIwMDkwODU5","name":"Poorva Singh"}},{"__typename":"IssueComment","body":"Here's a couple other things I can think of that are unlikely but worth checking: \r\n\r\n- If there's more than one target in your project, are all targets in your project set for `ONLY_ACTIVE_ARCH`, or just the main application?\r\n- Is your scheme set to run the tests in release mode rather than debug mode? \r\n- Is there something about XCUI tests that's trying to build the app for release even though your tests are set in debug?\r\n\r\nIf none of those turn up the problem, do you mind either emailing me your project or a sample project that reproduces this issue? ellen at apollographql dot com. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Were you ever able to figure this out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Race condition when unsubscribing","author":{"__typename":"User","login":"marioradonic","id":"MDQ6VXNlcjQxNTg3Mzc=","name":null},"body":"## Bug report\r\n\r\nI've been randomly (but often) getting `.unprocessedMessage` errors in my `.subscribe(...` handlers. I had a look at the code and it seems to me that there is a possible race condition.\r\n\r\nWhen [unsubscribing](https://github.com/apollographql/apollo-ios/blob/e0f65fee8c197239dbefbf1386b8e7f83b684f25/Sources/ApolloWebSocket/WebSocketTransport.swift#L301) from a subscribe task websocket message is sent requesting the subscription to stop and handler is released. It might be possible that a message is received from the socket with the update before the backend has time process this stop message and stop sending the messages. So in the [processMessage](https://github.com/apollographql/apollo-ios/blob/e0f65fee8c197239dbefbf1386b8e7f83b684f25/Sources/ApolloWebSocket/WebSocketTransport.swift#L146) method we end up in [this clause](https://github.com/apollographql/apollo-ios/blob/e0f65fee8c197239dbefbf1386b8e7f83b684f25/Sources/ApolloWebSocket/WebSocketTransport.swift#L177) because there is no subscription handlers any more. And then **all** the other handlers are notified about this error. This doesn't seem right to me as there was nothing wrong with other subscriptions.\r\n\r\nI'm not an expert in web sockets, so I don't know what the best solution would be. Maybe wait for the ack message from backend? But then the subscriber might get a message after cancelling the task, which is not nice. Maybe keep an intermittent array of task ids whose cancellation hasn't been acknowledged by the backend and ignore messages for those subscribers? That is if there is a stop acknowledge message from backend.\r\n\r\nI don't mind creating a PR if someone suggests the approach on how to fix this.\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.35.0\r\n- Xcode version: 12.1\r\n- Swift version: 5.3\r\n\r\n## Steps to reproduce\r\n\r\nI have a rx code in format of:\r\n`subscribeSomething().flatMapLatest { subscribeSomethingElse(using: $0) }`\r\n\r\nWhen the first subscription updates the second one is cancelled and new one is created.\r\n\r\n## Further details\r\n\r\nI can probably restructure my query so it's all done in one subscription, which would fix my issue but the underlying problem will still be there although it might happen less often.\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"I don't have any bright ideas on this one, websockets are also not my area of expertise. \r\n\r\n@fassko, if you're around, would love to hear any thoughts you have.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I was using GraphQL subscriptions with just one subscription. Otherwise, you can run into these weird side effects that you explained.","author":{"__typename":"User","login":"fassko","id":"MDQ6VXNlcjI5NDgy","name":"Kristaps Grinbergs"}},{"__typename":"IssueComment","body":"@fassko Well, it was worth a shot 🙃\r\n\r\n@marioradonic - Are you subscribing to the same `subscription` from your schema multiple times, or are there different `subscription`s defined that you're using? Basically, are your multiple subscriptions all returning the same information, or different information?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@designatednerd I am using multiple. Basically, I am subscribing to entity A, and when it updates I subscribe to entity B, cancelling the previous B subscription if there was any. (this cancelled subscription causes the problem - if the message comes from the backend with the cancelled subscription id the first entity A subscriber and the new B subscriber get the error message.\r\n\r\nI had another look at the websocket connection and it seems there is no closing acknowledgment message from the backend upon closing the subscription. So I'm not sure at which point should an unhandled message be considered an internal error. In any case I don't think it's a good API design that all the other subscribers get the error message, since nothing is wrong with their subscriptions. Maybe there could be a global error handler for these kinds of errors?\r\n\r\n","author":{"__typename":"User","login":"marioradonic","id":"MDQ6VXNlcjQxNTg3Mzc=","name":null}},{"__typename":"IssueComment","body":">cancelling the previous B subscription if there was any. \r\n\r\nIn theory you shouldn't have to cancel any existing subscription to entity B - if you've already got a running subscription it should continue to get all updates.\r\n\r\nIt may help me understand a bit better if you can give a concrete example of what entity A and entity B are representing. To take an example from our sample code, if you've subscribed to all reviews of Star Wars episodes, then as soon as you get a review of _Return of the Jedi_ kick off a second subscription that only handles _Jedi_ reviews, any further reviews that come in on that first subscription for _Jedi_ would also come in on the second subscription, without needing to stop and restart. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"spectrum.chat/apollo link is unavailable, Heroku error shown","author":{"__typename":"User","login":"gemmakbarlow","id":"MDQ6VXNlcjMzNzk2Mw==","name":"Gemma Barlow"},"body":"## Bug report\r\n\r\nMorning folks ! \r\n\r\nNot technically an Apollo bug, but I wanted to flag that https://spectrum.chat/apollo, linked from [CONTRIBUTING.md](https://github.com/apollographql/apollo-ios/blob/main/CONTRIBUTING.md), is currently returning a Heroku error.\r\n\r\n\"Screen\r\n\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- N / A\r\n\r\n## Steps to reproduce\r\n\r\n- N / A\r\n\r\n## Further details\r\n\r\nPlease feel free to close this if it isn't something you are in control of / hosting yourselves. I wasn't able to find a status page for the tool / platform and am not familiar with it. Google results get mixed in with the ISP provider unfortunately. 😄 ","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Haha, i have the same problem with the ISP, particularly since they are _my_ ISP. \r\n\r\nSpectrum is a chat platform that got bought out by GitHub about a year and a half ago - we'd been using them prior to that buyout and have been continuing to do so. Thanks for the heads up on this, but unfortunately there isn't much we can do about their deploys failing. Upside is it seems to be back up and running now, though!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"How to handle errors correctly","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null},"body":"Hi,\r\nI am currently on the stage of migrating from 0.33 -> 0.36. Gone through all the provided documentation, but I am still confused on what would be the correct way of handling errors(also read the suggested article: https://medium.com/@sachee/200-ok-error-handling-in-graphql-7ec869aec9bc).\r\n\r\nBefore going to write this question, I just wanted to give it a try myself.\r\nOne of the most important use cases related to error handling is that we want to cover the case when a auth token expires on the backend, which results in an error when performing the next app query or mutation. At this stage, we want to catch the error, perform automatically a relogin(call `login` mutation), which basically will return a new auth token and after all that re-execute the failed request(query/mutation).\r\nAs far as I managed to understand, the best way to do this is through `ApolloErrorInterceptor`, which I basically did. I created a custom `ApolloErrorInterceptor`, returned it in `InterceptorProvider.additionalErrorInterceptor`.\r\nThe first problem I met is that it seems that not absolutely all errors get through this interceptor. Which left me without ideas on how to continue, but since this new apollo sdk approach is pretty fresh, I also left some space to consider it might be a bug, `full stop`.\r\n\r\nNow my question is: what is the correct way of handling errors? Can we improve the documentation to provide more examples about it?\r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Interesting, I thought it was me but maybe `InterceptorProvider.additionalErrorInterceptor` is not what we expect.\r\nI just went through same update and had same problem as you do. what worked for me was:\r\n\r\n```swift\r\n/// InterceptorProvider\r\n func interceptors(for operation: Operation) -> [ApolloInterceptor] {\r\n return [\r\n MaxRetryInterceptor(),\r\n LegacyCacheReadInterceptor(store: self.store),\r\n TokenAddingInterceptor(...),\r\n NetworkFetchInterceptor(client: self.client),\r\n TokenErrorInterceptor(...),\r\n ResponseCodeInterceptor(),\r\n LegacyParsingInterceptor(cacheKeyForObject: self.store.cacheKeyForObject),\r\n AutomaticPersistedQueryInterceptor(),\r\n LegacyCacheWriteInterceptor(store: self.store),\r\n ]\r\n }\r\n\r\n func additionalErrorInterceptor(for operation: Operation) -> ApolloErrorInterceptor? {\r\n return nil\r\n }\r\n```\r\n\r\n```swift\r\n/// TokenErrorInterceptor\r\n func interceptAsync(chain: RequestChain, request: HTTPRequest, response: HTTPResponse?, completion: @escaping (Result, Error>) -> Void) {\r\n guard\r\n let responseStatusCode = response?.httpResponse.statusCode,\r\n responseStatusCode == 401\r\n else {\r\n chain.proceedAsync(request: request, response: response, completion: completion)\r\n return\r\n }\r\n \r\n tokenService.renewAccessToken { [weak self] (error: OAuthSwiftError?) in\r\n guard self != nil else { return }\r\n \r\n if let error = error {\r\n chain.handleErrorAsync(error, request: request, response: response, completion: completion)\r\n } else {\r\n chain.retry(request: request, completion: completion)\r\n }\r\n }\r\n }\r\n```\r\n\r\nneither `additionalErrorInterceptor` nor having `TokenErrorInterceptor` after `ResponseCodeInterceptor` worked","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"`additionalErrorInterceptor` is generally intended for error handling *after* something has been dealt with by the request chain. In this case, you want to deal with it *within* the request chain, so that you can call retry. \r\n\r\n@RolandasRazma's example is a great one if the token error is coming back from middleware and causing a `401 Unauthorized` to be returned. \r\n\r\nIf there's something within GraphQL that's returning the error, you'll get a `200 OK` and an error on `GraphQLResult`'s `errors` property. In that case, you would want to insert your `TokenErrorInterceptor` after the `LegacyParsingInterceptor`, since that's where those would actually be parsed.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> `additionalErrorInterceptor` is generally intended for error handling _after_ something has been dealt with by the request chain.\r\n\r\nJust for the sake of understanding it better, what does it mean and why in some particular conditions it is not called.? I guess some of the docs needs to be more explicit about the use cases when it should be used.","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null}},{"__typename":"IssueComment","body":"It only wouldn't be called if it doesn't exist. It's designed to be a place to have all errors, no matter what the origin, pass through before being handed back to the caller. This allows for things like error logging that are hard to do without a centralized error handler. \r\n\r\nI'll work on clarifying this in the docs.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@odanu @RolandasRazma Added some docs on the additional error interceptor to #1484 ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"OK, that's merged - is there anything else here I can help clarify, or do you mind if we close this out?","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I think you can close this ticket. Though you have to maybe give it a try for different use cases around `additionalErrorInterceptor`. As written above, it looks like it doesn't catch all the errors.","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null}},{"__typename":"IssueComment","body":"> nor having `TokenErrorInterceptor` after `ResponseCodeInterceptor` worked\r\n\r\nHere the issue would be that the `401` response code would be caught by the `ResponseCodeInterceptor` [and returned as an error through `handleErrorAsync`](https://github.com/apollographql/apollo-ios/blob/a00031c2a357c03a2f58a5dda0afb35462dfef42/Sources/Apollo/ResponseCodeInterceptor.swift#L44) (which in turn [calls the `additionalErrorInterceptor` if it exists](https://github.com/apollographql/apollo-ios/blob/a00031c2a357c03a2f58a5dda0afb35462dfef42/Sources/Apollo/RequestChain.swift#L149)) and the chain would not proceed. \r\n\r\nThat would mean `TokenErrorInterceptor` wouldn't get called because an error has already been caught. That's why you have to put it before the `ResponseCodeInterceptor`. \r\n\r\nDoes that help explain why that wouldn't work? Or is there another place where things aren't showing up where you expect them to? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"No Ellen. I was not referring this part. Let's sum up again the thoughts.\r\nThe documentation and you, assures that `additionalErrorInterceptor` gets called, having the error which was collected in any of the interceptors. Which basically means that no matter at which level of the request/response/parsing/etc an error occurs, it will arrive to the `additionalErrorInterceptor`.\r\nNow as mentioned in the initial question, it seems that not all of the errors reach the `additionalErrorInterceptor`. That was my initial test. I just thought it would be the right place to handle all the errors, but got blocked because some of the errors didn't get to it. Check the question again please :).","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null}},{"__typename":"IssueComment","body":"Right, and my question is, what are the errors that are not passed through in your testing? \r\n\r\nNote that if there is an _expected_ error, which is handled by the interceptor (for example, the auto-persisted-query-specific error which is handled by the `AutomaticPersistedQueryInterceptor`), then that is not passed on since that is an error that was expected and handled. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"I will try to collect the information tomorrow;)","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null}},{"__typename":"IssueComment","body":"So I can find 2 cases when `additionalErrorInterceptor` is not used:\r\n1. when an interceptor caught the error triggered retry... the example with expired token\r\n2. `GraphQLError` objects which arrive through `GraphQLResults.errors` array.\r\n\r\nBut I guess both of these cases is expected behaviour.","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null}},{"__typename":"IssueComment","body":"You're correct - because a `GraphQLResult` can contain partial results with an error explaining what's missing, simply having `errors` be non-empty doesn't indicate that a request failed. \r\n\r\nYou can see an example of where we're looking for _specific_ errors to handle in that array in the `AutomaticPersistedQueryInterceptor`, and if you know your backend will be returning _specific_ errors you need to handle in that array (for example, token expiration errors there instead of as a 401), you can add your own interceptors to handle those. \r\n\r\nOtherwise, `GraphQLError`s should be returned as part of the `GraphQLResult`.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"@odanu Anything else here or can I close this out? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Oh sorry. All good. I had to close it earlier.","author":{"__typename":"User","login":"odanu","id":"MDQ6VXNlcjExMTA0MDg=","name":null}},{"__typename":"IssueComment","body":"👍 Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"How to fix that error?","author":{"__typename":"User","login":"zinminphyo","id":"MDQ6VXNlcjMzMzY4MzQ3","name":"Zin Min Phyo"},"body":"## Bug report\r\n\r\nPlease replace this line with a short description of the problem. Make sure you've read `CHANGELOG.md` in the root of the repo to make sure a new version hasn't already addressed your problem!\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.34.1\r\n- Xcode version: 12.0\r\n- Swift version: 5\r\n\"Screen\r\n\r\n- Package manager:\r\n\r\n## Steps to reproduce\r\n\r\nPlease replace this line with steps to reproduce the problem.\r\n\r\n## Further details\r\n\r\nPlease replace this line with any further details or context necessary to understand the problem. Delete this section if you don't have anything further to add.","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"@zinminphyo Can you please share more details about when and how this happened? It's not something I can necessarily tell you why it's happening without more detail. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Since I haven't gotten any further details here, I'm going to close this out. @zinminphyo Please reopen with further details if you have them. Anyone else with a similar problem, please open a new issue. Thank you!","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Generate Apollo GraphQL Api Bitrise issue","author":{"__typename":"User","login":"Kevin94singh","id":"MDQ6VXNlcjIxMzQ3NDg5","name":"Kevin Singh"},"body":"Hi,\r\n\r\nWhen building on a local machine with Fastlane, everything works ok. However, when I try to upload my build with Bitrise, I'm getting an error: \r\n\r\n```\r\n- ▸ Running script 'Generate Apollo GraphQL API'\r\n** ARCHIVE FAILED **\r\nThe following build commands failed:\r\n\tPhaseScriptExecution Generate\\ Apollo\\ GraphQL\\ API /Users/vagrant/Library/Developer/Xcode/DerivedData/project_name-asogvanbfzdyhybkhoculdmlwwfk/Build/Intermediates.noindex/ArchiveIntermediates/project_name_beta/IntermediateBuildFilesPath/project_name.build/Release-iphoneos/project_name_beta/Script-7A325491234C77FE003B1AE2.sh\r\n(1 failure)\r\n[11:36:34]: Exit status: 65\r\n```\r\n**Our Generate Apollo GraphQL API script**\r\n\r\n```\r\nSCRIPT_PATH=\"${PODS_ROOT}/Apollo/scripts\"\r\ncd \"${SRCROOT}/ProjectName\"\r\n\"${SCRIPT_PATH}\"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile=\"schema.json\" API.swift\r\n```\r\n\r\n| - project_folder\r\n | project.xcodeproj\r\n | - target_folder \r\n | schema.json\r\n | AppDelegate.swift\r\n | ViewController.swift\r\n | etc...\r\n | - another_folders\r\n | etc...\r\n\r\n**Apollo version: 0.30, iOS, Bitrise Fastlane version 2.7.x ** We have two targets (prod and beta), currently trying to build for Beta.\r\n\r\nI think that there might be an issue with NPM. In our workflow on Bitrise, I've set `run npm command`- `install -g apollo@2.25` - the version I have on my machine. But this step doesn't help. \r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"If you're using `run-bundled-codegen` it shouldn't be an issue with NPM - the bundled codegen downloads Node and all dependencies as a workaround because we were having *so* many problems with NPM. It certainly seems like another issue is happening that's causing the code generation to fail but isn't spitting out a reason correctly. \r\n\r\nI take it things build correctly when you try to run this locally? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"> If you're using `run-bundled-codegen` it shouldn't be an issue with NPM - the bundled codegen downloads Node and all dependencies as a workaround because we were having _so_ many problems with NPM. It certainly seems like another issue is happening that's causing the code generation to fail but isn't spitting out a reason correctly.\r\n> \r\n> I take it things build correctly when you try to run this locally?\r\n\r\nYes, when I run this locally with Fastlane, it builds correctly.","author":{"__typename":"User","login":"Kevin94singh","id":"MDQ6VXNlcjIxMzQ3NDg5","name":"Kevin Singh"}},{"__typename":"IssueComment","body":"Weird - and are you using Fastlane on bitrise as well, or something else? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yes, we are using Fastlane. Our steps for a workflow are Activate SSH Key, Git Clone repository, and Fastlane (set to a version 2.x.x, that is currently 2.7.1).","author":{"__typename":"User","login":"Kevin94singh","id":"MDQ6VXNlcjIxMzQ3NDg5","name":"Kevin Singh"}},{"__typename":"IssueComment","body":"Cool, thanks for clarifying - how are you setting things to \"beta\" - using a Scheme or a build configuration or some combination thereof? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"We have two schemes - \"beta\" and \"prod\". Each has its own target. The script is implemented in both targets .","author":{"__typename":"User","login":"Kevin94singh","id":"MDQ6VXNlcjIxMzQ3NDg5","name":"Kevin Singh"}},{"__typename":"IssueComment","body":"And am I correct in assuming the `.graphql` files and `API.swift` output are in the same folder (under `\"${SRCROOT}/ProjectName\"`), just shared between both targets? \r\n\r\nHonestly, if it's working locally and the only error info you're getting from Bitrise is a generic exit code 65, I'm not sure how much help I can be - you may want to reach out to them to see if you can get more detailed logs about what's not building on your beta version. \r\n\r\nOne thing I have tried in the past when something's building locally but not on CI for me is to check it back out in a separate folder and try from there - I've definitely found issues where there's some kind of local config not checked into version control that means it works in your main working directory, but not for anyone else (including CI) that checks it out. Probably worth a shot just to rule that out as a cause.","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Yes, it is shared between both targets. Prod build shows the same failure as a beta. \r\n\r\nI'll try to get more detailed logs and let you know. Thank you for your time! 😊","author":{"__typename":"User","login":"Kevin94singh","id":"MDQ6VXNlcjIxMzQ3NDg5","name":"Kevin Singh"}}]}},{"__typename":"Issue","title":"callbackQueue is not used in WebSocketTransport","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"},"body":"## Bug report\r\n\r\nhttps://github.com/apollographql/apollo-ios/blob/185d6b784538691b5a4287c25df9cae140abec02/Sources/ApolloWebSocket/WebSocketTransport.swift#L361 callbackQueue is unused\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.36.0\r\n\r\n## Steps to reproduce\r\n\r\nsubscribe using any callbackQueue, callback is done on some internal one","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Welp, that's embarrassing. Fix is up in #1507. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"thanks","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"Thank YOU for catching it","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"WebSocketTransport.send completionHandler is called in non escaping manner in case of error","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"},"body":"## Bug report\r\n\r\nhttps://github.com/apollographql/apollo-ios/blob/185d6b784538691b5a4287c25df9cae140abec02/Sources/ApolloWebSocket/WebSocketTransport.swift#L364\r\n\r\ncompletionHandler is called in non escaping manner in case of error\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.36.0","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Do you mean it's not called on the callback queue? ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"Was thinking about @escaping but yes, calling it on callback cue would fix that","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}},{"__typename":"IssueComment","body":"It's declared as [`@escaping` here](https://github.com/apollographql/apollo-ios/blob/185d6b784538691b5a4287c25df9cae140abec02/Sources/ApolloWebSocket/WebSocketTransport.swift#L362) - declaring escaping does not require it to escape, though. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}},{"__typename":"IssueComment","body":"sure, but it might break flow depending on what's happening internally\r\n\r\n```swift\r\nWebSocketTransport.send {\r\n print(\"a\")\r\n}\r\n\r\nprint(\"b\")\r\n```\r\n\r\nwhat order will be output depends on internal state and that's not great.\r\n\r\nIn any case, closing as https://github.com/apollographql/apollo-ios/pull/1507 fixes it","author":{"__typename":"User","login":"RolandasRazma","id":"MDQ6VXNlcjEwMjcxODc=","name":"Rolandas Razma"}}]}},{"__typename":"Issue","title":"Compatibility issues on Linux with CommonCrypto","author":{"__typename":"User","login":"abdimaye","id":"MDQ6VXNlcjI5MDIzNzI2","name":null},"body":"## Feature request\r\n\r\nThe CommonCrypto module is only available in Xcode 10+. It would be nice to have this replaced with an open source module such that the apollo client can run on other platforms.\r\n\r\n## Motivation\r\n\r\nWe are currently trying to run parts of our codebase on Linux.\r\n\r\n## Proposed solution\r\n\r\nReplace CommonCrypto with an open source library. There are only two files in ApolloCore that use it and the diff wouldn't be that big. \r\n\r\nI was looking at `swift-crypto` https://swift.org/blog/crypto/ but there are compatibility issues where it requires mocos 10.15 and apollo requires 10.10. \r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"We don't *officially* support Linux, but I would very much like to. My thought is that we could make some kind of protocol that uses `swift-crypto` for Linux band still uses `CommonCrypto` on iOS etc. Would be more than open to a PR if you have some time, I'm buried at the moment. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}},{"__typename":"Issue","title":"Apollo CLI step fails to locate SourcePackages directory ","author":{"__typename":"User","login":"alcamla","id":"MDQ6VXNlcjI5MDQ1Mjk=","name":"Alejandro Camacho"},"body":"## Bug report\r\n\r\nI am following the steps on the tutorial for iOS. I added Apollo to the project using SPM. After adding the corresponding CLI script, and building the project, I get the following error: \r\n`error: Unable to locate SourcePackages directory from BUILD_ROOT: '/Users/myUser/Library/Developer/Xcode/DerivedData/Build/Products'`\r\nI have noticed that BUILD_ROOT is set to that folder directly, so there is no chance that the while loop finds the SourcePackages folder. I am running on Xcode 12.1\r\n\r\n## Versions\r\n\r\nPlease fill in the versions you're currently using: \r\n\r\n- `apollo-ios` SDK version: 0.36\r\n- Xcode version: 12.1\r\n- Swift version: 5.3\r\n- Package manager: Swift package manager\r\n\r\n## Steps to reproduce\r\n\r\n1. Create project\r\n2. Add Apollo dependency using SPM\r\n3. Add new run script phase with the code generation build step for SPM\r\n4. Modify the last line to download the schema on first run\r\n5. Build the project \r\n","comments":{"__typename":"IssueCommentConnection","nodes":[{"__typename":"IssueComment","body":"Ugh, I bet they changed the damned location of the source packages in 12.1 - it's definitely undocumented. \r\n\r\nI'll get a look at this tomorrow, but I think I'm going to recommend trying the [Swift Scripting Setup](https://www.apollographql.com/docs/ios/swift-scripting/) - that doesn't have any dependency on going diving through the derived data folder. ","author":{"__typename":"User","login":"designatednerd","id":"MDQ6VXNlcjE5NzY0OTg=","name":"Ellen Shapiro"}}]}}]}}}} diff --git a/Tests/ApolloPerformanceTests/SelectionSetInitializerPerformanceTests.swift b/Tests/ApolloPerformanceTests/SelectionSetInitializerPerformanceTests.swift deleted file mode 100644 index 02275a5f88..0000000000 --- a/Tests/ApolloPerformanceTests/SelectionSetInitializerPerformanceTests.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers -import AnimalKingdomAPI - -class SelectionSetInitializerPerformanceTests: XCTestCase { - - func testPerformance_selectionSetInitialization_concreteObjectTypeCaseWithMultipleFulfilledFragments() { - measure { - for _ in 0..<1_000 { - let animal = AllAnimalsQuery.Data.AllAnimal.AsDog( - favoriteToy: "Milk Bone", - height: .init(feet: 3, meters: 1, relativeSize: .case(.small), centimeters: 100), - species: "Canine", - predators: [], - bodyTemperature: 98 - ) - XCTAssertNotNil(animal) - } - } - } - -} diff --git a/Tests/ApolloPerformanceTests/TypeCaseConversionPerformanceTests.swift b/Tests/ApolloPerformanceTests/TypeCaseConversionPerformanceTests.swift deleted file mode 100644 index ee0da2fdb3..0000000000 --- a/Tests/ApolloPerformanceTests/TypeCaseConversionPerformanceTests.swift +++ /dev/null @@ -1,43 +0,0 @@ -import Foundation -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers -import AnimalKingdomAPI - -class TypeCaseConversionPerformanceTests: XCTestCase { - - func testPerformance_typeConversion_checkTypeConformsToInterface() { - let animal = AllAnimalsQuery.Data.AllAnimal.AsDog( - favoriteToy: "Milk Bone", - height: .init(feet: 3, meters: 1, relativeSize: .case(.small), centimeters: 100), - species: "Canine", - predators: [], - bodyTemperature: 98 - ).asRootEntityType - - measure { - for _ in 0..<1_000 { - let asDog = animal.asDog - XCTAssertNotNil(asDog) - } - } - } - - func testPerformance_typeConversion_inclusionCondition() { - let animal = AllAnimalsIncludeSkipQuery.Data.AllAnimal.IfNotSkipHeightInMeters( - __typename: "Dog", - height: .init(feet: 3, inches: 36, meters: 1), - species: "Canine", - predators: [] - ).asRootEntityType - - measure { - for _ in 0..<1_000 { - let asConditional = animal.ifNotSkipHeightInMeters - XCTAssertNotNil(asConditional) - } - } - } - -} diff --git a/Tests/ApolloServerIntegrationTests/DefaultInterceptorProviderIntegrationTests.swift b/Tests/ApolloServerIntegrationTests/DefaultInterceptorProviderIntegrationTests.swift deleted file mode 100644 index 40825d9a75..0000000000 --- a/Tests/ApolloServerIntegrationTests/DefaultInterceptorProviderIntegrationTests.swift +++ /dev/null @@ -1,79 +0,0 @@ -import Apollo -import XCTest -import StarWarsAPI - -/// Tests that the `DefaultInterceptorProvider` configures an `ApolloClient` that successfully -/// communicates with an external Apollo Server. -/// -/// - Precondition: These tests will only pass if a local instance of the Star Wars server is -/// running on port 8080. -/// This server can be found at https://github.com/apollographql/starwars-server -class DefaultInterceptorProviderIntegrationTests: XCTestCase { - - var client: ApolloClient! - - override func setUp() { - let url = TestServerURL.starWarsServer.url - let store = ApolloStore() - let provider = DefaultInterceptorProvider(store: store) - let transport = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: url) - - client = ApolloClient(networkTransport: transport, store: store) - } - - override func tearDown() { - client = nil - - super.tearDown() - } - - func testLoading() { - let expectation = self.expectation(description: "loaded with default client") - client.fetch(query: HeroNameQuery(episode: nil)) { result in - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertEqual(graphQLResult.data?.hero?.name, "R2-D2") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - - } - expectation.fulfill() - } - - self.wait(for: [expectation], timeout: 10) - } - - func testInitialLoadFromNetworkAndSecondaryLoadFromCache() { - let initialLoadExpectation = self.expectation(description: "loaded with default client") - client.fetch(query: HeroNameQuery(episode: nil)) { result in - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertEqual(graphQLResult.data?.hero?.name, "R2-D2") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - - } - initialLoadExpectation.fulfill() - } - - self.wait(for: [initialLoadExpectation], timeout: 10) - - let secondLoadExpectation = self.expectation(description: "loaded with default client") - client.fetch(query: HeroNameQuery(episode: nil)) { result in - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertEqual(graphQLResult.data?.hero?.name, "R2-D2") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - - } - secondLoadExpectation.fulfill() - } - - self.wait(for: [secondLoadExpectation], timeout: 10) - } -} diff --git a/Tests/ApolloServerIntegrationTests/Info.plist b/Tests/ApolloServerIntegrationTests/Info.plist deleted file mode 100644 index 64d65ca495..0000000000 --- a/Tests/ApolloServerIntegrationTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Tests/ApolloServerIntegrationTests/SchemaRegistryApolloSchemaDownloaderTests.swift b/Tests/ApolloServerIntegrationTests/SchemaRegistryApolloSchemaDownloaderTests.swift deleted file mode 100644 index 7907c2bdc0..0000000000 --- a/Tests/ApolloServerIntegrationTests/SchemaRegistryApolloSchemaDownloaderTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -#if os(macOS) -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class SchemaRegistryApolloSchemaDownloaderTests: XCTestCase { - func testDownloadingSchema_fromSchemaRegistry_shouldOutputSDL() throws { - let testOutputFolderURL = CodegenTestHelper.outputFolderURL() - XCTAssertFalse(ApolloFileManager.default.doesFileExist(atPath: testOutputFolderURL.path)) - - guard let apiKey = ProcessInfo.processInfo.environment["REGISTRY_API_KEY"] else { - throw XCTSkip("No API key could be fetched from the environment to test downloading from the schema registry") - } - - let settings = ApolloSchemaDownloadConfiguration.DownloadMethod.ApolloRegistrySettings( - apiKey: apiKey, - graphID: "Apollo-Fullstack-8zo5jl" - ) - let configuration = ApolloSchemaDownloadConfiguration( - using: .apolloRegistry(settings), - outputPath: CodegenTestHelper.schemaFolderURL().path - ) - - try ApolloSchemaDownloader.fetch(configuration: configuration) - XCTAssertTrue(ApolloFileManager.default.doesFileExist(atPath: configuration.outputPath)) - - // Can it be turned into the expected schema? - let frontend = try GraphQLJSFrontend() - let source = try frontend.makeSource(from: URL(fileURLWithPath: configuration.outputPath)) - let schema = try frontend.loadSchema(from: [source]) - let rocketType = try schema.getType(named: "Rocket") - XCTAssertEqual(rocketType?.name, "Rocket") - } -} -#endif diff --git a/Tests/ApolloServerIntegrationTests/StarWarsApolloSchemaDownloaderTests.swift b/Tests/ApolloServerIntegrationTests/StarWarsApolloSchemaDownloaderTests.swift deleted file mode 100644 index 13e7abee22..0000000000 --- a/Tests/ApolloServerIntegrationTests/StarWarsApolloSchemaDownloaderTests.swift +++ /dev/null @@ -1,45 +0,0 @@ -#if os(macOS) -import XCTest -import ApolloInternalTestHelpers -import ApolloCodegenInternalTestHelpers -@testable import ApolloCodegenLib - -class StarWarsApolloSchemaDownloaderTests: XCTestCase { - - func testDownloadingSchema_usingIntrospection_shouldOutputSDL() throws { - let testOutputFolderURL = CodegenTestHelper.outputFolderURL() - let configuration = ApolloSchemaDownloadConfiguration( - using: .introspection(endpointURL: TestServerURL.starWarsServer.url), - outputPath: testOutputFolderURL.path - ) - - // Delete anything existing at the output URL - try ApolloFileManager.default.deleteDirectory(atPath: configuration.outputPath) - XCTAssertFalse(ApolloFileManager.default.doesFileExist(atPath: configuration.outputPath)) - - try ApolloSchemaDownloader.fetch(configuration: configuration) - - // Does the file now exist? - XCTAssertTrue(ApolloFileManager.default.doesFileExist(atPath: configuration.outputPath)) - - // Is it non-empty? - let data = try Data(contentsOf: URL(fileURLWithPath: configuration.outputPath)) - XCTAssertFalse(data.isEmpty) - - // It should not be JSON - XCTAssertNil(try? JSONSerialization.jsonObject(with: data, options: []) as? [AnyHashable:Any]) - - // Can it be turned into the expected schema? - let frontend = try GraphQLJSFrontend() - let source = try frontend.makeSource(from: URL(fileURLWithPath: configuration.outputPath)) - let schema = try frontend.loadSchema(from: [source]) - let episodeType = try schema.getType(named: "Episode") - XCTAssertEqual(episodeType?.name, "Episode") - - // OK delete it now - try ApolloFileManager.default.deleteFile(atPath: configuration.outputPath) - XCTAssertFalse(ApolloFileManager.default.doesFileExist(atPath: configuration.outputPath)) - } - -} -#endif diff --git a/Tests/ApolloServerIntegrationTests/StarWarsServerCachingRoundtripTests.swift b/Tests/ApolloServerIntegrationTests/StarWarsServerCachingRoundtripTests.swift deleted file mode 100644 index b9bd4f3595..0000000000 --- a/Tests/ApolloServerIntegrationTests/StarWarsServerCachingRoundtripTests.swift +++ /dev/null @@ -1,102 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloInternalTestHelpers -import StarWarsAPI -import ApolloAPI - -class SQLiteStarWarsServerCachingRoundtripTests: StarWarsServerCachingRoundtripTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class StarWarsServerCachingRoundtripTests: XCTestCase, CacheDependentTesting { - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - static let defaultWaitTimeout: TimeInterval = 5 - - var cache: NormalizedCache! - var store: ApolloStore! - var client: ApolloClient! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - store = ApolloStore(cache: cache) - let provider = DefaultInterceptorProvider(store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: TestServerURL.starWarsServer.url) - - client = ApolloClient(networkTransport: network, store: store) - } - - override func tearDownWithError() throws { - cache = nil - store = nil - client = nil - - try super.tearDownWithError() - } - - func testHeroAndFriendsNamesQuery() { - let query = HeroAndFriendsNamesQuery(episode: nil) - - fetchAndLoadFromStore(query: query) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - func testHeroAndFriendsNamesQueryWithVariable() { - let query = HeroAndFriendsNamesQuery(episode: .init(.jedi)) - - fetchAndLoadFromStore(query: query) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - func testHeroAndFriendsNamesWithIDsQuery() { - let query = HeroAndFriendsNamesWithIDsQuery(episode: nil) - - fetchAndLoadFromStore(query: query) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - // MARK: - Helpers - - private func fetchAndLoadFromStore(query: Query, file: StaticString = #filePath, line: UInt = #line, completionHandler: @escaping (_ data: Query.Data) -> Void) { - let fetchedFromServerExpectation = expectation(description: "Fetched query from server") - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData) { result in - defer { fetchedFromServerExpectation.fulfill() } - XCTAssertSuccessResult(result, file: file, line: line) - } - - wait(for: [fetchedFromServerExpectation], timeout: Self.defaultWaitTimeout) - - let resultObserver = makeResultObserver(for: query, file: file, line: line) - - let loadedFromStoreExpectation = resultObserver.expectation(description: "Loaded query from store", file: file, line: line) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache, file: file, line: line) - XCTAssertNil(graphQLResult.errors, file: file, line: line) - - let data = try XCTUnwrap(graphQLResult.data, file: file, line: line) - completionHandler(data) - } - } - - store.load(query, resultHandler: resultObserver.handler) - - wait(for: [loadedFromStoreExpectation], timeout: Self.defaultWaitTimeout) - } -} diff --git a/Tests/ApolloServerIntegrationTests/StarWarsServerTests.swift b/Tests/ApolloServerIntegrationTests/StarWarsServerTests.swift deleted file mode 100644 index 2b415bbe89..0000000000 --- a/Tests/ApolloServerIntegrationTests/StarWarsServerTests.swift +++ /dev/null @@ -1,266 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloInternalTestHelpers -import StarWarsAPI -import ApolloAPI - -class StarWarsServerAPQsGetMethodTests: StarWarsServerTests { - override func setUp() { - super.setUp() - config = APQsWithGetMethodConfig() - } -} - -class StarWarsServerAPQsTests: StarWarsServerTests { - override func setUp() { - super.setUp() - config = APQsConfig() - } -} - -class SQLiteStarWarsServerAPQsGetMethodTests: StarWarsServerAPQsGetMethodTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class SQLiteStarWarsServerAPQsTests: StarWarsServerAPQsTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class SQLiteStarWarsServerTests: StarWarsServerTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class StarWarsServerTests: XCTestCase, CacheDependentTesting { - var config: TestConfig! - - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - static let defaultWaitTimeout: TimeInterval = 5 - - var cache: NormalizedCache! - var client: ApolloClient! - - override func setUpWithError() throws { - try super.setUpWithError() - - config = DefaultConfig() - - cache = try makeNormalizedCache() - let store = ApolloStore(cache: cache) - - client = ApolloClient(networkTransport: config.network(store: store), store: store) - } - - override func tearDownWithError() throws { - cache = nil - client = nil - config = nil - - try super.tearDownWithError() - } - - // MARK: Queries - - func testHeroNameQuery() { - fetch(query: HeroNameQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - func testHeroNameQueryWithVariable() { - fetch(query: HeroNameQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - } - } - - func testHeroAppearsInQuery() { - fetch(query: HeroAppearsInQuery()) { data in - XCTAssertEqual(data.hero?.appearsIn, [.init(.newhope), .init(.empire), .init(.jedi)]) - } - } - - func testHeroAndFriendsNamesQuery() { - fetch(query: HeroAndFriendsNamesQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - func testHeroFriendsOfFriendsNamesQuery() { - fetch(query: HeroFriendsOfFriendsNamesQuery(episode: nil)) { data in - let friendsOfFirstFriendNames = data.hero?.friends?.first??.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsOfFirstFriendNames, ["Han Solo", "Leia Organa", "C-3PO", "R2-D2"]) - } - } - - func testHumanQueryWithNullMass() { - fetch(query: HumanQuery(id: "1004")) { data in - XCTAssertEqual(data.human?.name, "Wilhuff Tarkin") - XCTAssertNil(data.human?.mass) - } - } - - func testHumanQueryWithNullResult() { - fetch(query: HumanQuery(id: "9999")) { data in - XCTAssertNil(data.human) - } - } - - func testHeroDetailsQueryDroid() { - fetch(query: HeroDetailsQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - - guard let droid = data.hero?.asDroid else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(droid.primaryFunction, "Astromech") - } - } - - func testHeroDetailsQueryHuman() { - fetch(query: HeroDetailsQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - - guard let human = data.hero?.asHuman else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(human.height, 1.72) - } - } - - func testHeroDetailsWithFragmentQueryDroid() { - fetch(query: HeroDetailsWithFragmentQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.fragments.heroDetails.name, "R2-D2") - - guard let droid = data.hero?.fragments.heroDetails.asDroid else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(droid.primaryFunction, "Astromech") - } - } - - func testHeroDetailsWithFragmentQueryHuman() { - fetch(query: HeroDetailsWithFragmentQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.fragments.heroDetails.name, "Luke Skywalker") - - guard let human = data.hero?.fragments.heroDetails.asHuman else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(human.height, 1.72) - } - } - - func testDroidDetailsWithFragmentQueryDroid() { - fetch(query: DroidDetailsWithFragmentQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.asDroid?.name, "R2-D2") - XCTAssertEqual(data.hero?.asDroid?.primaryFunction, "Astromech") - } - } - - func testDroidDetailsWithFragmentQueryHuman() { - fetch(query: DroidDetailsWithFragmentQuery(episode: .init(.empire))) { data in - XCTAssertNil(data.hero?.asDroid) - } - } - - - func testHeroTypeDependentAliasedFieldDroid() { - fetch(query: HeroTypeDependentAliasedFieldQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.asDroid?.property, "Astromech") - XCTAssertNil(data.hero?.asHuman?.property) - } - } - - func testHeroTypeDependentAliasedFieldHuman() { - fetch(query: HeroTypeDependentAliasedFieldQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.asHuman?.property, "Tatooine") - XCTAssertNil(data.hero?.asDroid?.property) - } - } - - func testHeroParentTypeDependentFieldDroid() { - fetch(query: HeroParentTypeDependentFieldQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.asDroid?.friends?.first??.asHuman?.height, 1.72) - } - } - - func testHeroParentTypeDependentFieldHuman() { - fetch(query: HeroParentTypeDependentFieldQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.asHuman?.friends?.first??.asHuman?.height, 5.905512) - } - } - - func testStarshipCoordinates() { - fetch(query: StarshipQuery()) { data in - XCTAssertEqual(data.starship?.coordinates?[0], [1, 2]) - XCTAssertEqual(data.starship?.coordinates?[1], [3, 4]) - } - } - - // MARK: Mutations - - func testCreateReviewForEpisode() { - perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.jedi), - review: ReviewInput(stars: 5, commentary: "This is a great movie!")) - ) { data in - XCTAssertEqual(data.createReview?.stars, 5) - XCTAssertEqual(data.createReview?.commentary, "This is a great movie!") - } - } - - // MARK: - Helpers - - private func fetch(query: Query, file: StaticString = #filePath, line: UInt = #line, completionHandler: @escaping (_ data: Query.Data) -> Void) { - let resultObserver = makeResultObserver(for: query, file: file, line: line) - - let expectation = resultObserver.expectation(description: "Fetched query from server", file: file, line: line) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server, file: file, line: line) - XCTAssertNil(graphQLResult.errors, file: file, line: line) - - let data = try XCTUnwrap(graphQLResult.data, file: file, line: line) - completionHandler(data) - } - } - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData, resultHandler: resultObserver.handler) - - wait(for: [expectation], timeout: Self.defaultWaitTimeout) - } - - private func perform(mutation: Mutation, file: StaticString = #filePath, line: UInt = #line, completionHandler: @escaping (_ data: Mutation.Data) -> Void) { - let resultObserver = makeResultObserver(for: mutation, file: file, line: line) - - let expectation = resultObserver.expectation(description: "Performing mutation on server", file: file, line: line) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server, file: file, line: line) - XCTAssertNil(graphQLResult.errors, file: file, line: line) - - let data = try XCTUnwrap(graphQLResult.data, file: file, line: line) - completionHandler(data) - } - } - - client.perform(mutation: mutation, resultHandler: resultObserver.handler) - - wait(for: [expectation], timeout: Self.defaultWaitTimeout) - } -} diff --git a/Tests/ApolloServerIntegrationTests/StarWarsSubscriptionTests.swift b/Tests/ApolloServerIntegrationTests/StarWarsSubscriptionTests.swift deleted file mode 100644 index a92100baa7..0000000000 --- a/Tests/ApolloServerIntegrationTests/StarWarsSubscriptionTests.swift +++ /dev/null @@ -1,569 +0,0 @@ -import XCTest -import Apollo -import ApolloInternalTestHelpers -@testable import ApolloWebSocket -import StarWarsAPI -import ApolloAPI - -class StarWarsSubscriptionTests: XCTestCase { - var concurrentQueue: DispatchQueue! - var client: ApolloClient! - var webSocketTransport: WebSocketTransport! - - var connectionStartedExpectation: XCTestExpectation? - var disconnectedExpectation: XCTestExpectation? - var reconnectedExpectation: XCTestExpectation? - - override func setUp() { - super.setUp() - - concurrentQueue = DispatchQueue(label: "com.apollographql.test.\(self.name)", attributes: .concurrent) - - connectionStartedExpectation = self.expectation(description: "Web socket connected") - - webSocketTransport = WebSocketTransport( - websocket: WebSocket( - request: URLRequest(url: TestServerURL.starWarsWebSocket.url), - protocol: .graphql_ws - ), - store: ApolloStore() - ) - webSocketTransport.delegate = self - client = ApolloClient(networkTransport: webSocketTransport, store: ApolloStore()) - - self.wait(for: [self.connectionStartedExpectation!], timeout: 5) - } - - override func tearDownWithError() throws { - client = nil - webSocketTransport = nil - connectionStartedExpectation = nil - disconnectedExpectation = nil - reconnectedExpectation = nil - concurrentQueue = nil - - try super.tearDownWithError() - } - - private func waitForSubscriptionsToStart(for delay: TimeInterval = 0.1, on queue: DispatchQueue = .main) { - /// This method works around changes to the subscriptions package which mean that subscriptions do not start passing on data the absolute instant they are created. - let waitExpectation = self.expectation(description: "Waited!") - - queue.asyncAfter(deadline: .now() + delay) { - waitExpectation.fulfill() - } - - self.wait(for: [waitExpectation], timeout: delay + 1) - } - - // MARK: Subscriptions - - func testSubscribeReviewJediEpisode() { - let expectation = self.expectation(description: "Subscribe single review") - - let sub = client.subscribe(subscription: ReviewAddedSubscription(episode: .init(.jedi))) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - guard let data = graphQLResult.data else { - XCTFail("No subscription result data") - return - } - - XCTAssertEqual(data.reviewAdded?.episode, .init(.jedi)) - XCTAssertEqual(data.reviewAdded?.stars, 6) - XCTAssertEqual(data.reviewAdded?.commentary, "This is the greatest movie!") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.waitForSubscriptionsToStart() - - client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.jedi), - review: ReviewInput(stars: 6, commentary: "This is the greatest movie!") - )) - - waitForExpectations(timeout: 10, handler: nil) - sub.cancel() - } - - func testSubscribeReviewAnyEpisode() { - let expectation = self.expectation(description: "Subscribe any episode") - - let sub = client.subscribe(subscription: ReviewAddedSubscription(episode: nil)) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - guard let data = graphQLResult.data else { - XCTFail("No subscription result data") - return - } - - XCTAssertEqual(data.reviewAdded?.stars, 13) - XCTAssertEqual(data.reviewAdded?.commentary, "This is an even greater movie!") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.waitForSubscriptionsToStart() - - client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.empire), - review: ReviewInput(stars: 13, commentary: "This is an even greater movie!") - )) - - waitForExpectations(timeout: 2, handler: nil) - sub.cancel() - } - - func testSubscribeReviewDifferentEpisode() { - let expectation = self.expectation(description: "Subscription to specific episode - expecting timeout") - expectation.isInverted = true - - let sub = client.subscribe(subscription: ReviewAddedSubscription( - episode: .init(.jedi) - )) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - guard let data = graphQLResult.data else { - XCTFail("No subscription result data") - return - } - - XCTAssertNotEqual(data.reviewAdded?.episode, .init(.jedi)) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.waitForSubscriptionsToStart() - - client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.empire), - review: ReviewInput(stars: 10, commentary: "This is an even greater movie!") - )) - - waitForExpectations(timeout: 3, handler: nil) - sub.cancel() - } - - func testSubscribeThenCancel() { - let expectation = self.expectation(description: "Subscription then cancel - expecting timeout") - expectation.isInverted = true - - let sub = client.subscribe(subscription: ReviewAddedSubscription( - episode: .init(.jedi) - )) { _ in - XCTFail("Received subscription after cancel") - } - - self.waitForSubscriptionsToStart() - - sub.cancel() - - client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.jedi), - review: ReviewInput(stars: 10, commentary: "This is an even greater movie!") - )) - - waitForExpectations(timeout: 3, handler: nil) - } - - func testSubscribeMultipleReviews() { - let count = 50 - let expectation = self.expectation(description: "Multiple reviews") - expectation.expectedFulfillmentCount = count - - let sub = client.subscribe(subscription: ReviewAddedSubscription( - episode: .init(.empire) - )) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - guard let data = graphQLResult.data else { - XCTFail("No subscription result data") - return - } - - XCTAssertEqual(data.reviewAdded?.episode, .init(.empire)) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.waitForSubscriptionsToStart() - - for i in 1...count { - let review = ReviewInput(stars: i, commentary: "The greatest movie ever!") - _ = client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.empire), - review: review - )) - } - - waitForExpectations(timeout: 10, handler: nil) - sub.cancel() - } - - func testMultipleSubscriptions() { - // Multiple subscriptions, one for any episode and one for each of the episode - // We send count reviews and expect to receive twice that number of subscriptions - - let count = 20 - - let expectation = self.expectation(description: "Multiple reviews") - expectation.expectedFulfillmentCount = count * 2 - - var allFulfilledCount = 0 - var newHopeFulfilledCount = 0 - var empireFulfilledCount = 0 - var jediFulfilledCount = 0 - - let subAll = client.subscribe(subscription: ReviewAddedSubscription(episode: nil)) { result in - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - XCTAssertNotNil(graphQLResult.data) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - - expectation.fulfill() - allFulfilledCount += 1 - } - - let subEmpire = client.subscribe(subscription: ReviewAddedSubscription( - episode: .init(.empire) - )) { result in - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - XCTAssertNotNil(graphQLResult.data) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - - expectation.fulfill() - empireFulfilledCount += 1 - } - - let subJedi = client.subscribe(subscription: ReviewAddedSubscription( - episode: .init(.jedi) - )) { result in - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - XCTAssertNotNil(graphQLResult.data) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - - expectation.fulfill() - jediFulfilledCount += 1 - } - - let subNewHope = client.subscribe(subscription: ReviewAddedSubscription( - episode: .init(.newhope) - )) { result in - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - XCTAssertNotNil(graphQLResult.data) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - - expectation.fulfill() - newHopeFulfilledCount += 1 - } - - self.waitForSubscriptionsToStart() - - let episodes : [Episode] = [.empire, .jedi, .newhope] - - var selectedEpisodes = [Episode]() - for i in 1...count { - let review = ReviewInput(stars: i, commentary: "The greatest movie ever!") - let episode = episodes.randomElement()! - selectedEpisodes.append(episode) - _ = client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(episode), - review: review - )) - } - - waitForExpectations(timeout: 10, handler: nil) - XCTAssertEqual( - allFulfilledCount, - count, - "All not fulfilled proper number of times. Expected \(count), got \(allFulfilledCount)" - ) - let expectedNewHope = selectedEpisodes.filter { $0 == .init(.newhope) }.count - XCTAssertEqual( - newHopeFulfilledCount, - expectedNewHope, - "New Hope not fulfilled proper number of times. Expected \(expectedNewHope), got \(newHopeFulfilledCount)" - ) - let expectedEmpire = selectedEpisodes.filter { $0 == .init(.empire) }.count - XCTAssertEqual( - empireFulfilledCount, - expectedEmpire, - "Empire not fulfilled proper number of times. Expected \(expectedEmpire), got \(empireFulfilledCount)" - ) - let expectedJedi = selectedEpisodes.filter { $0 == .init(.jedi) }.count - XCTAssertEqual( - jediFulfilledCount, - expectedJedi, - "Jedi not fulfilled proper number of times. Expected \(expectedJedi), got \(jediFulfilledCount)" - ) - - subAll.cancel() - subEmpire.cancel() - subJedi.cancel() - subNewHope.cancel() - } - - // MARK: Data races tests - - func testConcurrentSubscribing() { - let firstSubscription = ReviewAddedSubscription(episode: .init(.empire)) - let secondSubscription = ReviewAddedSubscription(episode: .init(.empire)) - - let expectation = self.expectation(description: "Subscribers connected and received events") - expectation.expectedFulfillmentCount = 2 - - var sub1: Cancellable? - var sub2: Cancellable? - - concurrentQueue.async { - sub1 = self.client.subscribe(subscription: firstSubscription) { _ in - expectation.fulfill() - } - } - - concurrentQueue.async { - sub2 = self.client.subscribe(subscription: secondSubscription) { _ in - expectation.fulfill() - } - } - - self.waitForSubscriptionsToStart(on: concurrentQueue) - - // dispatched with a barrier flag to make sure - // this is performed after subscription calls - concurrentQueue.sync(flags: .barrier) { - // dispatched on the processing queue with barrier flag to make sure - // this is performed after subscribers are processed - self.webSocketTransport.processingQueue.async(flags: .barrier) { - _ = self.client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.empire), - review: ReviewInput(stars: 5, commentary: "The greatest movie ever!") - )) - } - } - - waitForExpectations(timeout: 10, handler: nil) - sub1?.cancel() - sub2?.cancel() - } - - func testConcurrentSubscriptionCancellations() { - let firstSubscription = ReviewAddedSubscription(episode: .init(.empire)) - let secondSubscription = ReviewAddedSubscription(episode: .init(.empire)) - - let expectation = self.expectation(description: "Subscriptions cancelled") - expectation.expectedFulfillmentCount = 2 - let invertedExpectation = self.expectation(description: "Subscription received callback - expecting timeout") - invertedExpectation.isInverted = true - - let sub1 = client.subscribe(subscription: firstSubscription) { _ in - invertedExpectation.fulfill() - } - let sub2 = client.subscribe(subscription: secondSubscription) { _ in - invertedExpectation.fulfill() - } - - self.waitForSubscriptionsToStart(on: concurrentQueue) - - concurrentQueue.async { - sub1.cancel() - expectation.fulfill() - } - concurrentQueue.async { - sub2.cancel() - expectation.fulfill() - } - - wait(for: [expectation], timeout: 10) - - _ = self.client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.empire), - review: ReviewInput(stars: 5, commentary: "The greatest movie ever!") - )) - - wait(for: [invertedExpectation], timeout: 2) - } - - func testConcurrentSubscriptionAndConnectionClose() { - let empireReviewSubscription = ReviewAddedSubscription(episode: .init(.empire)) - let expectation = self.expectation(description: "Connection closed") - let invertedExpectation = self.expectation(description: "Subscription received callback - expecting timeout") - invertedExpectation.isInverted = true - - let sub = self.client.subscribe(subscription: empireReviewSubscription) { _ in - invertedExpectation.fulfill() - } - - self.waitForSubscriptionsToStart(on: concurrentQueue) - - concurrentQueue.async { - sub.cancel() - } - concurrentQueue.async { - self.webSocketTransport.closeConnection() - expectation.fulfill() - } - - wait(for: [expectation], timeout: 10) - - _ = self.client.perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.empire), - review: ReviewInput(stars: 5, commentary: "The greatest movie ever!") - )) - - wait(for: [invertedExpectation], timeout: 2) - } - - func testConcurrentConnectAndCloseConnection() { - let webSocketTransport = WebSocketTransport( - websocket: MockWebSocket( - request: URLRequest(url: TestServerURL.starWarsWebSocket.url), - protocol: .graphql_ws - ), - store: ApolloStore() - ) - - let expectation = self.expectation(description: "Connection closed") - expectation.expectedFulfillmentCount = 2 - - concurrentQueue.async { - if let websocket = webSocketTransport.websocket as? MockWebSocket { - websocket.reportDidConnect() - expectation.fulfill() - } - } - - concurrentQueue.async { - webSocketTransport.closeConnection() - expectation.fulfill() - } - - waitForExpectations(timeout: 10, handler: nil) - } - - func testPausingAndResumingWebSocketConnection() { - let subscription = ReviewAddedSubscription(episode: nil) - let reviewMutation = CreateAwesomeReviewMutation() - - // Send the mutations via a separate transport so they can still be sent when the websocket is disconnected - let store = ApolloStore() - let interceptorProvider = DefaultInterceptorProvider(store: store) - let alternateTransport = RequestChainNetworkTransport( - interceptorProvider: interceptorProvider, - endpointURL: TestServerURL.starWarsServer.url - ) - let alternateClient = ApolloClient(networkTransport: alternateTransport, store: store) - - func sendReview() { - let reviewSentExpectation = self.expectation(description: "review sent") - alternateClient.perform(mutation: reviewMutation) { mutationResult in - switch mutationResult { - case .success: - break - case .failure(let error): - XCTFail("Unexpected error sending review: \(error)") - } - - reviewSentExpectation.fulfill() - } - self.wait(for: [reviewSentExpectation], timeout: 10) - } - - let subscriptionExpectation = self.expectation(description: "Received review") - // This should get hit twice - once before we pause the web socket and once after. - subscriptionExpectation.expectedFulfillmentCount = 2 - let reviewAddedSubscription = self.client.subscribe(subscription: subscription) { subscriptionResult in - switch subscriptionResult { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.data?.reviewAdded?.episode, .init(.jedi)) - subscriptionExpectation.fulfill() - case .failure(let error): - if let wsError = error as? WebSocket.WSError { - // This is an expected error on disconnection, ignore it. - XCTAssertEqual(wsError.code, 1000) - } else { - XCTFail("Unexpected error receiving subscription: \(error)") - subscriptionExpectation.fulfill() - } - } - } - - self.waitForSubscriptionsToStart() - sendReview() - - self.disconnectedExpectation = self.expectation(description: "Web socket disconnected") - webSocketTransport.pauseWebSocketConnection() - self.wait(for: [self.disconnectedExpectation!], timeout: 10) - - // This should not go through since the socket is paused - sendReview() - - self.reconnectedExpectation = self.expectation(description: "Web socket reconnected") - webSocketTransport.resumeWebSocketConnection() - self.wait(for: [self.reconnectedExpectation!], timeout: 10) - self.waitForSubscriptionsToStart() - - // Now that we've reconnected, this should go through to the same subscription. - sendReview() - - self.wait(for: [subscriptionExpectation], timeout: 10) - - // Cancel subscription so it doesn't keep receiving from other tests. - reviewAddedSubscription.cancel() - } -} - -extension StarWarsSubscriptionTests: WebSocketTransportDelegate { - - func webSocketTransportDidConnect(_ webSocketTransport: WebSocketTransport) { - self.connectionStartedExpectation?.fulfill() - } - - func webSocketTransportDidReconnect(_ webSocketTransport: WebSocketTransport) { - self.reconnectedExpectation?.fulfill() - } - - func webSocketTransport(_ webSocketTransport: WebSocketTransport, didDisconnectWithError error: Error?) { - self.disconnectedExpectation?.fulfill() - } -} diff --git a/Tests/ApolloServerIntegrationTests/StarWarsWebSocketTests.swift b/Tests/ApolloServerIntegrationTests/StarWarsWebSocketTests.swift deleted file mode 100755 index 912761a632..0000000000 --- a/Tests/ApolloServerIntegrationTests/StarWarsWebSocketTests.swift +++ /dev/null @@ -1,351 +0,0 @@ -import XCTest -import Apollo -import ApolloInternalTestHelpers -@testable import ApolloWebSocket -import StarWarsAPI -import ApolloAPI - -class StarWarsWebSocketTests: XCTestCase, CacheDependentTesting { - - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - static let defaultWaitTimeout: TimeInterval = 5 - - var cache: NormalizedCache! - var client: ApolloClient! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - let store = ApolloStore(cache: cache) - - let networkTransport = WebSocketTransport( - websocket: WebSocket(request: URLRequest(url: TestServerURL.starWarsWebSocket.url), - protocol: .graphql_ws), - store: store - ) - - client = ApolloClient(networkTransport: networkTransport, store: store) - } - - override func tearDownWithError() throws { - cache = nil - client = nil - - try super.tearDownWithError() - } - - // MARK: Queries - - func testHeroNameQuery() { - fetch(query: HeroNameQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - func testHeroNameQueryWithVariable() { - fetch(query: HeroNameQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - } - } - - func testHeroAppearsInQuery() { - fetch(query: HeroAppearsInQuery()) { data in - XCTAssertEqual(data.hero?.appearsIn, [.init(.newhope), .init(.empire), .init(.jedi)]) - } - } - - func testHeroAndFriendsNamesQuery() { - fetch(query: HeroAndFriendsNamesQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - func testHeroFriendsOfFriendsNamesQuery() { - fetch(query: HeroFriendsOfFriendsNamesQuery(episode: nil)) { data in - let friendsOfFirstFriendNames = data.hero?.friends?.first??.friends?.compactMap { $0?.name } - XCTAssertEqual(friendsOfFirstFriendNames, ["Han Solo", "Leia Organa", "C-3PO", "R2-D2"]) - } - } - - func testHumanQueryWithNullMass() { - fetch(query: HumanQuery(id: "1004")) { data in - XCTAssertEqual(data.human?.name, "Wilhuff Tarkin") - XCTAssertNil(data.human?.mass) - } - } - - func testHumanQueryWithNullResult() { - fetch(query: HumanQuery(id: "9999")) { data in - XCTAssertNil(data.human) - } - } - - func testHeroDetailsQueryDroid() { - fetch(query: HeroDetailsQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - - guard let droid = data.hero?.asDroid else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(droid.primaryFunction, "Astromech") - } - } - - func testHeroDetailsQueryHuman() { - fetch(query: HeroDetailsQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - - guard let human = data.hero?.asHuman else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(human.height, 1.72) - } - } - - func testHeroDetailsWithFragmentQueryDroid() { - fetch(query: HeroDetailsWithFragmentQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.fragments.heroDetails.name, "R2-D2") - - guard let droid = data.hero?.fragments.heroDetails.asDroid else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(droid.primaryFunction, "Astromech") - } - } - - func testHeroDetailsWithFragmentQueryHuman() { - fetch(query: HeroDetailsWithFragmentQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.fragments.heroDetails.name, "Luke Skywalker") - - guard let human = data.hero?.fragments.heroDetails.asHuman else { - XCTFail("Wrong type") - return - } - - XCTAssertEqual(human.height, 1.72) - } - } - - func testDroidDetailsWithFragmentQueryDroid() { - fetch(query: DroidDetailsWithFragmentQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.asDroid?.name, "R2-D2") - XCTAssertEqual(data.hero?.asDroid?.primaryFunction, "Astromech") - } - } - - func testDroidDetailsWithFragmentQueryHuman() { - fetch(query: DroidDetailsWithFragmentQuery(episode: .init(.empire))) { data in - XCTAssertNil(data.hero?.asDroid) - } - } - - - func testHeroTypeDependentAliasedFieldDroid() { - fetch(query: HeroTypeDependentAliasedFieldQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.asDroid?.property, "Astromech") - XCTAssertNil(data.hero?.asHuman?.property) - } - } - - func testHeroTypeDependentAliasedFieldHuman() { - fetch(query: HeroTypeDependentAliasedFieldQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.asHuman?.property, "Tatooine") - XCTAssertNil(data.hero?.asDroid?.property) - } - } - - func testHeroParentTypeDependentFieldDroid() { - fetch(query: HeroParentTypeDependentFieldQuery(episode: nil)) { data in - XCTAssertEqual(data.hero?.asDroid?.friends?.first??.asHuman?.height, 1.72) - } - } - - func testHeroParentTypeDependentFieldHuman() { - fetch(query: HeroParentTypeDependentFieldQuery(episode: .init(.empire))) { data in - XCTAssertEqual(data.hero?.asHuman?.friends?.first??.asHuman?.height, 5.905512) - } - } - - func testStarshipCoordinates() { - fetch(query: StarshipQuery()) { data in - XCTAssertEqual(data.starship?.coordinates?[0], [1, 2]) - XCTAssertEqual(data.starship?.coordinates?[1], [3, 4]) - } - } - - // MARK: @skip / @include directives - - func testHeroNameConditionalExclusion() { - fetch(query: HeroNameConditionalExclusionQuery(skipName: false)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - - fetch(query: HeroNameConditionalExclusionQuery(skipName: true)) { data in - XCTAssertNil(data.hero?.name) - } - } - - func testHeroNameConditionalInclusion() { - fetch(query: HeroNameConditionalInclusionQuery(includeName: true)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - - fetch(query: HeroNameConditionalInclusionQuery(includeName: false)) { data in - XCTAssertNil(data.hero?.name) - } - } - - func testHeroNameConditionalBoth() { - fetch(query: HeroNameConditionalBothQuery(skipName: false, includeName: true)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - - fetch(query: HeroNameConditionalBothQuery(skipName: true, includeName: true)) { data in - XCTAssertNil(data.hero?.name) - } - - fetch(query: HeroNameConditionalBothQuery(skipName: false, includeName: false)) { data in - XCTAssertNil(data.hero?.name) - } - - fetch(query: HeroNameConditionalBothQuery(skipName: true, includeName: false)) { data in - XCTAssertNil(data.hero?.name) - } - } - - func testHeroNameConditionalBothSeparate() { - fetch(query: HeroNameConditionalBothSeparateQuery(skipName: false, includeName: true)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - - fetch(query: HeroNameConditionalBothSeparateQuery(skipName: true, includeName: true)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - - fetch(query: HeroNameConditionalBothSeparateQuery(skipName: false, includeName: false)) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - } - - fetch(query: HeroNameConditionalBothSeparateQuery(skipName: true, includeName: false)) { data in - XCTAssertNil(data.hero?.name) - } - } - - func testHeroDetailsInlineConditionalInclusion() { - fetch(query: HeroDetailsInlineConditionalInclusionQuery(includeDetails: true)) { data in - XCTAssertEqual(data.hero?.ifIncludeDetails?.name, "R2-D2") - XCTAssertEqual(data.hero?.ifIncludeDetails?.appearsIn, [.init(.newhope), .init(.empire), .init(.jedi)]) - } - - fetch(query: HeroDetailsInlineConditionalInclusionQuery(includeDetails: false)) { data in - XCTAssertNil(data.hero?.ifIncludeDetails?.name) - XCTAssertNil(data.hero?.ifIncludeDetails?.appearsIn) - } - } - - func testHeroDetailsFragmentConditionalInclusion() { - fetch(query: HeroDetailsFragmentConditionalInclusionQuery(includeDetails: true)) { data in - XCTAssertEqual(data.hero?.ifIncludeDetails?.name, "R2-D2") - XCTAssertEqual(data.hero?.ifIncludeDetails?.fragments.heroDetails.asDroid?.primaryFunction, "Astromech") - } - - fetch(query: HeroDetailsFragmentConditionalInclusionQuery(includeDetails: false)) { data in - XCTAssertNil(data.hero?.ifIncludeDetails?.name) - XCTAssertNil(data.hero?.ifIncludeDetails?.fragments.heroDetails.asDroid?.primaryFunction) - } - } - - func testHeroNameTypeSpecificConditionalInclusion() { - fetch(query: HeroNameTypeSpecificConditionalInclusionQuery( - episode: nil, - includeName: true - )) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - XCTAssertEqual(data.hero?.asDroid?.name, "R2-D2") - } - - fetch(query: HeroNameTypeSpecificConditionalInclusionQuery( - episode: nil, - includeName: false - )) { data in - XCTAssertEqual(data.hero?.name, "R2-D2") - XCTAssertEqual(data.hero?.asDroid?.name, "R2-D2") - } - - fetch(query: HeroNameTypeSpecificConditionalInclusionQuery( - episode: .init(.empire), - includeName: true - )) { data in - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - } - - fetch(query: HeroNameTypeSpecificConditionalInclusionQuery( - episode: .init(.empire), - includeName: false - )) { data in - XCTAssertNil(data.hero?.name) - } - } - - // MARK: Mutations - - func testCreateReviewForEpisode() { - perform(mutation: CreateReviewForEpisodeMutation( - episode: .init(.jedi), - review: ReviewInput(stars: 5, commentary: "This is a great movie!") - )) { data in - XCTAssertEqual(data.createReview?.stars, 5) - XCTAssertEqual(data.createReview?.commentary, "This is a great movie!") - } - } - - // MARK: - Helpers - - private func fetch(query: Query, file: StaticString = #filePath, line: UInt = #line, completionHandler: @escaping (_ data: Query.Data) -> Void) { - let resultObserver = makeResultObserver(for: query, file: file, line: line) - - let expectation = resultObserver.expectation(description: "Fetched query from server", file: file, line: line) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server, file: file, line: line) - XCTAssertNil(graphQLResult.errors, file: file, line: line) - - let data = try XCTUnwrap(graphQLResult.data, file: file, line: line) - completionHandler(data) - } - } - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData, resultHandler: resultObserver.handler) - - wait(for: [expectation], timeout: Self.defaultWaitTimeout) - } - - private func perform(mutation: Mutation, file: StaticString = #filePath, line: UInt = #line, completionHandler: @escaping (_ data: Mutation.Data) -> Void) { - let resultObserver = makeResultObserver(for: mutation, file: file, line: line) - - let expectation = resultObserver.expectation(description: "Performing mutation on server", file: file, line: line) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server, file: file, line: line) - XCTAssertNil(graphQLResult.errors, file: file, line: line) - - let data = try XCTUnwrap(graphQLResult.data, file: file, line: line) - completionHandler(data) - } - } - - client.perform(mutation: mutation, resultHandler: resultObserver.handler) - - wait(for: [expectation], timeout: Self.defaultWaitTimeout) - } -} diff --git a/Tests/ApolloServerIntegrationTests/SubscriptionTests.swift b/Tests/ApolloServerIntegrationTests/SubscriptionTests.swift deleted file mode 100644 index b32fc34b86..0000000000 --- a/Tests/ApolloServerIntegrationTests/SubscriptionTests.swift +++ /dev/null @@ -1,58 +0,0 @@ -import XCTest -import Apollo -import SubscriptionAPI -import ApolloWebSocket -import SQLite -import Nimble - -class SubscriptionTests: XCTestCase { - enum Connection: Equatable { - case disconnected - case connected - } - - var connectionState: Connection = .disconnected - var resultNumber: Int? = nil - - func test_subscribe_givenSubscription_shouldReceiveSuccessResult_andCancelSubscription() { - // given - let store = ApolloStore() - let webSocketTransport = WebSocketTransport( - websocket: WebSocket(url: TestServerURL.subscriptionWebSocket.url, protocol: .graphql_transport_ws), - store: store - ) - webSocketTransport.delegate = self - let client = ApolloClient(networkTransport: webSocketTransport, store: store) - - expect(self.connectionState).toEventually(equal(Connection.connected), timeout: .seconds(1)) - - // when - let subject = client.subscribe(subscription: IncrementingSubscription()) { result in - switch result { - case let .failure(error): - XCTFail("Expected .success, got \(error.localizedDescription)") - - case let .success(graphqlResult): - expect(graphqlResult.errors).to(beNil()) - self.resultNumber = graphqlResult.data?.numberIncremented - } - } - - // then - expect(self.resultNumber).toEventuallyNot(beNil(), timeout: .seconds(2)) - - subject.cancel() - webSocketTransport.closeConnection() - expect(self.connectionState).toEventually(equal(.disconnected), timeout: .seconds(2)) - } -} - -extension SubscriptionTests: WebSocketTransportDelegate { - func webSocketTransportDidConnect(_ webSocketTransport: WebSocketTransport) { - connectionState = .connected - } - - func webSocketTransport(_ webSocketTransport: WebSocketTransport, didDisconnectWithError error:Error?) { - connectionState = .disconnected - } -} diff --git a/Tests/ApolloServerIntegrationTests/TestHelpers/HTTPBinAPI.swift b/Tests/ApolloServerIntegrationTests/TestHelpers/HTTPBinAPI.swift deleted file mode 100644 index 2229569dc9..0000000000 --- a/Tests/ApolloServerIntegrationTests/TestHelpers/HTTPBinAPI.swift +++ /dev/null @@ -1,59 +0,0 @@ -import Foundation - -enum HTTPBinAPI { - static let baseURL = URL(string: "https://httpbin.org")! - enum Endpoint { - case bytes(count: Int) - case get - case getWithIndex(index: Int) - case headers - case image - case post - - var toString: String { - - switch self { - case .bytes(let count): - return "bytes/\(count)" - case .get, - .getWithIndex: - return "get" - case .headers: - return "headers" - case .image: - return "image/jpeg" - case .post: - return "post" - } - } - - var queryParams: [URLQueryItem]? { - switch self { - case .getWithIndex(let index): - return [URLQueryItem(name: "index", value: "\(index)")] - default: - return nil - } - } - - var toURL: URL { - var components = URLComponents(url: HTTPBinAPI.baseURL, resolvingAgainstBaseURL: false)! - components.path = "/\(self.toString)" - components.queryItems = self.queryParams - - return components.url! - } - } -} - -struct HTTPBinResponse: Codable { - - let headers: [String: String] - let url: String - let json: [String: String]? - let args: [String: String]? - - init(data: Data) throws { - self = try JSONDecoder().decode(Self.self, from: data) - } -} diff --git a/Tests/ApolloServerIntegrationTests/TestHelpers/TestConfigs.swift b/Tests/ApolloServerIntegrationTests/TestHelpers/TestConfigs.swift deleted file mode 100644 index 4f55d2cf58..0000000000 --- a/Tests/ApolloServerIntegrationTests/TestHelpers/TestConfigs.swift +++ /dev/null @@ -1,47 +0,0 @@ -@testable import Apollo - -protocol TestConfig { - func network(store: ApolloStore) -> NetworkTransport -} - -class DefaultConfig: TestConfig { - - func transport(with store: ApolloStore) -> NetworkTransport { - let provider = DefaultInterceptorProvider(store: store) - return RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: TestServerURL.starWarsServer.url) - } - - func network(store: ApolloStore) -> NetworkTransport { - return transport(with: store) - } -} - -class APQsConfig: TestConfig { - - func transport(with store: ApolloStore) -> NetworkTransport { - let provider = DefaultInterceptorProvider(store: store) - return RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: TestServerURL.starWarsServer.url, - autoPersistQueries: true) - } - - func network(store: ApolloStore) -> NetworkTransport { - return transport(with: store) - } -} - -class APQsWithGetMethodConfig: TestConfig { - - func transport(with store: ApolloStore) -> NetworkTransport { - let provider = DefaultInterceptorProvider(store: store) - return RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: TestServerURL.starWarsServer.url, - autoPersistQueries: true, - useGETForPersistedQueryRetry: true) - } - - func network(store: ApolloStore) -> NetworkTransport { - return transport(with: store) - } -} diff --git a/Tests/ApolloServerIntegrationTests/TestHelpers/TestServerURLs.swift b/Tests/ApolloServerIntegrationTests/TestHelpers/TestServerURLs.swift deleted file mode 100644 index 95c504bd1c..0000000000 --- a/Tests/ApolloServerIntegrationTests/TestHelpers/TestServerURLs.swift +++ /dev/null @@ -1,15 +0,0 @@ -/// Local URLs for servers used in integration testing -import Foundation - -public enum TestServerURL: String { - case mockServer = "http://localhost/dummy_url" - case starWarsServer = "http://localhost:8080/graphql" - case starWarsWebSocket = "ws://localhost:8080/websocket" - case uploadServer = "http://localhost:4001" - case subscriptionServer = "http://localhost:4000/graphql" - case subscriptionWebSocket = "ws://localhost:4000/graphql" - - public var url: URL { - return URL(string: self.rawValue)! - } -} diff --git a/Tests/ApolloServerIntegrationTests/UploadTests.swift b/Tests/ApolloServerIntegrationTests/UploadTests.swift deleted file mode 100644 index d04bc5fbe4..0000000000 --- a/Tests/ApolloServerIntegrationTests/UploadTests.swift +++ /dev/null @@ -1,302 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloInternalTestHelpers -import UploadAPI -import StarWarsAPI - -class UploadTests: XCTestCase { - - static let uploadClientURL = TestServerURL.uploadServer.url - - var client: ApolloClient! - - override func setUp() { - super.setUp() - - client = { - let store = ApolloStore() - let provider = DefaultInterceptorProvider(store: store) - let transport = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.uploadClientURL, - additionalHeaders: ["headerKey": "headerValue"]) - transport.clientName = "test" - transport.clientVersion = "test" - - return ApolloClient(networkTransport: transport, store: store) - }() - } - - override func tearDown() { - client = nil - - super.tearDown() - } - - override class func tearDown() { - // Recreate the uploads folder at the end of all tests in this suite to avoid having one billion files in there - recreateUploadsFolder() - super.tearDown() - } - - private static func recreateUploadsFolder() { - let uploadsFolderURL = TestFileHelper.uploadsFolder() - try? FileManager.default.removeItem(at: uploadsFolderURL) - - try? FileManager.default.createDirectory(at: uploadsFolderURL, withIntermediateDirectories: false) - } - - private func compareInitialFile(at initialFileURL: URL, - toUploadedFileAt path: String?, - file: StaticString = #filePath, - line: UInt = #line) { - guard let path = path else { - XCTFail("Path was nil!", - file: file, - line: line) - return - } - - let sanitizedPath = String(path.dropFirst(2)) // Gets rid of the ./ returned by the server - - let uploadedFileURL = TestFileHelper.uploadServerFolder() - .appendingPathComponent(sanitizedPath) - - do { - let initialData = try Data(contentsOf: initialFileURL) - let uploadedData = try Data(contentsOf: uploadedFileURL) - XCTAssertFalse(initialData.isEmpty, - "Initial data was empty at \(initialFileURL)", - file: file, - line: line) - XCTAssertFalse(uploadedData.isEmpty, - "Uploaded data was empty at \(uploadedFileURL)", - file: file, - line: line) - XCTAssertEqual(initialData, - uploadedData, - "Initial data at \(initialFileURL) was not equal to data uploaded at \(uploadedFileURL)", - file: file, - line: line) - } catch { - XCTFail("Unexpected error loading data to compare: \(error)", - file: file, - line: line) - } - } - - func testUploadingASingleFile() throws { - let fileURL = TestFileHelper.fileURLForFile(named: "a", extension: "txt") - - let file = try GraphQLFile(fieldName: "file", - originalName: "a.txt", - fileURL: fileURL) - - let upload = UploadOneFileMutation(file: "a.txt") - - let expectation = self.expectation(description: "File upload complete") - self.client.upload(operation: upload, files: [file]) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.data?.singleUpload.filename, "a.txt") - self.compareInitialFile(at: fileURL, toUploadedFileAt: graphQLResult.data?.singleUpload.path) - case .failure(let error): - XCTFail("Unexpected upload error: \(error)") - } - } - - self.wait(for: [expectation], timeout: 10) - } - - func testUploadingMultipleFilesWithTheSameFieldName() throws { - let firstFileURL = TestFileHelper.fileURLForFile(named: "a", extension: "txt") - - let firstFile = try GraphQLFile(fieldName: "files", - originalName: "a.txt", - fileURL: firstFileURL) - - let secondFileURL = TestFileHelper.fileURLForFile(named: "b", extension: "txt") - - let secondFile = try GraphQLFile(fieldName: "files", - originalName: "b.txt", - fileURL: secondFileURL) - - let files = [firstFile, secondFile] - - let upload = UploadMultipleFilesToTheSameParameterMutation(files: files.map { $0.originalName }) - - let expectation = self.expectation(description: "File upload complete") - self.client.upload(operation: upload, files: files) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - guard let uploads = graphQLResult.data?.multipleUpload else { - XCTFail("NOPE") - return - } - - XCTAssertEqual(uploads.count, 2) - let sortedUploads = uploads.sorted { $0.filename < $1.filename } - XCTAssertEqual(sortedUploads[0].filename, "a.txt") - XCTAssertEqual(sortedUploads[1].filename, "b.txt") - self.compareInitialFile(at: firstFileURL, toUploadedFileAt: sortedUploads[0].path) - self.compareInitialFile(at: secondFileURL, toUploadedFileAt: sortedUploads[1].path) - case .failure(let error): - XCTFail("Unexpected upload error: \(error)") - } - } - - self.wait(for: [expectation], timeout: 10) - } - - func testUploadingMultipleFilesWithDifferentFieldNames() throws { - let firstFileURL = TestFileHelper.fileURLForFile(named: "a", extension: "txt") - - let firstFile = try GraphQLFile(fieldName: "singleFile", - originalName: "a.txt", - fileURL: firstFileURL) - - let secondFileURL = TestFileHelper.fileURLForFile(named: "b", extension: "txt") - - let secondFile = try GraphQLFile(fieldName: "multipleFiles", - originalName: "b.txt", - fileURL: secondFileURL) - - let thirdFileURL = TestFileHelper.fileURLForFile(named: "c", extension: "txt") - - let thirdFile = try GraphQLFile(fieldName: "multipleFiles", - originalName: "c.txt", - fileURL: thirdFileURL) - - // This is the array of Files for the `multipleFiles` parameter only - let multipleFiles = [secondFile, thirdFile] - - let upload = UploadMultipleFilesToDifferentParametersMutation(singleFile: firstFile.originalName, multipleFiles: multipleFiles.map { $0.originalName }) - - let expectation = self.expectation(description: "File upload complete") - - // This is the array of Files for all parameters - let allFiles = [firstFile, secondFile, thirdFile] - self.client.upload(operation: upload, files: allFiles) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - guard let uploads = graphQLResult.data?.multipleParameterUpload else { - XCTFail("NOPE") - return - } - - XCTAssertEqual(uploads.count, 3) - let sortedUploads = uploads.sorted { $0.filename < $1.filename } - XCTAssertEqual(sortedUploads[0].filename, "a.txt") - XCTAssertEqual(sortedUploads[1].filename, "b.txt") - XCTAssertEqual(sortedUploads[2].filename, "c.txt") - self.compareInitialFile(at: firstFileURL, toUploadedFileAt: sortedUploads[0].path) - self.compareInitialFile(at: secondFileURL, toUploadedFileAt: sortedUploads[1].path) - self.compareInitialFile(at: thirdFileURL, toUploadedFileAt: sortedUploads [2].path) - case .failure(let error): - XCTFail("Unexpected upload error: \(error)") - } - } - - self.wait(for: [expectation], timeout: 10) - } - - func testUploadingASingleFileInAnArray() throws { - let fileURL = TestFileHelper.fileURLForFile(named: "a", extension: "txt") - - let file = try GraphQLFile(fieldName: "files", - originalName: "a.txt", - fileURL: fileURL) - - let filesArray = [file] - - let uploadMutation = UploadMultipleFilesToTheSameParameterMutation(files: filesArray.map { $0.originalName }) - - let expectation = self.expectation(description: "File upload complete") - self.client.upload(operation: uploadMutation, files: filesArray) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - guard let uploads = graphQLResult.data?.multipleUpload else { - XCTFail("NOPE") - return - } - - XCTAssertEqual(uploads.count, 1) - guard let uploadedFile = uploads.first else { - XCTFail("Could not access uploaded file!") - return - } - - XCTAssertEqual(uploadedFile.filename, "a.txt") - self.compareInitialFile(at: fileURL, toUploadedFileAt: uploadedFile.path) - case .failure(let error): - XCTFail("Unexpected upload error: \(error)") - } - } - - self.wait(for: [expectation], timeout: 10) - } - - func testUploadingSingleFileInAnArrayWithAnotherFileForAnotherField() throws { - let firstFileURL = TestFileHelper.fileURLForFile(named: "a", extension: "txt") - - let firstFile = try GraphQLFile(fieldName: "singleFile", - originalName: "a.txt", - fileURL: firstFileURL) - - let secondFileURL = TestFileHelper.fileURLForFile(named: "b", extension: "txt") - - let secondFile = try GraphQLFile(fieldName: "multipleFiles", - originalName: "b.txt", - fileURL: secondFileURL) - - // This is the array of Files for the `multipleFiles` parameter only - let multipleFiles = [secondFile] - - let upload = UploadMultipleFilesToDifferentParametersMutation(singleFile: firstFile.originalName, multipleFiles: multipleFiles.map { $0.originalName }) - - let expectation = self.expectation(description: "File upload complete") - - // This is the array of Files for all parameters - let allFiles = [firstFile, secondFile] - self.client.upload(operation: upload, files: allFiles) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - guard let uploads = graphQLResult.data?.multipleParameterUpload else { - XCTFail("NOPE") - return - } - - XCTAssertEqual(uploads.count, 2) - let sortedUploads = uploads.sorted { $0.filename < $1.filename } - XCTAssertEqual(sortedUploads[0].filename, "a.txt") - XCTAssertEqual(sortedUploads[1].filename, "b.txt") - self.compareInitialFile(at: firstFileURL, toUploadedFileAt: sortedUploads[0].path) - self.compareInitialFile(at: secondFileURL, toUploadedFileAt: sortedUploads[1].path) - case .failure(let error): - XCTFail("Unexpected upload error: \(error)") - } - } - - self.wait(for: [expectation], timeout: 10) - } - -} diff --git a/Tests/ApolloTests/ApolloClientOperationTests.swift b/Tests/ApolloTests/ApolloClientOperationTests.swift deleted file mode 100644 index 41ff7d32c7..0000000000 --- a/Tests/ApolloTests/ApolloClientOperationTests.swift +++ /dev/null @@ -1,140 +0,0 @@ -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers -import XCTest -import Nimble - -final class ApolloClientOperationTests: XCTestCase { - - var store: MockStore! - var server: MockGraphQLServer! - var client: ApolloClient! - - override func setUpWithError() throws { - try super.setUpWithError() - - self.store = MockStore() - self.server = MockGraphQLServer() - self.client = ApolloClient( - networkTransport: MockNetworkTransport(server: self.server, store: self.store), - store: self.store - ) - } - - override func tearDownWithError() throws { - self.store = nil - self.server = nil - self.client = nil - - try super.tearDownWithError() - } - - class MockStore: ApolloStore { - var publishedRecordSets: [RecordSet] = [] - - init() { - super.init(cache: NoCache()) - } - - override func publish(records: RecordSet, identifier: UUID? = nil, callbackQueue: DispatchQueue = .main, completion: ((Result) -> Void)? = nil) { - publishedRecordSets.append(records) - } - } - - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("createReview", CreateReview.self) - ] } - - class CreateReview: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("__typename", String.self), - .field("stars", Int.self), - .field("commentary", String?.self) - ] } - } - } - - let jsonObject: JSONObject = [ - "data": [ - "createReview": [ - "__typename": "Review", - "stars": 3, - "commentary": "" - ] - ] - ] - - func test__performMutation_givenPublishResultToStore_true_publishResultsToStore() throws { - let mutation = MockMutation() - let resultObserver = self.makeResultObserver(for: mutation) - - let serverRequestExpectation = server.expect(MockMutation.self) { _ in - self.jsonObject - } - - let performResultFromServerExpectation = - resultObserver.expectation(description: "Mutation was successful") { result in - switch (result) { - case .success: - break - case let .failure(error): - fail("Unexpected failure! \(error)") - } - } - - // when - self.client.perform(mutation: mutation, - publishResultToStore: true, - resultHandler: resultObserver.handler) - - self.wait(for: [serverRequestExpectation, performResultFromServerExpectation], timeout: 0.2) - - // then - expect(self.store.publishedRecordSets.count).to(equal(1)) - - let actual = self.store.publishedRecordSets[0] - expect(actual["MUTATION_ROOT"]?.record).to(equal( - Record(key: "MUTATION_ROOT", [ - "createReview": CacheReference("MUTATION_ROOT.createReview") - ]) - )) - expect(actual["MUTATION_ROOT.createReview"]?.record).to(equal( - Record(key: "MUTATION_ROOT.createReview", [ - "__typename": "Review", - "stars": 3, - "commentary": "" - ]) - )) - } - - func test__performMutation_givenPublishResultToStore_false_doesNotPublishResultsToStore() throws { - let mutation = MockMutation() - let resultObserver = self.makeResultObserver(for: mutation) - - let serverRequestExpectation = server.expect(MockMutation.self) { _ in - self.jsonObject - } - - let performResultFromServerExpectation = - resultObserver.expectation(description: "Mutation was successful") { result in - switch (result) { - case .success: - break - case let .failure(error): - fail("Unexpected failure! \(error)") - } - } - - // when - self.client.perform(mutation: mutation, - publishResultToStore: false, - resultHandler: resultObserver.handler) - - self.wait(for: [serverRequestExpectation, performResultFromServerExpectation], timeout: 0.2) - - // then - expect(self.store.publishedRecordSets).to(beEmpty()) - } -} diff --git a/Tests/ApolloTests/AutomaticPersistedQueriesTests.swift b/Tests/ApolloTests/AutomaticPersistedQueriesTests.swift deleted file mode 100644 index a9d7b3d7a5..0000000000 --- a/Tests/ApolloTests/AutomaticPersistedQueriesTests.swift +++ /dev/null @@ -1,601 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class AutomaticPersistedQueriesTests: XCTestCase { - - private static let endpoint = TestURL.mockServer.url - - // MARK: - Mocks - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - - fileprivate enum MockEnum: String, EnumType { - case NEWHOPE - case JEDI - case EMPIRE - } - - fileprivate class MockHeroNameQuery: MockQuery { - override class var operationDocument: OperationDocument { - .init( - operationIdentifier: "f6e76545cd03aa21368d9969cb39447f6e836a16717823281803778e7805d671", - definition: .init("MockHeroNameQuery - Operation Definition") - ) - } - - var episode: GraphQLNullable { - didSet { - self.__variables = ["episode": episode] - } - } - - init(episode: GraphQLNullable = .none) { - self.episode = episode - super.init() - self.__variables = ["episode": episode] - } - } - - fileprivate class APQMockMutation: MockMutation { - override class var operationDocument: OperationDocument { - .init( - operationIdentifier: "4a1250de93ebcb5cad5870acf15001112bf27bb963e8709555b5ff67a1405374", - definition: .init("APQMockMutation - Operation Definition") - ) - } - } - - // MARK: - Helper Methods - - private func validatePostBody(with request: URLRequest, - operation: O, - queryDocument: Bool = false, - persistedQuery: Bool = false, - file: StaticString = #filePath, - line: UInt = #line) throws { - - guard - let httpBody = request.httpBody, - let jsonBody = try? JSONSerializationFormat.deserialize(data: httpBody) as? JSONObject else { - XCTFail("httpBody invalid", - file: file, - line: line) - return - } - - let queryString = jsonBody["query"] as? String - if queryDocument { - XCTAssertEqual(queryString, - O.definition?.queryDocument, - file: file, - line: line) - } - - if let query = operation as? MockHeroNameQuery{ - if let variables = jsonBody["variables"] as? JSONObject { - XCTAssertEqual(variables["episode"] as? String, - query.episode.rawValue, - file: file, - line: line) - } else { - XCTFail("variables should not be nil", - file: file, - line: line) - } - } - - let ext = jsonBody["extensions"] as? JSONObject - if persistedQuery { - let ext = try XCTUnwrap(ext, - "extensions json data should not be nil", - file: file, - line: line) - - let persistedQuery = try XCTUnwrap(ext["persistedQuery"] as? JSONObject, - "persistedQuery is missing", - file: file, - line: line) - - let version = try XCTUnwrap(persistedQuery["version"] as? Int, - "version is missing", - file: file, - line: line) - - let sha256Hash = try XCTUnwrap(persistedQuery["sha256Hash"] as? String, - "sha256Hash is missing", - file: file, - line: line) - - XCTAssertEqual(version, 1, - file: file, - line: line) - XCTAssertEqual(sha256Hash, - O.operationIdentifier, - file: file, - line: line) - } else { - XCTAssertNil(ext, - "extensions should be nil", - file: file, - line: line) - } - } - - private func validateUrlParams(with request: URLRequest, - query: MockHeroNameQuery, - queryDocument: Bool = false, - persistedQuery: Bool = false, - file: StaticString = #filePath, - line: UInt = #line) throws { - let url = try XCTUnwrap(request.url, - "URL not valid", - file: file, - line: line) - - let queryString = url.queryItemDictionary?["query"] - if queryDocument { - XCTAssertEqual(queryString, - MockHeroNameQuery.definition?.queryDocument, - file: file, - line: line) - } else { - XCTAssertNil(queryString, - "query string should be nil", - file: file, - line: line) - } - - if let variables = url.queryItemDictionary?["variables"] { - let expectation = expect(file: file, line: line, variables) - switch query.episode { - case let .some(episode): - expectation.to(equal("{\"episode\":\"\(episode.rawValue)\"}")) - - case .none: - #warning("TODO: write test to test this case actually happens") - expectation.to(equal("{}")) - - case .null: - expectation.to(equal("{\"episode\":null}")) - } - } else { - XCTFail("variables should not be nil", - file: file, - line: line) - } - - let ext = url.queryItemDictionary?["extensions"] - if persistedQuery { - guard - let ext = ext, - let data = ext.data(using: .utf8), - let jsonBody = try? JSONSerializationFormat.deserialize(data: data) as? JSONObject - else { - XCTFail("extensions json data should not be nil", - file: file, - line: line) - return - } - - let persistedQuery = try XCTUnwrap(jsonBody["persistedQuery"] as? JSONObject, - "persistedQuery is missing", - file: file, - line: line) - - let sha256Hash = try XCTUnwrap(persistedQuery["sha256Hash"] as? String, - "sha256Hash is missing", - file: file, - line: line) - - let version = try XCTUnwrap(persistedQuery["version"] as? Int, - "version is missing", - file: file, - line: line) - - XCTAssertEqual(version, 1, - file: file, - line: line) - XCTAssertEqual(sha256Hash, MockHeroNameQuery.operationIdentifier, - file: file, - line: line) - } else { - XCTAssertNil(ext, - "extension should be nil", - file: file, - line: line) - } - } - - - // MARK: - Tests - - func testRequestBody() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery() - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "POST") - - try self.validatePostBody(with: request, - operation: query, - queryDocument: true) - } - - func testRequestBodyWithVariable() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery(episode: .some(.JEDI)) - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "POST") - - try validatePostBody(with: request, - operation: query, - queryDocument: true) - } - - - func testRequestBodyForAPQsWithVariable() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery(episode: .some(.EMPIRE)) - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "POST") - - try self.validatePostBody(with: request, - operation: query, - persistedQuery: true) - } - - func testMutationRequestBodyForAPQs() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true) - - let expectation = self.expectation(description: "Mutation sent") - let mutation = APQMockMutation() - var lastRequest: URLRequest? - let _ = network.send(operation: mutation) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "POST") - - try self.validatePostBody(with: request, - operation: mutation, - persistedQuery: true) - } - - func testQueryStringForAPQsUseGetMethod() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true, - useGETForPersistedQueryRetry: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery() - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - XCTAssertEqual(request.url?.host, network.endpointURL.host) - - try self.validateUrlParams(with: request, - query: query, - persistedQuery: true) - } - - func testQueryStringForAPQsUseGetMethodWithVariable() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true, - useGETForPersistedQueryRetry: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery(episode: .some(.EMPIRE)) - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "GET") - - try self.validateUrlParams(with: request, - query: query, - persistedQuery: true) - } - - func testUseGETForQueriesRequest() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - additionalHeaders: ["Authorization": "Bearer 1234"], - useGETForQueries: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery() - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "GET") - XCTAssertEqual(request.allHTTPHeaderFields!["Authorization"], "Bearer 1234") - - try self.validateUrlParams(with: request, - query: query, - queryDocument: true) - } - - func testNotUseGETForQueriesRequest() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery() - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "POST") - - try self.validatePostBody(with: request, - operation: query, - queryDocument: true) - } - - func testNotUseGETForQueriesAPQsRequest() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery(episode: .some(.EMPIRE)) - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "POST") - - try self.validatePostBody(with: request, - operation: query, - persistedQuery: true) - } - - func testUseGETForQueriesAPQsRequest() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true, - useGETForQueries: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery(episode: .some(.EMPIRE)) - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 1) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "GET") - - try self.validateUrlParams(with: request, - query: query, - persistedQuery: true) - } - - func testNotUseGETForQueriesAPQsGETRequest() throws { - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true, - useGETForPersistedQueryRetry: true) - - let expectation = self.expectation(description: "Query sent") - let query = MockHeroNameQuery(episode: .some(.EMPIRE)) - var lastRequest: URLRequest? - let _ = network.send(operation: query) { _ in - lastRequest = mockClient.lastRequest - expectation.fulfill() - } - self.wait(for: [expectation], timeout: 2) - - let request = try XCTUnwrap(lastRequest, "last request should not be nil") - - XCTAssertEqual(request.url?.host, network.endpointURL.host) - XCTAssertEqual(request.httpMethod, "GET") - - try self.validateUrlParams(with: request, - query: query, - persistedQuery: true) - } - - // MARK: Persisted Query Retrying Tests - - func test__retryPersistedQuery__givenOperation_automaticallyPersisted_PersistedQueryNotFoundResponseError_retriesQueryWithFullDocument() throws { - // given - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true) - - let query = MockHeroNameQuery(episode: .some(.EMPIRE)) - - mockClient.response = HTTPURLResponse(url: TestURL.mockServer.url, - statusCode: 200, - httpVersion: nil, - headerFields: nil) - - mockClient.data = try JSONSerialization.data( - withJSONObject: ["errors": [["message": "PersistedQueryNotFound"]]] - ) - - // when - let _ = network.send(operation: query) { _ in } - - // then - expect(mockClient.requestCount).toEventually(equal(2)) - } - - func test__retryPersistedQuery__givenOperation_persistedOperationsOnly_PersistedQueryNotFoundResponseError_doesNotRetryAndThrows_persistedQueryNotFoundForPersistedOnlyQuery_error() throws { - // given - class MockPersistedOnlyQuery: MockHeroNameQuery { - override class var operationDocument: OperationDocument { - .init(operationIdentifier: "12345") - } - } - - let mockClient = MockURLSessionClient() - let store = ApolloStore() - let provider = DefaultInterceptorProvider(client: mockClient, store: store) - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: Self.endpoint, - autoPersistQueries: true) - - let query = MockPersistedOnlyQuery(episode: .some(.EMPIRE)) - - mockClient.response = HTTPURLResponse(url: TestURL.mockServer.url, - statusCode: 200, - httpVersion: nil, - headerFields: nil) - - mockClient.data = try JSONSerialization.data( - withJSONObject: ["errors": [["message": "PersistedQueryNotFound"]]] - ) - - let expectation = self.expectation(description: "Query failed") - - // when - let _ = network.send(operation: query) { result in - // then - switch result { - case .success: - fail("Expected failure result") - case .failure(let error): - let expectedError = AutomaticPersistedQueryInterceptor.APQError - .persistedQueryNotFoundForPersistedOnlyQuery(operationName: "MockOperationName") - expect(error as? AutomaticPersistedQueryInterceptor.APQError).to(equal(expectedError)) - - expectation.fulfill() - } - } - - self.wait(for: [expectation], timeout: 2) - } -} diff --git a/Tests/ApolloTests/BatchedLoadTests.swift b/Tests/ApolloTests/BatchedLoadTests.swift deleted file mode 100644 index 9b6c81c393..0000000000 --- a/Tests/ApolloTests/BatchedLoadTests.swift +++ /dev/null @@ -1,232 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -private final class MockBatchedNormalizedCache: NormalizedCache { - private var records: RecordSet - - @Atomic var numberOfBatchLoads: Int32 = 0 - - init(records: RecordSet) { - self.records = records - } - - public func loadRecords(forKeys keys: Set) throws -> [CacheKey: RecordRow] { - $numberOfBatchLoads.increment() - - return keys.reduce(into: [:]) { results, key in - results[key] = records[key] - } - } - - func loadRecords(forKeys keys: [CacheKey], - callbackQueue: DispatchQueue?, - completion: @escaping (Result<[RecordRow?], Error>) -> Void) { - $numberOfBatchLoads.increment() - - DispatchQueue.global().asyncAfter(deadline: .now() + .milliseconds(1)) { - let records = keys.map { self.records[$0] } - DispatchQueue.returnResultAsyncIfNeeded(on: callbackQueue, - action: completion, - result: .success(records)) - } - } - - func removeRecord(for key: CacheKey) throws { - records.removeRecord(for: key) - } - - func removeRecords(matching pattern: CacheKey) throws { - records.removeRecords(matching: pattern) - } - - func merge(records: RecordSet) throws -> Set { - return self.records.merge(records: records) - } - - func merge(records: RecordSet, - callbackQueue: DispatchQueue?, - completion: @escaping (Result, Error>) -> Void) { - DispatchQueue.global().asyncAfter(deadline: .now() + .milliseconds(1)) { - let changedKeys = self.records.merge(records: records) - DispatchQueue.returnResultAsyncIfNeeded(on: callbackQueue, - action: completion, - result: .success(changedKeys)) - } - } - - func clear(callbackQueue: DispatchQueue?, completion: ((Result) -> Void)?) { - DispatchQueue.global().asyncAfter(deadline: .now() + .milliseconds(1)) { - self.records.clear() - DispatchQueue.returnResultAsyncIfNeeded(on: callbackQueue, - action: completion, - result: .success(())) - } - } - - func clear() throws { - records.clear() - } -} - -class BatchedLoadTests: XCTestCase { - func testListsAreLoadedInASingleBatch() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - - var records = RecordSet() - let drones = (1...100).map { number in - RecordRow(record: Record(key: "Drone_\(number)", ["__typename": "Droid", "name": "Droid #\(number)"]), lastReceivedAt: Date()) - } - - records.insert(RecordRow(record: Record(key: "QUERY_ROOT", ["hero": CacheReference("2001")]), lastReceivedAt: Date())) - records.insert(RecordRow(record: Record(key: "2001", [ - "name": "R2-D2", - "__typename": "Droid", - "friends": drones.map { CacheReference($0.record.key) } - ]), lastReceivedAt: Date())) - records.insert(contentsOf: drones) - - let cache = MockBatchedNormalizedCache(records: records) - let store = ApolloStore(cache: cache) - - let query = MockQuery() - - // when - let expectation = self.expectation(description: "Loading query from store") - - store.load(query) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - - guard let data = graphQLResult.data else { - XCTFail("No data returned with result!") - return - } - - XCTAssertEqual(data.hero?.name, "R2-D2") - XCTAssertEqual(data.hero?.friends?.count, 100) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.waitForExpectations(timeout: 1) - - // then - XCTAssertEqual(cache.numberOfBatchLoads, 3) - } - - func testParallelLoadsUseIndependentBatching() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - - let records: RecordSet = [ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker"], - "1002": ["__typename": "Human", "name": "Han Solo"], - "1003": ["__typename": "Human", "name": "Leia Organa"], - ] - - let cache = MockBatchedNormalizedCache(records: records) - let store = ApolloStore(cache: cache) - - let query = MockQuery() - - (1...10).forEach { number in - let expectation = self.expectation(description: "Loading query #\(number) from store") - - store.load(query) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success(let graphQLResult): - XCTAssertNil(graphQLResult.errors) - - guard let data = graphQLResult.data else { - XCTFail("No data returned with query!") - return - - } - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - } - - self.waitForExpectations(timeout: 1) - - // then - XCTAssertEqual(cache.numberOfBatchLoads, 30) - } -} diff --git a/Tests/ApolloTests/BlindRetryingTestInterceptor.swift b/Tests/ApolloTests/BlindRetryingTestInterceptor.swift deleted file mode 100644 index 00dd8b2121..0000000000 --- a/Tests/ApolloTests/BlindRetryingTestInterceptor.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import Apollo -import ApolloAPI - -// An interceptor which blindly retries every time it receives a request. -class BlindRetryingTestInterceptor: ApolloInterceptor { - var hitCount = 0 - private(set) var hasBeenCancelled = false - - public var id: String = UUID().uuidString - - func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) { - self.hitCount += 1 - chain.retry(request: request, completion: completion) - } - - // Purposely not adhering to `Cancellable` here to make sure non `Cancellable` interceptors don't have this called. - func cancel() { - self.hasBeenCancelled = true - } -} diff --git a/Tests/ApolloTests/Cache/CacheDependentInterceptorTests.swift b/Tests/ApolloTests/Cache/CacheDependentInterceptorTests.swift deleted file mode 100644 index d075d71a0a..0000000000 --- a/Tests/ApolloTests/Cache/CacheDependentInterceptorTests.swift +++ /dev/null @@ -1,137 +0,0 @@ -import XCTest -import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class CacheDependentInterceptorTests: XCTestCase, CacheDependentTesting { - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - var cache: NormalizedCache! - var store: ApolloStore! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - store = ApolloStore(cache: cache) - } - - override func tearDown() { - cache = nil - store = nil - - super.tearDown() - } - - func testChangingCachePolicyInErrorInterceptorWorks() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - // Set up initial cache state - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - /// This interceptor will reroute anything that fails with a response code error to retry hitting only the cache - class RerouteToCacheErrorInterceptor: ApolloErrorInterceptor { - var handledError: Error? - - func handleErrorAsync( - error: Error, - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) { - - self.handledError = error - - switch error { - case ResponseCodeInterceptor.ResponseCodeError.invalidResponseCode: - request.cachePolicy = .returnCacheDataDontFetch - chain.retry(request: request, completion: completion) - default: - completion(.failure(error)) - } - } - } - - - class TestProvider: DefaultInterceptorProvider { - init(store: ApolloStore) { - super.init(client: self.mockClient, - store: store) - } - - let mockClient: MockURLSessionClient = { - let client = MockURLSessionClient() - client.response = HTTPURLResponse(url: TestURL.mockServer.url, - statusCode: 401, - httpVersion: nil, - headerFields: nil) - client.data = Data() - return client - }() - - let additionalInterceptor = RerouteToCacheErrorInterceptor() - - override func additionalErrorInterceptor(for operation: Operation) -> ApolloErrorInterceptor? { - self.additionalInterceptor - } - } - - let testProvider = TestProvider(store: self.store) - let network = RequestChainNetworkTransport(interceptorProvider: testProvider, - endpointURL: TestURL.mockServer.url) - - let expectation = self.expectation(description: "Request sent") - - // Send the initial request ignoring cache data so it doesn't initially get the data from the cache, - _ = network.send(operation: MockQuery(), cachePolicy: .fetchIgnoringCacheData) { result in - defer { - expectation.fulfill() - } - - // Check that the final result is what we expected - switch result { - case .failure(let error): - XCTFail("Unexpected error: \(error)") - case .success(let graphQLResult): - guard let heroName: String = graphQLResult.data?.hero?.name else { - XCTFail("Could not access hero name from returned result") - return - } - - XCTAssertEqual(heroName, "R2-D2") - } - - // Validate that there was a handled error before we went to the cache and we didn't just go straight to the cache - guard let handledError = testProvider.additionalInterceptor.handledError else { - XCTFail("No error was handled!") - return - } - switch handledError { - case ResponseCodeInterceptor.ResponseCodeError.invalidResponseCode(let response, _): - XCTAssertEqual(response?.statusCode, 401) - default: - XCTFail("Unexpected error on the additional error handler: \(handledError)") - } - } - - self.wait(for: [expectation], timeout: 5.0) - } -} - diff --git a/Tests/ApolloTests/Cache/CacheKeyConstructionTests.swift b/Tests/ApolloTests/Cache/CacheKeyConstructionTests.swift deleted file mode 100644 index 16ee8f7992..0000000000 --- a/Tests/ApolloTests/Cache/CacheKeyConstructionTests.swift +++ /dev/null @@ -1,53 +0,0 @@ -import XCTest -@testable import ApolloSQLite - -final class CacheKeyConstructionTests: XCTestCase { - func testCacheKeySplitsPeriods() { - let input = "my.chemical.romance" - let expected = ["my", "chemical", "romance"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } - - func testCacheKeySplitsPeriodsButIgnoresParentheses() { - let input = "my.chemical.romance(xWv.CD-RIP.whole-album)" - let expected = ["my", "chemical", "romance(xWv.CD-RIP.whole-album)"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } - - func testCacheKeyIgnoresNestedParentheses() { - let input = "my.chemical.romance(the.(very)hidden.albums)" - let expected = ["my", "chemical", "romance(the.(very)hidden.albums)"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } - - func testDoubleNestedInput() { - let input = "my.chemical.romance(name:imnotokay.rip(xWv(the.original).HIGH-QUALITY)).mp3" - let expected = ["my", "chemical", "romance(name:imnotokay.rip(xWv(the.original).HIGH-QUALITY))", "mp3"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } - - func testUnbalancedInput() { - let input = "my.chemical.romance(name: )(.thebest.)()" - let expected = ["my", "chemical", "romance(name: )(.thebest.)()"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } - - func testUnbalancedInputContinued() { - let input = "my.chemical.romance(name: )(.thebest.)().count" - let expected = ["my", "chemical", "romance(name: )(.thebest.)()", "count"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } - - func testNoSplits() { - let input = "mychemicalromance" - let expected = ["mychemicalromance"] - - XCTAssertEqual(input.splitIntoCacheKeyComponents(), expected) - } -} diff --git a/Tests/ApolloTests/Cache/FetchQueryTests.swift b/Tests/ApolloTests/Cache/FetchQueryTests.swift deleted file mode 100644 index 4a4683e28f..0000000000 --- a/Tests/ApolloTests/Cache/FetchQueryTests.swift +++ /dev/null @@ -1,481 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class FetchQueryTests: XCTestCase, CacheDependentTesting { - - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - static let defaultWaitTimeout: TimeInterval = 1 - - var cache: NormalizedCache! - var server: MockGraphQLServer! - var client: ApolloClient! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - let store = ApolloStore(cache: cache) - - server = MockGraphQLServer() - let networkTransport = MockNetworkTransport(server: server, store: store) - - client = ApolloClient(networkTransport: networkTransport, store: store) - } - - override func tearDownWithError() throws { - cache = nil - server = nil - client = nil - - try super.tearDownWithError() - } - - func test__fetch__givenCachePolicy_fetchIgnoringCacheData_onlyHitsNetwork() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - ] - ]) - - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Human" - ] - ] - ] - } - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromServerExpectation = resultObserver.expectation( - description: "Received result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - } - } - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData, resultHandler: resultObserver.handler) - - wait(for: [serverRequestExpectation, fetchResultFromServerExpectation], timeout: Self.defaultWaitTimeout) - } - - func test__fetch__givenCachePolicy_returnCacheDataAndFetch_hitsCacheFirstAndNetworkAfter() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - ] - ]) - - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Human" - ] - ] - ] - } - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromCacheExpectation = resultObserver.expectation( - description: "Received result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - let fetchResultFromServerExpectation = resultObserver.expectation( - description: "Received result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Luke Skywalker") - } - } - - client.fetch(query: query, cachePolicy: .returnCacheDataAndFetch, resultHandler: resultObserver.handler) - - wait(for: [fetchResultFromCacheExpectation, serverRequestExpectation, fetchResultFromServerExpectation], timeout: Self.defaultWaitTimeout) - } - - func test__fetch__givenCachePolicy_returnCacheDataElseFetch_givenDataIsCached_doesntHitNetwork() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": [ - "name": "R2-D2", - "__typename": "Droid", - ] - ]) - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromCacheExpectation = resultObserver.expectation( - description: "Received result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - client.fetch(query: query, - cachePolicy: .returnCacheDataElseFetch, - resultHandler: resultObserver.handler) - - wait(for: [fetchResultFromCacheExpectation], timeout: Self.defaultWaitTimeout) - } - - func test__fetch__givenCachePolicy_returnCacheDataElseFetch_givenNotAllDataIsCached_hitsNetwork() throws { - class HeroNameAndAppearsInSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("appearsIn", [String]?.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ]) - - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "appearsIn": ["NEWHOPE", "EMPIRE", "JEDI"], - "__typename": "Droid" - ] - ] - ] - } - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromServerExpectation = resultObserver.expectation(description: "Received result from server") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - XCTAssertEqual(data.hero?.appearsIn, ["NEWHOPE", "EMPIRE", "JEDI"]) - } - } - - client.fetch(query: query, cachePolicy: .returnCacheDataAndFetch, resultHandler: resultObserver.handler) - - wait(for: [serverRequestExpectation, fetchResultFromServerExpectation], timeout: Self.defaultWaitTimeout) - } - - func testFetchReturningCacheDataOnErrorReturnsData() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ]) - - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [] // incomplete data will cause an error on fetch - ] - ] - } - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromServerExpectation = resultObserver.expectation(description: "Received result from cache") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - client.fetch(query: query, cachePolicy: .fetchReturningCacheDataOnError, resultHandler: resultObserver.handler) - - wait(for: [serverRequestExpectation, fetchResultFromServerExpectation], timeout: Self.defaultWaitTimeout) - } - - func test__fetch__givenCachePolicy_returnCacheDataDontFetch_givenDataIsCached_doesntHitNetwork() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - ] - ]) - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromCacheExpectation = resultObserver.expectation(description: "Received result from cache") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - client.fetch(query: query, cachePolicy: .returnCacheDataDontFetch, resultHandler: resultObserver.handler) - - wait(for: [fetchResultFromCacheExpectation], timeout: Self.defaultWaitTimeout) - } - - func test__fetch__givenCachePolicy_returnCacheDataDontFetch_givenNotAllDataIsCached_returnsError() throws { - class HeroNameAndAppearsInSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("appearsIn", [String]?.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ]) - - let resultObserver = makeResultObserver(for: query) - - let cacheMissResultExpectation = resultObserver.expectation(description: "Received cache miss error") { result in - // TODO: We should check for a specific error type once we've defined a cache miss error. - XCTAssertThrowsError(try result.get()) - } - - client.fetch(query: query, - cachePolicy: .returnCacheDataDontFetch, - resultHandler: resultObserver.handler) - - wait(for: [cacheMissResultExpectation], timeout: Self.defaultWaitTimeout) - } - - func test__fetch_afterClearCache_givenCachePolicy_returnCacheDataDontFetch_throwsCacheMissError() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - ] - ]) - - let resultObserver = makeResultObserver(for: query) - - let fetchResultFromCacheExpectation = resultObserver.expectation( - description: "Received result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - client.fetch(query: query, cachePolicy: .returnCacheDataDontFetch, resultHandler: resultObserver.handler) - - wait(for: [fetchResultFromCacheExpectation], timeout: Self.defaultWaitTimeout) - - runActivity("Clear the cache") { _ in - let cacheClearedExpectation = expectation(description: "Cache cleared") - client.clearCache { result in - XCTAssertSuccessResult(result) - cacheClearedExpectation.fulfill() - } - - wait(for: [cacheClearedExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch from cache and expect cache miss failure") { _ in - let cacheMissResultExpectation = resultObserver.expectation(description: "Received cache miss error") { result in - // TODO: We should check for a specific error type once we've defined a cache miss error. - XCTAssertThrowsError(try result.get()) - } - - client.fetch(query: query, cachePolicy: .returnCacheDataDontFetch, resultHandler: resultObserver.handler) - - wait(for: [cacheMissResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testCompletionHandlerIsCalledOnTheSpecifiedQueue() { - let queue = DispatchQueue(label: "label") - - let key = DispatchSpecificKey() - queue.setSpecific(key: key, value: ()) - - let query = MockQuery.mock() - - let serverRequestExpectation = server.expect(MockQuery.self) { request in - ["data": [:]] - } - - let resultObserver = makeResultObserver(for: query) - - let fetchResultExpectation = resultObserver.expectation( - description: "Received fetch result" - ) { result in - XCTAssertNotNil(DispatchQueue.getSpecific(key: key)) - } - - client.fetch(query: query, - cachePolicy: .fetchIgnoringCacheData, - queue: queue, resultHandler: resultObserver.handler) - - wait(for: [serverRequestExpectation, fetchResultExpectation], timeout: Self.defaultWaitTimeout) - } -} diff --git a/Tests/ApolloTests/Cache/LoadQueryFromStoreTests.swift b/Tests/ApolloTests/Cache/LoadQueryFromStoreTests.swift deleted file mode 100644 index 9bc86a789f..0000000000 --- a/Tests/ApolloTests/Cache/LoadQueryFromStoreTests.swift +++ /dev/null @@ -1,597 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -#if canImport(ApolloSQLite) -import ApolloSQLite -#endif -import ApolloInternalTestHelpers - -class LoadQueryFromStoreTests: XCTestCase, CacheDependentTesting, StoreLoading { - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - static let defaultWaitTimeout: TimeInterval = 5.0 - - var cache: NormalizedCache! - var store: ApolloStore! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - store = ApolloStore(cache: cache) - } - - override func tearDownWithError() throws { - cache = nil - store = nil - - try super.tearDownWithError() - } - - func testLoadingHeroNameQuery() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - } - - func testLoadingHeroNameQueryWithVariable() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero(episode:JEDI)": CacheReference("hero(episode:JEDI)")], - "hero(episode:JEDI)": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // when - let query = MockQuery() - query.__variables = ["episode": "JEDI"] - - loadFromStore(operation: query) { result in - // then - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - } - - func testLoadingHeroNameQueryWithMissingName_throwsMissingValueError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid"] - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - XCTAssertThrowsError(try result.get()) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero", "name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - } - - func testLoadingHeroNameQueryWithNullName_throwsNullValueError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid", "name": NSNull()] - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - XCTAssertThrowsError(try result.get()) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero", "name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.nullValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - } - - func testLoadingHeroAndFriendsNamesQueryWithoutIDs() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend].self) - ]} - var friends: [Friend] { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - var name: String { __data["name"] } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - CacheReference("hero.friends.0"), - CacheReference("hero.friends.1"), - CacheReference("hero.friends.2") - ] - ], - "hero.friends.0": ["__typename": "Human", "name": "Luke Skywalker"], - "hero.friends.1": ["__typename": "Human", "name": "Han Solo"], - "hero.friends.2": ["__typename": "Human", "name": "Leia Organa"], - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - let friendsNames = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - } - - func testLoadingHeroAndFriendsNamesQueryWithIDs() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend].self) - ]} - var friends: [Friend] { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - var name: String { __data["name"] } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003"), - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker"], - "1002": ["__typename": "Human", "name": "Han Solo"], - "1003": ["__typename": "Human", "name": "Leia Organa"], - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - let friendsNames = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - } - - func testLoadingHeroAndFriendsNamesQuery_withOptionalFriendsSelection_withNullFriends() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self) - ]} - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - var name: String { __data["name"] } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": NSNull(), - ] - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - XCTAssertNil(data.hero.friends) - } - } - } - - func testLoadingHeroAndFriendsNamesQuery_withOptionalFriendsSelection_withFriendsNotInCache_throwsMissingValueError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self) - ]} - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - var name: String { __data["name"] } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - XCTAssertThrowsError(try result.get()) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero", "friends"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - } - - func testLoadingWithBadCacheSerialization() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self) - ]} - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - var name: String { __data["name"] } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": ["dictionary": "badValues", "nested bad val": ["subdictionary": "some value"] ] - ], - "1002": ["__typename": "Human", "name": "Han Solo"], - "1003": ["__typename": "Human", "name": "Leia Organa"], - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - XCTAssertThrowsError(try result.get()) { error in - // then - if let error = error as? GraphQLExecutionError, - case JSONDecodingError.couldNotConvert(_, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["hero", "friends", "0", "name"]) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - } - - func testLoadingQueryWithFloats() throws { - // given - let starshipLength: Float = 1234.5 - let coordinates: [[Double]] = [[38.857150, -94.798464]] - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("starshipCoordinates", Starship.self) - ]} - - class Starship: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("length", Float.self), - .field("coordinates", [[Double]].self) - ]} - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["starshipCoordinates": CacheReference("starshipCoordinates")], - "starshipCoordinates": ["__typename": "Starship", - "name": "Millennium Falcon", - "length": starshipLength, - "coordinates": coordinates] - ]) - - // when - let query = MockQuery() - - loadFromStore(operation: query) { result in - // then - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - let coordinateData: GivenSelectionSet.Starship? = data.starshipCoordinates - XCTAssertEqual(coordinateData?.name, "Millennium Falcon") - XCTAssertEqual(coordinateData?.length, starshipLength) - XCTAssertEqual(coordinateData?.coordinates, coordinates) - } - } - } - - func testResultContextWithDataFromYesterday() throws { - let now = Date() - let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: now)! - let aYearAgo = Calendar.current.date(byAdding: .year, value: -1, to: now)! - - let initialRecords = RecordSet([ - "QUERY_ROOT": (["hero": CacheReference("hero")], yesterday), - "hero": (["__typename": "Droid", "name": "R2-D2"], yesterday), - "ignoredData": (["__typename": "Droid", "name": "R2-D3"], aYearAgo) - ]) - try self.testResulContextWhenLoadingHeroNameQueryWithAge(initialRecords: initialRecords, expectedResultAge: yesterday) - } - - func testResultContextWithDataFromMixedDates() throws { - let now = Date() - let oneHourAgo = Calendar.current.date(byAdding: .hour, value: -1, to: now)! - let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: now)! - let aYearAgo = Calendar.current.date(byAdding: .year, value: -1, to: now)! - - - let fields = ( - ["hero": CacheReference("hero")], - ["__typename": "Droid", "name": "R2-D2"], - ["__typename": "Droid", "name": "R2-D3"] - ) - - let initialRecords1 = RecordSet([ - "QUERY_ROOT": (fields.0, yesterday), - "hero": (fields.1, yesterday), - "ignoredData": (fields.2, aYearAgo) - ]) - - - try self.testResulContextWhenLoadingHeroNameQueryWithAge(initialRecords: initialRecords1, expectedResultAge: yesterday) - - let initialRecords2 = RecordSet([ - "QUERY_ROOT": (fields.0, yesterday), - "hero": (fields.1, oneHourAgo), - "ignoredData": (fields.2, aYearAgo) - ]) - - try self.testResulContextWhenLoadingHeroNameQueryWithAge(initialRecords: initialRecords2, expectedResultAge: yesterday) - } - -} - -// MARK: - Helpers - -extension LoadQueryFromStoreTests { - - private func testResulContextWhenLoadingHeroNameQueryWithAge( - initialRecords: RecordSet, - expectedResultAge: Date, - file: StaticString = #file, - line: UInt = #line - ) throws { - - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - mergeRecordsIntoCache(initialRecords) - loadFromStore(operation: query) { result in - switch result { - case let .success(result): - XCTAssertNil(result.errors, file: file, line: line) - XCTAssertEqual(result.data?.hero?.name, "R2-D2", file: file, line: line) - XCTAssertEqual( - Calendar.current.compare(expectedResultAge, to: result.metadata.maxAge, toGranularity: .minute), - .orderedSame, - file: file, - line: line - ) - case let .failure(error): - XCTFail("Unexpected error: \(error)", file: file, line: line) - } - } - } -} - -extension RecordSet { - init(_ dictionary: Dictionary) { - self.init(rows: dictionary.map { element in - RecordRow( - record: Record(key: element.key, element.value.fields), - lastReceivedAt: element.value.receivedAt - ) - }) - } - } diff --git a/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift b/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift deleted file mode 100644 index d23666bb29..0000000000 --- a/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift +++ /dev/null @@ -1,2876 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class ReadWriteFromStoreTests: XCTestCase, CacheDependentTesting, StoreLoading { - - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - static let defaultWaitTimeout: TimeInterval = 5.0 - - var cache: NormalizedCache! - var store: ApolloStore! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - store = ApolloStore(cache: cache) - } - - override func tearDownWithError() throws { - cache = nil - store = nil - - try super.tearDownWithError() - } - - // MARK: - Read Query Tests - - func test_readQuery_givenQueryDataInCache_returnsData() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let data = try transaction.read(query: query) - - expect(data.0.hero?.__typename).to(equal("Droid")) - expect(data.0.hero?.name).to(equal("R2-D2")) - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_readQuery_givenQueryDataDoesNotExist_throwsMissingValueError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("name", String.self) - ]} - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": [:], - ]) - - // when - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadWriteTransaction({ transaction in - _ = try transaction.read(query: query) - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - - // then - expectJSONMissingValueError(result, atPath: ["name"]) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_readQuery_givenQueryDataWithVariableInCache_readsQuery() throws { - // given - enum Episode: String, EnumType { - case JEDI - } - - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - query.__variables = ["episode": Episode.JEDI] - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero(episode:JEDI)": CacheReference("hero(episode:JEDI)")], - "hero(episode:JEDI)": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // when - runActivity("read query") { _ in - let readCompletedExpectation = expectation(description: "Read completed") - store.withinReadTransaction({ transaction in - let data = try transaction.read(query: query) - - // then - expect(data.0.hero?.__typename).to(equal("Droid")) - expect(data.0.hero?.name).to(equal("R2-D2")) - - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func test_readQuery_givenQueryDataWithOtherVariableValueInCache_throwsMissingValueError() throws { - // given - enum Episode: String, EnumType { - case JEDI - case PHANTOM_MENACE - } - - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - query.__variables = ["episode": Episode.PHANTOM_MENACE] - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero(episode:JEDI)": CacheReference("hero(episode:JEDI)")], - "hero(episode:JEDI)": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // when - runActivity("read query") { _ in - let readCompletedExpectation = expectation(description: "Read completed") - store.withinReadTransaction({ transaction in - _ = try transaction.read(query: query) - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - - // then - expectJSONMissingValueError(result, atPath: ["hero"]) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func test_readQuery_withCacheReferencesByCustomKey_resolvesReferences() throws { - // given - class HeroFriendsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self) - ]} - - var friends: [Friend] { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - } - } - } - - let query = MockQuery() - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "id": "2001", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker", "id": "1000"], - "1002": ["__typename": "Human", "name": "Han Solo", "id": "1002"], - "1003": ["__typename": "Human", "name": "Leia Organa", "id": "1003"], - ]) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let data = try transaction.read(query: query) - - XCTAssertEqual(data.0.hero.name, "R2-D2") - let friendsNames: [String] = data.0.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - - func test_readObject_givenFragmentWithTypeSpecificProperty() throws { - // given - struct Types { - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { typename in - switch typename { - case "Droid": return Types.Droid - default: return nil - } - } - - class GivenSelectionSet: MockFragment { - typealias Schema = MockSchemaMetadata - - override class var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ]} - - var asDroid: AsDroid? { _asInlineFragment() } - - class AsDroid: MockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Droid } - - override class var __selections: [Selection] { [ - .field("primaryFunction", String.self), - ]} - } - } - - mergeRecordsIntoCache([ - "2001": ["name": "R2-D2", "__typename": "Droid", "primaryFunction": "Protocol"] - ]) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let r2d2 = try transaction.readObject( - ofType: GivenSelectionSet.self, - withKey: "2001" - ) - - XCTAssertEqual(r2d2.0.name, "R2-D2") - XCTAssertEqual(r2d2.0.asDroid?.primaryFunction, "Protocol") - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_readObject_givenFragmentWithMissingTypeSpecificProperty() throws { - // given - struct Types { - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { typename in - switch typename { - case "Droid": return Types.Droid - default: return nil - } - } - - class GivenSelectionSet: MockFragment { - typealias Schema = MockSchemaMetadata - - override class var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ]} - - var asDroid: AsDroid? { _asInlineFragment() } - - class AsDroid: MockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Droid } - - override class var __selections: [Selection] { [ - .field("primaryFunction", String.self), - ]} - } - } - - mergeRecordsIntoCache([ - "2001": ["name": "R2-D2", "__typename": "Droid"] - ]) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - XCTAssertThrowsError(try transaction.readObject( - ofType: GivenSelectionSet.self, - withKey: "2001") - ) { error in - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["primaryFunction"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - // MARK: - Write Local Cache Mutation Tests - - func test_updateCacheMutation_updateNestedField_updatesObjects() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutation() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - } - } - } - - func test_updateCacheMutationWithOptionalField_containingNull_updateNestedField_updatesObjectsMaintainingNullValue() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self), - .field("nickname", String?.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var nickname: String? { - get { __data["nickname"] } - set { __data["nickname"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutation() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2", "nickname": NSNull()] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - - let record = try! self.cache.loadRecords(forKeys: ["QUERY_ROOT.hero"]).first?.value.record - expect(record?["nickname"]).to(equal(NSNull())) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - XCTAssertNil(data.hero.nickname) - } - } - } - - /// This test ensures the fix for issue [#2861](https://github.com/apollographql/apollo-ios/issues/2861) - func test_updateCacheMutationWithOptionalField_containiningNull_retrievingOptionalField_returns_nil() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self), - .field("nickname", String?.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var nickname: String? { - get { __data["nickname"] } - set { __data["nickname"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutation() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2", "nickname": NSNull()] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - // doing a nil-coalescing to replace nil with - let nickname = data.hero.nickname - expect(nickname).to(beNil()) - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - /// The 'nickname' field is currently a cache miss, as it has never been fetched. We want to be able - /// to successfully mutate the 'name' field, but the 'nickname' field should still be a cache miss. - /// While reading an optional field to execute a cache mutation, this is fine, but while reading the - /// omitted optional field to execute a fetch from the cache onto a immutable selection set for a - /// operation, this should throw a missing value error, indicating the cache miss. - func test_updateCacheMutationWithOptionalField_omittingOptionalField_updateNestedField_updatesObjectsMaintainingNilValue_throwsMissingValueErrorOnRead() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self), - .field("nickname", String?.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var nickname: String? { - get { __data["nickname"] } - set { __data["nickname"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutation() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - expectJSONMissingValueError(result, atPath: ["hero", "nickname"]) - } - } - - func test_updateCacheMutationWithNonNullField_withNilValue_updateNestedField_throwsMissingValueOnInitialReadForUpdate() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self), - .field("nickname", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var nickname: String { - get { __data["nickname"] } - set { __data["nickname"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutation() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - expectJSONMissingValueError(result, atPath: ["hero", "nickname"]) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func test_updateCacheMutation_givenMutationOperation_updateNestedField_updatesObjectAtMutationRoot() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutationFromMutation() - - mergeRecordsIntoCache([ - "MUTATION_ROOT": ["hero": CacheReference("MUTATION_ROOT.hero")], - "MUTATION_ROOT.hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let mutation = MockMutation() - - loadFromStore(operation: mutation) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - } - } - } - - func test_updateCacheMutation_givenQueryWithVariables_updateNestedField_updatesObjectsOnlyForQueryWithMatchingVariables() throws { - // given - enum Episode: String, EnumType { - case JEDI - case PHANTOM_MENACE - } - - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": [ - "hero(episode:JEDI)": CacheReference("hero(episode:JEDI)"), - "hero(episode:PHANTOM_MENACE)": CacheReference("hero(episode:PHANTOM_MENACE)") - ], - "hero(episode:JEDI)": ["__typename": "Droid", "name": "R2-D2"], - "hero(episode:PHANTOM_MENACE)": ["__typename": "Human", "name": "Qui-Gon Jinn"] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - let cacheMutation = MockLocalCacheMutation() - cacheMutation.__variables = ["episode": Episode.JEDI] - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("read queries") { _ in - let readCompletedExpectation = expectation(description: "Read completed") - readCompletedExpectation.expectedFulfillmentCount = 2 - - let query = MockQuery() - query.__variables = ["episode": Episode.JEDI] - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - - readCompletedExpectation.fulfill() - } - } - - query.__variables = ["episode": Episode.PHANTOM_MENACE] - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Qui-Gon Jinn") - - readCompletedExpectation.fulfill() - } - } - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func test_updateCacheMutation_updateNestedFieldOnTypeCase_updatesObjects() throws { - // given - struct Types { - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { typename in - switch typename { - case "Droid": return Types.Droid - default: return nil - } - } - - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var asDroid: AsDroid? { - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - - struct AsDroid: MockMutableInlineFragment { - public var __data: DataDict = .empty() - - public typealias RootEntityType = Hero - static let __parentType: ParentType = Types.Droid - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("primaryFunction", String.self), - ]} - - var primaryFunction: String { - get { __data["primaryFunction"] } - set { __data["primaryFunction"] = newValue } - } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2", "primaryFunction": "Protocol"] - ]) - - let cacheMutation = MockLocalCacheMutation() - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.asDroid?.primaryFunction = "Combat" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.asDroid?.primaryFunction, "Combat") - } - } - } - - func test_updateCacheMutation_updateNestedFieldOnNamedFragment_updatesObjects() throws { - // given - struct Types { - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { typename in - switch typename { - case "Droid": return Types.Droid - default: return nil - } - } - - struct GivenFragment: MockMutableRootSelectionSet, Fragment { - typealias Schema = MockSchemaMetadata - static let fragmentDefinition: StaticString = "" - - var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var asDroid: AsDroid? { - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - - struct AsDroid: MockMutableInlineFragment { - public var __data: DataDict = .empty() - public typealias RootEntityType = GivenFragment - static let __parentType: ParentType = Types.Droid - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("primaryFunction", String.self), - ]} - - var primaryFunction: String { - get { __data["primaryFunction"] } - set { __data["primaryFunction"] = newValue } - } - } - } - - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .fragment(GivenFragment.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - struct Fragments: FragmentContainer { - var __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - - var givenFragment: GivenFragment { - get { _toFragment() } - _modify { var f = givenFragment; yield &f; __data = f.__data } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } - } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2", "primaryFunction": "Protocol"] - ]) - - let cacheMutation = MockLocalCacheMutation() - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.fragments.givenFragment.name = "Artoo" - data.hero.fragments.givenFragment.asDroid?.primaryFunction = "Combat" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - XCTAssertEqual(data.hero.fragments.givenFragment.asDroid?.primaryFunction, "Combat") - } - } - } - - func test_updateCacheMutation_updateNestedFieldOnOptionalNamedFragment_updatesObjects() throws { - // given - struct Types { - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { typename in - switch typename { - case "Droid": return Types.Droid - default: return nil - } - } - - struct GivenFragment: MockMutableRootSelectionSet, Fragment { - typealias Schema = MockSchemaMetadata - static let fragmentDefinition: StaticString = "" - - var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .inlineFragment(AsDroid.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var asDroid: AsDroid? { - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - - struct AsDroid: MockMutableInlineFragment { - public var __data: DataDict = .empty() - public typealias RootEntityType = GivenFragment - static let __parentType: ParentType = Types.Droid - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("primaryFunction", String.self), - ]} - - var primaryFunction: String { - get { __data["primaryFunction"] } - set { __data["primaryFunction"] = newValue } - } - } - } - - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("name", String.self), - .fragment(GivenFragment.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var asDroid: AsDroid? { - get { _asInlineFragment() } - set { if let newData = newValue?.__data._data { __data._data = newData }} - } - - struct AsDroid: MockMutableInlineFragment { - public var __data: DataDict = .empty() - public typealias RootEntityType = GivenFragment - static let __parentType: ParentType = Types.Droid - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("primaryFunction", String.self), - ]} - - var primaryFunction: String { - get { __data["primaryFunction"] } - set { __data["primaryFunction"] = newValue } - } - } - - struct Fragments: FragmentContainer { - var __data: DataDict - init(_dataDict: DataDict) { __data = _dataDict } - - var givenFragment: GivenFragment? { - get { _toFragment() } - _modify { var f = givenFragment; yield &f; if let newData = f?.__data { __data = newData } } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } - } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2", "primaryFunction": "Protocol"] - ]) - - let cacheMutation = MockLocalCacheMutation() - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.fragments.givenFragment?.name = "Artoo" - data.hero.fragments.givenFragment?.asDroid?.primaryFunction = "Combat" - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - XCTAssertEqual(data.hero.fragments.givenFragment?.asDroid?.primaryFunction, "Combat") - } - } - } - - func test_updateCacheMutation_givenAddNewReferencedEntity_entityIsIncludedOnRead() throws { - /// given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("id", String.self), - .field("name", String.self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "id": "2001", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker", "id": "1000"], - "1002": ["__typename": "Human", "name": "Han Solo", "id": "1002"], - "1003": ["__typename": "Human", "name": "Leia Organa", "id": "1003"], - ]) - - runActivity("Add C-3PO Entity and Reference") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - let cacheMutation = MockLocalCacheMutation() - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - var c3po = GivenSelectionSet.Hero.Friend() - c3po.__typename = "Droid" - c3po.id = "1004" - c3po.name = "C-3PO" - - data.hero.friends.append(c3po) - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("read query") { _ in - let readCompletedExpectation = expectation(description: "Read completed") - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - let friendsNames = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa", "C-3PO"]) - - readCompletedExpectation.fulfill() - } - } - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func test_updateCacheMutation_givenEnumField_enumFieldIsSerializedAndCanBeRead() throws { - // given - enum HeroType: String, EnumType { - case droid - } - - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("type", GraphQLEnum.self) - ]} - - var type: GraphQLEnum { - get { __data["type"] } - set { __data["type"] = newValue } - } - } - } - - let cacheMutation = MockLocalCacheMutation() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "type": "droid"] - ]) - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - // noop - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.type, .case(.droid)) - } - } - } - - func test_writeDataForCacheMutation_givenMutationOperation_updateNestedField_updatesObjectAtMutationRoot() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - runActivity("update mutation") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - let data = try! GivenSelectionSet(data: - ["hero": [ - "__typename": "Droid", - "name": "Artoo" - ]], - variables: nil - ) - let cacheMutation = MockLocalCacheMutationFromMutation() - - try transaction.write(data: data, for: cacheMutation) - - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let mutation = MockMutation() - - loadFromStore(operation: mutation) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - } - } - } - - func test_writeDataForCacheMutation_givenInvalidData_throwsError() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String?.self) - ]} - - var name: String? { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - // when - let writeCompletedExpectation = expectation(description: "Write completed") - - store.withinReadWriteTransaction({ transaction in - let data = GivenSelectionSet( - _dataDict: .init( - data: [ - "hero": "name" - ], - fulfilledFragments: [ObjectIdentifier(GivenSelectionSet.Hero.self)] - )) - let cacheMutation = MockLocalCacheMutation() - try transaction.write(data: data, for: cacheMutation) - }, completion: { result in - defer { writeCompletedExpectation.fulfill() } - - XCTAssertFailureResult(result) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero"]) - XCTAssertMatch(error.underlying, JSONDecodingError.wrongType) - } else { - XCTFail("Unexpected error: \(error)") - } - } - }) - - self.wait(for: [writeCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_writeDataForCacheMutation_givenNilValueForOptionalField_writesFieldWithNullValue() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String?.self) - ]} - - var name: String? { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - // when - let writeCompletedExpectation = expectation(description: "Write completed") - - store.withinReadWriteTransaction({ transaction in - let data = GivenSelectionSet( - _dataDict: .init( - data: [ - "hero": DataDict( - data: [ - "__typename": "Hero", - "name": Optional.none, - ], - fulfilledFragments: [ObjectIdentifier(GivenSelectionSet.Hero.self)]), - - ], - fulfilledFragments: [ObjectIdentifier(GivenSelectionSet.self)])) - let cacheMutation = MockLocalCacheMutation() - try transaction.write(data: data, for: cacheMutation) - }, completion: { result in - defer { writeCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [writeCompletedExpectation], timeout: Self.defaultWaitTimeout) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let query = MockQuery() - let resultData = try transaction.read(query: query).0 - - expect(resultData.hero.name).to(beNil()) - - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_writeDataForSelectionSet_givenFragment_updateNestedField_updatesObject() throws { - // given - struct GivenFragment: MockMutableRootSelectionSet, Fragment { - static var fragmentDefinition: StaticString { "" } - - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - runActivity("update fragment") { _ in - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - let fragment = try! GivenFragment(data: - ["hero": [ - "__typename": "Droid", - "name": "Artoo" - ]], - variables: nil - ) - - try transaction.write(selectionSet: fragment, withKey: CacheReference.RootQuery.key) - - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - let query = MockQuery() - - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "Artoo") - } - } - } - - func test_writeDataForOperation_givenSelectionSetManuallyInitializedWithInclusionConditions_writesFieldsForInclusionConditions() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Query = Object(typename: "Query", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - default: XCTFail(); return nil - } - } - - class Data: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Query } - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - public var hero: Hero { __data["hero"] } - - convenience init( - hero: Hero - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - "hero": hero._fieldData, - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - class Hero: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .include(if: "a", .inlineFragment(IfA.self)), - .include(if: "b", .inlineFragment(IfB.self)) - ]} - - var ifA: IfA? { _asInlineFragment() } - var ifB: IfB? { _asInlineFragment() } - - class IfA: ConcreteMockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("name", String.self), - .include(if: !"c", .field("friend", Friend.self)), - .include(if: !"d", .field("other", String.self)) - ]} - var name: String { __data["name"] } - var friend: Friend? { __data["friend"] } - var other: String? { __data["name"] } - - convenience init( - name: String, - friend: Friend? = nil, - other: String? = nil - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Human.typename, - "name": name, - "friend": friend._fieldData, - "other": other - ], fulfilledFragments: [ - ObjectIdentifier(Hero.self), - ObjectIdentifier(Self.self) - ])) - } - - class Friend: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - - var name: String { __data["name"] } - - convenience init( - name: String - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Human.typename, - "name": name, - ], fulfilledFragments: [ObjectIdentifier(Friend.self)])) - } - - } - } - - class IfB: ConcreteMockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - ]} - convenience init() { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Human.typename, - ], fulfilledFragments: [ - ObjectIdentifier(Hero.self), - ObjectIdentifier(Self.self) - ])) - } - } - } - } - - // when - let writeCompletedExpectation = expectation(description: "Write completed") - - store.withinReadWriteTransaction({ transaction in - let data = Data( - hero: .IfA( - name: "Han Solo", - friend: Data.Hero.IfA.Friend(name: "Leia Organa") - ).asRootEntityType - ) - let query = MockQuery() - try transaction.write(data: data, for: query) - - }, completion: { result in - defer { writeCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [writeCompletedExpectation], timeout: Self.defaultWaitTimeout) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let query = MockQuery() - query.__variables = ["a": true, "b": false, "c": false, "d": true] - let resultData = try transaction.read(query: query).0 - - expect(resultData.hero.ifA?.name).to(equal("Han Solo")) - expect(resultData.hero.ifB).to(beNil()) - expect(resultData.hero.ifA?.friend?.name).to(equal("Leia Organa")) - expect(resultData.hero.ifA?.friend?.other).to(beNil()) - - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_writeDataForOperation_givenSelectionSetManuallyInitializedWithTypeCases_writesFieldForTypeCasesWithManuallyProvidedImplementedInterfaces() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Query = Object(typename: "Query", implementedInterfaces: []) - static let Character = Interface(name: "Character") - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - default: return nil - } - } - - class GivenQuery: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Query } - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - public var hero: Hero { __data["hero"] } - - convenience init( - hero: Hero - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - "hero": hero._fieldData, - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - class Hero: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .inlineFragment(AsCharacter.self) - ]} - - var asCharacter: AsCharacter? { _asInlineFragment() } - - class AsCharacter: ConcreteMockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Character } - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - - var name: String { __data["name"] } - - convenience init( - __typename: String, - name: String - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": __typename, - "name": name - ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(Hero.self) - ])) - } - } - } - } - - // when - let writeCompletedExpectation = expectation(description: "Write completed") - - store.withinReadWriteTransaction({ transaction in - let data = GivenQuery( - hero: .AsCharacter( - __typename: "Person", - name: "Han Solo" - ).asRootEntityType - ) - let query = MockQuery() - try transaction.write(data: data, for: query) - - }, completion: { result in - defer { writeCompletedExpectation.fulfill() } - let heroKey = "QUERY_ROOT.hero" - let records = try? self.cache.loadRecords(forKeys: [heroKey]) - let heroRecord = records?[heroKey] - - expect(heroRecord?.record.fields["name"] as? String).to(equal("Han Solo")) - XCTAssertSuccessResult(result) - }) - - self.wait(for: [writeCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_writeDataForOperation_givenSelectionSetManuallyInitializedWithNamedFragmentInInclusionConditionIsFulfilled_writesFieldsForNamedFragment() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Query = Object(typename: "Query", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Query": return Types.Query - case "Human": return Types.Human - default: XCTFail(); return nil - } - } - - struct GivenFragment: MockMutableRootSelectionSet, Fragment { - static var fragmentDefinition: StaticString { "" } - - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __parentType: ParentType { Types.Query } - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - init( - hero: Hero - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - "hero": hero._fieldData - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __parentType: ParentType { Types.Human } - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - init( - name: String - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Human.typename, - "name": name - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - class GivenQuery: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Query } - override class var __selections: [Selection] {[ - .include(if: "a", [.inlineFragment(IfA.self)]) - ]} - - var ifA: IfA? { _asInlineFragment() } - - convenience init() { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - class IfA: ConcreteMockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Query } - override class var __selections: [Selection] {[ - .fragment(GivenFragment.self) - ]} - - public var hero: GivenFragment.Hero { __data["hero"] } - - convenience init( - hero: GivenFragment.Hero - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - "hero": hero._fieldData, - ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(GivenQuery.self), - ObjectIdentifier(GivenFragment.self) - ])) - } - } - } - - // when - let writeCompletedExpectation = expectation(description: "Write completed") - - store.withinReadWriteTransaction({ transaction in - let data = GivenQuery.IfA( - hero: .init(name: "Han Solo") - ).asRootEntityType - let query = MockQuery() - try transaction.write(data: data, for: query) - - }, completion: { result in - defer { writeCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [writeCompletedExpectation], timeout: Self.defaultWaitTimeout) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let query = MockQuery() - query.__variables = ["a": true] - let resultData = try transaction.read(query: query).0 - - expect(resultData.ifA?.hero.name).to(equal("Han Solo")) - - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func test_writeDataForOperation_givenSelectionSetManuallyInitializedWithNamedFragmentInInclusionConditionNotFulfilled_doesNotAttemptToWriteFieldsForNamedFragment() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Query = Object(typename: "Query", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Query": return Types.Query - case "Human": return Types.Human - default: XCTFail(); return nil - } - } - - struct GivenFragment: MockMutableRootSelectionSet, Fragment { - static var fragmentDefinition: StaticString { "" } - - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - init( - hero: Hero - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - "hero": hero._fieldData, - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - init( - name: String - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Human.typename, - "name": name, - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - class GivenQuery: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Query } - override class var __selections: [Selection] {[ - .include(if: "a", [.inlineFragment(IfA.self)]) - ]} - - var ifA: IfA? { _asInlineFragment() } - - convenience init() { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename - ], fulfilledFragments: [ObjectIdentifier(Self.self)])) - } - - class IfA: ConcreteMockTypeCase { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Types.Query } - override class var __selections: [Selection] {[ - .fragment(GivenFragment.self) - ]} - - public var hero: GivenFragment.Hero { __data["hero"] } - - convenience init( - hero: GivenFragment.Hero - ) { - self.init(_dataDict: DataDict(data: [ - "__typename": Types.Query.typename, - "hero": hero._fieldData, - ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(GivenQuery.self), - ObjectIdentifier(GivenFragment.self) - ])) - } - } - } - - // when - let writeCompletedExpectation = expectation(description: "Write completed") - - store.withinReadWriteTransaction({ transaction in - let data = GivenQuery() - let query = MockQuery() - try transaction.write(data: data, for: query) - - }, completion: { result in - defer { writeCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [writeCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - // MARK: - Update Object With Key Tests - - func test_updateObjectWithKey_readAfterUpdateWithinSameTransaction_hasUpdatedValue() throws { - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("QUERY_ROOT.hero")], - "QUERY_ROOT.hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // then - let readAfterUpdateCompletedExpectation = expectation(description: "Read after update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.updateObject( - ofType: GivenSelectionSet.self, - withKey: "QUERY_ROOT", { data in - data.hero.name = "Artoo" - }) - - let data = try transaction.readObject( - ofType: GivenSelectionSet.self, - withKey: "QUERY_ROOT" - ) - - XCTAssertEqual(data.0.hero.name, "Artoo") - - }, completion: { result in - defer { readAfterUpdateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readAfterUpdateCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func testUpdateObjectWithKey_givenFragment_updatesObject() throws { - /// given - struct GivenFragment: MockMutableRootSelectionSet, Fragment { - static var fragmentDefinition: StaticString { "" } - - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("id", String.self), - .field("friends", [Friend].self), - ]} - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "id": "2001", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker", "id": "1000"], - "1002": ["__typename": "Human", "name": "Han Solo", "id": "1002"], - "1003": ["__typename": "Human", "name": "Leia Organa", "id": "1003"], - ]) - - let updateCompletedExpectation = expectation(description: "Update completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.updateObject( - ofType: GivenFragment.self, - withKey: "2001" - ) { friendsNamesFragment in - var c3po = GivenFragment.Friend() - c3po.__typename = "Droid" - c3po.id = "1004" - c3po.name = "C-3PO" - - friendsNamesFragment.friends.append(c3po) - } - }, completion: { result in - defer { updateCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [updateCompletedExpectation], timeout: Self.defaultWaitTimeout) - - class HeroFriendsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self) - ]} - - var friends: [Friend] { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - } - } - } - - let query = MockQuery() - loadFromStore(operation: query) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - let friendsNames: [String] = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa", "C-3PO"]) - } - } - } - - // MARK: - Remove Object - - func test_removeObject_givenReferencedByOtherRecord_thenReadQueryReferencingRemovedRecord_throwsError() throws { - /// given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero? { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self), - ]} - - var name: String? { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("id", String.self), - .field("name", String.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "id": "2001", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker", "id": "1000"], - "1002": ["__typename": "Human", "name": "Han Solo", "id": "1002"], - "1003": ["__typename": "Human", "name": "Leia Organa", "id": "1003"], - ]) - - runActivity("delete record for Leia Organa") { _ in - let readWriteCompletedExpectation = expectation(description: "ReadWrite completed") - - store.withinReadWriteTransaction({ transaction in - try transaction.removeObject(for: "1003") - }, completion: { result in - defer { readWriteCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - - self.wait(for: [readWriteCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Read query with deleted record reference") { _ in - let query = MockQuery() - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - _ = try transaction.read(query: query) - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertFailureResult(result) { readError in - guard let error = readError as? GraphQLExecutionError else { - XCTFail("Unexpected error for reading removed record: \(readError)") - return - } - - /// The error should occur when trying to load all the hero's friend references, since one has been deleted - XCTAssertEqual(error.path, ["hero", "friends", "2"]) - expect(error.underlying as? JSONDecodingError).to(equal(JSONDecodingError.missingValue)) - } - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func test_removeObjectsMatchingPattern_givenPatternNotMatchingKeyCase_deletesCaseInsensitiveMatchingRecords() throws { - // given - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - // then - let heroKey = "hero" - - // - // 1. Merge all required records into the cache with lowercase key - // - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["\(heroKey.lowercased())": CacheReference("QUERY_ROOT.\(heroKey.lowercased())")], - "QUERY_ROOT.\(heroKey.lowercased())": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // - // 2. Remove object matching case insensitive (uppercase) key - // - This should remove `QUERY_ROOT.hero` using pattern `QUERY_ROOT.HERO` - // - - let removeRecordsCompletedExpectation = expectation(description: "Remove cache record by key pattern") - - store.withinReadWriteTransaction({ transaction in - try transaction.removeObjects(matching: "\(heroKey.uppercased())") - }, completion: { result in - defer { removeRecordsCompletedExpectation.fulfill() } - - XCTAssertSuccessResult(result) - }) - - waitForExpectations(timeout: Self.defaultWaitTimeout) - - // - // 3. Attempt to read records after pattern removal - expected FAIL - // - - let readAfterRemoveCompletedExpectation = expectation(description: "Read from cache after removal by pattern") - - store.withinReadTransaction({ transaction in - _ = try transaction.read(query: query) - - }, completion: { result in - defer { readAfterRemoveCompletedExpectation.fulfill() } - - XCTAssertFailureResult(result) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - }) - - waitForExpectations(timeout: Self.defaultWaitTimeout) - } - - func test_removeObjectsMatchingPattern_givenKeyMatchingSubrangePattern_deletesMultipleRecords() throws { - // given - enum Episode: String, EnumType { - case NEWHOPE - case JEDI - case EMPIRE - } - - class HeroFriendsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self) - ]} - - var friends: [Friend] { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - } - } - } - - // - // 1. Merge all required records into the cache - // - mergeRecordsIntoCache([ - "QUERY_ROOT": [ - "hero(episode:NEWHOPE)": CacheReference("1002"), - "hero(episode:JEDI)": CacheReference("1101"), - "hero(episode:EMPIRE)": CacheReference("2001") - ], - "2001": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - CacheReference("1101"), - CacheReference("1003") - ] - ], - "1101": [ - "__typename": "Human", "name": "Luke Skywalker", "id": "1101", "friends": [] - ], - "1002": [ - "__typename": "Human", "name": "Han Solo", "id": "1002", "friends": [] - ], - "1003": [ - "__typename": "Human", "name": "Leia Organa", "id": "1003", "friends": [] - ], - ]) - - // - // 2. Remove all objects matching the pattern `100` - // - This will remove `1002` (Han Solo, hero for the .newhope episode) - // - This will remove `1003` (Leia Organa, friend of the hero in .empire episode) - // - - let removeFromCacheCompletedExpectation = expectation(description: "Hero objects removed from cache by pattern") - - store.withinReadWriteTransaction({ transaction in - try transaction.removeObjects(matching: "100") - }, completion: { result in - defer { removeFromCacheCompletedExpectation.fulfill() } - - XCTAssertSuccessResult(result) - }) - - waitForExpectations(timeout: Self.defaultWaitTimeout) - - // - // 3. Attempt to read records after pattern removal - // - .newhope episode query expected to FAIL on the `hero` path - // - .jedi episdoe query expected to SUCCEED - // - .empire episode query expected to FAIL on the `hero.friends` path - // - - let readHeroNewHopeAfterRemoveCompletedExpectation = expectation(description: "Read removed hero object for .newhope episode from cache") - - store.withinReadTransaction({ transaction in - let query = MockQuery() - query.__variables = ["episode": "NEWHOPE"] - _ = try transaction.read(query: query) - - }, completion: { newHopeResult in - defer { readHeroNewHopeAfterRemoveCompletedExpectation.fulfill() } - - XCTAssertFailureResult(newHopeResult) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - }) - - let readHeroJediAfterRemoveCompletedExpectation = expectation(description: "Read removed hero object for .jedi episode from cache") - - store.withinReadTransaction({ transaction in - let query = MockQuery() - query.__variables = ["episode": "JEDI"] - let data = try transaction.read(query: query) - - XCTAssertEqual(data.0.hero.__typename, "Human") - XCTAssertEqual(data.0.hero.name, "Luke Skywalker") - - }, completion: { jediResult in - defer { readHeroJediAfterRemoveCompletedExpectation.fulfill() } - - XCTAssertSuccessResult(jediResult) - }) - - let readHeroEmpireAfterRemoveCompletedExpectation = expectation(description: "Read removed hero object for .empire episode from cache") - - store.withinReadTransaction({ transaction in - let query = MockQuery() - query.__variables = ["episode": "EMPIRE"] - _ = try transaction.read(query: query) - - }, completion: { empireResult in - defer { readHeroEmpireAfterRemoveCompletedExpectation.fulfill() } - - XCTAssertFailureResult(empireResult) { error in - if let error = error as? GraphQLExecutionError { - XCTAssertEqual(error.path, ["hero.friends.1"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - }) - - waitForExpectations(timeout: Self.defaultWaitTimeout) - } - - // MARK: Memory Leak Tests - - func test_readTransaction_readQuery_afterTransaction_releasesReadTransaction() throws { - // given - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("hero")], - "hero": ["__typename": "Droid", "name": "R2-D2"] - ]) - - // when - - weak var readTransaction: ApolloStore.ReadTransaction? - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - readTransaction = transaction - - let data = try transaction.read(query: query) - - expect(data.0.hero?.__typename).to(equal("Droid")) - expect(data.0.hero?.name).to(equal("R2-D2")) - - }, completion: { result in - defer { readCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - expect(readTransaction).to(beNil()) - }) - - self.wait(for: [readCompletedExpectation], timeout: Self.defaultWaitTimeout) - } - - func testReceivedAtAfterUpdateQuery() throws { - - // given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict data: DataDict) { __data = data } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict data: DataDict) { __data = data } - - static var __selections: [Selection] { [ - .field("name", String.self) - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - - let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: Date())! - let initialRecords = RecordSet([ - "QUERY_ROOT": (["hero": CacheReference("QUERY_ROOT.hero")], yesterday), - "QUERY_ROOT.hero": (["__typename": "Droid", "name": "R2-D2"], yesterday) - ]) - let cacheMutation = MockLocalCacheMutation() - mergeRecordsIntoCache(initialRecords) - - runActivity("update mutation") { _ in - - let expectation = self.expectation(description: "transaction'd") - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - } - }, completion: { result in - defer { expectation.fulfill() } - XCTAssertSuccessResult(result) - }) - self.wait(for: [expectation], timeout: Self.defaultWaitTimeout) - - let query = MockQuery() - loadFromStore(operation: query) { result in - switch result { - case let .success(success): - // the query age is that of the oldest row read, so still yesterday - XCTAssertEqual( - Calendar.current.compare(yesterday, to: success.metadata.maxAge, toGranularity: .minute), - .orderedSame - ) - case let .failure(error): - XCTFail("Unexpected error: \(error)") - } - - } - } - - runActivity("read object") { _ in - // verify that the age of the modified row is from just now - let cacheReadExpectation = self.expectation(description: "cacheReadExpectation") - store.withinReadTransaction ({ transaction in - let object = try transaction.readObject(ofType: GivenSelectionSet.Hero.self, withKey: "QUERY_ROOT.hero") - XCTAssertTrue(object.0.name == "Artoo") - XCTAssertEqual( - Calendar.current.compare(Date(), to: object.1.maxAge, toGranularity: .minute), - .orderedSame - ) - }, completion: { result in - defer { cacheReadExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - self.wait(for: [cacheReadExpectation], timeout: Self.defaultWaitTimeout) - } - } - -} - -// MARK: Helpers - -fileprivate func expectJSONMissingValueError( - _ result: Result, - atPath path: ResponsePath, - file: FileString = #file, line: UInt = #line -) { - guard case let .failure(readError) = result else { - fail("Expected JSON Missing Value Error: \(result)", - file: file, line: line) - return - } - - if let error = readError as? GraphQLExecutionError { - expect(file: file, line: line, error.path).to(equal(path)) - switch error.underlying { - case JSONDecodingError.missingValue: - // This is correct. - break - default: - fail("Expected JSON Missing Value Error: \(result)", - file: file, line: line) - } - } else { - expect(readError as? JSONDecodingError).to(equal(.missingValue)) - } -} diff --git a/Tests/ApolloTests/Cache/SQLite/CachePersistenceTests.swift b/Tests/ApolloTests/Cache/SQLite/CachePersistenceTests.swift deleted file mode 100644 index f0a2bb7b96..0000000000 --- a/Tests/ApolloTests/Cache/SQLite/CachePersistenceTests.swift +++ /dev/null @@ -1,299 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -@testable import ApolloSQLite -import ApolloInternalTestHelpers -import SQLite -import StarWarsAPI - -class CachePersistenceTests: XCTestCase { - - func testDatabaseSetup() throws { - // loop through each of the database snapshots to run through migrations - // if a migration fails, then it will throw an error - // we verify the migration is successful by comparing the iteration to the schema version (assigned after the migration) - let testBundle = Bundle(for: Self.self) - try testBundle.paths(forResourcesOfType: "sqlite3", inDirectory: nil) - .sorted() // make sure they run in order - .map(URL.init(fileURLWithPath:)) - .enumerated() - .forEach { previousSchemaVersion, fileURL in - guard FileManager.default.fileExists(atPath: fileURL.path) else { - XCTFail("expected snapshot file '\(fileURL.lastPathComponent)' could not be found") - return - } - // open a connection to the snapshot that is expected to be migrated to the next version - try SQLiteTestCacheProvider.withCache(fileURL: fileURL) { cache in - guard let sqlCache = cache as? SQLiteNormalizedCache else { - XCTFail("The cache is not using SQLite") - return - } - let schemaVersion = try sqlCache.database.readSchemaVersion() - XCTAssertEqual(schemaVersion, Int64(previousSchemaVersion + 1)) - - runTestFetchAndPersist(againstFileAt: fileURL) - } - } - } - - func testFetchAndPersist() throws { - self.runTestFetchAndPersist(againstFileAt: SQLiteTestCacheProvider.temporarySQLiteFileURL()) - } - - func testFetchAndPersistWithPeriodArguments() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["text": .variable("term")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - query.__variables = ["term": "Luke.Skywalker"] - - let sqliteFileURL = SQLiteTestCacheProvider.temporarySQLiteFileURL() - - try SQLiteTestCacheProvider.withCache(fileURL: sqliteFileURL) { (cache) in - let store = ApolloStore(cache: cache) - - let server = MockGraphQLServer() - let networkTransport = MockNetworkTransport(server: server, store: store) - - let client = ApolloClient(networkTransport: networkTransport, store: store) - - _ = server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Human" - ] - ] - ] - } - - let networkExpectation = self.expectation(description: "Fetching query from network") - let newCacheExpectation = self.expectation(description: "Fetch query from new cache") - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData) { outerResult in - defer { networkExpectation.fulfill() } - - switch outerResult { - case .failure(let error): - XCTFail("Unexpected error: \(error)") - return - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.data?.hero?.name, "Luke Skywalker") - - // Do another fetch from cache to ensure that data is cached before creating new cache - client.fetch(query: query, cachePolicy: .returnCacheDataDontFetch) { innerResult in - try! SQLiteTestCacheProvider.withCache(fileURL: sqliteFileURL) { cache in - let newStore = ApolloStore(cache: cache) - let newClient = ApolloClient(networkTransport: networkTransport, store: newStore) - - newClient.fetch(query: query, cachePolicy: .returnCacheDataDontFetch) { newClientResult in - defer { newCacheExpectation.fulfill() } - switch newClientResult { - case .success(let newClientGraphQLResult): - XCTAssertEqual(newClientGraphQLResult.data?.hero?.name, "Luke Skywalker") - case .failure(let error): - XCTFail("Unexpected error with new client: \(error)") - } - _ = newClient // Workaround for a bug - ensure that newClient is retained until this block is run - } - } - } - } - } - - self.waitForExpectations(timeout: 2, handler: nil) - } - } - - func testPassInConnectionDoesNotThrow() { - do { - let database = try SQLiteDotSwiftDatabase(connection: Connection()) - _ = try SQLiteNormalizedCache(database: database) - - } catch { - XCTFail("Passing in connection failed with error: \(error)") - } - } - - func testClearCache() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - let sqliteFileURL = SQLiteTestCacheProvider.temporarySQLiteFileURL() - - try SQLiteTestCacheProvider.withCache(fileURL: sqliteFileURL) { (cache) in - let store = ApolloStore(cache: cache) - - let server = MockGraphQLServer() - let networkTransport = MockNetworkTransport(server: server, store: store) - - let client = ApolloClient(networkTransport: networkTransport, store: store) - - _ = server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Human" - ] - ] - ] - } - - let networkExpectation = self.expectation(description: "Fetching query from network") - let emptyCacheExpectation = self.expectation(description: "Fetch query from empty cache") - let cacheClearExpectation = self.expectation(description: "cache cleared") - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData) { outerResult in - defer { networkExpectation.fulfill() } - - switch outerResult { - case .failure(let error): - XCTFail("Unexpected failure: \(error)") - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.data?.hero?.name, "Luke Skywalker") - } - - client.clearCache(completion: { result in - switch result { - case .success: - break - case .failure(let error): - XCTFail("Error clearing cache: \(error)") - } - cacheClearExpectation.fulfill() - }) - - client.fetch(query: query, cachePolicy: .returnCacheDataDontFetch) { innerResult in - defer { emptyCacheExpectation.fulfill() } - - switch innerResult { - case .success: - XCTFail("This should have returned an error") - case .failure(let error): - if let resultError = error as? JSONDecodingError { - switch resultError { - case .missingValue: - // Correct error! - break - default: - XCTFail("Unexpected JSON error: \(error)") - } - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - } - - self.waitForExpectations(timeout: 2, handler: nil) - } - } - -} - -extension CachePersistenceTests { - private func runTestFetchAndPersist( - againstFileAt sqliteFileURL: URL, - file: StaticString = #file, - line: UInt = #line - ) { - - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let query = MockQuery() - - try SQLiteTestCacheProvider.withCache(fileURL: sqliteFileURL) { (cache) in - let store = ApolloStore(cache: cache) - - let server = MockGraphQLServer() - let networkTransport = MockNetworkTransport(server: server, store: store) - - let client = ApolloClient(networkTransport: networkTransport, store: store) - - _ = server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Human" - ] - ] - ] - } - - let networkExpectation = self.expectation(description: "Fetching query from network") - let newCacheExpectation = self.expectation(description: "Fetch query from new cache") - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData) { outerResult in - defer { networkExpectation.fulfill() } - - switch outerResult { - case .failure(let error): - XCTFail("Unexpected error: \(error)") - return - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.data?.hero?.name, "Luke Skywalker") - - // Do another fetch from cache to ensure that data is cached before creating new cache - client.fetch(query: query, cachePolicy: .returnCacheDataDontFetch) { innerResult in - try! SQLiteTestCacheProvider.withCache(fileURL: sqliteFileURL) { cache in - let newStore = ApolloStore(cache: cache) - let newClient = ApolloClient(networkTransport: networkTransport, store: newStore) - - newClient.fetch(query: query, cachePolicy: .returnCacheDataDontFetch) { newClientResult in - defer { newCacheExpectation.fulfill() } - switch newClientResult { - case .success(let newClientGraphQLResult): - XCTAssertEqual(newClientGraphQLResult.data?.hero?.name, "Luke Skywalker") - case .failure(let error): - XCTFail("Unexpected error with new client: \(error)") - } - _ = newClient // Workaround for a bug - ensure that newClient is retained until this block is run - } - } - } - } - } - - self.waitForExpectations(timeout: 2, handler: nil) - } - - } - -} diff --git a/Tests/ApolloTests/Cache/SQLite/SQLiteCacheTests.swift b/Tests/ApolloTests/Cache/SQLite/SQLiteCacheTests.swift deleted file mode 100644 index 3a76b0cab1..0000000000 --- a/Tests/ApolloTests/Cache/SQLite/SQLiteCacheTests.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import ApolloInternalTestHelpers - -// These test cases inherit all tests from their superclasses. - -class SQLiteFetchQueryTests: FetchQueryTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class SQLiteLoadQueryFromStoreTests: LoadQueryFromStoreTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class SQLiteReadWriteFromStoreTests: ReadWriteFromStoreTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - -class SQLiteWatchQueryTests: WatchQueryTests { - override var cacheType: TestCacheProvider.Type { - SQLiteTestCacheProvider.self - } -} - diff --git a/Tests/ApolloTests/Cache/StoreConcurrencyTests.swift b/Tests/ApolloTests/Cache/StoreConcurrencyTests.swift deleted file mode 100644 index 55a21cb237..0000000000 --- a/Tests/ApolloTests/Cache/StoreConcurrencyTests.swift +++ /dev/null @@ -1,390 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class StoreConcurrencyTests: XCTestCase, CacheDependentTesting { - - var cacheType: TestCacheProvider.Type { - InMemoryTestCacheProvider.self - } - - var defaultWaitTimeout: TimeInterval = 60 - - var cache: NormalizedCache! - var store: ApolloStore! - - override func setUpWithError() throws { - try super.setUpWithError() - - cache = try makeNormalizedCache() - store = ApolloStore(cache: cache) - } - - override func tearDownWithError() throws { - cache = nil - store = nil - - try super.tearDownWithError() - } - - // MARK: - Mocks - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - - // MARK - Tests - - func testConcurrentReadsInitiatedFromMainThread() throws { - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - CacheReference("1000"), - CacheReference("1002"), - CacheReference("1003") - ] - ], - "1000": ["__typename": "Human", "name": "Luke Skywalker"], - "1002": ["__typename": "Human", "name": "Han Solo"], - "1003": ["__typename": "Human", "name": "Leia Organa"], - ]) - - let query = MockQuery() - - let numberOfReads = 1000 - - let allReadsCompletedExpectation = XCTestExpectation(description: "All reads completed") - allReadsCompletedExpectation.expectedFulfillmentCount = numberOfReads - - for _ in 0..() - - let numberOfReads = 1000 - - let allReadsCompletedExpectation = XCTestExpectation(description: "All reads completed") - allReadsCompletedExpectation.expectedFulfillmentCount = numberOfReads - - DispatchQueue.concurrentPerform(iterations: numberOfReads) { _ in - store.withinReadTransaction({ transaction in - let data = try transaction.read(query: query) - - XCTAssertEqual(data.0.hero?.name, "R2-D2") - let friendsNames = data.0.hero?.friends?.map { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - }, completion: { result in - defer { allReadsCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - } - - self.wait(for: [allReadsCompletedExpectation], timeout: defaultWaitTimeout) - } - - func testConcurrentUpdatesInitiatedFromMainThread() throws { - /// given - struct GivenSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String? { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] { [ - .field("id", String.self), - .field("name", String.self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - } - - mergeRecordsIntoCache([ - "QUERY_ROOT": ["hero": CacheReference("2001")], - "2001": [ - "name": "R2-D2", - "id": "2001", - "__typename": "Droid", - "friends": [] - ] - ]) - - let cacheMutation = MockLocalCacheMutation() - let query = MockQuery() - - let numberOfUpdates = 100 - - let allUpdatesCompletedExpectation = XCTestExpectation(description: "All store updates completed") - allUpdatesCompletedExpectation.expectedFulfillmentCount = numberOfUpdates - - for i in 0..() - let query = MockQuery() - - let numberOfUpdates = 100 - - let allUpdatesCompletedExpectation = XCTestExpectation(description: "All store updates completed") - allUpdatesCompletedExpectation.expectedFulfillmentCount = numberOfUpdates - - DispatchQueue.concurrentPerform(iterations: numberOfUpdates) { i in - store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - data.hero.name = "Artoo" - - var newDroid = GivenSelectionSet.Hero.Friend() - newDroid.__typename = "Droid" - newDroid.id = "\(i)" - newDroid.name = "Droid #\(i)" - data.hero.friends.append(newDroid) - } - - let data = try transaction.read(query: query) - - XCTAssertEqual(data.0.hero.name, "Artoo") - XCTAssertEqual(data.0.hero.friends.last?.name, "Droid #\(i)") - }, completion: { result in - defer { allUpdatesCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - }) - } - - self.wait(for: [allUpdatesCompletedExpectation], timeout: defaultWaitTimeout) - - let readCompletedExpectation = expectation(description: "Read completed") - - store.withinReadTransaction({ transaction in - let data = try transaction.read(query: query) - - XCTAssertEqual(data.0.hero.name, "Artoo") - - let friendsNames: [String] = try XCTUnwrap( - data.0.hero.friends.compactMap { $0.name } - ) - - let expectedFriendsNames = (0..() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - } - - let initialWatcherResultExpectation = - resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Refetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Artoo", - "__typename": "Droid" - ] - ] - ] - } - - let refetchedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received refetched result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - } - } - - watcher.refetch() - - wait(for: [serverRequestExpectation, refetchedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryGetsUpdatedAfterFetchingSameQueryWithChangedData() throws { - class SimpleMockSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch same query from server returning changed data") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Artoo", - "__typename": "Droid" - ] - ] - ] - } - - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - } - } - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryDoesNotRefetchAfterSameQueryWithDifferentArgument() throws { - class GivenMockSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let watchedQuery = MockQuery() - watchedQuery.__variables = ["episode": "EMPIRE"] - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch same query from server with different argument") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - expect(request.operation.__variables?["episode"] as? String).to(equal("JEDI")) - - return [ - "data": [ - "hero": [ - "name": "Artoo", - "__typename": "Droid" - ] - ] - ] - } - - let noUpdatedResultExpectation = resultObserver.expectation( - description: "Other query shouldn't trigger refetch" - ) { _ in } - noUpdatedResultExpectation.isInverted = true - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - let newQuery = MockQuery() - newQuery.__variables = ["episode": "JEDI"] - - client.fetch(query: newQuery, cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, noUpdatedResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryGetsUpdatedWhenSameObjectHasChangedInAnotherQueryWithDifferentVariables() throws { - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self) - ]} - } - } - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let watchedQuery = MockQuery() - watchedQuery.__variables = ["episode": "EMPIRE"] - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = server.expect(MockQuery.self) { request in - expect(request.operation.__variables?["episode"] as? String).to(equal("EMPIRE")) - return [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation(description: "Watcher received initial result") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.id, "2001") - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch same query from server with different argument but returning same object with changed data") { _ in - let serverRequestExpectation = server.expect(MockQuery.self) { request in - expect(request.operation.__variables?["episode"] as? String).to(equal("JEDI")) - return [ - "data": [ - "hero": [ - "id": "2001", - "name": "Artoo", - "__typename": "Droid" - ] - ] - ] - } - - let updatedWatcherResultExpectation = resultObserver.expectation(description: "Updated result after refetching query") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - } - } - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - let query = MockQuery() - query.__variables = ["episode": "JEDI"] - - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryGetsUpdatedWhenOverlappingQueryReturnsChangedData() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - class HeroAndFriendsNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "name": "Luke Skywalker"], - ["__typename": "Human", "name": "Han Solo"], - ["__typename": "Human", "name": "Leia Organa"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch overlapping query from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Artoo", - "__typename": "Droid" - ] - ] - ] - } - - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testListInWatchedQueryGetsUpdatedByListOfKeysFromOtherQuery() throws { - class HeroAndFriendsIdsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - ]} - } - } - } - - class HeroAndFriendsNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ["__typename": "Human", "id": "1002", "name": "Han Solo"], - ["__typename": "Human", "id": "1003", "name": "Leia Organa"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation(description: "Watcher received initial result from server") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch other query with list of updated keys from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "Artoo", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1003"], - ["__typename": "Human", "id": "1000"], - ] - ] - ] - ] - } - - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Leia Organa", "Luke Skywalker"]) - } - } - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryRefetchesFromServerAfterOtherQueryUpdatesListWithIncompleteObject() throws { - class HeroAndFriendsIDsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - ]} - } - } - } - - class HeroAndFriendsNameWithIDsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ["__typename": "Human", "id": "1002", "name": "Han Solo"], - ["__typename": "Human", "id": "1003", "name": "Leia Organa"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation(description: "Watcher received initial result from server") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch other query with list of updated keys from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "Artoo", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1003"], - ["__typename": "Human", "id": "1004"], - ["__typename": "Human", "id": "1000"], - ] - ] - ] - ] - } - - let refetchServerRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "Artoo", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1003", "name": "Leia Organa"], - ["__typename": "Human", "id": "1004", "name": "Wilhuff Tarkin"], - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ] - ] - ] - ] - } - - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Leia Organa", "Wilhuff Tarkin", "Luke Skywalker"]) - } - } - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, refetchServerRequestExpectation, updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryGetsUpdatedWhenObjectIsChangedByDirectStoreUpdate() throws { - struct HeroAndFriendsNamesSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var friends: [Friend]? { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self), - ]} - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - } - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "name": "Luke Skywalker"], - ["__typename": "Human", "name": "Han Solo"], - ["__typename": "Human", "name": "Leia Organa"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - let friendsNames: [String] = try XCTUnwrap( - data.hero?.friends?.compactMap { $0.name } - ) - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Update object directly in store") { _ in - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - client.store.withinReadWriteTransaction({ transaction in - let cacheMutation = MockLocalCacheMutation() - try transaction.update(cacheMutation) { data in - data.hero?.name = "Artoo" - } - }) - - wait(for: [updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQuery_givenCachePolicyReturnCacheDataDontFetch_doesNotRefetchFromServerAfterOtherQueryUpdatesListWithIncompleteObject() throws { - // given - struct HeroAndFriendsNamesSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - } - - struct HeroAndFriendsIDsOnlySelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("friends", [Friend].self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - } - } - } - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Write data to cache") { _ in - let writeToStoreExpectation = expectation(description: "Initial Data written to store") - - client.store.withinReadWriteTransaction({ transaction in - let data = try! HeroAndFriendsNamesSelectionSet( - data: - [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ["__typename": "Human", "id": "1002", "name": "Han Solo"], - ["__typename": "Human", "id": "1003", "name": "Leia Organa"], - ] - ] - ], - variables: nil - ) - - let cacheMutation = MockLocalCacheMutation() - try transaction.write(data: data, for: cacheMutation) - }) { result in - XCTAssertSuccessResult(result) - writeToStoreExpectation.fulfill() - } - - wait(for: [writeToStoreExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Initial fetch from cache") { _ in - let initialWatcherResultExpectation = resultObserver.expectation(description: "Watcher received initial result from cache") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - let friendsNames = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo", "Leia Organa"]) - } - } - - watcher.fetch(cachePolicy: .returnCacheDataDontFetch) - - wait(for: [initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch other query with list of updated keys from server") { _ in - let serverRequestExpectation = server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "Artoo", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1003"], - ["__typename": "Human", "id": "1004"], - ["__typename": "Human", "id": "1000"], - ] - ] - ] - ] - } - - let noRefetchExpectation = resultObserver.expectation(description: "Initial query shouldn't trigger refetch") { _ in } - noRefetchExpectation.isInverted = true - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - let query = MockQuery() - client.fetch(query: query, cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, noRefetchExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryIsOnlyUpdatedOnceIfConcurrentFetchesAllReturnTheSameResult() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation(description: "Watcher received initial result from server") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "R2-D2") - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - let numberOfFetches = 10 - - runActivity("Fetch same query concurrently \(numberOfFetches) times") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Artoo", - "__typename": "Droid" - ] - ] - ] - } - - serverRequestExpectation.expectedFulfillmentCount = numberOfFetches - - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero?.name, "Artoo") - } - } - - let otherFetchesCompletedExpectation = expectation(description: "Other fetches completed") - otherFetchesCompletedExpectation.expectedFulfillmentCount = numberOfFetches - - DispatchQueue.concurrentPerform(iterations: numberOfFetches) { _ in - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { [weak self] result in - otherFetchesCompletedExpectation.fulfill() - - if let self = self, case .failure(let error) = result { - self.record(error) - } - } - } - - wait(for: [serverRequestExpectation, otherFetchesCompletedExpectation, updatedWatcherResultExpectation], timeout: 3) - - XCTAssertEqual(updatedWatcherResultExpectation.numberOfFulfillments, 1) - } - } - - func testWatchedQueryIsUpdatedMultipleTimesIfConcurrentFetchesReturnChangedData() throws { - class HeroNameSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - var hero: Hero { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - - var name: String { __data["name"] } - } - } - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertEqual(data.hero.name, "R2-D2") - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - let numberOfFetches = 10 - - runActivity("Fetch same query concurrently \(numberOfFetches) times") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "name": "Artoo #\(UUID())", - "__typename": "Droid" - ] - ] - ] - } - - serverRequestExpectation.expectedFulfillmentCount = numberOfFetches - - let updatedWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received updated result from cache" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - XCTAssertTrue(try XCTUnwrap(data.hero.name).hasPrefix("Artoo")) - } - } - - updatedWatcherResultExpectation.expectedFulfillmentCount = numberOfFetches - - let otherFetchesCompletedExpectation = expectation(description: "Other fetches completed") - otherFetchesCompletedExpectation.expectedFulfillmentCount = numberOfFetches - - DispatchQueue.concurrentPerform(iterations: numberOfFetches) { _ in - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { [weak self] result in - otherFetchesCompletedExpectation.fulfill() - - if let self = self, case .failure(let error) = result { - self.record(error) - } - } - } - - wait(for: [serverRequestExpectation, otherFetchesCompletedExpectation, updatedWatcherResultExpectation], timeout: 3) - - XCTAssertEqual(updatedWatcherResultExpectation.numberOfFulfillments, numberOfFetches) - } - } - - func testWatchedQueryDependentKeysAreUpdatedAfterDirectStoreUpdate() { - // given - struct HeroAndFriendsNamesWithIDsSelectionSet: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - var hero: Hero { - get { __data["hero"] } - set { __data["hero"] = newValue } - } - - struct Hero: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - - var friends: [Friend] { - get { __data["friends"] } - set { __data["friends"] = newValue } - } - - struct Friend: MockMutableRootSelectionSet { - public var __data: DataDict = .empty() - init(_dataDict: DataDict) { __data = _dataDict } - - static var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var id: String { - get { __data["id"] } - set { __data["id"] = newValue } - } - - var name: String { - get { __data["name"] } - set { __data["name"] = newValue } - } - } - } - } - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - typealias HeroAndFriendsNamesWithIDsQuery = MockQuery - let watchedQuery = HeroAndFriendsNamesWithIDsQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = server.expect(HeroAndFriendsNamesWithIDsQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation(description: "Watcher received initial result from server") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - - XCTAssertEqual(data.hero.name, "R2-D2") - - let friendsNames = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker"]) - - let expectedDependentKeys: Set = [ - "Droid:2001.__typename", - "Droid:2001.friends", - "Droid:2001.id", - "Droid:2001.name", - "Human:1000.__typename", - "Human:1000.id", - "Human:1000.name", - "QUERY_ROOT.hero", - ] - let actualDependentKeys = try XCTUnwrap(graphQLResult.dependentKeys) - expect(actualDependentKeys).to(equal(expectedDependentKeys)) - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Update same query directly in store") { _ in - let updatedWatcherResultExpectation = resultObserver.expectation(description: "Watcher received updated result from cache") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - - XCTAssertEqual(data.hero.name, "R2-D2") - - let friendsNames = data.hero.friends.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo"]) - - let expectedDependentKeys: Set = [ - "Droid:2001.__typename", - "Droid:2001.friends", - "Droid:2001.id", - "Droid:2001.name", - "Human:1000.__typename", - "Human:1000.id", - "Human:1000.name", - "Human:1002.__typename", - "Human:1002.id", - "Human:1002.name", - "QUERY_ROOT.hero", - ] - let actualDependentKeys = try XCTUnwrap(graphQLResult.dependentKeys) - expect(actualDependentKeys).to(equal(expectedDependentKeys)) - } - } - - let cacheMutation = MockLocalCacheMutation() - client.store.withinReadWriteTransaction({ transaction in - try transaction.update(cacheMutation) { data in - var human = HeroAndFriendsNamesWithIDsSelectionSet.Hero.Friend() - human.__typename = "Human" - human.id = "1002" - human.name = "Han Solo" - data.hero.friends.append(human) - } - }) - - wait(for: [updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testWatchedQueryDependentKeysAreUpdatedAfterOtherFetchReturnsChangedData() { - class HeroAndFriendsNameWithIDsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - let watcher = GraphQLQueryWatcher(client: client, query: watchedQuery, context: nil, resultHandler: resultObserver.handler) - addTeardownBlock { watcher.cancel() } - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - - XCTAssertEqual(data.hero?.name, "R2-D2") - - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker"]) - - let expectedDependentKeys: Set = [ - "Droid:2001.__typename", - "Droid:2001.friends", - "Droid:2001.id", - "Droid:2001.name", - "Human:1000.__typename", - "Human:1000.id", - "Human:1000.name", - "QUERY_ROOT.hero", - ] - let actualDependentKeys = try XCTUnwrap(graphQLResult.dependentKeys) - XCTAssertEqual(actualDependentKeys, expectedDependentKeys) - } - } - - watcher.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("Fetch other query from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ["__typename": "Human", "id": "1002", "name": "Han Solo"], - ] - ] - ] - ] - } - - let updatedWatcherResultExpectation = resultObserver.expectation(description: "Watcher received updated result from cache") { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - - XCTAssertEqual(data.hero?.name, "R2-D2") - - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker", "Han Solo"]) - - let expectedDependentKeys: Set = [ - "Droid:2001.__typename", - "Droid:2001.friends", - "Droid:2001.id", - "Droid:2001.name", - "Human:1000.__typename", - "Human:1000.id", - "Human:1000.name", - "Human:1002.__typename", - "Human:1002.id", - "Human:1002.name", - "QUERY_ROOT.hero", - ] - let actualDependentKeys = try XCTUnwrap(graphQLResult.dependentKeys) - XCTAssertEqual(actualDependentKeys, expectedDependentKeys) - } - } - - let otherFetchCompletedExpectation = expectation(description: "Other fetch completed") - - client.fetch(query: MockQuery(), - cachePolicy: .fetchIgnoringCacheData) { result in - defer { otherFetchCompletedExpectation.fulfill() } - XCTAssertSuccessResult(result) - } - - wait(for: [serverRequestExpectation, otherFetchCompletedExpectation, updatedWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - } - - func testQueryWatcherDoesNotHaveARetainCycle() { - class HeroAndFriendsNameWithIDsSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero?.self) - ]} - - var hero: Hero? { __data["hero"] } - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend]?.self), - ]} - - var friends: [Friend]? { __data["friends"] } - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .field("name", String.self), - ]} - - var name: String { __data["name"] } - } - } - } - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let watchedQuery = MockQuery() - - let resultObserver = makeResultObserver(for: watchedQuery) - - var watcher: GraphQLQueryWatcher>? = - GraphQLQueryWatcher(client: client, - query: watchedQuery, - context: nil, - resultHandler: resultObserver.handler) - - weak var weakWatcher = watcher - - runActivity("Initial fetch from server") { _ in - let serverRequestExpectation = - server.expect(MockQuery.self) { request in - [ - "data": [ - "hero": [ - "id": "2001", - "name": "R2-D2", - "__typename": "Droid", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ] - ] - ] - ] - } - - let initialWatcherResultExpectation = resultObserver.expectation( - description: "Watcher received initial result from server" - ) { result in - try XCTAssertSuccessResult(result) { graphQLResult in - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertNil(graphQLResult.errors) - - let data = try XCTUnwrap(graphQLResult.data) - - XCTAssertEqual(data.hero?.name, "R2-D2") - - let friendsNames = data.hero?.friends?.compactMap { $0.name } - XCTAssertEqual(friendsNames, ["Luke Skywalker"]) - - let expectedDependentKeys: Set = [ - "Droid:2001.__typename", - "Droid:2001.friends", - "Droid:2001.id", - "Droid:2001.name", - "Human:1000.__typename", - "Human:1000.id", - "Human:1000.name", - "QUERY_ROOT.hero", - ] - let actualDependentKeys = try XCTUnwrap(graphQLResult.dependentKeys) - XCTAssertEqual(actualDependentKeys, expectedDependentKeys) - } - } - - watcher!.fetch(cachePolicy: .fetchIgnoringCacheData) - - wait(for: [serverRequestExpectation, initialWatcherResultExpectation], timeout: Self.defaultWaitTimeout) - } - - runActivity("make sure it gets released") { _ in - watcher = nil - cache = nil - server = nil - client = nil - - XCTAssertTrueEventually(weakWatcher == nil, message: "Watcher was not released.") - } - } -} diff --git a/Tests/ApolloTests/CacheKeyForFieldTests.swift b/Tests/ApolloTests/CacheKeyForFieldTests.swift deleted file mode 100644 index 7b8f784748..0000000000 --- a/Tests/ApolloTests/CacheKeyForFieldTests.swift +++ /dev/null @@ -1,63 +0,0 @@ -import XCTest -@testable import Apollo - -class CacheKeyForFieldTests: XCTestCase { - func testFieldWithNameOnly() { - let actual = CacheKeyForField(named: "hero", arguments: [:]) - XCTAssertEqual(actual, "hero") - } - - func testFieldWithStringArgument() { - let actual = CacheKeyForField(named: "hero", arguments: ["episode": "JEDI"]) - XCTAssertEqual(actual, "hero(episode:JEDI)") - } - - func testFieldWithIntegerArgument() { - let actual = CacheKeyForField(named: "hero", arguments: ["episode": 1]) - XCTAssertEqual(actual, "hero(episode:1)") - } - - func testFieldWithFloatArgument() { - let actual = CacheKeyForField(named: "hero", arguments: ["episode": 1.99]) - XCTAssertEqual(actual, "hero(episode:1.99)") - } - - func testFieldWithNullArgument() { - let actual = CacheKeyForField(named: "hero", arguments: ["episode": NSNull()]) - XCTAssertEqual(actual, "hero(episode:null)") - } - - func testFieldWithNestedNullArgument() throws { - let actual = CacheKeyForField( - named: "hero", - arguments: ["nested": ["foo": 1, "bar": NSNull()]] - ) - XCTAssertEqual(actual, "hero([nested:bar:null,foo:1])") - } - - func testFieldWithListArgument() { - let actual = CacheKeyForField(named: "hero", arguments: ["episodes": [1, 1, 2]]) - XCTAssertEqual(actual, "hero(episodes:[1, 1, 2])") - } - - func testFieldWithDictionaryArgument() throws { - let actual = CacheKeyForField( - named: "hero", - arguments: ["nested": ["foo": 1, "bar": "2"]] - ) - XCTAssertEqual(actual, "hero([nested:bar:2,foo:1])") - } - - func testFieldWithMultipleArgumentsIsOrderIndependent() { - let actual1 = CacheKeyForField(named: "hero", arguments: ["foo": "a", "bar": "b"]) - let actual2 = CacheKeyForField(named: "hero", arguments: ["bar": "b", "foo": "a"]) - XCTAssertEqual(actual1, actual2) - } - - func testFieldWithInputObjectArgumentIsOrderIndependent() { - let actual1 = CacheKeyForField(named: "hero", arguments: ["episode": "JEDI", "nested": ["foo": "a", "bar": "b"]]) - let actual2 = CacheKeyForField(named: "hero", arguments: ["episode": "JEDI", "nested": ["bar": "b", "foo": "a"]]) - XCTAssertEqual(actual1, actual2) - } - -} diff --git a/Tests/ApolloTests/CacheKeyResolutionTests.swift b/Tests/ApolloTests/CacheKeyResolutionTests.swift deleted file mode 100644 index f49fd76eb4..0000000000 --- a/Tests/ApolloTests/CacheKeyResolutionTests.swift +++ /dev/null @@ -1,126 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class CacheKeyResolutionTests: XCTestCase { - - func test__schemaConfiguration__givenData_whenCacheKeyInfoIsNil_shouldReturnNil() { - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = { _, _ in nil } - - let object: JSONObject = [ - "id": "α" - ] - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual = MockSchemaMetadata.cacheKey(for: objectDict) - - expect(actual).to(beNil()) - } - - func test__schemaConfiguration__givenData_whenUnknownType_withCacheKeyInfoForUnknownType_shouldReturnInfoWithTypeName() { - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in nil } - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = { (_, json) in - return try? CacheKeyInfo(jsonValue: json["id"]) - } - - let object: JSONObject = [ - "__typename": "Omega", - "id": "ω" - ] - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual = MockSchemaMetadata.cacheKey(for: objectDict) - - expect(actual).to(equal("Omega:ω")) - } - - func test__schemaConfiguration__givenData_whenUnknownType_nilCacheKeyInfo_shouldReturnNil() { - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in nil } - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = { (_, json) in nil } - - let object: JSONObject = [ - "__typename": "Omega", - "id": "ω" - ] - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual = MockSchemaMetadata.cacheKey(for: objectDict) - - expect(actual).to(beNil()) - } - - func test__schemaConfiguration__givenData_whenKnownType_givenNilCacheKeyInfo_shouldReturnNil() { - let Alpha = Object(typename: "Alpha", implementedInterfaces: []) - - let object: JSONObject = [ - "__typename": "Alpha", - "id": "α" - ] - - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Alpha } - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = { (_, json) in nil } - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual = MockSchemaMetadata.cacheKey(for: objectDict) - - expect(actual).to(beNil()) - } - - func test__schemaConfiguration__givenData_whenKnownType_givenCacheKeyInfo_shouldReturnCacheReference() { - let object: JSONObject = [ - "__typename": "MockSchemaObject", - "id": "β" - ] - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual = MockSchemaMetadata.cacheKey(for: objectDict) - - expect(actual).to(equal( - "MockSchemaObject:β" - )) - } - - func test__multipleSchemaConfigurations_withDifferentCacheKeyProvidersDefinedInExtensions_shouldReturnDifferentCacheKeys() { - let object: JSONObject = [ - "__typename": "MockSchemaObject", - "id": "β" - ] - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual1 = MockSchema1.cacheKey(for: objectDict) - - expect(actual1).to(equal( - "MockSchemaObject:one" - )) - - let actual2 = MockSchema2.cacheKey(for: objectDict) - - expect(actual2).to(equal( - "MockSchemaObject:two" - )) - } - - func test__schemaConfiguration__givenData_whenKnownType_isCacheKeyProvider_withUniqueKeyGroupId_shouldReturnCacheReference() { - let Delta = Object(typename: "Delta", implementedInterfaces: []) - - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Delta } - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = { (_, json) in - .init(id: "δ", uniqueKeyGroup: "GreekLetters") - } - - let object: JSONObject = [ - "__typename": "Delta", - "lowercase": "δ" - ] - - let objectDict = NetworkResponseExecutionSource().opaqueObjectDataWrapper(for: object) - let actual = MockSchemaMetadata.cacheKey(for: objectDict) - - expect(actual).to(equal("GreekLetters:δ")) - } - -} diff --git a/Tests/ApolloTests/CancellationHandlingInterceptor.swift b/Tests/ApolloTests/CancellationHandlingInterceptor.swift deleted file mode 100644 index 9955ea7a2f..0000000000 --- a/Tests/ApolloTests/CancellationHandlingInterceptor.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// CancellationHandlingInterceptor.swift -// ApolloTests -// -// Created by Ellen Shapiro on 9/17/20. -// Copyright © 2020 Apollo GraphQL. All rights reserved. -// - -import Foundation -import Apollo -import ApolloAPI - -class CancellationHandlingInterceptor: ApolloInterceptor, Cancellable { - private(set) var hasBeenCancelled = false - - public var id: String = UUID().uuidString - - func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) { - - guard !self.hasBeenCancelled else { - return - } - - DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { - chain.proceedAsync( - request: request, - response: response, - interceptor: self, - completion: completion - ) - } - } - - func cancel() { - self.hasBeenCancelled = true - } -} diff --git a/Tests/ApolloTests/ClearCacheTests.swift b/Tests/ApolloTests/ClearCacheTests.swift deleted file mode 100644 index 54cc2578a1..0000000000 --- a/Tests/ApolloTests/ClearCacheTests.swift +++ /dev/null @@ -1,53 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloInternalTestHelpers - -class ClearCacheTests: XCTestCase { - static let defaultWaitTimeout = 0.5 - - var store: ApolloStore! - var server: MockGraphQLServer! - var transport: NetworkTransport! - var client: ApolloClient! - - override func setUp() { - store = ApolloStore.mock() - server = MockGraphQLServer() - transport = MockNetworkTransport(server: server, store: store) - client = ApolloClient(networkTransport: transport, store: store) - } - - override func tearDown() { - client = nil - transport = nil - server = nil - store = nil - } - - func testClearCacheCompletion_givenNoCallbackQueue_shouldCallbackOnMainQueue() throws { - let completionCallbackExpectation = expectation(description: "clearCache completion callback on main queue") - client.clearCache() { result in - XCTAssertTrue(Thread.isMainThread) - - completionCallbackExpectation.fulfill() - } - - wait(for: [completionCallbackExpectation], timeout: Self.defaultWaitTimeout) - } - - func testCacheClearCompletion_givenCustomCallbackQueue_shouldCallbackOnCustomQueue() throws { - let label = "CustomQueue" - let queue = DispatchQueue(label: label) - let key = DispatchSpecificKey() - queue.setSpecific(key: key, value: label) - - let completionCallbackExpectation = expectation(description: "clearCache completion callback on custom queue") - client.clearCache(callbackQueue: queue) { result in - XCTAssertEqual(DispatchQueue.getSpecific(key: key), label) - - completionCallbackExpectation.fulfill() - } - - wait(for: [completionCallbackExpectation], timeout: Self.defaultWaitTimeout) - } -} diff --git a/Tests/ApolloTests/DataLoaderTests.swift b/Tests/ApolloTests/DataLoaderTests.swift deleted file mode 100644 index 691d5a4c21..0000000000 --- a/Tests/ApolloTests/DataLoaderTests.swift +++ /dev/null @@ -1,84 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloInternalTestHelpers - -class DataLoaderTests: XCTestCase { - func testSingleLoad() throws { - let loader = DataLoader { keys in - return self.wordsForNumbers(keys) - } - - XCTAssertEqual(try loader[1].get(), "one") - } - - func testMultipleLoads() throws { - var numberOfBatchLoads = 0 - - let loader = DataLoader { keys in - numberOfBatchLoads += 1 - return self.wordsForNumbers(keys) - } - - let results = [loader[1], loader[2]] - let values = try results.map { try $0.get() } - - XCTAssertEqual(values, ["one", "two"]) - XCTAssertEqual(numberOfBatchLoads, 1) - } - - func testCoalescesIdenticalRequests() throws { - var batchLoads: [Set] = [] - - let loader = DataLoader { keys in - batchLoads.append(keys) - return self.wordsForNumbers(keys) - } - - let results = [loader[1], loader[1]] - let values = try results.map { try $0.get() } - - XCTAssertEqual(values, ["one", "one"]) - XCTAssertEqual(batchLoads.count, 1) - XCTAssertEqual(batchLoads[0], [1]) - } - - func testCachesRepeatedRequests() throws { - var batchLoads: [Set] = [] - - let loader = DataLoader { keys in - batchLoads.append(keys) - return self.wordsForNumbers(keys) - } - - let results1 = [loader[1], loader[2]] - let values1 = try results1.map { try $0.get() } - - XCTAssertEqual(values1, ["one", "two"]) - XCTAssertEqual(batchLoads.count, 1) - XCTAssertEqualUnordered(batchLoads[0], [1, 2]) - - let results2 = [loader[1], loader[3]] - let values2 = try results2.map { try $0.get() } - - XCTAssertEqual(values2, ["one", "three"]) - XCTAssertEqual(batchLoads.count, 2) - XCTAssertEqual(batchLoads[1], [3]) - - let results3 = [loader[1], loader[2], loader[3]] - let values3 = try results3.map { try $0.get() } - - XCTAssertEqual(values3, ["one", "two", "three"]) - XCTAssertEqual(batchLoads.count, 2) - } - - // - Helpers - - private func wordsForNumbers(_ keys: Set) -> [Int: String] { - let formatter = NumberFormatter() - formatter.numberStyle = .spellOut - - return keys.reduce(into: [:]) { result, key in - result[key] = formatter.string(from: key as NSNumber) - } - } -} diff --git a/Tests/ApolloTests/DefaultInterceptorProviderTests.swift b/Tests/ApolloTests/DefaultInterceptorProviderTests.swift deleted file mode 100644 index 9029b64b6d..0000000000 --- a/Tests/ApolloTests/DefaultInterceptorProviderTests.swift +++ /dev/null @@ -1,115 +0,0 @@ -import XCTest -import Apollo -import ApolloAPI -import ApolloInternalTestHelpers -import StarWarsAPI - -class DefaultInterceptorProviderTests: XCTestCase { - - var client: ApolloClient! - var mockServer: MockGraphQLServer! - - static let mockData: JSONObject = [ - "data": [ - "hero": [ - "name": "R2-D2", - "__typename": "Droid" - ] - ] - ] - - override func setUp() { - mockServer = MockGraphQLServer() - let store = ApolloStore() - let networkTransport = MockNetworkTransport(server: mockServer, store: store) - client = ApolloClient(networkTransport: networkTransport, store: store) - } - - override func tearDown() { - client = nil - mockServer = nil - - super.tearDown() - } - - func testLoading() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let expectation = mockServer.expect(MockQuery.self) { _ in - DefaultInterceptorProviderTests.mockData - } - - client.fetch(query: MockQuery()) { result in - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertEqual(graphQLResult.data?.hero?.name, "R2-D2") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.wait(for: [expectation], timeout: 10) - } - - func testInitialLoadFromNetworkAndSecondaryLoadFromCache() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - } - - let initialLoadExpectation = mockServer.expect(MockQuery.self) { _ in - DefaultInterceptorProviderTests.mockData - } - initialLoadExpectation.assertForOverFulfill = false - - client.fetch(query: MockQuery()) { result in - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.source, .server) - XCTAssertEqual(graphQLResult.data?.hero?.name, "R2-D2") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - } - } - - self.wait(for: [initialLoadExpectation], timeout: 10) - - let secondLoadExpectation = self.expectation(description: "loaded with default client") - - client.fetch(query: MockQuery()) { result in - switch result { - case .success(let graphQLResult): - XCTAssertEqual(graphQLResult.source, .cache) - XCTAssertEqual(graphQLResult.data?.hero?.name, "R2-D2") - case .failure(let error): - XCTFail("Unexpected error: \(error)") - - } - secondLoadExpectation.fulfill() - } - - self.wait(for: [secondLoadExpectation], timeout: 10) - } -} diff --git a/Tests/ApolloTests/ErrorGenerationTests.swift b/Tests/ApolloTests/ErrorGenerationTests.swift deleted file mode 100644 index 3bb1bff06e..0000000000 --- a/Tests/ApolloTests/ErrorGenerationTests.swift +++ /dev/null @@ -1,118 +0,0 @@ -// -// ErrorGenerationTests.swift -// Apollo -// -// Created by Ellen Shapiro on 9/9/19. -// Copyright © 2019 Apollo GraphQL. All rights reserved. -// - -import Apollo -@testable import ApolloAPI -import ApolloInternalTestHelpers -import Nimble -import XCTest - -class ErrorGenerationTests: XCTestCase { - - private func checkExtensions(on error: GraphQLError, - expectedDict: [String: Any?], - file: StaticString = #filePath, - line: UInt = #line) { - XCTAssertEqual(error.extensions?.count, - expectedDict.count, - file: file, - line: line) - - for (key, expectedValue) in expectedDict { - let actualValue = error.extensions?[key] as? String - let stringExpectedValue = expectedValue as? String - XCTAssertEqual(actualValue, - stringExpectedValue, - "Value for key \(key) did not match expected value \(String(describing: stringExpectedValue)), it was \(String(describing: actualValue))", - file: file, - line: line) - } - } - - func testSingleErrorParsing() throws { - let json = """ -{ - "data": { - "hero": null - }, - "errors": [ - { - "message": "Invalid client auth token.", - "extensions": { - "code": "INTERNAL_SERVER_ERROR" - } - } - ] -} -""" - - let data = try XCTUnwrap(json.data(using: .utf8), - "Couldn't create json data") - let deserialized = try JSONSerializationFormat.deserialize(data: data) - let jsonObject = try XCTUnwrap(deserialized as? JSONObject) - let response = GraphQLResponse(operation: MockQuery.mock(), body: jsonObject) - let result = try response.parseResultFast() - XCTAssertNotNil(result.data) - expect(result.data?.__data._data["hero"]).to(beNil()) - - XCTAssertEqual(result.errors?.count, 1) - let error = try XCTUnwrap(result.errors?.first) - XCTAssertEqual(error.message, "Invalid client auth token.") - - self.checkExtensions(on: error, expectedDict: [ - "code": "INTERNAL_SERVER_ERROR" - ]) - } - - func testLocalizedStringFromErrorResponseWithMultipleErrors() throws { - let json = """ -{ - "data": { - "hero": null - }, - "errors": [ - { - "message": "Invalid client auth token.", - "extensions": { - "code": "INTERNAL_SERVER_ERROR" - } - }, - { - "message": "Server is having a sad.", - "extensions": { - "code": "INTERNAL_SERVER_ERROR" - } - } - ] -} -""" - - let data = try XCTUnwrap(json.data(using: .utf8), - "Couldn't create json data") - let deserialized = try JSONSerializationFormat.deserialize(data: data) - let jsonObject = try XCTUnwrap(deserialized as? JSONObject) - let response = GraphQLResponse(operation: MockQuery.mock(), body: jsonObject) - let result = try response.parseResultFast() - XCTAssertNotNil(result.data) - expect(result.data?.__data._data["hero"]).to(beNil()) - - let errors = try XCTUnwrap(result.errors) - - XCTAssertEqual(errors.count, 2) - XCTAssertEqual(errors.map { $0.message }, [ - "Invalid client auth token.", - "Server is having a sad.", - ]) - - for error in errors { - self.checkExtensions(on: error, expectedDict: [ - "code": "INTERNAL_SERVER_ERROR" - ]) - } - } -} diff --git a/Tests/ApolloTests/ExecutionSources/NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift b/Tests/ApolloTests/ExecutionSources/NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift deleted file mode 100644 index e25ad70249..0000000000 --- a/Tests/ApolloTests/ExecutionSources/NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests.swift +++ /dev/null @@ -1,306 +0,0 @@ -import Foundation -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI - -class NetworkResponseExecutionSource_OpaqueObjectDataWrapper_Tests: XCTestCase { - - var subject: NetworkResponseExecutionSource! - - override func setUp() { - super.setUp() - subject = NetworkResponseExecutionSource() - } - - override func tearDown() { - super.tearDown() - subject = nil - } - - // MARK: - Scalar Fields - - func test__subscript__forStringScalarField_returnsValue() throws { - // given - let data = [ - "name": "Luke Skywalker" - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["name"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - func test__subscript_forIntScalarField_returnsValue() throws { - // given - let data = [ - "value": Int(10) - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript_forInt32ScalarField_returnsValue() throws { - // given - let data = [ - "value": Int32(10) - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript_forInt64ScalarField_returnsValue() throws { - // given - let data = [ - "value": Int64(10) - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript_forBoolScalarField_returnsScalarTypeValue() throws { - // given - let data = [ - "value": true - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Bool).to(equal(true)) - } - - func test__subscript_forDoubleScalarField_returnsScalarTypeValue() throws { - // given - let data = [ - "value": Double(10.5) - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Double).to(equal(10.5)) - } - - func test__subscript_forFloatScalarField_returnsScalarTypeValue() throws { - // given - let data = [ - "value": Float(10.5) - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Float).to(equal(10.5)) - } - - func test__subscript__givenDeserializedJSON_returnsScalarTypeValues() throws { - // given - let data = """ - { - "string" : "string", - "int": 321, - "bool": true, - "double": 10.5 - } - """.data(using: .utf8)! - - let deserialized = try JSONSerializationFormat.deserialize(data: data) as! JSONObject - let objectData = subject.opaqueObjectDataWrapper(for: deserialized) - - // when - let actualString = objectData["string"] - let actualInt = objectData["int"] - let actualBool = objectData["bool"] - let actualDouble = objectData["double"] - - // then - expect(actualString as? String).to(equal("string")) - expect(actualInt as? Int).to(equal(321)) - expect(actualBool as? Bool).to(equal(true)) - expect(actualDouble as? Double).to(equal(10.5)) - } - - // MARK: Object Fields - - func test__subscript__forObjectField_givenObjectJSON_returnsValueAsObjectDataWrapper() throws { - // given - let data = [ - "friend": [ - "name": "Luke Skywalker" - ] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["friend"]?["name"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - // MARK: List Fields - - func test__subscript__forListOfScalarField_returnsValue() throws { - // given - let data = [ - "list": ["Luke Skywalker"] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["list"]?[0] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - func test__subscript__forListOfObjectsField_returnsValueAsObjectDict() throws { - // given - let data = [ - "friends": [ - [ - "name": "Luke Skywalker" - ] - ] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["friends"]?[0]?["name"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - func test__subscript__forListOfIntFields_returnsValue() throws { - // given - let data = [ - "values": [Int(10), Int(20)] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - - let actual = objectData["values"]?[0] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forListOfInt32Fields_returnsValue() throws { - // given - let data = [ - "values": [Int32(10), Int32(20)] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - - let actual = objectData["values"]?[0] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forListOfInt64Fields_returnsValue() throws { - // given - let data = [ - "values": [Int64(10), Int64(20)] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - - let actual = objectData["values"]?[0] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forListOfBoolFields_returnsValue() throws { - // given - let data = [ - "values": [true, false] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - - let actual = objectData["values"]?[0] - - // then - expect(actual as? Bool).to(equal(true)) - } - - func test__subscript__forListOfDoubleFields_returnsValue() throws { - // given - let data = [ - "values": [Double(10.5), Double(20.5)] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - - let actual = objectData["values"]?[0] - - // then - expect(actual as? Double).to(equal(10.5)) - } - - func test__subscript__forListOfFloatFields_returnsValue() throws { - // given - let data = [ - "values": [Float(10.5), Float(20.5)] - ] - - let objectData = subject.opaqueObjectDataWrapper(for: data) - - // when - - let actual = objectData["values"]?[0] - - // then - expect(actual as? Float).to(equal(10.5)) - } - -} diff --git a/Tests/ApolloTests/ExecutionSources/SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift b/Tests/ApolloTests/ExecutionSources/SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift deleted file mode 100644 index 6f0ce458dc..0000000000 --- a/Tests/ApolloTests/ExecutionSources/SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests.swift +++ /dev/null @@ -1,351 +0,0 @@ -import Foundation -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI - -class SelectionSetModelExecutionSource_OpaqueObjectDataWrapper_Tests: XCTestCase { - - // MARK: - Scalar Fields - - func test__subscript__forStringScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "name": "Luke Skywalker" - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["name"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - func test__subscript__forIntScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "value": Int(10) - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forInt32ScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "value": Int32(10) - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forInt64ScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "value": Int64(10) - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forBoolScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "value": true - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Bool).to(equal(true)) - } - - func test__subscript__forDoubleScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "value": Double(10.5) - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Double).to(equal(10.5)) - } - - func test__subscript__forFloatScalarField_returnsValue() throws { - // given - let data = DataDict( - data: [ - "value": Float(10.5) - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["value"] - - // then - expect(actual as? Float).to(equal(10.5)) - } - - func test__subscript__forCustomScalarField_returnsValueAsJSONValue() throws { - // given - let data = DataDict( - data: [ - "customScalar": MockCustomScalar(value: "Luke Skywalker") - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["customScalar"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - // MARK: Object Fields - - func test__subscript__forObjectField_returnsValueAsObjectDataWrapper() throws { - // given - let data = DataDict( - data: [ - "friend": DataDict( - data: [ - "name": "Luke Skywalker" - ], - fulfilledFragments: [] - ) - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["friend"]?["name"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - // MARK: List Fields - - func test__subscript__forListOfStringScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "list": ["Luke Skywalker"] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["list"]?[0] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - func test__subscript__forListOfIntScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "values": [Int(10), Int(20)] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["values"]?[0] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forListOfInt32ScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "values": [Int32(10), Int32(20)] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["values"]?[0] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forListOfInt64ScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "values": [Int64(10), Int64(20)] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["values"]?[0] - - // then - expect(actual as? Int).to(equal(10)) - } - - func test__subscript__forListOfBoolScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "values": [true, false] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["values"]?[0] - - // then - expect(actual as? Bool).to(equal(true)) - } - - func test__subscript__forListOfDoubleScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "values": [Double(10.5), Double(20.5)] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["values"]?[0] - - // then - expect(actual as? Double).to(equal(10.5)) - } - - func test__subscript__forListOfFloatScalarFields_returnsValue() throws { - // given - let data = DataDict( - data: [ - "values": [Float(10.5), Float(20.5)] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["values"]?[0] - - // then - expect(actual as? Float).to(equal(10.5)) - } - - func test__subscript__forListOfCustomScalarField_returnsValueAsListOfJSONValue() throws { - // given - let data = DataDict( - data: [ - "list": [MockCustomScalar(value: "Luke Skywalker")] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["list"]?[0] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - - func test__subscript__forListOfObjectsField_returnsValueAsObjectDict() throws { - // given - let data = DataDict( - data: [ - "friends": [ - DataDict( - data: [ - "name": "Luke Skywalker" - ], - fulfilledFragments: [] - ) - ] - ], - fulfilledFragments: [] - ) - - let objectData = SelectionSetModelExecutionSource().opaqueObjectDataWrapper(for: data) - - // when - let actual = objectData["friends"]?[0]?["name"] - - // then - expect(actual as? String).to(equal("Luke Skywalker")) - } - -} diff --git a/Tests/ApolloTests/GETTransformerTests.swift b/Tests/ApolloTests/GETTransformerTests.swift deleted file mode 100644 index b18577c6e1..0000000000 --- a/Tests/ApolloTests/GETTransformerTests.swift +++ /dev/null @@ -1,287 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class GETTransformerTests: XCTestCase { - private var requestBodyCreator: ApolloRequestBodyCreator! - private static let url = TestURL.mockPort8080.url - - override func setUp() { - super.setUp() - - requestBodyCreator = ApolloRequestBodyCreator() - } - - override func tearDown() { - requestBodyCreator = nil - - super.tearDown() - } - - private enum MockEnum: String, EnumType { - case LARGE - case AVERAGE - case SMALL - } - - func test__createGetURL__queryWithSingleParameterAndVariable_encodesURL() { - class GivenMockOperation: MockOperation { - override class var operationName: String { "TestOpName" } - override class var operationDocument: OperationDocument { - .init(definition: .init( - """ - query MockQuery($param: String) { - testField(param: $param) { - __typename - name - } - } - """)) - } - } - - let operation = GivenMockOperation() - operation.__variables = ["param": "TestParamValue"] - - let body = requestBodyCreator.requestBody(for: operation, - sendQueryDocument: true, - autoPersistQuery: false) - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?operationName=TestOpName&query=query%20MockQuery($param:%20String)%20%7B%0A%20%20testField(param:%20$param)%20%7B%0A%20%20%20%20__typename%0A%20%20%20%20name%0A%20%20%7D%0A%7D&variables=%7B%22param%22:%22TestParamValue%22%7D" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__query_withEnumParameterAndVariable_encodesURL() { - class GivenMockOperation: MockOperation { - override class var operationName: String { "TestOpName" } - override class var operationDocument: OperationDocument { - .init(definition: .init( - """ - query MockQuery($param: MockEnum) { - testField(param: $param) { - __typename - name - } - } - """)) - } - } - - let operation = GivenMockOperation() - operation.__variables = ["param": MockEnum.LARGE] - - let body = requestBodyCreator.requestBody(for: operation, - sendQueryDocument: true, - autoPersistQuery: false) - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?operationName=TestOpName&query=query%20MockQuery($param:%20MockEnum)%20%7B%0A%20%20testField(param:%20$param)%20%7B%0A%20%20%20%20__typename%0A%20%20%20%20name%0A%20%20%7D%0A%7D&variables=%7B%22param%22:%22LARGE%22%7D" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__queryWithMoreThanOneParameter_withIncludeDirective_encodesURL() throws { - class GivenMockOperation: MockOperation { - override class var operationName: String { "TestOpName" } - override class var operationDocument: OperationDocument { - .init(definition: .init( - """ - query MockQuery($a: String, $b: Boolean!) { - testField(param: $a) { - __typename - nestedField @include(if: $b) - } - } - """)) - } - } - - let operation = GivenMockOperation() - operation.__variables = ["a": "TestParamValue", "b": true] - - let body = requestBodyCreator.requestBody(for: operation, - sendQueryDocument: true, - autoPersistQuery: false) - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?operationName=TestOpName&query=query%20MockQuery($a:%20String,%20$b:%20Boolean!)%20%7B%0A%20%20testField(param:%20$a)%20%7B%0A%20%20%20%20__typename%0A%20%20%20%20nestedField%20@include(if:%20$b)%0A%20%20%7D%0A%7D&variables=%7B%22a%22:%22TestParamValue%22,%22b%22:true%7D" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__queryWith2DParameter_encodesURL_withBodyComponentsInAlphabeticalOrder() throws { - class GivenMockOperation: MockOperation { - override class var operationName: String { "TestOpName" } - override class var operationDocument: OperationDocument { - .init( - operationIdentifier: "4d465fbc6e3731d01102504850", - definition: .init("query MockQuery {}")) - } - } - - let persistedQuery: JSONEncodableDictionary = [ - "version": 1, - "sha256Hash": GivenMockOperation.operationIdentifier! - ] - - let extensions: JSONEncodableDictionary = [ - "persistedQuery": persistedQuery - ] - - let body: JSONEncodableDictionary = [ - "query": GivenMockOperation.definition?.queryDocument, - "extensions": extensions - ] - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?extensions=%7B%22persistedQuery%22:%7B%22sha256Hash%22:%224d465fbc6e3731d01102504850%22,%22version%22:1%7D%7D&query=query%20MockQuery%20%7B%7D" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__queryWithParameter_withPlusSign_encodesPlusSign() throws { - let extensions: JSONEncodableDictionary = [ - "testParam": "+Test+Test" - ] - - let body: JSONEncodableDictionary = [ - "query": MockOperation.definition?.queryDocument, - "extensions": extensions - ] - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?extensions=%7B%22testParam%22:%22%2BTest%2BTest%22%7D&query=Mock%20Operation%20Definition" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__queryWithParameter_withAmpersand_encodesAmpersand() throws { - let extensions: JSONEncodableDictionary = [ - "testParam": "Test&Test" - ] - - let body: JSONEncodableDictionary = [ - "query": MockOperation.definition?.queryDocument, - "extensions": extensions - ] - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?extensions=%7B%22testParam%22:%22Test%26Test%22%7D&query=Mock%20Operation%20Definition" - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__queryWithPersistedQueryID_withoutQueryParameter_encodesURL() throws { - class GivenMockOperation: MockOperation { - override class var operationName: String { "TestOpName" } - override class var operationDocument: OperationDocument { - .init(operationIdentifier: "4d465fbc6e3731d01102504850") - } - } - - let persistedQuery: JSONEncodableDictionary = [ - "version": 1, - "sha256Hash": GivenMockOperation.operationIdentifier! - ] - - let extensions: JSONEncodableDictionary = [ - "persistedQuery": persistedQuery - ] - - let body: JSONEncodableDictionary = [ - "extensions": extensions - ] - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?extensions=%7B%22persistedQuery%22:%7B%22sha256Hash%22:%224d465fbc6e3731d01102504850%22,%22version%22:1%7D%7D" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__queryWithNullValueForVariable_encodesVariableWithNull() { - class GivenMockOperation: MockOperation { - override class var operationName: String { "TestOpName" } - override class var operationDocument: OperationDocument { - .init(definition: .init( - """ - query MockQuery($param: String) { - testField(param: $param) { - __typename - name - } - } - """)) - } - } - - let operation = GivenMockOperation() - operation.__variables = ["param": GraphQLNullable.null] - - let body = requestBodyCreator.requestBody(for: operation, - sendQueryDocument: true, - autoPersistQuery: false) - - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?operationName=TestOpName&query=query%20MockQuery($param:%20String)%20%7B%0A%20%20testField(param:%20$param)%20%7B%0A%20%20%20%20__typename%0A%20%20%20%20name%0A%20%20%7D%0A%7D&variables=%7B%22param%22:null%7D" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__urlHasExistingParameters_encodesURLIncludingExistingParameters_atStartOfQueryParameters() throws { - let extensions: JSONEncodableDictionary = [ - "testParam": "Test&Test" - ] - - let body: JSONEncodableDictionary = [ - "query": MockOperation.definition?.queryDocument, - "extensions": extensions - ] - - var components = URLComponents(string: Self.url.absoluteString)! - components.queryItems = [URLQueryItem(name: "zalgo", value: "bar")] - let transformer = GraphQLGETTransformer(body: body, url: components.url!) - - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql?zalgo=bar&extensions=%7B%22testParam%22:%22Test%26Test%22%7D&query=Mock%20Operation%20Definition" - - expect(url?.absoluteString).to(equal(expected)) - } - - func test__createGetURL__withEmptyQueryParameter_returnsURL() throws { - let body: JSONEncodableDictionary = [:] - let transformer = GraphQLGETTransformer(body: body, url: Self.url) - let url = transformer.createGetURL() - - let expected = "http://localhost:8080/graphql" - - expect(url?.absoluteString).to(equal(expected)) - } -} diff --git a/Tests/ApolloTests/GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift b/Tests/ApolloTests/GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift deleted file mode 100644 index 4726eea970..0000000000 --- a/Tests/ApolloTests/GraphQLExecutor_ResultNormalizer_FromResponse_Tests.swift +++ /dev/null @@ -1,537 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class GraphQLExecutor_ResultNormalizer_FromResponse_Tests: XCTestCase { - - // MARK: - Helpers - - private static let executor: GraphQLExecutor = { - let executor = GraphQLExecutor(executionSource: NetworkResponseExecutionSource()) - return executor - }() - - private func normalizeRecords( - _ selectionSet: S.Type, - with variables: GraphQLOperation.Variables? = nil, - from object: JSONObject - ) throws -> RecordSet { - return try GraphQLExecutor_ResultNormalizer_FromResponse_Tests.executor.execute( - selectionSet: selectionSet, - on: object, - firstReceivedAt: Date(), - withRootCacheReference: CacheReference.RootQuery, - variables: variables, - accumulator: ResultNormalizerFactory.networkResponseDataNormalizer() - ) - } - - // MARK: - Tests - - func test__execute__givenObjectWithNoCacheKey_normalizesRecordToPathFromQueryRoot() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - - let object: JSONObject = [ - "hero": ["__typename": "Droid", "name": "R2-D2"] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - // then - XCTAssertEqual(records["QUERY_ROOT"]?.record["hero"] as? CacheReference, - CacheReference("QUERY_ROOT.hero")) - - let hero = try XCTUnwrap(records["QUERY_ROOT.hero"]?.record) - XCTAssertEqual(hero["name"] as? String, "R2-D2") - } - - func test__execute__givenObjectWithNoCacheKey_forFieldWithStringArgument_normalizesRecordToPathFromQueryRootIncludingArgument() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - - let variables = ["episode": "JEDI"] - - let object: JSONObject = [ - "hero": ["__typename": "Droid", "name": "R2-D2"] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, with: variables, from: object) - - // then - XCTAssertEqual(records["QUERY_ROOT"]?.record["hero(episode:JEDI)"] as? CacheReference, - CacheReference("QUERY_ROOT.hero(episode:JEDI)")) - - let hero = try XCTUnwrap(records["QUERY_ROOT.hero(episode:JEDI)"]) - XCTAssertEqual(hero.record["name"] as? String, "R2-D2") - } - - func test__execute__givenObjectWithNoCacheKey_forFieldWithEnumArgument_normalizesRecordToPathFromQueryRootIncludingArgument() throws { - // given - enum MockEnum: String, EnumType { - case NEWHOPE - case EMPIRE - case JEDI - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self, arguments: ["episode": .variable("episode")]) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - - let variables = ["episode": MockEnum.EMPIRE] - - let object: JSONObject = [ - "hero": ["__typename": "Droid", "name": "R2-D2"] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, with: variables, from: object) - - // then - XCTAssertEqual(records["QUERY_ROOT"]?.record["hero(episode:EMPIRE)"] as? CacheReference, - CacheReference("QUERY_ROOT.hero(episode:EMPIRE)")) - - let hero = try XCTUnwrap(records["QUERY_ROOT.hero(episode:EMPIRE)"]) - XCTAssertEqual(hero.record["name"] as? String, "R2-D2") - } - - func test__execute__givenObjectWithNoCacheKey_andNestedArrayOfObjectsWithNoCacheKey_normalizesRecordsToPathsFromQueryRoot() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self), - .field("friends", [Friend].self) - ]} - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - } - - let object: JSONObject = [ - "hero": [ - "__typename": "Droid", - "name": "R2-D2", - "friends": [ - ["__typename": "Human", "name": "Luke Skywalker"], - ["__typename": "Human", "name": "Han Solo"], - ["__typename": "Human", "name": "Leia Organa"] - ] - ] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(records["QUERY_ROOT"]?.record["hero"] as? CacheReference, - CacheReference("QUERY_ROOT.hero")) - - let hero = try XCTUnwrap(records["QUERY_ROOT.hero"]) - XCTAssertEqual(hero.record["name"] as? String, "R2-D2") - XCTAssertEqual(hero.record["friends"] as? [CacheReference], - [CacheReference("QUERY_ROOT.hero.friends.0"), - CacheReference("QUERY_ROOT.hero.friends.1"), - CacheReference("QUERY_ROOT.hero.friends.2")]) - - let luke = try XCTUnwrap(records["QUERY_ROOT.hero.friends.0"]) - XCTAssertEqual(luke.record["name"] as? String, "Luke Skywalker") - } - - func test__execute__givenObjectWithCacheKey_andNestedArrayOfObjectsWithCacheKey_normalizesRecordsToIndividualReferences() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("id", String.self), - .field("name", String.self), - .field("friends", [Friend].self) - ]} - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("id", String.self), - .field("name", String.self) - ]} - } - } - } - - MockSchemaMetadata.stub_cacheKeyInfoForType_Object = IDCacheKeyProvider.resolver - - let object: JSONObject = [ - "hero": [ - "__typename": "Droid", - "id": "2001", - "name": "R2-D2", - "friends": [ - ["__typename": "Human", "id": "1000", "name": "Luke Skywalker"], - ["__typename": "Human", "id": "1002", "name": "Han Solo"], - ["__typename": "Human", "id": "1003", "name": "Leia Organa"] - ] - ] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(records["QUERY_ROOT"]?.record["hero"] as? CacheReference, - CacheReference("Droid:2001")) - - let hero = try XCTUnwrap(records["Droid:2001"]) - XCTAssertEqual(hero.record["name"] as? String, "R2-D2") - XCTAssertEqual(hero.record["friends"] as? [CacheReference], - [CacheReference("Human:1000"), - CacheReference("Human:1002"), - CacheReference("Human:1003")]) - - let luke = try XCTUnwrap(records["Human:1000"]) - XCTAssertEqual(luke.record["name"] as? String, "Luke Skywalker") - - let han = try XCTUnwrap(records["Human:1002"]) - XCTAssertEqual(han.record["name"] as? String, "Han Solo") - - let leia = try XCTUnwrap(records["Human:1003"]) - XCTAssertEqual(leia.record["name"] as? String, "Leia Organa") - } - - func test__execute__givenFieldForObjectWithNoCacheKey_andAliasedFieldForSameFieldName_normalizesRecordsForBothFieldsIntoOneRecord() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self), - .field("hero", alias: "r2", R2.self) - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", String.self) - ]} - } - - class R2: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("catchphrase", String.self) - ]} - } - } - - let object: JSONObject = [ - "hero": ["__typename": "Droid", "name": "R2-D2"], - "r2": ["__typename": "Droid", "catchphrase": "Beeeeeeeeeeeeeep"] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - let hero = try XCTUnwrap(records["QUERY_ROOT.hero"]) - XCTAssertEqual(hero.record["__typename"] as? String, "Droid") - XCTAssertEqual(hero.record["name"] as? String, "R2-D2") - XCTAssertEqual(hero.record["catchphrase"] as? String, "Beeeeeeeeeeeeeep") - } - - func test__execute__givenDifferentAliasedFieldsOnTwoTypeCasesWithSameAlias_givenIsFirstType_hasRecordWithFieldValueUsingNonaliasedFieldName() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - case "Droid": return Types.Droid - default: XCTFail(); return nil - } - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self), - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ]} - - class AsHuman: MockTypeCase { - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("name", alias: "property", String.self) - ]} - } - - class AsDroid: MockTypeCase { - override class var __parentType: ParentType { Types.Droid } - override class var __selections: [Selection] {[ - .field("primaryFunction", alias: "property", String.self) - ]} - } - } - } - - let object: JSONObject = [ - "hero": ["__typename": "Human", "property": "Han Solo"] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - let hero = try XCTUnwrap(records["QUERY_ROOT.hero"]) - XCTAssertEqual(hero.record["name"] as? String, "Han Solo") - XCTAssertNil(hero.record["property"]) - XCTAssertNil(hero.record["primaryFunction"]) - } - - func test__execute__givenDifferentAliasedFieldsOnTwoTypeCasesWithSameAlias_givenIsSecondType_hasRecordWithFieldValueUsingNonaliasedFieldName() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - case "Droid": return Types.Droid - default: XCTFail(); return nil - } - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self), - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ]} - - class AsHuman: MockTypeCase { - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("name", alias: "property", String.self) - ]} - } - - class AsDroid: MockTypeCase { - override class var __parentType: ParentType { Types.Droid } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("primaryFunction", alias: "property", String.self) - ]} - } - } - } - - let object: JSONObject = [ - "hero": ["__typename": "Droid", "property": "Astromech"] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - let hero = try XCTUnwrap(records["QUERY_ROOT.hero"]) - XCTAssertEqual(hero.record["primaryFunction"] as? String, "Astromech") - XCTAssertNil(hero.record["property"]) - XCTAssertNil(hero.record["name"]) - } - - func test__execute__givenSameFieldWithDifferentArgumentValueOnSameNestedFieldOnTwoTypeCases_givenIsFirstType_hasRecordForFieldNameWithFirstTypesArgument() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - case "Droid": return Types.Droid - default: XCTFail(); return nil - } - } - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self), - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ]} - - class AsHuman: MockTypeCase { - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("friend", Friend.self), - ]} - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("height", Double.self, arguments: ["unit": "FOOT"]) - ]} - } - } - - class AsDroid: MockTypeCase { - override class var __parentType: ParentType { Types.Droid } - override class var __selections: [Selection] {[ - .field("friend", Friend.self), - ]} - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("height", Double.self, arguments: ["unit": "METER"]) - ]} - } - } - } - } - - let object: JSONObject = [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Human", - "friend": ["__typename": "Human", "name": "Han Solo", "height": 5.905512], - ] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - let han = try XCTUnwrap(records["QUERY_ROOT.hero.friend"]) - XCTAssertEqual(han.record["height(unit:FOOT)"] as? Double, 5.905512) - XCTAssertNil(han.record["height(unit:METER)"]) - XCTAssertNil(han.record["height"]) - } - - func test__execute__givenSameFieldWithDifferentArgumentValueOnSameNestedFieldOnTwoTypeCases_givenIsSecondType_hasRecordForFieldNameWithFirstTypesArgument() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let Droid = Object(typename: "Droid", implementedInterfaces: []) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - case "Droid": return Types.Droid - default: XCTFail(); return nil - } - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("hero", Hero.self), - ]} - - class Hero: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .inlineFragment(AsHuman.self), - .inlineFragment(AsDroid.self), - ]} - - class AsHuman: MockTypeCase { - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("friend", Friend.self), - ]} - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("height", Double.self, arguments: ["unit": "FOOT"]) - ]} - } - } - - class AsDroid: MockTypeCase { - override class var __parentType: ParentType { Types.Droid } - override class var __selections: [Selection] {[ - .field("friend", Friend.self), - ]} - - class Friend: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("height", Double.self, arguments: ["unit": "METER"]) - ]} - } - } - } - } - - let object: JSONObject = [ - "hero": [ - "name": "Luke Skywalker", - "__typename": "Droid", - "friend": ["__typename": "Human", "name": "Luke Skywalker", "height": 1.72], - ] - ] - - // when - let records = try normalizeRecords(GivenSelectionSet.self, from: object) - - // then - let luke = try XCTUnwrap(records["QUERY_ROOT.hero.friend"]) - XCTAssertEqual(luke.record["height(unit:METER)"] as? Double, 1.72) - XCTAssertNil(luke.record["height(unit:FOOT)"]) - XCTAssertNil(luke.record["height"]) - } -} diff --git a/Tests/ApolloTests/GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift b/Tests/ApolloTests/GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift deleted file mode 100644 index 03d67efc44..0000000000 --- a/Tests/ApolloTests/GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.swift +++ /dev/null @@ -1,1845 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo -@testable import ApolloAPI -import ApolloInternalTestHelpers - -/// Tests reading fields from a JSON network response using a GraphQLExecutor and a SelectionSetMapper -class GraphQLExecutor_SelectionSetMapper_FromResponse_Tests: XCTestCase { - - // MARK: - Helpers - - private static let executor: GraphQLExecutor = { - let executor = GraphQLExecutor(executionSource: NetworkResponseExecutionSource()) - return executor - }() - - private func readValues( - _ selectionSet: T.Type, - from object: JSONObject, - variables: GraphQLOperation.Variables? = nil - ) throws -> T { - return try GraphQLExecutor_SelectionSetMapper_FromResponse_Tests.executor.execute( - selectionSet: selectionSet, - on: object, - firstReceivedAt: Date(), - variables: variables, - accumulator: GraphQLSelectionSetMapper() - ) - } - - // MARK: - Tests - - // MARK: Nonnull Scalar - - func test__nonnull_scalar__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String.self)] } - } - let object: JSONObject = ["name": "Luke Skywalker"] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.name, "Luke Skywalker") - } - - func test__nonnull_scalar__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String.self)] } - } - let object: JSONObject = [:] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_scalar__givenDataHasNullValueForField_throwsNullValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String.self)] } - } - let object: JSONObject = ["name": NSNull()] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.nullValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_scalar__givenDataWithTypeConvertibleToFieldType_getsConvertedValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String.self)] } - } - let object: JSONObject = ["name": 10] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.name, "10") - } - - func test__nonnull_scalar__givenDataWithTypeNotConvertibleToFieldType_throwsCouldNotConvertError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String.self)] } - } - let object: JSONObject = ["name": false] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["name"]) - XCTAssertEqual(value as? Bool, false) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: Custom Scalar - - func test__nonnull_customScalar_asString__givenDataAsInt_getsValue() throws { - // given - typealias GivenCustomScalar = String - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("customScalar", GivenCustomScalar.self)] } - } - let object: JSONObject = ["customScalar": Int(12345678)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.customScalar, "12345678") - } - - func test__nonnull_customScalar_asString__givenDataAsInt64_getsValue() throws { - // given - typealias GivenCustomScalar = String - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("customScalar", GivenCustomScalar.self)] } - } - let object: JSONObject = ["customScalar": Int64(989561700)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.customScalar, "989561700") - } - - func test__nonnull_customScalar_asString__givenDataAsDouble_getsValue() throws { - // given - typealias GivenCustomScalar = String - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("customScalar", GivenCustomScalar.self)] } - } - let object: JSONObject = ["customScalar": Double(1234.5678)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.customScalar, "1234.5678") - } - - func test__nonnull_customScalar_asCustomStruct__givenDataAsInt64_getsValue() throws { - // given - struct GivenCustomScalar: CustomScalarType, Hashable { - let value: Int64 - init(value: Int64) { - self.value = value - } - init(_jsonValue value: JSONValue) throws { - self.value = value as! Int64 - } - var _jsonValue: JSONValue { value } - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("customScalar", GivenCustomScalar.self)] } - } - let object: JSONObject = ["customScalar": Int64(989561700)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.customScalar, GivenCustomScalar(value: 989561700)) - } - - // MARK: Optional Scalar - - func test__optional_scalar__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String?.self)] } - } - let object: JSONObject = ["name": "Luke Skywalker"] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.name, "Luke Skywalker") - } - - func test__optional_scalar__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String?.self)] } - } - let object: JSONObject = [:] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__optional_scalar__givenDataHasNullValueForField_returnsNilValueForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String?.self)] } - } - let object: JSONObject = ["name": NSNull()] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertNil(data.name) - } - - func test__optional_scalar__givenDataWithTypeConvertibleToFieldType_getsConvertedValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String?.self)] } - } - let object: JSONObject = ["name": 10] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.name, "10") - } - - func test__optional_scalar__givenDataWithTypeNotConvertibleToFieldType_throwsCouldNotConvertError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("name", String?.self)] } - } - let object: JSONObject = ["name": false] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["name"]) - XCTAssertEqual(value as? Bool, false) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: Nonnull Enum Value - - private enum MockEnum: String, EnumType { - case SMALL - case MEDIUM - case LARGE - } - - func test__nonnull_enum__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("size", GraphQLEnum.self)] } - } - let object: JSONObject = ["size": "SMALL"] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.size, GraphQLEnum(MockEnum.SMALL)) - } - - func test__nonnull_enum__givenDataIsNotAnEnumCase_getsValueAsUnknownCase() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("size", GraphQLEnum.self)] } - } - let object: JSONObject = ["size": "GIGANTIC"] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.size, GraphQLEnum.unknown("GIGANTIC")) - } - - func test__nonnull_enum__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("size", GraphQLEnum.self)] } - } - let object: JSONObject = [:] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["size"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_enum__givenDataHasNullValueForField_throwsNullValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("size", GraphQLEnum.self) - ]} - } - let object: JSONObject = ["size": NSNull()] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["size"]) - XCTAssertMatch(error.underlying, JSONDecodingError.nullValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_enum__givenDataWithType_Int_throwsCouldNotConvertError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("size", GraphQLEnum.self)] } - } - let object: JSONObject = ["size": 10] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["size"]) - XCTAssertEqual(value as? Int, 10) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_enum__givenDataWithType_Double_throwsCouldNotConvertError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("size", GraphQLEnum.self)] } - } - let object: JSONObject = ["size": 10.0] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["size"]) - XCTAssertEqual(value as? Double, 10.0) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: NonNull List Of NonNull Scalar - - func test__nonnull_list_nonnull_scalar__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String].self)] } - } - let object: JSONObject = ["favorites": ["Purple", "Potatoes", "iPhone"]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, ["Purple", "Potatoes", "iPhone"]) - } - - func test__nonnull_list_nonnull_scalar__givenEmptyDataArray_getsValueAsEmptyArray() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String].self)] } - } - let object: JSONObject = ["favorites": []] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, Array()) - } - - func test__nonnull_list_nonnull_scalar__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String].self)] } - } - let object: JSONObject = [:] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["favorites"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_list_nonnull_scalar__givenDataIsNullForField_throwsNullValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String].self)] } - } - let object: JSONObject = ["favorites": NSNull()] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["favorites"]) - XCTAssertMatch(error.underlying, JSONDecodingError.nullValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_list_nonnull_scalar__givenDataWithElementTypeConvertibleToFieldType_getsConvertedValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String].self)] } - } - let object: JSONObject = ["favorites": [10, 20, 30]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, ["10", "20", "30"]) - } - - func test__nonnull_list_nonnull_enum__givenDataWithStringsNotEnumValue_getsValueAsUnknownCase() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("favorites", [GraphQLEnum].self) - ] } - } - let object: JSONObject = ["favorites": ["10", "20", "30"]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, [ - GraphQLEnum.unknown("10"), - GraphQLEnum.unknown("20"), - GraphQLEnum.unknown("30")]) - } - - func test__nonnull_list_nonnull_scalar__givenDataWithElementTypeNotConvertibleToFieldType_throwsCouldNotConvertError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String].self)] } - } - let object: JSONObject = ["favorites": [true, false, true]] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, - case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["favorites", "0"]) - XCTAssertEqual(value as? Bool, true) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: Optional List Of NonNull Scalar - - func test__optional_list_nonnull_scalar__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String]?.self)] } - } - let object: JSONObject = ["favorites": ["Purple", "Potatoes", "iPhone"]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, ["Purple", "Potatoes", "iPhone"]) - } - - func test__optional_list_nonnull_scalar__givenEmptyDataArray_getsValueAsEmptyArray() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String]?.self)] } - } - let object: JSONObject = ["favorites": []] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, Array()) - } - - func test__optional_list_nonnull_scalar__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String]?.self)] } - } - let object: JSONObject = [:] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["favorites"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__optional_list_nonnull_scalar__givenDataIsNullForField_valueIsNil() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String]?.self)] } - } - let object: JSONObject = ["favorites": NSNull()] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertNil(data.favorites) - } - - func test__optional_list_nonnull_scalar__givenDataWithElementTypeConvertibleToFieldType_getsConvertedValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String]?.self)] } - } - let object: JSONObject = ["favorites": [10, 20, 30]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, ["10", "20", "30"]) - } - - func test__optional_list_nonnull_scalar__givenDataWithElementTypeNotConvertibleToFieldType_throwsCouldNotConvertError() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String]?.self)] } - } - let object: JSONObject = ["favorites": [true, false, false]] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, - case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["favorites", "0"]) - XCTAssertEqual(value as? Bool, true) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: NonNull List Of Optional Scalar - - func test__nonnull_list_optional_scalar__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String?].self)] } - } - let object: JSONObject = ["favorites": ["Purple", "Potatoes", "iPhone"]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, ["Purple", "Potatoes", "iPhone"]) - } - - func test__nonnull_list_optional_scalar__givenEmptyDataArray_getsValueAsEmptyArray() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String?].self)] } - } - let object: JSONObject = ["favorites": []] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, Array()) - } - - func test__nonnull_list_optional_scalar__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String?].self)] } - } - let object: JSONObject = [:] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["favorites"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_list_nonnull_optional__givenDataIsNullForField_throwsNullValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String?].self)] } - } - let object: JSONObject = ["favorites": NSNull()] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["favorites"]) - XCTAssertMatch(error.underlying, JSONDecodingError.nullValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_list_nonnull_optional__givenDataIsArrayWithNullElement_valueIsArrayWithValuesIncludingNilElement() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String?].self)] } - } - let object: JSONObject = ["favorites": ["Red", NSNull(), "Bird"]] - - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites! as [String?], ["Red", nil, "Bird"]) - } - - // MARK: Optional List Of Optional Scalar - - func test__optional_list_optional_scalar__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [.field("favorites", [String?]?.self)] } - } - let object: JSONObject = ["favorites": ["Purple", "Potatoes", "iPhone"]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, ["Purple", "Potatoes", "iPhone"]) - } - - func test__optional_list_optional_enum__givenDataWithUnknownEnumCaseElement_getsValueWithUnknownEnumCaseElement() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("favorites", [GraphQLEnum?]?.self) - ] } - } - let object: JSONObject = ["favorites": ["Purple"]] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.favorites, [GraphQLEnum.unknown("Purple")]) - } - - func test__optional_list_optional_enum__givenDataWithNonConvertibleTypeElement_getsValueWithUnknownEnumCaseElement() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] { [ - .field("favorites", [GraphQLEnum?]?.self) - ] } - } - let object: JSONObject = ["favorites": [10]] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if let error = error as? GraphQLExecutionError, - case JSONDecodingError.couldNotConvert(let value, let expectedType) = error.underlying { - XCTAssertEqual(error.path, ["favorites", "0"]) - XCTAssertEqual(value as? Int, 10) - XCTAssertTrue(expectedType == String.self) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: Nonnull Nested Selection Set - - func test__nonnull_nestedObject__givenData_getsValue() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("child", Child.self) - ]} - - class Child: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - let object: JSONObject = [ - "child": - [ - "__typename": "Child", - "name": "Luke Skywalker" - ] - ] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.child?.name, "Luke Skywalker") - } - - func test__nonnull_nestedObject__givenDataMissingKeyForField_throwsMissingValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("child", Child.self) - ]} - - class Child: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - let object: JSONObject = ["child": ["__typename": "Child"]] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["child", "name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.missingValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - func test__nonnull_nestedObject__givenDataHasNullValueForField_throwsNullValueError() { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("child", Child.self) - ]} - - class Child: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - let object: JSONObject = [ - "child": [ - "__typename": "Child", - "name": NSNull() - ] - ] - - // when - XCTAssertThrowsError(try readValues(GivenSelectionSet.self, from: object)) { (error) in - // then - if case let error as GraphQLExecutionError = error { - XCTAssertEqual(error.path, ["child", "name"]) - XCTAssertMatch(error.underlying, JSONDecodingError.nullValue) - } else { - XCTFail("Unexpected error: \(error)") - } - } - } - - // MARK: - Inline Fragments - - func test__inlineFragment__withoutTypenameMatchingCondition_selectsTypeCaseField() throws { - // given - struct Types { - static let Human = Object(typename: "Human", implementedInterfaces: []) - static let MockChildObject = Object(typename: "MockChildObject", implementedInterfaces: []) - } - - class GivenSelectionSet: MockSelectionSet { - typealias Schema = MockSchemaMetadata - override class var __parentType: ParentType { Object.mock } - override class var __selections: [Selection] {[ - .field("child", Child.self), - ]} - - class Child: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.MockChildObject } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .inlineFragment(AsHuman.self) - ]} - - class AsHuman: MockTypeCase { - override class var __parentType: ParentType { Types.Human } - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - } - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { typeName in - switch typeName { - case "Human": - return Types.Human - default: - fail() - return nil - } - } - - let object: JSONObject = [ - "child": [ - "__typename": "Human", - "name": "Han Solo" - ] - ] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.child?.__typename, "Human") - XCTAssertEqual(data.child?.name, "Han Solo") - } - - // MARK: - Fragments - - func test__fragment__asObjectType_matchingParentType_selectsFragmentFields() throws { - // given - struct Types { - static let MockChildObject = Object(typename: "MockChildObject", implementedInterfaces: []) - } - - class GivenFragment: MockFragment { - override class var __parentType: ParentType { Types.MockChildObject } - override class var __selections: [Selection] {[ - .field("child", Child.self) - ]} - - class Child: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("name", String.self) - ]} - } - } - - class GivenSelectionSet: AbstractMockSelectionSet { - override class var __parentType: ParentType { Types.MockChildObject } - override class var __selections: [Selection] {[ - .fragment(GivenFragment.self) - ]} - - struct Fragments: FragmentContainer { - let __data: DataDict - var childFragment: GivenFragment { _toFragment() } - - init(_dataDict: DataDict) { __data = _dataDict } - } - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in return Types.MockChildObject } - - let object: JSONObject = [ - "__typename": "MockChildObject", - "child": [ - "__typename": "Human", - "name": "Han Solo" - ] - ] - - // when - let data = try readValues(GivenSelectionSet.self, from: object) - - // then - XCTAssertEqual(data.child?.name, "Han Solo") - XCTAssertEqual(data.fragments.childFragment.child?.name, "Han Solo") - } - - // MARK: - Boolean Conditions - - // MARK: Include - - func test__booleanCondition_include_singleField__givenVariableIsTrue_getsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_include_singleField__givenVariableIsFalse_doesNotGetsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - } - - func test__booleanCondition_include_singleField__givenGraphQLNullableVariableIsTrue_getsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": GraphQLNullable(true)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_include_singleField__givenGraphQLNullableVariableIsFalse_doesNotGetsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": GraphQLNullable(false)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - } - - func test__booleanCondition_multipleIncludes_singleField__givenAllVariablesAreTrue_getsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "one" || "two", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["one": true, "two": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_include_singleField__givenVariableIsFalse_givenOtherSelection_doesNotGetsValueForConditionalField_doesGetOtherSelection() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("id", String.self), - .include(if: "variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - expect(data.id).to(equal("1234")) - } - - func test__booleanCondition_include_multipleFields__givenVariableIsTrue_getsValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "variable", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - expect(data.id).to(equal("1234")) - } - - func test__booleanCondition_include_multipleFields__givenVariableIsFalse_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "variable", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - expect(data.id).to(beNil()) - } - - func test__booleanCondition_include_fragment__givenVariableIsTrue_getsValuesForFragmentFields() throws { - // given - class GivenFragment: MockFragment { - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("id", String.self), - .include(if: "variable", .fragment(GivenFragment.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_include_fragment__givenVariableIsFalse_doesNotGetValuesForFragmentFields() throws { - // given - class GivenFragment: MockFragment { - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("id", String.self), - .include(if: "variable", .fragment(GivenFragment.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(beNil()) - } - - func test__booleanCondition_include_typeCase__givenVariableIsTrue_typeCaseMatchesParentType_getsValuesForTypeCaseFields() throws { - // given - struct Types { - static let Person = Object(typename: "Person", implementedInterfaces: []) - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .include(if: "variable", .inlineFragment(AsPerson.self)) - ]} - - class AsPerson: MockTypeCase { - override class var __parentType: ParentType { Types.Person } - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - } - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Types.Person } - let object: JSONObject = ["__typename": "Person", - "name": "Luke Skywalker", - "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_include_typeCase__givenVariableIsFalse_typeCaseMatchesParentType_doesNotGetValuesForTypeCaseFields() throws { - // given - struct Types { - static let Person = Object(typename: "Person", implementedInterfaces: []) - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .include(if: "variable", .inlineFragment(AsPerson.self)) - ]} - - class AsPerson: MockTypeCase { - override class var __parentType: ParentType { Types.Person } - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - } - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Types.Person } - let object: JSONObject = ["__typename": "Person", - "name": "Luke Skywalker", - "id": "1234"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(beNil()) - } - - func test__booleanCondition_include_typeCase__givenVariableIsTrue_typeCaseDoesNotMatchParentType_doesNotGetValuesForTypeCaseFields() throws { - // given - struct Types { - static let Person = Object(typename: "Person", implementedInterfaces: []) - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .include(if: "variable", .inlineFragment(AsPerson.self)) - ]} - - class AsPerson: MockTypeCase { - override class var __parentType: ParentType { Types.Person } - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - } - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Object.mock } - let object: JSONObject = ["__typename": "Person", - "name": "Luke Skywalker", - "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(beNil()) - } - - func test__booleanCondition_include_singleFieldOnNestedTypeCase__givenVariableIsTrue_typeCaseMatchesParentType_getsValuesForTypeCaseFields() throws { - // given - struct Types { - static let Person = Object(typename: "Person", implementedInterfaces: []) - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .inlineFragment(AsPerson.self) - ]} - - class AsPerson: MockTypeCase { - override class var __parentType: ParentType { Types.Person } - override class var __selections: [Selection] {[ - .include(if: "variable", .field("name", String.self)), - ]} - } - } - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Types.Person } - let object: JSONObject = ["__typename": "Person", - "name": "Luke Skywalker", - "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_include_singleFieldOnNestedTypeCase__givenVariableIsFalse_typeCaseMatchesParentType_getsValuesForTypeCaseFields() throws { - // given - struct Types { - static let Person = Object(typename: "Person", implementedInterfaces: []) - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .inlineFragment(AsPerson.self) - ]} - - class AsPerson: MockTypeCase { - override class var __parentType: ParentType { Types.Person } - override class var __selections: [Selection] {[ - .include(if: "variable", .field("name", String.self)), - ]} - } - } - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Types.Person } - let object: JSONObject = ["__typename": "Person", - "name": "Luke Skywalker", - "id": "1234"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(beNil()) - } - - func test__booleanCondition_include_typeCaseOnNamedFragment__givenVariableIsTrue_typeCaseMatchesParentType_getsValuesForTypeCaseFields() throws { - // given - struct Types { - static let Person = Object(typename: "Person", implementedInterfaces: []) - } - - class GivenFragment: MockFragment { - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("id", String.self), - .include(if: "variable", .inlineFragment(AsPerson.self)) - ]} - - class AsPerson: MockTypeCase { - override class var __parentType: ParentType { Types.Person } - override class var __selections: [Selection] {[ - .fragment(GivenFragment.self), - ]} - } - } - MockSchemaMetadata.stub_objectTypeForTypeName = { _ in Types.Person } - let object: JSONObject = ["__typename": "Person", - "name": "Luke Skywalker", - "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.id).to(equal("1234")) - expect(data.name).to(equal("Luke Skywalker")) - } - - // MARK: Skip - - func test__booleanCondition_skip_singleField__givenVariableIsFalse_getsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_skip_singleField__givenVariableIsTrue_doesNotGetsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - } - - func test__booleanCondition_skip_singleField__givenGraphQLNullableVariableIsFalse_getsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": GraphQLNullable(false)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_skip_singleField__givenGraphQLNullableVariableIsTrue_doesNotGetsValueForConditionalField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": GraphQLNullable(true)] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - } - - func test__booleanCondition_skip_multipleFields__givenVariableIsFalse_getsValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - expect(data.id).to(equal("1234")) - } - - func test__booleanCondition_skip_multipleFields__givenVariableIsTrue_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - expect(data.id).to(beNil()) - } - - func test__booleanCondition_skip_singleField__givenVariableIsTrue_givenFieldIdSelectedByAnotherSelection_getsValueForField() throws { - // given - class GivenFragment: MockFragment { - override class var __selections: [Selection] {[ - .field("name", String.self), - ]} - } - - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"variable", .field("name", String.self)), - .fragment(GivenFragment.self) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker"] - let variables = ["variable": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - // MARK: Skip & Include - /// Compliance with spec: https://spec.graphql.org/draft/#note-f3059 - - func test__booleanCondition_bothSkipAndInclude_multipleFields__givenSkipIsTrue_includeIsTrue_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip" && "include", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": true, - "include": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - expect(data.id).to(beNil()) - } - - func test__booleanCondition_bothSkipAndInclude_multipleFields__givenSkipIsTrue_includeIsFalse_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip" && "include", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": true, - "include": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - expect(data.id).to(beNil()) - } - - func test__booleanCondition_bothSkipAndInclude_multipleFields__givenSkipIsFalse_includeIsFalse_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip" && "include", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": false, - "include": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - expect(data.id).to(beNil()) - } - - func test__booleanCondition_bothSkipAndInclude_multipleFields__givenSkipIsFalse_includeIsTrue_getValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip" && "include", [ - .field("name", String.self), - .field("id", String.self), - ]) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": false, - "include": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - expect(data.id).to(equal("1234")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelection__givenSkipIsTrue_includeIsTrue_getsValuesForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip", .field("name", String.self)), - .include(if: "include", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": true, - "include": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelectionMergedAsOrCondition__givenSkipIsTrue_includeIsTrue_getsValuesForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "include" || !"skip", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": true, - "include": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelection__givenSkipIsFalse_includeIsFalse_getsValuesForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip", .field("name", String.self)), - .include(if: "include", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": false, - "include": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelectionMergedAsOrCondition__givenSkipIsFalse_includeIsFalse_getsValuesForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "include" || !"skip", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": false, - "include": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelection__givenSkipIsFalse_includeIsTrue_getsValuesForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip", .field("name", String.self)), - .include(if: "include", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": false, - "include": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelectionMergedAsOrCondition__givenSkipIsFalse_includeIsTrue_getsValuesForField() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "include" || !"skip", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": false, - "include": true] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(equal("Luke Skywalker")) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelection__givenSkipIsTrue_includeIsFalse_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: !"skip", .field("name", String.self)), - .include(if: "include", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": true, - "include": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - } - - func test__booleanCondition_bothSkipAndInclude_onSeperateFieldsForSameSelectionMergedAsOrCondition__givenSkipIsTrue_includeIsFalse_doesNotGetValuesForConditionalFields() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: "include" || !"skip", .field("name", String.self)) - ]} - } - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - let variables = ["skip": true, - "include": false] - - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: variables) - - // then - expect(data.name).to(beNil()) - } - - func test__booleanCondition_bothSkipAndInclude_mergedAsComplexLogicalCondition_correctlyEvaluatesConditionalSelections() throws { - // given - class GivenSelectionSet: MockSelectionSet { - override class var __selections: [Selection] {[ - .include(if: ("a" && !"b" && "c") || "d" || !"e", .field("name", String?.self)) - ]} - - var name: String? { __data["name"] } - } - - let tests: [(variables: [String: Bool], expectedResult: Bool)] = [ - (["a": true, "b": false, "c": true, "d": true, "e": true], true), // a && b && c -> true - (["a": false, "b": false, "c": true, "d": false, "e": true], false), // a is false - (["a": true, "b": true, "c": true, "d": false, "e": true], false), // b is true - (["a": true, "b": false, "c": false, "d": false, "e": true], false), // c is false - (["a": false, "b": false, "c": false, "d": true, "e": true], true), // d is true - (["a": false, "b": false, "c": false, "d": false, "e": false], true), // e is false - (["a": false, "b": false, "c": false, "d": true, "e": true], true), // d is true - (["a": false, "b": false, "c": false, "d": false, "e": true], false), // e is true - ] - - let object: JSONObject = ["name": "Luke Skywalker", "id": "1234"] - - for test in tests { - // when - let data = try readValues(GivenSelectionSet.self, from: object, variables: test.variables) - - // then - if test.expectedResult { - expect(data.name).to(equal("Luke Skywalker")) - } else { - expect(data.name).to(beNil()) - } - } - } - - // MARK: Fulfilled Fragment Tests - - func test__nestedEntity_andTypeCaseWithAdditionalMergedNestedEntityFields_givenChildEntityCanConvertToTypeCase_fulfilledFragmentsContainsTypeCase() throws { - struct Types { - static let Character = Interface(name: "Character") - static let Hero = Interface(name: "Hero") - static let Human = Object(typename: "Human", implementedInterfaces: [Character.self, Hero.self]) - } - - MockSchemaMetadata.stub_objectTypeForTypeName = { - switch $0 { - case "Human": return Types.Human - default: XCTFail(); return nil - } - } - - class Character: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Character } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("friend", Friend.self), - .inlineFragment(AsHero.self) - ]} - - var friend: Friend { __data["friend"] } - - class Friend: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Character } - override class var __selections: [Selection] {[ - .field("__typename", String.self), - ]} - } - - class AsHero: ConcreteMockTypeCase { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Hero } - override class var __selections: [Selection] {[ - .field("friend", Friend.self), - ]} - - var friend: Friend { __data["friend"] } - - class Friend: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __parentType: ParentType { Types.Character } - override class var __selections: [Selection] {[ - .field("heroName", String.self), - ]} - - var heroName: String? { __data["heroName"] } - } - } - - } - - let jsonObject: JSONObject = [ - "__typename": "Human", "friend": [ - "__typename": "Human", - "name": "Han", - "heroName": "Han Solo" - ] - ] - - let data = try Character(data: jsonObject) - expect(data.friend.__data.fragmentIsFulfilled(Character.Friend.self)).to(beTrue()) - expect(data.friend.__data.fragmentIsFulfilled(Character.AsHero.Friend.self)).to(beTrue()) - } -} diff --git a/Tests/ApolloTests/GraphQLFileTests.swift b/Tests/ApolloTests/GraphQLFileTests.swift deleted file mode 100644 index ba89c15fc7..0000000000 --- a/Tests/ApolloTests/GraphQLFileTests.swift +++ /dev/null @@ -1,77 +0,0 @@ -import XCTest - -@testable import Apollo -import ApolloInternalTestHelpers - -class GraphQLFileTests: XCTestCase { - - func testCreatingFileWithKnownBadURLFails() { - let url = URL(fileURLWithPath: "/known/bad/path") - XCTAssertThrowsError(try GraphQLFile(fieldName: "test", - originalName: "test", - fileURL: url)) { error in - switch error { - case GraphQLFile.GraphQLFileError.couldNotGetFileSize(let fileURL): - XCTAssertEqual(fileURL, url) - default: - XCTFail("Unexpected error creating file: \(error)") - } - } - } - - func testCreatingFileWithKnownGoodURLSucceedsAndCreatesAndCanRecreateInputStream() throws { - let knownFileURL = TestFileHelper.fileURLForFile(named: "a", extension: "txt") - - let file = try GraphQLFile(fieldName: "test", - originalName: "test", - fileURL: knownFileURL) - - let inputStream = try file.generateInputStream() - - inputStream.open() - XCTAssertTrue(inputStream.hasBytesAvailable) - inputStream.close() - - let inputStream2 = try file.generateInputStream() - - inputStream2.open() - XCTAssertTrue(inputStream2.hasBytesAvailable) - inputStream2.close() - } - - func testCreatingFileWithEmptyDataSucceedsAndCreatesInputStream() throws { - let data = Data() - XCTAssertTrue(data.isEmpty) - - let file = GraphQLFile(fieldName: "test", - originalName: "test", - data: data) - - let inputStream = try file.generateInputStream() - - // Shouldn't have any bytes available if data is empty - inputStream.open() - XCTAssertFalse(inputStream.hasBytesAvailable) - inputStream.close() - } - - func testCreatingFileWithNonEmptyDataSucceedsAndCreatesAndCanRecreateInputStream() throws { - let data = try XCTUnwrap("A test string".data(using: .utf8)) - XCTAssertFalse(data.isEmpty) - - let file = GraphQLFile(fieldName: "test", - originalName: "test", - data: data) - - let inputStream = try file.generateInputStream() - inputStream.open() - XCTAssertTrue(inputStream.hasBytesAvailable) - inputStream.close() - - let inputStream2 = try file.generateInputStream() - - inputStream2.open() - XCTAssertTrue(inputStream2.hasBytesAvailable) - inputStream2.close() - } -} diff --git a/Tests/ApolloTests/GraphQLMapEncodingTests.swift b/Tests/ApolloTests/GraphQLMapEncodingTests.swift deleted file mode 100644 index 19cf146f62..0000000000 --- a/Tests/ApolloTests/GraphQLMapEncodingTests.swift +++ /dev/null @@ -1,98 +0,0 @@ -import XCTest -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers -import StarWarsAPI - -#warning("TODO: Do we refactor these for [String: InputValue] or delete them?") -class GraphQLMapEncodingTests: XCTestCase { -// private struct MockGraphQLMapConvertible: GraphQLMapConvertible { -// let graphQLMap: GraphQLMap -// } - -// private func serializeAndDeserialize(_ map: GraphQLMap) -> NSDictionary { -// let input = MockGraphQLMapConvertible(graphQLMap: map) -// let data = try! JSONSerializationFormat.serialize(value: input.jsonValue as! [String: JSONEncodable?]) -// return try! JSONSerialization.jsonObject(with: data, options: []) as! NSDictionary -// } -// -// func testEncodeValue() { -// let map: GraphQLMap = ["name": "Luke Skywalker"] -// XCTAssertEqual(serializeAndDeserialize(map), ["name": "Luke Skywalker"]) -// } -// -// func testEncodeOptionalValue() { -// let map: GraphQLMap = ["name": "Luke Skywalker" as Optional] -// XCTAssertEqual(serializeAndDeserialize(map), ["name": "Luke Skywalker"]) -// } -// -// func testEncodeOptionalValueWithValueMissing() { -// let map: GraphQLMap = ["name": Optional.none] -// XCTAssertEqual(serializeAndDeserialize(map), [:]) -// } -// -// func testEncodeOptionalValueWithExplicitNull() { -// let map: GraphQLMap = ["name": Optional.some(.none)] -// XCTAssertEqual(serializeAndDeserialize(map), ["name": NSNull()]) -// } -// -// func testEncodeEnumValue() { -// let map: GraphQLMap = ["favoriteEpisode": Episode.jedi] -// XCTAssertEqual(serializeAndDeserialize(map), ["favoriteEpisode": "JEDI"]) -// } -// -// func testEncodeMap() { -// let map: GraphQLMap = ["hero": ["name": "Luke Skywalker"]] -// XCTAssertEqual(serializeAndDeserialize(map), ["hero": ["name": "Luke Skywalker"]]) -// } -// -// func testEncodeOptionalMapWithValueMissing() { -// let map: GraphQLMap = ["hero": Optional.none] -// XCTAssertEqual(serializeAndDeserialize(map), [:]) -// } -// -// func testEncodeList() { -// let map: GraphQLMap = ["appearsIn": [.jedi, .empire] as [Episode]] -// XCTAssertEqual(serializeAndDeserialize(map), ["appearsIn": ["JEDI", "EMPIRE"]]) -// } -// -// func testEncodeOptionalList() { -// let map: GraphQLMap = ["appearsIn": [.jedi, .empire] as Optional<[Episode]?>] -// XCTAssertEqual(serializeAndDeserialize(map), ["appearsIn": ["JEDI", "EMPIRE"]]) -// } -// -// func testEncodeOptionalListWithValueMissing() { -// let map: GraphQLMap = ["appearsIn": Optional<[Episode]?>.none] -// XCTAssertEqual(serializeAndDeserialize(map), [:]) -// } -// -// func testEncodeInputObject() { -// let review = ReviewInput(stars: 5, commentary: "This is a great movie!") -// let map: GraphQLMap = ["review": review] -// XCTAssertEqual(serializeAndDeserialize(map), ["review": ["stars": 5, "commentary": "This is a great movie!"]]) -// } -// -// func testEncodeInputObjectWithOptionalPropertyMissing() { -// let review = ReviewInput(stars: 5) -// let map: GraphQLMap = ["review": review] -// XCTAssertEqual(serializeAndDeserialize(map), ["review": ["stars": 5]]) -// } -// -// func testEncodeInputObjectWithExplicitNilForOptionalProperty() { -// let review = ReviewInput(stars: 5, commentary: nil) -// let map: GraphQLMap = ["review": review] -// XCTAssertEqual(serializeAndDeserialize(map), ["review": ["stars": 5]]) -// } -// -// func testEncodeInputObjectWithExplicitSomeNilForOptionalProperty() { -// let review = ReviewInput(stars: 5, commentary: .some(nil)) -// let map: GraphQLMap = ["review": review] -// XCTAssertEqual(serializeAndDeserialize(map), ["review": ["stars": 5, "commentary": NSNull()]]) -// } -// -// func testEncodeInputObjectWithNestedInputObject() { -// let review = ReviewInput(stars: 5, favoriteColor: ColorInput(red: 0, green: 0, blue: 0)) -// let map: GraphQLMap = ["review": review] -// XCTAssertEqual(serializeAndDeserialize(map), ["review": ["stars": 5, "favorite_color": ["red": 0, "blue": 0, "green": 0]]]) -// } -} diff --git a/Tests/ApolloTests/HTTPURLResponseExtensionTests.swift b/Tests/ApolloTests/HTTPURLResponseExtensionTests.swift deleted file mode 100644 index 0f110f7687..0000000000 --- a/Tests/ApolloTests/HTTPURLResponseExtensionTests.swift +++ /dev/null @@ -1,135 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo - -final class HTTPURLResponseExtensionTests: XCTestCase { - - func createResponse(statusCode: Int, headers: [String: String]? = nil) -> HTTPURLResponse { - return HTTPURLResponse( - url: URL(string: "https://apollographql.com")!, - statusCode: statusCode, - httpVersion: nil, - headerFields: headers - )! - } - - // MARK: - Response code tests - - func test__isSuccessful__givenLessThanLowerBound_shouldReturnFalse() { - // given - let response = createResponse(statusCode: 199) - - // then - expect(response.isSuccessful).to(beFalse()) - } - - func test__isSuccessful__givenEqualToLowerBound_shouldReturnTrue() { - // given - let response = createResponse(statusCode: 200) - - // then - expect(response.isSuccessful).to(beTrue()) - } - - func test__isSuccessful__givenBetweenBounds_shouldReturnTrue() { - // given - let response = createResponse(statusCode: 202) - - // then - expect(response.isSuccessful).to(beTrue()) - } - - func test__isSuccessful__givenEqualToUpperBound_shouldReturnTrue() { - // given - let response = createResponse(statusCode: 299) - - // then - expect(response.isSuccessful).to(beTrue()) - } - - func test__isSuccessful__givenMoreThanUpperBound_shouldReturnFalse() { - // given - let response = createResponse(statusCode: 300) - - // then - expect(response.isSuccessful).to(beFalse()) - } - - // MARK: - Multipart tests - func test__isMultipart__givenMultipartMixedContentType_shouldReturnTrue() { - // given - let response = createResponse( - statusCode: 0, - headers: ["Content-Type": "multipart/mixed; boundary=apollo"] - ) - - // then - expect(response.isMultipart).to(beTrue()) - } - - func test__isMultipart__givenOtherContentType_shouldReturnFalse() { - // given - let response = createResponse(statusCode: 0, headers: ["Content-Type": "anything-else"]) - - // then - expect(response.isMultipart).to(beFalse()) - } - - func test__isMultipart__givenMissingContentType_shouldReturnFalse() { - // given - let response = createResponse(statusCode: 0) - - // then - expect(response.isMultipart).to(beFalse()) - } - - func test__multipartBoundary__givenMissingContentType_shouldReturnNil() { - // given - let response = createResponse(statusCode: 0) - - // then - expect(response.multipartBoundary).to(beNil()) - } - - func test__multipartBoundary__givenMissingBoundaryMarker_shouldReturnNil() { - // given - let response = createResponse(statusCode: 0, headers: ["Content-Type": "multipart/mixed"]) - - // then - expect(response.multipartBoundary).to(beNil()) - } - - func test__multipartBoundary__givenBoundaryMarker_shouldReturnBoundaryMarker() { - // given - let response = createResponse( - statusCode: 0, - headers: ["Content-Type": "multipart/mixed; boundary=apollo"] - ) - - // then - expect(response.multipartBoundary).to(equal("apollo")) - } - - func test__multipartBoundary__givenBoundaryMarkerWithPrefixWhitespace_shouldReturnBoundaryMarkerPreservingPrefixWhitespace() { - // given - let response = createResponse( - statusCode: 0, - headers: ["Content-Type": "multipart/mixed; boundary= apollo"] - ) - - // then - expect(response.multipartBoundary).to(equal(" apollo")) - } - - func test__multipartBoundary__givenBoundaryMarkerWithQuotations_shouldReturnBoundaryMarkerWithoutQuotations() { - // given - let response = createResponse( - statusCode: 0, - headers: ["Content-Type": "multipart/mixed; boundary=\"apollo\""] - ) - - // then - expect(response.multipartBoundary).to(equal("apollo")) - } - -} diff --git a/Tests/ApolloTests/Info.plist b/Tests/ApolloTests/Info.plist deleted file mode 100644 index 2cafdf8edb..0000000000 --- a/Tests/ApolloTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - $(CURRENT_PROJECT_VERSION) - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - - diff --git a/Tests/ApolloTests/Interceptors/JSONResponseParsingInterceptorTests.swift b/Tests/ApolloTests/Interceptors/JSONResponseParsingInterceptorTests.swift deleted file mode 100644 index 13cc112488..0000000000 --- a/Tests/ApolloTests/Interceptors/JSONResponseParsingInterceptorTests.swift +++ /dev/null @@ -1,75 +0,0 @@ -import Apollo -import ApolloAPI -import ApolloInternalTestHelpers -import XCTest - -class JSONResponseParsingInterceptorTests: XCTestCase { - func testJSONResponseParsingInterceptorFailsWhenNoResponse() { - let provider = MockInterceptorProvider([ - JSONResponseParsingInterceptor() - ]) - - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: TestURL.mockServer.url) - - let expectation = self.expectation(description: "Request sent") - - _ = network.send(operation: MockQuery.mock()) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success: - XCTFail("This should not have succeeded") - case .failure(let error): - switch error { - case JSONResponseParsingInterceptor.JSONResponseParsingError.noResponseToParse: - // This is what we want - break - default: - XCTFail("Unexpected error type: \(error.localizedDescription)") - } - } - } - - self.wait(for: [expectation], timeout: 1) - } - - func testJSONResponseParsingInterceptorFailsWithEmptyData() { - let client = MockURLSessionClient( - response: .mock(), - data: Data() - ) - - let provider = MockInterceptorProvider([ - NetworkFetchInterceptor(client: client), - JSONResponseParsingInterceptor(), - ]) - - let network = RequestChainNetworkTransport(interceptorProvider: provider, - endpointURL: TestURL.mockServer.url) - - let expectation = self.expectation(description: "Request sent") - - _ = network.send(operation: MockQuery.mock()) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success: - XCTFail("This should not have succeeded") - case .failure(let error): - switch error { - case JSONResponseParsingInterceptor.JSONResponseParsingError.couldNotParseToJSON(let data): - XCTAssertTrue(data.isEmpty) - default: - XCTFail("Unexpected error type: \(error.localizedDescription)") - } - } - } - - self.wait(for: [expectation], timeout: 1) - } -} diff --git a/Tests/ApolloTests/Interceptors/MaxRetryInterceptorTests.swift b/Tests/ApolloTests/Interceptors/MaxRetryInterceptorTests.swift deleted file mode 100644 index c21568baf2..0000000000 --- a/Tests/ApolloTests/Interceptors/MaxRetryInterceptorTests.swift +++ /dev/null @@ -1,103 +0,0 @@ -import XCTest -import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -class MaxRetryInterceptorTests: XCTestCase { - - func testMaxRetryInterceptorErrorsAfterMaximumRetries() { - class TestProvider: InterceptorProvider { - let testInterceptor = BlindRetryingTestInterceptor() - let retryCount = 15 - - func interceptors( - for operation: Operation - ) -> [any ApolloInterceptor] { - [ - MaxRetryInterceptor(maxRetriesAllowed: self.retryCount), - self.testInterceptor - ] - } - } - - let testProvider = TestProvider() - let network = RequestChainNetworkTransport(interceptorProvider: testProvider, - endpointURL: TestURL.mockServer.url) - - let expectation = self.expectation(description: "Request sent") - - let operation = MockQuery.mock() - _ = network.send(operation: operation) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success: - XCTFail("This should not have worked") - case .failure(let error): - switch error { - case MaxRetryInterceptor.RetryError.hitMaxRetryCount(let count, let operationName): - XCTAssertEqual(count, testProvider.retryCount) - // There should be one more hit than retries since it will be hit on the original call - XCTAssertEqual(testProvider.testInterceptor.hitCount, testProvider.retryCount + 1) - XCTAssertEqual(operationName, MockQuery.operationName) - default: - XCTFail("Unexpected error type: \(error)") - } - } - } - - self.wait(for: [expectation], timeout: 1) - } - - func testRetryInterceptorDoesNotErrorIfRetriedFewerThanMaxTimes() { - class TestProvider: InterceptorProvider { - let testInterceptor = RetryToCountThenSucceedInterceptor(timesToCallRetry: 2) - let retryCount = 3 - - let mockClient: MockURLSessionClient = { - let client = MockURLSessionClient() - client.jsonData = [:] - client.response = HTTPURLResponse(url: TestURL.mockServer.url, - statusCode: 200, - httpVersion: nil, - headerFields: nil) - return client - }() - - func interceptors( - for operation: Operation - ) -> [any ApolloInterceptor] { - [ - MaxRetryInterceptor(maxRetriesAllowed: self.retryCount), - self.testInterceptor, - NetworkFetchInterceptor(client: self.mockClient), - JSONResponseParsingInterceptor() - ] - } - } - - let testProvider = TestProvider() - let network = RequestChainNetworkTransport(interceptorProvider: testProvider, - endpointURL: TestURL.mockServer.url) - - let expectation = self.expectation(description: "Request sent") - - let operation = MockQuery.mock() - _ = network.send(operation: operation) { result in - defer { - expectation.fulfill() - } - - switch result { - case .success: - XCTAssertEqual(testProvider.testInterceptor.timesRetryHasBeenCalled, testProvider.testInterceptor.timesToCallRetry) - case .failure(let error): - XCTFail("Unexpected error: \(error.localizedDescription)") - } - } - - self.wait(for: [expectation], timeout: 1) - } -} diff --git a/Tests/ApolloTests/Interceptors/MultipartResponseParsingInterceptorTests.swift b/Tests/ApolloTests/Interceptors/MultipartResponseParsingInterceptorTests.swift deleted file mode 100644 index 173b6ecec2..0000000000 --- a/Tests/ApolloTests/Interceptors/MultipartResponseParsingInterceptorTests.swift +++ /dev/null @@ -1,449 +0,0 @@ -import XCTest -import Nimble -@testable import Apollo -import ApolloAPI -import ApolloInternalTestHelpers - -final class MultipartResponseParsingInterceptorTests: XCTestCase { - - let defaultTimeout = 0.5 - - // MARK: - Error tests - - func test__error__givenNoResponse_shouldReturnError() throws { - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectation = expectation(description: "Received callback") - - subject.intercept(request: .mock(operation: MockSubscription.mock())) { result in - defer { - expectation.fulfill() - } - - expect(result).to(beFailure { error in - expect(error).to( - matchError(MultipartResponseParsingInterceptor.MultipartResponseParsingError.noResponseToParse) - ) - }) - } - - wait(for: [expectation], timeout: defaultTimeout) - } - - func test__error__givenResponse_withMissingMultipartBoundaryHeader_shouldReturnError() throws { - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectation = expectation(description: "Received callback") - - subject.intercept( - request: .mock(operation: MockSubscription.mock()), - response: .mock(headerFields: ["Content-Type": "multipart/mixed"]) - ) { result in - defer { - expectation.fulfill() - } - - expect(result).to(beFailure { error in - expect(error).to( - matchError(MultipartResponseParsingInterceptor.MultipartResponseParsingError.cannotParseResponseData) - ) - }) - } - - wait(for: [expectation], timeout: defaultTimeout) - } - - func test__error__givenChunk_withIncorrectContentType_shouldReturnError() throws { - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectation = expectation(description: "Received callback") - - subject.intercept( - request: .mock(operation: MockSubscription.mock()), - response: .mock( - headerFields: ["Content-Type": "multipart/mixed;boundary=graphql"], - data: """ - --graphql - content-type: test/custom - - { - "data" : { - "key" : "value" - } - } - --graphql - """.crlfFormattedData() - ) - ) { result in - defer { - expectation.fulfill() - } - - expect(result).to(beFailure { error in - expect(error).to( - matchError(MultipartResponseParsingInterceptor.MultipartResponseParsingError.unsupportedContentType(type: "test/custom")) - ) - }) - } - - wait(for: [expectation], timeout: defaultTimeout) - } - - func test__error__givenChunk_withTransportError_shouldReturnError() throws { - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectation = expectation(description: "Received callback") - - subject.intercept( - request: .mock(operation: MockSubscription.mock()), - response: .mock( - headerFields: ["Content-Type": "multipart/mixed;boundary=graphql"], - data: """ - --graphql - content-type: application/json - - { - "errors" : [ - { - "message" : "forced test failure!" - } - ] - } - --graphql - """.crlfFormattedData() - ) - ) { result in - defer { - expectation.fulfill() - } - - expect(result).to(beFailure { error in - expect(error).to( - matchError(MultipartResponseParsingInterceptor.MultipartResponseParsingError.irrecoverableError(message: "forced test failure!")) - ) - }) - } - - wait(for: [expectation], timeout: defaultTimeout) - } - - func test__error__givenUnrecognizableChunk_shouldReturnError() throws { - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectation = expectation(description: "Received callback") - - subject.intercept( - request: .mock(operation: MockSubscription.mock()), - response: .mock( - headerFields: ["Content-Type": "multipart/mixed;boundary=graphql"], - data: """ - --graphql - content-type: application/json - - not_a_valid_json_object - --graphql - """.crlfFormattedData() - ) - ) { result in - defer { - expectation.fulfill() - } - - expect(result).to(beFailure { error in - expect(error).to( - matchError(MultipartResponseParsingInterceptor.MultipartResponseParsingError.cannotParseChunkData) - ) - }) - } - - wait(for: [expectation], timeout: defaultTimeout) - } - - func test__error__givenChunk_withMissingPayload_shouldReturnError() throws { - let subject = InterceptorTester(interceptor: MultipartResponseParsingInterceptor()) - - let expectation = expectation(description: "Received callback") - - subject.intercept( - request: .mock(operation: MockSubscription.mock()), - response: .mock( - headerFields: ["Content-Type": "multipart/mixed;boundary=graphql"], - data: """ - --graphql - content-type: application/json - - { - "key": "value" - } - --graphql - """.crlfFormattedData() - ) - ) { result in - defer { - expectation.fulfill() - } - - expect(result).to(beFailure { error in - expect(error).to( - matchError(MultipartResponseParsingInterceptor.MultipartResponseParsingError.cannotParsePayloadData) - ) - }) - } - - wait(for: [expectation], timeout: defaultTimeout) - } - - // MARK: Parsing tests - - private class Time: MockSelectionSet { - typealias Schema = MockSchemaMetadata - - override class var __selections: [Selection] {[ - .field("__typename", String.self), - .field("ticker", Int.self) - ]} - - var ticker: Int { __data["ticker"] } - } - - private func buildNetworkTransport( - responseData: Data - ) -> RequestChainNetworkTransport { - let client = MockURLSessionClient( - response: .mock(headerFields: ["Content-Type": "multipart/mixed;boundary=graphql"]), - data: responseData - ) - - let provider = MockInterceptorProvider([ - NetworkFetchInterceptor(client: client), - MultipartResponseParsingInterceptor(), - JSONResponseParsingInterceptor() - ]) - - return RequestChainNetworkTransport( - interceptorProvider: provider, - endpointURL: TestURL.mockServer.url - ) - } - - func test__parsing__givenHeartbeat_shouldIgnore() throws { - let network = buildNetworkTransport(responseData: """ - --graphql - content-type: application/json - - {} - --graphql - """.crlfFormattedData() - ) - - let expectation = expectation(description: "Heartbeat ignored") - expectation.isInverted = true - - _ = network.send(operation: MockSubscription!0},autoplays:{type:Boolean,default:()=>!0},posterVariants:{type:Array,required:!1,default:()=>[]}},data:()=>({appState:l["a"].state}),computed:{preferredColorScheme:({appState:t})=>t.preferredColorScheme,systemColorScheme:({appState:t})=>t.systemColorScheme,userPrefersDark:({preferredColorScheme:t,systemColorScheme:e})=>t===u["a"].dark.value||t===u["a"].auto.value&&e===u["a"].dark.value,shouldShowDarkVariant:({darkVideoVariantAttributes:t,userPrefersDark:e})=>t&&e,defaultVideoAttributes(){return this.videoVariantsGroupedByAppearance.light[0]||this.darkVideoVariantAttributes||{}},darkVideoVariantAttributes(){return this.videoVariantsGroupedByAppearance.dark[0]},videoVariantsGroupedByAppearance(){return Object(c["d"])(this.variants)},posterVariantsGroupedByAppearance(){return Object(c["d"])(this.posterVariants)},defaultPosterAttributes:({posterVariantsGroupedByAppearance:t,userPrefersDark:e})=>e&&t.dark.length?t.dark[0]:t.light[0]||{},videoAttributes:({darkVideoVariantAttributes:t,defaultVideoAttributes:e,shouldShowDarkVariant:n})=>n?t:e},methods:{normalizeAssetUrl:c["b"]}},p=d,m=n("2877"),h=Object(m["a"])(p,o,r,!1,null,null,null),v=h.exports,f=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"video-replay-container"},[n("VideoAsset",{ref:"asset",attrs:{variants:t.variants,showsControls:t.showsControls,autoplays:t.autoplays},on:{ended:t.onVideoEnd}}),n("a",{staticClass:"replay-button",class:{visible:this.showsReplayButton},attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.replay.apply(null,arguments)}}},[t._v(" Replay "),n("InlineReplayIcon",{staticClass:"replay-icon icon-inline"})],1)],1)},y=[],b=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"inline-replay-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M2.254 10.201c-1.633-2.613-0.838-6.056 1.775-7.689 2.551-1.594 5.892-0.875 7.569 1.592l0.12 0.184-0.848 0.53c-1.34-2.145-4.166-2.797-6.311-1.457s-2.797 4.166-1.457 6.311 4.166 2.797 6.311 1.457c1.006-0.629 1.71-1.603 2.003-2.723l0.056-0.242 0.98 0.201c-0.305 1.487-1.197 2.792-2.51 3.612-2.613 1.633-6.056 0.838-7.689-1.775z"}}),n("path",{attrs:{d:"M10.76 1.355l0.984-0.18 0.851 4.651-4.56-1.196 0.254-0.967 3.040 0.796z"}})])},C=[],_=n("be08"),g={name:"InlineReplayIcon",components:{SVGIcon:_["a"]}},V=g,S=Object(m["a"])(V,b,C,!1,null,null,null),A=S.exports,T={name:"ReplayableVideoAsset",components:{InlineReplayIcon:A,VideoAsset:v},props:{variants:{type:Array,required:!0},showsControls:{type:Boolean,default:()=>!0},autoplays:{type:Boolean,default:()=>!0}},data(){return{showsReplayButton:!1}},methods:{async replay(){const t=this.$refs.asset.$el;t&&(await t.play(),this.showsReplayButton=!1)},onVideoEnd(){this.showsReplayButton=!0}}},w=T,k=(n("dffc"),Object(m["a"])(w,f,y,!1,null,"59608016",null)),I=k.exports;const x={video:"video",image:"image"};var O={name:"Asset",components:{ImageAsset:i["a"],VideoAsset:v},constants:{AssetTypes:x},inject:["references"],props:{identifier:{type:String,required:!0},showsReplayButton:{type:Boolean,default:()=>!1},showsVideoControls:{type:Boolean,default:()=>!0},videoAutoplays:{type:Boolean,default:()=>!0}},computed:{rawAsset(){return this.references[this.identifier]||{}},isRawAssetVideo:({rawAsset:t})=>t.type===x.video,videoPoster(){return this.isRawAssetVideo&&this.references[this.rawAsset.poster]},asset(){return this.isRawAssetVideo&&this.prefersReducedMotion&&this.videoPoster||this.rawAsset},assetComponent(){switch(this.asset.type){case x.image:return i["a"];case x.video:return this.showsReplayButton?I:v;default:return}},prefersReducedMotion(){return window.matchMedia("(prefers-reduced-motion)").matches},assetProps(){return{[x.image]:this.imageProps,[x.video]:this.videoProps}[this.asset.type]},imageProps(){return{alt:this.asset.alt,variants:this.asset.variants}},videoProps(){return{variants:this.asset.variants,showsControls:this.showsVideoControls,autoplays:!this.prefersReducedMotion&&this.videoAutoplays,posterVariants:this.videoPoster?this.videoPoster.variants:[]}},assetListeners(){return{[x.image]:null,[x.video]:{ended:()=>this.$emit("videoEnded")}}[this.asset.type]}}},j=O,N=(n("7839"),Object(m["a"])(j,s,a,!1,null,"1b5cc854",null));e["a"]=N.exports},"82d9":function(t,e,n){},"85fb":function(t,e,n){},"8d2d":function(t,e,n){"use strict";var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"tutorial-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M0.933 6.067h3.733v1.867h-3.733v-1.867z"}}),n("path",{attrs:{d:"M0.933 1.867h3.733v1.867h-3.733v-1.867z"}}),n("path",{attrs:{d:"M13.067 1.867v10.267h-7.467v-10.267zM12.133 2.8h-5.6v8.4h5.6z"}}),n("path",{attrs:{d:"M0.933 10.267h3.733v1.867h-3.733v-1.867z"}})])},a=[],i=n("be08"),o={name:"TutorialIcon",components:{SVGIcon:i["a"]}},r=o,c=n("2877"),l=Object(c["a"])(r,s,a,!1,null,null,null);e["a"]=l.exports},"8f86":function(t,e,n){},"9b79":function(t,e,n){},"9f56":function(t,e,n){},a497:function(t,e,n){"use strict";n("da75")},a9f1:function(t,e,n){"use strict";var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"article-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M8.033 1l3.967 4.015v7.985h-10v-12zM7.615 2h-4.615v10h8v-6.574z"}}),n("path",{attrs:{d:"M7 1h1v4h-1z"}}),n("path",{attrs:{d:"M7 5h5v1h-5z"}})])},a=[],i=n("be08"),o={name:"ArticleIcon",components:{SVGIcon:i["a"]}},r=o,c=n("2877"),l=Object(c["a"])(r,s,a,!1,null,null,null);e["a"]=l.exports},b185:function(t,e,n){},b9c2:function(t,e,n){},c4dd:function(t,e,n){"use strict";var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"play-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),n("path",{attrs:{d:"M10.195 7.010l-5 3v-6l5 3z"}})])},a=[],i=n("be08"),o={name:"PlayIcon",components:{SVGIcon:i["a"]}},r=o,c=n("2877"),l=Object(c["a"])(r,s,a,!1,null,null,null);e["a"]=l.exports},c802:function(t,e,n){"use strict";n("f084")},d647:function(t,e,n){"use strict";n("b185")},da75:function(t,e,n){},dcb9:function(t,e,n){},de60:function(t,e,n){"use strict";var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"download-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5z"}}),n("path",{attrs:{d:"M7.51 2.964l-0.001 5.431 1.308-2.041 0.842 0.539-2.664 4.162-2.633-4.164 0.845-0.534 1.303 2.059 0.001-5.452z"}})])},a=[],i=n("be08"),o={name:"DownloadIcon",components:{SVGIcon:i["a"]}},r=o,c=n("2877"),l=Object(c["a"])(r,s,a,!1,null,null,null);e["a"]=l.exports},dffc:function(t,e,n){"use strict";n("f3cd")},e929:function(t,e,n){"use strict";n("54b0")},ec73:function(t,e,n){},ee29:function(t,e,n){"use strict";n("b9c2")},f025:function(t,e,n){"use strict";n.r(e);var s,a,i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.topicData?n("Overview",t._b({key:t.topicKey},"Overview",t.overviewProps,!1)):t._e()},o=[],r=n("25a9"),c=n("bb52"),l=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"tutorials-overview"},[t.isTargetIDE?t._e():n("Nav",{staticClass:"theme-dark",attrs:{sections:t.otherSections}},[t._v(" "+t._s(t.title)+" ")]),n("main",{staticClass:"main",attrs:{id:"main",role:"main",tabindex:"0"}},[n("div",{staticClass:"radial-gradient"},[t._t("above-hero"),t.heroSection?n("Hero",{attrs:{action:t.heroSection.action,content:t.heroSection.content,estimatedTime:t.metadata.estimatedTime,image:t.heroSection.image,title:t.heroSection.title}}):t._e()],2),t.otherSections.length>0?n("LearningPath",{attrs:{sections:t.otherSections}}):t._e()],1)],1)},u=[],d={state:{activeTutorialLink:null,activeVolume:null},reset(){this.state.activeTutorialLink=null,this.state.activeVolume=null},setActiveSidebarLink(t){this.state.activeTutorialLink=t},setActiveVolume(t){this.state.activeVolume=t}},p=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("NavBase",[n("NavTitleContainer",{attrs:{to:t.buildUrl(t.$route.path,t.$route.query)}},[n("template",{slot:"default"},[t._t("default")],2),n("template",{slot:"subhead"},[t._v("Tutorials")])],2),n("template",{slot:"menu-items"},[n("NavMenuItemBase",{staticClass:"in-page-navigation"},[n("TutorialsNavigation",{attrs:{sections:t.sections}})],1),t._t("menu-items")],2)],2)},m=[],h=n("cbcf"),v=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("nav",{staticClass:"tutorials-navigation"},[n("TutorialsNavigationList",t._l(t.sections,(function(e,s){return n("li",{key:e.name+"_"+s,class:t.sectionClasses(e)},[t.isVolume(e)?n(t.componentForVolume(e),t._b({tag:"component",on:{"select-menu":t.onSelectMenu,"deselect-menu":t.onDeselectMenu}},"component",t.propsForVolume(e),!1),t._l(e.chapters,(function(e){return n("li",{key:e.name},[n("TutorialsNavigationLink",[t._v(" "+t._s(e.name)+" ")])],1)})),0):t.isResources(e)?n("TutorialsNavigationLink",[t._v(" Resources ")]):t._e()],1)})),0)],1)},f=[],y=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("router-link",{staticClass:"tutorials-navigation-link",class:{active:t.active},attrs:{to:t.fragment},nativeOn:{click:function(e){return t.handleFocus.apply(null,arguments)}}},[t._t("default")],2)},b=[],C=n("002d"),_=n("8a61"),g={name:"TutorialsNavigationLink",mixins:[_["a"]],inject:{store:{default:()=>({state:{}})}},data(){return{state:this.store.state}},computed:{active:({state:{activeTutorialLink:t},text:e})=>e===t,fragment:({text:t,$route:e})=>({hash:Object(C["a"])(t),query:e.query}),text:({$slots:{default:[{text:t}]}})=>t.trim()},methods:{async handleFocus(){const{hash:t}=this.fragment,e=document.getElementById(t);e&&(e.focus(),await this.scrollToElement("#"+t))}}},V=g,S=(n("6962"),n("2877")),A=Object(S["a"])(V,y,b,!1,null,"6bb99205",null),T=A.exports,w=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ol",{staticClass:"tutorials-navigation-list",attrs:{role:"list"}},[t._t("default")],2)},k=[],I={name:"TutorialsNavigationList"},x=I,O=(n("202a"),Object(S["a"])(x,w,k,!1,null,"6f2800d1",null)),j=O.exports,N=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"tutorials-navigation-menu",class:{collapsed:t.collapsed}},[n("button",{staticClass:"toggle",attrs:{"aria-expanded":t.collapsed?"false":"true",type:"button"},on:{click:function(e){return e.stopPropagation(),t.onClick.apply(null,arguments)}}},[n("span",{staticClass:"text"},[t._v(t._s(t.title))]),n("InlineCloseIcon",{staticClass:"toggle-icon icon-inline"})],1),n("transition-expand",[t.collapsed?t._e():n("div",{staticClass:"tutorials-navigation-menu-content"},[n("TutorialsNavigationList",{attrs:{"aria-label":"Chapters"}},[t._t("default")],2)],1)])],1)},M=[],E=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"inline-close-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M11.91 1l1.090 1.090-4.917 4.915 4.906 4.905-1.090 1.090-4.906-4.905-4.892 4.894-1.090-1.090 4.892-4.894-4.903-4.904 1.090-1.090 4.903 4.904z"}})])},$=[],q=n("be08"),B={name:"InlineCloseIcon",components:{SVGIcon:q["a"]}},R=B,z=Object(S["a"])(R,E,$,!1,null,null,null),D=z.exports,L={name:"TransitionExpand",functional:!0,render(t,e){const n={props:{name:"expand"},on:{afterEnter(t){t.style.height="auto"},enter(t){const{width:e}=getComputedStyle(t);t.style.width=e,t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";const{height:n}=getComputedStyle(t);t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,getComputedStyle(t).height,requestAnimationFrame(()=>{t.style.height=n})},leave(t){const{height:e}=getComputedStyle(t);t.style.height=e,getComputedStyle(t).height,requestAnimationFrame(()=>{t.style.height=0})}}};return t("transition",n,e.children)}},P=L,G=(n("032c"),Object(S["a"])(P,s,a,!1,null,null,null)),F=G.exports,H={name:"TutorialsNavigationMenu",components:{InlineCloseIcon:D,TransitionExpand:F,TutorialsNavigationList:j},props:{collapsed:{type:Boolean,default:!0},title:{type:String,required:!0}},methods:{onClick(){this.collapsed?this.$emit("select-menu",this.title):this.$emit("deselect-menu")}}},K=H,U=(n("d647"),Object(S["a"])(K,N,M,!1,null,"6513d652",null)),Z=U.exports;const J={resources:"resources",volume:"volume"};var Q={name:"TutorialsNavigation",components:{TutorialsNavigationLink:T,TutorialsNavigationList:j,TutorialsNavigationMenu:Z},constants:{SectionKind:J},inject:{store:{default:()=>({setActiveVolume(){}})}},data(){return{state:this.store.state}},props:{sections:{type:Array,required:!0}},computed:{activeVolume:({state:t})=>t.activeVolume},methods:{sectionClasses(t){return{volume:this.isVolume(t),"volume--named":this.isNamedVolume(t),resource:this.isResources(t)}},componentForVolume:({name:t})=>t?Z:j,isResources:({kind:t})=>t===J.resources,isVolume:({kind:t})=>t===J.volume,activateFirstNamedVolume(){const{isNamedVolume:t,sections:e}=this,n=e.find(t);n&&this.store.setActiveVolume(n.name)},isNamedVolume(t){return this.isVolume(t)&&t.name},onDeselectMenu(){this.store.setActiveVolume(null)},onSelectMenu(t){this.store.setActiveVolume(t)},propsForVolume({name:t}){const{activeVolume:e}=this;return t?{collapsed:t!==e,title:t}:{"aria-label":"Chapters"}}},created(){this.activateFirstNamedVolume()}},W=Q,X=(n("095b"),Object(S["a"])(W,v,f,!1,null,"0cbd8adb",null)),Y=X.exports,tt=n("653a"),et=n("d26a"),nt=n("863d");const st={resources:"resources",volume:"volume"};var at={name:"Nav",constants:{SectionKind:st},components:{NavMenuItemBase:nt["a"],NavTitleContainer:tt["a"],TutorialsNavigation:Y,NavBase:h["a"]},props:{sections:{type:Array,require:!0}},methods:{buildUrl:et["b"]}},it=at,ot=(n("6211"),Object(S["a"])(it,p,m,!1,null,"1001350c",null)),rt=ot.exports,ct=n("bf08"),lt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"hero"},[n("div",{staticClass:"copy-container"},[n("h1",{staticClass:"title"},[t._v(t._s(t.title))]),t.content?n("ContentNode",{attrs:{content:t.content}}):t._e(),t.estimatedTime?n("p",{staticClass:"meta"},[n("TimerIcon"),n("span",{staticClass:"meta-content"},[n("strong",{staticClass:"time"},[t._v(t._s(t.estimatedTime))]),n("span",[t._v(" Estimated Time")])])],1):t._e(),t.action?n("CallToActionButton",{attrs:{action:t.action,"aria-label":t.action.overridingTitle+" with "+t.title,isDark:""}}):t._e()],1),t.image?n("Asset",{attrs:{identifier:t.image}}):t._e()],1)},ut=[],dt=n("80e4"),pt=n("c081"),mt=n("5677"),ht=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"timer-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 2c-2.761 0-5 2.239-5 5s2.239 5 5 5c2.761 0 5-2.239 5-5v0c0-2.761-2.239-5-5-5v0z"}}),n("path",{attrs:{d:"M6.51 3.51h1.5v3.5h-1.5v-3.5z"}}),n("path",{attrs:{d:"M6.51 7.010h4v1.5h-4v-1.5z"}})])},vt=[],ft={name:"TimerIcon",components:{SVGIcon:q["a"]}},yt=ft,bt=Object(S["a"])(yt,ht,vt,!1,null,null,null),Ct=bt.exports,_t={name:"Hero",components:{Asset:dt["a"],CallToActionButton:pt["a"],ContentNode:mt["a"],TimerIcon:Ct},props:{action:{type:Object,required:!1},content:{type:Array,required:!1},estimatedTime:{type:String,required:!1},image:{type:String,required:!1},title:{type:String,required:!0}}},gt=_t,Vt=(n("f974"),Object(S["a"])(gt,lt,ut,!1,null,"fc7f508c",null)),St=Vt.exports,At=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"learning-path",class:t.classes},[n("div",{staticClass:"main-container"},[t.isTargetIDE?t._e():n("div",{staticClass:"secondary-content-container"},[n("TutorialsNavigation",{attrs:{sections:t.sections,"aria-label":"On this page"}})],1),n("div",{staticClass:"primary-content-container"},[n("div",{staticClass:"content-sections-container"},[t._l(t.volumes,(function(e,s){return n("Volume",t._b({key:"volume_"+s,staticClass:"content-section"},"Volume",t.propsFor(e),!1))})),t._l(t.otherSections,(function(e,s){return n(t.componentFor(e),t._b({key:"resource_"+s,tag:"component",staticClass:"content-section"},"component",t.propsFor(e),!1))}))],2)])])])},Tt=[],wt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"resources",attrs:{id:"resources",tabindex:"-1"}},[n("VolumeName",{attrs:{name:"Resources",content:t.content}}),n("TileGroup",{attrs:{tiles:t.tiles}})],1)},kt=[],It=n("72e7");const xt={topOneThird:"-30% 0% -70% 0%",center:"-50% 0% -50% 0%"};var Ot={mixins:[It["a"]],computed:{intersectionRoot(){return null},intersectionRootMargin(){return xt.center}},methods:{onIntersect(t){if(!t.isIntersecting)return;const e=this.onIntersectViewport;e?e():console.warn("onIntersectViewportCenter not implemented")}}},jt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"volume-name"},[t.image?n("Asset",{staticClass:"image",attrs:{identifier:t.image,"aria-hidden":"true"}}):t._e(),n("h2",{staticClass:"name"},[t._v(" "+t._s(t.name)+" ")]),t.content?n("ContentNode",{attrs:{content:t.content}}):t._e()],1)},Nt=[],Mt={name:"VolumeName",components:{ContentNode:mt["a"],Asset:dt["a"]},props:{image:{type:String,required:!1},content:{type:Array,required:!1},name:{type:String,required:!1}}},Et=Mt,$t=(n("c802"),Object(S["a"])(Et,jt,Nt,!1,null,"14577284",null)),qt=$t.exports,Bt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"tile-group",class:t.countClass},t._l(t.tiles,(function(e){return n("Tile",t._b({key:e.title},"Tile",t.propsFor(e),!1))})),1)},Rt=[],zt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"tile"},[t.identifier?n("div",{staticClass:"icon"},[n(t.iconComponent,{tag:"component"})],1):t._e(),n("div",{staticClass:"title"},[t._v(t._s(t.title))]),n("ContentNode",{attrs:{content:t.content}}),t.action?n("DestinationDataProvider",{attrs:{destination:t.action},scopedSlots:t._u([{key:"default",fn:function(e){var s=e.url,a=e.title;return n("Reference",{staticClass:"link",attrs:{url:s}},[t._v(" "+t._s(a)+" "),n("InlineChevronRightIcon",{staticClass:"link-icon icon-inline"})],1)}}],null,!1,3874201962)}):t._e()],1)},Dt=[],Lt=n("3b96"),Pt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"document-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M11.2,5.3,8,2l-.1-.1H2.8V12.1h8.5V6.3l-.1-1ZM8,3.2l2,2.1H8Zm2.4,8H3.6V2.8H7V6.3h3.4Z"}})])},Gt=[],Ft={name:"DocumentIcon",components:{SVGIcon:q["a"]}},Ht=Ft,Kt=(n("77e2"),Object(S["a"])(Ht,Pt,Gt,!1,null,"56114692",null)),Ut=Kt.exports,Zt=n("de60"),Jt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SVGIcon",{staticClass:"forum-icon",attrs:{viewBox:"0 0 14 14"}},[n("path",{attrs:{d:"M13 1v9h-7l-1.5 3-1.5-3h-2v-9zM12 2h-10v7h1.616l0.884 1.763 0.88-1.763h6.62z"}}),n("path",{attrs:{d:"M3 4h8.001v1h-8.001v-1z"}}),n("path",{attrs:{d:"M3 6h8.001v1h-8.001v-1z"}})])},Qt=[],Wt={name:"ForumIcon",components:{SVGIcon:q["a"]}},Xt=Wt,Yt=Object(S["a"])(Xt,Jt,Qt,!1,null,null,null),te=Yt.exports,ee=n("c4dd"),ne=n("86d8"),se=n("34b0"),ae=n("c7ea");const ie={documentation:"documentation",downloads:"downloads",featured:"featured",forums:"forums",sampleCode:"sampleCode",videos:"videos"};var oe={name:"Tile",constants:{Identifier:ie},components:{DestinationDataProvider:ae["a"],InlineChevronRightIcon:se["a"],ContentNode:mt["a"],CurlyBracketsIcon:Lt["a"],DocumentIcon:Ut,DownloadIcon:Zt["a"],ForumIcon:te,PlayIcon:ee["a"],Reference:ne["a"]},props:{action:{type:Object,required:!1},content:{type:Array,required:!0},identifier:{type:String,required:!1},title:{type:String,require:!0}},computed:{iconComponent:({identifier:t})=>({[ie.documentation]:Ut,[ie.downloads]:Zt["a"],[ie.forums]:te,[ie.sampleCode]:Lt["a"],[ie.videos]:ee["a"]}[t])}},re=oe,ce=(n("0175"),Object(S["a"])(re,zt,Dt,!1,null,"86db603a",null)),le=ce.exports,ue={name:"TileGroup",components:{Tile:le},props:{tiles:{type:Array,required:!0}},computed:{countClass:({tiles:t})=>"count-"+t.length},methods:{propsFor:({action:t,content:e,identifier:n,title:s})=>({action:t,content:e,identifier:n,title:s})}},de=ue,pe=(n("f0ca"),Object(S["a"])(de,Bt,Rt,!1,null,"015f9f13",null)),me=pe.exports,he={name:"Resources",mixins:[Ot],inject:{store:{default:()=>({setActiveSidebarLink(){},setActiveVolume(){}})}},components:{VolumeName:qt,TileGroup:me},computed:{intersectionRootMargin:()=>xt.topOneThird},props:{content:{type:Array,required:!1},tiles:{type:Array,required:!0}},methods:{onIntersectViewport(){this.store.setActiveSidebarLink("Resources"),this.store.setActiveVolume(null)}}},ve=he,fe=(n("5668"),Object(S["a"])(ve,wt,kt,!1,null,"49ba6f62",null)),ye=fe.exports,be=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"volume"},[t.name?n("VolumeName",t._b({},"VolumeName",{name:t.name,image:t.image,content:t.content},!1)):t._e(),t._l(t.chapters,(function(e,s){return n("Chapter",{key:e.name,staticClass:"tile",attrs:{content:e.content,image:e.image,name:e.name,number:s+1,topics:t.lookupTopics(e.tutorials),volumeHasName:!!t.name}})}))],2)},Ce=[],_e=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"chapter",attrs:{id:t.anchor,tabindex:"-1"}},[n("div",{staticClass:"info"},[n("Asset",{attrs:{identifier:t.image,"aria-hidden":"true"}}),n("div",{staticClass:"intro"},[n(t.volumeHasName?"h3":"h2",{tag:"component",staticClass:"name",attrs:{"aria-label":t.name+" - Chapter "+t.number}},[n("span",{staticClass:"eyebrow",attrs:{"aria-hidden":"true"}},[t._v("Chapter "+t._s(t.number))]),n("span",{staticClass:"name-text",attrs:{"aria-hidden":"true"}},[t._v(t._s(t.name))])]),t.content?n("ContentNode",{attrs:{content:t.content}}):t._e()],1)],1),n("TopicList",{attrs:{topics:t.topics}})],1)},ge=[],Ve=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ol",{staticClass:"topic-list"},t._l(t.topics,(function(e){return n("li",{key:e.url,staticClass:"topic",class:[t.kindClassFor(e),{"no-time-estimate":!e.estimatedTime}]},[n("div",{staticClass:"topic-icon"},[n(t.iconComponent(e),{tag:"component"})],1),n("router-link",{staticClass:"container",attrs:{to:t.buildUrl(e.url,t.$route.query),"aria-label":t.ariaLabelFor(e)}},[n("div",{staticClass:"link"},[t._v(t._s(e.title))]),e.estimatedTime?n("div",{staticClass:"time"},[n("TimerIcon"),n("span",{staticClass:"time-label"},[t._v(t._s(e.estimatedTime))])],1):t._e()])],1)})),0)},Se=[],Ae=n("a9f1"),Te=n("8d2d");const we={article:"article",tutorial:"project"},ke={article:"article",tutorial:"tutorial"},Ie={[we.article]:"Article",[we.tutorial]:"Tutorial"};var xe={name:"ChapterTopicList",components:{TimerIcon:Ct},constants:{TopicKind:we,TopicKindClass:ke,TopicKindIconLabel:Ie},props:{topics:{type:Array,required:!0}},methods:{buildUrl:et["b"],iconComponent:({kind:t})=>({[we.article]:Ae["a"],[we.tutorial]:Te["a"]}[t]),kindClassFor:({kind:t})=>({[we.article]:ke.article,[we.tutorial]:ke.tutorial}[t]),formatTime:t=>t.replace("min"," minutes").replace("hrs"," hours"),ariaLabelFor({title:t,estimatedTime:e,kind:n}){const s=[t,Ie[n]];return e&&s.push(this.formatTime(e)+" Estimated Time"),s.join(" - ")}}},Oe=xe,je=(n("1cc5"),Object(S["a"])(Oe,Ve,Se,!1,null,"da979188",null)),Ne=je.exports,Me={name:"Chapter",mixins:[Ot],inject:{store:{default:()=>({setActiveSidebarLink(){},setActiveVolume(){}})}},components:{Asset:dt["a"],ContentNode:mt["a"],TopicList:Ne},props:{content:{type:Array,required:!1},image:{type:String,required:!0},name:{type:String,required:!0},number:{type:Number,required:!0},topics:{type:Array,required:!0},volumeHasName:{type:Boolean,default:!1}},computed:{anchor:({name:t})=>Object(C["a"])(t),intersectionRootMargin:()=>xt.topOneThird},methods:{onIntersectViewport(){this.store.setActiveSidebarLink(this.name),this.volumeHasName||this.store.setActiveVolume(null)}}},Ee=Me,$e=(n("f31c"),Object(S["a"])(Ee,_e,ge,!1,null,"1d13969f",null)),qe=$e.exports,Be={name:"Volume",mixins:[Ot],components:{VolumeName:qt,Chapter:qe},computed:{intersectionRootMargin:()=>xt.topOneThird},inject:{references:{default:()=>({})},store:{default:()=>({setActiveVolume(){}})}},props:{chapters:{type:Array,required:!0},content:{type:Array,required:!1},image:{type:String,required:!1},name:{type:String,required:!1}},methods:{lookupTopics(t){return t.reduce((t,e)=>t.concat(this.references[e]||[]),[])},onIntersectViewport(){this.name&&this.store.setActiveVolume(this.name)}}},Re=Be,ze=(n("ee29"),Object(S["a"])(Re,be,Ce,!1,null,"2129f58c",null)),De=ze.exports;const Le={resources:"resources",volume:"volume"};var Pe={name:"LearningPath",components:{Resources:ye,TutorialsNavigation:Y,Volume:De},constants:{SectionKind:Le},inject:{isTargetIDE:{default:!1}},props:{sections:{type:Array,required:!0,validator:t=>t.every(t=>Object.prototype.hasOwnProperty.call(Le,t.kind))}},computed:{classes:({isTargetIDE:t})=>({ide:t}),partitionedSections:({sections:t})=>t.reduce(([t,e],n)=>n.kind===Le.volume?[t.concat(n),e]:[t,e.concat(n)],[[],[]]),volumes:({partitionedSections:t})=>t[0],otherSections:({partitionedSections:t})=>t[1]},methods:{componentFor:({kind:t})=>({[Le.resources]:ye,[Le.volume]:De}[t]),propsFor:({chapters:t,content:e,image:n,kind:s,name:a,tiles:i})=>({[Le.resources]:{content:e,tiles:i},[Le.volume]:{chapters:t,content:e,image:n,name:a}}[s])}},Ge=Pe,Fe=(n("e929"),Object(S["a"])(Ge,At,Tt,!1,null,"48bfa85c",null)),He=Fe.exports;const Ke={hero:"hero",resources:"resources",volume:"volume"};var Ue={name:"TutorialsOverview",components:{Hero:St,LearningPath:He,Nav:rt},mixins:[ct["a"]],constants:{SectionKind:Ke},inject:{isTargetIDE:{default:!1}},props:{metadata:{type:Object,default:()=>({})},references:{type:Object,default:()=>({})},sections:{type:Array,default:()=>[],validator:t=>t.every(t=>Object.prototype.hasOwnProperty.call(Ke,t.kind))}},computed:{pageTitle:({title:t})=>[t,"Tutorials"].filter(Boolean).join(" "),pageDescription:({heroSection:t,extractFirstParagraphText:e})=>t?e(t.content):null,partitionedSections:({sections:t})=>t.reduce(([t,e],n)=>n.kind===Ke.hero?[t.concat(n),e]:[t,e.concat(n)],[[],[]]),heroSections:({partitionedSections:t})=>t[0],otherSections:({partitionedSections:t})=>t[1],heroSection:({heroSections:t})=>t[0],store:()=>d,title:({metadata:{category:t=""}})=>t},provide(){return{references:this.references,store:this.store}},created(){this.store.reset()}},Ze=Ue,Je=(n("3f36"),Object(S["a"])(Ze,l,u,!1,null,"53888684",null)),Qe=Je.exports,We=n("146e"),Xe={name:"TutorialsOverview",components:{Overview:Qe},mixins:[c["a"],We["a"]],data(){return{topicData:null}},computed:{overviewProps:({topicData:{metadata:t,references:e,sections:n}})=>({metadata:t,references:e,sections:n}),topicKey:({$route:t,topicData:e})=>[t.path,e.identifier.interfaceLanguage].join()},beforeRouteEnter(t,e,n){Object(r["b"])(t,e,n).then(t=>n(e=>{e.topicData=t})).catch(n)},beforeRouteUpdate(t,e,n){Object(r["d"])(t,e)?Object(r["b"])(t,e,n).then(t=>{this.topicData=t,n()}).catch(n):n()},watch:{topicData(){this.$nextTick(()=>{this.newContentMounted()})}}},Ye=Xe,tn=Object(S["a"])(Ye,i,o,!1,null,null,null);e["default"]=tn.exports},f084:function(t,e,n){},f0ca:function(t,e,n){"use strict";n("8f86")},f31c:function(t,e,n){"use strict";n("9f56")},f3cd:function(t,e,n){},f974:function(t,e,n){"use strict";n("dcb9")},fb73:function(t,e,n){}}]); \ No newline at end of file diff --git a/docs/docc/Apollo.doccarchive/metadata.json b/docs/docc/Apollo.doccarchive/metadata.json deleted file mode 100644 index 24a697348b..0000000000 --- a/docs/docc/Apollo.doccarchive/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "bundleDisplayName" : "Apollo", - "bundleIdentifier" : "Apollo", - "schemaVersion" : { - "major" : 0, - "minor" : 1, - "patch" : 0 - } -} \ No newline at end of file diff --git a/docs/docc/Apollo.doccarchive/theme-settings.json b/docs/docc/Apollo.doccarchive/theme-settings.json deleted file mode 100644 index 8903ddc8d4..0000000000 --- a/docs/docc/Apollo.doccarchive/theme-settings.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "meta": {}, - "theme": { - "code": { - "indentationWidth": 4 - }, - "colors": { - "text": "", - "text-background": "", - "grid": "", - "article-background": "", - "generic-modal-background": "", - "secondary-label": "", - "header-text": "", - "not-found": { - "input-border": "" - }, - "runtime-preview": { - "text": "" - }, - "tabnav-item": { - "border-color": "" - }, - "svg-icon": { - "fill-light": "", - "fill-dark": "" - }, - "loading-placeholder": { - "background": "" - }, - "button": { - "text": "", - "light": { - "background": "", - "backgroundHover": "", - "backgroundActive": "" - }, - "dark": { - "background": "", - "backgroundHover": "", - "backgroundActive": "" - } - }, - "link": null - }, - "style": { - "button": { - "borderRadius": null - } - }, - "typography": { - "html-font": "" - } - }, - "features": { - "docs": { - "quickNavigation": { - "enable": false - } - } - } -} diff --git a/docs/docc/netlify.toml b/docs/docc/netlify.toml deleted file mode 100644 index b87b8d3dda..0000000000 --- a/docs/docc/netlify.toml +++ /dev/null @@ -1,4 +0,0 @@ -[[redirects]] - from = "/*" - to = "/index.html" - status = 200 diff --git a/docs/shared/cli-install/pods.mdx b/docs/shared/cli-install/pods.mdx deleted file mode 100644 index df30f62eae..0000000000 --- a/docs/shared/cli-install/pods.mdx +++ /dev/null @@ -1,9 +0,0 @@ -If you use Cocoapods, Apollo iOS compiles the Codegen CLI into an executable shell application during `pod install` (located in `Pods/Apollo/apollo-ios-cli`). - -After installing the Apollo iOS pod, you can run the Codegen CLI from the directory of your `Podfile`: - -```bash -./Pods/Apollo/apollo-ios-cli ${Command Name} -${Command Arguments} -``` - -> **Note:** If you are using `:path` in your Podfile to link to a local copy of Apollo iOS, the CLI will not be automatically available. You will need to manually build the Codegen CLI. See the [CLI installation guide](/ios/code-generation/codegen-cli#installation) for directions on how to do that. diff --git a/docs/shared/cli-install/spm-xcode.mdx b/docs/shared/cli-install/spm-xcode.mdx deleted file mode 100644 index dfc3dd56bb..0000000000 --- a/docs/shared/cli-install/spm-xcode.mdx +++ /dev/null @@ -1,13 +0,0 @@ -The Apollo iOS SPM package includes the Codegen CLI as an executable target. This ensures you always have a valid CLI version for your Apollo iOS version. - -To simplify accessing the Codegen CLI, you can run the included `InstallCLI` SPM plugin. - -This plugin builds the CLI and creates a symbolic link to the executable in your project root. - -If you use Swift packages through Xcode, you can right-click on your project in the Xcode file explorer, revealing an **Install CLI** plugin command. Selecting this command presents a dialog allowing you to grant the plugin "write" access to your project directory. - -Where to find the SPM plugin commands in Xcode - -After the plugin installs, it creates a symbolic link to the Codegen CLI (named `apollo-ios-cli`) in your project root folder. You can now run the CLI from the command line with `./apollo-ios-cli`. - -> **Note:** Because the `apollo-ios-cli` in your project root is only a symbolic link, it only works if the compiled CLI executable exists. This is generally located in your Xcode Derived Data or the `.build` folder. If these are cleared, you can rerun the Install CLI plugin to rebuild the CLI executable. diff --git a/docs/shared/cli-install/spm.mdx b/docs/shared/cli-install/spm.mdx deleted file mode 100644 index 596943ab6f..0000000000 --- a/docs/shared/cli-install/spm.mdx +++ /dev/null @@ -1,13 +0,0 @@ -The Apollo iOS SPM package includes the Codegen CLI as an executable target. This ensures you always have a valid CLI version for your Apollo iOS version. - -To simplify accessing the Codegen CLI, you can run the included `apollo-cli-install` SPM plugin. This plugin builds the CLI and creates a symbolic link to the executable in your project root. - -If using a `Package.swift` file, you can install the CLI by running: - -```bash -swift package --allow-writing-to-package-directory apollo-cli-install -``` - -After the plugin installs, it creates a symbolic link to the Codegen CLI (named `apollo-ios-cli`) in your project root folder. You can now run the CLI from the command line using `./apollo-ios-cli`. - -> **Note:** Because the `apollo-ios-cli` in your project root is only a symbolic link, it only works if the compiled CLI executable exists. This is generally located in your Xcode Derived Data or the `.build` folder. If these are cleared, you can rerun the Install CLI plugin to rebuild the CLI executable. diff --git a/docs/shared/pods-installation-panel.mdx b/docs/shared/pods-installation-panel.mdx deleted file mode 100644 index 579a28fff6..0000000000 --- a/docs/shared/pods-installation-panel.mdx +++ /dev/null @@ -1,42 +0,0 @@ - - - - - -#### Install or update CocoaPods - -Because Apollo iOS uses Swift 5, you need to use CocoaPods version `1.7.0` or later. You can install CocoaPods with the following command: - - ```sh - gem install cocoapods - ``` - - - - -#### Add dependencies - -Add `pod "Apollo"` to your Podfile. - - - To include the `ApolloSQLite` framework, also add `pod "Apollo/SQLite"` - - To include the `ApolloWebSocket` framework, also add `pod "Apollo/WebSocket"` - - - - -Run `pod install`. - - - - -Use the `.xcworkspace` file generated by CocoaPods to work on your project. - - - - -You're done! - - - - - diff --git a/docs/shared/separate-local-cache-mutation-note.mdx b/docs/shared/separate-local-cache-mutation-note.mdx deleted file mode 100644 index 524c2daeb3..0000000000 --- a/docs/shared/separate-local-cache-mutation-note.mdx +++ /dev/null @@ -1,9 +0,0 @@ -> #### Separating cache mutations from network operations -> -> By flagging a query as a `LocalCacheMutation`, the generated model for that cache mutation no longer conforms to `GraphQLQuery`. This means you can no longer use that cache mutation as a query operation. -> -> Fundamentally, this is because cache mutation models are *mutable*, whereas network response data is *immutable*. Cache mutations are designed to access and mutate only the data necessary. -> -> If our cache mutation models were mutable, mutating them outside of a `ReadWriteTransaction` wouldn't persist any changes to the cache. Additionally, mutable data models require nearly double the generated code. By maintaining immutable models, we avoid this confusion and reduce our generated code. -> -> Avoid creating mutable versions of entire query operations. Instead, define mutable fragments or queries to mutate only the fields necessary. diff --git a/docs/shared/setup-codegen/combined.mdx b/docs/shared/setup-codegen/combined.mdx deleted file mode 100644 index b1e3441323..0000000000 --- a/docs/shared/setup-codegen/combined.mdx +++ /dev/null @@ -1,25 +0,0 @@ -import SPMInstallCLI from "../cli-install/spm.mdx" -import SPMXcodeInstallCLI from "../cli-install/spm-xcode.mdx" -import PodsInstallCLI from "../cli-install/pods.mdx" -import SetupCodegenPanel from "./single-panel.mdx" - - - - -} /> - - - - - - -} /> - - - - - - -} /> - - \ No newline at end of file diff --git a/docs/shared/setup-codegen/single-panel.mdx b/docs/shared/setup-codegen/single-panel.mdx deleted file mode 100644 index e34fc4781d..0000000000 --- a/docs/shared/setup-codegen/single-panel.mdx +++ /dev/null @@ -1,77 +0,0 @@ -import {CodeBlock, CodeBlockProps} from "@apollo/chakra-helpers" - - - - - -#### Install the Codegen CLI - -<>{props.installComponent} - - - - - -#### Initialize the code generation configuration - -The Codegen CLI uses a JSON file to configure the code generation engine. You can use the Codegen CLI's `init` command to create this file with default values. - -From your project's root directory, run the following command with your customized values: - - - -- `${MySchemaName}` provides a name for the namespace of your generated schema files. -- `${ModuleType}` configures how your generated schema types are included in your project. - > This is a crucial decision to make **before configuring code generation**. To determine the right option for your project, see [Project Configuration](/ios/project-configuration). - > - > To get started quickly, you can use the `embeddedInTarget` option. - > Using `embeddedInTarget`, you must supply a target name using the `--target-name` command line option. - -Running this command creates an `apollo-codegen-config.json` file. - - - - -#### Configure code generation options - -Open your `apollo-codegen-config.json` file to start configuring code generation for your project. - -The default configuration will: - -- Find all GraphQL schema files ending with the file extension `.graphqls` within your project directory. -- Find all GraphQL operation and fragment definition files ending with the file extension `.graphql` within your project directory. -- Generate Swift code for the schema types in a directory with the `schema-name` provided. -- Generate Swift code for the operation and fragment models in a subfolder within the schema types output location. - - - - -#### Run code generation - -From your project's root directory, run: - - - -The code generation engine creates your files with the extension `.graphql.swift`. - - - - -#### Add the generated schema and operation files to your target - -By default, a directory containing your generated schema files is within a directory with the schema name you provided (i.e., `MySchemaName`). Your generated operation and fragment files are in a subfolder within the same directory. - -If you created your target in an Xcode project or workspace, you'll need to manually add the generated files to your target. - -> **Note:** Because adding generated files to your Xcode targets must be done manually each time you generate new files, we highly recommend defining your project targets with SPM. Alternatively, you can generate your operations into the package that includes your schema files. For more information see the documentation for [Code Generation Configuration](/ios/code-generation/codegen-configuration). - - - diff --git a/docs/shared/spm-package-installation-panel.mdx b/docs/shared/spm-package-installation-panel.mdx deleted file mode 100644 index 3521940a78..0000000000 --- a/docs/shared/spm-package-installation-panel.mdx +++ /dev/null @@ -1,40 +0,0 @@ - - -If your project uses its own `Package.swift` file, you can add Apollo iOS as a dependency there. - - - - -#### Add Apollo iOS to your dependencies list - -```swift title="Package.swift" -dependencies: [ - .package( - url: "https://github.com/apollographql/apollo-ios.git", - .upToNextMajor(from: "1.0.0") - ), -], -``` - - - - -#### Link the Apollo product to your package target - -Any targets in your application that will use `ApolloClient` need to have a dependency on the `Apollo` product. - -```swift title="Package.swift" -.target( - name: "MyApp", - dependencies: [ - .product(name: "Apollo", package: "apollo-ios"), - ] -) -``` - -> **Note:** Targets that only use Apollo's generated models don't need to be linked to the `Apollo` product. - - - - - \ No newline at end of file diff --git a/docs/shared/spm-xcode-installation-panel.mdx b/docs/shared/spm-xcode-installation-panel.mdx deleted file mode 100644 index afbc004e4a..0000000000 --- a/docs/shared/spm-xcode-installation-panel.mdx +++ /dev/null @@ -1,47 +0,0 @@ - - -If using Swift Package Manager within an Xcode project or workspace, use the Xcode project configuration UI to add the Apollo iOS package. - - - - -Go to **File > Add Packages...** - -Adding an SPM package - - - - -In the dialog that appears, paste the URL of the Apollo iOS GitHub repo (`https://github.com/apollographql/apollo-ios.git`) into the search bar, then select the `apollo-ios` package that appears: - -Pasting the Apollo iOS GitHub URL - - - - -Select which version you want to use ([see version history](https://github.com/apollographql/apollo-ios/releases)), then click **Add Package**. - -> **Note:** Xcode might not automatically select the latest version number, please check. - - - - -Select which packages you want to use. If you're getting started, we recommend selecting just the main `Apollo` library for now. You can always add other packages later if you need them. - -Selecting Apollo iOS packages - -> **Notes:** -> 1. Do not select the `Apollo-Dynamic` product unless your project is configured to use dynamic linking of the Apollo iOS framework. Most projects do not need to link to this product. -> 2. **Do not select the `apollo-ios-cli` package.** This product is the CLI executable for code generation. If you link it to your project as a dependency it **will** cause build errors. - -Then, click **Add Package**. - - - - -You're done! - - - - - diff --git a/docs/shared/sqlite-cocoapods-panel.mdx b/docs/shared/sqlite-cocoapods-panel.mdx deleted file mode 100644 index 8669eee26d..0000000000 --- a/docs/shared/sqlite-cocoapods-panel.mdx +++ /dev/null @@ -1,12 +0,0 @@ - - -Add the following to your `Podfile`: - -```ruby -pod 'Apollo' -pod 'Apollo/SQLite' -``` - -Note that if you're specifying a version for `Apollo`, you need to specify the same version for `Apollo/SQLite`. - - \ No newline at end of file diff --git a/docs/shared/sqlite-spm-panel.mdx b/docs/shared/sqlite-spm-panel.mdx deleted file mode 100644 index b5033577c2..0000000000 --- a/docs/shared/sqlite-spm-panel.mdx +++ /dev/null @@ -1,9 +0,0 @@ - - -Add the following dependency to your target's `dependencies` in your `Package.swift` file: - -```swift -.product(name: "ApolloSQLite", package: "Apollo"), -``` - - \ No newline at end of file diff --git a/docs/source/_redirects b/docs/source/_redirects deleted file mode 100644 index 330e15da72..0000000000 --- a/docs/source/_redirects +++ /dev/null @@ -1,5 +0,0 @@ -/v1/* /docs/ios/:splat -/v1 /docs/ios/ -/tutorial /docs/ios/tutorial/tutorial-introduction -/tutorial/tutorial-create-project /docs/ios/tutorial/tutorial-add-sdk -/fetching/apqs /docs/ios/fetching/persisted-queries diff --git a/docs/source/api/Apollo/classes/ApolloClient.md b/docs/source/api/Apollo/classes/ApolloClient.md deleted file mode 100644 index 854872f61f..0000000000 --- a/docs/source/api/Apollo/classes/ApolloClient.md +++ /dev/null @@ -1,52 +0,0 @@ -**CLASS** - -# `ApolloClient` - -```swift -public class ApolloClient -``` - -The `ApolloClient` class implements the core API for Apollo by conforming to `ApolloClientProtocol`. - -## Properties -### `store` - -```swift -public let store: ApolloStore -``` - -## Methods -### `init(networkTransport:store:)` - -```swift -public init(networkTransport: NetworkTransport, store: ApolloStore) -``` - -Creates a client with the specified network transport and store. - -- Parameters: - - networkTransport: A network transport used to send operations to a server. - - store: A store used as a local cache. Note that if the `NetworkTransport` or any of its dependencies takes a store, you should make sure the same store is passed here so that it can be cleared properly. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| networkTransport | A network transport used to send operations to a server. | -| store | A store used as a local cache. Note that if the `NetworkTransport` or any of its dependencies takes a store, you should make sure the same store is passed here so that it can be cleared properly. | - -### `init(url:)` - -```swift -public convenience init(url: URL) -``` - -Creates a client with a `RequestChainNetworkTransport` connecting to the specified URL. - -- Parameter url: The URL of a GraphQL server to connect to. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| url | The URL of a GraphQL server to connect to. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/ApolloStore.ReadTransaction.md b/docs/source/api/Apollo/classes/ApolloStore.ReadTransaction.md deleted file mode 100644 index a269954602..0000000000 --- a/docs/source/api/Apollo/classes/ApolloStore.ReadTransaction.md +++ /dev/null @@ -1,24 +0,0 @@ -**CLASS** - -# `ApolloStore.ReadTransaction` - -```swift -public class ReadTransaction -``` - -## Methods -### `read(query:)` - -```swift -public func read(query: Query) throws -> Query.Data -``` - -### `readObject(ofType:withKey:variables:)` - -```swift -public func readObject( - ofType type: SelectionSet.Type, - withKey key: CacheKey, - variables: GraphQLOperation.Variables? = nil -) throws -> SelectionSet -``` diff --git a/docs/source/api/Apollo/classes/ApolloStore.ReadWriteTransaction.md b/docs/source/api/Apollo/classes/ApolloStore.ReadWriteTransaction.md deleted file mode 100644 index be1f32c858..0000000000 --- a/docs/source/api/Apollo/classes/ApolloStore.ReadWriteTransaction.md +++ /dev/null @@ -1,92 +0,0 @@ -**CLASS** - -# `ApolloStore.ReadWriteTransaction` - -```swift -public final class ReadWriteTransaction: ReadTransaction -``` - -## Methods -### `update(_:_:)` - -```swift -public func update( - _ cacheMutation: CacheMutation, - _ body: (inout CacheMutation.Data) throws -> Void -) throws -``` - -### `updateObject(ofType:withKey:variables:_:)` - -```swift -public func updateObject( - ofType type: SelectionSet.Type, - withKey key: CacheKey, - variables: GraphQLOperation.Variables? = nil, - _ body: (inout SelectionSet) throws -> Void -) throws -``` - -### `write(data:for:)` - -```swift -public func write( - data: CacheMutation.Data, - for cacheMutation: CacheMutation -) throws -``` - -### `write(selectionSet:withKey:variables:)` - -```swift -public func write( - selectionSet: SelectionSet, - withKey key: CacheKey, - variables: GraphQLOperation.Variables? = nil -) throws -``` - -### `removeObject(for:)` - -```swift -public func removeObject(for key: CacheKey) throws -``` - -Removes the object for the specified cache key. Does not cascade -or allow removal of only certain fields. Does nothing if an object -does not exist for the given key. - -- Parameters: - - key: The cache key to remove the object for - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache key to remove the object for | - -### `removeObjects(matching:)` - -```swift -public func removeObjects(matching pattern: CacheKey) throws -``` - -Removes records with keys that match the specified pattern. This method will only -remove whole records, it does not perform cascading deletes. This means only the -records with matched keys will be removed, and not any references to them. Key -matching is case-insensitive. - -If you attempt to pass a cache path for a single field, this method will do nothing -since it won't be able to locate a record to remove based on that path. - -- Note: This method can be very slow depending on the number of records in the cache. -It is recommended that this method be called in a background queue. - -- Parameters: - - pattern: The pattern that will be applied to find matching keys. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pattern | The pattern that will be applied to find matching keys. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/ApolloStore.md b/docs/source/api/Apollo/classes/ApolloStore.md deleted file mode 100644 index f5d3700018..0000000000 --- a/docs/source/api/Apollo/classes/ApolloStore.md +++ /dev/null @@ -1,134 +0,0 @@ -**CLASS** - -# `ApolloStore` - -```swift -public class ApolloStore -``` - -The `ApolloStore` class acts as a local cache for normalized GraphQL results. - -## Methods -### `init(cache:)` - -```swift -public init(cache: NormalizedCache = InMemoryNormalizedCache()) -``` - -Designated initializer -- Parameters: - - cache: An instance of `normalizedCache` to use to cache results. - Defaults to an `InMemoryNormalizedCache`. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| cache | An instance of `normalizedCache` to use to cache results. Defaults to an `InMemoryNormalizedCache`. | - -### `clearCache(callbackQueue:completion:)` - -```swift -public func clearCache(callbackQueue: DispatchQueue = .main, completion: ((Result) -> Void)? = nil) -``` - -Clears the instance of the cache. Note that a cache can be shared across multiple `ApolloClient` objects, so clearing that underlying cache will clear it for all clients. - -- Parameters: - - callbackQueue: The queue to call the completion block on. Defaults to `DispatchQueue.main`. - - completion: [optional] A completion block to be called after records are merged into the cache. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| callbackQueue | The queue to call the completion block on. Defaults to `DispatchQueue.main`. | -| completion | [optional] A completion block to be called after records are merged into the cache. | - -### `publish(records:identifier:callbackQueue:completion:)` - -```swift -public func publish(records: RecordSet, identifier: UUID? = nil, callbackQueue: DispatchQueue = .main, completion: ((Result) -> Void)? = nil) -``` - -Merges a `RecordSet` into the normalized cache. -- Parameters: - - records: The records to be merged into the cache. - - identifier: [optional] A unique identifier for the request that kicked off this change, - to assist in de-duping cache hits for watchers. - - callbackQueue: The queue to call the completion block on. Defaults to `DispatchQueue.main`. - - completion: [optional] A completion block to be called after records are merged into the cache. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| records | The records to be merged into the cache. | -| identifier | [optional] A unique identifier for the request that kicked off this change, to assist in de-duping cache hits for watchers. | -| callbackQueue | The queue to call the completion block on. Defaults to `DispatchQueue.main`. | -| completion | [optional] A completion block to be called after records are merged into the cache. | - -### `withinReadTransaction(_:callbackQueue:completion:)` - -```swift -public func withinReadTransaction(_ body: @escaping (ReadTransaction) throws -> T, - callbackQueue: DispatchQueue? = nil, - completion: ((Result) -> Void)? = nil) -``` - -Performs an operation within a read transaction - -- Parameters: - - body: The body of the operation to perform. - - callbackQueue: [optional] The callback queue to use to perform the completion block on. Will perform on the current queue if not provided. Defaults to nil. - - completion: [optional] The completion block to perform when the read transaction completes. Defaults to nil. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| body | The body of the operation to perform. | -| callbackQueue | [optional] The callback queue to use to perform the completion block on. Will perform on the current queue if not provided. Defaults to nil. | -| completion | [optional] The completion block to perform when the read transaction completes. Defaults to nil. | - -### `withinReadWriteTransaction(_:callbackQueue:completion:)` - -```swift -public func withinReadWriteTransaction(_ body: @escaping (ReadWriteTransaction) throws -> T, - callbackQueue: DispatchQueue? = nil, - completion: ((Result) -> Void)? = nil) -``` - -Performs an operation within a read-write transaction - -- Parameters: - - body: The body of the operation to perform - - callbackQueue: [optional] a callback queue to perform the action on. Will perform on the current queue if not provided. Defaults to nil. - - completion: [optional] a completion block to fire when the read-write transaction completes. Defaults to nil. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| body | The body of the operation to perform | -| callbackQueue | [optional] a callback queue to perform the action on. Will perform on the current queue if not provided. Defaults to nil. | -| completion | [optional] a completion block to fire when the read-write transaction completes. Defaults to nil. | - -### `load(_:callbackQueue:resultHandler:)` - -```swift -public func load(_ operation: Operation, callbackQueue: DispatchQueue? = nil, resultHandler: @escaping GraphQLResultHandler) -``` - -Loads the results for the given query from the cache. - -- Parameters: - - query: The query to load results for - - resultHandler: The completion handler to execute on success or error - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| query | The query to load results for | -| resultHandler | The completion handler to execute on success or error | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/DefaultInterceptorProvider.md b/docs/source/api/Apollo/classes/DefaultInterceptorProvider.md deleted file mode 100644 index 4567088371..0000000000 --- a/docs/source/api/Apollo/classes/DefaultInterceptorProvider.md +++ /dev/null @@ -1,63 +0,0 @@ -**CLASS** - -# `DefaultInterceptorProvider` - -```swift -open class DefaultInterceptorProvider: InterceptorProvider -``` - -The default interceptor provider for typescript-generated code - -## Methods -### `init(client:shouldInvalidateClientOnDeinit:store:)` - -```swift -public init(client: URLSessionClient = URLSessionClient(), - shouldInvalidateClientOnDeinit: Bool = true, - store: ApolloStore) -``` - -Designated initializer - -- Parameters: - - client: The `URLSessionClient` to use. Defaults to the default setup. - - shouldInvalidateClientOnDeinit: If the passed-in client should be invalidated when this interceptor provider is deinitialized. If you are recreating the `URLSessionClient` every time you create a new provider, you should do this to prevent memory leaks. Defaults to true, since by default we provide a `URLSessionClient` to new instances. - - store: The `ApolloStore` to use when reading from or writing to the cache. Make sure you pass the same store to the `ApolloClient` instance you're planning to use. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| client | The `URLSessionClient` to use. Defaults to the default setup. | -| shouldInvalidateClientOnDeinit | If the passed-in client should be invalidated when this interceptor provider is deinitialized. If you are recreating the `URLSessionClient` every time you create a new provider, you should do this to prevent memory leaks. Defaults to true, since by default we provide a `URLSessionClient` to new instances. | -| store | The `ApolloStore` to use when reading from or writing to the cache. Make sure you pass the same store to the `ApolloClient` instance you’re planning to use. | - -### `deinit` - -```swift -deinit -``` - -### `interceptors(for:)` - -```swift -open func interceptors(for operation: Operation) -> [ApolloInterceptor] -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to provide interceptors for | - -### `additionalErrorInterceptor(for:)` - -```swift -open func additionalErrorInterceptor(for operation: Operation) -> ApolloErrorInterceptor? -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to provide an additional error interceptor for | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/EmptyCancellable.md b/docs/source/api/Apollo/classes/EmptyCancellable.md deleted file mode 100644 index 0e24e5d808..0000000000 --- a/docs/source/api/Apollo/classes/EmptyCancellable.md +++ /dev/null @@ -1,22 +0,0 @@ -**CLASS** - -# `EmptyCancellable` - -```swift -public final class EmptyCancellable: Cancellable -``` - -A class to return when we need to bail out of something which still needs to return `Cancellable`. - -## Methods -### `init()` - -```swift -public init() -``` - -### `cancel()` - -```swift -public func cancel() -``` diff --git a/docs/source/api/Apollo/classes/GraphQLQueryWatcher.md b/docs/source/api/Apollo/classes/GraphQLQueryWatcher.md deleted file mode 100644 index c1d68f0812..0000000000 --- a/docs/source/api/Apollo/classes/GraphQLQueryWatcher.md +++ /dev/null @@ -1,61 +0,0 @@ -**CLASS** - -# `GraphQLQueryWatcher` - -```swift -public final class GraphQLQueryWatcher: Cancellable, ApolloStoreSubscriber -``` - -A `GraphQLQueryWatcher` is responsible for watching the store, and calling the result handler with a new result whenever any of the data the previous result depends on changes. - -NOTE: The store retains the watcher while subscribed. You must call `cancel()` on your query watcher when you no longer need results. Failure to call `cancel()` before releasing your reference to the returned watcher will result in a memory leak. - -## Properties -### `query` - -```swift -public let query: Query -``` - -## Methods -### `init(client:query:callbackQueue:resultHandler:)` - -```swift -public init(client: ApolloClientProtocol, - query: Query, - callbackQueue: DispatchQueue = .main, - resultHandler: @escaping GraphQLResultHandler) -``` - -Designated initializer - -- Parameters: - - client: The client protocol to pass in. - - query: The query to watch. - - callbackQueue: The queue for the result handler. Defaults to the main queue. - - resultHandler: The result handler to call with changes. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| client | The client protocol to pass in. | -| query | The query to watch. | -| callbackQueue | The queue for the result handler. Defaults to the main queue. | -| resultHandler | The result handler to call with changes. | - -### `refetch(cachePolicy:)` - -```swift -public func refetch(cachePolicy: CachePolicy = .fetchIgnoringCacheData) -``` - -Refetch a query from the server. - -### `cancel()` - -```swift -public func cancel() -``` - -Cancel any in progress fetching operations and unsubscribe from the store. diff --git a/docs/source/api/Apollo/classes/GraphQLResponse.md b/docs/source/api/Apollo/classes/GraphQLResponse.md deleted file mode 100644 index bc4ace0af5..0000000000 --- a/docs/source/api/Apollo/classes/GraphQLResponse.md +++ /dev/null @@ -1,45 +0,0 @@ -**CLASS** - -# `GraphQLResponse` - -```swift -public final class GraphQLResponse -``` - -Represents a GraphQL response received from a server. - -## Properties -### `body` - -```swift -public let body: JSONObject -``` - -## Methods -### `init(operation:body:)` - -```swift -public init(operation: Operation, body: JSONObject) where Operation.Data == Data -``` - -### `parseResult()` - -```swift -public func parseResult() throws -> (GraphQLResult, RecordSet?) -``` - -Parses a response into a `GraphQLResult` and a `RecordSet`. -The result can be sent to a completion block for a request. -The `RecordSet` can be merged into a local cache. -- Returns: A `GraphQLResult` and a `RecordSet`. - -### `parseResultFast()` - -```swift -public func parseResultFast() throws -> GraphQLResult -``` - -Parses a response into a `GraphQLResult` for use without the cache. This parsing does not -create dependent keys or a `RecordSet` for the cache. - -This is faster than `parseResult()` and should be used when cache the response is not needed. diff --git a/docs/source/api/Apollo/classes/HTTPRequest.md b/docs/source/api/Apollo/classes/HTTPRequest.md deleted file mode 100644 index 0b309708ef..0000000000 --- a/docs/source/api/Apollo/classes/HTTPRequest.md +++ /dev/null @@ -1,137 +0,0 @@ -**CLASS** - -# `HTTPRequest` - -```swift -open class HTTPRequest: Hashable -``` - -Encapsulation of all information about a request before it hits the network - -## Properties -### `graphQLEndpoint` - -```swift -open var graphQLEndpoint: URL -``` - -The endpoint to make a GraphQL request to - -### `operation` - -```swift -open var operation: Operation -``` - -The GraphQL Operation to execute - -### `additionalHeaders` - -```swift -open var additionalHeaders: [String: String] -``` - -Any additional headers you wish to add by default to this request - -### `cachePolicy` - -```swift -open var cachePolicy: CachePolicy -``` - -The `CachePolicy` to use for this request. - -### `contextIdentifier` - -```swift -public let contextIdentifier: UUID? -``` - -[optional] A unique identifier for this request, to help with deduping cache hits for watchers. - -## Methods -### `init(graphQLEndpoint:operation:contextIdentifier:contentType:clientName:clientVersion:additionalHeaders:cachePolicy:)` - -```swift -public init(graphQLEndpoint: URL, - operation: Operation, - contextIdentifier: UUID? = nil, - contentType: String, - clientName: String, - clientVersion: String, - additionalHeaders: [String: String], - cachePolicy: CachePolicy = .default) -``` - -Designated Initializer - -- Parameters: - - graphQLEndpoint: The endpoint to make a GraphQL request to - - operation: The GraphQL Operation to execute - - contextIdentifier: [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. - - contentType: The `Content-Type` header's value. Should usually be set for you by a subclass. - - clientName: The name of the client to send with the `"apollographql-client-name"` header - - clientVersion: The version of the client to send with the `"apollographql-client-version"` header - - additionalHeaders: Any additional headers you wish to add by default to this request. - - cachePolicy: The `CachePolicy` to use for this request. Defaults to the `.default` policy - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| graphQLEndpoint | The endpoint to make a GraphQL request to | -| operation | The GraphQL Operation to execute | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. | -| contentType | The `Content-Type` header’s value. Should usually be set for you by a subclass. | -| clientName | The name of the client to send with the `"apollographql-client-name"` header | -| clientVersion | The version of the client to send with the `"apollographql-client-version"` header | -| additionalHeaders | Any additional headers you wish to add by default to this request. | -| cachePolicy | The `CachePolicy` to use for this request. Defaults to the `.default` policy | - -### `addHeader(name:value:)` - -```swift -open func addHeader(name: String, value: String) -``` - -### `updateContentType(to:)` - -```swift -open func updateContentType(to contentType: String) -``` - -### `toURLRequest()` - -```swift -open func toURLRequest() throws -> URLRequest -``` - -Converts this object to a fully fleshed-out `URLRequest` - -- Throws: Any error in creating the request -- Returns: The URL request, ready to send to your server. - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func == (lhs: HTTPRequest, rhs: HTTPRequest) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/HTTPResponse.md b/docs/source/api/Apollo/classes/HTTPResponse.md deleted file mode 100644 index fcf0600de6..0000000000 --- a/docs/source/api/Apollo/classes/HTTPResponse.md +++ /dev/null @@ -1,67 +0,0 @@ -**CLASS** - -# `HTTPResponse` - -```swift -public class HTTPResponse -``` - -Data about a response received by an HTTP request. - -## Properties -### `httpResponse` - -```swift -public var httpResponse: HTTPURLResponse -``` - -The `HTTPURLResponse` received from the URL loading system - -### `rawData` - -```swift -public var rawData: Data -``` - -The raw data received from the URL loading system - -### `parsedResponse` - -```swift -public var parsedResponse: GraphQLResult? -``` - -[optional] The data as parsed into a `GraphQLResult`, which can eventually be returned to the UI. Will be nil if not yet parsed. - -### `legacyResponse` - -```swift -public var legacyResponse: GraphQLResponse? = nil -``` - -[optional] The data as parsed into a `GraphQLResponse` for legacy caching purposes. If you're not using the `JSONResponseParsingInterceptor`, you probably shouldn't be using this property. -**NOTE:** This property will be removed when the transition to the Swift Codegen is complete. - -## Methods -### `init(response:rawData:parsedResponse:)` - -```swift -public init(response: HTTPURLResponse, - rawData: Data, - parsedResponse: GraphQLResult?) -``` - -Designated initializer - -- Parameters: - - response: The `HTTPURLResponse` received from the server. - - rawData: The raw, unparsed data received from the server. - - parsedResponse: [optional] The response parsed into the `ParsedValue` type. Will be nil if not yet parsed, or if parsing failed. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| response | The `HTTPURLResponse` received from the server. | -| rawData | The raw, unparsed data received from the server. | -| parsedResponse | [optional] The response parsed into the `ParsedValue` type. Will be nil if not yet parsed, or if parsing failed. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/InMemoryNormalizedCache.md b/docs/source/api/Apollo/classes/InMemoryNormalizedCache.md deleted file mode 100644 index d815fe5d02..0000000000 --- a/docs/source/api/Apollo/classes/InMemoryNormalizedCache.md +++ /dev/null @@ -1,68 +0,0 @@ -**CLASS** - -# `InMemoryNormalizedCache` - -```swift -public final class InMemoryNormalizedCache: NormalizedCache -``` - -## Methods -### `init(records:)` - -```swift -public init(records: RecordSet = RecordSet()) -``` - -### `loadRecords(forKeys:)` - -```swift -public func loadRecords(forKeys keys: Set) throws -> [CacheKey: Record] -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache keys to load data for | - -### `removeRecord(for:)` - -```swift -public func removeRecord(for key: CacheKey) throws -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache key to remove the record for | - -### `merge(records:)` - -```swift -public func merge(records newRecords: RecordSet) throws -> Set -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| records | The set of records to merge. | - -### `removeRecords(matching:)` - -```swift -public func removeRecords(matching pattern: CacheKey) throws -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pattern | The pattern that will be applied to find matching keys. | - -### `clear()` - -```swift -public func clear() -``` diff --git a/docs/source/api/Apollo/classes/JSONRequest.md b/docs/source/api/Apollo/classes/JSONRequest.md deleted file mode 100644 index de0a96e8d0..0000000000 --- a/docs/source/api/Apollo/classes/JSONRequest.md +++ /dev/null @@ -1,120 +0,0 @@ -**CLASS** - -# `JSONRequest` - -```swift -open class JSONRequest: HTTPRequest -``` - -A request which sends JSON related to a GraphQL operation. - -## Properties -### `requestBodyCreator` - -```swift -public let requestBodyCreator: RequestBodyCreator -``` - -### `autoPersistQueries` - -```swift -public let autoPersistQueries: Bool -``` - -### `useGETForQueries` - -```swift -public let useGETForQueries: Bool -``` - -### `useGETForPersistedQueryRetry` - -```swift -public let useGETForPersistedQueryRetry: Bool -``` - -### `isPersistedQueryRetry` - -```swift -public var isPersistedQueryRetry = false -``` - -### `body` - -```swift -public var body: JSONEncodableDictionary -``` - -### `serializationFormat` - -```swift -public let serializationFormat = JSONSerializationFormat.self -``` - -## Methods -### `init(operation:graphQLEndpoint:contextIdentifier:clientName:clientVersion:additionalHeaders:cachePolicy:autoPersistQueries:useGETForQueries:useGETForPersistedQueryRetry:requestBodyCreator:)` - -```swift -public init( - operation: Operation, - graphQLEndpoint: URL, - contextIdentifier: UUID? = nil, - clientName: String, - clientVersion: String, - additionalHeaders: [String: String] = [:], - cachePolicy: CachePolicy = .default, - autoPersistQueries: Bool = false, - useGETForQueries: Bool = false, - useGETForPersistedQueryRetry: Bool = false, - requestBodyCreator: RequestBodyCreator = ApolloRequestBodyCreator() -) -``` - -Designated initializer - -- Parameters: - - operation: The GraphQL Operation to execute - - graphQLEndpoint: The endpoint to make a GraphQL request to - - contextIdentifier: [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. - - clientName: The name of the client to send with the `"apollographql-client-name"` header - - clientVersion: The version of the client to send with the `"apollographql-client-version"` header - - additionalHeaders: Any additional headers you wish to add by default to this request - - cachePolicy: The `CachePolicy` to use for this request. - - autoPersistQueries: `true` if Auto-Persisted Queries should be used. Defaults to `false`. - - useGETForQueries: `true` if Queries should use `GET` instead of `POST` for HTTP requests. Defaults to `false`. - - useGETForPersistedQueryRetry: `true` if when an Auto-Persisted query is retried, it should use `GET` instead of `POST` to send the query. Defaults to `false`. - - requestBodyCreator: An object conforming to the `RequestBodyCreator` protocol to assist with creating the request body. Defaults to the provided `ApolloRequestBodyCreator` implementation. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The GraphQL Operation to execute | -| graphQLEndpoint | The endpoint to make a GraphQL request to | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. | -| clientName | The name of the client to send with the `"apollographql-client-name"` header | -| clientVersion | The version of the client to send with the `"apollographql-client-version"` header | -| additionalHeaders | Any additional headers you wish to add by default to this request | -| cachePolicy | The `CachePolicy` to use for this request. | -| autoPersistQueries | `true` if Auto-Persisted Queries should be used. Defaults to `false`. | -| useGETForQueries | `true` if Queries should use `GET` instead of `POST` for HTTP requests. Defaults to `false`. | -| useGETForPersistedQueryRetry | `true` if when an Auto-Persisted query is retried, it should use `GET` instead of `POST` to send the query. Defaults to `false`. | -| requestBodyCreator | An object conforming to the `RequestBodyCreator` protocol to assist with creating the request body. Defaults to the provided `ApolloRequestBodyCreator` implementation. | - -### `toURLRequest()` - -```swift -open override func toURLRequest() throws -> URLRequest -``` - -### `==(_:_:)` - -```swift -public static func == (lhs: JSONRequest, rhs: JSONRequest) -> Bool -``` - -### `hash(into:)` - -```swift -public override func hash(into hasher: inout Hasher) -``` diff --git a/docs/source/api/Apollo/classes/JSONSerializationFormat.md b/docs/source/api/Apollo/classes/JSONSerializationFormat.md deleted file mode 100644 index 6fb67c3707..0000000000 --- a/docs/source/api/Apollo/classes/JSONSerializationFormat.md +++ /dev/null @@ -1,26 +0,0 @@ -**CLASS** - -# `JSONSerializationFormat` - -```swift -public final class JSONSerializationFormat -``` - -## Methods -### `serialize(value:)` - -```swift -public class func serialize(value: JSONEncodable) throws -> Data -``` - -### `serialize(value:)` - -```swift -public class func serialize(value: JSONObject) throws -> Data -``` - -### `deserialize(data:)` - -```swift -public class func deserialize(data: Data) throws -> JSONValue -``` diff --git a/docs/source/api/Apollo/classes/MaxRetryInterceptor.md b/docs/source/api/Apollo/classes/MaxRetryInterceptor.md deleted file mode 100644 index e023436313..0000000000 --- a/docs/source/api/Apollo/classes/MaxRetryInterceptor.md +++ /dev/null @@ -1,45 +0,0 @@ -**CLASS** - -# `MaxRetryInterceptor` - -```swift -public class MaxRetryInterceptor: ApolloInterceptor -``` - -An interceptor to enforce a maximum number of retries of any `HTTPRequest` - -## Methods -### `init(maxRetriesAllowed:)` - -```swift -public init(maxRetriesAllowed: Int = 3) -``` - -Designated initializer. - -- Parameter maxRetriesAllowed: How many times a query can be retried, in addition to the initial attempt before - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| maxRetriesAllowed | How many times a query can be retried, in addition to the initial attempt before | - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/MultipartFormData.md b/docs/source/api/Apollo/classes/MultipartFormData.md deleted file mode 100644 index 5656d8bc6f..0000000000 --- a/docs/source/api/Apollo/classes/MultipartFormData.md +++ /dev/null @@ -1,125 +0,0 @@ -**CLASS** - -# `MultipartFormData` - -```swift -public final class MultipartFormData -``` - -A helper for building out multi-part form data for upload - -## Properties -### `boundary` - -```swift -public let boundary: String -``` - -## Methods -### `init(boundary:)` - -```swift -public init(boundary: String) -``` - -Designated initializer - -- Parameter boundary: The boundary to use between parts of the form. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| boundary | The boundary to use between parts of the form. | - -### `init()` - -```swift -public convenience init() -``` - -Convenience initializer which uses a pre-defined boundary - -### `appendPart(string:name:)` - -```swift -public func appendPart(string: String, name: String) throws -``` - -Appends the passed-in string as a part of the body. - -- Parameters: - - string: The string to append - - name: The name of the part to pass along to the server - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| string | The string to append | -| name | The name of the part to pass along to the server | - -### `appendPart(data:name:contentType:filename:)` - -```swift -public func appendPart(data: Data, - name: String, - contentType: String? = nil, - filename: String? = nil) -``` - -Appends the passed-in data as a part of the body. - -- Parameters: - - data: The data to append - - name: The name of the part to pass along to the server - - contentType: [optional] The content type of this part. Defaults to nil. - - filename: [optional] The name of the file for this part. Defaults to nil. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| data | The data to append | -| name | The name of the part to pass along to the server | -| contentType | [optional] The content type of this part. Defaults to nil. | -| filename | [optional] The name of the file for this part. Defaults to nil. | - -### `appendPart(inputStream:contentLength:name:contentType:filename:)` - -```swift -public func appendPart(inputStream: InputStream, - contentLength: UInt64, - name: String, - contentType: String? = nil, - filename: String? = nil) -``` - -Appends the passed-in input stream as a part of the body. - -- Parameters: - - inputStream: The input stream to append. - - contentLength: Length of the input stream data. - - name: The name of the part to pass along to the server - - contentType: [optional] The content type of this part. Defaults to nil. - - filename: [optional] The name of the file for this part. Defaults to nil. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| inputStream | The input stream to append. | -| contentLength | Length of the input stream data. | -| name | The name of the part to pass along to the server | -| contentType | [optional] The content type of this part. Defaults to nil. | -| filename | [optional] The name of the file for this part. Defaults to nil. | - -### `encode()` - -```swift -public func encode() throws -> Data -``` - -Encodes everything into the final form data to send to a server. - -- Returns: The final form data to send to a server. diff --git a/docs/source/api/Apollo/classes/NetworkFetchInterceptor.md b/docs/source/api/Apollo/classes/NetworkFetchInterceptor.md deleted file mode 100644 index a4fda369ae..0000000000 --- a/docs/source/api/Apollo/classes/NetworkFetchInterceptor.md +++ /dev/null @@ -1,51 +0,0 @@ -**CLASS** - -# `NetworkFetchInterceptor` - -```swift -public class NetworkFetchInterceptor: ApolloInterceptor, Cancellable -``` - -An interceptor which actually fetches data from the network. - -## Methods -### `init(client:)` - -```swift -public init(client: URLSessionClient) -``` - -Designated initializer. - -- Parameter client: The `URLSessionClient` to use to fetch data - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| client | The `URLSessionClient` to use to fetch data | - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | - -### `cancel()` - -```swift -public func cancel() -``` diff --git a/docs/source/api/Apollo/classes/RequestChain.md b/docs/source/api/Apollo/classes/RequestChain.md deleted file mode 100644 index 26e9ea1e82..0000000000 --- a/docs/source/api/Apollo/classes/RequestChain.md +++ /dev/null @@ -1,172 +0,0 @@ -**CLASS** - -# `RequestChain` - -```swift -public class RequestChain: Cancellable -``` - -A chain that allows a single network request to be created and executed. - -## Properties -### `isNotCancelled` - -```swift -public var isNotCancelled: Bool -``` - -Checks the underlying value of `isCancelled`. Set up like this for better readability in `guard` statements - -### `additionalErrorHandler` - -```swift -public var additionalErrorHandler: ApolloErrorInterceptor? -``` - -Something which allows additional error handling to occur when some kind of error has happened. - -## Methods -### `init(interceptors:callbackQueue:)` - -```swift -public init(interceptors: [ApolloInterceptor], - callbackQueue: DispatchQueue = .main) -``` - -Creates a chain with the given interceptor array. - -- Parameters: - - interceptors: The array of interceptors to use. - - callbackQueue: The `DispatchQueue` to call back on when an error or result occurs. Defaults to `.main`. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| interceptors | The array of interceptors to use. | -| callbackQueue | The `DispatchQueue` to call back on when an error or result occurs. Defaults to `.main`. | - -### `kickoff(request:completion:)` - -```swift -public func kickoff( - request: HTTPRequest, - completion: @escaping (Result, Error>) -> Void) -``` - -Kicks off the request from the beginning of the interceptor array. - -- Parameters: - - request: The request to send. - - completion: The completion closure to call when the request has completed. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | The request to send. | -| completion | The completion closure to call when the request has completed. | - -### `proceedAsync(request:response:completion:)` - -```swift -public func proceedAsync( - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -Proceeds to the next interceptor in the array. - -- Parameters: - - request: The in-progress request object - - response: [optional] The in-progress response object, if received yet - - completion: The completion closure to call when data has been processed and should be returned to the UI. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | The in-progress request object | -| response | [optional] The in-progress response object, if received yet | -| completion | The completion closure to call when data has been processed and should be returned to the UI. | - -### `cancel()` - -```swift -public func cancel() -``` - -Cancels the entire chain of interceptors. - -### `retry(request:completion:)` - -```swift -public func retry( - request: HTTPRequest, - completion: @escaping (Result, Error>) -> Void) -``` - -Restarts the request starting from the first interceptor. - -- Parameters: - - request: The request to retry - - completion: The completion closure to call when the request has completed. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | The request to retry | -| completion | The completion closure to call when the request has completed. | - -### `handleErrorAsync(_:request:response:completion:)` - -```swift -public func handleErrorAsync( - _ error: Error, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -Handles the error by returning it on the appropriate queue, or by applying an additional error interceptor if one has been provided. - -- Parameters: - - error: The error to handle - - request: The request, as far as it has been constructed. - - response: The response, as far as it has been constructed. - - completion: The completion closure to call when work is complete. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| error | The error to handle | -| request | The request, as far as it has been constructed. | -| response | The response, as far as it has been constructed. | -| completion | The completion closure to call when work is complete. | - -### `returnValueAsync(for:value:completion:)` - -```swift -public func returnValueAsync( - for request: HTTPRequest, - value: GraphQLResult, - completion: @escaping (Result, Error>) -> Void) -``` - -Handles a resulting value by returning it on the appropriate queue. - -- Parameters: - - request: The request, as far as it has been constructed. - - value: The value to be returned - - completion: The completion closure to call when work is complete. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | The request, as far as it has been constructed. | -| value | The value to be returned | -| completion | The completion closure to call when work is complete. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/RequestChainNetworkTransport.md b/docs/source/api/Apollo/classes/RequestChainNetworkTransport.md deleted file mode 100644 index 9a608d2ab6..0000000000 --- a/docs/source/api/Apollo/classes/RequestChainNetworkTransport.md +++ /dev/null @@ -1,155 +0,0 @@ -**CLASS** - -# `RequestChainNetworkTransport` - -```swift -open class RequestChainNetworkTransport: NetworkTransport -``` - -An implementation of `NetworkTransport` which creates a `RequestChain` object -for each item sent through it. - -## Properties -### `endpointURL` - -```swift -public let endpointURL: URL -``` - -The GraphQL endpoint URL to use. - -### `additionalHeaders` - -```swift -public private(set) var additionalHeaders: [String: String] -``` - -Any additional headers that should be automatically added to every request. - -### `autoPersistQueries` - -```swift -public let autoPersistQueries: Bool -``` - -Set to `true` if Automatic Persisted Queries should be used to send a query hash instead of the full query body by default. - -### `useGETForQueries` - -```swift -public let useGETForQueries: Bool -``` - -Set to `true` if you want to use `GET` instead of `POST` for queries, for example to take advantage of a CDN. - -### `useGETForPersistedQueryRetry` - -```swift -public let useGETForPersistedQueryRetry: Bool -``` - -Set to `true` to use `GET` instead of `POST` for a retry of a persisted query. - -### `requestBodyCreator` - -```swift -public var requestBodyCreator: RequestBodyCreator -``` - -The `RequestBodyCreator` object to use to build your `URLRequest`. - -### `clientName` - -```swift -public var clientName = RequestChainNetworkTransport.defaultClientName -``` - -### `clientVersion` - -```swift -public var clientVersion = RequestChainNetworkTransport.defaultClientVersion -``` - -## Methods -### `init(interceptorProvider:endpointURL:additionalHeaders:autoPersistQueries:requestBodyCreator:useGETForQueries:useGETForPersistedQueryRetry:)` - -```swift -public init(interceptorProvider: InterceptorProvider, - endpointURL: URL, - additionalHeaders: [String: String] = [:], - autoPersistQueries: Bool = false, - requestBodyCreator: RequestBodyCreator = ApolloRequestBodyCreator(), - useGETForQueries: Bool = false, - useGETForPersistedQueryRetry: Bool = false) -``` - -Designated initializer - -- Parameters: - - interceptorProvider: The interceptor provider to use when constructing chains for a request - - endpointURL: The GraphQL endpoint URL to use. - - additionalHeaders: Any additional headers that should be automatically added to every request. Defaults to an empty dictionary. - - autoPersistQueries: Pass `true` if Automatic Persisted Queries should be used to send a query hash instead of the full query body by default. Defaults to `false`. - - requestBodyCreator: The `RequestBodyCreator` object to use to build your `URLRequest`. Defaults to the provided `ApolloRequestBodyCreator` implementation. - - useGETForQueries: Pass `true` if you want to use `GET` instead of `POST` for queries, for example to take advantage of a CDN. Defaults to `false`. - - useGETForPersistedQueryRetry: Pass `true` to use `GET` instead of `POST` for a retry of a persisted query. Defaults to `false`. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| interceptorProvider | The interceptor provider to use when constructing chains for a request | -| endpointURL | The GraphQL endpoint URL to use. | -| additionalHeaders | Any additional headers that should be automatically added to every request. Defaults to an empty dictionary. | -| autoPersistQueries | Pass `true` if Automatic Persisted Queries should be used to send a query hash instead of the full query body by default. Defaults to `false`. | -| requestBodyCreator | The `RequestBodyCreator` object to use to build your `URLRequest`. Defaults to the provided `ApolloRequestBodyCreator` implementation. | -| useGETForQueries | Pass `true` if you want to use `GET` instead of `POST` for queries, for example to take advantage of a CDN. Defaults to `false`. | -| useGETForPersistedQueryRetry | Pass `true` to use `GET` instead of `POST` for a retry of a persisted query. Defaults to `false`. | - -### `constructRequest(for:cachePolicy:contextIdentifier:)` - -```swift -open func constructRequest( - for operation: Operation, - cachePolicy: CachePolicy, - contextIdentifier: UUID? = nil) -> HTTPRequest -``` - -Constructs a default (ie, non-multipart) GraphQL request. - -Override this method if you need to use a custom subclass of `HTTPRequest`. - -- Parameters: - - operation: The operation to create the request for - - cachePolicy: The `CachePolicy` to use when creating the request - - contextIdentifier: [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Should default to `nil`. -- Returns: The constructed request. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to create the request for | -| cachePolicy | The `CachePolicy` to use when creating the request | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Should default to `nil`. | - -### `send(operation:cachePolicy:contextIdentifier:callbackQueue:completionHandler:)` - -```swift -public func send( - operation: Operation, - cachePolicy: CachePolicy = .default, - contextIdentifier: UUID? = nil, - callbackQueue: DispatchQueue = .main, - completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send. | -| cachePolicy | The `CachePolicy` to use making this request. | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | A closure to call when a request completes. On `success` will contain the response received from the server. On `failure` will contain the error which occurred. | \ No newline at end of file diff --git a/docs/source/api/Apollo/classes/TaskData.md b/docs/source/api/Apollo/classes/TaskData.md deleted file mode 100644 index 606e221627..0000000000 --- a/docs/source/api/Apollo/classes/TaskData.md +++ /dev/null @@ -1,22 +0,0 @@ -**CLASS** - -# `TaskData` - -```swift -public class TaskData -``` - -A wrapper for data about a particular task handled by `URLSessionClient` - -## Properties -### `rawCompletion` - -```swift -public let rawCompletion: URLSessionClient.RawCompletion? -``` - -### `completionBlock` - -```swift -public let completionBlock: URLSessionClient.Completion -``` diff --git a/docs/source/api/Apollo/classes/URLSessionClient.md b/docs/source/api/Apollo/classes/URLSessionClient.md deleted file mode 100644 index 94b6a55712..0000000000 --- a/docs/source/api/Apollo/classes/URLSessionClient.md +++ /dev/null @@ -1,252 +0,0 @@ -**CLASS** - -# `URLSessionClient` - -```swift -open class URLSessionClient: NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate -``` - -A class to handle URL Session calls that will support background execution, -but still (mostly) use callbacks for its primary method of communication. - -**NOTE:** Delegate methods implemented here are not documented inline because -Apple has their own documentation for them. Please consult Apple's -documentation for how the delegate methods work and what needs to be overridden -and handled within your app, particularly in regards to what needs to be called -when for background sessions. - -## Properties -### `session` - -```swift -open private(set) var session: URLSession! -``` - -The raw URLSession being used for this client - -## Methods -### `init(sessionConfiguration:callbackQueue:)` - -```swift -public init(sessionConfiguration: URLSessionConfiguration = .default, - callbackQueue: OperationQueue? = .main) -``` - -Designated initializer. - -- Parameters: - - sessionConfiguration: The `URLSessionConfiguration` to use to set up the URL session. - - callbackQueue: [optional] The `OperationQueue` to tell the URL session to call back to this class on, which will in turn call back to your class. Defaults to `.main`. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| sessionConfiguration | The `URLSessionConfiguration` to use to set up the URL session. | -| callbackQueue | [optional] The `OperationQueue` to tell the URL session to call back to this class on, which will in turn call back to your class. Defaults to `.main`. | - -### `invalidate()` - -```swift -public func invalidate() -``` - -Cleans up and invalidates everything related to this session client. - -NOTE: This must be called from the `deinit` of anything holding onto this client in order to break a retain cycle with the delegate. - -### `clear(task:)` - -```swift -open func clear(task identifier: Int) -``` - -Clears underlying dictionaries of any data related to a particular task identifier. - -- Parameter identifier: The identifier of the task to clear. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| identifier | The identifier of the task to clear. | - -### `clearAllTasks()` - -```swift -open func clearAllTasks() -``` - -Clears underlying dictionaries of any data related to all tasks. - -Mostly useful for cleanup and/or after invalidation of the `URLSession`. - -### `sendRequest(_:rawTaskCompletionHandler:completion:)` - -```swift -open func sendRequest(_ request: URLRequest, - rawTaskCompletionHandler: RawCompletion? = nil, - completion: @escaping Completion) -> URLSessionTask -``` - -The main method to perform a request. - -- Parameters: - - request: The request to perform. - - rawTaskCompletionHandler: [optional] A completion handler to call once the raw task is done, so if an Error requires access to the headers, the user can still access these. - - completion: A completion handler to call when the task has either completed successfully or failed. - -- Returns: The created URLSession task, already resumed, because nobody ever remembers to call `resume()`. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | The request to perform. | -| rawTaskCompletionHandler | [optional] A completion handler to call once the raw task is done, so if an Error requires access to the headers, the user can still access these. | -| completion | A completion handler to call when the task has either completed successfully or failed. | - -### `cancel(task:)` - -```swift -open func cancel(task: URLSessionTask) -``` - -Cancels a given task and clears out its underlying data. - -NOTE: You will not receive any kind of "This was cancelled" error when this is called. - -- Parameter task: The task you wish to cancel. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| task | The task you wish to cancel. | - -### `urlSession(_:didBecomeInvalidWithError:)` - -```swift -open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) -``` - -### `urlSession(_:task:didFinishCollecting:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - didFinishCollecting metrics: URLSessionTaskMetrics) -``` - -### `urlSession(_:didReceive:completionHandler:)` - -```swift -open func urlSession(_ session: URLSession, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -``` - -### `urlSessionDidFinishEvents(forBackgroundURLSession:)` - -### `urlSession(_:task:didReceive:completionHandler:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -``` - -### `urlSession(_:taskIsWaitingForConnectivity:)` - -```swift -open func urlSession(_ session: URLSession, - taskIsWaitingForConnectivity task: URLSessionTask) -``` - -### `urlSession(_:task:didCompleteWithError:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - didCompleteWithError error: Error?) -``` - -### `urlSession(_:task:needNewBodyStream:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) -``` - -### `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - didSendBodyData bytesSent: Int64, - totalBytesSent: Int64, - totalBytesExpectedToSend: Int64) -``` - -### `urlSession(_:task:willBeginDelayedRequest:completionHandler:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - willBeginDelayedRequest request: URLRequest, - completionHandler: @escaping (URLSession.DelayedRequestDisposition, URLRequest?) -> Void) -``` - -### `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` - -```swift -open func urlSession(_ session: URLSession, - task: URLSessionTask, - willPerformHTTPRedirection response: HTTPURLResponse, - newRequest request: URLRequest, - completionHandler: @escaping (URLRequest?) -> Void) -``` - -### `urlSession(_:dataTask:didReceive:)` - -```swift -open func urlSession(_ session: URLSession, - dataTask: URLSessionDataTask, - didReceive data: Data) -``` - -### `urlSession(_:dataTask:didBecome:)` - -```swift -open func urlSession(_ session: URLSession, - dataTask: URLSessionDataTask, - didBecome streamTask: URLSessionStreamTask) -``` - -### `urlSession(_:dataTask:didBecome:)` - -```swift -open func urlSession(_ session: URLSession, - dataTask: URLSessionDataTask, - didBecome downloadTask: URLSessionDownloadTask) -``` - -### `urlSession(_:dataTask:willCacheResponse:completionHandler:)` - -```swift -open func urlSession(_ session: URLSession, - dataTask: URLSessionDataTask, - willCacheResponse proposedResponse: CachedURLResponse, - completionHandler: @escaping (CachedURLResponse?) -> Void) -``` - -### `urlSession(_:dataTask:didReceive:completionHandler:)` - -```swift -open func urlSession(_ session: URLSession, - dataTask: URLSessionDataTask, - didReceive response: URLResponse, - completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) -``` diff --git a/docs/source/api/Apollo/classes/UploadRequest.md b/docs/source/api/Apollo/classes/UploadRequest.md deleted file mode 100644 index 686f3c23f5..0000000000 --- a/docs/source/api/Apollo/classes/UploadRequest.md +++ /dev/null @@ -1,104 +0,0 @@ -**CLASS** - -# `UploadRequest` - -```swift -open class UploadRequest: HTTPRequest -``` - -A request class allowing for a multipart-upload request. - -## Properties -### `requestBodyCreator` - -```swift -public let requestBodyCreator: RequestBodyCreator -``` - -### `files` - -```swift -public let files: [GraphQLFile] -``` - -### `manualBoundary` - -```swift -public let manualBoundary: String? -``` - -### `serializationFormat` - -```swift -public let serializationFormat = JSONSerializationFormat.self -``` - -## Methods -### `init(graphQLEndpoint:operation:clientName:clientVersion:additionalHeaders:files:manualBoundary:requestBodyCreator:)` - -```swift -public init(graphQLEndpoint: URL, - operation: Operation, - clientName: String, - clientVersion: String, - additionalHeaders: [String: String] = [:], - files: [GraphQLFile], - manualBoundary: String? = nil, - requestBodyCreator: RequestBodyCreator = ApolloRequestBodyCreator()) -``` - -Designated Initializer - -- Parameters: - - graphQLEndpoint: The endpoint to make a GraphQL request to - - operation: The GraphQL Operation to execute - - clientName: The name of the client to send with the `"apollographql-client-name"` header - - clientVersion: The version of the client to send with the `"apollographql-client-version"` header - - additionalHeaders: Any additional headers you wish to add by default to this request. Defaults to an empty dictionary. - - files: The array of files to upload for all `Upload` parameters in the mutation. - - manualBoundary: [optional] A manual boundary to pass in. A default boundary will be used otherwise. Defaults to nil. - - requestBodyCreator: An object conforming to the `RequestBodyCreator` protocol to assist with creating the request body. Defaults to the provided `ApolloRequestBodyCreator` implementation. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| graphQLEndpoint | The endpoint to make a GraphQL request to | -| operation | The GraphQL Operation to execute | -| clientName | The name of the client to send with the `"apollographql-client-name"` header | -| clientVersion | The version of the client to send with the `"apollographql-client-version"` header | -| additionalHeaders | Any additional headers you wish to add by default to this request. Defaults to an empty dictionary. | -| files | The array of files to upload for all `Upload` parameters in the mutation. | -| manualBoundary | [optional] A manual boundary to pass in. A default boundary will be used otherwise. Defaults to nil. | -| requestBodyCreator | An object conforming to the `RequestBodyCreator` protocol to assist with creating the request body. Defaults to the provided `ApolloRequestBodyCreator` implementation. | - -### `toURLRequest()` - -```swift -public override func toURLRequest() throws -> URLRequest -``` - -### `requestMultipartFormData()` - -```swift -open func requestMultipartFormData() throws -> MultipartFormData -``` - -Creates the `MultipartFormData` object to use when creating the URL Request. - -This method follows the [GraphQL Multipart Request Spec](https://github.com/jaydenseric/graphql-multipart-request-spec) Override this method to use a different upload spec. - -- Throws: Any error arising from creating the form data -- Returns: The created form data - -### `==(_:_:)` - -```swift -public static func == (lhs: UploadRequest, rhs: UploadRequest) -> Bool -``` - -### `hash(into:)` - -```swift -public override func hash(into hasher: inout Hasher) -``` diff --git a/docs/source/api/Apollo/enums/ApolloClient.ApolloClientError.md b/docs/source/api/Apollo/enums/ApolloClient.ApolloClientError.md deleted file mode 100644 index b74aa33c2f..0000000000 --- a/docs/source/api/Apollo/enums/ApolloClient.ApolloClientError.md +++ /dev/null @@ -1,21 +0,0 @@ -**ENUM** - -# `ApolloClient.ApolloClientError` - -```swift -public enum ApolloClientError: Error, LocalizedError, Hashable -``` - -## Cases -### `noUploadTransport` - -```swift -case noUploadTransport -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/AutomaticPersistedQueryInterceptor.APQError.md b/docs/source/api/Apollo/enums/AutomaticPersistedQueryInterceptor.APQError.md deleted file mode 100644 index c2b3acbb61..0000000000 --- a/docs/source/api/Apollo/enums/AutomaticPersistedQueryInterceptor.APQError.md +++ /dev/null @@ -1,27 +0,0 @@ -**ENUM** - -# `AutomaticPersistedQueryInterceptor.APQError` - -```swift -public enum APQError: LocalizedError -``` - -## Cases -### `noParsedResponse` - -```swift -case noParsedResponse -``` - -### `persistedQueryRetryFailed(operationName:)` - -```swift -case persistedQueryRetryFailed(operationName: String) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/CachePolicy.md b/docs/source/api/Apollo/enums/CachePolicy.md deleted file mode 100644 index 19b87a2e20..0000000000 --- a/docs/source/api/Apollo/enums/CachePolicy.md +++ /dev/null @@ -1,59 +0,0 @@ -**ENUM** - -# `CachePolicy` - -```swift -public enum CachePolicy: Hashable -``` - -A cache policy that specifies whether results should be fetched from the server or loaded from the local cache. - -## Cases -### `returnCacheDataElseFetch` - -```swift -case returnCacheDataElseFetch -``` - -Return data from the cache if available, else fetch results from the server. - -### `fetchIgnoringCacheData` - -```swift -case fetchIgnoringCacheData -``` - -Always fetch results from the server. - -### `fetchIgnoringCacheCompletely` - -```swift -case fetchIgnoringCacheCompletely -``` - -Always fetch results from the server, and don't store these in the cache. - -### `returnCacheDataDontFetch` - -```swift -case returnCacheDataDontFetch -``` - -Return data from the cache if available, else return nil. - -### `returnCacheDataAndFetch` - -```swift -case returnCacheDataAndFetch -``` - -Return data from the cache if available, and always fetch results from the server. - -## Properties -### `default` - -```swift -public static var `default`: CachePolicy = .returnCacheDataElseFetch -``` - -The current default cache policy. diff --git a/docs/source/api/Apollo/enums/CacheWriteInterceptor.CacheWriteError.md b/docs/source/api/Apollo/enums/CacheWriteInterceptor.CacheWriteError.md deleted file mode 100644 index e8336f366a..0000000000 --- a/docs/source/api/Apollo/enums/CacheWriteInterceptor.CacheWriteError.md +++ /dev/null @@ -1,21 +0,0 @@ -**ENUM** - -# `CacheWriteInterceptor.CacheWriteError` - -```swift -public enum CacheWriteError: Error, LocalizedError -``` - -## Cases -### `noResponseToParse` - -```swift -case noResponseToParse -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/GraphQLFile.GraphQLFileError.md b/docs/source/api/Apollo/enums/GraphQLFile.GraphQLFileError.md deleted file mode 100644 index b0dc790811..0000000000 --- a/docs/source/api/Apollo/enums/GraphQLFile.GraphQLFileError.md +++ /dev/null @@ -1,27 +0,0 @@ -**ENUM** - -# `GraphQLFile.GraphQLFileError` - -```swift -public enum GraphQLFileError: Error, LocalizedError -``` - -## Cases -### `couldNotCreateInputStream` - -```swift -case couldNotCreateInputStream -``` - -### `couldNotGetFileSize(fileURL:)` - -```swift -case couldNotGetFileSize(fileURL: URL) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/GraphQLHTTPRequestError.md b/docs/source/api/Apollo/enums/GraphQLHTTPRequestError.md deleted file mode 100644 index 4d9c0c66b1..0000000000 --- a/docs/source/api/Apollo/enums/GraphQLHTTPRequestError.md +++ /dev/null @@ -1,29 +0,0 @@ -**ENUM** - -# `GraphQLHTTPRequestError` - -```swift -public enum GraphQLHTTPRequestError: Error, LocalizedError, Hashable -``` - -An error which has occurred during the serialization of a request. - -## Cases -### `serializedBodyMessageError` - -```swift -case serializedBodyMessageError -``` - -### `serializedQueryParamsMessageError` - -```swift -case serializedQueryParamsMessageError -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/GraphQLResult.Source.md b/docs/source/api/Apollo/enums/GraphQLResult.Source.md deleted file mode 100644 index f1ab68226c..0000000000 --- a/docs/source/api/Apollo/enums/GraphQLResult.Source.md +++ /dev/null @@ -1,22 +0,0 @@ -**ENUM** - -# `GraphQLResult.Source` - -```swift -public enum Source: Hashable -``` - -Represents source of data - -## Cases -### `cache` - -```swift -case cache -``` - -### `server` - -```swift -case server -``` diff --git a/docs/source/api/Apollo/enums/JSONResponseParsingInterceptor.JSONResponseParsingError.md b/docs/source/api/Apollo/enums/JSONResponseParsingInterceptor.JSONResponseParsingError.md deleted file mode 100644 index a27dc57179..0000000000 --- a/docs/source/api/Apollo/enums/JSONResponseParsingInterceptor.JSONResponseParsingError.md +++ /dev/null @@ -1,27 +0,0 @@ -**ENUM** - -# `JSONResponseParsingInterceptor.JSONResponseParsingError` - -```swift -public enum JSONResponseParsingError: Error, LocalizedError -``` - -## Cases -### `noResponseToParse` - -```swift -case noResponseToParse -``` - -### `couldNotParseToJSON(data:)` - -```swift -case couldNotParseToJSON(data: Data) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/MaxRetryInterceptor.RetryError.md b/docs/source/api/Apollo/enums/MaxRetryInterceptor.RetryError.md deleted file mode 100644 index 471d63e234..0000000000 --- a/docs/source/api/Apollo/enums/MaxRetryInterceptor.RetryError.md +++ /dev/null @@ -1,21 +0,0 @@ -**ENUM** - -# `MaxRetryInterceptor.RetryError` - -```swift -public enum RetryError: Error, LocalizedError -``` - -## Cases -### `hitMaxRetryCount(count:operationName:)` - -```swift -case hitMaxRetryCount(count: Int, operationName: String) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/RequestChain.ChainError.md b/docs/source/api/Apollo/enums/RequestChain.ChainError.md deleted file mode 100644 index 70d501464f..0000000000 --- a/docs/source/api/Apollo/enums/RequestChain.ChainError.md +++ /dev/null @@ -1,27 +0,0 @@ -**ENUM** - -# `RequestChain.ChainError` - -```swift -public enum ChainError: Error, LocalizedError -``` - -## Cases -### `invalidIndex(chain:index:)` - -```swift -case invalidIndex(chain: RequestChain, index: Int) -``` - -### `noInterceptors` - -```swift -case noInterceptors -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/ResponseCodeInterceptor.ResponseCodeError.md b/docs/source/api/Apollo/enums/ResponseCodeInterceptor.ResponseCodeError.md deleted file mode 100644 index aae6ca7d1a..0000000000 --- a/docs/source/api/Apollo/enums/ResponseCodeInterceptor.ResponseCodeError.md +++ /dev/null @@ -1,21 +0,0 @@ -**ENUM** - -# `ResponseCodeInterceptor.ResponseCodeError` - -```swift -public enum ResponseCodeError: Error, LocalizedError -``` - -## Cases -### `invalidResponseCode(response:rawData:)` - -```swift -case invalidResponseCode(response: HTTPURLResponse?, rawData: Data?) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/enums/URLSessionClient.URLSessionClientError.md b/docs/source/api/Apollo/enums/URLSessionClient.URLSessionClientError.md deleted file mode 100644 index ed476531ec..0000000000 --- a/docs/source/api/Apollo/enums/URLSessionClient.URLSessionClientError.md +++ /dev/null @@ -1,45 +0,0 @@ -**ENUM** - -# `URLSessionClient.URLSessionClientError` - -```swift -public enum URLSessionClientError: Error, LocalizedError -``` - -## Cases -### `noHTTPResponse(request:)` - -```swift -case noHTTPResponse(request: URLRequest?) -``` - -### `sessionBecameInvalidWithoutUnderlyingError` - -```swift -case sessionBecameInvalidWithoutUnderlyingError -``` - -### `dataForRequestNotFound(request:)` - -```swift -case dataForRequestNotFound(request: URLRequest?) -``` - -### `networkError(data:response:underlying:)` - -```swift -case networkError(data: Data, response: HTTPURLResponse?, underlying: Error) -``` - -### `sessionInvalidated` - -```swift -case sessionInvalidated -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/extensions/ApolloClient.md b/docs/source/api/Apollo/extensions/ApolloClient.md deleted file mode 100644 index a06170da69..0000000000 --- a/docs/source/api/Apollo/extensions/ApolloClient.md +++ /dev/null @@ -1,112 +0,0 @@ -**EXTENSION** - -# `ApolloClient` -```swift -extension ApolloClient: ApolloClientProtocol -``` - -## Methods -### `clearCache(callbackQueue:completion:)` - -```swift -public func clearCache(callbackQueue: DispatchQueue = .main, - completion: ((Result) -> Void)? = nil) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| callbackQueue | The queue to fall back on. Should default to the main queue. | -| completion | [optional] A completion closure to execute when clearing has completed. Should default to nil. | - -### `fetch(query:cachePolicy:contextIdentifier:queue:resultHandler:)` - -```swift -@discardableResult public func fetch(query: Query, - cachePolicy: CachePolicy = .default, - contextIdentifier: UUID? = nil, - queue: DispatchQueue = .main, - resultHandler: GraphQLResultHandler? = nil) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| query | The query to fetch. | -| cachePolicy | A cache policy that specifies when results should be fetched from the server and when data should be loaded from the local cache. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Should default to `nil`. | -| resultHandler | [optional] A closure that is called when query results are available or when an error occurs. | - -### `watch(query:cachePolicy:callbackQueue:resultHandler:)` - -```swift -public func watch(query: Query, - cachePolicy: CachePolicy = .default, - callbackQueue: DispatchQueue = .main, - resultHandler: @escaping GraphQLResultHandler) -> GraphQLQueryWatcher -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| query | The query to fetch. | -| cachePolicy | A cache policy that specifies when results should be fetched from the server or from the local cache. | -| callbackQueue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| resultHandler | [optional] A closure that is called when query results are available or when an error occurs. | - -### `perform(mutation:publishResultToStore:queue:resultHandler:)` - -```swift -public func perform(mutation: Mutation, - publishResultToStore: Bool = true, - queue: DispatchQueue = .main, - resultHandler: GraphQLResultHandler? = nil) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| mutation | The mutation to perform. | -| publishResultToStore | If `true`, this will publish the result returned from the operation to the cache store. Default is `true`. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| resultHandler | An optional closure that is called when mutation results are available or when an error occurs. | - -### `upload(operation:files:queue:resultHandler:)` - -```swift -public func upload(operation: Operation, - files: [GraphQLFile], - queue: DispatchQueue = .main, - resultHandler: GraphQLResultHandler? = nil) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send | -| files | An array of `GraphQLFile` objects to send. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| completionHandler | The completion handler to execute when the request completes or errors. Note that an error will be returned If your `networkTransport` does not also conform to `UploadingNetworkTransport`. | - -### `subscribe(subscription:queue:resultHandler:)` - -```swift -public func subscribe(subscription: Subscription, - queue: DispatchQueue = .main, - resultHandler: @escaping GraphQLResultHandler) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| subscription | The subscription to subscribe to. | -| fetchHTTPMethod | The HTTP Method to be used. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| resultHandler | An optional closure that is called when mutation results are available or when an error occurs. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/ApolloExtension.md b/docs/source/api/Apollo/extensions/ApolloExtension.md deleted file mode 100644 index 50cbbf1798..0000000000 --- a/docs/source/api/Apollo/extensions/ApolloExtension.md +++ /dev/null @@ -1,21 +0,0 @@ -**EXTENSION** - -# `ApolloExtension` -```swift -public extension ApolloExtension where Base == DispatchQueue -``` - -## Methods -### `performAsyncIfNeeded(on:action:)` - -```swift -static func performAsyncIfNeeded(on callbackQueue: DispatchQueue?, action: @escaping () -> Void) -``` - -### `returnResultAsyncIfNeeded(on:action:result:)` - -```swift -static func returnResultAsyncIfNeeded(on callbackQueue: DispatchQueue?, - action: ((Result) -> Void)?, - result: Result) -``` diff --git a/docs/source/api/Apollo/extensions/Dictionary.md b/docs/source/api/Apollo/extensions/Dictionary.md deleted file mode 100644 index 5a9f8e559e..0000000000 --- a/docs/source/api/Apollo/extensions/Dictionary.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Dictionary` -```swift -public extension Dictionary -``` - -## Methods -### `+=(_:_:)` - -```swift -static func += (lhs: inout Dictionary, rhs: Dictionary) -``` diff --git a/docs/source/api/Apollo/extensions/GraphQLError.md b/docs/source/api/Apollo/extensions/GraphQLError.md deleted file mode 100644 index 16cc148fb5..0000000000 --- a/docs/source/api/Apollo/extensions/GraphQLError.md +++ /dev/null @@ -1,19 +0,0 @@ -**EXTENSION** - -# `GraphQLError` -```swift -extension GraphQLError: CustomStringConvertible -``` - -## Properties -### `description` - -```swift -public var description: String -``` - -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/Apollo/extensions/GraphQLGETTransformer.md b/docs/source/api/Apollo/extensions/GraphQLGETTransformer.md deleted file mode 100644 index 57b0e6ac14..0000000000 --- a/docs/source/api/Apollo/extensions/GraphQLGETTransformer.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `GraphQLGETTransformer` -```swift -extension GraphQLGETTransformer: Hashable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: GraphQLGETTransformer, rhs: GraphQLGETTransformer) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/GraphQLResponse.md b/docs/source/api/Apollo/extensions/GraphQLResponse.md deleted file mode 100644 index a92d65153d..0000000000 --- a/docs/source/api/Apollo/extensions/GraphQLResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `GraphQLResponse` -```swift -extension GraphQLResponse: Equatable where Data: Equatable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: GraphQLResponse, rhs: GraphQLResponse) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/GraphQLResult.md b/docs/source/api/Apollo/extensions/GraphQLResult.md deleted file mode 100644 index a6d9e0d8fe..0000000000 --- a/docs/source/api/Apollo/extensions/GraphQLResult.md +++ /dev/null @@ -1,20 +0,0 @@ -**EXTENSION** - -# `GraphQLResult` -```swift -extension GraphQLResult: Equatable where Data: Equatable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: GraphQLResult, rhs: GraphQLResult) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/HTTPRequest.md b/docs/source/api/Apollo/extensions/HTTPRequest.md deleted file mode 100644 index d070c01760..0000000000 --- a/docs/source/api/Apollo/extensions/HTTPRequest.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `HTTPRequest` -```swift -extension HTTPRequest: CustomDebugStringConvertible -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` diff --git a/docs/source/api/Apollo/extensions/HTTPResponse.md b/docs/source/api/Apollo/extensions/HTTPResponse.md deleted file mode 100644 index 595439086f..0000000000 --- a/docs/source/api/Apollo/extensions/HTTPResponse.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `HTTPResponse` -```swift -extension HTTPResponse: Equatable where Operation.Data: Equatable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: HTTPResponse, rhs: HTTPResponse) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/InterceptorProvider.md b/docs/source/api/Apollo/extensions/InterceptorProvider.md deleted file mode 100644 index 2ce9788197..0000000000 --- a/docs/source/api/Apollo/extensions/InterceptorProvider.md +++ /dev/null @@ -1,19 +0,0 @@ -**EXTENSION** - -# `InterceptorProvider` -```swift -public extension InterceptorProvider -``` - -## Methods -### `additionalErrorInterceptor(for:)` - -```swift -func additionalErrorInterceptor(for operation: Operation) -> ApolloErrorInterceptor? -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to provide an additional error interceptor for | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/MultipartFormData.md b/docs/source/api/Apollo/extensions/MultipartFormData.md deleted file mode 100644 index 1ffd8af460..0000000000 --- a/docs/source/api/Apollo/extensions/MultipartFormData.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `MultipartFormData` -```swift -extension MultipartFormData: Hashable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: MultipartFormData, rhs: MultipartFormData) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/NetworkTransport.md b/docs/source/api/Apollo/extensions/NetworkTransport.md deleted file mode 100644 index 9f1cdfbb36..0000000000 --- a/docs/source/api/Apollo/extensions/NetworkTransport.md +++ /dev/null @@ -1,67 +0,0 @@ -**EXTENSION** - -# `NetworkTransport` -```swift -public extension NetworkTransport -``` - -## Properties -### `headerFieldNameApolloClientName` - -```swift -static var headerFieldNameApolloClientName: String -``` - -The field name for the Apollo Client Name header - -### `headerFieldNameApolloClientVersion` - -```swift -static var headerFieldNameApolloClientVersion: String -``` - -The field name for the Apollo Client Version header - -### `defaultClientName` - -```swift -static var defaultClientName: String -``` - -The default client name to use when setting up the `clientName` property - -### `clientName` - -```swift -var clientName: String -``` - -### `defaultClientVersion` - -```swift -static var defaultClientVersion: String -``` - -The default client version to use when setting up the `clientVersion` property. - -### `clientVersion` - -```swift -var clientVersion: String -``` - -## Methods -### `addApolloClientHeaders(to:)` - -```swift -func addApolloClientHeaders(to request: inout URLRequest) -``` - -Adds the Apollo client headers for this instance of `NetworkTransport` to the given request -- Parameter request: A mutable URLRequest to add the headers to. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | A mutable URLRequest to add the headers to. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/Record.md b/docs/source/api/Apollo/extensions/Record.md deleted file mode 100644 index b4d6770f08..0000000000 --- a/docs/source/api/Apollo/extensions/Record.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Record` -```swift -extension Record: CustomStringConvertible -``` - -## Properties -### `description` - -```swift -public var description: String -``` diff --git a/docs/source/api/Apollo/extensions/RecordSet.md b/docs/source/api/Apollo/extensions/RecordSet.md deleted file mode 100644 index 0741fa599f..0000000000 --- a/docs/source/api/Apollo/extensions/RecordSet.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `RecordSet` -```swift -extension RecordSet: ExpressibleByDictionaryLiteral -``` - -## Properties -### `description` - -```swift -public var description: String -``` - -### `debugDescription` - -```swift -public var debugDescription: String -``` - -### `playgroundDescription` - -```swift -public var playgroundDescription: Any -``` - -## Methods -### `init(dictionaryLiteral:)` - -```swift -public init(dictionaryLiteral elements: (CacheKey, Record.Fields)...) -``` diff --git a/docs/source/api/Apollo/extensions/RequestBodyCreator.md b/docs/source/api/Apollo/extensions/RequestBodyCreator.md deleted file mode 100644 index 739fdf9969..0000000000 --- a/docs/source/api/Apollo/extensions/RequestBodyCreator.md +++ /dev/null @@ -1,25 +0,0 @@ -**EXTENSION** - -# `RequestBodyCreator` -```swift -extension RequestBodyCreator -``` - -## Methods -### `requestBody(for:sendQueryDocument:autoPersistQuery:)` - -```swift -public func requestBody( - for operation: Operation, - sendQueryDocument: Bool, - autoPersistQuery: Bool -) -> JSONEncodableDictionary -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to use | -| sendQueryDocument | Whether or not to send the full query document. Should default to `true`. | -| autoPersistQuery | Whether to use auto-persisted query information. Should default to `false`. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/RequestChainNetworkTransport.md b/docs/source/api/Apollo/extensions/RequestChainNetworkTransport.md deleted file mode 100644 index 748283911c..0000000000 --- a/docs/source/api/Apollo/extensions/RequestChainNetworkTransport.md +++ /dev/null @@ -1,53 +0,0 @@ -**EXTENSION** - -# `RequestChainNetworkTransport` -```swift -extension RequestChainNetworkTransport: UploadingNetworkTransport -``` - -## Methods -### `constructUploadRequest(for:with:manualBoundary:)` - -```swift -open func constructUploadRequest( - for operation: Operation, - with files: [GraphQLFile], - manualBoundary: String? = nil) -> HTTPRequest -``` - -Constructs an uploading (ie, multipart) GraphQL request - -Override this method if you need to use a custom subclass of `HTTPRequest`. - -- Parameters: - - operation: The operation to create a request for - - files: The files you wish to upload - - manualBoundary: [optional] A manually set boundary for your upload request. Defaults to nil. -- Returns: The created request. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to create a request for | -| files | The files you wish to upload | -| manualBoundary | [optional] A manually set boundary for your upload request. Defaults to nil. | - -### `upload(operation:files:callbackQueue:completionHandler:)` - -```swift -public func upload( - operation: Operation, - files: [GraphQLFile], - callbackQueue: DispatchQueue = .main, - completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send | -| files | An array of `GraphQLFile` objects to send. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | The completion handler to execute when the request completes or errors | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/ResponsePath.md b/docs/source/api/Apollo/extensions/ResponsePath.md deleted file mode 100644 index 6390773d34..0000000000 --- a/docs/source/api/Apollo/extensions/ResponsePath.md +++ /dev/null @@ -1,39 +0,0 @@ -**EXTENSION** - -# `ResponsePath` -```swift -extension ResponsePath: CustomStringConvertible -``` - -## Properties -### `description` - -```swift -public var description: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -static public func == (lhs: ResponsePath, rhs: ResponsePath) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/Apollo/extensions/Selection.Field.md b/docs/source/api/Apollo/extensions/Selection.Field.md deleted file mode 100644 index 4fec12b186..0000000000 --- a/docs/source/api/Apollo/extensions/Selection.Field.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Selection.Field` -```swift -extension Selection.Field -``` - -## Methods -### `cacheKey(with:)` - -```swift -public func cacheKey(with variables: GraphQLOperation.Variables?) throws -> String -``` diff --git a/docs/source/api/Apollo/methods/unzip(__).md b/docs/source/api/Apollo/methods/unzip(__).md deleted file mode 100644 index 43b0a776a1..0000000000 --- a/docs/source/api/Apollo/methods/unzip(__).md +++ /dev/null @@ -1,5 +0,0 @@ -### `unzip(_:)` - -```swift -public func unzip(_ array: [(Element1?, Element2?, Element3?)]) -> ([Element1], [Element2], [Element3]) -``` diff --git a/docs/source/api/Apollo/protocols/ApolloClientProtocol.md b/docs/source/api/Apollo/protocols/ApolloClientProtocol.md deleted file mode 100644 index 805395917d..0000000000 --- a/docs/source/api/Apollo/protocols/ApolloClientProtocol.md +++ /dev/null @@ -1,176 +0,0 @@ -**PROTOCOL** - -# `ApolloClientProtocol` - -```swift -public protocol ApolloClientProtocol: AnyObject -``` - -The `ApolloClientProtocol` provides the core API for Apollo. This API provides methods to fetch and watch queries, and to perform mutations. - -## Properties -### `store` - -```swift -var store: ApolloStore -``` - -A store used as a local cache. - -## Methods -### `clearCache(callbackQueue:completion:)` - -```swift -func clearCache(callbackQueue: DispatchQueue, completion: ((Result) -> Void)?) -``` - -Clears the underlying cache. -Be aware: In more complex setups, the same underlying cache can be used across multiple instances, so if you call this on one instance, it'll clear that cache across all instances which share that cache. - -- Parameters: - - callbackQueue: The queue to fall back on. Should default to the main queue. - - completion: [optional] A completion closure to execute when clearing has completed. Should default to nil. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| callbackQueue | The queue to fall back on. Should default to the main queue. | -| completion | [optional] A completion closure to execute when clearing has completed. Should default to nil. | - -### `fetch(query:cachePolicy:contextIdentifier:queue:resultHandler:)` - -```swift -func fetch(query: Query, - cachePolicy: CachePolicy, - contextIdentifier: UUID?, - queue: DispatchQueue, - resultHandler: GraphQLResultHandler?) -> Cancellable -``` - -Fetches a query from the server or from the local cache, depending on the current contents of the cache and the specified cache policy. - -- Parameters: - - query: The query to fetch. - - cachePolicy: A cache policy that specifies when results should be fetched from the server and when data should be loaded from the local cache. - - queue: A dispatch queue on which the result handler will be called. Should default to the main queue. - - contextIdentifier: [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Should default to `nil`. - - resultHandler: [optional] A closure that is called when query results are available or when an error occurs. -- Returns: An object that can be used to cancel an in progress fetch. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| query | The query to fetch. | -| cachePolicy | A cache policy that specifies when results should be fetched from the server and when data should be loaded from the local cache. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Should default to `nil`. | -| resultHandler | [optional] A closure that is called when query results are available or when an error occurs. | - -### `watch(query:cachePolicy:callbackQueue:resultHandler:)` - -```swift -func watch(query: Query, - cachePolicy: CachePolicy, - callbackQueue: DispatchQueue, - resultHandler: @escaping GraphQLResultHandler) -> GraphQLQueryWatcher -``` - -Watches a query by first fetching an initial result from the server or from the local cache, depending on the current contents of the cache and the specified cache policy. After the initial fetch, the returned query watcher object will get notified whenever any of the data the query result depends on changes in the local cache, and calls the result handler again with the new result. - -- Parameters: - - query: The query to fetch. - - cachePolicy: A cache policy that specifies when results should be fetched from the server or from the local cache. - - callbackQueue: A dispatch queue on which the result handler will be called. Should default to the main queue. - - resultHandler: [optional] A closure that is called when query results are available or when an error occurs. -- Returns: A query watcher object that can be used to control the watching behavior. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| query | The query to fetch. | -| cachePolicy | A cache policy that specifies when results should be fetched from the server or from the local cache. | -| callbackQueue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| resultHandler | [optional] A closure that is called when query results are available or when an error occurs. | - -### `perform(mutation:publishResultToStore:queue:resultHandler:)` - -```swift -func perform(mutation: Mutation, - publishResultToStore: Bool, - queue: DispatchQueue, - resultHandler: GraphQLResultHandler?) -> Cancellable -``` - -Performs a mutation by sending it to the server. - -- Parameters: - - mutation: The mutation to perform. - - publishResultToStore: If `true`, this will publish the result returned from the operation to the cache store. Default is `true`. - - queue: A dispatch queue on which the result handler will be called. Should default to the main queue. - - resultHandler: An optional closure that is called when mutation results are available or when an error occurs. -- Returns: An object that can be used to cancel an in progress mutation. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| mutation | The mutation to perform. | -| publishResultToStore | If `true`, this will publish the result returned from the operation to the cache store. Default is `true`. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| resultHandler | An optional closure that is called when mutation results are available or when an error occurs. | - -### `upload(operation:files:queue:resultHandler:)` - -```swift -func upload(operation: Operation, - files: [GraphQLFile], - queue: DispatchQueue, - resultHandler: GraphQLResultHandler?) -> Cancellable -``` - -Uploads the given files with the given operation. - -- Parameters: - - operation: The operation to send - - files: An array of `GraphQLFile` objects to send. - - queue: A dispatch queue on which the result handler will be called. Should default to the main queue. - - completionHandler: The completion handler to execute when the request completes or errors. Note that an error will be returned If your `networkTransport` does not also conform to `UploadingNetworkTransport`. -- Returns: An object that can be used to cancel an in progress request. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send | -| files | An array of `GraphQLFile` objects to send. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| completionHandler | The completion handler to execute when the request completes or errors. Note that an error will be returned If your `networkTransport` does not also conform to `UploadingNetworkTransport`. | - -### `subscribe(subscription:queue:resultHandler:)` - -```swift -func subscribe(subscription: Subscription, - queue: DispatchQueue, - resultHandler: @escaping GraphQLResultHandler) -> Cancellable -``` - -Subscribe to a subscription - -- Parameters: - - subscription: The subscription to subscribe to. - - fetchHTTPMethod: The HTTP Method to be used. - - queue: A dispatch queue on which the result handler will be called. Should default to the main queue. - - resultHandler: An optional closure that is called when mutation results are available or when an error occurs. -- Returns: An object that can be used to cancel an in progress subscription. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| subscription | The subscription to subscribe to. | -| fetchHTTPMethod | The HTTP Method to be used. | -| queue | A dispatch queue on which the result handler will be called. Should default to the main queue. | -| resultHandler | An optional closure that is called when mutation results are available or when an error occurs. | \ No newline at end of file diff --git a/docs/source/api/Apollo/protocols/ApolloErrorInterceptor.md b/docs/source/api/Apollo/protocols/ApolloErrorInterceptor.md deleted file mode 100644 index 9acd22fc0d..0000000000 --- a/docs/source/api/Apollo/protocols/ApolloErrorInterceptor.md +++ /dev/null @@ -1,40 +0,0 @@ -**PROTOCOL** - -# `ApolloErrorInterceptor` - -```swift -public protocol ApolloErrorInterceptor -``` - -An error interceptor called to allow further examination of error data when an error occurs in the chain. - -## Methods -### `handleErrorAsync(error:chain:request:response:completion:)` - -```swift -func handleErrorAsync( - error: Error, - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -Asynchronously handles the receipt of an error at any point in the chain. - -- Parameters: - - error: The received error - - chain: The chain the error was received on - - request: The request, as far as it was constructed - - response: [optional] The response, if one was received - - completion: The completion closure to fire when the operation has completed. Note that if you call `retry` on the chain, you will not want to call the completion block in this method. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| error | The received error | -| chain | The chain the error was received on | -| request | The request, as far as it was constructed | -| response | [optional] The response, if one was received | -| completion | The completion closure to fire when the operation has completed. Note that if you call `retry` on the chain, you will not want to call the completion block in this method. | \ No newline at end of file diff --git a/docs/source/api/Apollo/protocols/ApolloInterceptor.md b/docs/source/api/Apollo/protocols/ApolloInterceptor.md deleted file mode 100644 index 02025e3d11..0000000000 --- a/docs/source/api/Apollo/protocols/ApolloInterceptor.md +++ /dev/null @@ -1,37 +0,0 @@ -**PROTOCOL** - -# `ApolloInterceptor` - -```swift -public protocol ApolloInterceptor -``` - -A protocol to set up a chainable unit of networking work. - -## Methods -### `interceptAsync(chain:request:response:completion:)` - -```swift -func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -Called when this interceptor should do its work. - -- Parameters: - - chain: The chain the interceptor is a part of. - - request: The request, as far as it has been constructed - - response: [optional] The response, if received - - completion: The completion block to fire when data needs to be returned to the UI. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/protocols/Cancellable.md b/docs/source/api/Apollo/protocols/Cancellable.md deleted file mode 100644 index 8406f07e3b..0000000000 --- a/docs/source/api/Apollo/protocols/Cancellable.md +++ /dev/null @@ -1,18 +0,0 @@ -**PROTOCOL** - -# `Cancellable` - -```swift -public protocol Cancellable: AnyObject -``` - -An object that can be used to cancel an in progress action. - -## Methods -### `cancel()` - -```swift -func cancel() -``` - -Cancel an in progress action. diff --git a/docs/source/api/Apollo/protocols/InterceptorProvider.md b/docs/source/api/Apollo/protocols/InterceptorProvider.md deleted file mode 100644 index 6d62e023f2..0000000000 --- a/docs/source/api/Apollo/protocols/InterceptorProvider.md +++ /dev/null @@ -1,42 +0,0 @@ -**PROTOCOL** - -# `InterceptorProvider` - -```swift -public protocol InterceptorProvider -``` - -A protocol to allow easy creation of an array of interceptors for a given operation. - -## Methods -### `interceptors(for:)` - -```swift -func interceptors(for operation: Operation) -> [ApolloInterceptor] -``` - -Creates a new array of interceptors when called - -- Parameter operation: The operation to provide interceptors for - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to provide interceptors for | - -### `additionalErrorInterceptor(for:)` - -```swift -func additionalErrorInterceptor(for operation: Operation) -> ApolloErrorInterceptor? -``` - -Provides an additional error interceptor for any additional handling of errors -before returning to the UI, such as logging. -- Parameter operation: The operation to provide an additional error interceptor for - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to provide an additional error interceptor for | \ No newline at end of file diff --git a/docs/source/api/Apollo/protocols/NetworkTransport.md b/docs/source/api/Apollo/protocols/NetworkTransport.md deleted file mode 100644 index 8ef2fe3cc7..0000000000 --- a/docs/source/api/Apollo/protocols/NetworkTransport.md +++ /dev/null @@ -1,59 +0,0 @@ -**PROTOCOL** - -# `NetworkTransport` - -```swift -public protocol NetworkTransport: AnyObject -``` - -A network transport is responsible for sending GraphQL operations to a server. - -## Properties -### `clientName` - -```swift -var clientName: String -``` - -The name of the client to send as a header value. - -### `clientVersion` - -```swift -var clientVersion: String -``` - -The version of the client to send as a header value. - -## Methods -### `send(operation:cachePolicy:contextIdentifier:callbackQueue:completionHandler:)` - -```swift -func send(operation: Operation, - cachePolicy: CachePolicy, - contextIdentifier: UUID?, - callbackQueue: DispatchQueue, - completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable -``` - -Send a GraphQL operation to a server and return a response. - -Note if you're implementing this yourself rather than using one of the batteries-included versions of `NetworkTransport` (which handle this for you): The `clientName` and `clientVersion` should be sent with any URL request which needs headers so your client can be identified by tools meant to see what client is using which request. The `addApolloClientHeaders` method is provided below to do this for you if you're using Apollo Studio. - -- Parameters: - - operation: The operation to send. - - cachePolicy: The `CachePolicy` to use making this request. - - contextIdentifier: [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. - - callbackQueue: The queue to call back on with the results. Should default to `.main`. - - completionHandler: A closure to call when a request completes. On `success` will contain the response received from the server. On `failure` will contain the error which occurred. -- Returns: An object that can be used to cancel an in progress request. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send. | -| cachePolicy | The `CachePolicy` to use making this request. | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | A closure to call when a request completes. On `success` will contain the response received from the server. On `failure` will contain the error which occurred. | \ No newline at end of file diff --git a/docs/source/api/Apollo/protocols/NormalizedCache.md b/docs/source/api/Apollo/protocols/NormalizedCache.md deleted file mode 100644 index a3fea7e0d9..0000000000 --- a/docs/source/api/Apollo/protocols/NormalizedCache.md +++ /dev/null @@ -1,103 +0,0 @@ -**PROTOCOL** - -# `NormalizedCache` - -```swift -public protocol NormalizedCache: AnyObject -``` - -## Methods -### `loadRecords(forKeys:)` - -```swift -func loadRecords(forKeys keys: Set) throws -> [CacheKey: Record] -``` - -Loads records corresponding to the given keys. - -- Parameters: - - key: The cache keys to load data for -- Returns: A dictionary of cache keys to records containing the records that have been found. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache keys to load data for | - -### `merge(records:)` - -```swift -func merge(records: RecordSet) throws -> Set -``` - -Merges a set of records into the cache. - -- Parameters: - - records: The set of records to merge. -- Returns: A set of keys corresponding to *fields* that have changed (i.e. QUERY_ROOT.Foo.myField). These are the same type of keys as are returned by RecordSet.merge(records:). - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| records | The set of records to merge. | - -### `removeRecord(for:)` - -```swift -func removeRecord(for key: CacheKey) throws -``` - -Removes a record for the specified key. This method will only -remove whole records, not individual fields. - -If you attempt to pass a cache key for a single field, this -method will do nothing since it won't be able to locate a -record to remove based on that key. - -This method does not support cascading delete - it will only -remove the record for the specified key, and not any references to it or from it. - -- Parameters: - - key: The cache key to remove the record for - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache key to remove the record for | - -### `removeRecords(matching:)` - -```swift -func removeRecords(matching pattern: CacheKey) throws -``` - -Removes records with keys that match the specified pattern. This method will only -remove whole records, it does not perform cascading deletes. This means only the -records with matched keys will be removed, and not any references to them. Key -matching is case-insensitive. - -If you attempt to pass a cache path for a single field, this method will do nothing -since it won't be able to locate a record to remove based on that path. - -- Note: This method can be very slow depending on the number of records in the cache. -It is recommended that this method be called in a background queue. - -- Parameters: - - pattern: The pattern that will be applied to find matching keys. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pattern | The pattern that will be applied to find matching keys. | - -### `clear()` - -```swift -func clear() throws -``` - -Clears all records. diff --git a/docs/source/api/Apollo/protocols/RequestBodyCreator.md b/docs/source/api/Apollo/protocols/RequestBodyCreator.md deleted file mode 100644 index 6e5eec7693..0000000000 --- a/docs/source/api/Apollo/protocols/RequestBodyCreator.md +++ /dev/null @@ -1,34 +0,0 @@ -**PROTOCOL** - -# `RequestBodyCreator` - -```swift -public protocol RequestBodyCreator -``` - -## Methods -### `requestBody(for:sendQueryDocument:autoPersistQuery:)` - -```swift -func requestBody( - for operation: Operation, - sendQueryDocument: Bool, - autoPersistQuery: Bool -) -> JSONEncodableDictionary -``` - -Creates a `JSONEncodableDictionary` out of the passed-in operation - -- Parameters: - - operation: The operation to use - - sendQueryDocument: Whether or not to send the full query document. Should default to `true`. - - autoPersistQuery: Whether to use auto-persisted query information. Should default to `false`. -- Returns: The created `JSONEncodableDictionary` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to use | -| sendQueryDocument | Whether or not to send the full query document. Should default to `true`. | -| autoPersistQuery | Whether to use auto-persisted query information. Should default to `false`. | \ No newline at end of file diff --git a/docs/source/api/Apollo/protocols/UploadingNetworkTransport.md b/docs/source/api/Apollo/protocols/UploadingNetworkTransport.md deleted file mode 100644 index aad8e0a0c6..0000000000 --- a/docs/source/api/Apollo/protocols/UploadingNetworkTransport.md +++ /dev/null @@ -1,38 +0,0 @@ -**PROTOCOL** - -# `UploadingNetworkTransport` - -```swift -public protocol UploadingNetworkTransport: NetworkTransport -``` - -A network transport which can also handle uploads of files. - -## Methods -### `upload(operation:files:callbackQueue:completionHandler:)` - -```swift -func upload( - operation: Operation, - files: [GraphQLFile], - callbackQueue: DispatchQueue, - completionHandler: @escaping (Result,Error>) -> Void) -> Cancellable -``` - -Uploads the given files with the given operation. - -- Parameters: - - operation: The operation to send - - files: An array of `GraphQLFile` objects to send. - - callbackQueue: The queue to call back on with the results. Should default to `.main`. - - completionHandler: The completion handler to execute when the request completes or errors -- Returns: An object that can be used to cancel an in progress request. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send | -| files | An array of `GraphQLFile` objects to send. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | The completion handler to execute when the request completes or errors | \ No newline at end of file diff --git a/docs/source/api/Apollo/structs/ApolloRequestBodyCreator.md b/docs/source/api/Apollo/structs/ApolloRequestBodyCreator.md deleted file mode 100644 index 1877e0a0db..0000000000 --- a/docs/source/api/Apollo/structs/ApolloRequestBodyCreator.md +++ /dev/null @@ -1,14 +0,0 @@ -**STRUCT** - -# `ApolloRequestBodyCreator` - -```swift -public struct ApolloRequestBodyCreator: RequestBodyCreator -``` - -## Methods -### `init()` - -```swift -public init() -``` diff --git a/docs/source/api/Apollo/structs/AutomaticPersistedQueryInterceptor.md b/docs/source/api/Apollo/structs/AutomaticPersistedQueryInterceptor.md deleted file mode 100644 index aee375bf5c..0000000000 --- a/docs/source/api/Apollo/structs/AutomaticPersistedQueryInterceptor.md +++ /dev/null @@ -1,35 +0,0 @@ -**STRUCT** - -# `AutomaticPersistedQueryInterceptor` - -```swift -public struct AutomaticPersistedQueryInterceptor: ApolloInterceptor -``` - -## Methods -### `init()` - -```swift -public init() -``` - -Designated initializer - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/structs/CacheReadInterceptor.md b/docs/source/api/Apollo/structs/CacheReadInterceptor.md deleted file mode 100644 index 42d3cb6750..0000000000 --- a/docs/source/api/Apollo/structs/CacheReadInterceptor.md +++ /dev/null @@ -1,45 +0,0 @@ -**STRUCT** - -# `CacheReadInterceptor` - -```swift -public struct CacheReadInterceptor: ApolloInterceptor -``` - -An interceptor that reads data from the cache for queries, following the `HTTPRequest`'s `cachePolicy`. - -## Methods -### `init(store:)` - -```swift -public init(store: ApolloStore) -``` - -Designated initializer - -- Parameter store: The store to use when reading from the cache. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| store | The store to use when reading from the cache. | - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/structs/CacheWriteInterceptor.md b/docs/source/api/Apollo/structs/CacheWriteInterceptor.md deleted file mode 100644 index ad53aa3b16..0000000000 --- a/docs/source/api/Apollo/structs/CacheWriteInterceptor.md +++ /dev/null @@ -1,52 +0,0 @@ -**STRUCT** - -# `CacheWriteInterceptor` - -```swift -public struct CacheWriteInterceptor: ApolloInterceptor -``` - -An interceptor which writes data to the cache, following the `HTTPRequest`'s `cachePolicy`. - -## Properties -### `store` - -```swift -public let store: ApolloStore -``` - -## Methods -### `init(store:)` - -```swift -public init(store: ApolloStore) -``` - -Designated initializer - -- Parameter store: The store to use when writing to the cache. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| store | The store to use when writing to the cache. | - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/structs/GraphQLError.Location.md b/docs/source/api/Apollo/structs/GraphQLError.Location.md deleted file mode 100644 index 973299c804..0000000000 --- a/docs/source/api/Apollo/structs/GraphQLError.Location.md +++ /dev/null @@ -1,26 +0,0 @@ -**STRUCT** - -# `GraphQLError.Location` - -```swift -public struct Location -``` - -Represents a location in a GraphQL document. - -## Properties -### `line` - -```swift -public let line: Int -``` - -The line number of a syntax element. - -### `column` - -```swift -public let column: Int -``` - -The column number of a syntax element. diff --git a/docs/source/api/Apollo/structs/GraphQLError.md b/docs/source/api/Apollo/structs/GraphQLError.md deleted file mode 100644 index 6f91d92a51..0000000000 --- a/docs/source/api/Apollo/structs/GraphQLError.md +++ /dev/null @@ -1,43 +0,0 @@ -**STRUCT** - -# `GraphQLError` - -```swift -public struct GraphQLError: Error, Hashable -``` - -Represents an error encountered during the execution of a GraphQL operation. - - - SeeAlso: [The Response Format section in the GraphQL specification](https://facebook.github.io/graphql/#sec-Response-Format) - -## Properties -### `message` - -```swift -public var message: String? -``` - -A description of the error. - -### `locations` - -```swift -public var locations: [Location]? -``` - -A list of locations in the requested GraphQL document associated with the error. - -### `extensions` - -```swift -public var extensions: [String : Any]? -``` - -A dictionary which services can use however they see fit to provide additional information in errors to clients. - -## Methods -### `init(_:)` - -```swift -public init(_ object: JSONObject) -``` diff --git a/docs/source/api/Apollo/structs/GraphQLExecutionError.md b/docs/source/api/Apollo/structs/GraphQLExecutionError.md deleted file mode 100644 index eeed6a63c0..0000000000 --- a/docs/source/api/Apollo/structs/GraphQLExecutionError.md +++ /dev/null @@ -1,32 +0,0 @@ -**STRUCT** - -# `GraphQLExecutionError` - -```swift -public struct GraphQLExecutionError: Error, LocalizedError -``` - -An error which has occurred during GraphQL execution. - -## Properties -### `pathString` - -```swift -public var pathString: String -``` - -### `underlying` - -```swift -public let underlying: Error -``` - -The error that occurred during parsing. - -### `errorDescription` - -```swift -public var errorDescription: String? -``` - -A description of the error which includes the path where the error occurred. diff --git a/docs/source/api/Apollo/structs/GraphQLFile.md b/docs/source/api/Apollo/structs/GraphQLFile.md deleted file mode 100644 index 1f9cd34fa6..0000000000 --- a/docs/source/api/Apollo/structs/GraphQLFile.md +++ /dev/null @@ -1,121 +0,0 @@ -**STRUCT** - -# `GraphQLFile` - -```swift -public struct GraphQLFile: Hashable -``` - -A file which can be uploaded to a GraphQL server - -## Properties -### `fieldName` - -```swift -public let fieldName: String -``` - -### `originalName` - -```swift -public let originalName: String -``` - -### `mimeType` - -```swift -public let mimeType: String -``` - -### `data` - -```swift -public let data: Data? -``` - -### `fileURL` - -```swift -public let fileURL: URL? -``` - -### `contentLength` - -```swift -public let contentLength: UInt64 -``` - -### `octetStreamMimeType` - -```swift -public static let octetStreamMimeType = "application/octet-stream" -``` - -A convenience constant for declaring your mimetype is octet-stream. - -## Methods -### `init(fieldName:originalName:mimeType:data:)` - -```swift -public init(fieldName: String, - originalName: String, - mimeType: String = GraphQLFile.octetStreamMimeType, - data: Data) -``` - -Convenience initializer for raw data - -- Parameters: - - fieldName: The name of the field this file is being sent for - - originalName: The original name of the file - - mimeType: The mime type of the file to send to the server. Defaults to `GraphQLFile.octetStreamMimeType`. - - data: The raw data to send for the file. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| fieldName | The name of the field this file is being sent for | -| originalName | The original name of the file | -| mimeType | The mime type of the file to send to the server. Defaults to `GraphQLFile.octetStreamMimeType`. | -| data | The raw data to send for the file. | - -### `init(fieldName:originalName:mimeType:fileURL:)` - -```swift -public init(fieldName: String, - originalName: String, - mimeType: String = GraphQLFile.octetStreamMimeType, - fileURL: URL) throws -``` - -Throwing convenience initializer for files in the filesystem - -- Parameters: - - fieldName: The name of the field this file is being sent for - - originalName: The original name of the file - - mimeType: The mime type of the file to send to the server. Defaults to `GraphQLFile.octetStreamMimeType`. - - fileURL: The URL of the file to upload. -- Throws: If the file's size could not be determined - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| fieldName | The name of the field this file is being sent for | -| originalName | The original name of the file | -| mimeType | The mime type of the file to send to the server. Defaults to `GraphQLFile.octetStreamMimeType`. | -| fileURL | The URL of the file to upload. | - -### `generateInputStream()` - -```swift -public func generateInputStream() throws -> InputStream -``` - -Uses either the data or the file URL to create an -`InputStream` that can be used to stream data into -a multipart-form. - -- Returns: The created `InputStream`. -- Throws: If an input stream could not be created from either data or a file URL. diff --git a/docs/source/api/Apollo/structs/GraphQLGETTransformer.md b/docs/source/api/Apollo/structs/GraphQLGETTransformer.md deleted file mode 100644 index c425febb0c..0000000000 --- a/docs/source/api/Apollo/structs/GraphQLGETTransformer.md +++ /dev/null @@ -1,37 +0,0 @@ -**STRUCT** - -# `GraphQLGETTransformer` - -```swift -public struct GraphQLGETTransformer -``` - -## Methods -### `init(body:url:)` - -```swift -public init(body: JSONEncodableDictionary, url: URL) -``` - -A helper for transforming a `JSONEncodableDictionary` that can be sent with a `POST` request into a URL with query parameters for a `GET` request. - -- Parameters: - - body: The `JSONEncodableDictionary` to transform from the body of a `POST` request - - url: The base url to append the query to. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| body | The `JSONEncodableDictionary` to transform from the body of a `POST` request | -| url | The base url to append the query to. | - -### `createGetURL()` - -```swift -public func createGetURL() -> URL? -``` - -Creates the get URL. - -- Returns: [optional] The created get URL or nil if the provided information couldn't be used to access the appropriate parameters. diff --git a/docs/source/api/Apollo/structs/GraphQLResult.md b/docs/source/api/Apollo/structs/GraphQLResult.md deleted file mode 100644 index 9ea98f3da9..0000000000 --- a/docs/source/api/Apollo/structs/GraphQLResult.md +++ /dev/null @@ -1,53 +0,0 @@ -**STRUCT** - -# `GraphQLResult` - -```swift -public struct GraphQLResult -``` - -Represents the result of a GraphQL operation. - -## Properties -### `data` - -```swift -public let data: Data? -``` - -The typed result data, or `nil` if an error was encountered that prevented a valid response. - -### `errors` - -```swift -public let errors: [GraphQLError]? -``` - -A list of errors, or `nil` if the operation completed without encountering any errors. - -### `extensions` - -```swift -public let extensions: [String: AnyHashable]? -``` - -A dictionary which services can use however they see fit to provide additional information to clients. - -### `source` - -```swift -public let source: Source -``` - -Source of data - -## Methods -### `init(data:extensions:errors:source:dependentKeys:)` - -```swift -public init(data: Data?, - extensions: [String: AnyHashable]?, - errors: [GraphQLError]?, - source: Source, - dependentKeys: Set?) -``` diff --git a/docs/source/api/Apollo/structs/JSONResponseParsingInterceptor.md b/docs/source/api/Apollo/structs/JSONResponseParsingInterceptor.md deleted file mode 100644 index d1b08507db..0000000000 --- a/docs/source/api/Apollo/structs/JSONResponseParsingInterceptor.md +++ /dev/null @@ -1,36 +0,0 @@ -**STRUCT** - -# `JSONResponseParsingInterceptor` - -```swift -public struct JSONResponseParsingInterceptor: ApolloInterceptor -``` - -An interceptor which parses JSON response data into a `GraphQLResult` and attaches it to the `HTTPResponse`. - -## Methods -### `init()` - -```swift -public init() -``` - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void -) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/structs/Record.md b/docs/source/api/Apollo/structs/Record.md deleted file mode 100644 index de16903588..0000000000 --- a/docs/source/api/Apollo/structs/Record.md +++ /dev/null @@ -1,29 +0,0 @@ -**STRUCT** - -# `Record` - -```swift -public struct Record: Hashable -``` - -A cache record. - -## Properties -### `key` - -```swift -public let key: CacheKey -``` - -### `fields` - -```swift -public private(set) var fields: Fields -``` - -## Methods -### `init(key:_:)` - -```swift -public init(key: CacheKey, _ fields: Fields = [:]) -``` diff --git a/docs/source/api/Apollo/structs/RecordSet.md b/docs/source/api/Apollo/structs/RecordSet.md deleted file mode 100644 index 1388a77d7f..0000000000 --- a/docs/source/api/Apollo/structs/RecordSet.md +++ /dev/null @@ -1,77 +0,0 @@ -**STRUCT** - -# `RecordSet` - -```swift -public struct RecordSet: Hashable -``` - -A set of cache records. - -## Properties -### `storage` - -```swift -public private(set) var storage: [CacheKey: Record] = [:] -``` - -### `isEmpty` - -```swift -public var isEmpty: Bool -``` - -### `keys` - -```swift -public var keys: Set -``` - -## Methods -### `init(records:)` - -```swift -public init(records: S) where S.Iterator.Element == Record -``` - -### `insert(_:)` - -```swift -public mutating func insert(_ record: Record) -``` - -### `removeRecord(for:)` - -```swift -public mutating func removeRecord(for key: CacheKey) -``` - -### `removeRecords(matching:)` - -```swift -public mutating func removeRecords(matching pattern: CacheKey) -``` - -### `clear()` - -```swift -public mutating func clear() -``` - -### `insert(contentsOf:)` - -```swift -public mutating func insert(contentsOf records: S) where S.Iterator.Element == Record -``` - -### `merge(records:)` - -```swift -@discardableResult public mutating func merge(records: RecordSet) -> Set -``` - -### `merge(record:)` - -```swift -@discardableResult public mutating func merge(record: Record) -> Set -``` diff --git a/docs/source/api/Apollo/structs/ResponseCodeInterceptor.md b/docs/source/api/Apollo/structs/ResponseCodeInterceptor.md deleted file mode 100644 index 6e8ecfb568..0000000000 --- a/docs/source/api/Apollo/structs/ResponseCodeInterceptor.md +++ /dev/null @@ -1,37 +0,0 @@ -**STRUCT** - -# `ResponseCodeInterceptor` - -```swift -public struct ResponseCodeInterceptor: ApolloInterceptor -``` - -An interceptor to check the response code returned with a request. - -## Methods -### `init()` - -```swift -public init() -``` - -Designated initializer - -### `interceptAsync(chain:request:response:completion:)` - -```swift -public func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| chain | The chain the interceptor is a part of. | -| request | The request, as far as it has been constructed | -| response | [optional] The response, if received | -| completion | The completion block to fire when data needs to be returned to the UI. | \ No newline at end of file diff --git a/docs/source/api/Apollo/structs/ResponsePath.md b/docs/source/api/Apollo/structs/ResponsePath.md deleted file mode 100644 index a2b6685903..0000000000 --- a/docs/source/api/Apollo/structs/ResponsePath.md +++ /dev/null @@ -1,80 +0,0 @@ -**STRUCT** - -# `ResponsePath` - -```swift -public struct ResponsePath: ExpressibleByArrayLiteral -``` - -Represents a list of string components joined into a path using a reverse linked list. - -A response path is stored as a linked list because using an array turned out to be -a performance bottleneck during decoding/execution. - -In order to optimize for calculation of a path string, `ResponsePath` does not allow insertion -of components in the middle or at the beginning of the path. Components may only be appended to -the end of an existing path. - -## Properties -### `joined` - -```swift -public var joined: String -``` - -### `isEmpty` - -```swift -public var isEmpty: Bool -``` - -## Methods -### `toArray()` - -```swift -public func toArray() -> [String] -``` - -### `init(arrayLiteral:)` - -```swift -public init(arrayLiteral segments: Key...) -``` - -### `init(_:)` - -```swift -public init(_ key: Key) -``` - -### `append(_:)` - -```swift -public mutating func append(_ key: Key) -``` - -### `appending(_:)` - -```swift -public func appending(_ key: Key) -> ResponsePath -``` - -### `+(_:_:)` - -```swift -public static func + (lhs: ResponsePath, rhs: Key) -> ResponsePath -``` - -### `+(_:_:)` - -```swift -public static func + (lhs: ResponsePath, rhs: ResponsePath) -> ResponsePath -``` - -### `+(_:_:)` - -```swift -public static func + ( - lhs: ResponsePath, rhs: T -) -> ResponsePath where T.Element == Key -``` diff --git a/docs/source/api/Apollo/toc.md b/docs/source/api/Apollo/toc.md deleted file mode 100644 index 89dc119c47..0000000000 --- a/docs/source/api/Apollo/toc.md +++ /dev/null @@ -1,113 +0,0 @@ -# Reference Documentation - -## Protocols - -- [ApolloClientProtocol](protocols/ApolloClientProtocol/) -- [ApolloErrorInterceptor](protocols/ApolloErrorInterceptor/) -- [ApolloInterceptor](protocols/ApolloInterceptor/) -- [Cancellable](protocols/Cancellable/) -- [InterceptorProvider](protocols/InterceptorProvider/) -- [NetworkTransport](protocols/NetworkTransport/) -- [NormalizedCache](protocols/NormalizedCache/) -- [RequestBodyCreator](protocols/RequestBodyCreator/) -- [UploadingNetworkTransport](protocols/UploadingNetworkTransport/) - -## Structs - -- [ApolloRequestBodyCreator](structs/ApolloRequestBodyCreator/) -- [AutomaticPersistedQueryInterceptor](structs/AutomaticPersistedQueryInterceptor/) -- [CacheReadInterceptor](structs/CacheReadInterceptor/) -- [CacheWriteInterceptor](structs/CacheWriteInterceptor/) -- [GraphQLError](structs/GraphQLError/) -- [GraphQLError.Location](structs/GraphQLError.Location/) -- [GraphQLExecutionError](structs/GraphQLExecutionError/) -- [GraphQLFile](structs/GraphQLFile/) -- [GraphQLGETTransformer](structs/GraphQLGETTransformer/) -- [GraphQLResult](structs/GraphQLResult/) -- [JSONResponseParsingInterceptor](structs/JSONResponseParsingInterceptor/) -- [Record](structs/Record/) -- [RecordSet](structs/RecordSet/) -- [ResponseCodeInterceptor](structs/ResponseCodeInterceptor/) -- [ResponsePath](structs/ResponsePath/) - -## Classes - -- [ApolloClient](classes/ApolloClient/) -- [ApolloStore](classes/ApolloStore/) -- [ApolloStore.ReadTransaction](classes/ApolloStore.ReadTransaction/) -- [ApolloStore.ReadWriteTransaction](classes/ApolloStore.ReadWriteTransaction/) -- [DefaultInterceptorProvider](classes/DefaultInterceptorProvider/) -- [EmptyCancellable](classes/EmptyCancellable/) -- [GraphQLQueryWatcher](classes/GraphQLQueryWatcher/) -- [GraphQLResponse](classes/GraphQLResponse/) -- [HTTPRequest](classes/HTTPRequest/) -- [HTTPResponse](classes/HTTPResponse/) -- [InMemoryNormalizedCache](classes/InMemoryNormalizedCache/) -- [JSONRequest](classes/JSONRequest/) -- [JSONSerializationFormat](classes/JSONSerializationFormat/) -- [MaxRetryInterceptor](classes/MaxRetryInterceptor/) -- [MultipartFormData](classes/MultipartFormData/) -- [NetworkFetchInterceptor](classes/NetworkFetchInterceptor/) -- [RequestChain](classes/RequestChain/) -- [RequestChainNetworkTransport](classes/RequestChainNetworkTransport/) -- [TaskData](classes/TaskData/) -- [URLSessionClient](classes/URLSessionClient/) -- [UploadRequest](classes/UploadRequest/) - -## Enums - -- [ApolloClient.ApolloClientError](enums/ApolloClient.ApolloClientError/) -- [AutomaticPersistedQueryInterceptor.APQError](enums/AutomaticPersistedQueryInterceptor.APQError/) -- [CachePolicy](enums/CachePolicy/) -- [CacheWriteInterceptor.CacheWriteError](enums/CacheWriteInterceptor.CacheWriteError/) -- [GraphQLFile.GraphQLFileError](enums/GraphQLFile.GraphQLFileError/) -- [GraphQLHTTPRequestError](enums/GraphQLHTTPRequestError/) -- [GraphQLResult.Source](enums/GraphQLResult.Source/) -- [JSONResponseParsingInterceptor.JSONResponseParsingError](enums/JSONResponseParsingInterceptor.JSONResponseParsingError/) -- [MaxRetryInterceptor.RetryError](enums/MaxRetryInterceptor.RetryError/) -- [RequestChain.ChainError](enums/RequestChain.ChainError/) -- [ResponseCodeInterceptor.ResponseCodeError](enums/ResponseCodeInterceptor.ResponseCodeError/) -- [URLSessionClient.URLSessionClientError](enums/URLSessionClient.URLSessionClientError/) - -## Extensions - -- [ApolloClient](extensions/ApolloClient/) -- [ApolloExtension](extensions/ApolloExtension/) -- [Dictionary](extensions/Dictionary/) -- [GraphQLError](extensions/GraphQLError/) -- [GraphQLGETTransformer](extensions/GraphQLGETTransformer/) -- [GraphQLResponse](extensions/GraphQLResponse/) -- [GraphQLResult](extensions/GraphQLResult/) -- [HTTPRequest](extensions/HTTPRequest/) -- [HTTPResponse](extensions/HTTPResponse/) -- [InterceptorProvider](extensions/InterceptorProvider/) -- [MultipartFormData](extensions/MultipartFormData/) -- [NetworkTransport](extensions/NetworkTransport/) -- [Record](extensions/Record/) -- [RecordSet](extensions/RecordSet/) -- [RequestBodyCreator](extensions/RequestBodyCreator/) -- [RequestChainNetworkTransport](extensions/RequestChainNetworkTransport/) -- [ResponsePath](extensions/ResponsePath/) -- [Selection.Field](extensions/Selection.Field/) - -## Typealiases - -- [CacheKey](typealiases/CacheKey/) -- [CacheKeyForObject](typealiases/CacheKeyForObject/) -- [DataLoader.BatchLoad](typealiases/DataLoader.BatchLoad/) -- [DidChangeKeysFunc](typealiases/DidChangeKeysFunc/) -- [GraphQLResultHandler](typealiases/GraphQLResultHandler/) -- [JSONObject](typealiases/JSONObject/) -- [JSONValue](typealiases/JSONValue/) -- [Record.Fields](typealiases/Record.Fields/) -- [Record.Value](typealiases/Record.Value/) -- [ResponsePath.Key](typealiases/ResponsePath.Key/) -- [URLSessionClient.Completion](typealiases/URLSessionClient.Completion/) -- [URLSessionClient.RawCompletion](typealiases/URLSessionClient.RawCompletion/) - -## Methods - -- [unzip(__)](methods/unzip(__)/) -- [unzip(__)](methods/unzip(__)/) - -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/api/Apollo/typealiases/CacheKey.md b/docs/source/api/Apollo/typealiases/CacheKey.md deleted file mode 100644 index 11979fa02f..0000000000 --- a/docs/source/api/Apollo/typealiases/CacheKey.md +++ /dev/null @@ -1,9 +0,0 @@ -**TYPEALIAS** - -# `CacheKey` - -```swift -public typealias CacheKey = String -``` - -A cache key for a record. \ No newline at end of file diff --git a/docs/source/api/Apollo/typealiases/CacheKeyForObject.md b/docs/source/api/Apollo/typealiases/CacheKeyForObject.md deleted file mode 100644 index c7c827558b..0000000000 --- a/docs/source/api/Apollo/typealiases/CacheKeyForObject.md +++ /dev/null @@ -1,9 +0,0 @@ -**TYPEALIAS** - -# `CacheKeyForObject` - -```swift -public typealias CacheKeyForObject = (_ object: JSONObject) -> JSONValue? -``` - -A function that returns a cache key for a particular result object. If it returns `nil`, a default cache key based on the field path will be used. \ No newline at end of file diff --git a/docs/source/api/Apollo/typealiases/DataLoader.BatchLoad.md b/docs/source/api/Apollo/typealiases/DataLoader.BatchLoad.md deleted file mode 100644 index be78601c7d..0000000000 --- a/docs/source/api/Apollo/typealiases/DataLoader.BatchLoad.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `DataLoader.BatchLoad` - -```swift -public typealias BatchLoad = (Set) throws -> [Key: Value] -``` diff --git a/docs/source/api/Apollo/typealiases/DidChangeKeysFunc.md b/docs/source/api/Apollo/typealiases/DidChangeKeysFunc.md deleted file mode 100644 index 78becdf477..0000000000 --- a/docs/source/api/Apollo/typealiases/DidChangeKeysFunc.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `DidChangeKeysFunc` - -```swift -public typealias DidChangeKeysFunc = (Set, UUID?) -> Void -``` diff --git a/docs/source/api/Apollo/typealiases/GraphQLResultHandler.md b/docs/source/api/Apollo/typealiases/GraphQLResultHandler.md deleted file mode 100644 index f5908f2db8..0000000000 --- a/docs/source/api/Apollo/typealiases/GraphQLResultHandler.md +++ /dev/null @@ -1,12 +0,0 @@ -**TYPEALIAS** - -# `GraphQLResultHandler` - -```swift -public typealias GraphQLResultHandler = (Result, Error>) -> Void -``` - -A handler for operation results. - -- Parameters: - - result: The result of a performed operation. Will have a `GraphQLResult` with any parsed data and any GraphQL errors on `success`, and an `Error` on `failure`. \ No newline at end of file diff --git a/docs/source/api/Apollo/typealiases/JSONObject.md b/docs/source/api/Apollo/typealiases/JSONObject.md deleted file mode 100644 index 3c258fba44..0000000000 --- a/docs/source/api/Apollo/typealiases/JSONObject.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `JSONObject` - -```swift -public typealias JSONObject = [String: JSONValue] -``` diff --git a/docs/source/api/Apollo/typealiases/JSONValue.md b/docs/source/api/Apollo/typealiases/JSONValue.md deleted file mode 100644 index a31cd9ce55..0000000000 --- a/docs/source/api/Apollo/typealiases/JSONValue.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `JSONValue` - -```swift -public typealias JSONValue = AnyHashable -``` diff --git a/docs/source/api/Apollo/typealiases/Record.Fields.md b/docs/source/api/Apollo/typealiases/Record.Fields.md deleted file mode 100644 index 9768d32ff0..0000000000 --- a/docs/source/api/Apollo/typealiases/Record.Fields.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `Record.Fields` - -```swift -public typealias Fields = [CacheKey: Value] -``` diff --git a/docs/source/api/Apollo/typealiases/Record.Value.md b/docs/source/api/Apollo/typealiases/Record.Value.md deleted file mode 100644 index 5b8159383d..0000000000 --- a/docs/source/api/Apollo/typealiases/Record.Value.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `Record.Value` - -```swift -public typealias Value = AnyHashable -``` diff --git a/docs/source/api/Apollo/typealiases/ResponsePath.Key.md b/docs/source/api/Apollo/typealiases/ResponsePath.Key.md deleted file mode 100644 index 1c558ed2f6..0000000000 --- a/docs/source/api/Apollo/typealiases/ResponsePath.Key.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `ResponsePath.Key` - -```swift -public typealias Key = String -``` diff --git a/docs/source/api/Apollo/typealiases/URLSessionClient.Completion.md b/docs/source/api/Apollo/typealiases/URLSessionClient.Completion.md deleted file mode 100644 index 19aef74ca3..0000000000 --- a/docs/source/api/Apollo/typealiases/URLSessionClient.Completion.md +++ /dev/null @@ -1,9 +0,0 @@ -**TYPEALIAS** - -# `URLSessionClient.Completion` - -```swift -public typealias Completion = (Result<(Data, HTTPURLResponse), Error>) -> Void -``` - -A completion block returning a result. On `.success` it will contain a tuple with non-nil `Data` and its corresponding `HTTPURLResponse`. On `.failure` it will contain an error. \ No newline at end of file diff --git a/docs/source/api/Apollo/typealiases/URLSessionClient.RawCompletion.md b/docs/source/api/Apollo/typealiases/URLSessionClient.RawCompletion.md deleted file mode 100644 index 89b05ddb07..0000000000 --- a/docs/source/api/Apollo/typealiases/URLSessionClient.RawCompletion.md +++ /dev/null @@ -1,9 +0,0 @@ -**TYPEALIAS** - -# `URLSessionClient.RawCompletion` - -```swift -public typealias RawCompletion = (Data?, HTTPURLResponse?, Error?) -> Void -``` - -A completion block to be called when the raw task has completed, with the raw information from the session \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/classes/Interface.md b/docs/source/api/ApolloAPI/classes/Interface.md deleted file mode 100644 index 33844678d6..0000000000 --- a/docs/source/api/ApolloAPI/classes/Interface.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `Interface` - -```swift -open class Interface: CacheEntity, ParentTypeConvertible -``` diff --git a/docs/source/api/ApolloAPI/classes/Object.md b/docs/source/api/ApolloAPI/classes/Object.md deleted file mode 100644 index cbd7109405..0000000000 --- a/docs/source/api/ApolloAPI/classes/Object.md +++ /dev/null @@ -1,20 +0,0 @@ -**CLASS** - -# `Object` - -```swift -open class Object: CacheEntity -``` - -## Methods -### `_canBeConverted(to:)` - -```swift -public final class func _canBeConverted(to otherType: ParentType) -> Bool -``` - -### `implements(_:)` - -```swift -public final class func implements(_ interface: Interface.Type) -> Bool -``` diff --git a/docs/source/api/ApolloAPI/enums/DocumentType.md b/docs/source/api/ApolloAPI/enums/DocumentType.md deleted file mode 100644 index d1e42915c3..0000000000 --- a/docs/source/api/ApolloAPI/enums/DocumentType.md +++ /dev/null @@ -1,54 +0,0 @@ -**ENUM** - -# `DocumentType` - -```swift -public enum DocumentType -``` - -The means of providing the operation document that includes the definition of the operation -over network transport. - -This data represents the `Document` as defined in the GraphQL Spec. -- See: [GraphQLSpec - Document](https://spec.graphql.org/draft/#Document) - -The Apollo Code Generation Engine will generate the `DocumentType` on each generated -`GraphQLOperation`. You can change the type of `DocumentType` generated in your -[code generation configuration](// TODO: ADD URL TO DOCUMENTATION HERE). - -## Cases -### `notPersisted(definition:)` - -```swift -case notPersisted(definition: OperationDefinition) -``` - -The traditional way of providing the operation `Document`. -The `Document` is sent with every operation request. - -### `automaticallyPersisted(operationIdentifier:definition:)` - -```swift -case automaticallyPersisted(operationIdentifier: String, definition: OperationDefinition) -``` - -Automatically persists your operations using Apollo Server's -[APQs](https://www.apollographql.com/docs/apollo-server/performance/apq). - -This allow the operation definition to be persisted using an `operationIdentifier` instead of -being sent with every operation request. If the server does not recognize the -`operationIdentifier`, the network transport can send the provided definition to -"automatically persist" the operation definition. - -### `persistedOperationsOnly(operationIdentifier:)` - -```swift -case persistedOperationsOnly(operationIdentifier: String) -``` - -Provides only the `operationIdentifier` for operations that have been previously persisted -to an Apollo Server using -[APQs](https://www.apollographql.com/docs/apollo-server/performance/apq). - -If the server does not recognize the `operationIdentifier`, the operation will fail. This -method should only be used if you are manually persisting your queries to an Apollo Server. diff --git a/docs/source/api/ApolloAPI/enums/Field.OutputType.md b/docs/source/api/ApolloAPI/enums/Field.OutputType.md deleted file mode 100644 index 6127030348..0000000000 --- a/docs/source/api/ApolloAPI/enums/Field.OutputType.md +++ /dev/null @@ -1,51 +0,0 @@ -**ENUM** - -# `Field.OutputType` - -```swift -public indirect enum OutputType -``` - -## Cases -### `scalar(_:)` - -```swift -case scalar(ScalarType.Type) -``` - -### `customScalar(_:)` - -```swift -case customScalar(CustomScalarType.Type) -``` - -### `object(_:)` - -```swift -case object(RootSelectionSet.Type) -``` - -### `nonNull(_:)` - -```swift -case nonNull(OutputType) -``` - -### `list(_:)` - -```swift -case list(OutputType) -``` - -## Properties -### `namedType` - -```swift -public var namedType: OutputType -``` - -### `isNullable` - -```swift -public var isNullable: Bool -``` diff --git a/docs/source/api/ApolloAPI/enums/GraphQLEnum.md b/docs/source/api/ApolloAPI/enums/GraphQLEnum.md deleted file mode 100644 index cec2ad358e..0000000000 --- a/docs/source/api/ApolloAPI/enums/GraphQLEnum.md +++ /dev/null @@ -1,80 +0,0 @@ -**ENUM** - -# `GraphQLEnum` - -```swift -public enum GraphQLEnum: CaseIterable, Hashable, RawRepresentable -``` - -A generic enum that wraps a generated enum from a GraphQL Schema. - -`GraphQLEnum` provides an `__unknown` case that is used when the response returns a value that -is not recognized as a valid enum case. This is usually caused by future cases added to the enum -on the schema after code generation. - -## Cases -### `case(_:)` - -```swift -case `case`(T) -``` - -A recognized case of the wrapped enum. - -### `__unknown(_:)` - -```swift -case __unknown(String) -``` - -An unrecognized value for the enum. -The associated value exposes the raw `String` data from the response. - -## Properties -### `value` - -```swift -@inlinable public var value: T? -``` - -The underlying enum case. If the value is `__unknown`, this will be `nil`. - -### `rawValue` - -```swift -@inlinable public var rawValue: String -``` - -### `allCases` - -```swift -@inlinable public static var allCases: [GraphQLEnum] -``` - -A collection of all known values of the wrapped enum. -This collection does not include the `__unknown` case. - -## Methods -### `init(_:)` - -```swift -@inlinable public init(_ caseValue: T) -``` - -### `init(rawValue:)` - -```swift -@inlinable public init(rawValue: String) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| rawValue | The raw value to use for the new instance. | - -### `init(_:)` - -```swift -@inlinable public init(_ rawValue: String) -``` diff --git a/docs/source/api/ApolloAPI/enums/GraphQLNullable.md b/docs/source/api/ApolloAPI/enums/GraphQLNullable.md deleted file mode 100644 index 4fb019a978..0000000000 --- a/docs/source/api/ApolloAPI/enums/GraphQLNullable.md +++ /dev/null @@ -1,56 +0,0 @@ -**ENUM** - -# `GraphQLNullable` - -```swift -public enum GraphQLNullable: ExpressibleByNilLiteral -``` - -Indicates the presence of a value, supporting both `nil` and `null` values. - -In GraphQL, explicitly providing a `null` value for an input value to a field argument is -semantically different from not providing a value at all (`nil`). This enum allows you to -distinguish your input values between `null` and `nil`. - -- See: [GraphQLSpec - Input Values - Null Value](http://spec.graphql.org/June2018/#sec-Null-Value) - -## Cases -### `none` - -```swift -case none -``` - -The absence of a value. -Functionally equivalent to `nil`. - -### `null` - -```swift -case null -``` - -The presence of an explicity null value. -Functionally equivalent to `NSNull` - -### `some(_:)` - -```swift -case some(Wrapped) -``` - -The presence of a value, stored as `Wrapped` - -## Properties -### `unwrapped` - -```swift -@inlinable public var unwrapped: Wrapped? -``` - -## Methods -### `init(nilLiteral:)` - -```swift -@inlinable public init(nilLiteral: ()) -``` diff --git a/docs/source/api/ApolloAPI/enums/GraphQLOperationType.md b/docs/source/api/ApolloAPI/enums/GraphQLOperationType.md deleted file mode 100644 index 0fac3f6d91..0000000000 --- a/docs/source/api/ApolloAPI/enums/GraphQLOperationType.md +++ /dev/null @@ -1,26 +0,0 @@ -**ENUM** - -# `GraphQLOperationType` - -```swift -public enum GraphQLOperationType: Hashable -``` - -## Cases -### `query` - -```swift -case query -``` - -### `mutation` - -```swift -case mutation -``` - -### `subscription` - -```swift -case subscription -``` diff --git a/docs/source/api/ApolloAPI/enums/InputValue.md b/docs/source/api/ApolloAPI/enums/InputValue.md deleted file mode 100644 index b7a2eabbbf..0000000000 --- a/docs/source/api/ApolloAPI/enums/InputValue.md +++ /dev/null @@ -1,61 +0,0 @@ -**ENUM** - -# `InputValue` - -```swift -public indirect enum InputValue -``` - -Represents an input value to an argument on a `Selection.Field`'s `Arguments`. - -- See: [GraphQLSpec - Input Values](http://spec.graphql.org/June2018/#sec-Input-Values) - -## Cases -### `scalar(_:)` - -```swift -case scalar(ScalarType) -``` - -A direct input value, valid types are `String`, `Int` `Float` and `Bool`. -For enum input values, the enum cases's `rawValue` as a `String` should be used. - -### `variable(_:)` - -```swift -case variable(String) -``` - -A variable input value to be evaluated using the operation's `variables` dictionary at runtime. - -`.variable` should only be used as the value for an argument in a `Selection.Field`. -A `.variable` value should not be included in an operation's `variables` dictionary. - -### `list(_:)` - -```swift -case list([InputValue]) -``` - -A GraphQL "List" input value. -- See: [GraphQLSpec - Input Values - List Value](http://spec.graphql.org/June2018/#sec-List-Value) - -### `object(_:)` - -```swift -case object([String: InputValue]) -``` - -A GraphQL "InputObject" input value. Represented as a dictionary of input values. -- See: [GraphQLSpec - Input Values - Input Object Values](http://spec.graphql.org/June2018/#sec-Input-Object-Values) - -### `null` - -```swift -case null -``` - -A null input value. - -A null input value indicates an intentional inclusion of a value for a field argument as null. -- See: [GraphQLSpec - Input Values - Null Value](http://spec.graphql.org/June2018/#sec-Null-Value) diff --git a/docs/source/api/ApolloAPI/enums/JSONDecodingError.md b/docs/source/api/ApolloAPI/enums/JSONDecodingError.md deleted file mode 100644 index 81d87b12c7..0000000000 --- a/docs/source/api/ApolloAPI/enums/JSONDecodingError.md +++ /dev/null @@ -1,65 +0,0 @@ -**ENUM** - -# `JSONDecodingError` - -```swift -public enum JSONDecodingError: Error, LocalizedError, Hashable -``` - -## Cases -### `missingValue` - -```swift -case missingValue -``` - -### `nullValue` - -```swift -case nullValue -``` - -### `wrongType` - -```swift -case wrongType -``` - -### `couldNotConvert(value:to:)` - -```swift -case couldNotConvert(value: AnyHashable, to: Any.Type) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: JSONDecodingError, rhs: JSONDecodingError) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/enums/NoFragments.md b/docs/source/api/ApolloAPI/enums/NoFragments.md deleted file mode 100644 index 7620aebda9..0000000000 --- a/docs/source/api/ApolloAPI/enums/NoFragments.md +++ /dev/null @@ -1,11 +0,0 @@ -**ENUM** - -# `NoFragments` - -```swift -public enum NoFragments -``` - -A `FragmentContainer` to be used by `SelectionSet`s that have no fragments. -This is the default `FragmentContainer` for a `SelectionSet` that does not specify a -`Fragments` type. diff --git a/docs/source/api/ApolloAPI/enums/ParentType.md b/docs/source/api/ApolloAPI/enums/ParentType.md deleted file mode 100644 index 0fb64011c4..0000000000 --- a/docs/source/api/ApolloAPI/enums/ParentType.md +++ /dev/null @@ -1,26 +0,0 @@ -**ENUM** - -# `ParentType` - -```swift -public enum ParentType -``` - -## Cases -### `Object(_:)` - -```swift -case Object(Object.Type) -``` - -### `Interface(_:)` - -```swift -case Interface(Interface.Type) -``` - -### `Union(_:)` - -```swift -case Union(Union.Type) -``` diff --git a/docs/source/api/ApolloAPI/enums/Selection.md b/docs/source/api/ApolloAPI/enums/Selection.md deleted file mode 100644 index eaf2e917c6..0000000000 --- a/docs/source/api/ApolloAPI/enums/Selection.md +++ /dev/null @@ -1,124 +0,0 @@ -**ENUM** - -# `Selection` - -```swift -public enum Selection -``` - -## Cases -### `field(_:)` - -```swift -case field(Field) -``` - -A single field selection. - -### `fragment(_:)` - -```swift -case fragment(Fragment.Type) -``` - -A fragment spread of a named fragment definition. - -### `inlineFragment(_:)` - -```swift -case inlineFragment(ApolloAPI.InlineFragment.Type) -``` - -An inline fragment with a child selection set nested in a parent selection set. - -### `conditional(_:_:)` - -```swift -case conditional(Conditions, [Selection]) -``` - -A group of selections that have `@include/@skip` directives. - -## Methods -### `field(_:alias:_:arguments:)` - -```swift -static public func field( - _ name: String, - alias: String? = nil, - _ type: OutputTypeConvertible.Type, - arguments: [String: InputValue]? = nil -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if condition: String, - _ selection: Selection -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if condition: String, - _ selections: [Selection] -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if conditions: Conditions, - _ selection: Selection -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if conditions: Conditions, - _ selections: [Selection] -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if condition: Condition, - _ selection: Selection -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if condition: Condition, - _ selections: [Selection] -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if conditions: [Condition], - _ selection: Selection -) -> Selection -``` - -### `include(if:_:)` - -```swift -static public func include( - if conditions: [Condition], - _ selections: [Selection] -) -> Selection -``` diff --git a/docs/source/api/ApolloAPI/extensions/AnyHashableConvertible.md b/docs/source/api/ApolloAPI/extensions/AnyHashableConvertible.md deleted file mode 100644 index f93f0777c7..0000000000 --- a/docs/source/api/ApolloAPI/extensions/AnyHashableConvertible.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `AnyHashableConvertible` -```swift -extension AnyHashableConvertible where Self: Hashable -``` - -## Properties -### `asAnyHashable` - -```swift -@inlinable public var asAnyHashable: AnyHashable -``` diff --git a/docs/source/api/ApolloAPI/extensions/AnySelectionSet.md b/docs/source/api/ApolloAPI/extensions/AnySelectionSet.md deleted file mode 100644 index 237754b929..0000000000 --- a/docs/source/api/ApolloAPI/extensions/AnySelectionSet.md +++ /dev/null @@ -1,26 +0,0 @@ -**EXTENSION** - -# `AnySelectionSet` -```swift -extension AnySelectionSet -``` - -## Properties -### `_fieldData` - -```swift -@inlinable public var _fieldData: AnyHashable -``` - -### `selections` - -```swift -static var selections: [Selection] -``` - -## Methods -### `init(fieldData:variables:)` - -```swift -@inlinable public init(fieldData: AnyHashable?, variables: GraphQLOperation.Variables?) -``` diff --git a/docs/source/api/ApolloAPI/extensions/Array.md b/docs/source/api/ApolloAPI/extensions/Array.md deleted file mode 100644 index 0622cc391e..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Array.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `Array` -```swift -extension Array: SelectionSetEntityValue where Element: SelectionSetEntityValue -``` - -## Properties -### `_fieldData` - -```swift -@inlinable public var _fieldData: AnyHashable -``` - -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -@inlinable public static var asOutputType: Selection.Field.OutputType -``` - -## Methods -### `init(fieldData:variables:)` - -```swift -@inlinable public init(fieldData: AnyHashable?, variables: GraphQLOperation.Variables?) -``` diff --git a/docs/source/api/ApolloAPI/extensions/Bool.md b/docs/source/api/ApolloAPI/extensions/Bool.md deleted file mode 100644 index 84d1bda335..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Bool.md +++ /dev/null @@ -1,26 +0,0 @@ -**EXTENSION** - -# `Bool` -```swift -extension Bool: JSONDecodable, JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -public static let asOutputType: Selection.Field.OutputType = .nonNull(.scalar(Bool.self)) -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/CacheKeyProvider.md b/docs/source/api/ApolloAPI/extensions/CacheKeyProvider.md deleted file mode 100644 index 31384a71d1..0000000000 --- a/docs/source/api/ApolloAPI/extensions/CacheKeyProvider.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `CacheKeyProvider` -```swift -extension CacheKeyProvider -``` - -## Properties -### `uniqueKeyGroupId` - -```swift -public static var uniqueKeyGroupId: StaticString? -``` diff --git a/docs/source/api/ApolloAPI/extensions/CacheReference.md b/docs/source/api/ApolloAPI/extensions/CacheReference.md deleted file mode 100644 index b72254747d..0000000000 --- a/docs/source/api/ApolloAPI/extensions/CacheReference.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `CacheReference` -```swift -extension CacheReference: CustomStringConvertible -``` - -## Properties -### `description` - -```swift -public var description: String -``` diff --git a/docs/source/api/ApolloAPI/extensions/CustomScalarType.md b/docs/source/api/ApolloAPI/extensions/CustomScalarType.md deleted file mode 100644 index 50225f28fb..0000000000 --- a/docs/source/api/ApolloAPI/extensions/CustomScalarType.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `CustomScalarType` -```swift -extension CustomScalarType -``` - -## Properties -### `asOutputType` - -```swift -@inlinable public static var asOutputType: Selection.Field.OutputType -``` diff --git a/docs/source/api/ApolloAPI/extensions/Dictionary.md b/docs/source/api/ApolloAPI/extensions/Dictionary.md deleted file mode 100644 index 0edf2ad9e2..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Dictionary.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `Dictionary` -```swift -extension Dictionary: _InitializableByDictionaryLiteralElements -``` - -## Properties -### `jsonEncodableValue` - -```swift -@inlinable public var jsonEncodableValue: JSONEncodable? -``` - -### `jsonEncodableObject` - -```swift -@inlinable public var jsonEncodableObject: JSONEncodableDictionary -``` - -## Methods -### `init(_:)` - -```swift -@inlinable public init(_ elements: [(Key, Value)]) -``` - -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/Double.md b/docs/source/api/ApolloAPI/extensions/Double.md deleted file mode 100644 index b0311b0706..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Double.md +++ /dev/null @@ -1,26 +0,0 @@ -**EXTENSION** - -# `Double` -```swift -extension Double: JSONDecodable, JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -public static let asOutputType: Selection.Field.OutputType = .nonNull(.scalar(Double.self)) -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/EnumType.md b/docs/source/api/ApolloAPI/extensions/EnumType.md deleted file mode 100644 index 3cc570b9f2..0000000000 --- a/docs/source/api/ApolloAPI/extensions/EnumType.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `EnumType` -```swift -extension EnumType -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` diff --git a/docs/source/api/ApolloAPI/extensions/Float.md b/docs/source/api/ApolloAPI/extensions/Float.md deleted file mode 100644 index 5133f5a6cc..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Float.md +++ /dev/null @@ -1,26 +0,0 @@ -**EXTENSION** - -# `Float` -```swift -extension Float: JSONDecodable, JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -public static let asOutputType: Selection.Field.OutputType = .nonNull(.scalar(Float.self)) -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/FragmentContainer.md b/docs/source/api/ApolloAPI/extensions/FragmentContainer.md deleted file mode 100644 index a409293608..0000000000 --- a/docs/source/api/ApolloAPI/extensions/FragmentContainer.md +++ /dev/null @@ -1,43 +0,0 @@ -**EXTENSION** - -# `FragmentContainer` -```swift -extension FragmentContainer -``` - -## Methods -### `_toFragment()` - -```swift -@inlinable public func _toFragment() -> T -``` - -Converts a `SelectionSet` to a `Fragment` given a generic fragment type. - -- Warning: This function is not supported for use outside of generated call sites. -Generated call sites are guaranteed by the GraphQL compiler to be safe. -Unsupported usage may result in unintended consequences including crashes. - -### `_toFragment(if:)` - -```swift -@inlinable public func _toFragment( - if conditions: Selection.Conditions? = nil -) -> T? -``` - -### `_toFragment(if:)` - -```swift -@inlinable public func _toFragment( - if conditions: [Selection.Condition] -) -> T? -``` - -### `_toFragment(if:)` - -```swift -@inlinable public func _toFragment( - if condition: Selection.Condition -) -> T? -``` diff --git a/docs/source/api/ApolloAPI/extensions/GraphQLEnum.md b/docs/source/api/ApolloAPI/extensions/GraphQLEnum.md deleted file mode 100644 index 5c4b854c9b..0000000000 --- a/docs/source/api/ApolloAPI/extensions/GraphQLEnum.md +++ /dev/null @@ -1,51 +0,0 @@ -**EXTENSION** - -# `GraphQLEnum` -```swift -extension GraphQLEnum: CustomScalarType -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: AnyHashable -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue: JSONValue) throws -``` - -### `==(_:_:)` - -```swift -@inlinable public static func ==(lhs: GraphQLEnum, rhs: GraphQLEnum) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `==(_:_:)` - -```swift -@inlinable public static func ==(lhs: GraphQLEnum, rhs: T) -> Bool -``` - -### `!=(_:_:)` - -```swift -@inlinable public static func !=(lhs: GraphQLEnum, rhs: T) -> Bool -``` - -### `~=(_:_:)` - -```swift -@inlinable public static func ~=(lhs: T, rhs: GraphQLEnum) -> Bool -``` diff --git a/docs/source/api/ApolloAPI/extensions/GraphQLMutation.md b/docs/source/api/ApolloAPI/extensions/GraphQLMutation.md deleted file mode 100644 index 396ee79cfd..0000000000 --- a/docs/source/api/ApolloAPI/extensions/GraphQLMutation.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `GraphQLMutation` -```swift -public extension GraphQLMutation -``` - -## Properties -### `operationType` - -```swift -@inlinable static var operationType: GraphQLOperationType -``` diff --git a/docs/source/api/ApolloAPI/extensions/GraphQLNullable.md b/docs/source/api/ApolloAPI/extensions/GraphQLNullable.md deleted file mode 100644 index 15989b7d81..0000000000 --- a/docs/source/api/ApolloAPI/extensions/GraphQLNullable.md +++ /dev/null @@ -1,111 +0,0 @@ -**EXTENSION** - -# `GraphQLNullable` -```swift -extension GraphQLNullable: ExpressibleByUnicodeScalarLiteral -where Wrapped: ExpressibleByUnicodeScalarLiteral -``` - -## Properties -### `jsonEncodableValue` - -```swift -@inlinable public var jsonEncodableValue: JSONEncodable? -``` - -## Methods -### `init(unicodeScalarLiteral:)` - -```swift -@inlinable public init(unicodeScalarLiteral value: Wrapped.UnicodeScalarLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(extendedGraphemeClusterLiteral:)` - -```swift -@inlinable public init(extendedGraphemeClusterLiteral value: Wrapped.ExtendedGraphemeClusterLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(stringLiteral:)` - -```swift -@inlinable public init(stringLiteral value: Wrapped.StringLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(integerLiteral:)` - -```swift -@inlinable public init(integerLiteral value: Wrapped.IntegerLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value to create. | - -### `init(floatLiteral:)` - -```swift -@inlinable public init(floatLiteral value: Wrapped.FloatLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value to create. | - -### `init(booleanLiteral:)` - -```swift -@inlinable public init(booleanLiteral value: Wrapped.BooleanLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(arrayLiteral:)` - -```swift -@inlinable public init(arrayLiteral elements: Wrapped.ArrayLiteralElement...) -``` - -### `init(dictionaryLiteral:)` - -```swift -@inlinable public init(dictionaryLiteral elements: (Wrapped.Key, Wrapped.Value)...) -``` - -### `init(_:)` - -```swift -@inlinable init(_ caseValue: T) where Wrapped == GraphQLEnum -``` - -### `init(_:)` - -```swift -@inlinable init(_ object: Wrapped) where Wrapped: InputObject -``` diff --git a/docs/source/api/ApolloAPI/extensions/GraphQLOperation.md b/docs/source/api/ApolloAPI/extensions/GraphQLOperation.md deleted file mode 100644 index cf853feb05..0000000000 --- a/docs/source/api/ApolloAPI/extensions/GraphQLOperation.md +++ /dev/null @@ -1,51 +0,0 @@ -**EXTENSION** - -# `GraphQLOperation` -```swift -public extension GraphQLOperation -``` - -## Properties -### `variables` - -```swift -var variables: Variables? -``` - -### `definition` - -```swift -static var definition: OperationDefinition? -``` - -### `operationIdentifier` - -```swift -static var operationIdentifier: String? -``` - -## Methods -### `==(_:_:)` - -```swift -static func ==(lhs: Self, rhs: Self) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/GraphQLQuery.md b/docs/source/api/ApolloAPI/extensions/GraphQLQuery.md deleted file mode 100644 index a7f4740ff7..0000000000 --- a/docs/source/api/ApolloAPI/extensions/GraphQLQuery.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `GraphQLQuery` -```swift -public extension GraphQLQuery -``` - -## Properties -### `operationType` - -```swift -@inlinable static var operationType: GraphQLOperationType -``` diff --git a/docs/source/api/ApolloAPI/extensions/GraphQLSubscription.md b/docs/source/api/ApolloAPI/extensions/GraphQLSubscription.md deleted file mode 100644 index 9e994a8537..0000000000 --- a/docs/source/api/ApolloAPI/extensions/GraphQLSubscription.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `GraphQLSubscription` -```swift -public extension GraphQLSubscription -``` - -## Properties -### `operationType` - -```swift -@inlinable static var operationType: GraphQLOperationType -``` diff --git a/docs/source/api/ApolloAPI/extensions/InputObject.md b/docs/source/api/ApolloAPI/extensions/InputObject.md deleted file mode 100644 index e3e4f55ca0..0000000000 --- a/docs/source/api/ApolloAPI/extensions/InputObject.md +++ /dev/null @@ -1,45 +0,0 @@ -**EXTENSION** - -# `InputObject` -```swift -extension InputObject -``` - -## Properties -### `jsonValue` - -```swift -public var jsonValue: JSONValue -``` - -### `jsonEncodableValue` - -```swift -public var jsonEncodableValue: JSONEncodable? -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: Self, rhs: Self) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/InputValue.md b/docs/source/api/ApolloAPI/extensions/InputValue.md deleted file mode 100644 index 8835df1f7e..0000000000 --- a/docs/source/api/ApolloAPI/extensions/InputValue.md +++ /dev/null @@ -1,92 +0,0 @@ -**EXTENSION** - -# `InputValue` -```swift -extension InputValue: ExpressibleByStringLiteral -``` - -## Methods -### `init(stringLiteral:)` - -```swift -@inlinable public init(stringLiteral value: StringLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(integerLiteral:)` - -```swift -@inlinable public init(integerLiteral value: IntegerLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value to create. | - -### `init(floatLiteral:)` - -```swift -@inlinable public init(floatLiteral value: FloatLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value to create. | - -### `init(booleanLiteral:)` - -```swift -@inlinable public init(booleanLiteral value: BooleanLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(arrayLiteral:)` - -```swift -@inlinable public init(arrayLiteral elements: InputValue...) -``` - -### `init(dictionaryLiteral:)` - -```swift -@inlinable public init(dictionaryLiteral elements: (String, InputValue)...) -``` - -### `==(_:_:)` - -```swift -public static func == (lhs: InputValue, rhs: InputValue) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/Int.md b/docs/source/api/ApolloAPI/extensions/Int.md deleted file mode 100644 index 7ea9ea8ec6..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Int.md +++ /dev/null @@ -1,26 +0,0 @@ -**EXTENSION** - -# `Int` -```swift -extension Int: JSONDecodable, JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -public static let asOutputType: Selection.Field.OutputType = .nonNull(.scalar(Int.self)) -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/Interface.md b/docs/source/api/ApolloAPI/extensions/Interface.md deleted file mode 100644 index b57f661b04..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Interface.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Interface` -```swift -extension Interface -``` - -## Properties -### `asParentType` - -```swift -@inlinable public static var asParentType: ParentType -``` diff --git a/docs/source/api/ApolloAPI/extensions/JSONEncodable.md b/docs/source/api/ApolloAPI/extensions/JSONEncodable.md deleted file mode 100644 index 3fe148c3dc..0000000000 --- a/docs/source/api/ApolloAPI/extensions/JSONEncodable.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `JSONEncodable` -```swift -extension JSONEncodable where Self: GraphQLOperationVariableValue -``` - -## Properties -### `jsonEncodableValue` - -```swift -@inlinable public var jsonEncodableValue: JSONEncodable? -``` diff --git a/docs/source/api/ApolloAPI/extensions/JSONEncodableDictionary.md b/docs/source/api/ApolloAPI/extensions/JSONEncodableDictionary.md deleted file mode 100644 index 5e8e4ea7f3..0000000000 --- a/docs/source/api/ApolloAPI/extensions/JSONEncodableDictionary.md +++ /dev/null @@ -1,25 +0,0 @@ -**EXTENSION** - -# `JSONEncodableDictionary` -```swift -extension JSONEncodableDictionary: AnyHashableConvertible where Value: Hashable -``` - -## Properties -### `asAnyHashable` - -```swift -@inlinable public var asAnyHashable: AnyHashable -``` - -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `jsonObject` - -```swift -@inlinable public var jsonObject: JSONObject -``` diff --git a/docs/source/api/ApolloAPI/extensions/LocalCacheMutation.md b/docs/source/api/ApolloAPI/extensions/LocalCacheMutation.md deleted file mode 100644 index 09dfc867ea..0000000000 --- a/docs/source/api/ApolloAPI/extensions/LocalCacheMutation.md +++ /dev/null @@ -1,39 +0,0 @@ -**EXTENSION** - -# `LocalCacheMutation` -```swift -public extension LocalCacheMutation -``` - -## Properties -### `variables` - -```swift -var variables: GraphQLOperation.Variables? -``` - -## Methods -### `hash(into:)` - -```swift -func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -static func ==(lhs: Self, rhs: Self) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/MutableSelectionSet.md b/docs/source/api/ApolloAPI/extensions/MutableSelectionSet.md deleted file mode 100644 index a7416a12e0..0000000000 --- a/docs/source/api/ApolloAPI/extensions/MutableSelectionSet.md +++ /dev/null @@ -1,19 +0,0 @@ -**EXTENSION** - -# `MutableSelectionSet` -```swift -public extension MutableSelectionSet -``` - -## Properties -### `__typename` - -```swift -@inlinable var __typename: String -``` - -### `fragments` - -```swift -@inlinable var fragments: Fragments -``` diff --git a/docs/source/api/ApolloAPI/extensions/NSDictionary.md b/docs/source/api/ApolloAPI/extensions/NSDictionary.md deleted file mode 100644 index 96a7397505..0000000000 --- a/docs/source/api/ApolloAPI/extensions/NSDictionary.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `NSDictionary` -```swift -extension NSDictionary: JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` diff --git a/docs/source/api/ApolloAPI/extensions/NSNull.md b/docs/source/api/ApolloAPI/extensions/NSNull.md deleted file mode 100644 index a14c646580..0000000000 --- a/docs/source/api/ApolloAPI/extensions/NSNull.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `NSNull` -```swift -extension NSNull: JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` diff --git a/docs/source/api/ApolloAPI/extensions/Object.md b/docs/source/api/ApolloAPI/extensions/Object.md deleted file mode 100644 index f2a3b33dc5..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Object.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Object` -```swift -extension Object: ParentTypeConvertible -``` - -## Properties -### `asParentType` - -```swift -@inlinable public static var asParentType: ParentType -``` diff --git a/docs/source/api/ApolloAPI/extensions/Optional.md b/docs/source/api/ApolloAPI/extensions/Optional.md deleted file mode 100644 index 147a1614a4..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Optional.md +++ /dev/null @@ -1,44 +0,0 @@ -**EXTENSION** - -# `Optional` -```swift -extension Optional: SelectionSetEntityValue where Wrapped: SelectionSetEntityValue -``` - -## Properties -### `_fieldData` - -```swift -@inlinable public var _fieldData: AnyHashable -``` - -### `jsonEncodableValue` - -```swift -@inlinable public var jsonEncodableValue: JSONEncodable? -``` - -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -@inlinable public static var asOutputType: Selection.Field.OutputType -``` - -## Methods -### `init(fieldData:variables:)` - -```swift -@inlinable public init(fieldData: AnyHashable?, variables: GraphQLOperation.Variables?) -``` - -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/ParentType.md b/docs/source/api/ApolloAPI/extensions/ParentType.md deleted file mode 100644 index 01bb544492..0000000000 --- a/docs/source/api/ApolloAPI/extensions/ParentType.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `ParentType` -```swift -extension ParentType: Hashable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: ParentType, rhs: ParentType) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/RawRepresentable.md b/docs/source/api/ApolloAPI/extensions/RawRepresentable.md deleted file mode 100644 index dedf260811..0000000000 --- a/docs/source/api/ApolloAPI/extensions/RawRepresentable.md +++ /dev/null @@ -1,20 +0,0 @@ -**EXTENSION** - -# `RawRepresentable` -```swift -extension RawRepresentable where RawValue: JSONDecodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/RootSelectionSet.md b/docs/source/api/ApolloAPI/extensions/RootSelectionSet.md deleted file mode 100644 index bc41c1e34a..0000000000 --- a/docs/source/api/ApolloAPI/extensions/RootSelectionSet.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `RootSelectionSet` -```swift -extension RootSelectionSet -``` - -## Properties -### `asOutputType` - -```swift -@inlinable public static var asOutputType: Selection.Field.OutputType -``` diff --git a/docs/source/api/ApolloAPI/extensions/SchemaConfiguration.md b/docs/source/api/ApolloAPI/extensions/SchemaConfiguration.md deleted file mode 100644 index 4bfb98743f..0000000000 --- a/docs/source/api/ApolloAPI/extensions/SchemaConfiguration.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `SchemaConfiguration` -```swift -extension SchemaConfiguration -``` - -## Methods -### `cacheKey(for:)` - -```swift -public static func cacheKey(for data: JSONObject) -> CacheReference? -``` diff --git a/docs/source/api/ApolloAPI/extensions/Selection.Conditions.md b/docs/source/api/ApolloAPI/extensions/Selection.Conditions.md deleted file mode 100644 index dccf897f1b..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Selection.Conditions.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Selection.Conditions` -```swift -public extension Selection.Conditions -``` - -## Methods -### `evaluate(with:)` - -```swift -func evaluate(with variables: GraphQLOperation.Variables?) -> Bool -``` diff --git a/docs/source/api/ApolloAPI/extensions/Selection.Field.OutputType.md b/docs/source/api/ApolloAPI/extensions/Selection.Field.OutputType.md deleted file mode 100644 index 59d39d0724..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Selection.Field.OutputType.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `Selection.Field.OutputType` -```swift -extension Selection.Field.OutputType: Hashable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: Selection.Field.OutputType, rhs: Selection.Field.OutputType) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/Selection.Field.md b/docs/source/api/ApolloAPI/extensions/Selection.Field.md deleted file mode 100644 index 16e07fca91..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Selection.Field.md +++ /dev/null @@ -1,20 +0,0 @@ -**EXTENSION** - -# `Selection.Field` -```swift -extension Selection.Field: Hashable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: Selection.Field, rhs: Selection.Field) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/Selection.md b/docs/source/api/ApolloAPI/extensions/Selection.md deleted file mode 100644 index 7040907341..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Selection.md +++ /dev/null @@ -1,32 +0,0 @@ -**EXTENSION** - -# `Selection` -```swift -extension Selection: Hashable -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: Selection, rhs: Selection) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/SelectionSet.md b/docs/source/api/ApolloAPI/extensions/SelectionSet.md deleted file mode 100644 index f179f9c93e..0000000000 --- a/docs/source/api/ApolloAPI/extensions/SelectionSet.md +++ /dev/null @@ -1,84 +0,0 @@ -**EXTENSION** - -# `SelectionSet` -```swift -extension SelectionSet -``` - -## Properties -### `schema` - -```swift -@inlinable public static var schema: SchemaConfiguration.Type -``` - -### `__typename` - -```swift -@inlinable public var __typename: String -``` - -### `fragments` - -```swift -public var fragments: Fragments -``` - -Contains accessors for all of the fragments the `SelectionSet` can be converted to. - -## Methods -### `_asInlineFragment(if:)` - -```swift -@inlinable public func _asInlineFragment( - if conditions: Selection.Conditions? = nil -) -> T? where T.Schema == Schema -``` - -Verifies if a `SelectionSet` may be converted to an `InlineFragment` and performs -the conversion. - -- Warning: This function is not supported for use outside of generated call sites. -Generated call sites are guaranteed by the GraphQL compiler to be safe. -Unsupported usage may result in unintended consequences including crashes. - -### `_asInlineFragment(if:)` - -```swift -@inlinable public func _asInlineFragment( - if conditions: [Selection.Condition] -) -> T? where T.Schema == Schema -``` - -### `_asInlineFragment(if:)` - -```swift -@inlinable public func _asInlineFragment( - if condition: Selection.Condition -) -> T? where T.Schema == Schema -``` - -### `hash(into:)` - -```swift -@inlinable public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -@inlinable public static func ==(lhs: Self, rhs: Self) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/extensions/String.md b/docs/source/api/ApolloAPI/extensions/String.md deleted file mode 100644 index 7a9714905c..0000000000 --- a/docs/source/api/ApolloAPI/extensions/String.md +++ /dev/null @@ -1,26 +0,0 @@ -**EXTENSION** - -# `String` -```swift -extension String: JSONDecodable, JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -### `asOutputType` - -```swift -public static let asOutputType: Selection.Field.OutputType = .nonNull(.scalar(String.self)) -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/URL.md b/docs/source/api/ApolloAPI/extensions/URL.md deleted file mode 100644 index 3d866797e6..0000000000 --- a/docs/source/api/ApolloAPI/extensions/URL.md +++ /dev/null @@ -1,20 +0,0 @@ -**EXTENSION** - -# `URL` -```swift -extension URL: JSONDecodable, JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -@inlinable public var jsonValue: JSONValue -``` - -## Methods -### `init(jsonValue:)` - -```swift -@inlinable public init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/extensions/Union.md b/docs/source/api/ApolloAPI/extensions/Union.md deleted file mode 100644 index 7fc7849ca2..0000000000 --- a/docs/source/api/ApolloAPI/extensions/Union.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Union` -```swift -extension Union -``` - -## Properties -### `asParentType` - -```swift -@inlinable public static var asParentType: ParentType -``` diff --git a/docs/source/api/ApolloAPI/methods/!=(____).md b/docs/source/api/ApolloAPI/methods/!=(____).md deleted file mode 100644 index cd29d7b499..0000000000 --- a/docs/source/api/ApolloAPI/methods/!=(____).md +++ /dev/null @@ -1,6 +0,0 @@ -### `!=(_:_:)` - -```swift -@inlinable public func !=(lhs: GraphQLEnum?, rhs: T) -> Bool -where T.RawValue == String -``` diff --git a/docs/source/api/ApolloAPI/methods/==(____).md b/docs/source/api/ApolloAPI/methods/==(____).md deleted file mode 100644 index 08055c2425..0000000000 --- a/docs/source/api/ApolloAPI/methods/==(____).md +++ /dev/null @@ -1,6 +0,0 @@ -### `==(_:_:)` - -```swift -@inlinable public func ==(lhs: GraphQLEnum?, rhs: T) -> Bool -where T.RawValue == String -``` diff --git a/docs/source/api/ApolloAPI/methods/__(____).md b/docs/source/api/ApolloAPI/methods/__(____).md deleted file mode 100644 index 122d1a3d63..0000000000 --- a/docs/source/api/ApolloAPI/methods/__(____).md +++ /dev/null @@ -1,5 +0,0 @@ -### `??(_:_:)` - -```swift -@inlinable public func ??(lhs: T?, rhs: GraphQLNullable) -> GraphQLNullable -``` diff --git a/docs/source/api/ApolloAPI/protocols/AnyHashableConvertible.md b/docs/source/api/ApolloAPI/protocols/AnyHashableConvertible.md deleted file mode 100644 index 43ea2be3e1..0000000000 --- a/docs/source/api/ApolloAPI/protocols/AnyHashableConvertible.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `AnyHashableConvertible` - -```swift -public protocol AnyHashableConvertible -``` - -## Properties -### `asAnyHashable` - -```swift -var asAnyHashable: AnyHashable -``` diff --git a/docs/source/api/ApolloAPI/protocols/AnyScalarType.md b/docs/source/api/ApolloAPI/protocols/AnyScalarType.md deleted file mode 100644 index d4405419c6..0000000000 --- a/docs/source/api/ApolloAPI/protocols/AnyScalarType.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `AnyScalarType` - -```swift -public protocol AnyScalarType: JSONEncodable, AnyHashableConvertible -``` diff --git a/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md b/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md deleted file mode 100644 index a31b0fa96b..0000000000 --- a/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md +++ /dev/null @@ -1,43 +0,0 @@ -**PROTOCOL** - -# `AnySelectionSet` - -```swift -public protocol AnySelectionSet: SelectionSetEntityValue -``` - -## Properties -### `schema` - -```swift -static var schema: SchemaConfiguration.Type -``` - -### `selections` - -```swift -static var selections: [Selection] -``` - -### `__parentType` - -```swift -static var __parentType: ParentType -``` - -The GraphQL type for the `SelectionSet`. - -This may be a concrete type (`Object`) or an abstract type (`Interface`, or `Union`). - -### `__data` - -```swift -var __data: DataDict -``` - -## Methods -### `init(data:)` - -```swift -init(data: DataDict) -``` diff --git a/docs/source/api/ApolloAPI/protocols/CacheEntity.md b/docs/source/api/ApolloAPI/protocols/CacheEntity.md deleted file mode 100644 index 4548da9518..0000000000 --- a/docs/source/api/ApolloAPI/protocols/CacheEntity.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `CacheEntity` - -```swift -public protocol CacheEntity: AnyObject -``` diff --git a/docs/source/api/ApolloAPI/protocols/CacheKeyProvider.md b/docs/source/api/ApolloAPI/protocols/CacheKeyProvider.md deleted file mode 100644 index a334720c19..0000000000 --- a/docs/source/api/ApolloAPI/protocols/CacheKeyProvider.md +++ /dev/null @@ -1,21 +0,0 @@ -**PROTOCOL** - -# `CacheKeyProvider` - -```swift -public protocol CacheKeyProvider -``` - -## Properties -### `uniqueKeyGroupId` - -```swift -static var uniqueKeyGroupId: StaticString? -``` - -## Methods -### `cacheKey(for:)` - -```swift -static func cacheKey(for data: JSONObject) -> String? -``` diff --git a/docs/source/api/ApolloAPI/protocols/CustomScalarType.md b/docs/source/api/ApolloAPI/protocols/CustomScalarType.md deleted file mode 100644 index 4a58f65045..0000000000 --- a/docs/source/api/ApolloAPI/protocols/CustomScalarType.md +++ /dev/null @@ -1,18 +0,0 @@ -**PROTOCOL** - -# `CustomScalarType` - -```swift -public protocol CustomScalarType: - AnyScalarType, - JSONDecodable, - OutputTypeConvertible, - GraphQLOperationVariableValue -``` - -## Properties -### `jsonValue` - -```swift -var jsonValue: JSONValue -``` diff --git a/docs/source/api/ApolloAPI/protocols/EnumType.md b/docs/source/api/ApolloAPI/protocols/EnumType.md deleted file mode 100644 index 61b2a642a9..0000000000 --- a/docs/source/api/ApolloAPI/protocols/EnumType.md +++ /dev/null @@ -1,15 +0,0 @@ -**PROTOCOL** - -# `EnumType` - -```swift -public protocol EnumType: - RawRepresentable, - CaseIterable, - JSONEncodable, - GraphQLOperationVariableValue -where RawValue == String -``` - -A protocol that a generated enum from a GraphQL schema conforms to. -This allows it to be wrapped in a `GraphQLEnum` and be used as an input value for operations. diff --git a/docs/source/api/ApolloAPI/protocols/Fragment.md b/docs/source/api/ApolloAPI/protocols/Fragment.md deleted file mode 100644 index 2c3a1e5b3c..0000000000 --- a/docs/source/api/ApolloAPI/protocols/Fragment.md +++ /dev/null @@ -1,19 +0,0 @@ -**PROTOCOL** - -# `Fragment` - -```swift -public protocol Fragment: AnySelectionSet -``` - -A protocol representing a fragment that a `SelectionSet` object may be converted to. - -A `SelectionSet` can be converted to any `Fragment` included in it's `Fragments` object via -its `fragments` property. - -## Properties -### `fragmentDefinition` - -```swift -static var fragmentDefinition: StaticString -``` diff --git a/docs/source/api/ApolloAPI/protocols/FragmentContainer.md b/docs/source/api/ApolloAPI/protocols/FragmentContainer.md deleted file mode 100644 index 875b777c5f..0000000000 --- a/docs/source/api/ApolloAPI/protocols/FragmentContainer.md +++ /dev/null @@ -1,21 +0,0 @@ -**PROTOCOL** - -# `FragmentContainer` - -```swift -public protocol FragmentContainer -``` - -## Properties -### `__data` - -```swift -var __data: DataDict -``` - -## Methods -### `init(data:)` - -```swift -init(data: DataDict) -``` diff --git a/docs/source/api/ApolloAPI/protocols/GraphQLMutation.md b/docs/source/api/ApolloAPI/protocols/GraphQLMutation.md deleted file mode 100644 index f08bfe5d54..0000000000 --- a/docs/source/api/ApolloAPI/protocols/GraphQLMutation.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `GraphQLMutation` - -```swift -public protocol GraphQLMutation: GraphQLOperation -``` diff --git a/docs/source/api/ApolloAPI/protocols/GraphQLOperation.md b/docs/source/api/ApolloAPI/protocols/GraphQLOperation.md deleted file mode 100644 index 9bca04cedc..0000000000 --- a/docs/source/api/ApolloAPI/protocols/GraphQLOperation.md +++ /dev/null @@ -1,32 +0,0 @@ -**PROTOCOL** - -# `GraphQLOperation` - -```swift -public protocol GraphQLOperation: AnyObject, Hashable -``` - -## Properties -### `operationName` - -```swift -static var operationName: String -``` - -### `operationType` - -```swift -static var operationType: GraphQLOperationType -``` - -### `document` - -```swift -static var document: DocumentType -``` - -### `variables` - -```swift -var variables: Variables? -``` diff --git a/docs/source/api/ApolloAPI/protocols/GraphQLOperationVariableValue.md b/docs/source/api/ApolloAPI/protocols/GraphQLOperationVariableValue.md deleted file mode 100644 index ea6a28e5d3..0000000000 --- a/docs/source/api/ApolloAPI/protocols/GraphQLOperationVariableValue.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `GraphQLOperationVariableValue` - -```swift -public protocol GraphQLOperationVariableValue -``` - -## Properties -### `jsonEncodableValue` - -```swift -var jsonEncodableValue: JSONEncodable? -``` diff --git a/docs/source/api/ApolloAPI/protocols/GraphQLQuery.md b/docs/source/api/ApolloAPI/protocols/GraphQLQuery.md deleted file mode 100644 index c838f06b36..0000000000 --- a/docs/source/api/ApolloAPI/protocols/GraphQLQuery.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `GraphQLQuery` - -```swift -public protocol GraphQLQuery: GraphQLOperation -``` diff --git a/docs/source/api/ApolloAPI/protocols/GraphQLSubscription.md b/docs/source/api/ApolloAPI/protocols/GraphQLSubscription.md deleted file mode 100644 index 8bc7806ae2..0000000000 --- a/docs/source/api/ApolloAPI/protocols/GraphQLSubscription.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `GraphQLSubscription` - -```swift -public protocol GraphQLSubscription: GraphQLOperation -``` diff --git a/docs/source/api/ApolloAPI/protocols/InlineFragment.md b/docs/source/api/ApolloAPI/protocols/InlineFragment.md deleted file mode 100644 index d4035bd358..0000000000 --- a/docs/source/api/ApolloAPI/protocols/InlineFragment.md +++ /dev/null @@ -1,19 +0,0 @@ -**PROTOCOL** - -# `InlineFragment` - -```swift -public protocol InlineFragment: AnySelectionSet -``` - -A selection set that represents an inline fragment nested inside a `RootSelectionSet`. - -An `InlineFragment` can only ever exist as a nested selection set within a `RootSelectionSet`. -Each `InlineFragment` represents additional fields to be selected if the underlying -type.inclusion condition of the object data returned for the selection set is met. - -An `InlineFragment` will only include the specific `selections` that should be selected for that -`InlineFragment`. But the code generation engine will create accessor fields for any fields -from the fragment's parent `RootSelectionSet` that will be selected. This includes fields from -the parent selection set, as well as any other child selections sets that are compatible with -the `InlineFragment`'s `__parentType` and the operation's inclusion condition. diff --git a/docs/source/api/ApolloAPI/protocols/InputObject.md b/docs/source/api/ApolloAPI/protocols/InputObject.md deleted file mode 100644 index a1f0e031bd..0000000000 --- a/docs/source/api/ApolloAPI/protocols/InputObject.md +++ /dev/null @@ -1,18 +0,0 @@ -**PROTOCOL** - -# `InputObject` - -```swift -public protocol InputObject: GraphQLOperationVariableValue, JSONEncodable, Hashable -``` - -An protocol for a struct that represents a GraphQL Input Object. - -- See: [GraphQLSpec - Input Objects](https://spec.graphql.org/draft/#sec-Input-Objects) - -## Properties -### `__data` - -```swift -var __data: InputDict -``` diff --git a/docs/source/api/ApolloAPI/protocols/JSONDecodable.md b/docs/source/api/ApolloAPI/protocols/JSONDecodable.md deleted file mode 100644 index 5428f50874..0000000000 --- a/docs/source/api/ApolloAPI/protocols/JSONDecodable.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `JSONDecodable` - -```swift -public protocol JSONDecodable: AnyHashableConvertible -``` - -## Methods -### `init(jsonValue:)` - -```swift -init(jsonValue value: JSONValue) throws -``` diff --git a/docs/source/api/ApolloAPI/protocols/JSONEncodable.md b/docs/source/api/ApolloAPI/protocols/JSONEncodable.md deleted file mode 100644 index 6fb7ef518c..0000000000 --- a/docs/source/api/ApolloAPI/protocols/JSONEncodable.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `JSONEncodable` - -```swift -public protocol JSONEncodable -``` - -## Properties -### `jsonValue` - -```swift -var jsonValue: JSONValue -``` diff --git a/docs/source/api/ApolloAPI/protocols/LocalCacheMutation.md b/docs/source/api/ApolloAPI/protocols/LocalCacheMutation.md deleted file mode 100644 index 519b64cc9d..0000000000 --- a/docs/source/api/ApolloAPI/protocols/LocalCacheMutation.md +++ /dev/null @@ -1,20 +0,0 @@ -**PROTOCOL** - -# `LocalCacheMutation` - -```swift -public protocol LocalCacheMutation: AnyObject, Hashable -``` - -## Properties -### `operationType` - -```swift -static var operationType: GraphQLOperationType -``` - -### `variables` - -```swift -var variables: GraphQLOperation.Variables? -``` diff --git a/docs/source/api/ApolloAPI/protocols/MutableRootSelectionSet.md b/docs/source/api/ApolloAPI/protocols/MutableRootSelectionSet.md deleted file mode 100644 index dd6abf2d2a..0000000000 --- a/docs/source/api/ApolloAPI/protocols/MutableRootSelectionSet.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `MutableRootSelectionSet` - -```swift -public protocol MutableRootSelectionSet: RootSelectionSet, MutableSelectionSet -``` diff --git a/docs/source/api/ApolloAPI/protocols/MutableSelectionSet.md b/docs/source/api/ApolloAPI/protocols/MutableSelectionSet.md deleted file mode 100644 index fdebed1bb7..0000000000 --- a/docs/source/api/ApolloAPI/protocols/MutableSelectionSet.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `MutableSelectionSet` - -```swift -public protocol MutableSelectionSet: SelectionSet -``` - -## Properties -### `__data` - -```swift -var __data: DataDict -``` diff --git a/docs/source/api/ApolloAPI/protocols/OutputTypeConvertible.md b/docs/source/api/ApolloAPI/protocols/OutputTypeConvertible.md deleted file mode 100644 index 5ab5866222..0000000000 --- a/docs/source/api/ApolloAPI/protocols/OutputTypeConvertible.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `OutputTypeConvertible` - -```swift -public protocol OutputTypeConvertible -``` - -## Properties -### `asOutputType` - -```swift -@inlinable static var asOutputType: Selection.Field.OutputType -``` diff --git a/docs/source/api/ApolloAPI/protocols/ParentTypeConvertible.md b/docs/source/api/ApolloAPI/protocols/ParentTypeConvertible.md deleted file mode 100644 index e536d3aab7..0000000000 --- a/docs/source/api/ApolloAPI/protocols/ParentTypeConvertible.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `ParentTypeConvertible` - -```swift -public protocol ParentTypeConvertible -``` - -## Properties -### `asParentType` - -```swift -@inlinable static var asParentType: ParentType -``` diff --git a/docs/source/api/ApolloAPI/protocols/RootSelectionSet.md b/docs/source/api/ApolloAPI/protocols/RootSelectionSet.md deleted file mode 100644 index 21bd44a133..0000000000 --- a/docs/source/api/ApolloAPI/protocols/RootSelectionSet.md +++ /dev/null @@ -1,22 +0,0 @@ -**PROTOCOL** - -# `RootSelectionSet` - -```swift -public protocol RootSelectionSet: AnySelectionSet, OutputTypeConvertible -``` - -A selection set that represents the root selections on its `__parentType`. Nested selection -sets for type cases are not `RootSelectionSet`s. - -While a `TypeCase` only provides the additional selections that should be selected for its -specific type, a `RootSelectionSet` guarantees that all fields for itself and its nested type -cases are selected. - -When considering a specific `TypeCase`, all fields will be selected either by the root selection -set, a fragment spread, the type case itself, or another compatible `TypeCase` on the root -selection set. - -This is why only a `RootSelectionSet` can be executed by a `GraphQLExecutor`. Executing a -non-root selection set would result in fields from the root selection set not being collected -into the `ResponseDict` for the `SelectionSet`'s data. diff --git a/docs/source/api/ApolloAPI/protocols/ScalarType.md b/docs/source/api/ApolloAPI/protocols/ScalarType.md deleted file mode 100644 index bfa4b228fc..0000000000 --- a/docs/source/api/ApolloAPI/protocols/ScalarType.md +++ /dev/null @@ -1,10 +0,0 @@ -**PROTOCOL** - -# `ScalarType` - -```swift -public protocol ScalarType: - AnyScalarType, - JSONDecodable, - GraphQLOperationVariableValue -``` diff --git a/docs/source/api/ApolloAPI/protocols/SchemaConfiguration.md b/docs/source/api/ApolloAPI/protocols/SchemaConfiguration.md deleted file mode 100644 index d706db76f8..0000000000 --- a/docs/source/api/ApolloAPI/protocols/SchemaConfiguration.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `SchemaConfiguration` - -```swift -public protocol SchemaConfiguration -``` - -## Methods -### `objectType(forTypename:)` - -```swift -static func objectType(forTypename __typename: String) -> Object.Type? -``` diff --git a/docs/source/api/ApolloAPI/protocols/SchemaUnknownTypeCacheKeyProvider.md b/docs/source/api/ApolloAPI/protocols/SchemaUnknownTypeCacheKeyProvider.md deleted file mode 100644 index ee582d235c..0000000000 --- a/docs/source/api/ApolloAPI/protocols/SchemaUnknownTypeCacheKeyProvider.md +++ /dev/null @@ -1,17 +0,0 @@ -**PROTOCOL** - -# `SchemaUnknownTypeCacheKeyProvider` - -```swift -public protocol SchemaUnknownTypeCacheKeyProvider -``` - -## Methods -### `cacheKeyProviderForUnknownType(withTypename:data:)` - -```swift -static func cacheKeyProviderForUnknownType( - withTypename: String, - data: JSONObject -) -> CacheKeyProvider.Type? -``` diff --git a/docs/source/api/ApolloAPI/protocols/SelectionSet.md b/docs/source/api/ApolloAPI/protocols/SelectionSet.md deleted file mode 100644 index 990704dc6d..0000000000 --- a/docs/source/api/ApolloAPI/protocols/SelectionSet.md +++ /dev/null @@ -1,7 +0,0 @@ -**PROTOCOL** - -# `SelectionSet` - -```swift -public protocol SelectionSet: AnySelectionSet, Hashable -``` diff --git a/docs/source/api/ApolloAPI/protocols/SelectionSetEntityValue.md b/docs/source/api/ApolloAPI/protocols/SelectionSetEntityValue.md deleted file mode 100644 index caf954feb4..0000000000 --- a/docs/source/api/ApolloAPI/protocols/SelectionSetEntityValue.md +++ /dev/null @@ -1,21 +0,0 @@ -**PROTOCOL** - -# `SelectionSetEntityValue` - -```swift -public protocol SelectionSetEntityValue -``` - -## Properties -### `_fieldData` - -```swift -var _fieldData: AnyHashable -``` - -## Methods -### `init(fieldData:variables:)` - -```swift -init(fieldData: AnyHashable?, variables: GraphQLOperation.Variables?) -``` diff --git a/docs/source/api/ApolloAPI/protocols/Union.md b/docs/source/api/ApolloAPI/protocols/Union.md deleted file mode 100644 index 5c6a0390d9..0000000000 --- a/docs/source/api/ApolloAPI/protocols/Union.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `Union` - -```swift -public protocol Union: ParentTypeConvertible -``` - -## Properties -### `possibleTypes` - -```swift -static var possibleTypes: [Object.Type] -``` diff --git a/docs/source/api/ApolloAPI/protocols/_InitializableByArrayLiteralElements.md b/docs/source/api/ApolloAPI/protocols/_InitializableByArrayLiteralElements.md deleted file mode 100644 index 072afc2b93..0000000000 --- a/docs/source/api/ApolloAPI/protocols/_InitializableByArrayLiteralElements.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `_InitializableByArrayLiteralElements` - -```swift -public protocol _InitializableByArrayLiteralElements: ExpressibleByArrayLiteral -``` - -## Methods -### `init(_:)` - -```swift -init(_ array: [ArrayLiteralElement]) -``` diff --git a/docs/source/api/ApolloAPI/protocols/_InitializableByDictionaryLiteralElements.md b/docs/source/api/ApolloAPI/protocols/_InitializableByDictionaryLiteralElements.md deleted file mode 100644 index 4f635a894e..0000000000 --- a/docs/source/api/ApolloAPI/protocols/_InitializableByDictionaryLiteralElements.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `_InitializableByDictionaryLiteralElements` - -```swift -public protocol _InitializableByDictionaryLiteralElements: ExpressibleByDictionaryLiteral -``` - -## Methods -### `init(_:)` - -```swift -init(_ elements: [(Key, Value)]) -``` diff --git a/docs/source/api/ApolloAPI/structs/CacheReference.md b/docs/source/api/ApolloAPI/structs/CacheReference.md deleted file mode 100644 index e35b8f6bb3..0000000000 --- a/docs/source/api/ApolloAPI/structs/CacheReference.md +++ /dev/null @@ -1,86 +0,0 @@ -**STRUCT** - -# `CacheReference` - -```swift -public struct CacheReference: Hashable -``` - -Represents a reference to a record for a GraphQL Object in the cache. - -## Properties -### `RootQuery` - -```swift -public static let RootQuery: CacheReference = CacheReference("QUERY_ROOT") -``` - -A CacheReference referencing the root query object. - -### `RootMutation` - -```swift -public static let RootMutation: CacheReference = CacheReference("MUTATION_ROOT") -``` - -A CacheReference referencing the root mutation object. - -### `RootSubscription` - -```swift -public static let RootSubscription: CacheReference = CacheReference("SUBSCRIPTION_ROOT") -``` - -A CacheReference referencing the root subscription object. - -### `key` - -```swift -public let key: String -``` - -The unique identifier for the referenced object. - -The key for an object must be: - - Unique across the type - - No two different objects with the same "__typename" can have the same key. - - Keys do not need to be unique from keys for different types (objects with - different "__typename"s). - - Stable - - The key for an object may not ever change. If the cache recieves a new key, it will - treat the object as an entirely new object. There is no mechanisim for cache normalization - in which an object changes its key but maintains its identity. - -Any format for keys will work, as long as they are stable and unique. -If multiple fields must be used to derive a unique key, we recommend joining the values for -the fields with a ":" delimiter. For example, if you need to join the title of a book and the -author name to use as a unique key, you could return "Iliad:Homer". - -A reference to a record that does not have it's own unique cache key is based on a path from -another cache reference or a root object. - -## Methods -### `rootCacheReference(for:)` - -```swift -public static func rootCacheReference( - for operationType: GraphQLOperationType -) -> CacheReference -``` - -### `init(_:)` - -```swift -public init(_ key: String) -``` - -Initializer - -- Parameters: - - key: The unique identifier for the referenced object. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The unique identifier for the referenced object. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/structs/DataDict.md b/docs/source/api/ApolloAPI/structs/DataDict.md deleted file mode 100644 index 932058d9de..0000000000 --- a/docs/source/api/ApolloAPI/structs/DataDict.md +++ /dev/null @@ -1,57 +0,0 @@ -**STRUCT** - -# `DataDict` - -```swift -public struct DataDict: Hashable -``` - -A structure that wraps the underlying data dictionary used by `SelectionSet`s. - -## Properties -### `_data` - -```swift -public var _data: JSONObject -``` - -### `_variables` - -```swift -public let _variables: GraphQLOperation.Variables? -``` - -## Methods -### `init(_:variables:)` - -```swift -@inlinable public init( - _ data: JSONObject, - variables: GraphQLOperation.Variables? -) -``` - -### `hash(into:)` - -```swift -@inlinable public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -@inlinable public static func ==(lhs: DataDict, rhs: DataDict) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/structs/InputDict.md b/docs/source/api/ApolloAPI/structs/InputDict.md deleted file mode 100644 index a5b930b817..0000000000 --- a/docs/source/api/ApolloAPI/structs/InputDict.md +++ /dev/null @@ -1,48 +0,0 @@ -**STRUCT** - -# `InputDict` - -```swift -public struct InputDict: GraphQLOperationVariableValue, Hashable -``` - -A structure that wraps the underlying data dictionary used by `InputObject`s. - -## Properties -### `jsonEncodableValue` - -```swift -public var jsonEncodableValue: JSONEncodable? -``` - -## Methods -### `init(_:)` - -```swift -public init(_ data: [String: GraphQLOperationVariableValue] = [:]) -``` - -### `==(_:_:)` - -```swift -public static func == (lhs: InputDict, rhs: InputDict) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/structs/OperationDefinition.md b/docs/source/api/ApolloAPI/structs/OperationDefinition.md deleted file mode 100644 index a293259326..0000000000 --- a/docs/source/api/ApolloAPI/structs/OperationDefinition.md +++ /dev/null @@ -1,27 +0,0 @@ -**STRUCT** - -# `OperationDefinition` - -```swift -public struct OperationDefinition -``` - -The definition of an operation to be provided over network transport. - -This data represents the `Definition` for a `Document` as defined in the GraphQL Spec. -In the case of the Apollo client, the definition will always be an `ExecutableDefinition`. -- See: [GraphQLSpec - Document](https://spec.graphql.org/draft/#Document) - -## Properties -### `queryDocument` - -```swift -public var queryDocument: String -``` - -## Methods -### `init(_:fragments:)` - -```swift -public init(_ definition: String, fragments: [Fragment.Type]? = nil) -``` diff --git a/docs/source/api/ApolloAPI/structs/Selection.Condition.md b/docs/source/api/ApolloAPI/structs/Selection.Condition.md deleted file mode 100644 index f81715459f..0000000000 --- a/docs/source/api/ApolloAPI/structs/Selection.Condition.md +++ /dev/null @@ -1,72 +0,0 @@ -**STRUCT** - -# `Selection.Condition` - -```swift -struct Condition: ExpressibleByStringLiteral, Hashable -``` - -## Properties -### `variableName` - -```swift -public let variableName: String -``` - -### `inverted` - -```swift -public let inverted: Bool -``` - -## Methods -### `init(variableName:inverted:)` - -```swift -public init( - variableName: String, - inverted: Bool -) -``` - -### `init(stringLiteral:)` - -```swift -public init(stringLiteral value: StringLiteralType) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `!(_:)` - -```swift -public static prefix func !(value: Condition) -> Condition -``` - -### `&&(_:_:)` - -```swift -public static func &&(_ lhs: Condition, rhs: Condition) -> [Condition] -``` - -### `&&(_:_:)` - -```swift -public static func &&(_ lhs: [Condition], rhs: Condition) -> [Condition] -``` - -### `||(_:_:)` - -```swift -public static func ||(_ lhs: Condition, rhs: Condition) -> Conditions -``` - -### `||(_:_:)` - -```swift -public static func ||(_ lhs: [Condition], rhs: Condition) -> Conditions -``` diff --git a/docs/source/api/ApolloAPI/structs/Selection.Conditions.md b/docs/source/api/ApolloAPI/structs/Selection.Conditions.md deleted file mode 100644 index 668f8f0756..0000000000 --- a/docs/source/api/ApolloAPI/structs/Selection.Conditions.md +++ /dev/null @@ -1,69 +0,0 @@ -**STRUCT** - -# `Selection.Conditions` - -```swift -struct Conditions: ExpressibleByArrayLiteral, ExpressibleByStringLiteral, Hashable -``` - -The conditions representing a group of `@include/@skip` directives. - -The conditions are a two-dimensional array of `Selection.Condition`s. -The outer array represents groups of conditions joined together with a logical "or". -Conditions in the same inner array are joined together with a logical "and". - -## Properties -### `value` - -```swift -public let value: [[Condition]] -``` - -## Methods -### `init(_:)` - -```swift -public init(_ value: [[Condition]]) -``` - -### `init(arrayLiteral:)` - -```swift -public init(arrayLiteral elements: [Condition]...) -``` - -### `init(_:)` - -```swift -public init(_ conditions: [Condition]...) -``` - -### `init(stringLiteral:)` - -```swift -public init(stringLiteral string: String) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value of the new instance. | - -### `init(_:)` - -```swift -public init(_ condition: Condition) -``` - -### `||(_:_:)` - -```swift -public static func ||(_ lhs: Conditions, rhs: [Condition]) -> Conditions -``` - -### `||(_:_:)` - -```swift -public static func ||(_ lhs: Conditions, rhs: Condition) -> Conditions -``` diff --git a/docs/source/api/ApolloAPI/structs/Selection.Field.md b/docs/source/api/ApolloAPI/structs/Selection.Field.md deleted file mode 100644 index 1efa467115..0000000000 --- a/docs/source/api/ApolloAPI/structs/Selection.Field.md +++ /dev/null @@ -1,50 +0,0 @@ -**STRUCT** - -# `Selection.Field` - -```swift -public struct Field -``` - -## Properties -### `name` - -```swift -public let name: String -``` - -### `alias` - -```swift -public let alias: String? -``` - -### `arguments` - -```swift -public let arguments: [String: InputValue]? -``` - -### `type` - -```swift -public let type: OutputType -``` - -### `responseKey` - -```swift -public var responseKey: String -``` - -## Methods -### `init(_:alias:type:arguments:)` - -```swift -public init( - _ name: String, - alias: String? = nil, - type: OutputType, - arguments: [String: InputValue]? = nil -) -``` diff --git a/docs/source/api/ApolloAPI/toc.md b/docs/source/api/ApolloAPI/toc.md deleted file mode 100644 index 4ff95dd5bf..0000000000 --- a/docs/source/api/ApolloAPI/toc.md +++ /dev/null @@ -1,125 +0,0 @@ -# Reference Documentation - -## Protocols - -- [AnyHashableConvertible](protocols/AnyHashableConvertible/) -- [AnyScalarType](protocols/AnyScalarType/) -- [AnySelectionSet](protocols/AnySelectionSet/) -- [CacheEntity](protocols/CacheEntity/) -- [CacheKeyProvider](protocols/CacheKeyProvider/) -- [CustomScalarType](protocols/CustomScalarType/) -- [EnumType](protocols/EnumType/) -- [Fragment](protocols/Fragment/) -- [FragmentContainer](protocols/FragmentContainer/) -- [GraphQLMutation](protocols/GraphQLMutation/) -- [GraphQLOperation](protocols/GraphQLOperation/) -- [GraphQLOperationVariableValue](protocols/GraphQLOperationVariableValue/) -- [GraphQLQuery](protocols/GraphQLQuery/) -- [GraphQLSubscription](protocols/GraphQLSubscription/) -- [InlineFragment](protocols/InlineFragment/) -- [InputObject](protocols/InputObject/) -- [JSONDecodable](protocols/JSONDecodable/) -- [JSONEncodable](protocols/JSONEncodable/) -- [LocalCacheMutation](protocols/LocalCacheMutation/) -- [MutableRootSelectionSet](protocols/MutableRootSelectionSet/) -- [MutableSelectionSet](protocols/MutableSelectionSet/) -- [OutputTypeConvertible](protocols/OutputTypeConvertible/) -- [ParentTypeConvertible](protocols/ParentTypeConvertible/) -- [RootSelectionSet](protocols/RootSelectionSet/) -- [ScalarType](protocols/ScalarType/) -- [SchemaConfiguration](protocols/SchemaConfiguration/) -- [SchemaUnknownTypeCacheKeyProvider](protocols/SchemaUnknownTypeCacheKeyProvider/) -- [SelectionSet](protocols/SelectionSet/) -- [SelectionSetEntityValue](protocols/SelectionSetEntityValue/) -- [Union](protocols/Union/) -- [_InitializableByArrayLiteralElements](protocols/_InitializableByArrayLiteralElements/) -- [_InitializableByDictionaryLiteralElements](protocols/_InitializableByDictionaryLiteralElements/) - -## Structs - -- [CacheReference](structs/CacheReference/) -- [DataDict](structs/DataDict/) -- [InputDict](structs/InputDict/) -- [OperationDefinition](structs/OperationDefinition/) -- [Selection.Condition](structs/Selection.Condition/) -- [Selection.Conditions](structs/Selection.Conditions/) -- [Selection.Field](structs/Selection.Field/) - -## Classes - -- [Interface](classes/Interface/) -- [Object](classes/Object/) - -## Enums - -- [DocumentType](enums/DocumentType/) -- [Field.OutputType](enums/Field.OutputType/) -- [GraphQLEnum](enums/GraphQLEnum/) -- [GraphQLNullable](enums/GraphQLNullable/) -- [GraphQLOperationType](enums/GraphQLOperationType/) -- [InputValue](enums/InputValue/) -- [JSONDecodingError](enums/JSONDecodingError/) -- [NoFragments](enums/NoFragments/) -- [ParentType](enums/ParentType/) -- [Selection](enums/Selection/) - -## Extensions - -- [AnyHashableConvertible](extensions/AnyHashableConvertible/) -- [AnySelectionSet](extensions/AnySelectionSet/) -- [Array](extensions/Array/) -- [Bool](extensions/Bool/) -- [CacheKeyProvider](extensions/CacheKeyProvider/) -- [CacheReference](extensions/CacheReference/) -- [CustomScalarType](extensions/CustomScalarType/) -- [Dictionary](extensions/Dictionary/) -- [Double](extensions/Double/) -- [EnumType](extensions/EnumType/) -- [Float](extensions/Float/) -- [FragmentContainer](extensions/FragmentContainer/) -- [GraphQLEnum](extensions/GraphQLEnum/) -- [GraphQLMutation](extensions/GraphQLMutation/) -- [GraphQLNullable](extensions/GraphQLNullable/) -- [GraphQLOperation](extensions/GraphQLOperation/) -- [GraphQLQuery](extensions/GraphQLQuery/) -- [GraphQLSubscription](extensions/GraphQLSubscription/) -- [InputObject](extensions/InputObject/) -- [InputValue](extensions/InputValue/) -- [Int](extensions/Int/) -- [Interface](extensions/Interface/) -- [JSONEncodable](extensions/JSONEncodable/) -- [JSONEncodableDictionary](extensions/JSONEncodableDictionary/) -- [LocalCacheMutation](extensions/LocalCacheMutation/) -- [MutableSelectionSet](extensions/MutableSelectionSet/) -- [NSDictionary](extensions/NSDictionary/) -- [NSNull](extensions/NSNull/) -- [Object](extensions/Object/) -- [Optional](extensions/Optional/) -- [ParentType](extensions/ParentType/) -- [RawRepresentable](extensions/RawRepresentable/) -- [RootSelectionSet](extensions/RootSelectionSet/) -- [SchemaConfiguration](extensions/SchemaConfiguration/) -- [Selection](extensions/Selection/) -- [Selection.Conditions](extensions/Selection.Conditions/) -- [Selection.Field](extensions/Selection.Field/) -- [Selection.Field.OutputType](extensions/Selection.Field.OutputType/) -- [SelectionSet](extensions/SelectionSet/) -- [String](extensions/String/) -- [URL](extensions/URL/) -- [Union](extensions/Union/) - -## Typealiases - -- [GraphQLEnum.RawValue](typealiases/GraphQLEnum.RawValue/) -- [GraphQLOperation.Variables](typealiases/GraphQLOperation.Variables/) -- [JSONEncodableDictionary](typealiases/JSONEncodableDictionary/) -- [JSONObject](typealiases/JSONObject/) -- [JSONValue](typealiases/JSONValue/) - -## Methods - -- [!=(____)](methods/!=(____)/) -- [==(____)](methods/==(____)/) -- [__(____)](methods/__(____)/) - -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/api/ApolloAPI/typealiases/GraphQLEnum.RawValue.md b/docs/source/api/ApolloAPI/typealiases/GraphQLEnum.RawValue.md deleted file mode 100644 index c5d7446c1c..0000000000 --- a/docs/source/api/ApolloAPI/typealiases/GraphQLEnum.RawValue.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `GraphQLEnum.RawValue` - -```swift -public typealias RawValue = String -``` diff --git a/docs/source/api/ApolloAPI/typealiases/GraphQLOperation.Variables.md b/docs/source/api/ApolloAPI/typealiases/GraphQLOperation.Variables.md deleted file mode 100644 index 20a7250d1a..0000000000 --- a/docs/source/api/ApolloAPI/typealiases/GraphQLOperation.Variables.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `GraphQLOperation.Variables` - -```swift -typealias Variables = [String: GraphQLOperationVariableValue] -``` diff --git a/docs/source/api/ApolloAPI/typealiases/JSONEncodableDictionary.md b/docs/source/api/ApolloAPI/typealiases/JSONEncodableDictionary.md deleted file mode 100644 index f6e7d3d845..0000000000 --- a/docs/source/api/ApolloAPI/typealiases/JSONEncodableDictionary.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `JSONEncodableDictionary` - -```swift -public typealias JSONEncodableDictionary = [String: JSONEncodable] -``` diff --git a/docs/source/api/ApolloAPI/typealiases/JSONObject.md b/docs/source/api/ApolloAPI/typealiases/JSONObject.md deleted file mode 100644 index 3c258fba44..0000000000 --- a/docs/source/api/ApolloAPI/typealiases/JSONObject.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `JSONObject` - -```swift -public typealias JSONObject = [String: JSONValue] -``` diff --git a/docs/source/api/ApolloAPI/typealiases/JSONValue.md b/docs/source/api/ApolloAPI/typealiases/JSONValue.md deleted file mode 100644 index a31cd9ce55..0000000000 --- a/docs/source/api/ApolloAPI/typealiases/JSONValue.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `JSONValue` - -```swift -public typealias JSONValue = AnyHashable -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/ASTNode.md b/docs/source/api/ApolloCodegenLib/classes/ASTNode.md deleted file mode 100644 index afa21cdf7f..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/ASTNode.md +++ /dev/null @@ -1,9 +0,0 @@ -**CLASS** - -# `ASTNode` - -```swift -public class ASTNode: JavaScriptObject -``` - -An AST node. diff --git a/docs/source/api/ApolloCodegenLib/classes/ApolloCodegen.md b/docs/source/api/ApolloCodegenLib/classes/ApolloCodegen.md deleted file mode 100644 index a4cfb57409..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/ApolloCodegen.md +++ /dev/null @@ -1,27 +0,0 @@ -**CLASS** - -# `ApolloCodegen` - -```swift -public class ApolloCodegen -``` - -A class to facilitate running code generation - -## Methods -### `build(with:)` - -```swift -public static func build(with configuration: ApolloCodegenConfiguration) throws -``` - -Executes the code generation engine with a specified configuration. - -- Parameters: - - configuration: A configuration object that specifies inputs, outputs and behaviours used during code generation. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| configuration | A configuration object that specifies inputs, outputs and behaviours used during code generation. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Argument.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Argument.md deleted file mode 100644 index 5cae55188e..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Argument.md +++ /dev/null @@ -1,33 +0,0 @@ -**CLASS** - -# `CompilationResult.Argument` - -```swift -public class Argument: JavaScriptObject, Hashable -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: Argument, rhs: Argument) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Directive.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Directive.md deleted file mode 100644 index e341617345..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Directive.md +++ /dev/null @@ -1,40 +0,0 @@ -**CLASS** - -# `CompilationResult.Directive` - -```swift -public class Directive: JavaScriptObject, Hashable -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func == (lhs: Directive, rhs: Directive) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Field.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Field.md deleted file mode 100644 index d68d31e895..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.Field.md +++ /dev/null @@ -1,40 +0,0 @@ -**CLASS** - -# `CompilationResult.Field` - -```swift -public class Field: JavaScriptWrapper, Hashable, CustomDebugStringConvertible -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: Field, rhs: Field) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.FragmentDefinition.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.FragmentDefinition.md deleted file mode 100644 index 533d68b330..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.FragmentDefinition.md +++ /dev/null @@ -1,40 +0,0 @@ -**CLASS** - -# `CompilationResult.FragmentDefinition` - -```swift -public class FragmentDefinition: JavaScriptObject, Hashable -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: FragmentDefinition, rhs: FragmentDefinition) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.FragmentSpread.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.FragmentSpread.md deleted file mode 100644 index d6a91c1698..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.FragmentSpread.md +++ /dev/null @@ -1,36 +0,0 @@ -**CLASS** - -# `CompilationResult.FragmentSpread` - -```swift -public class FragmentSpread: JavaScriptObject, Hashable -``` - -Represents an individual selection that includes a named fragment in a selection set. -(ie. `...FragmentName`) - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: FragmentSpread, rhs: FragmentSpread) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.InlineFragment.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.InlineFragment.md deleted file mode 100644 index c56ba897c5..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.InlineFragment.md +++ /dev/null @@ -1,40 +0,0 @@ -**CLASS** - -# `CompilationResult.InlineFragment` - -```swift -public class InlineFragment: JavaScriptObject, Hashable -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: InlineFragment, rhs: InlineFragment) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.OperationDefinition.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.OperationDefinition.md deleted file mode 100644 index 04b086b60d..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.OperationDefinition.md +++ /dev/null @@ -1,28 +0,0 @@ -**CLASS** - -# `CompilationResult.OperationDefinition` - -```swift -public class OperationDefinition: JavaScriptObject, Equatable -``` - -## Properties -### `debugDescription` - -```swift -override public var debugDescription: String -``` - -## Methods -### `==(_:_:)` - -```swift -public static func ==(lhs: OperationDefinition, rhs: OperationDefinition) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.SelectionSet.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.SelectionSet.md deleted file mode 100644 index 6979525036..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.SelectionSet.md +++ /dev/null @@ -1,40 +0,0 @@ -**CLASS** - -# `CompilationResult.SelectionSet` - -```swift -public class SelectionSet: JavaScriptWrapper, Hashable, CustomDebugStringConvertible -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: SelectionSet, rhs: SelectionSet) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.VariableDefinition.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.VariableDefinition.md deleted file mode 100644 index e7a207c8be..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.VariableDefinition.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `CompilationResult.VariableDefinition` - -```swift -public class VariableDefinition: JavaScriptObject -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.md b/docs/source/api/ApolloCodegenLib/classes/CompilationResult.md deleted file mode 100644 index 02766ea74c..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/CompilationResult.md +++ /dev/null @@ -1,9 +0,0 @@ -**CLASS** - -# `CompilationResult` - -```swift -public class CompilationResult: JavaScriptObject -``` - -The output of the frontend compiler. diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLAbstractType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLAbstractType.md deleted file mode 100644 index 20bf3be726..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLAbstractType.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `GraphQLAbstractType` - -```swift -public class GraphQLAbstractType: GraphQLCompositeType -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLCompositeType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLCompositeType.md deleted file mode 100644 index a833172948..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLCompositeType.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `GraphQLCompositeType` - -```swift -public class GraphQLCompositeType: GraphQLNamedType -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLDocument.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLDocument.md deleted file mode 100644 index f4446f3c00..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLDocument.md +++ /dev/null @@ -1,9 +0,0 @@ -**CLASS** - -# `GraphQLDocument` - -```swift -public class GraphQLDocument: ASTNode -``` - -A parsed GraphQL document. diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLEnumType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLEnumType.md deleted file mode 100644 index a1960602e3..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLEnumType.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `GraphQLEnumType` - -```swift -public class GraphQLEnumType: GraphQLNamedType -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLEnumValue.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLEnumValue.md deleted file mode 100644 index c241e61302..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLEnumValue.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `GraphQLEnumValue` - -```swift -public class GraphQLEnumValue: JavaScriptObject -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLError.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLError.md deleted file mode 100644 index 9007c1e122..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLError.md +++ /dev/null @@ -1,12 +0,0 @@ -**CLASS** - -# `GraphQLError` - -```swift -public class GraphQLError: JavaScriptError -``` - -A GraphQL error. -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. diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLField.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLField.md deleted file mode 100644 index 5ecd46e956..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLField.md +++ /dev/null @@ -1,40 +0,0 @@ -**CLASS** - -# `GraphQLField` - -```swift -public class GraphQLField: JavaScriptObject, Hashable -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func == (lhs: GraphQLField, rhs: GraphQLField) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLFieldArgument.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLFieldArgument.md deleted file mode 100644 index 6530d44064..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLFieldArgument.md +++ /dev/null @@ -1,33 +0,0 @@ -**CLASS** - -# `GraphQLFieldArgument` - -```swift -public class GraphQLFieldArgument: JavaScriptObject, Hashable -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func == (lhs: GraphQLFieldArgument, rhs: GraphQLFieldArgument) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLInputField.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLInputField.md deleted file mode 100644 index 70dfd2ec5b..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLInputField.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `GraphQLInputField` - -```swift -public class GraphQLInputField: JavaScriptObject -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLInputObjectType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLInputObjectType.md deleted file mode 100644 index 7385a63162..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLInputObjectType.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `GraphQLInputObjectType` - -```swift -public class GraphQLInputObjectType: GraphQLNamedType -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLInterfaceType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLInterfaceType.md deleted file mode 100644 index 4d024e5d6d..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLInterfaceType.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `GraphQLInterfaceType` - -```swift -public class GraphQLInterfaceType: GraphQLAbstractType, GraphQLInterfaceImplementingType -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLJSFrontend.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLJSFrontend.md deleted file mode 100644 index aae73ab101..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLJSFrontend.md +++ /dev/null @@ -1,98 +0,0 @@ -**CLASS** - -# `GraphQLJSFrontend` - -```swift -public final class GraphQLJSFrontend -``` - -## Methods -### `init()` - -```swift -public init() throws -``` - -### `loadSchema(from:)` - -```swift -public func loadSchema(from sources: [GraphQLSource]) throws -> GraphQLSchema -``` - -Load a schema by parsing an introspection result. - -### `printSchemaAsSDL(schema:)` - -```swift -public func printSchemaAsSDL(schema: GraphQLSchema) throws -> String -``` - -Take a loaded GQL schema and print it as SDL. - -### `makeSource(_:filePath:)` - -```swift -public func makeSource(_ body: String, filePath: String) throws -> GraphQLSource -``` - -Create a `GraphQLSource` object from a string. - -### `makeSource(from:)` - -```swift -public func makeSource(from fileURL: URL) throws -> GraphQLSource -``` - -Create a `GraphQLSource` object by reading from a file. - -### `parseDocument(_:experimentalClientControlledNullability:)` - -```swift -public func parseDocument( - _ source: GraphQLSource, - experimentalClientControlledNullability: Bool = false -) throws -> GraphQLDocument -``` - -Parses a GraphQL document from a source, returning a reference to the parsed AST that can be passed on to validation and compilation. -Syntax errors will result in throwing a `GraphQLError`. - -### `parseDocument(from:experimentalClientControlledNullability:)` - -```swift -public func parseDocument( - from fileURL: URL, - experimentalClientControlledNullability: Bool = false -) throws -> GraphQLDocument -``` - -Parses a GraphQL document from a file, returning a reference to the parsed AST that can be passed on to validation and compilation. -Syntax errors will result in throwing a `GraphQLError`. - -### `mergeDocuments(_:)` - -```swift -public func mergeDocuments(_ documents: [GraphQLDocument]) throws -> GraphQLDocument -``` - -Validation and compilation take a single document, but you can merge documents, and operations and fragments will remember their source. - -### `validateDocument(schema:document:)` - -```swift -public func validateDocument(schema: GraphQLSchema, document: GraphQLDocument) throws -> [GraphQLError] -``` - -Validate a GraphQL document and return any validation errors as `GraphQLError`s. - -### `compile(schema:document:experimentalLegacySafelistingCompatibleOperations:)` - -```swift -public func compile( - schema: GraphQLSchema, - document: GraphQLDocument, - experimentalLegacySafelistingCompatibleOperations: Bool = false -) throws -> CompilationResult -``` - -Compiles a GraphQL document into an intermediate representation that is more suitable for analysis and code generation. diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLNamedType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLNamedType.md deleted file mode 100644 index f24d704eed..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLNamedType.md +++ /dev/null @@ -1,33 +0,0 @@ -**CLASS** - -# `GraphQLNamedType` - -```swift -public class GraphQLNamedType: JavaScriptObject, Hashable -``` - -## Methods -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `==(_:_:)` - -```swift -public static func ==(lhs: GraphQLNamedType, rhs: GraphQLNamedType) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLObjectType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLObjectType.md deleted file mode 100644 index 9575a06067..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLObjectType.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `GraphQLObjectType` - -```swift -public class GraphQLObjectType: GraphQLCompositeType, GraphQLInterfaceImplementingType -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLScalarType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLScalarType.md deleted file mode 100644 index 6f060144fe..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLScalarType.md +++ /dev/null @@ -1,7 +0,0 @@ -**CLASS** - -# `GraphQLScalarType` - -```swift -public class GraphQLScalarType: GraphQLNamedType -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLSchema.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLSchema.md deleted file mode 100644 index 81c37e8501..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLSchema.md +++ /dev/null @@ -1,9 +0,0 @@ -**CLASS** - -# `GraphQLSchema` - -```swift -public class GraphQLSchema: JavaScriptObject -``` - -A GraphQL schema. diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLSchemaValidationError.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLSchemaValidationError.md deleted file mode 100644 index bf4af6af38..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLSchemaValidationError.md +++ /dev/null @@ -1,9 +0,0 @@ -**CLASS** - -# `GraphQLSchemaValidationError` - -```swift -public class GraphQLSchemaValidationError: JavaScriptError -``` - -A GraphQL schema validation error. This wraps one or more underlying validation errors. diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLSource.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLSource.md deleted file mode 100644 index e1ef66e52b..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLSource.md +++ /dev/null @@ -1,10 +0,0 @@ -**CLASS** - -# `GraphQLSource` - -```swift -public class GraphQLSource: JavaScriptObject -``` - -A representation of source input to GraphQL parsing. -Corresponds to https://github.com/graphql/graphql-js/blob/master/src/language/source.js diff --git a/docs/source/api/ApolloCodegenLib/classes/GraphQLUnionType.md b/docs/source/api/ApolloCodegenLib/classes/GraphQLUnionType.md deleted file mode 100644 index 3278248788..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/GraphQLUnionType.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `GraphQLUnionType` - -```swift -public class GraphQLUnionType: GraphQLAbstractType -``` - -## Properties -### `debugDescription` - -```swift -public override var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md b/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md deleted file mode 100644 index 1385b6e0cb..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md +++ /dev/null @@ -1,10 +0,0 @@ -**CLASS** - -# `JavaScriptError` - -```swift -public class JavaScriptError: JavaScriptObject, Error, @unchecked Sendable -``` - -An error thrown during JavaScript execution. -See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error diff --git a/docs/source/api/ApolloCodegenLib/classes/JavaScriptObject.md b/docs/source/api/ApolloCodegenLib/classes/JavaScriptObject.md deleted file mode 100644 index c1a4fe0229..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/JavaScriptObject.md +++ /dev/null @@ -1,9 +0,0 @@ -**CLASS** - -# `JavaScriptObject` - -```swift -public class JavaScriptObject: JavaScriptValueDecodable -``` - -A type that references an underlying JavaScript object. diff --git a/docs/source/api/ApolloCodegenLib/classes/JavaScriptWrapper.md b/docs/source/api/ApolloCodegenLib/classes/JavaScriptWrapper.md deleted file mode 100644 index 547b255cdf..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/JavaScriptWrapper.md +++ /dev/null @@ -1,12 +0,0 @@ -**CLASS** - -# `JavaScriptWrapper` - -```swift -public class JavaScriptWrapper: JavaScriptValueDecodable -``` - -An object that can wrap an underlying `JavaScriptObject`. - -Can be used as an alternative to subclassing `JavaScriptObject` when you -need to be able to create a non-javascript backed version of the class also. diff --git a/docs/source/api/ApolloCodegenLib/classes/Schema.ReferencedTypes.md b/docs/source/api/ApolloCodegenLib/classes/Schema.ReferencedTypes.md deleted file mode 100644 index df320ffc2d..0000000000 --- a/docs/source/api/ApolloCodegenLib/classes/Schema.ReferencedTypes.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `Schema.ReferencedTypes` - -```swift -public final class ReferencedTypes -``` - -## Methods -### `unions(including:)` - -```swift -public func unions(including type: GraphQLObjectType) -> Set -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegen.Error.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegen.Error.md deleted file mode 100644 index a321bf7e11..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegen.Error.md +++ /dev/null @@ -1,25 +0,0 @@ -**ENUM** - -# `ApolloCodegen.Error` - -```swift -public enum Error: Swift.Error, LocalizedError -``` - -Errors that can occur during code generation. - -## Cases -### `graphQLSourceValidationFailure(atLines:)` - -```swift -case graphQLSourceValidationFailure(atLines: [String]) -``` - -An error occured during validation of the GraphQL schema or operations. - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.APQConfig.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.APQConfig.md deleted file mode 100644 index a4bc34bef8..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.APQConfig.md +++ /dev/null @@ -1,46 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.APQConfig` - -```swift -public enum APQConfig: String, Codable, Equatable -``` - -Enum to enable using -[Automatic Persisted Queries (APQs)](https://www.apollographql.com/docs/apollo-server/performance/apq) -with your generated operations. - -APQs are an Apollo Server feature. When using Apollo iOS to connect to any other GraphQL server, -`APQConfig` should be set to `.disabled` - -## Cases -### `disabled` - -```swift -case disabled -``` - -The default value. Disables APQs. -The operation document is sent to the server with each operation request. - -### `automaticallyPersist` - -```swift -case automaticallyPersist -``` - -Automatically persists your operations using Apollo Server's -[APQs](https://www.apollographql.com/docs/apollo-server/performance/apq). - -### `persistedOperationsOnly` - -```swift -case persistedOperationsOnly -``` - -Provides only the `operationIdentifier` for operations that have been previously persisted -to an Apollo Server using -[APQs](https://www.apollographql.com/docs/apollo-server/performance/apq). - -If the server does not recognize the `operationIdentifier`, the operation will fail. This -method should only be used if you are manually persisting your queries to an Apollo Server. diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.Composition.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.Composition.md deleted file mode 100644 index 7a408c9c5c..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.Composition.md +++ /dev/null @@ -1,24 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.Composition` - -```swift -public enum Composition: String, Codable, Equatable -``` - -Composition is used as a substitute for a boolean where context is better placed in the value -instead of the parameter name, e.g.: `includeDeprecatedEnumCases = true` vs. -`deprecatedEnumCases = .include`. - -## Cases -### `include` - -```swift -case include -``` - -### `exclude` - -```swift -case exclude -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.Error.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.Error.md deleted file mode 100644 index e0f84bda15..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.Error.md +++ /dev/null @@ -1,67 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.Error` - -```swift -public enum Error: Swift.Error, LocalizedError, Equatable -``` - -Errors which can happen with code generation - -## Cases -### `notAFile(_:)` - -```swift -case notAFile(PathType) -``` - -### `notADirectory(_:)` - -```swift -case notADirectory(PathType) -``` - -### `folderCreationFailed(_:underlyingError:)` - -```swift -case folderCreationFailed(PathType, underlyingError: Swift.Error) -``` - -### `testMocksInvalidSwiftPackageConfiguration` - -```swift -case testMocksInvalidSwiftPackageConfiguration -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String -``` - -### `recoverySuggestion` - -```swift -public var recoverySuggestion: String -``` - -## Methods -### `logging(withPath:)` - -```swift -public func logging(withPath path: String) -> Error -``` - -### `==(_:_:)` - -```swift -public static func == (lhs: Error, rhs: Error) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.OperationsFileOutput.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.OperationsFileOutput.md deleted file mode 100644 index 5997e30e86..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.OperationsFileOutput.md +++ /dev/null @@ -1,37 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.OperationsFileOutput` - -```swift -public enum OperationsFileOutput: Codable, Equatable -``` - -The local path structure for the generated operation object files. - -## Cases -### `inSchemaModule` - -```swift -case inSchemaModule -``` - -All operation object files will be located in the module with the schema types. - -### `relative(subpath:)` - -```swift -case relative(subpath: String?) -``` - -Operation object files will be co-located relative to the defining operation `.graphql` -file. If `subpath` is specified a subfolder will be created relative to the `.graphql` file -and the operation object files will be generated there. If no `subpath` is defined then all -operation object files will be generated alongside the `.graphql` file. - -### `absolute(path:)` - -```swift -case absolute(path: String) -``` - -All operation object files will be located in the specified path. diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.PathType.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.PathType.md deleted file mode 100644 index 0435afc8ee..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.PathType.md +++ /dev/null @@ -1,39 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.PathType` - -```swift -public enum PathType -``` - -## Cases -### `schema` - -```swift -case schema -``` - -### `schemaTypes` - -```swift -case schemaTypes -``` - -### `operations` - -```swift -case operations -``` - -### `operationIdentifiers` - -```swift -case operationIdentifiers -``` - -## Properties -### `errorRecoverySuggestion` - -```swift -public var errorRecoverySuggestion: String -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.QueryStringLiteralFormat.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.QueryStringLiteralFormat.md deleted file mode 100644 index 0a95038a04..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.QueryStringLiteralFormat.md +++ /dev/null @@ -1,26 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.QueryStringLiteralFormat` - -```swift -public enum QueryStringLiteralFormat: String, Codable, Equatable -``` - -Specify the formatting of the GraphQL query string literal. - -## Cases -### `singleLine` - -```swift -case singleLine -``` - -The query string will be copied into the operation object with all line break formatting removed. - -### `multiline` - -```swift -case multiline -``` - -The query string will be copied with original formatting into the operation object. diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.TestMockFileOutput.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.TestMockFileOutput.md deleted file mode 100644 index bf0d8aa685..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenConfiguration.TestMockFileOutput.md +++ /dev/null @@ -1,48 +0,0 @@ -**ENUM** - -# `ApolloCodegenConfiguration.TestMockFileOutput` - -```swift -public enum TestMockFileOutput: Codable, Equatable -``` - -The local path structure for the generated test mock object files. - -## Cases -### `none` - -```swift -case none -``` - -Test mocks will not be generated. This is the default value. - -### `absolute(path:)` - -```swift -case absolute(path: String) -``` - - Generated test mock files will be located in the specified path. - No module will be created for the generated test mocks. - -- Note: Generated files must be manually added to your test target. Test mocks generated - this way may also be manually embedded in a test utility module that is imported by your - test target. - -### `swiftPackage(targetName:)` - -```swift -case swiftPackage(targetName: String? = nil) -``` - -Generated test mock files will be included in a target defined in the generated -`Package.swift` file that is suitable for linking the generated test mock files to your -test target using Swift Package Manager. - -The name of the test mock target can be specified with the `targetName` value. -If no target name is provided, the target name defaults to "\(schemaNamespace)TestMocks". - -- Note: This requires your `SchemaTypesFileOutput.ModuleType` to be `.swiftPackageManager`. -If this option is provided without the `.swiftPackageManager` module type, code generation -will fail. diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloSchemaDownloadConfiguration.DownloadMethod.md b/docs/source/api/ApolloCodegenLib/enums/ApolloSchemaDownloadConfiguration.DownloadMethod.md deleted file mode 100644 index 479fa956fe..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloSchemaDownloadConfiguration.DownloadMethod.md +++ /dev/null @@ -1,44 +0,0 @@ -**ENUM** - -# `ApolloSchemaDownloadConfiguration.DownloadMethod` - -```swift -public enum DownloadMethod: Equatable, Codable -``` - -How to attempt to download your schema - -## Cases -### `apolloRegistry(_:)` - -```swift -case apolloRegistry(_ settings: ApolloRegistrySettings) -``` - -The Apollo Schema Registry, which serves as a central hub for managing your graph. - -### `introspection(endpointURL:httpMethod:outputFormat:)` - -```swift -case introspection( - endpointURL: URL, - httpMethod: HTTPMethod = .POST, - outputFormat: OutputFormat = .SDL -) -``` - -GraphQL Introspection connecting to the specified URL. - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: DownloadMethod, rhs: DownloadMethod) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloSchemaDownloader.SchemaDownloadError.md b/docs/source/api/ApolloCodegenLib/enums/ApolloSchemaDownloader.SchemaDownloadError.md deleted file mode 100644 index 5d2d7800e7..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloSchemaDownloader.SchemaDownloadError.md +++ /dev/null @@ -1,69 +0,0 @@ -**ENUM** - -# `ApolloSchemaDownloader.SchemaDownloadError` - -```swift -public enum SchemaDownloadError: Error, LocalizedError -``` - -## Cases -### `downloadedRegistryJSONFileNotFound(underlying:)` - -```swift -case downloadedRegistryJSONFileNotFound(underlying: Error) -``` - -### `downloadedIntrospectionJSONFileNotFound(underlying:)` - -```swift -case downloadedIntrospectionJSONFileNotFound(underlying: Error) -``` - -### `couldNotParseRegistryJSON(underlying:)` - -```swift -case couldNotParseRegistryJSON(underlying: Error) -``` - -### `unexpectedRegistryJSONType` - -```swift -case unexpectedRegistryJSONType -``` - -### `couldNotExtractSDLFromRegistryJSON` - -```swift -case couldNotExtractSDLFromRegistryJSON -``` - -### `couldNotCreateSDLDataToWrite(schema:)` - -```swift -case couldNotCreateSDLDataToWrite(schema: String) -``` - -### `couldNotConvertIntrospectionJSONToSDL(underlying:)` - -```swift -case couldNotConvertIntrospectionJSONToSDL(underlying: Error) -``` - -### `couldNotCreateURLComponentsFromEndpointURL(url:)` - -```swift -case couldNotCreateURLComponentsFromEndpointURL(url: URL) -``` - -### `couldNotGetURLFromURLComponents(components:)` - -```swift -case couldNotGetURLFromURLComponents(components: URLComponents) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloURLError.md b/docs/source/api/ApolloCodegenLib/enums/ApolloURLError.md deleted file mode 100644 index 588838d529..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloURLError.md +++ /dev/null @@ -1,21 +0,0 @@ -**ENUM** - -# `ApolloURLError` - -```swift -public enum ApolloURLError: Error, LocalizedError -``` - -## Cases -### `fileNameIsEmpty` - -```swift -case fileNameIsEmpty -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/CodegenLogger.LogLevel.md b/docs/source/api/ApolloCodegenLib/enums/CodegenLogger.LogLevel.md deleted file mode 100644 index 1e5462cf29..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/CodegenLogger.LogLevel.md +++ /dev/null @@ -1,26 +0,0 @@ -**ENUM** - -# `CodegenLogger.LogLevel` - -```swift -public enum LogLevel: Int -``` - -## Cases -### `error` - -```swift -case error -``` - -### `warning` - -```swift -case warning -``` - -### `debug` - -```swift -case debug -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/CompilationResult.InclusionCondition.md b/docs/source/api/ApolloCodegenLib/enums/CompilationResult.InclusionCondition.md deleted file mode 100644 index d2f30ad5db..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/CompilationResult.InclusionCondition.md +++ /dev/null @@ -1,26 +0,0 @@ -**ENUM** - -# `CompilationResult.InclusionCondition` - -```swift -public enum InclusionCondition: JavaScriptValueDecodable, Hashable -``` - -## Cases -### `included` - -```swift -case included -``` - -### `skipped` - -```swift -case skipped -``` - -### `variable(_:isInverted:)` - -```swift -case variable(String, isInverted: Bool) -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/CompilationResult.OperationType.md b/docs/source/api/ApolloCodegenLib/enums/CompilationResult.OperationType.md deleted file mode 100644 index a1d20e96e6..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/CompilationResult.OperationType.md +++ /dev/null @@ -1,26 +0,0 @@ -**ENUM** - -# `CompilationResult.OperationType` - -```swift -public enum OperationType: String, Equatable, JavaScriptValueDecodable -``` - -## Cases -### `query` - -```swift -case query -``` - -### `mutation` - -```swift -case mutation -``` - -### `subscription` - -```swift -case subscription -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/CompilationResult.Selection.md b/docs/source/api/ApolloCodegenLib/enums/CompilationResult.Selection.md deleted file mode 100644 index 0abac0945d..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/CompilationResult.Selection.md +++ /dev/null @@ -1,33 +0,0 @@ -**ENUM** - -# `CompilationResult.Selection` - -```swift -public enum Selection: JavaScriptValueDecodable, CustomDebugStringConvertible, Hashable -``` - -## Cases -### `field(_:)` - -```swift -case field(Field) -``` - -### `inlineFragment(_:)` - -```swift -case inlineFragment(InlineFragment) -``` - -### `fragmentSpread(_:)` - -```swift -case fragmentSpread(FragmentSpread) -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/DownloadMethod.HTTPMethod.md b/docs/source/api/ApolloCodegenLib/enums/DownloadMethod.HTTPMethod.md deleted file mode 100644 index 56205ae344..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/DownloadMethod.HTTPMethod.md +++ /dev/null @@ -1,35 +0,0 @@ -**ENUM** - -# `DownloadMethod.HTTPMethod` - -```swift -public enum HTTPMethod: Equatable, CustomStringConvertible, Codable -``` - -The HTTP request method. This is an option on Introspection schema downloads only. -Apollo Registry downloads are always POST requests. - -## Cases -### `POST` - -```swift -case POST -``` - -Use POST for HTTP requests. This is the default for GraphQL. - -### `GET(queryParameterName:)` - -```swift -case GET(queryParameterName: String) -``` - -Use GET for HTTP requests with the GraphQL query being sent in the query string -parameter named in `queryParameterName`. - -## Properties -### `description` - -```swift -public var description: String -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/DownloadMethod.OutputFormat.md b/docs/source/api/ApolloCodegenLib/enums/DownloadMethod.OutputFormat.md deleted file mode 100644 index f44ea862cb..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/DownloadMethod.OutputFormat.md +++ /dev/null @@ -1,36 +0,0 @@ -**ENUM** - -# `DownloadMethod.OutputFormat` - -```swift -public enum OutputFormat: String, Equatable, CustomStringConvertible, Codable -``` - -The output format for the downloaded schema. This is an option on Introspection schema -downloads only. For Apollo Registry schema downloads, the schema will always be output as -an SDL document - -## Cases -### `SDL` - -```swift -case SDL -``` - -A Schema Definition Language (SDL) document defining the schema as described in -the [GraphQL Specification](https://spec.graphql.org/draft/#sec-Schema) - -### `JSON` - -```swift -case JSON -``` - -A JSON schema definition provided as the result of a schema introspection query. - -## Properties -### `description` - -```swift -public var description: String -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/FileManagerPathError.md b/docs/source/api/ApolloCodegenLib/enums/FileManagerPathError.md deleted file mode 100644 index ac7343335a..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/FileManagerPathError.md +++ /dev/null @@ -1,33 +0,0 @@ -**ENUM** - -# `FileManagerPathError` - -```swift -public enum FileManagerPathError: Swift.Error, LocalizedError, Equatable -``` - -## Cases -### `notAFile(path:)` - -```swift -case notAFile(path: String) -``` - -### `notADirectory(path:)` - -```swift -case notADirectory(path: String) -``` - -### `cannotCreateFile(at:)` - -```swift -case cannotCreateFile(at: String) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/Glob.MatchError.md b/docs/source/api/ApolloCodegenLib/enums/Glob.MatchError.md deleted file mode 100644 index caeb868376..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/Glob.MatchError.md +++ /dev/null @@ -1,47 +0,0 @@ -**ENUM** - -# `Glob.MatchError` - -```swift -public enum MatchError: Error, LocalizedError, Equatable -``` - -An error object that indicates why pattern matching failed. - -## Cases -### `noSpace` - -```swift -case noSpace -``` - -### `aborted` - -```swift -case aborted -``` - -### `cannotEnumerate(path:)` - -```swift -case cannotEnumerate(path: String) -``` - -### `invalidExclude(path:)` - -```swift -case invalidExclude(path: String) -``` - -### `unknown(code:)` - -```swift -case unknown(code: Int) -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/GraphQLType.md b/docs/source/api/ApolloCodegenLib/enums/GraphQLType.md deleted file mode 100644 index 87cc4c0cfc..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/GraphQLType.md +++ /dev/null @@ -1,65 +0,0 @@ -**ENUM** - -# `GraphQLType` - -```swift -public indirect enum GraphQLType: Hashable -``` - -A GraphQL type. - -## Cases -### `entity(_:)` - -```swift -case entity(GraphQLCompositeType) -``` - -### `scalar(_:)` - -```swift -case scalar(GraphQLScalarType) -``` - -### `enum(_:)` - -```swift -case `enum`(GraphQLEnumType) -``` - -### `inputObject(_:)` - -```swift -case inputObject(GraphQLInputObjectType) -``` - -### `nonNull(_:)` - -```swift -case nonNull(GraphQLType) -``` - -### `list(_:)` - -```swift -case list(GraphQLType) -``` - -## Properties -### `typeReference` - -```swift -public var typeReference: String -``` - -### `namedType` - -```swift -public var namedType: GraphQLNamedType -``` - -### `innerType` - -```swift -public var innerType: GraphQLType -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/InflectionRule.md b/docs/source/api/ApolloCodegenLib/enums/InflectionRule.md deleted file mode 100644 index 253b8b4178..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/InflectionRule.md +++ /dev/null @@ -1,49 +0,0 @@ -**ENUM** - -# `InflectionRule` - -```swift -public enum InflectionRule: Codable, Equatable -``` - -The types of inflection rules that can be used to customize pluralization. - -## Cases -### `pluralization(singularRegex:replacementRegex:)` - -```swift -case pluralization(singularRegex: String, replacementRegex: String) -``` - -A pluralization rule that allows taking a singular word and pluralizing it. -- singularRegex: A regular expression representing the single version of the word -- replacementRegex: A regular expression representing how to replace the singular version. - -### `singularization(pluralRegex:replacementRegex:)` - -```swift -case singularization(pluralRegex: String, replacementRegex: String) -``` - -A singularization rule that allows taking a plural word and singularizing it. -- pluralRegex: A regular expression represeinting the plural version of the word -- replacementRegex: A regular expression representing how to replace the singular version - -### `irregular(singular:plural:)` - -```swift -case irregular(singular: String, plural: String) -``` - -A definition of an irregular pluralization rule not easily captured by regex - for example "person" and "people". -- singular: The singular version of the word -- plural: The plural version of the word. - -### `uncountable(word:)` - -```swift -case uncountable(word: String) -``` - -A definition of a word that should never be pluralized or de-pluralized because it's the same no matter what the count - for example, "fish". -- word: The word that should never be adjusted. diff --git a/docs/source/api/ApolloCodegenLib/enums/JavaScriptBridge.Error.md b/docs/source/api/ApolloCodegenLib/enums/JavaScriptBridge.Error.md deleted file mode 100644 index 2fa7398431..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/JavaScriptBridge.Error.md +++ /dev/null @@ -1,14 +0,0 @@ -**ENUM** - -# `JavaScriptBridge.Error` - -```swift -public enum Error: Swift.Error -``` - -## Cases -### `failedToCreateJSContext` - -```swift -case failedToCreateJSContext -``` diff --git a/docs/source/api/ApolloCodegenLib/enums/SchemaTypesFileOutput.ModuleType.md b/docs/source/api/ApolloCodegenLib/enums/SchemaTypesFileOutput.ModuleType.md deleted file mode 100644 index 7bac05d43e..0000000000 --- a/docs/source/api/ApolloCodegenLib/enums/SchemaTypesFileOutput.ModuleType.md +++ /dev/null @@ -1,47 +0,0 @@ -**ENUM** - -# `SchemaTypesFileOutput.ModuleType` - -```swift -public enum ModuleType: Codable, Equatable -``` - -Compatible dependency manager automation. - -## Cases -### `embeddedInTarget(name:)` - -```swift -case embeddedInTarget(name: String) -``` - -Generated schema types will be manually embedded in a target with the specified `name`. -No module will be created for the generated schema types. - -- Note: Generated files must be manually added to your application target. The generated -schema types files will be namespaced with the value of your configuration's -`schemaNamespace` to prevent naming conflicts. - -### `swiftPackageManager` - -```swift -case swiftPackageManager -``` - -Generates a `Package.swift` file that is suitable for linking the generated schema types -files to your project using Swift Package Manager. - -### `other` - -```swift -case other -``` - -No module will be created for the generated types and you are required to create the -module to support your preferred dependency manager. You must specify the name of the -module you will create in the `schemaNamespace` property as this will be used in `import` -statements of generated operation files. - -Use this option for dependency managers, such as CocoaPods or Carthage. Example usage -would be to create the podspec file (CocoaPods) or Xcode project file (Carthage) that -is expecting the generated files in the configured output location. diff --git a/docs/source/api/ApolloCodegenLib/extensions/ApolloCodegenConfiguration.md b/docs/source/api/ApolloCodegenLib/extensions/ApolloCodegenConfiguration.md deleted file mode 100644 index 7a9382ac3a..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/ApolloCodegenConfiguration.md +++ /dev/null @@ -1,16 +0,0 @@ -**EXTENSION** - -# `ApolloCodegenConfiguration` -```swift -extension ApolloCodegenConfiguration -``` - -## Methods -### `validate()` - -```swift -public func validate() throws -``` - -Validates paths within the configuration ensuring that required files exist and that output -directories can be created. diff --git a/docs/source/api/ApolloCodegenLib/extensions/ApolloExtension.md b/docs/source/api/ApolloCodegenLib/extensions/ApolloExtension.md deleted file mode 100644 index 2381a20d39..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/ApolloExtension.md +++ /dev/null @@ -1,173 +0,0 @@ -**EXTENSION** - -# `ApolloExtension` -```swift -extension ApolloExtension where Base: FileManager -``` - -## Methods -### `doesFileExist(atPath:)` - -```swift -public func doesFileExist(atPath path: String) -> Bool -``` - -Checks if the path exists and is a file, not a directory. - -- Parameter path: The path to check. -- Returns: `true` if there is something at the path and it is a file, not a directory. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| path | The path to check. | - -### `doesDirectoryExist(atPath:)` - -```swift -public func doesDirectoryExist(atPath path: String) -> Bool -``` - -Checks if the path exists and is a directory, not a file. - -- Parameter path: The path to check. -- Returns: `true` if there is something at the path and it is a directory, not a file. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| path | The path to check. | - -### `deleteFile(atPath:)` - -```swift -public func deleteFile(atPath path: String) throws -``` - -Verifies that a file exists at the path and then attempts to delete it. An error is thrown if the path is for a directory. - -- Parameter path: The path of the file to delete. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| path | The path of the file to delete. | - -### `deleteDirectory(atPath:)` - -```swift -public func deleteDirectory(atPath path: String) throws -``` - -Verifies that a directory exists at the path and then attempts to delete it. An error is thrown if the path is for a file. - -- Parameter path: The path of the directory to delete. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| path | The path of the directory to delete. | - -### `createFile(atPath:data:overwrite:)` - -```swift -public func createFile(atPath path: String, data: Data? = nil, overwrite: Bool = true) throws -``` - -Creates a file at the specified path and writes any given data to it. If a file already exists at `path`, this method overwrites the -contents of that file if the current process has the appropriate privileges to do so. - -- Parameters: - - path: Path to the file. - - data: [optional] Data to write to the file path. - - overwrite: Indicates if the contents of an existing file should be overwritten. - If `false` the function will exit without writing the file if it already exists. - This will not throw an error. - Defaults to `false. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| path | Path to the file. | -| data | [optional] Data to write to the file path. | -| overwrite | Indicates if the contents of an existing file should be overwritten. If `false` the function will exit without writing the file if it already exists. This will not throw an error. Defaults to `false. | - -### `createContainingDirectoryIfNeeded(forPath:)` - -```swift -public func createContainingDirectoryIfNeeded(forPath path: String) throws -``` - -Creates the containing directory (including all intermediate directories) for the given file URL if necessary. This method will not -overwrite any existing directory. - -- Parameter fileURL: The URL of the file to create a containing directory for if necessary. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| fileURL | The URL of the file to create a containing directory for if necessary. | - -### `createDirectoryIfNeeded(atPath:)` - -```swift -public func createDirectoryIfNeeded(atPath path: String) throws -``` - -Creates the directory (including all intermediate directories) for the given URL if necessary. This method will not overwrite any -existing directory. - -- Parameter path: The path of the directory to create if necessary. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| path | The path of the directory to create if necessary. | - -### `parentFolderURL()` - -```swift -public func parentFolderURL() -> URL -``` - -- Returns: the URL to the parent folder of the current URL. - -### `childFolderURL(folderName:)` - -```swift -public func childFolderURL(folderName: String) -> URL -``` - -- Parameter folderName: The name of the child folder to append to the current URL -- Returns: The full URL including the appended child folder. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| folderName | The name of the child folder to append to the current URL | - -### `childFileURL(fileName:)` - -```swift -public func childFileURL(fileName: String) throws -> URL -``` - -Adds the filename to the caller to get the full URL of a file - -- Parameters: - - fileName: The name of the child file, with an extension, for example `"API.swift"`. Note: For hidden files just pass `".filename"`. -- Returns: The full URL including the full file. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| fileName | The name of the child file, with an extension, for example `"API.swift"`. Note: For hidden files just pass `".filename"`. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/extensions/ApolloSchemaDownloadConfiguration.md b/docs/source/api/ApolloCodegenLib/extensions/ApolloSchemaDownloadConfiguration.md deleted file mode 100644 index 924e389fbb..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/ApolloSchemaDownloadConfiguration.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `ApolloSchemaDownloadConfiguration` -```swift -extension ApolloSchemaDownloadConfiguration: CustomDebugStringConvertible -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/extensions/FileHandle.md b/docs/source/api/ApolloCodegenLib/extensions/FileHandle.md deleted file mode 100644 index 4fbd2f6da9..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/FileHandle.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `FileHandle` -```swift -extension FileHandle: TextOutputStream -``` - -## Methods -### `write(_:)` - -```swift -public func write(_ string: String) -``` diff --git a/docs/source/api/ApolloCodegenLib/extensions/GraphQLType.md b/docs/source/api/ApolloCodegenLib/extensions/GraphQLType.md deleted file mode 100644 index 7a31c9c0c4..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/GraphQLType.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `GraphQLType` -```swift -extension GraphQLType: CustomDebugStringConvertible -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/extensions/JavaScriptError.md b/docs/source/api/ApolloCodegenLib/extensions/JavaScriptError.md deleted file mode 100644 index 0c3b0c7ec9..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/JavaScriptError.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `JavaScriptError` -```swift -extension JavaScriptError: CustomStringConvertible -``` - -## Properties -### `description` - -```swift -public var description: String -``` diff --git a/docs/source/api/ApolloCodegenLib/extensions/JavaScriptObject.md b/docs/source/api/ApolloCodegenLib/extensions/JavaScriptObject.md deleted file mode 100644 index e71d1b5fe7..0000000000 --- a/docs/source/api/ApolloCodegenLib/extensions/JavaScriptObject.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `JavaScriptObject` -```swift -extension JavaScriptObject: CustomDebugStringConvertible -``` - -## Properties -### `debugDescription` - -```swift -@objc public var debugDescription: String -``` diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.ExperimentalFeatures.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.ExperimentalFeatures.md deleted file mode 100644 index 52acbc7327..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.ExperimentalFeatures.md +++ /dev/null @@ -1,56 +0,0 @@ -**STRUCT** - -# `ApolloCodegenConfiguration.ExperimentalFeatures` - -```swift -public struct ExperimentalFeatures: Codable, Equatable -``` - -## Properties -### `clientControlledNullability` - -```swift -public let clientControlledNullability: Bool -``` - - **EXPERIMENTAL**: If enabled, the parser will understand and parse Client Controlled Nullability - Designators contained in Fields. They'll be represented in the - `required` field of the FieldNode. - - The syntax looks like the following: - - ```graphql - { - nullableField! - nonNullableField? - nonNullableSelectionSet? { - childField! - } - } - ``` - - Note: This feature is experimental and may change or be removed in the - future. - -### `legacySafelistingCompatibleOperations` - -```swift -public let legacySafelistingCompatibleOperations: Bool -``` - - **EXPERIMENTAL**: If enabled, the generated operations will be transformed using a method - that attempts to maintain compatibility with the legacy behavior from - [`apollo-tooling`](https://github.dev/apollographql/apollo-tooling) - for registering persisted operation to a safelist. - - - Note: Safelisting queries is a deprecated feature of Apollo Server that has reduced - support for legacy use cases. This option may not work as intended in all situations. - -## Methods -### `init(clientControlledNullability:legacySafelistingCompatibleOperations:)` - -```swift -public init( - clientControlledNullability: Bool = false, - legacySafelistingCompatibleOperations: Bool = false -) -``` diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.FileInput.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.FileInput.md deleted file mode 100644 index 0af7419a2b..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.FileInput.md +++ /dev/null @@ -1,185 +0,0 @@ -**STRUCT** - -# `ApolloCodegenConfiguration.FileInput` - -```swift -public struct FileInput: Codable, Equatable -``` - -The input paths and files required for code generation. - -## Properties -### `schemaSearchPaths` - -```swift -public let schemaSearchPaths: [String] -``` - -An array of path matching pattern strings used to find GraphQL schema -files to be included for code generation. - -Schema files may contain only spec-compliant -[`TypeSystemDocument`](https://spec.graphql.org/draft/#sec-Type-System) or -[`TypeSystemExtension`](https://spec.graphql.org/draft/#sec-Type-System-Extensions) -definitions in SDL or JSON format. -This includes: - - [Schema Definitions](https://spec.graphql.org/draft/#SchemaDefinition) - - [Type Definitions](https://spec.graphql.org/draft/#TypeDefinition) - - [Directive Definitions](https://spec.graphql.org/draft/#DirectiveDefinition) - - [Schema Extensions](https://spec.graphql.org/draft/#SchemaExtension) - - [Type Extensions](https://spec.graphql.org/draft/#TypeExtension) - -You can use absolute or relative paths in path matching patterns. Relative paths will be -based off the current working directory from `FileManager`. - -Each path matching pattern can include the following characters: - - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - - `?` matches any single character, eg: `file-?.graphql` - - `**` matches all subdirectories (deep), eg: `**/*.graphql` - - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - -- Precondition: JSON format schema files must have the file extension ".json". -When using a JSON format schema file, only a single JSON schema can be provided with any -number of additional SDL schema extension files. - -### `operationSearchPaths` - -```swift -public let operationSearchPaths: [String] -``` - -An array of path matching pattern strings used to find GraphQL -operation files to be included for code generation. - - Operation files may contain only spec-compliant - [`ExecutableDocument`](https://spec.graphql.org/draft/#ExecutableDocument) - definitions in SDL format. - This includes: - - [Operation Definitions](https://spec.graphql.org/draft/#sec-Language.Operations) - (ie. `query`, `mutation`, or `subscription`) - - [Fragment Definitions](https://spec.graphql.org/draft/#sec-Language.Fragments) - -You can use absolute or relative paths in path matching patterns. Relative paths will be -based off the current working directory from `FileManager`. - -Each path matching pattern can include the following characters: - - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - - `?` matches any single character, eg: `file-?.graphql` - - `**` matches all subdirectories (deep), eg: `**/*.graphql` - - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - -## Methods -### `init(schemaSearchPaths:operationSearchPaths:)` - -```swift -public init( - schemaSearchPaths: [String] = ["**/*.graphqls"], - operationSearchPaths: [String] = ["**/*.graphql"] -) -``` - -Designated initializer. - -- Parameters: - - schemaSearchPaths: An array of path matching pattern strings used to find GraphQL schema - files to be included for code generation. - Schema files may contain only spec-compliant - [`TypeSystemDocument`](https://spec.graphql.org/draft/#sec-Type-System) or - [`TypeSystemExtension`](https://spec.graphql.org/draft/#sec-Type-System-Extensions) - definitions in SDL or JSON format. - This includes: - - [Schema Definitions](https://spec.graphql.org/draft/#SchemaDefinition) - - [Type Definitions](https://spec.graphql.org/draft/#TypeDefinition) - - [Directive Definitions](https://spec.graphql.org/draft/#DirectiveDefinition) - - [Schema Extensions](https://spec.graphql.org/draft/#SchemaExtension) - - [Type Extensions](https://spec.graphql.org/draft/#TypeExtension) - - Defaults to `["**/*.graphqls"]`. - - - operationSearchPaths: An array of path matching pattern strings used to find GraphQL - operation files to be included for code generation. - Operation files may contain only spec-compliant - [`ExecutableDocument`](https://spec.graphql.org/draft/#ExecutableDocument) - definitions in SDL format. - This includes: - - [Operation Definitions](https://spec.graphql.org/draft/#sec-Language.Operations) - (ie. `query`, `mutation`, or `subscription`) - - [Fragment Definitions](https://spec.graphql.org/draft/#sec-Language.Fragments) - - Defaults to `["**/*.graphql"]`. - - You can use absolute or relative paths in path matching patterns. Relative paths will be - based off the current working directory from `FileManager`. - - Each path matching pattern can include the following characters: - - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - - `?` matches any single character, eg: `file-?.graphql` - - `**` matches all subdirectories (deep), eg: `**/*.graphql` - - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - -- Precondition: JSON format schema files must have the file extension ".json". -When using a JSON format schema file, only a single JSON schema can be provided with any -number of additional SDL schema extension files. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| schemaSearchPaths | An array of path matching pattern strings used to find GraphQL schema files to be included for code generation. Schema files may contain only spec-compliant or definitions in SDL or JSON format. This includes: Defaults to `["**/*.graphqls"]`. | -| operationSearchPaths | An array of path matching pattern strings used to find GraphQL operation files to be included for code generation. Operation files may contain only spec-compliant definitions in SDL format. This includes: Defaults to `["**/*.graphql"]`. | - -### `init(schemaPath:operationSearchPaths:)` - -```swift -public init( - schemaPath: String, - operationSearchPaths: [String] = ["**/*.graphql"] -) -``` - -Convenience initializer. - -- Parameters: - - schemaPath: The path to a local GraphQL schema file to be used for code generation. - Schema files may contain only spec-compliant - [`TypeSystemDocument`](https://spec.graphql.org/draft/#sec-Type-System) or - [`TypeSystemExtension`](https://spec.graphql.org/draft/#sec-Type-System-Extensions) - definitions in SDL or JSON format. - This includes: - - [Schema Definitions](https://spec.graphql.org/draft/#SchemaDefinition) - - [Type Definitions](https://spec.graphql.org/draft/#TypeDefinition) - - [Directive Definitions](https://spec.graphql.org/draft/#DirectiveDefinition) - - [Schema Extensions](https://spec.graphql.org/draft/#SchemaExtension) - - [Type Extensions](https://spec.graphql.org/draft/#TypeExtension) - - - operationSearchPaths: An array of path matching pattern strings used to find GraphQL - operation files to be included for code generation. - Operation files may contain only spec-compliant - [`ExecutableDocument`](https://spec.graphql.org/draft/#ExecutableDocument) - definitions in SDL format. - This includes: - - [Operation Definitions](https://spec.graphql.org/draft/#sec-Language.Operations) - (ie. `query`, `mutation`, or `subscription`) - - [Fragment Definitions](https://spec.graphql.org/draft/#sec-Language.Fragments) - - Defaults to `["**/*.graphql"]`. - - You can use absolute or relative paths in path matching patterns. Relative paths will be - based off the current working directory from `FileManager`. - - Each path matching pattern can include the following characters: - - `*` matches everything but the directory separator (shallow), eg: `*.graphql` - - `?` matches any single character, eg: `file-?.graphql` - - `**` matches all subdirectories (deep), eg: `**/*.graphql` - - `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - -- Precondition: JSON format schema files must have the file extension ".json". -When using a JSON format schema file, only a single JSON schema can be provided with any -number of additional SDL schema extension files. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| schemaPath | The path to a local GraphQL schema file to be used for code generation. Schema files may contain only spec-compliant or definitions in SDL or JSON format. This includes: | -| operationSearchPaths | An array of path matching pattern strings used to find GraphQL operation files to be included for code generation. Operation files may contain only spec-compliant definitions in SDL format. This includes: Defaults to `["**/*.graphql"]`. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.FileOutput.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.FileOutput.md deleted file mode 100644 index 2e7dc5b3a9..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.FileOutput.md +++ /dev/null @@ -1,67 +0,0 @@ -**STRUCT** - -# `ApolloCodegenConfiguration.FileOutput` - -```swift -public struct FileOutput: Codable, Equatable -``` - -The paths and files output by code generation. - -## Properties -### `schemaTypes` - -```swift -public let schemaTypes: SchemaTypesFileOutput -``` - -The local path structure for the generated schema types files. - -### `operations` - -```swift -public let operations: OperationsFileOutput -``` - -The local path structure for the generated operation object files. - -### `testMocks` - -```swift -public let testMocks: TestMockFileOutput -``` - -The local path structure for the test mock operation object files. - -### `operationIdentifiersPath` - -```swift -public let operationIdentifiersPath: String? -``` - -An absolute location to an operation id JSON map file. If specified, also stores the -operation IDs (hashes) as properties on operation types. - -## Methods -### `init(schemaTypes:operations:testMocks:operationIdentifiersPath:)` - -```swift -public init( - schemaTypes: SchemaTypesFileOutput, - operations: OperationsFileOutput = .relative(subpath: nil), - testMocks: TestMockFileOutput = .none, - operationIdentifiersPath: String? = nil -) -``` - -Designated initializer. - -- Parameters: - - schemaTypes: The local path structure for the generated schema types files. - - operations: The local path structure for the generated operation object files. - Defaults to `.relative` with a `subpath` of `nil`. - - testMocks: The local path structure for the test mock operation object files. - If `.none`, test mocks will not be generated. Defaults to `.none`. - - operationIdentifiersPath: An absolute location to an operation id JSON map file. - If specified, also stores the operation IDs (hashes) as properties on operation types. - Defaults to `nil`. diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.OutputOptions.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.OutputOptions.md deleted file mode 100644 index 1ef6081931..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.OutputOptions.md +++ /dev/null @@ -1,89 +0,0 @@ -**STRUCT** - -# `ApolloCodegenConfiguration.OutputOptions` - -```swift -public struct OutputOptions: Codable, Equatable -``` - -## Properties -### `additionalInflectionRules` - -```swift -public let additionalInflectionRules: [InflectionRule] -``` - -Any non-default rules for pluralization or singularization you wish to include. - -### `queryStringLiteralFormat` - -```swift -public let queryStringLiteralFormat: QueryStringLiteralFormat -``` - -Formatting of the GraphQL query string literal that is included in each -generated operation object. - -### `deprecatedEnumCases` - -```swift -public let deprecatedEnumCases: Composition -``` - -How deprecated enum cases from the schema should be handled. - -### `schemaDocumentation` - -```swift -public let schemaDocumentation: Composition -``` - -Whether schema documentation is added to the generated files. - -### `apqs` - -```swift -public let apqs: APQConfig -``` - -Whether the generated operations should use Automatic Persisted Queries. - -See `APQConfig` for more information on Automatic Persisted Queries. - -### `warningsOnDeprecatedUsage` - -```swift -public let warningsOnDeprecatedUsage: Composition -``` - -Annotate generated Swift code with the Swift `available` attribute and `deprecated` -argument for parts of the GraphQL schema annotated with the built-in `@deprecated` -directive. - -## Methods -### `init(additionalInflectionRules:queryStringLiteralFormat:deprecatedEnumCases:schemaDocumentation:apqs:warningsOnDeprecatedUsage:)` - -```swift -public init( - additionalInflectionRules: [InflectionRule] = [], - queryStringLiteralFormat: QueryStringLiteralFormat = .multiline, - deprecatedEnumCases: Composition = .include, - schemaDocumentation: Composition = .include, - apqs: APQConfig = .disabled, - warningsOnDeprecatedUsage: Composition = .include -) -``` - -Designated initializer. - -- Parameters: - - additionalInflectionRules: Any non-default rules for pluralization or singularization - you wish to include. - - queryStringLiteralFormat: Formatting of the GraphQL query string literal that is - included in each generated operation object. - - deprecatedEnumCases: How deprecated enum cases from the schema should be handled. - - schemaDocumentation: Whether schema documentation is added to the generated files. - - apqs: Whether the generated operations should use Automatic Persisted Queries. - - warningsOnDeprecatedUsage: Annotate generated Swift code with the Swift `available` - attribute and `deprecated` argument for parts of the GraphQL schema annotated with the - built-in `@deprecated` directive. diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.SchemaTypesFileOutput.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.SchemaTypesFileOutput.md deleted file mode 100644 index 6081f8272c..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.SchemaTypesFileOutput.md +++ /dev/null @@ -1,43 +0,0 @@ -**STRUCT** - -# `ApolloCodegenConfiguration.SchemaTypesFileOutput` - -```swift -public struct SchemaTypesFileOutput: Codable, Equatable -``` - -The local path structure for the generated schema types files. - -## Properties -### `path` - -```swift -public let path: String -``` - -Local path where the generated schema types files should be stored. - -### `moduleType` - -```swift -public let moduleType: ModuleType -``` - -Automation to ease the integration of the generated schema types file with compatible -dependency managers. - -## Methods -### `init(path:moduleType:)` - -```swift -public init( - path: String, - moduleType: ModuleType -) -``` - -Designated initializer. - -- Parameters: - - path: Local path where the generated schema type files should be stored. - - moduleType: Type of module that will be created for the schema types files. diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.md deleted file mode 100644 index e1a5a57816..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenConfiguration.md +++ /dev/null @@ -1,84 +0,0 @@ -**STRUCT** - -# `ApolloCodegenConfiguration` - -```swift -public struct ApolloCodegenConfiguration: Codable, Equatable -``` - -A configuration object that defines behavior for code generation. - -## Properties -### `schemaNamespace` - -```swift -public let schemaNamespace: String -``` - -Name used to scope the generated schema type files. - -### `input` - -```swift -public let input: FileInput -``` - -The input files required for code generation. - -### `output` - -```swift -public let output: FileOutput -``` - -The paths and files output by code generation. - -### `options` - -```swift -public let options: OutputOptions -``` - -Rules and options to customize the generated code. - -### `experimentalFeatures` - -```swift -public let experimentalFeatures: ExperimentalFeatures -``` - -Allows users to enable experimental features. - -Note: These features could change at any time and they are not guaranteed to always be -available. - -### `schemaDownloadConfiguration` - -```swift -public let schemaDownloadConfiguration: ApolloSchemaDownloadConfiguration? -``` - -Schema download configuration. - -## Methods -### `init(schemaNamespace:input:output:options:experimentalFeatures:schemaDownloadConfiguration:)` - -```swift -public init( - schemaNamespace: String, - input: FileInput, - output: FileOutput, - options: OutputOptions = OutputOptions(), - experimentalFeatures: ExperimentalFeatures = ExperimentalFeatures(), - schemaDownloadConfiguration: ApolloSchemaDownloadConfiguration? = nil -) -``` - -Designated initializer. - -- Parameters: - - schemaNamespace: Name used to scope the generated schema type files. - - input: The input files required for code generation. - - output: The paths and files output by code generation. - - options: Rules and options to customize the generated code. - - experimentalFeatures: Allows users to enable experimental features. diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration.HTTPHeader.md b/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration.HTTPHeader.md deleted file mode 100644 index a5ac4c0c9a..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration.HTTPHeader.md +++ /dev/null @@ -1,21 +0,0 @@ -**STRUCT** - -# `ApolloSchemaDownloadConfiguration.HTTPHeader` - -```swift -public struct HTTPHeader: Equatable, CustomDebugStringConvertible, Codable -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` - -## Methods -### `init(key:value:)` - -```swift -public init(key: String, value: String) -``` diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration.md b/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration.md deleted file mode 100644 index ed0ef9af6d..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration.md +++ /dev/null @@ -1,80 +0,0 @@ -**STRUCT** - -# `ApolloSchemaDownloadConfiguration` - -```swift -public struct ApolloSchemaDownloadConfiguration: Equatable, Codable -``` - -A configuration object that defines behavior for schema download. - -## Properties -### `downloadMethod` - -```swift -public let downloadMethod: DownloadMethod -``` - -How to download your schema. Supports the Apollo Registry and GraphQL Introspection methods. - -### `downloadTimeout` - -```swift -public let downloadTimeout: Double -``` - -The maximum time (in seconds) to wait before indicating that the download timed out. -Defaults to 30 seconds. - -### `headers` - -```swift -public let headers: [HTTPHeader] -``` - -Any additional headers to include when retrieving your schema. Defaults to nil. - -### `outputPath` - -```swift -public let outputPath: String -``` - -The local path where the downloaded schema should be written to. - -### `outputFormat` - -```swift -public var outputFormat: DownloadMethod.OutputFormat -``` - -## Methods -### `init(using:timeout:headers:outputPath:)` - -```swift -public init( - using downloadMethod: DownloadMethod, - timeout downloadTimeout: Double = 30.0, - headers: [HTTPHeader] = [], - outputPath: String -) -``` - -Designated Initializer - -- Parameters: - - downloadMethod: How to download your schema. - - downloadTimeout: The maximum time (in seconds) to wait before indicating that the - download timed out. Defaults to 30 seconds. - - headers: [optional] Any additional headers to include when retrieving your schema. - Defaults to nil - - outputPath: The local path where the downloaded schema should be written to. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| downloadMethod | How to download your schema. | -| downloadTimeout | The maximum time (in seconds) to wait before indicating that the download timed out. Defaults to 30 seconds. | -| headers | [optional] Any additional headers to include when retrieving your schema. Defaults to nil | -| outputPath | The local path where the downloaded schema should be written to. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloader.md b/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloader.md deleted file mode 100644 index 752f85ff15..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloSchemaDownloader.md +++ /dev/null @@ -1,29 +0,0 @@ -**STRUCT** - -# `ApolloSchemaDownloader` - -```swift -public struct ApolloSchemaDownloader -``` - -A wrapper to facilitate downloading a GraphQL schema. - -## Methods -### `fetch(configuration:)` - -```swift -public static func fetch(configuration: ApolloSchemaDownloadConfiguration) throws -``` - -Downloads your schema using the specified configuration object. - -- Parameters: - - configuration: The `ApolloSchemaDownloadConfiguration` used to download the schema. -- Returns: Output from a successful fetch or throws an error. -- Throws: Any error which occurs during the fetch. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| configuration | The `ApolloSchemaDownloadConfiguration` used to download the schema. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md b/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md deleted file mode 100644 index 2ecccda14b..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md +++ /dev/null @@ -1,45 +0,0 @@ -**STRUCT** - -# `CodegenLogger` - -```swift -public struct CodegenLogger -``` - -Helper to get logs printing to stdout so they can be read from the command line. - -## Properties -### `level` - -```swift -public static var level = LogLevel.debug -``` - -The `LogLevel` at which to print logs. Higher raw values than this will -be ignored. Defaults to `debug`. - -## Methods -### `log(_:logLevel:file:line:)` - -```swift -public static func log(_ logString: @autoclosure () -> String, - logLevel: LogLevel = .debug, - file: StaticString = #file, - line: UInt = #line) -``` - -Logs the given string if its `logLevel` is at or above `CodegenLogger.level`, otherwise ignores it. - -- Parameter logString: The string to log out, as an autoclosure -- Parameter logLevel: The log level at which to print this specific log. Defaults to `debug`. -- Parameter file: The file where this function was called. Defaults to the direct caller. -- Parameter line: The line where this function was called. Defaults to the direct caller. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| logString | The string to log out, as an autoclosure | -| logLevel | The log level at which to print this specific log. Defaults to `debug`. | -| file | The file where this function was called. Defaults to the direct caller. | -| line | The line where this function was called. Defaults to the direct caller. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/structs/DownloadMethod.ApolloRegistrySettings.md b/docs/source/api/ApolloCodegenLib/structs/DownloadMethod.ApolloRegistrySettings.md deleted file mode 100644 index 70b0fab89e..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/DownloadMethod.ApolloRegistrySettings.md +++ /dev/null @@ -1,55 +0,0 @@ -**STRUCT** - -# `DownloadMethod.ApolloRegistrySettings` - -```swift -public struct ApolloRegistrySettings: Equatable, Codable -``` - -## Properties -### `apiKey` - -```swift -public let apiKey: String -``` - -The API key to use when retrieving your schema from the Apollo Registry. - -### `graphID` - -```swift -public let graphID: String -``` - -The identifier of the graph to fetch. Can be found in Apollo Studio. - -### `variant` - -```swift -public let variant: String? -``` - -The variant of the graph in the registry. - -## Methods -### `init(apiKey:graphID:variant:)` - -```swift -public init(apiKey: String, graphID: String, variant: String = "current") -``` - -Designated initializer - -- Parameters: - - apiKey: The API key to use when retrieving your schema. - - graphID: The identifier of the graph to fetch. Can be found in Apollo Studio. - - variant: The variant of the graph to fetch. Defaults to "current", which will return - whatever is set to the current variant. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| apiKey | The API key to use when retrieving your schema. | -| graphID | The identifier of the graph to fetch. Can be found in Apollo Studio. | -| variant | The variant of the graph to fetch. Defaults to “current”, which will return whatever is set to the current variant. | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/structs/FileFinder.md b/docs/source/api/ApolloCodegenLib/structs/FileFinder.md deleted file mode 100644 index 06dacae773..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/FileFinder.md +++ /dev/null @@ -1,68 +0,0 @@ -**STRUCT** - -# `FileFinder` - -```swift -public struct FileFinder -``` - -## Methods -### `findParentFolder(from:)` - -```swift -public static func findParentFolder(from filePath: StaticString = #filePath) -> URL -``` - -Version that works if you're using the 5.3 compiler or above -- Parameter filePath: The full file path of the file to find. Defaults to the `#filePath` of the caller. -- Returns: The file URL for the parent folder. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| filePath | The full file path of the file to find. Defaults to the `#filePath` of the caller. | - -### `fileURL(from:)` - -```swift -public static func fileURL(from filePath: StaticString = #filePath) -> URL -``` - -The URL of a file at a given path -- Parameter filePath: The full file path of the file to find -- Returns: The file's URL - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| filePath | The full file path of the file to find | - -### `findParentFolder(from:)` - -Version that works if you're using the 5.2 compiler or below -- Parameter file: The full file path of the file to find. Defaults to the `#file` of the caller. -- Returns: The file URL for the parent folder. - -### `fileURL(from:)` - -The URL of a file at a given path -- Parameter filePath: The full file path of the file to find -- Returns: The file's URL - -### `findParentFolder(from:)` - -```swift -public static func findParentFolder(from filePath: String) -> URL -``` - -Finds the parent folder from a given file path. -- Parameter filePath: The full file path, as a string -- Returns: The file URL for the parent folder. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| filePath | The full file path, as a string | \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/structs/Glob.md b/docs/source/api/ApolloCodegenLib/structs/Glob.md deleted file mode 100644 index e0988ef164..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/Glob.md +++ /dev/null @@ -1,9 +0,0 @@ -**STRUCT** - -# `Glob` - -```swift -public struct Glob -``` - -A path pattern matcher. diff --git a/docs/source/api/ApolloCodegenLib/structs/GraphQLSourceLocation.md b/docs/source/api/ApolloCodegenLib/structs/GraphQLSourceLocation.md deleted file mode 100644 index cc077fc11f..0000000000 --- a/docs/source/api/ApolloCodegenLib/structs/GraphQLSourceLocation.md +++ /dev/null @@ -1,9 +0,0 @@ -**STRUCT** - -# `GraphQLSourceLocation` - -```swift -public struct GraphQLSourceLocation -``` - -Represents a location in a GraphQL source file. diff --git a/docs/source/api/ApolloCodegenLib/toc.md b/docs/source/api/ApolloCodegenLib/toc.md deleted file mode 100644 index 554f9d8cb7..0000000000 --- a/docs/source/api/ApolloCodegenLib/toc.md +++ /dev/null @@ -1,98 +0,0 @@ -# Reference Documentation - -## Structs - -- [ApolloCodegenConfiguration](structs/ApolloCodegenConfiguration/) -- [ApolloCodegenConfiguration.ExperimentalFeatures](structs/ApolloCodegenConfiguration.ExperimentalFeatures/) -- [ApolloCodegenConfiguration.FileInput](structs/ApolloCodegenConfiguration.FileInput/) -- [ApolloCodegenConfiguration.FileOutput](structs/ApolloCodegenConfiguration.FileOutput/) -- [ApolloCodegenConfiguration.OutputOptions](structs/ApolloCodegenConfiguration.OutputOptions/) -- [ApolloCodegenConfiguration.SchemaTypesFileOutput](structs/ApolloCodegenConfiguration.SchemaTypesFileOutput/) -- [ApolloSchemaDownloadConfiguration](structs/ApolloSchemaDownloadConfiguration/) -- [ApolloSchemaDownloadConfiguration.HTTPHeader](structs/ApolloSchemaDownloadConfiguration.HTTPHeader/) -- [ApolloSchemaDownloader](structs/ApolloSchemaDownloader/) -- [CodegenLogger](structs/CodegenLogger/) -- [DownloadMethod.ApolloRegistrySettings](structs/DownloadMethod.ApolloRegistrySettings/) -- [FileFinder](structs/FileFinder/) -- [Glob](structs/Glob/) -- [GraphQLSourceLocation](structs/GraphQLSourceLocation/) - -## Classes - -- [ASTNode](classes/ASTNode/) -- [ApolloCodegen](classes/ApolloCodegen/) -- [CompilationResult](classes/CompilationResult/) -- [CompilationResult.Argument](classes/CompilationResult.Argument/) -- [CompilationResult.Directive](classes/CompilationResult.Directive/) -- [CompilationResult.Field](classes/CompilationResult.Field/) -- [CompilationResult.FragmentDefinition](classes/CompilationResult.FragmentDefinition/) -- [CompilationResult.FragmentSpread](classes/CompilationResult.FragmentSpread/) -- [CompilationResult.InlineFragment](classes/CompilationResult.InlineFragment/) -- [CompilationResult.OperationDefinition](classes/CompilationResult.OperationDefinition/) -- [CompilationResult.SelectionSet](classes/CompilationResult.SelectionSet/) -- [CompilationResult.VariableDefinition](classes/CompilationResult.VariableDefinition/) -- [GraphQLAbstractType](classes/GraphQLAbstractType/) -- [GraphQLCompositeType](classes/GraphQLCompositeType/) -- [GraphQLDocument](classes/GraphQLDocument/) -- [GraphQLEnumType](classes/GraphQLEnumType/) -- [GraphQLEnumValue](classes/GraphQLEnumValue/) -- [GraphQLError](classes/GraphQLError/) -- [GraphQLField](classes/GraphQLField/) -- [GraphQLFieldArgument](classes/GraphQLFieldArgument/) -- [GraphQLInputField](classes/GraphQLInputField/) -- [GraphQLInputObjectType](classes/GraphQLInputObjectType/) -- [GraphQLInterfaceType](classes/GraphQLInterfaceType/) -- [GraphQLJSFrontend](classes/GraphQLJSFrontend/) -- [GraphQLNamedType](classes/GraphQLNamedType/) -- [GraphQLObjectType](classes/GraphQLObjectType/) -- [GraphQLScalarType](classes/GraphQLScalarType/) -- [GraphQLSchema](classes/GraphQLSchema/) -- [GraphQLSchemaValidationError](classes/GraphQLSchemaValidationError/) -- [GraphQLSource](classes/GraphQLSource/) -- [GraphQLUnionType](classes/GraphQLUnionType/) -- [JavaScriptError](classes/JavaScriptError/) -- [JavaScriptObject](classes/JavaScriptObject/) -- [JavaScriptWrapper](classes/JavaScriptWrapper/) -- [Schema.ReferencedTypes](classes/Schema.ReferencedTypes/) - -## Enums - -- [ApolloCodegen.Error](enums/ApolloCodegen.Error/) -- [ApolloCodegenConfiguration.APQConfig](enums/ApolloCodegenConfiguration.APQConfig/) -- [ApolloCodegenConfiguration.Composition](enums/ApolloCodegenConfiguration.Composition/) -- [ApolloCodegenConfiguration.Error](enums/ApolloCodegenConfiguration.Error/) -- [ApolloCodegenConfiguration.OperationsFileOutput](enums/ApolloCodegenConfiguration.OperationsFileOutput/) -- [ApolloCodegenConfiguration.PathType](enums/ApolloCodegenConfiguration.PathType/) -- [ApolloCodegenConfiguration.QueryStringLiteralFormat](enums/ApolloCodegenConfiguration.QueryStringLiteralFormat/) -- [ApolloCodegenConfiguration.TestMockFileOutput](enums/ApolloCodegenConfiguration.TestMockFileOutput/) -- [ApolloSchemaDownloadConfiguration.DownloadMethod](enums/ApolloSchemaDownloadConfiguration.DownloadMethod/) -- [ApolloSchemaDownloader.SchemaDownloadError](enums/ApolloSchemaDownloader.SchemaDownloadError/) -- [ApolloURLError](enums/ApolloURLError/) -- [CodegenLogger.LogLevel](enums/CodegenLogger.LogLevel/) -- [CompilationResult.InclusionCondition](enums/CompilationResult.InclusionCondition/) -- [CompilationResult.OperationType](enums/CompilationResult.OperationType/) -- [CompilationResult.Selection](enums/CompilationResult.Selection/) -- [DownloadMethod.HTTPMethod](enums/DownloadMethod.HTTPMethod/) -- [DownloadMethod.OutputFormat](enums/DownloadMethod.OutputFormat/) -- [FileManagerPathError](enums/FileManagerPathError/) -- [Glob.MatchError](enums/Glob.MatchError/) -- [GraphQLType](enums/GraphQLType/) -- [InflectionRule](enums/InflectionRule/) -- [JavaScriptBridge.Error](enums/JavaScriptBridge.Error/) -- [SchemaTypesFileOutput.ModuleType](enums/SchemaTypesFileOutput.ModuleType/) - -## Extensions - -- [ApolloCodegenConfiguration](extensions/ApolloCodegenConfiguration/) -- [ApolloExtension](extensions/ApolloExtension/) -- [ApolloSchemaDownloadConfiguration](extensions/ApolloSchemaDownloadConfiguration/) -- [FileHandle](extensions/FileHandle/) -- [GraphQLType](extensions/GraphQLType/) -- [JavaScriptError](extensions/JavaScriptError/) -- [JavaScriptObject](extensions/JavaScriptObject/) - -## Typealiases - -- [FileAttributes](typealiases/FileAttributes/) - -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/api/ApolloCodegenLib/typealiases/FileAttributes.md b/docs/source/api/ApolloCodegenLib/typealiases/FileAttributes.md deleted file mode 100644 index 201cd41eaa..0000000000 --- a/docs/source/api/ApolloCodegenLib/typealiases/FileAttributes.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `FileAttributes` - -```swift -public typealias FileAttributes = [FileAttributeKey : Any] -``` diff --git a/docs/source/api/ApolloSQLite/classes/SQLiteDotSwiftDatabase.md b/docs/source/api/ApolloSQLite/classes/SQLiteDotSwiftDatabase.md deleted file mode 100644 index a8df246ac8..0000000000 --- a/docs/source/api/ApolloSQLite/classes/SQLiteDotSwiftDatabase.md +++ /dev/null @@ -1,56 +0,0 @@ -**CLASS** - -# `SQLiteDotSwiftDatabase` - -```swift -public final class SQLiteDotSwiftDatabase: SQLiteDatabase -``` - -## Methods -### `init(fileURL:)` - -```swift -public init(fileURL: URL) throws -``` - -### `init(connection:)` - -```swift -public init(connection: Connection) -``` - -### `createRecordsTableIfNeeded()` - -```swift -public func createRecordsTableIfNeeded() throws -``` - -### `selectRawRows(forKeys:)` - -```swift -public func selectRawRows(forKeys keys: Set) throws -> [DatabaseRow] -``` - -### `addOrUpdateRecordString(_:for:)` - -```swift -public func addOrUpdateRecordString(_ recordString: String, for cacheKey: CacheKey) throws -``` - -### `deleteRecord(for:)` - -```swift -public func deleteRecord(for cacheKey: CacheKey) throws -``` - -### `deleteRecords(matching:)` - -```swift -public func deleteRecords(matching pattern: CacheKey) throws -``` - -### `clearDatabase(shouldVacuumOnClear:)` - -```swift -public func clearDatabase(shouldVacuumOnClear: Bool) throws -``` diff --git a/docs/source/api/ApolloSQLite/classes/SQLiteNormalizedCache.md b/docs/source/api/ApolloSQLite/classes/SQLiteNormalizedCache.md deleted file mode 100644 index 2ece84cd5a..0000000000 --- a/docs/source/api/ApolloSQLite/classes/SQLiteNormalizedCache.md +++ /dev/null @@ -1,39 +0,0 @@ -**CLASS** - -# `SQLiteNormalizedCache` - -```swift -public final class SQLiteNormalizedCache -``` - -A `NormalizedCache` implementation which uses a SQLite database to store data. - -## Methods -### `init(fileURL:databaseType:shouldVacuumOnClear:)` - -```swift -public init(fileURL: URL, - databaseType: SQLiteDatabase.Type = SQLiteDotSwiftDatabase.self, - shouldVacuumOnClear: Bool = false) throws -``` - -Designated initializer - -- Parameters: - - fileURL: The file URL to use for your database. - - shouldVacuumOnClear: If the database should also be `VACCUM`ed on clear to remove all traces of info. Defaults to `false` since this involves a performance hit, but this should be used if you are storing any Personally Identifiable Information in the cache. -- Throws: Any errors attempting to open or create the database. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| fileURL | The file URL to use for your database. | -| shouldVacuumOnClear | If the database should also be `VACCUM`ed on clear to remove all traces of info. Defaults to `false` since this involves a performance hit, but this should be used if you are storing any Personally Identifiable Information in the cache. | - -### `init(database:shouldVacuumOnClear:)` - -```swift -public init(database: SQLiteDatabase, - shouldVacuumOnClear: Bool = false) throws -``` diff --git a/docs/source/api/ApolloSQLite/enums/SQLiteNormalizedCacheError.md b/docs/source/api/ApolloSQLite/enums/SQLiteNormalizedCacheError.md deleted file mode 100644 index fc7113b51d..0000000000 --- a/docs/source/api/ApolloSQLite/enums/SQLiteNormalizedCacheError.md +++ /dev/null @@ -1,20 +0,0 @@ -**ENUM** - -# `SQLiteNormalizedCacheError` - -```swift -public enum SQLiteNormalizedCacheError: Error -``` - -## Cases -### `invalidRecordEncoding(record:)` - -```swift -case invalidRecordEncoding(record: String) -``` - -### `invalidRecordShape(object:)` - -```swift -case invalidRecordShape(object: Any) -``` diff --git a/docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md b/docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md deleted file mode 100644 index dc849b62cc..0000000000 --- a/docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md +++ /dev/null @@ -1,31 +0,0 @@ -**EXTENSION** - -# `SQLiteDatabase` -```swift -public extension SQLiteDatabase -``` - -## Properties -### `tableName` - -```swift -static var tableName: String -``` - -### `idColumnName` - -```swift -static var idColumnName: String -``` - -### `keyColumnName` - -```swift -static var keyColumnName: String -``` - -### `recordColumName` - -```swift -static var recordColumName: String -``` diff --git a/docs/source/api/ApolloSQLite/extensions/SQLiteNormalizedCache.md b/docs/source/api/ApolloSQLite/extensions/SQLiteNormalizedCache.md deleted file mode 100644 index 3f143bb0c5..0000000000 --- a/docs/source/api/ApolloSQLite/extensions/SQLiteNormalizedCache.md +++ /dev/null @@ -1,61 +0,0 @@ -**EXTENSION** - -# `SQLiteNormalizedCache` -```swift -extension SQLiteNormalizedCache: NormalizedCache -``` - -## Methods -### `loadRecords(forKeys:)` - -```swift -public func loadRecords(forKeys keys: Set) throws -> [CacheKey: Record] -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache keys to load data for | - -### `merge(records:)` - -```swift -public func merge(records: RecordSet) throws -> Set -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| records | The set of records to merge. | - -### `removeRecord(for:)` - -```swift -public func removeRecord(for key: CacheKey) throws -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | The cache key to remove the record for | - -### `removeRecords(matching:)` - -```swift -public func removeRecords(matching pattern: CacheKey) throws -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pattern | The pattern that will be applied to find matching keys. | - -### `clear()` - -```swift -public func clear() throws -``` diff --git a/docs/source/api/ApolloSQLite/protocols/SQLiteDatabase.md b/docs/source/api/ApolloSQLite/protocols/SQLiteDatabase.md deleted file mode 100644 index ae272cecb6..0000000000 --- a/docs/source/api/ApolloSQLite/protocols/SQLiteDatabase.md +++ /dev/null @@ -1,50 +0,0 @@ -**PROTOCOL** - -# `SQLiteDatabase` - -```swift -public protocol SQLiteDatabase -``` - -## Methods -### `init(fileURL:)` - -```swift -init(fileURL: URL) throws -``` - -### `createRecordsTableIfNeeded()` - -```swift -func createRecordsTableIfNeeded() throws -``` - -### `selectRawRows(forKeys:)` - -```swift -func selectRawRows(forKeys keys: Set) throws -> [DatabaseRow] -``` - -### `addOrUpdateRecordString(_:for:)` - -```swift -func addOrUpdateRecordString(_ recordString: String, for cacheKey: CacheKey) throws -``` - -### `deleteRecord(for:)` - -```swift -func deleteRecord(for cacheKey: CacheKey) throws -``` - -### `deleteRecords(matching:)` - -```swift -func deleteRecords(matching pattern: CacheKey) throws -``` - -### `clearDatabase(shouldVacuumOnClear:)` - -```swift -func clearDatabase(shouldVacuumOnClear: Bool) throws -``` diff --git a/docs/source/api/ApolloSQLite/structs/DatabaseRow.md b/docs/source/api/ApolloSQLite/structs/DatabaseRow.md deleted file mode 100644 index 10ca8a7015..0000000000 --- a/docs/source/api/ApolloSQLite/structs/DatabaseRow.md +++ /dev/null @@ -1,7 +0,0 @@ -**STRUCT** - -# `DatabaseRow` - -```swift -public struct DatabaseRow -``` diff --git a/docs/source/api/ApolloSQLite/toc.md b/docs/source/api/ApolloSQLite/toc.md deleted file mode 100644 index 8cb54bf69b..0000000000 --- a/docs/source/api/ApolloSQLite/toc.md +++ /dev/null @@ -1,25 +0,0 @@ -# Reference Documentation - -## Protocols - -- [SQLiteDatabase](protocols/SQLiteDatabase/) - -## Structs - -- [DatabaseRow](structs/DatabaseRow/) - -## Classes - -- [SQLiteDotSwiftDatabase](classes/SQLiteDotSwiftDatabase/) -- [SQLiteNormalizedCache](classes/SQLiteNormalizedCache/) - -## Enums - -- [SQLiteNormalizedCacheError](enums/SQLiteNormalizedCacheError/) - -## Extensions - -- [SQLiteDatabase](extensions/SQLiteDatabase/) -- [SQLiteNormalizedCache](extensions/SQLiteNormalizedCache/) - -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/api/ApolloUtils/classes/Atomic.md b/docs/source/api/ApolloUtils/classes/Atomic.md deleted file mode 100644 index 9c2fbe2080..0000000000 --- a/docs/source/api/ApolloUtils/classes/Atomic.md +++ /dev/null @@ -1,51 +0,0 @@ -**CLASS** - -# `Atomic` - -```swift -public class Atomic -``` - -Wrapper for a value protected by an NSLock - -## Properties -### `value` - -```swift -public var value: T -``` - -The current value. Read-only. To update the underlying value, use `mutate`. - -## Methods -### `init(_:)` - -```swift -public init(_ value: T) -``` - -Designated initializer - -- Parameter value: The value to begin with. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| value | The value to begin with. | - -### `mutate(block:)` - -```swift -public func mutate(block: (inout T) -> U) -> U -``` - -Mutates the underlying value within a lock. -- Parameter block: The block to execute to mutate the value. -- Returns: The value returned by the block. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| block | The block to execute to mutate the value. | \ No newline at end of file diff --git a/docs/source/api/ApolloUtils/classes/LinkedList.Iterator.md b/docs/source/api/ApolloUtils/classes/LinkedList.Iterator.md deleted file mode 100644 index f611f42a44..0000000000 --- a/docs/source/api/ApolloUtils/classes/LinkedList.Iterator.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `LinkedList.Iterator` - -```swift -public class Iterator: IteratorProtocol -``` - -## Methods -### `next()` - -```swift -public func next() -> Element? -``` diff --git a/docs/source/api/ApolloUtils/classes/LinkedList.Node.Iterator.md b/docs/source/api/ApolloUtils/classes/LinkedList.Node.Iterator.md deleted file mode 100644 index bde0589f82..0000000000 --- a/docs/source/api/ApolloUtils/classes/LinkedList.Node.Iterator.md +++ /dev/null @@ -1,14 +0,0 @@ -**CLASS** - -# `LinkedList.Node.Iterator` - -```swift -public class Iterator: IteratorProtocol -``` - -## Methods -### `next()` - -```swift -public func next() -> Element? -``` diff --git a/docs/source/api/ApolloUtils/classes/LinkedList.Node.md b/docs/source/api/ApolloUtils/classes/LinkedList.Node.md deleted file mode 100644 index e86abdb1df..0000000000 --- a/docs/source/api/ApolloUtils/classes/LinkedList.Node.md +++ /dev/null @@ -1,26 +0,0 @@ -**CLASS** - -# `LinkedList.Node` - -```swift -public class Node -``` - -## Properties -### `value` - -```swift -public let value: T -``` - -### `previous` - -```swift -public fileprivate(set) weak var previous: Node? -``` - -### `next` - -```swift -public fileprivate(set) var next: Node? -``` diff --git a/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md b/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md deleted file mode 100644 index 70bb4d58fa..0000000000 --- a/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md +++ /dev/null @@ -1,19 +0,0 @@ -**EXTENSION** - -# `ApolloCompatible` -```swift -extension ApolloCompatible -``` - -## Properties -### `apollo` - -```swift -public var apollo: ApolloExtension -``` - -### `apollo` - -```swift -public static var apollo: ApolloExtension.Type -``` diff --git a/docs/source/api/ApolloUtils/extensions/ApolloExtension.md b/docs/source/api/ApolloUtils/extensions/ApolloExtension.md deleted file mode 100644 index 230efa27a8..0000000000 --- a/docs/source/api/ApolloUtils/extensions/ApolloExtension.md +++ /dev/null @@ -1,41 +0,0 @@ -**EXTENSION** - -# `ApolloExtension` -```swift -public extension ApolloExtension where Base: Collection -``` - -## Properties -### `isNotEmpty` - -```swift -var isNotEmpty: Bool -``` - -Convenience helper to make `guard` statements more readable - -- returns: `true` if the collection has contents. - -### `isEmptyOrNil` - -```swift -var isEmptyOrNil: Bool -``` - -- returns: `true` if the collection is empty or nil - -### `isNotEmpty` - -```swift -var isNotEmpty: Bool -``` - -- returns: `true` if the collection is non-nil AND has contents. - -### `sha256Hash` - -```swift -public var sha256Hash: String -``` - -The SHA256 hash of the current string. diff --git a/docs/source/api/ApolloUtils/extensions/Atomic.md b/docs/source/api/ApolloUtils/extensions/Atomic.md deleted file mode 100644 index f10d7599e2..0000000000 --- a/docs/source/api/ApolloUtils/extensions/Atomic.md +++ /dev/null @@ -1,15 +0,0 @@ -**EXTENSION** - -# `Atomic` -```swift -public extension Atomic where T == Int -``` - -## Methods -### `increment()` - -```swift -func increment() -> T -``` - -Increments in a lock-compatible fashion diff --git a/docs/source/api/ApolloUtils/extensions/DefaultStringInterpolation.md b/docs/source/api/ApolloUtils/extensions/DefaultStringInterpolation.md deleted file mode 100644 index a1b0489c00..0000000000 --- a/docs/source/api/ApolloUtils/extensions/DefaultStringInterpolation.md +++ /dev/null @@ -1,44 +0,0 @@ -**EXTENSION** - -# `DefaultStringInterpolation` -```swift -public extension DefaultStringInterpolation -``` - -## Methods -### `appendInterpolation(indented:)` - -```swift -mutating func appendInterpolation(indented string: String) -``` - -A String interpolation function that respects nested indentation. - -Example: -```swift -class Root { -let children: [Root] = [] -func description: String { - var desc = "\(type(of: self)) {" - children.forEach { child in - desc += "\n \(indented: child.debugDescription)," - } - if !children.isEmpty { desc += "\n" } - desc += "\(indented: "}")" - return desc -} -// Given classes A - E as subclasses of Root - -let root = Root(children: [A(children: [B(), C(children: [D()])]), E()]) -print(root.description) -``` -This prints: -Root { - A { - B {} - C { - D {} - } - } - E {} -} diff --git a/docs/source/api/ApolloUtils/extensions/Dictionary.md b/docs/source/api/ApolloUtils/extensions/Dictionary.md deleted file mode 100644 index ada2f6cb56..0000000000 --- a/docs/source/api/ApolloUtils/extensions/Dictionary.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Dictionary` -```swift -extension Dictionary: DictionaryType -``` - -## Properties -### `underlying` - -```swift -public var underlying: [Key: Value] -``` diff --git a/docs/source/api/ApolloUtils/extensions/LinkedList.Node.md b/docs/source/api/ApolloUtils/extensions/LinkedList.Node.md deleted file mode 100644 index 554dd23b8e..0000000000 --- a/docs/source/api/ApolloUtils/extensions/LinkedList.Node.md +++ /dev/null @@ -1,45 +0,0 @@ -**EXTENSION** - -# `LinkedList.Node` -```swift -extension LinkedList.Node: Equatable where T: Equatable -``` - -## Properties -### `debugDescription` - -```swift -public var debugDescription: String -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: LinkedList.Node, rhs: LinkedList.Node) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `makeIterator()` - -```swift -public func makeIterator() -> Iterator -``` diff --git a/docs/source/api/ApolloUtils/extensions/LinkedList.md b/docs/source/api/ApolloUtils/extensions/LinkedList.md deleted file mode 100644 index 773228fcbe..0000000000 --- a/docs/source/api/ApolloUtils/extensions/LinkedList.md +++ /dev/null @@ -1,87 +0,0 @@ -**EXTENSION** - -# `LinkedList` -```swift -extension LinkedList: Equatable where T: Equatable -``` - -## Properties -### `startIndex` - -```swift -public var startIndex: Int -``` - -### `endIndex` - -```swift -public var endIndex: Int -``` - -### `count` - -```swift -public var count: Int -``` - -### `isEmpty` - -```swift -public var isEmpty: Bool -``` - -### `debugDescription` - -```swift -public var debugDescription: String -``` - -## Methods -### `==(_:_:)` - -```swift -public static func == (lhs: LinkedList, rhs: LinkedList) -> Bool -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| lhs | A value to compare. | -| rhs | Another value to compare. | - -### `hash(into:)` - -```swift -public func hash(into hasher: inout Hasher) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| hasher | The hasher to use when combining the components of this instance. | - -### `node(at:)` - -```swift -public func node(at position: Int) -> Node -``` - -### `index(after:)` - -```swift -public func index(after i: Int) -> Int -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| i | A valid index of the collection. `i` must be less than `endIndex`. | - -### `makeIterator()` - -```swift -public func makeIterator() -> Iterator -``` diff --git a/docs/source/api/ApolloUtils/extensions/Optional.md b/docs/source/api/ApolloUtils/extensions/Optional.md deleted file mode 100644 index 01925a8373..0000000000 --- a/docs/source/api/ApolloUtils/extensions/Optional.md +++ /dev/null @@ -1,15 +0,0 @@ -**EXTENSION** - -# `Optional` -```swift -extension Optional: OptionalType -``` - -## Properties -### `underlying` - -```swift -public var underlying: Wrapped? -``` - -Return the value if it exists, otherwise `nil` diff --git a/docs/source/api/ApolloUtils/extensions/Result.md b/docs/source/api/ApolloUtils/extensions/Result.md deleted file mode 100644 index b99358f0e6..0000000000 --- a/docs/source/api/ApolloUtils/extensions/Result.md +++ /dev/null @@ -1,13 +0,0 @@ -**EXTENSION** - -# `Result` -```swift -extension Result: ResultType -``` - -## Properties -### `underlying` - -```swift -public var underlying: Result -``` diff --git a/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md b/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md deleted file mode 100644 index 6aa9715956..0000000000 --- a/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md +++ /dev/null @@ -1,29 +0,0 @@ -**PROTOCOL** - -# `ApolloCompatible` - -```swift -public protocol ApolloCompatible -``` - -Protocol to allow calls to extended methods and vars as object.apollo.method - -NOTE: This does not work with a bunch of stuff involving generic types - those -still need to use old-school `apollo_method` naming conventions. - -## Properties -### `apollo` - -```swift -var apollo: ApolloExtension -``` - -The `ApolloExtension` object for an instance - -### `apollo` - -```swift -static var apollo: ApolloExtension.Type -``` - -The `ApolloExtension` object for a type diff --git a/docs/source/api/ApolloUtils/protocols/DictionaryType.md b/docs/source/api/ApolloUtils/protocols/DictionaryType.md deleted file mode 100644 index 4eb91cc4ba..0000000000 --- a/docs/source/api/ApolloUtils/protocols/DictionaryType.md +++ /dev/null @@ -1,16 +0,0 @@ -**PROTOCOL** - -# `DictionaryType` - -```swift -public protocol DictionaryType: ExpressibleByDictionaryLiteral -``` - -Provides a PAT interface to `Dictionary` - -## Properties -### `underlying` - -```swift -var underlying: [KeyType: ValueType] -``` diff --git a/docs/source/api/ApolloUtils/protocols/OptionalType.md b/docs/source/api/ApolloUtils/protocols/OptionalType.md deleted file mode 100644 index ccfddfa2f3..0000000000 --- a/docs/source/api/ApolloUtils/protocols/OptionalType.md +++ /dev/null @@ -1,16 +0,0 @@ -**PROTOCOL** - -# `OptionalType` - -```swift -public protocol OptionalType: ExpressibleByNilLiteral -``` - -Provides a PAT interface to `Optional` - -## Properties -### `underlying` - -```swift -var underlying: WrappedType? -``` diff --git a/docs/source/api/ApolloUtils/protocols/ResultType.md b/docs/source/api/ApolloUtils/protocols/ResultType.md deleted file mode 100644 index fc67e699ee..0000000000 --- a/docs/source/api/ApolloUtils/protocols/ResultType.md +++ /dev/null @@ -1,16 +0,0 @@ -**PROTOCOL** - -# `ResultType` - -```swift -public protocol ResultType -``` - -Provides a PAT interface to `Result` - -## Properties -### `underlying` - -```swift -var underlying: Result -``` diff --git a/docs/source/api/ApolloUtils/structs/ApolloExtension.md b/docs/source/api/ApolloUtils/structs/ApolloExtension.md deleted file mode 100644 index a06b88b0b2..0000000000 --- a/docs/source/api/ApolloUtils/structs/ApolloExtension.md +++ /dev/null @@ -1,18 +0,0 @@ -**STRUCT** - -# `ApolloExtension` - -```swift -public struct ApolloExtension -``` - -Wrapper to allow calls to extended methods and vars as object.apollo.method - -## Properties -### `base` - -```swift -public let base: Base -``` - -The base type in the extension diff --git a/docs/source/api/ApolloUtils/structs/IsEverTrue.md b/docs/source/api/ApolloUtils/structs/IsEverTrue.md deleted file mode 100644 index 4e53a573b9..0000000000 --- a/docs/source/api/ApolloUtils/structs/IsEverTrue.md +++ /dev/null @@ -1,24 +0,0 @@ -**STRUCT** - -# `IsEverTrue` - -```swift -public struct IsEverTrue -``` - -A property wrapper that indicates if a `Bool` value was ever set to `true`. -Defaults to `false`, if ever set to `true`, it will always be `true`. - -## Properties -### `wrappedValue` - -```swift -public var wrappedValue: Bool -``` - -## Methods -### `init()` - -```swift -public init() -``` diff --git a/docs/source/api/ApolloUtils/structs/LinkedList.md b/docs/source/api/ApolloUtils/structs/LinkedList.md deleted file mode 100644 index a2b5b9acd7..0000000000 --- a/docs/source/api/ApolloUtils/structs/LinkedList.md +++ /dev/null @@ -1,106 +0,0 @@ -**STRUCT** - -# `LinkedList` - -```swift -public struct LinkedList: ExpressibleByArrayLiteral -``` - -A doubly linked list implementation. - -This implementation utilizes copy on write semantics and is optimized for forward and backwards -traversal and appending items (which requires accessing last). - -It is not optimized for prepending or insertion of items. - -## Properties -### `head` - -```swift -public var head: Node -``` - -The head (first) node in the list - -### `last` - -```swift -public var last: Node -``` - -The last node in the list - -## Methods -### `init(_:)` - -```swift -public init(_ headValue: T) -``` - -### `init(array:)` - -```swift -public init(array: [T]) -``` - -### `init(arrayLiteral:)` - -```swift -public init(arrayLiteral segments: T...) -``` - -### `append(_:)` - -```swift -public mutating func append(_ value: T) -``` - -### `append(_:)` - -```swift -public mutating func append(_ sequence: S) where S.Element == T -``` - -### `appending(_:)` - -```swift -public func appending(_ value: T) -> LinkedList -``` - -### `appending(_:)` - -```swift -public func appending( - _ sequence: S -) -> LinkedList where S.Element == T -``` - -### `mutateLast(_:)` - -```swift -public mutating func mutateLast(_ mutate: (T) -> T) -``` - -### `mutatingLast(_:)` - -```swift -public func mutatingLast(_ mutate: (T) -> T) -> LinkedList -``` - -### `+(_:_:)` - -```swift -public static func +( - lhs: LinkedList, - rhs: S -) -> LinkedList where S.Element == T -``` - -### `+=(_:_:)` - -```swift -public static func +=( - lhs: inout LinkedList, - rhs: S -) where S.Element == T -``` diff --git a/docs/source/api/ApolloUtils/toc.md b/docs/source/api/ApolloUtils/toc.md deleted file mode 100644 index ddf4ac5419..0000000000 --- a/docs/source/api/ApolloUtils/toc.md +++ /dev/null @@ -1,40 +0,0 @@ -# Reference Documentation - -## Protocols - -- [ApolloCompatible](protocols/ApolloCompatible/) -- [DictionaryType](protocols/DictionaryType/) -- [OptionalType](protocols/OptionalType/) -- [ResultType](protocols/ResultType/) - -## Structs - -- [ApolloExtension](structs/ApolloExtension/) -- [IsEverTrue](structs/IsEverTrue/) -- [LinkedList](structs/LinkedList/) - -## Classes - -- [Atomic](classes/Atomic/) -- [LinkedList.Iterator](classes/LinkedList.Iterator/) -- [LinkedList.Node](classes/LinkedList.Node/) -- [LinkedList.Node.Iterator](classes/LinkedList.Node.Iterator/) - -## Extensions - -- [ApolloCompatible](extensions/ApolloCompatible/) -- [ApolloExtension](extensions/ApolloExtension/) -- [Atomic](extensions/Atomic/) -- [DefaultStringInterpolation](extensions/DefaultStringInterpolation/) -- [Dictionary](extensions/Dictionary/) -- [LinkedList](extensions/LinkedList/) -- [LinkedList.Node](extensions/LinkedList.Node/) -- [Optional](extensions/Optional/) -- [Result](extensions/Result/) - -## Typealiases - -- [LinkedList.Element](typealiases/LinkedList.Element/) -- [LinkedList.Node.Element](typealiases/LinkedList.Node.Element/) - -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/api/ApolloUtils/typealiases/LinkedList.Element.md b/docs/source/api/ApolloUtils/typealiases/LinkedList.Element.md deleted file mode 100644 index b486905a1e..0000000000 --- a/docs/source/api/ApolloUtils/typealiases/LinkedList.Element.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `LinkedList.Element` - -```swift -public typealias Element = T -``` diff --git a/docs/source/api/ApolloUtils/typealiases/LinkedList.Node.Element.md b/docs/source/api/ApolloUtils/typealiases/LinkedList.Node.Element.md deleted file mode 100644 index 2af17208d2..0000000000 --- a/docs/source/api/ApolloUtils/typealiases/LinkedList.Node.Element.md +++ /dev/null @@ -1,7 +0,0 @@ -**TYPEALIAS** - -# `LinkedList.Node.Element` - -```swift -public typealias Element = T -``` diff --git a/docs/source/api/ApolloWebSocket/classes/SSLCert.md b/docs/source/api/ApolloWebSocket/classes/SSLCert.md deleted file mode 100644 index e312715737..0000000000 --- a/docs/source/api/ApolloWebSocket/classes/SSLCert.md +++ /dev/null @@ -1,44 +0,0 @@ -**CLASS** - -# `SSLCert` - -```swift -open class SSLCert -``` - -## Methods -### `init(data:)` - -```swift -public init(data: Data) -``` - -Designated init for certificates - -- parameter data: is the binary data of the certificate - -- returns: a representation security object to be used with - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| data | is the binary data of the certificate | - -### `init(key:)` - -```swift -public init(key: SecKey) -``` - -Designated init for public keys - -- parameter key: is the public key to be used - -- returns: a representation security object to be used with - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| key | is the public key to be used | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/classes/SSLClientCertificate.md b/docs/source/api/ApolloWebSocket/classes/SSLClientCertificate.md deleted file mode 100644 index 7b3c6612d6..0000000000 --- a/docs/source/api/ApolloWebSocket/classes/SSLClientCertificate.md +++ /dev/null @@ -1,78 +0,0 @@ -**CLASS** - -# `SSLClientCertificate` - -```swift -public class SSLClientCertificate -``` - -## Methods -### `init(pkcs12Path:password:)` - -```swift -public convenience init(pkcs12Path: String, password: String) throws -``` - -Convenience init. -- parameter pkcs12Path: Path to pkcs12 file containing private key and X.509 ceritifacte (.p12) -- parameter password: file password, see **kSecImportExportPassphrase** - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pkcs12Path | Path to pkcs12 file containing private key and X.509 ceritifacte (.p12) | -| password | file password, see | - -### `init(identity:identityCertificate:)` - -```swift -public init(identity: SecIdentity, identityCertificate: SecCertificate) -``` - -Designated init. For more information, see SSLSetCertificate() in Security/SecureTransport.h. -- parameter identity: SecIdentityRef, see **kCFStreamSSLCertificates** -- parameter identityCertificate: CFArray of SecCertificateRefs, see **kCFStreamSSLCertificates** - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| identity | SecIdentityRef, see | -| identityCertificate | CFArray of SecCertificateRefs, see | - -### `init(pkcs12Url:password:)` - -```swift -public convenience init(pkcs12Url: URL, password: String) throws -``` - -Convenience init. -- parameter pkcs12Url: URL to pkcs12 file containing private key and X.509 ceritifacte (.p12) -- parameter password: file password, see **kSecImportExportPassphrase** - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pkcs12Url | URL to pkcs12 file containing private key and X.509 ceritifacte (.p12) | -| password | file password, see | - -### `init(pkcs12Url:importOptions:)` - -```swift -public init(pkcs12Url: URL, importOptions: CFDictionary) throws -``` - -Designated init. -- parameter pkcs12Url: URL to pkcs12 file containing private key and X.509 ceritifacte (.p12) -- parameter importOptions: A dictionary containing import options. A -kSecImportExportPassphrase entry is required at minimum. Only password-based -PKCS12 blobs are currently supported. See **SecImportExport.h** - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| pkcs12Url | URL to pkcs12 file containing private key and X.509 ceritifacte (.p12) | -| importOptions | A dictionary containing import options. A kSecImportExportPassphrase entry is required at minimum. Only password-based PKCS12 blobs are currently supported. See | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/classes/SSLSecurity.md b/docs/source/api/ApolloWebSocket/classes/SSLSecurity.md deleted file mode 100644 index 13b321072b..0000000000 --- a/docs/source/api/ApolloWebSocket/classes/SSLSecurity.md +++ /dev/null @@ -1,151 +0,0 @@ -**CLASS** - -# `SSLSecurity` - -```swift -open class SSLSecurity : SSLTrustValidator -``` - -## Properties -### `validatedDN` - -```swift -public var validatedDN = true -``` - -### `validateEntireChain` - -```swift -public var validateEntireChain = true -``` - -## Methods -### `init(usePublicKeys:)` - -```swift -public convenience init(usePublicKeys: Bool = false) -``` - -Use certs from main app bundle - -- parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation - -- returns: a representation security object to be used with - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| usePublicKeys | is to specific if the publicKeys or certificates should be used for SSL pinning validation | - -### `init(certs:usePublicKeys:)` - -```swift -public init(certs: [SSLCert], usePublicKeys: Bool) -``` - -Designated init - -- parameter certs: is the certificates or public keys to use -- parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation - -- returns: a representation security object to be used with - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| certs | is the certificates or public keys to use | -| usePublicKeys | is to specific if the publicKeys or certificates should be used for SSL pinning validation | - -### `isValid(_:domain:)` - -```swift -open func isValid(_ trust: SecTrust, domain: String?) -> Bool -``` - -Valid the trust and domain name. - -- parameter trust: is the serverTrust to validate -- parameter domain: is the CN domain to validate - -- returns: if the key was successfully validated - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| trust | is the serverTrust to validate | -| domain | is the CN domain to validate | - -### `extractPublicKey(_:)` - -```swift -public func extractPublicKey(_ data: Data) -> SecKey? -``` - -Get the public key from a certificate data - -- parameter data: is the certificate to pull the public key from - -- returns: a public key - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| data | is the certificate to pull the public key from | - -### `extractPublicKey(_:policy:)` - -```swift -public func extractPublicKey(_ cert: SecCertificate, policy: SecPolicy) -> SecKey? -``` - -Get the public key from a certificate - -- parameter data: is the certificate to pull the public key from - -- returns: a public key - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| data | is the certificate to pull the public key from | - -### `certificateChain(_:)` - -```swift -public func certificateChain(_ trust: SecTrust) -> [Data] -``` - -Get the certificate chain for the trust - -- parameter trust: is the trust to lookup the certificate chain for - -- returns: the certificate chain for the trust - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| trust | is the trust to lookup the certificate chain for | - -### `publicKeyChain(_:)` - -```swift -public func publicKeyChain(_ trust: SecTrust) -> [SecKey] -``` - -Get the public key chain for the trust - -- parameter trust: is the trust to lookup the certificate chain and extract the public keys - -- returns: the public keys from the certifcate chain for the trust - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| trust | is the trust to lookup the certificate chain and extract the public keys | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/classes/SplitNetworkTransport.md b/docs/source/api/ApolloWebSocket/classes/SplitNetworkTransport.md deleted file mode 100644 index ac996e40a1..0000000000 --- a/docs/source/api/ApolloWebSocket/classes/SplitNetworkTransport.md +++ /dev/null @@ -1,42 +0,0 @@ -**CLASS** - -# `SplitNetworkTransport` - -```swift -public class SplitNetworkTransport -``` - -A network transport that sends subscriptions using one `NetworkTransport` and other requests using another `NetworkTransport`. Ideal for sending subscriptions via a web socket but everything else via HTTP. - -## Properties -### `clientName` - -```swift -public var clientName: String -``` - -### `clientVersion` - -```swift -public var clientVersion: String -``` - -## Methods -### `init(uploadingNetworkTransport:webSocketNetworkTransport:)` - -```swift -public init(uploadingNetworkTransport: UploadingNetworkTransport, webSocketNetworkTransport: NetworkTransport) -``` - -Designated initializer - -- Parameters: - - uploadingNetworkTransport: An `UploadingNetworkTransport` to use for non-subscription requests. Should generally be a `RequestChainNetworkTransport` or something similar. - - webSocketNetworkTransport: A `NetworkTransport` to use for subscription requests. Should generally be a `WebSocketTransport` or something similar. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| uploadingNetworkTransport | An `UploadingNetworkTransport` to use for non-subscription requests. Should generally be a `RequestChainNetworkTransport` or something similar. | -| webSocketNetworkTransport | A `NetworkTransport` to use for subscription requests. Should generally be a `WebSocketTransport` or something similar. | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/classes/WebSocket.md b/docs/source/api/ApolloWebSocket/classes/WebSocket.md deleted file mode 100644 index c828815000..0000000000 --- a/docs/source/api/ApolloWebSocket/classes/WebSocket.md +++ /dev/null @@ -1,238 +0,0 @@ -**CLASS** - -# `WebSocket` - -```swift -public final class WebSocket: NSObject, WebSocketClient, StreamDelegate, WebSocketStreamDelegate -``` - -## Properties -### `delegate` - -```swift -public weak var delegate: WebSocketClientDelegate? -``` - -Responds to callback about new messages coming in over the WebSocket -and also connection/disconnect messages. - -### `callbackQueue` - -```swift -public var callbackQueue = DispatchQueue.main -``` - -### `onConnect` - -```swift -public var onConnect: (() -> Void)? -``` - -### `onDisconnect` - -```swift -public var onDisconnect: ((Error?) -> Void)? -``` - -### `onText` - -```swift -public var onText: ((String) -> Void)? -``` - -### `onData` - -```swift -public var onData: ((Data) -> Void)? -``` - -### `onPong` - -```swift -public var onPong: ((Data?) -> Void)? -``` - -### `onHttpResponseHeaders` - -```swift -public var onHttpResponseHeaders: (([String: String]) -> Void)? -``` - -### `disableSSLCertValidation` - -```swift -public var disableSSLCertValidation = false -``` - -### `overrideTrustHostname` - -```swift -public var overrideTrustHostname = false -``` - -### `desiredTrustHostname` - -```swift -public var desiredTrustHostname: String? = nil -``` - -### `sslClientCertificate` - -```swift -public var sslClientCertificate: SSLClientCertificate? = nil -``` - -### `enableCompression` - -```swift -public var enableCompression = true -``` - -### `security` - -```swift -public var security: SSLTrustValidator? -``` - -### `enabledSSLCipherSuites` - -```swift -public var enabledSSLCipherSuites: [SSLCipherSuite]? -``` - -### `isConnected` - -```swift -public var isConnected: Bool -``` - -### `request` - -```swift -public var request: URLRequest -``` - -### `currentURL` - -```swift -public var currentURL: URL -``` - -### `respondToPingWithPong` - -```swift -public var respondToPingWithPong: Bool = true -``` - -## Methods -### `init(request:protocol:)` - -```swift -public init(request: URLRequest, protocol: WSProtocol) -``` - -Designated initializer. - -- Parameters: - - request: A URL request object that provides request-specific information such as the URL. - - protocol: Protocol to use for communication over the web socket. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| request | A URL request object that provides request-specific information such as the URL. | -| protocol | Protocol to use for communication over the web socket. | - -### `init(url:protocol:)` - -```swift -public convenience init(url: URL, protocol: WSProtocol) -``` - -Convenience initializer to specify the URL and web socket protocol. - -- Parameters: - - url: The destination URL to connect to. - - protocol: Protocol to use for communication over the web socket. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| url | The destination URL to connect to. | -| protocol | Protocol to use for communication over the web socket. | - -### `init(url:writeQueueQOS:protocol:)` - -```swift -public convenience init( - url: URL, - writeQueueQOS: QualityOfService, - protocol: WSProtocol -) -``` - -Convenience initializer to specify the URL and web socket protocol with a specific quality of -service on the write queue. - -- Parameters: - - url: The destination URL to connect to. - - writeQueueQOS: Specifies the quality of service for the write queue. - - protocol: Protocol to use for communication over the web socket. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| url | The destination URL to connect to. | -| writeQueueQOS | Specifies the quality of service for the write queue. | -| protocol | Protocol to use for communication over the web socket. | - -### `connect()` - -```swift -public func connect() -``` - -Connect to the WebSocket server on a background thread. - -### `disconnect()` - -```swift -public func disconnect() -``` - -### `write(string:)` - -```swift -public func write(string: String) -``` - -### `write(ping:completion:)` - -```swift -public func write(ping: Data, completion: (() -> ())? = nil) -``` - -Write a ping to the websocket. This sends it as a control frame. - -### `newBytesInStream()` - -```swift -public func newBytesInStream() -``` - -Delegate for the stream methods. Processes incoming bytes - -### `streamDidError(error:)` - -```swift -public func streamDidError(error: Error?) -``` - -### `deinit` - -```swift -deinit -``` diff --git a/docs/source/api/ApolloWebSocket/classes/WebSocketTransport.md b/docs/source/api/ApolloWebSocket/classes/WebSocketTransport.md deleted file mode 100644 index f7c6087c27..0000000000 --- a/docs/source/api/ApolloWebSocket/classes/WebSocketTransport.md +++ /dev/null @@ -1,134 +0,0 @@ -**CLASS** - -# `WebSocketTransport` - -```swift -public class WebSocketTransport -``` - -A network transport that uses web sockets requests to send GraphQL subscription operations to a server. - -## Properties -### `delegate` - -```swift -public weak var delegate: WebSocketTransportDelegate? -``` - -### `clientName` - -```swift -public var clientName: String -``` - -- NOTE: Setting this won't override immediately if the socket is still connected, only on reconnection. - -### `clientVersion` - -```swift -public var clientVersion: String -``` - -- NOTE: Setting this won't override immediately if the socket is still connected, only on reconnection. - -## Methods -### `init(websocket:store:config:)` - -```swift -public init( - websocket: WebSocketClient, - store: ApolloStore? = nil, - config: Configuration = Configuration() -) -``` - -Designated initializer - -- Parameters: - - websocket: The websocket client to use for creating a websocket connection. - - store: [optional] The `ApolloStore` used as a local cache. - - config: A `WebSocketTransport.Configuration` object with options for configuring the - web socket connection. Defaults to a configuration with default values. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| websocket | The websocket client to use for creating a websocket connection. | -| store | [optional] The `ApolloStore` used as a local cache. | -| config | A `WebSocketTransport.Configuration` object with options for configuring the web socket connection. Defaults to a configuration with default values. | - -### `isConnected()` - -```swift -public func isConnected() -> Bool -``` - -### `ping(data:completionHandler:)` - -```swift -public func ping(data: Data, completionHandler: (() -> Void)? = nil) -``` - -### `initServer()` - -```swift -public func initServer() -``` - -### `closeConnection()` - -```swift -public func closeConnection() -``` - -### `deinit` - -```swift -deinit -``` - -### `unsubscribe(_:)` - -```swift -public func unsubscribe(_ subscriptionId: String) -``` - -### `updateHeaderValues(_:reconnectIfConnected:)` - -```swift -public func updateHeaderValues(_ values: [String: String?], reconnectIfConnected: Bool = true) -``` - -### `updateConnectingPayload(_:reconnectIfConnected:)` - -```swift -public func updateConnectingPayload(_ payload: JSONEncodableDictionary, reconnectIfConnected: Bool = true) -``` - -### `pauseWebSocketConnection()` - -```swift -public func pauseWebSocketConnection() -``` - -Disconnects the websocket while setting the auto-reconnect value to false, -allowing purposeful disconnects that do not dump existing subscriptions. -NOTE: You will receive an error on the subscription (should be a `WebSocket.WSError` with code 1000) when the socket disconnects. -ALSO NOTE: To reconnect after calling this, you will need to call `resumeWebSocketConnection`. - -### `resumeWebSocketConnection(autoReconnect:)` - -```swift -public func resumeWebSocketConnection(autoReconnect: Bool = true) -``` - -Reconnects a paused web socket. - -- Parameter autoReconnect: `true` if you want the websocket to automatically reconnect if the connection drops. Defaults to true. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| autoReconnect | `true` if you want the websocket to automatically reconnect if the connection drops. Defaults to true. | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/enums/WSError.ErrorType.md b/docs/source/api/ApolloWebSocket/enums/WSError.ErrorType.md deleted file mode 100644 index efad57c85c..0000000000 --- a/docs/source/api/ApolloWebSocket/enums/WSError.ErrorType.md +++ /dev/null @@ -1,44 +0,0 @@ -**ENUM** - -# `WSError.ErrorType` - -```swift -public enum ErrorType -``` - -## Cases -### `outputStreamWriteError` - -```swift -case outputStreamWriteError -``` - -### `invalidSSLError` - -```swift -case invalidSSLError -``` - -### `writeTimeoutError` - -```swift -case writeTimeoutError -``` - -### `protocolError` - -```swift -case protocolError -``` - -### `upgradeError` - -```swift -case upgradeError -``` - -### `closeError` - -```swift -case closeError -``` diff --git a/docs/source/api/ApolloWebSocket/enums/WebSocket.OpCode.md b/docs/source/api/ApolloWebSocket/enums/WebSocket.OpCode.md deleted file mode 100644 index 106d018cc8..0000000000 --- a/docs/source/api/ApolloWebSocket/enums/WebSocket.OpCode.md +++ /dev/null @@ -1,44 +0,0 @@ -**ENUM** - -# `WebSocket.OpCode` - -```swift -public enum OpCode : UInt8 -``` - -## Cases -### `continueFrame` - -```swift -case continueFrame = 0x0 -``` - -### `textFrame` - -```swift -case textFrame = 0x1 -``` - -### `binaryFrame` - -```swift -case binaryFrame = 0x2 -``` - -### `connectionClose` - -```swift -case connectionClose = 0x8 -``` - -### `ping` - -```swift -case ping = 0x9 -``` - -### `pong` - -```swift -case pong = 0xA -``` diff --git a/docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md b/docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md deleted file mode 100644 index b609043b0c..0000000000 --- a/docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md +++ /dev/null @@ -1,35 +0,0 @@ -**ENUM** - -# `WebSocket.WSProtocol` - -```swift -public enum WSProtocol: CustomStringConvertible -``` - -The GraphQL over WebSocket protocols supported by apollo-ios. - -## Cases -### `graphql_ws` - -```swift -case graphql_ws -``` - -WebSocket protocol `graphql-ws`. This is implemented by the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) -and AWS AppSync libraries. - -### `graphql_transport_ws` - -```swift -case graphql_transport_ws -``` - -WebSocket protocol `graphql-transport-ws`. This is implemented by the [graphql-ws](https://github.com/enisdenjo/graphql-ws) -library. - -## Properties -### `description` - -```swift -public var description: String -``` diff --git a/docs/source/api/ApolloWebSocket/enums/WebSocketError.ErrorKind.md b/docs/source/api/ApolloWebSocket/enums/WebSocketError.ErrorKind.md deleted file mode 100644 index 94c00248db..0000000000 --- a/docs/source/api/ApolloWebSocket/enums/WebSocketError.ErrorKind.md +++ /dev/null @@ -1,44 +0,0 @@ -**ENUM** - -# `WebSocketError.ErrorKind` - -```swift -public enum ErrorKind -``` - -## Cases -### `errorResponse` - -```swift -case errorResponse -``` - -### `networkError` - -```swift -case networkError -``` - -### `unprocessedMessage(_:)` - -```swift -case unprocessedMessage(String) -``` - -### `serializedMessageError` - -```swift -case serializedMessageError -``` - -### `neitherErrorNorPayloadReceived` - -```swift -case neitherErrorNorPayloadReceived -``` - -### `upgradeError(code:)` - -```swift -case upgradeError(code: Int) -``` diff --git a/docs/source/api/ApolloWebSocket/extensions/SplitNetworkTransport.md b/docs/source/api/ApolloWebSocket/extensions/SplitNetworkTransport.md deleted file mode 100644 index 58c960ddad..0000000000 --- a/docs/source/api/ApolloWebSocket/extensions/SplitNetworkTransport.md +++ /dev/null @@ -1,46 +0,0 @@ -**EXTENSION** - -# `SplitNetworkTransport` -```swift -extension SplitNetworkTransport: NetworkTransport -``` - -## Methods -### `send(operation:cachePolicy:contextIdentifier:callbackQueue:completionHandler:)` - -```swift -public func send(operation: Operation, - cachePolicy: CachePolicy, - contextIdentifier: UUID? = nil, - callbackQueue: DispatchQueue = .main, - completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send. | -| cachePolicy | The `CachePolicy` to use making this request. | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | A closure to call when a request completes. On `success` will contain the response received from the server. On `failure` will contain the error which occurred. | - -### `upload(operation:files:callbackQueue:completionHandler:)` - -```swift -public func upload( - operation: Operation, - files: [GraphQLFile], - callbackQueue: DispatchQueue = .main, - completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send | -| files | An array of `GraphQLFile` objects to send. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | The completion handler to execute when the request completes or errors | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/extensions/WebSocketTransport.md b/docs/source/api/ApolloWebSocket/extensions/WebSocketTransport.md deleted file mode 100644 index 0c768c8f2b..0000000000 --- a/docs/source/api/ApolloWebSocket/extensions/WebSocketTransport.md +++ /dev/null @@ -1,85 +0,0 @@ -**EXTENSION** - -# `WebSocketTransport` -```swift -extension WebSocketTransport: NetworkTransport -``` - -## Methods -### `send(operation:cachePolicy:contextIdentifier:callbackQueue:completionHandler:)` - -```swift -public func send( - operation: Operation, - cachePolicy: CachePolicy, - contextIdentifier: UUID? = nil, - callbackQueue: DispatchQueue = .main, - completionHandler: @escaping (Result, Error>) -> Void) -> Cancellable -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| operation | The operation to send. | -| cachePolicy | The `CachePolicy` to use making this request. | -| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to `nil`. | -| callbackQueue | The queue to call back on with the results. Should default to `.main`. | -| completionHandler | A closure to call when a request completes. On `success` will contain the response received from the server. On `failure` will contain the error which occurred. | - -### `websocketDidConnect(socket:)` - -```swift -public func websocketDidConnect(socket: WebSocketClient) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | - -### `handleConnection()` - -```swift -public func handleConnection() -``` - -### `websocketDidDisconnect(socket:error:)` - -```swift -public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | -| error | An optional error if an error occured. | - -### `websocketDidReceiveMessage(socket:text:)` - -```swift -public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | -| text | The text received from the server. | - -### `websocketDidReceiveData(socket:data:)` - -```swift -public func websocketDidReceiveData(socket: WebSocketClient, data: Data) -``` - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | -| data | The data received from the server. | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/extensions/WebSocketTransportDelegate.md b/docs/source/api/ApolloWebSocket/extensions/WebSocketTransportDelegate.md deleted file mode 100644 index e299ce858e..0000000000 --- a/docs/source/api/ApolloWebSocket/extensions/WebSocketTransportDelegate.md +++ /dev/null @@ -1,37 +0,0 @@ -**EXTENSION** - -# `WebSocketTransportDelegate` -```swift -public extension WebSocketTransportDelegate -``` - -## Methods -### `webSocketTransportDidConnect(_:)` - -```swift -func webSocketTransportDidConnect(_ webSocketTransport: WebSocketTransport) -``` - -### `webSocketTransportDidReconnect(_:)` - -```swift -func webSocketTransportDidReconnect(_ webSocketTransport: WebSocketTransport) -``` - -### `webSocketTransport(_:didDisconnectWithError:)` - -```swift -func webSocketTransport(_ webSocketTransport: WebSocketTransport, didDisconnectWithError error:Error?) -``` - -### `webSocketTransport(_:didReceivePingData:)` - -```swift -func webSocketTransport(_ webSocketTransport: WebSocketTransport, didReceivePingData: Data?) -``` - -### `webSocketTransport(_:didReceivePongData:)` - -```swift -func webSocketTransport(_ webSocketTransport: WebSocketTransport, didReceivePongData: Data?) -``` diff --git a/docs/source/api/ApolloWebSocket/protocols/OperationMessageIdCreator.md b/docs/source/api/ApolloWebSocket/protocols/OperationMessageIdCreator.md deleted file mode 100644 index 25f07411f1..0000000000 --- a/docs/source/api/ApolloWebSocket/protocols/OperationMessageIdCreator.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `OperationMessageIdCreator` - -```swift -public protocol OperationMessageIdCreator -``` - -## Methods -### `requestId()` - -```swift -func requestId() -> String -``` diff --git a/docs/source/api/ApolloWebSocket/protocols/SSLTrustValidator.md b/docs/source/api/ApolloWebSocket/protocols/SSLTrustValidator.md deleted file mode 100644 index 8c7a950b25..0000000000 --- a/docs/source/api/ApolloWebSocket/protocols/SSLTrustValidator.md +++ /dev/null @@ -1,14 +0,0 @@ -**PROTOCOL** - -# `SSLTrustValidator` - -```swift -public protocol SSLTrustValidator -``` - -## Methods -### `isValid(_:domain:)` - -```swift -func isValid(_ trust: SecTrust, domain: String?) -> Bool -``` diff --git a/docs/source/api/ApolloWebSocket/protocols/WebSocketClient.md b/docs/source/api/ApolloWebSocket/protocols/WebSocketClient.md deleted file mode 100644 index dfc07da408..0000000000 --- a/docs/source/api/ApolloWebSocket/protocols/WebSocketClient.md +++ /dev/null @@ -1,72 +0,0 @@ -**PROTOCOL** - -# `WebSocketClient` - -```swift -public protocol WebSocketClient: AnyObject -``` - -Protocol allowing alternative implementations of websockets beyond `ApolloWebSocket`. - -## Properties -### `request` - -```swift -var request: URLRequest -``` - -The URLRequest used on connection. - -### `delegate` - -```swift -var delegate: WebSocketClientDelegate? -``` - -The delegate that will receive networking event updates for this websocket client. - -- Note: The `WebSocketTransport` will set itself as the delgate for the client. Consumers -should set themselves as the delegate for the `WebSocketTransport` to observe events. - -### `callbackQueue` - -```swift -var callbackQueue: DispatchQueue -``` - -`DispatchQueue` where the websocket client should call all delegate callbacks. - -## Methods -### `connect()` - -```swift -func connect() -``` - -Connects to the websocket server. - -- Note: This should be implemented to connect the websocket on a background thread. - -### `disconnect()` - -```swift -func disconnect() -``` - -Disconnects from the websocket server. - -### `write(ping:completion:)` - -```swift -func write(ping: Data, completion: (() -> Void)?) -``` - -Writes ping data to the websocket. - -### `write(string:)` - -```swift -func write(string: String) -``` - -Writes a string to the websocket. diff --git a/docs/source/api/ApolloWebSocket/protocols/WebSocketClientDelegate.md b/docs/source/api/ApolloWebSocket/protocols/WebSocketClientDelegate.md deleted file mode 100644 index 8a3727ef3f..0000000000 --- a/docs/source/api/ApolloWebSocket/protocols/WebSocketClientDelegate.md +++ /dev/null @@ -1,79 +0,0 @@ -**PROTOCOL** - -# `WebSocketClientDelegate` - -```swift -public protocol WebSocketClientDelegate: AnyObject -``` - -The delegate for a `WebSocketClient` to recieve notification of socket events. - -## Methods -### `websocketDidConnect(socket:)` - -```swift -func websocketDidConnect(socket: WebSocketClient) -``` - -The websocket client has started a connection to the server. -- Parameter socket: The `WebSocketClient` that sent the delegate event. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | - -### `websocketDidDisconnect(socket:error:)` - -```swift -func websocketDidDisconnect(socket: WebSocketClient, error: Error?) -``` - -The websocket client has disconnected from the server. -- Parameters: - - socket: The `WebSocketClient` that sent the delegate event. - - error: An optional error if an error occured. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | -| error | An optional error if an error occured. | - -### `websocketDidReceiveMessage(socket:text:)` - -```swift -func websocketDidReceiveMessage(socket: WebSocketClient, text: String) -``` - -The websocket client received message text from the server -- Parameters: - - socket: The `WebSocketClient` that sent the delegate event. - - text: The text received from the server. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | -| text | The text received from the server. | - -### `websocketDidReceiveData(socket:data:)` - -```swift -func websocketDidReceiveData(socket: WebSocketClient, data: Data) -``` - -The websocket client received data from the server -- Parameters: - - socket: The `WebSocketClient` that sent the delegate event. - - data: The data received from the server. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| socket | The `WebSocketClient` that sent the delegate event. | -| data | The data received from the server. | \ No newline at end of file diff --git a/docs/source/api/ApolloWebSocket/protocols/WebSocketTransportDelegate.md b/docs/source/api/ApolloWebSocket/protocols/WebSocketTransportDelegate.md deleted file mode 100644 index b71f3d9567..0000000000 --- a/docs/source/api/ApolloWebSocket/protocols/WebSocketTransportDelegate.md +++ /dev/null @@ -1,26 +0,0 @@ -**PROTOCOL** - -# `WebSocketTransportDelegate` - -```swift -public protocol WebSocketTransportDelegate: AnyObject -``` - -## Methods -### `webSocketTransportDidConnect(_:)` - -```swift -func webSocketTransportDidConnect(_ webSocketTransport: WebSocketTransport) -``` - -### `webSocketTransportDidReconnect(_:)` - -```swift -func webSocketTransportDidReconnect(_ webSocketTransport: WebSocketTransport) -``` - -### `webSocketTransport(_:didDisconnectWithError:)` - -```swift -func webSocketTransport(_ webSocketTransport: WebSocketTransport, didDisconnectWithError error:Error?) -``` diff --git a/docs/source/api/ApolloWebSocket/structs/ApolloSequencedOperationMessageIdCreator.md b/docs/source/api/ApolloWebSocket/structs/ApolloSequencedOperationMessageIdCreator.md deleted file mode 100644 index e40e510560..0000000000 --- a/docs/source/api/ApolloWebSocket/structs/ApolloSequencedOperationMessageIdCreator.md +++ /dev/null @@ -1,34 +0,0 @@ -**STRUCT** - -# `ApolloSequencedOperationMessageIdCreator` - -```swift -public struct ApolloSequencedOperationMessageIdCreator: OperationMessageIdCreator -``` - -The default implementation of `OperationMessageIdCreator` that uses a sequential numbering scheme. - -## Methods -### `init(startAt:)` - -```swift -public init(startAt sequenceNumber: Int = 1) -``` - -Designated initializer. - -- Parameter startAt: The number from which the sequenced numbering scheme should start. - -#### Parameters - -| Name | Description | -| ---- | ----------- | -| startAt | The number from which the sequenced numbering scheme should start. | - -### `requestId()` - -```swift -public func requestId() -> String -``` - -Returns the number in the current sequence. Will be incremented when calling this method. diff --git a/docs/source/api/ApolloWebSocket/structs/SSLClientCertificateError.md b/docs/source/api/ApolloWebSocket/structs/SSLClientCertificateError.md deleted file mode 100644 index 0b1b6083fb..0000000000 --- a/docs/source/api/ApolloWebSocket/structs/SSLClientCertificateError.md +++ /dev/null @@ -1,14 +0,0 @@ -**STRUCT** - -# `SSLClientCertificateError` - -```swift -public struct SSLClientCertificateError: LocalizedError -``` - -## Properties -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/ApolloWebSocket/structs/SSLSettings.md b/docs/source/api/ApolloWebSocket/structs/SSLSettings.md deleted file mode 100644 index d49b2f5999..0000000000 --- a/docs/source/api/ApolloWebSocket/structs/SSLSettings.md +++ /dev/null @@ -1,44 +0,0 @@ -**STRUCT** - -# `SSLSettings` - -```swift -public struct SSLSettings -``` - -## Properties -### `useSSL` - -```swift -public let useSSL: Bool -``` - -### `disableCertValidation` - -```swift -public let disableCertValidation: Bool -``` - -### `overrideTrustHostname` - -```swift -public var overrideTrustHostname: Bool -``` - -### `desiredTrustHostname` - -```swift -public var desiredTrustHostname: String? -``` - -### `sslClientCertificate` - -```swift -public let sslClientCertificate: SSLClientCertificate? -``` - -### `cipherSuites` - -```swift -public let cipherSuites: [SSLCipherSuite]? -``` diff --git a/docs/source/api/ApolloWebSocket/structs/WebSocket.WSError.md b/docs/source/api/ApolloWebSocket/structs/WebSocket.WSError.md deleted file mode 100644 index a1d9a366fb..0000000000 --- a/docs/source/api/ApolloWebSocket/structs/WebSocket.WSError.md +++ /dev/null @@ -1,26 +0,0 @@ -**STRUCT** - -# `WebSocket.WSError` - -```swift -public struct WSError: Swift.Error -``` - -## Properties -### `type` - -```swift -public let type: ErrorType -``` - -### `message` - -```swift -public let message: String -``` - -### `code` - -```swift -public let code: Int -``` diff --git a/docs/source/api/ApolloWebSocket/structs/WebSocketError.md b/docs/source/api/ApolloWebSocket/structs/WebSocketError.md deleted file mode 100644 index b2430509dc..0000000000 --- a/docs/source/api/ApolloWebSocket/structs/WebSocketError.md +++ /dev/null @@ -1,40 +0,0 @@ -**STRUCT** - -# `WebSocketError` - -```swift -public struct WebSocketError: Error, LocalizedError -``` - -A structure for capturing problems and any associated errors from a `WebSocketTransport`. - -## Properties -### `payload` - -```swift -public let payload: JSONObject? -``` - -The payload of the response. - -### `error` - -```swift -public let error: Error? -``` - -The underlying error, or nil if one was not returned - -### `kind` - -```swift -public let kind: ErrorKind -``` - -The kind of problem which occurred. - -### `errorDescription` - -```swift -public var errorDescription: String? -``` diff --git a/docs/source/api/ApolloWebSocket/structs/WebSocketTransport.Configuration.md b/docs/source/api/ApolloWebSocket/structs/WebSocketTransport.Configuration.md deleted file mode 100644 index 9bacb97afb..0000000000 --- a/docs/source/api/ApolloWebSocket/structs/WebSocketTransport.Configuration.md +++ /dev/null @@ -1,102 +0,0 @@ -**STRUCT** - -# `WebSocketTransport.Configuration` - -```swift -public struct Configuration -``` - -## Properties -### `clientName` - -```swift -public fileprivate(set) var clientName: String -``` - -The client name to use for this client. Defaults to `Self.defaultClientName` - -### `clientVersion` - -```swift -public fileprivate(set) var clientVersion: String -``` - -The client version to use for this client. Defaults to `Self.defaultClientVersion`. - -### `reconnect` - -```swift -public let reconnect: Atomic -``` - -Whether to auto reconnect when websocket looses connection. Defaults to true. - -### `reconnectionInterval` - -```swift -public let reconnectionInterval: TimeInterval -``` - -How long to wait before attempting to reconnect. Defaults to half a second. - -### `allowSendingDuplicates` - -```swift -public let allowSendingDuplicates: Bool -``` - -Allow sending duplicate messages. Important when reconnected. Defaults to true. - -### `connectOnInit` - -```swift -public let connectOnInit: Bool -``` - -Whether the websocket connects immediately on creation. -If false, remember to call `resumeWebSocketConnection()` to connect. -Defaults to true. - -### `connectingPayload` - -```swift -public fileprivate(set) var connectingPayload: JSONEncodableDictionary? -``` - -[optional]The payload to send on connection. Defaults to an empty `JSONEncodableDictionary`. - -### `requestBodyCreator` - -```swift -public let requestBodyCreator: RequestBodyCreator -``` - -The `RequestBodyCreator` to use when serializing requests. Defaults to an `ApolloRequestBodyCreator`. - -### `operationMessageIdCreator` - -```swift -public let operationMessageIdCreator: OperationMessageIdCreator -``` - -The `OperationMessageIdCreator` used to generate a unique message identifier per request. -Defaults to `ApolloSequencedOperationMessageIdCreator`. - -## Methods -### `init(clientName:clientVersion:reconnect:reconnectionInterval:allowSendingDuplicates:connectOnInit:connectingPayload:requestBodyCreator:operationMessageIdCreator:)` - -```swift -public init( - clientName: String = WebSocketTransport.defaultClientName, - clientVersion: String = WebSocketTransport.defaultClientVersion, - reconnect: Bool = true, - reconnectionInterval: TimeInterval = 0.5, - allowSendingDuplicates: Bool = true, - connectOnInit: Bool = true, - connectingPayload: JSONEncodableDictionary? = [:], - requestBodyCreator: RequestBodyCreator = ApolloRequestBodyCreator(), - operationMessageIdCreator: OperationMessageIdCreator = ApolloSequencedOperationMessageIdCreator() -) -``` - -The designated initializer diff --git a/docs/source/api/ApolloWebSocket/toc.md b/docs/source/api/ApolloWebSocket/toc.md deleted file mode 100644 index b593a93f7c..0000000000 --- a/docs/source/api/ApolloWebSocket/toc.md +++ /dev/null @@ -1,42 +0,0 @@ -# Reference Documentation - -## Protocols - -- [OperationMessageIdCreator](protocols/OperationMessageIdCreator/) -- [SSLTrustValidator](protocols/SSLTrustValidator/) -- [WebSocketClient](protocols/WebSocketClient/) -- [WebSocketClientDelegate](protocols/WebSocketClientDelegate/) -- [WebSocketTransportDelegate](protocols/WebSocketTransportDelegate/) - -## Structs - -- [ApolloSequencedOperationMessageIdCreator](structs/ApolloSequencedOperationMessageIdCreator/) -- [SSLClientCertificateError](structs/SSLClientCertificateError/) -- [SSLSettings](structs/SSLSettings/) -- [WebSocket.WSError](structs/WebSocket.WSError/) -- [WebSocketError](structs/WebSocketError/) -- [WebSocketTransport.Configuration](structs/WebSocketTransport.Configuration/) - -## Classes - -- [SSLCert](classes/SSLCert/) -- [SSLClientCertificate](classes/SSLClientCertificate/) -- [SSLSecurity](classes/SSLSecurity/) -- [SplitNetworkTransport](classes/SplitNetworkTransport/) -- [WebSocket](classes/WebSocket/) -- [WebSocketTransport](classes/WebSocketTransport/) - -## Enums - -- [WSError.ErrorType](enums/WSError.ErrorType/) -- [WebSocket.OpCode](enums/WebSocket.OpCode/) -- [WebSocket.WSProtocol](enums/WebSocket.WSProtocol/) -- [WebSocketError.ErrorKind](enums/WebSocketError.ErrorKind/) - -## Extensions - -- [SplitNetworkTransport](extensions/SplitNetworkTransport/) -- [WebSocketTransport](extensions/WebSocketTransport/) -- [WebSocketTransportDelegate](extensions/WebSocketTransportDelegate/) - -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/caching/cache-consistency.mdx b/docs/source/caching/cache-consistency.mdx deleted file mode 100644 index f51667606e..0000000000 --- a/docs/source/caching/cache-consistency.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Cache consistency ---- - -# UNDER CONSTRUCTION - -### Updating the cache after mutations - -This functionality is useful when performing mutations or receiving subscription data, as you should always update the local cache to ensure consistency with the operation that was just performed. The ability to write to the cache directly also prevents you from needing to re-fetch data over the network after a mutation is performed. - - - - -There are 2 primary ways you will want to manually update the cache. Either you'll want to update the cache for a query, or you will want to update a cached object directly. - -Manual Scenario A - -1. You use the id of the object (after setting up the afore mentioned `apollo.cacheKeyForObject = { $0["id"] }`) to fetch and change the object. This will update any query where this object is referenced. This works well for updating queries which reference this object, but in the case of a create mutation, your queries won't contain this object to update. Which leads us into Scenario B. - -Manual Scenario B - -1. You fire off a mutation which creates a new object. -2. You may then want to update the cache for a List that should contain this new object. This is a bit fiddly at the moment, as `Droid` for `CreateDroidsMutation` is strongly typed: `CreateDroidsMutation.Droid`. When inserting this object into the cache for `ListDroidsQuery` you need to init a `ListDroidsQuery.Droid` object from a `CreateDroidsMutation.Droid` or the types won't match. Your alternative to this is to manually refetch queries on a mutation which will trigger any watchers to update. - -Where you may not need to manually update the cache: - -If you use fragments which contain ID's then a query which returns or mutates this fragment and returns a new state for this object will automatically be merged into your cache and any query which references that object will be updated. It may therefore be advantageous to plan your schemas so Fragments are reused in List / Detail queries and then the same Fragment is returned as the result of a mutation. diff --git a/docs/source/caching/cache-key-resolution.mdx b/docs/source/caching/cache-key-resolution.mdx deleted file mode 100644 index cd06c073e0..0000000000 --- a/docs/source/caching/cache-key-resolution.mdx +++ /dev/null @@ -1,188 +0,0 @@ ---- -title: Custom cache keys ---- - -When working with a [normalized cache](./introduction#what-is-a-normalized-cache), it is recommended that you specify a **cache ID** for each object type in your schema. If you don't, objects are assigned a *default* cache ID, but that ID can lead to undesirable duplication of data. - -The normalized cache computes a **cache key** for each object that is stored in the cache. With Apollo iOS, you can customize the computation of **cache keys** to improve the performance and capabilities of your cache. - -> To learn more, read about how the cache [normalizes objects by cache key](./introduction#normalizing-objects-by-cache-key). - -## `CacheKeyInfo` - -The information needed to construct a **cache key** is represented by a [`CacheKeyInfo`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/cachekeyinfo) value. This `struct` consists of two properties you can provide to affect how a cache key is computed: - -1. `let uniqueKeyGroup: String?` - - An optional **group identifier** for a set of objects that should be grouped together in the normalized cache. This is used as the first component of the **cache key**. - - > #### Important: Cache key group uniqueness - > - > All objects with the same `uniqueKeyGroup` must have unique `id`s across all types. - - To prevent cache key collisions, cache keys will always have a **group identifier** component. When the `uniqueKeyGroup` is `nil` (the default value), to [`__typename`](https://spec.graphql.org/draft/#sec-Type-Name-Introspection) of the response object is used as the **group identifier** by default. - - If multiple distinct types can be grouped together in the cache, the `CacheKeyInfo` for each `Object` should have the same `uniqueKeyGroup`. - - > **Tip:** By grouping objects together, their **keys** in the normalized cache will have the same prefix. This allows you to search for cached objects in the same group by their cache `id`. To learn more, read about [direct cache access](./cache-transactions) - -2. `let id: String` - - The unique **cache ID** representing the object. This is used as the second component of the **cache key**. - - > #### Important: Cache ID uniqueness - > - > The ID must be deterministic and unique for all objects with the same **group identifier** (`__typename` or `uniqueKeyGroup`). - > - >That is, the key will be the same every time for a response object representing the same entity in the cache and the same key will never be used for reponse objects representing different objects that also have the same **group identifier**. - -The normalized cache constructs cache keys with the format: - -`"${GroupIdentifier}:${CacheID}"` - -Given a `CacheKeyInfo`: -```swift -CacheKeyInfo(id: "123", uniqueKeyGroup: "Animal") -``` -Apollo iOS would construct a cache key of `"Animal:123"`. - -## The `SchemaConfiguration` file - -The `SchemaConfiguration` file is your entry point to configuring **cache keys** for the types in your schema. - -When Apollo iOS [generates code for your project](../code-generation/introduction), it will generate a set of metadata types representing the GraphQL schema for your application. One of these files is named `SchemaConfiguration.swift`. - - The code generation engine creates this file if it doesn't exist yet, but never overwrites an existing `SchemaConfiguration.swift` file. This means you can edit your schema configuration without those changes being overwritten on subsequent code generation runs. - -> *Tip:* You can configure the location of the generated schema types with the [`output.schemaTypes` option in your code generation configuration](./../code-generation/codegen-configuration). - -## Specifying cache IDs - -The `SchemaConfiguration` contains a [`cacheKeyInfo(for type:object:)`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/schemaconfiguration/cachekeyinfo(for:object:)) function. This function provides you a JSON response `object` and the concrete `type` of the object represented by the response. - -The `object` parameter provides a JSON response from either a network request or a cache hit. - -The `type` parameter provides a strongly typed [`Object`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/object) type. This is a generated metadata type representing a concrete `type` in your GraphQL schema. - -To configure how cache keys are computed from a response object, you can create and return [`CacheKeyInfo`](#cachekeyinfo) values from your implementation of [`cacheKeyInfo(for:object:)`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/schemaconfiguration/cachekeyinfo(for:object:)). - -> **Note:** When specifying **cache IDs**, make sure that you are always fetching the fields used to construct those IDs in your operations. Any response objects that don't contain the **cache ID** fields will not be able to be [merged via cache normalization](./introduction#normalizing-responses). - -### Using a default cache ID field - -If your schema provides a common unique identifier across many of your objects types, you may want to use that field as the **cache ID** by default. - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - guard let id = object["id"] as? String else { - return nil - } - - return CacheKeyInfo(id: id) - } -} -``` - -If the JSON response `object` has no `id` field, the function returns `nil` and the cache will normalize the object using the [default response path normalization](./introduction#normalizing-responses). - -#### JSON value convenience initializer - -Alternatively, you can use the [`init(jsonValue:uniqueKeyGroup:)`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/cachekeyinfo/init(jsonvalue:uniquekeygroupid:)) convenience initializer. This initializer attempts to use the value of a key in the JSON response, throwing an error if the key does not exist. - -If you want to return `nil` when the value does not exist, you can use `try?`. - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - return try? CacheKeyInfo(jsonValue: object["id"]) - } -} -``` - -### Specifying cache IDs by `Object` type - -If you would like to specify **cache IDs** differently for different types of objects, you can use the `type` parameter. - -For an object of the type `Dog` with a unique key represented by an `id` field, you may implement cache key resolution as: - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - switch type { - case Objects.Dog: - return try? CacheKeyInfo(jsonValue: object["id"]) - - default: - return nil - } - } -} -``` - -### Specifying cache IDs by abstract types - -If object types sharing the same `interface` or `union` in your schema have the same cache key resolution strategy, you can resolve the key based on those abstract types. - -The generated schema metadata includes `Interfaces` and `Unions` types that contain a list of all the abstract types used in your GraphQL schema. - -For example, for a schema with `Dog` and `Cat` types that implement `interface Pet`, you may implement cache key resolution as: - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - if type.implements(Interfaces.Pet) { - return try? CacheKeyInfo(jsonValue: object["id"]) - } - - return nil - } -} -``` - -To instead configure cache key resolution based on a `union` type, use the union's [`possibleTypes`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/union/possibletypes) property. - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - if Unions.ClassroomPets.possibleTypes.contains(type) { - return try? CacheKeyInfo(jsonValue: object["id"]) - } - - return nil - } -} -``` - -### Grouping cached objects with `uniqueKeyGroup` - -If your **cache IDs** values are guaranteed to be unique across a number of different types, you may want to group them together in the cache with a common [`uniqueKeyGroup`](#cachekeyinfo). - -> See [`uniqueKeyGroup`](#cachekeyinfo) for more information on grouping cached objects. - -For example, if all objects that implement `interface Animal` will have unique **cache IDs**, whether they are `Dog`, `Cat`, or any other type that implements `Animal`, they can share a `uniqueKeyGroup`. - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - if type.implements(Interfaces.Pet) { - return try? CacheKeyInfo( - jsonValue: object["id"], - uniqueKeyGroupId: Interfaces.Pet.name - ) - } - - return nil - } -} -``` - -## Caveats & limitations - -Cache key resolution has a few notable quirks and limitations you should be aware of while implementing your cache key resolution function: - -1. While the cache key for an object can use a field from another nested object, if the fields on the referenced object are changed in another operation, the cache key for the dependent object will not be updated. For nested objects that are not normalized with their own cache key, this will never occur, but if the nested object is an entity with its own cache key, it can be mutated independently. In that case, any other objects whose cache keys are dependent on the mutated entity will not be updated automatically. You must take care to update those entities manually with a cache mutation. - -2. The `object` passed to this function represents data for an object in an specific operation model, not a type in your schema. This means that [aliased fields](https://spec.graphql.org/draft/#sec-Field-Alias) will be keyed on their alias name, not the name of the field on the schema type. - -3. The `object` parameter of this function is an ``ObjectData`` struct that wraps the underlying object data. Because cache key resolution is performed both on raw JSON (from a network response) and `SelectionSet` model data (when writing to the cache directly), the underlying data will have different formats. The ``ObjectData`` wrapper is used to normalize this data to a consistent format in this context. \ No newline at end of file diff --git a/docs/source/caching/cache-setup.mdx b/docs/source/caching/cache-setup.mdx deleted file mode 100644 index c81108d11e..0000000000 --- a/docs/source/caching/cache-setup.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Cache setup ---- - -All caches used by the `ApolloClient` must conform to the [`NormalizedCache` protocol](https://www.apollographql.com/docs/ios/docc/documentation/apollo/normalizedcache). This protocol provides normalized cache entries as serialized key value pairs called [`Records`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/record). - -In addition to the [default cache implementations](#default-caches) provided by Apollo iOS, you can create your own cache, providing any custom storage implementation you like. Because the records provided to your `NormalizedCache` implementation have already been ["normalized"](./introduction#normalizing-responses) by Apollo iOS, you can focus your implementation on the storage of your normalized cache data. - -> If you are interested in creating a custom `NormalizedCache` implementation, start by reading the [API Reference for `NormalizedCache`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/normalizedcache). - -Apollo iOS includes default implementations for two types of `NormalizedCache`: - -## `InMemoryNormalizedCache` - -**This is the default caching implementation used by the `ApolloClient`.** - -An in-memory cache stores normalized results directly in system memory while your application is running. Results are not persisted to disk. This means the cache is not saved when the application terminates. - -Because the cached data is stored directly in memory, it is faster to read and write records to the cache than a disk-based cache implementation. - -An in-memory cache is best at caching short-lived data. It is recommended for data that is expected to change frequently or is unlikely to be accessed again in the future. - -A few examples of this are: -- Items in a newsfeed -- Location-based data -- Search results for a specific search term - -For data that is short-lived, the simplicity of having a clear cache at the beginning of each application run, combined with the improved performance, may make an `InMemoryNormalizedCache` a good choice. - -### Setup - -To use an `InMemoryNormalizedCache`, no additional work is necessary! - -`InMemoryNormalizedCache` is the default cache when initializing an `ApolloClient`. If you want to use an in-memory cache without modifications, all you have to do is instantiate an `ApolloClient` instance without passing a custom `ApolloStore` into the `store` parameter. - -If you find you need to instantiate the in-memory cache yourself, you can do so with one line: - -```swift -let cache = InMemoryNormalizedCache() -``` - -## `SQLiteNormalizedCache` - -A SQLite cache writes out cache results to an on-disk [`SQLite`](https://www.sqlite.org/index.html) file. - -Storing cache results on-disk allows us to maintain the cache across application runs. However the file I/O required by each cache operation may slightly increase cache response time. - -As an added benefit, because this cache does not hold any results in memory, there is no risk of the cache using too much memory. - -An on-disk cache is best at caching long-lived data. It is recommended for data that is not expected to change as frequently as it is accessed; takes a long time to fetch; or should be accessible while offline. - -A few examples of this are: -- User Settings/Profiles -- Locally created user content -- Data from background fetches - -For data that you want to persist between application runs, the `SQLiteNormalizedCache` may fit your needs. - -> **Note: Caching Sensitive Data** -> -> When persisting cache data to disk, be sure to consider if any sensitive data is being written to the cache. Cache data is stored in plain-text and can be retrieved from the device. You may need to sanitize your cache data or encrypt the cache file. - -### Setup - -import SPMSQLite from "./../../shared/sqlite-spm-panel.mdx" -import CocoaPodsSQLite from "./../../shared/sqlite-cocoapods-panel.mdx" - -To use the `SQLiteNormalizedCache`, you need to add the `ApolloSQLite` sub-package to your project using your preferred package manager: - - - - - -Once `ApolloSQLite` is linked to your project, you can do the following: - -1. Set up a file URL for your `SQLite` file. -2. Use that file URL to instantiate a `SQLiteNormalizedCache`. -3. Instantiate an `ApolloStore` with your `SQLiteNormalizedCache`. -4. Pass that `ApolloStore` into the initializer of `ApolloClient`: - -```swift -// 1. Determine where you would like to store your SQLite file. -// A commonly used location is the user's Documents directory -// within your application's sandbox. -let documentsPath = NSSearchPathForDirectoriesInDomains( - .documentDirectory, - .userDomainMask, - true -).first! -let documentsURL = URL(fileURLWithPath: documentsPath) -let sqliteFileURL = documentsURL.appendingPathComponent("test_apollo_db.sqlite") - -// 2. Use that file URL to instantiate the SQLite cache: -let sqliteCache = try SQLiteNormalizedCache(fileURL: sqliteFileURL) - -// 3. And then instantiate an instance of `ApolloStore` with the cache you've just created: -let store = ApolloStore(cache: sqliteCache) - -// 4. Assuming you've set up your `networkTransport` instance elsewhere, -// pass the store you just created into your `ApolloClient` initializer. -let apolloClient = ApolloClient(networkTransport: networkTransport, store: store) -``` diff --git a/docs/source/caching/cache-transactions.mdx b/docs/source/caching/cache-transactions.mdx deleted file mode 100644 index 9aacd88c11..0000000000 --- a/docs/source/caching/cache-transactions.mdx +++ /dev/null @@ -1,173 +0,0 @@ ---- -title: Direct cache access ---- - -import SeparateLocalCacheMutationsNote from "../../shared/separate-local-cache-mutation-note.mdx" - -Apollo iOS provides the ability to directly read and update the cache as needed using type-safe generated operation models. This provides a strongly-typed interface for accessing your cache data in pure Swift code. - -The `ApolloStore` has APIs for accessing the cache via both `ReadTransaction` and `ReadWriteTransaction`. - -> This article explains how you can access cache data directly. To learn how you can use the cache alongside network requests to fetch data for your GraphQL operations, read our documentation on [fetching locally cached data](./../fetching/fetching-data#fetching-locally-cached-data). - -## Reading cache data - -You can read data from the local cache directly with [`ApolloStore.withinReadTransaction(_:callbackQueue:completion:)`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/withinreadtransaction(_:callbackqueue:completion:)). The transaction block provides a [`ReadTransaction`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readtransaction). - -A [`ReadTransaction`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readtransaction) can be used to read any of your [generated GraphQL queries or fragments](./../fetching/fetching-data#generated-operation-models). - -```swift -// Read from a GraphQL Query -client.store.withinReadTransaction({ transaction in - let data = try transaction.read( - query: HeroNameQuery(episode: .jedi) - ) - print(data.hero?.name) -}) - -// Read from a GraphQL fragment -client.store.withinReadTransaction({ transaction -> HeroDetails in - let data = try transaction.readObject( - ofType: HeroDetails.self, - withKey: "Hero:123" - ) - - print(data.hero?.name) -}) -``` - -## Writing cache data - -You can write data to the local cache with [`ApolloStore.withinReadWriteTransaction(_:callbackQueue:completion:)`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/withinreadwritetransaction(_:callbackqueue:completion:)). The transaction block provides a [`ReadWriteTransaction`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readwritetransaction). In addition the the ability to write data to the cache, [`ReadWriteTransaction`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readwritetransaction) has all of the functionality of a `ReadTransaction`. To write data to the cache, you'll need to define a [`LocalCacheMutation`](#defining-local-cache-mutations). - -### Defining local cache mutations - -Like [reading cache data](#reading-cache-data), writing to the cache uses type-safe generated models. However, because the generated models for your operations and fragments are immutable, you cannot change the values on these models to write them to the cache. In order to write to the cache, you can define a [`LocalCacheMutation`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/localcachemutation). - -A [`LocalCacheMutation`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/localcachemutation) is just a [GraphQL query or fragment definition](./../fetching/fetching-data#defining-operations) that has been flagged as a local cache mutation using the Apollo iOS specific directive `@apollo_client_ios_localCacheMutation`. - -When a query or fragment with this directive is defined, the code generation engine will generate a mutable model that can be used with a [`ReadWriteTransaction`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readwritetransaction) to write data to the cache. - -> Your query definitions can also define variables for these operations to mutate cache data for fields with input arguments. For more information see our [operation argument documentation](./../fetching/operation-arguments). - - - -```graphql title="Mutable Query Definition" -query HeroNameLocalCacheMutation( - $episode: Episode! -) @apollo_client_ios_localCacheMutation { - hero(episode: $episode) { - id - name - } -} -``` - -```graphql title="Mutable Fragment Definition" -fragment MutableHeroDetails on Hero -@apollo_client_ios_localCacheMutation { - id - name -} -``` - - - -The generated models for your mutations will have mutable fields (`var` instead of `let`). Generating both getters and setters for fields on the mutable models means that they are larger than immutable generated models. - - - -### Writing local cache mutations to the cache - -Once you have generated mutable query models, you can use them with [`ReadWriteTransaction.update()`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readwritetransaction/update(_:_:)). - -```swift title="Local Cache Mutation Update" -store.withinReadWriteTransaction({ transaction in - let cacheMutation = HeroNameLocalCacheMutation(episode: .CLONES) - - try transaction.update(cacheMutation) { (data: inout HeroNameLocalCacheMutation.Data) in - data.hero.name = "General Kenobi" - } - - let queryData = try transaction.read( - query: HeroNameQuery(episode: .jedi) - ) - print(queryData.hero?.name) // "General Kenobi" -}) - -``` - -### Writing mutable fragments to the cache - -To write data for a mutable fragment, use [`ReadWriteTransaction.updateObject(ofType:withKey:variables:_:)`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/readwritetransaction/updateobject(oftype:withkey:variables:_:)). You will need to pass the cache key of the object you want to update along with the mutable fragment. - -> For more information on cache keys in the normalized cache, check out our documentation on [normalized cache responses](./introduction#normalizing-responses). - -```swift title="Mutable Fragment Update" -store.withinReadWriteTransaction({ transaction in - try transaction.updateObject( - ofType MutableHeroDetails.self, - withKey: "Hero:123" - ) { (data: inout MutableHeroDetails) in - data.hero.name = "General Kenobi" - - let queryData = try transaction.read( - query: HeroNameQuery(episode: .jedi) - ) - - print(queryData.hero?.name) // "General Kenobi" - } -}) -``` - -## Deleting cache data - -There are presently three deletion methods available: - -1. `ApolloStore.clear` - - Removes all data from the cache immediately. - -2. `ReadWriteTransaction.removeObject(for:)` - - Removes a single object for the given `CacheKey`. - -3. `ReadWriteTransaction.removeObjects(matching:)` - - Removes all objects with a `CacheKey` that matches the given pattern. Pattern matching is **not** case sensitive. For an in memory cache it is the equivalent of checking whether the cache key _contains_ the pattern and `SQLite` caches will perform a `LIKE` query to remove the objects. This method can be very slow depending on the number of records in the cache, it is recommended that this method be called on a background queue. - -The `removeObject(for:)` and `removeObjects(matching:)` functions will only remove things at the level of an object. They cannot remove individual properties from an object, and cannot remove outside references **to** an object. - -Deleting an object from the cache does _not_ perform cascading deletions. That is, if you remove an object which has a reference to another object, the reference will be removed, but that other object will not be removed and will remain in the cache. Likewise, if you delete an object, references _to_ that object will not be deleted, they will simply fail, causing a cache miss, when you attempt to load the object again. - -This means that if you are planning to remove something, be sure that you either: - -A) Know for sure you no longer need it - -or - -B) Are fine with your cache policy potentially triggering an additional fetch if the missing value causes a read to fail - -> **Note:** As of right now, there is not a way to delete a single property's value. For instance, calling `try transaction.removeRecord(for: "2001.name")` will result in no action, as there would not be a record with the cache key `"2001.name"`, since `name` is a scalar field on the `"2001"` record. - -### Deleting objects by cache key - -> You will need to have a clear understanding of how you are generating cache keys to be able to use this functionality effectively. To help you figure out how to construct a cache key or pattern to delete, we recommend having a clear understanding of [how cache keys are generated](./introduction#normalizing-responses) and [configuring custom cache keys](./cache-key-resolution) for your cache objects. - -Removing objects by their cache key allows you to clear stale or unneeded cache data without deleting the entire cache. - -In Apollo iOS, you can [configure custom cache keys for your objects](./cache-key-resolution). The key for an entry in the cache that uses custom cache IDs will have the format `${ObjectType}:${CustomCacheKey). - -In this example, we've configured our cache to attempt to use the `id` field as a cache ID. - -```swift title="SchemaConfiguration.swift" -static func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - try? CacheKeyInfo(jsonValue: object["id"]) -} -``` - -This indicates that for every object which has an `id` field, its cache ID will be the value of the `id` field. - -If you have previously fetched a `Book` object with the ID `"2001"`, the key for that entry in the cache will be `"Book:2001"`. To delete this object from the cache, you can call `transaction.removeObject(for: "Book:2001")` within a `ReadWriteTransaction`. This will remove the cache entry with that key, along with all of its associated scalar properties and the references to other objects it stores. - -We can also delete all objects of a concrete object type from the cache. To remove all `Book` objects, you can use `transaction.removeObjects(matching: "Book:")`. diff --git a/docs/source/caching/introduction.mdx b/docs/source/caching/introduction.mdx deleted file mode 100644 index d56b9ed32c..0000000000 --- a/docs/source/caching/introduction.mdx +++ /dev/null @@ -1,244 +0,0 @@ ---- -title: Client-side caching ---- - -Apollo iOS supports client-side caching of GraphQL response data. Utilizing our caching mechanisms, your application can respond to GraphQL queries using locally cached data that has been previously fetched. This helps to reduce network traffic, which provides a number of benefits including: - -- Shorter loading times -- Reduction of server load and cost -- Less data usage for users of your application - -Apollo iOS uses a normalized cache that, when configured properly, acts as a source of truth for your graph, enabling your application to react to changes as they're fetched. - -The Apollo iOS library contains both a short-lived in-memory cache and a SQLite cache that persists cache data to disk. - -> Learn about using cache policies to configure how GraphQL operations interact with cache data by reading our documentation on [fetching locally cached data](./../fetching/fetching-data#fetching-locally-cached-data). - -## What is a normalized cache? - -In a GraphQL client, a normalized cache breaks each of your GraphQL operation responses into the individual objects it contains. Then, each object is cached as a *separate entry* based on its **cache key**. This means that if multiple responses include the _same_ object, that object can be de-duplicated into a single cache entry. This reduces the overall size of the cache and helps keep your cached data consistent and fresh. - -Because the normalized cache updates cache entries across all of your operations, data fetched by one operation can update objects fetched by another operation. This allows you to [watch your queries](./../fetching/queries#watching-queries) and react to changes across your entire application. You can use this to update your UI automatically or trigger other events when new data is available. - -### Normalizing responses - -In order to maintain a normalized cache, Apollo iOS processes response data of your GraphQL operations, identifying each object and creating new cache entries or merging data into existing cache entries. - -To understand how Apollo iOS does this, consider this example query: - -```graphql title="Query" -query GetFavoriteBook { - favoriteBook { # Book object - id - title - author { # Author object - id - name - } - } -} -``` - -The `favoriteBook` field in this query returns a `Book` object, which in turn includes an `Author` object. An example response from the GraphQL server may look like this: - -```json title="Response" -{ - "favoriteBook": { - "id": "bk123", - "title": "Les Guerriers du silence", - "author": { - "id": "au456", - "name": "Pierre Bordage" - } - } -} -``` - -A normalized cache does _not_ store this response directly. Instead, it breaks it up into individual cache entries. By default, these cache entries are identified by their path from the [root operation](https://spec.graphql.org/draft/#sec-Root-Operation-Types). Because this example is a query (rather than a mutation or subscription), the root has the name `QUERY_ROOT`. - -```json title="Cache Entries" -"QUERY_ROOT": { - "favoriteBook": "-> #QUERY_ROOT.favoriteBook" -} - -"QUERY_ROOT.favoriteBook": { - "id": "bk123", - "title": "Les guerriers du silence", - "author": "-> #QUERY_ROOT.favoriteBook.author" -} - -"QUERY_ROOT.favoriteBook.author": { - "id": "au456", - "name": "Pierre Bordage" -} -``` - -The `QUERY_ROOT` entry is always present if you've cached results from at least one query. This entry contains a reference for each top-level field you've included in any queries (e.g., `favoriteBook`). - -The `favoriteBook` entry has a `author` field containing the string `"-> #QUERY_ROOT.favoriteBook.author"`. The `-> #` indicates that this is a **reference** to another cache entry, in this case, the `QUERY_ROOT.favoriteBook.author` entry. - -Normalizing objects by their response path allows us to merge changes from other operations along the same response path. - -For example, if we defined another query that fetched additional fields on the `favoriteBook` object, they could be merged into the existing cache entry. - - - -```graphql title="Query" -query FavoriteBookYear { - favoriteBook { # Book object - id - yearPublished - } -} -``` - -```json title="Response" -{ - "favoriteBook": { - "id": "bk123", - "yearPublished": 1993 - } -} -``` - - - -After merging this response into the cache, the `favoriteBook` entry would have the `yearPublished` field added to its existing data. - -```json title="Cache Entries" -"QUERY_ROOT.favoriteBook": { - "id": "bk123", - "title": "Les guerriers du silence", - "author": "-> #QUERY_ROOT.favoriteBook.author", - "yearPublished": 1993 -} -``` - -The `favoriteBook` field can now be queried for its `title` and `yearPublished` in a new query, and the normalized cache could return a response from the local cache immediately without needed to send the query to the server. - -```graphql title="Query" -query FavoriteBookTitleAndYear { - favoriteBook { # Book object - title - yearPublished - } -} -``` - -### Normalizing objects by cache key - -> This section explains how cache keys are used to merge object data in the normalized cache. For information on how to configure your cache keys, see [Custom cache keys](./cache-key-resolution). - -Normalizing response data by the response path helps us de-duplicate responses for the same fields, but it does not allow us to merge cache entries from different fields that return the same object. - -In this query, we fetch a `Book` object using the field at the path `bestFriend.favoriteBook`. - - - -```graphql title="Query" -query BestFriendsFavoriteBook { - bestFriend { - favoriteBook { # Book object - id - title - genre - } - } -} -``` - -```json title="Response" -{ - "bestFriend" { - "favoriteBook": { - "id": "bk123", - "title": "Les guerriers du silence", - "genre": "SCIENCE_FICTION" - } - } -} -``` - - - -When this response is merged into the cache, we have new cache entries added for `QUERY_ROOT.bestFriend` and `QUERY_ROOT.bestFriend.favoriteBook`. - -The response tells use that our `bestFriend` has the same `favoriteBook` as us! However, the data for same book is not de-duplicated in our cache entries. - -```json title="Cache Entries" -"QUERY_ROOT.favoriteBook": { - "id": "bk123", - "title": "Les guerriers du silence", - "author": "-> #QUERY_ROOT.favoriteBook.author", - "yearPublished": 1993 -} - -"QUERY_ROOT.bestFriend": { - "favoriteBook": "-> #QUERY_ROOT.bestFriend.favoriteBook" -} - -"QUERY_ROOT.bestFriend.favoriteBook": { - "id": "bk123", - "title": "Les guerriers du silence", - "genre": "SCIENCE_FICTION" -} -``` - -If we tried to fetch a query with the field `favoriteBook.genre`, the cache would not find the `genre` field on the cache entry `QUERY_ROOT.favoriteBook`, so it would send the query to the server to fetch the duplicate data. - -In order to de-duplicate response data from different fields that return the same object, we need to configure the cache to recognize that they are the same object. We can do that by providing cache key configuration for the `Book` object. - -In this example, the `Book` object type has an `id` field that uniquely identifies it. Since our `favoriteBook` and `bestFriend.favoriteBook` cache entries have the same `id`, we know they represent the same `Book` object. We can configure the cache to use the `id` field as the cache ID for all `Book` objects. This will ensure the cache normalizes our cache entries correctly. - -To configure cache keys, we return a new `CacheKeyInfo` value from the `SchemaConfiguration.cacheKeyInfo(for type:,object:)` function. - -```swift title="SchemaConfiguration.swift" -static func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - switch type { - case MySchema.Objects.Book: - return try? CacheKeyInfo(jsonValue: object["id"]) - - default: return nil - } -} -``` - -With this set up, whenever the normalized cache writes response data for a `Book` object, it will use the `id` to construct a cache key, instead of the response path. - -To prevent cache key conflicts across different object types, the cache prepends the [`__typename`](https://spec.graphql.org/draft/#sec-Type-Name-Introspection) of the object to the provided cache ID followed by a colon (`:`). - -This means the cache key for our `Book` will now be `"Book:bk123"`. - -> For more information on using `CacheKeyInfo` to configure cache keys, see [Custom cache keys](./cache-key-resolution). - -With cache key resolution configured for the `Book` type, the response data for the queries above would create a single, normalized `Book` object. - -```json title="Cache Entries" -"QUERY_ROOT": { - "favoriteBook": "-> #Book:bk123" -} - -"BOOK:bk123": { - "id": "bk123", - "title": "Les guerriers du silence", - "author": "-> #QUERY_ROOT.favoriteBook.author", - "yearPublished": 1993, - "genre": "SCIENCE_FICTION" -} - -"QUERY_ROOT.bestFriend": { - "favoriteBook": "-> #Book:bk123" -} -``` - -The cache entry for `BOOK:bk123` contains all of the fields fetched on the `Book` from all queries. Additionally, the `favoriteBook` and `bestFriend.favoriteBook` fields are a cache reference to the entry with the cache key `BOOK:bk123`. - -> To learn more about the normalization process, see our blog posts: -> - [Demystifying Cache Normalization](https://www.apollographql.com/blog/apollo-client/caching/demystifying-cache-normalization). -> - [GraphQL Concepts Visualized](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3) - -## Clearing cached data - -All caches can be cleared in their entirety by calling [`clear(callbackQueue:completion:)`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollostore/clearcache(callbackqueue:completion:)) on your `ApolloStore`. - -> If you need to work more directly with the cache, check out [Direct cache access](./cache-transactions). diff --git a/docs/source/code-generation/codegen-cli.mdx b/docs/source/code-generation/codegen-cli.mdx deleted file mode 100644 index 742e0cf59d..0000000000 --- a/docs/source/code-generation/codegen-cli.mdx +++ /dev/null @@ -1,186 +0,0 @@ ---- -title: The Codegen CLI ---- - -import SPMInstallCLI from "../../shared/cli-install/spm.mdx" -import SPMXcodeInstallCLI from "../../shared/cli-install/spm-xcode.mdx" -import PodsInstallCLI from "../../shared/cli-install/pods.mdx" - -The Codegen CLI provides a command line tool that streamlines the process of running code generation. The CLI can be ran manually from Terminal (or any other shell program) or can be called into from bash scripts. - -The Codegen CLI has three primary commands: - -- [**Initialize**](#initialize): Initializes an `apollo-codegen-configuration.json` file that can be used to [configure how the CLI generates code](./codegen-configuration). -- [**Fetch Schema**](#fetch-schema): Fetches your GraphQL schema and writes it to a file. The schema is required in order to run code generation. - - To learn how to configure schema fetching, see [Downloading a schema](./downloading-schema). -- [**Generate**](#generate): Runs the code generation engine using the configuration in your `apollo-codegen-configuration.json` file. -- [**Generate Operation Manifest**](#generate-operation-manifest): Generates the operation manifest for persisted queries using the configuration in your `apollo-codegen-configuration.json` file. - -> For detailed usage documentation of these commands, see the [Usage](#usage) section. - -## Installation - -When Apollo iOS is included as a dependency through Swift Package Manager (SPM) or Cocoapods, the CLI is built and packaged with the dependency automatically. This ensures you always have a valid version of the CLI for the version of Apollo iOS you are using and you never have to worry about installation or updates. - -To learn how to run the Codegen CLI with your chosen package manager, open the appropriate section: - - - - - - - - - - - - - - - - - - - - - -Each [release](https://github.com/apollographql/apollo-ios/releases) of Apollo iOS in GitHub has a pre-built CLI binary attached. This binary can be downloaded and moved to any local directory that is convenient for you. - -After downloading the binary, you can run the Codegen CLI from the directory where it is located: - -```bash -./apollo-ios-cli ${Command Name} -${Command Arguments} -``` - - - - - -If you are not using SPM or Cocoapods, and do not want to use the pre-built CLI binary, you can compile the CLI manually. Once you've cloned the Apollo iOS git repo, use Terminal to go into that cloned directory and run the following command: - -```bash -make build-cli -``` - -This will compile the Codegen CLI which you will find at `.build/release/apollo-ios-cli`. You can run the CLI from this directory, move it to another location, or add it to your shell's `$PATH`. - -```bash -./.build/release/apollo-ios-cli ${Command Name} -${Command Arguments} -``` - - - -## Usage - -The Apollo iOS Codegen CLI is a command like utility for Apollo iOS code generation. - -#### `apollo-ios-cli ` - -#### Options: - -| Option | Description | -| ------ | ----------- | -| `--version` | Show the version of the CLI. | -| `-h, --help` | Show help information. | - -#### Subcommands: - -| Command | Description | -| ------ | ----------- | -| `init` | Initialize a new configuration with defaults. | -| `generate` | Generate Swift source code based on a code generation configuration. | -| `fetch-schema` | Download a GraphQL schema from the Apollo Registry or GraphQL introspection. | - -See `apollo-ios-cli help ` for detailed help. - -### Initialize - -Creates an `apollo-codegen-configuration.json` file with default values. The Codegen CLI reads this file to [configure how the CLI generates code](./codegen-configuration). - -The default configuration will: -- Find all GraphQL schema files ending with the file extension `.graphqls` within your project directory. -- Find all GraphQL operation and fragment definition files ending with the file extension `.graphql` within your project directory. -- Create a Swift Package for your generated schema with the `schema-name` provided. -- Generate operation and fragment models relative to the `.graphql` files that define them. - -> For more information on configuring code generation, see the [configuration documentation](./codegen-configuration). - -#### Command: - -`apollo-ios-cli init [--schema-name ] [--module-type ] [--target-name ]` - -#### Options: - -| Option | Description | -| ---------- | ----------- | -| `--schema-name` | **[Required]** The name you would like to be used as the namespace for your generated schema files. | -| `--module-type` | **[Required]** How to package the schema types for dependency management. Possible types are `embeddedInTarget`, `swiftPackageManager`, `other`. | -| `--target-name` | Name of the target in which the schema types files will be manually embedded.

*Note: This is required for the "embeddedInTarget" module type and will be ignored for all other module types.* | -| `-p, --path ` | Write the configuration to a file at the path. (default: `./apollo-codegen-config.json`) | -| `-w, --overwrite` | Overwrite any file at `--path`. If init is called without `--overwrite` and a config file already exists at `--path`, the command will fail. | -| `-s, --print` | Print the configuration to stdout. | -| `--version` | Show the version of the CLI. | -| `-h, --help` | Show help information. | - -### Fetch Schema - -Downloads a GraphQL schema from the Apollo Registry or GraphQL introspection and writes it to a file. The schema is required in order to run code generation. - -> For more information on schema fetching, see [Downloading a schema](./downloading-schema). - -#### Command: - -`apollo-ios-cli fetch-schema [--path ] [--string ]` - -#### Options: - -| Option | Description | -| ---------- | ----------- | -| `-p, --path ` | Read the configuration from a file at the path. `--string` overrides this option if used together. (default: `./apollo-codegen-config.json`) | -| `-s, --string ` | Provide the configuration string in JSON format. This option overrides `--path`. | -| `-v, --verbose ` | Increase verbosity to include debug output. | -| `--version` | Show the version of the CLI. | -| `-h, --help` | Show help information.| - -### Generate - -Runs the code generation engine to generate Swift source code using the configuration in your `apollo-codegen-configuration.json` file. - -> For more information on configuring code generation, see the [configuration documentation](./codegen-configuration). - -#### Command: - -`apollo-ios-cli generate [--path ] [--string ]` - -#### Options: - -| Option | Description | -| ---------- | ----------- | -| `-p, --path ` | Read the configuration from a file at the path. `--string` overrides this option if used together. (default: `./apollo-codegen-config.json`) | -| `-s, --string ` | Provide the configuration string in JSON format. This option overrides `--path`. | -| `-v, --verbose ` | Increase verbosity to include debug output. | -| `-f, --fetch-schema` | Fetch the GraphQL schema before Swift code generation. This runs the [`fetch-schema`](#fetch-schema) command. | -| `--ignore-version-mismatch` | Ignores version mismatches between the `apollo-ios-cli` and the version of the Apollo sdk being used. | -| `--version` | Show the version of the CLI. | -| `-h, --help` | Show help information.| - -### Generate Operation Manifest - -Generates the operation manifest for persisted queries using the configuration in your `apollo-codegen-configuration.json` file. - -> For more information on configuring code generation, see the [configuration documentation](./codegen-configuration). - -#### Command: - -`apollo-ios-cli generate-operation-manifest [--path ] [--string ]` - -#### Options: - -| Option | Description | -| ---------- | ----------- | -| `-p, --path ` | Read the configuration from a file at the path. `--string` overrides this option if used together. (default: `./apollo-codegen-config.json`) | -| `-s, --string ` | Provide the configuration string in JSON format. This option overrides `--path`. | -| `-v, --verbose ` | Increase verbosity to include debug output. | -| `--ignore-version-mismatch` | Ignores version mismatches between the `apollo-ios-cli` and the version of the Apollo sdk being used. | -| `--version` | Show the version of the CLI. | -| `-h, --help` | Show help information.| \ No newline at end of file diff --git a/docs/source/code-generation/codegen-configuration.mdx b/docs/source/code-generation/codegen-configuration.mdx deleted file mode 100644 index 987fa35863..0000000000 --- a/docs/source/code-generation/codegen-configuration.mdx +++ /dev/null @@ -1,757 +0,0 @@ ---- -title: Codegen configuration ---- - -The Apollo iOS Code Generation Engine is flexible and can be configured for different behaviors. - -The configuration options for code generation are represented by the [`ApolloCodegenConfiguration struct`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration). - -When using the [Codegen CLI](./codegen-cli), your configuration is represented by the `apollo-codegen-configuration.json` JSON file created by the CLI's [`init` command](./codegen-cli#initialize). - -When [running code generation in your own Swift code](./run-codegen-in-swift-code), the configuration options are represented by the [`ApolloCodegenConfiguration struct`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration). - -Most of the configuration properties have defaults that provide a good starting point. - -There are a number of base configuration properties, each representing a specific characteristic of the codegen engine: - -| Property Name | Description | -| ------------- | ----------- | -| [`schemaNamespace`](#schema-namespace) | Namespace used to scope the generated schema types. | -| [`input`](#file-input) | Search patterns that will be used to locate the schema and operation definition files. | -| [`output`](#file-output) | Location and structure of the generated files and modules. | -| [`options`](#output-options) | Rules and options to customize the generated code. | -| [`experimentalFeatures`](#experimental-features) | Used to enable experimental features.
*Note: These features could change at any time and are not guaranteed to always be available.* | -| [`schemaDownload`](#schema-download-configuration) | Configuration to fetch a GraphQL schema before generation. | -| [`operationManifest`](#operation-manifest-configuration) | Configuration to generate operation manifests for persisted queries | - -## Schema namespace - -**[`schemaNamespace: String`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schemanamespace)** - -This option defines the name of your schema module or namespace. - -Along with your operation definitions, Apollo iOS generates a set of metadata objects that represent the types in your schema. All of these object are grouped within a namespace with the provided name. - -- If you are embedding your generated schema types within another target, this will be the name of a [caseless namespace `enum`](https://www.swiftbysundell.com/articles/powerful-ways-to-use-swift-enums/#namespaces-and-non-initializable-types). - -- If you are including your schema types as a stand-alone target that can be imported by your other project targets, this will be the name of that target. - -You can configure how you would like to include your schema types in your project using the [`output.schemaTypes.moduleType` option](#module-type). - -## File input - -**[`input: FileInput`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/input)** - -The code generation engine requires a GraphQL schema and at least one operation to be able to generate Swift code. Read the introductory section on [GraphQL source files](./introduction#graphql-source-files) for more information. - -The properties to configure `input` are: - -| Property Name | Description | -| ------------- | ----------- | -| [`schemaSearchPaths`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/fileinput/schemasearchpaths) | An array of path matching pattern strings used to find GraphQL schema files. [Schema extension](https://spec.graphql.org/draft/#sec-Schema-Extension) files can be included in these search paths.

*Note: JSON format schema files must have the `.json` file extension.* | -| [`operationSearchPaths`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/fileinput/operationsearchpaths) | An array of path matching pattern strings used to find GraphQL operation files. | - - - -```json title="CLI Configuration JSON" -"input": { - "schemaSearchPaths": [ - "**/*.graphqls" - ], - "operationSearchPaths": [ - "**/*.graphql" - ] -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - input: ApolloCodegenConfiguration.FileInput( - schemaSearchPaths: ["**/*.graphqls"], - operationSearchPaths: ["**/*.graphql"] - ), -) -``` - - - -#### Search Path Patterns - -Each file input property is a `[String]` search path array. Search paths can be used to search your project directory for files matching a glob pattern. You can use absolute or relative paths in path matching patterns. Relative paths will be based off the current working directory. - -Each path matching pattern can include the following characters: -- `*` matches everything but the directory separator (shallow), eg: `*.graphql` -- `?` matches any single character, eg: `file-?.graphql` -- `**` matches all subdirectories (deep), eg: `**/*.graphql` -- `!` excludes any match only if the pattern starts with a `!` character, eg: `!file.graphql` - -## File output - -**[`output: FileOutput`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/output)** - -The [`FileOutput`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/fileoutput) options are used to configure which files are generated and their output locations. - -The properties to configure `output` are: - -| Property Name | Description | -| ------------- | ----------- | -| [`schemaTypes`](#schema-types) | Location and structure of the generated schema types files. | -| [`operations`](#operations) | Location and structure of the generated operation files such as queries, mutations, subscriptions, and fragments. | -| [`testMocks`](#test-mocks) | Location and structure of the test mock operation object files.

If `.none`, test mocks will not be generated. | - - - -```json title="CLI Configuration JSON" -"output": { - "schemaTypes": { - "moduleType": { - "swiftPackageManager": {} - }, - "path": "./generated/schema/" - }, - "operations": { - "inSchemaModule": {} - }, - "testMocks": { - "none": {} - }, - "operationManifest" : { - "path" : "./generated/operationIdentifiers.json", - "version" : "persistedQueries" - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput( - path: "./generated/schema/", - moduleType: .swiftPackageManager - ) - operations: .inSchemaModule, - testMocks: .none, - operationIdentifiersPath: "./generated/" - ) -) -``` - - - -### Schema types - -**[`output.schemaTypes: SchemaTypesFileOutput`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/fileoutput/schematypes)** - -Schema types are common to all generated operation models and are required for the generated Swift code to compile. - -The properties to configure `output.schemaTypes` are: - -| Property Name | Description | -| ------------- | ----------- | -| [`path`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/path) | A file path where the generated schema types should be output.

Relative to your project root | -| [`moduleType`](#module-type) | How generated schema types will be linked to your project. | - -#### Module type - -**[`output.schemaTypes.moduleType: ModuleType`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.property)** - -Use the [`ModuleType`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum) value to configure how your schema types are linked to your project. The Code Generation Engine uses this to determine the structure of the generated files, including `import` statements. - -For single target applications, [`embeddedInTarget(name:)`](#embedded-in-target) can be used. - -For multi-module projects, it is recommended that the schema types be created in a separate module to help with separation of concerns. If using Swift Package Manager, the `swiftPackageManager` option can help automate module creation. - -> **Note:** This option must be set correctly for your project structure or generated code will fail to compile. - -The possible values for `moduleType` are: - -| Value | Description | -| ----- | ----------- | -| [`embeddedInTarget(name:accessModifier:)`](#embedded-in-target) | Indicates that you would like to include the generated module directly in your application target. | -| [`swiftPackageManager`](#swift-package-manager) | Creates a schema module as an SPM package that can be included in your project. | -| [`other`](#other-schema-module-types) | Indicates that you would like to manually define a schema module using a third party package manager (such as Cocoapods). | - -#### Embedded in target - -**[`ModuleType.embeddedInTarget(name: String, accessModifier: AccessModifier)`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum/embeddedintarget(name:accessModifier:))** - -This option indicates that you would like to include the generated module directly in your application target. - -The `name` parameter must specify the name of the target the schema types will be included in. This will be used to generate `import` statements for generated operations. Use the `accessModifier` parameter to control the visibility of the generated code. - -No module will be created for the schema types. Instead, generated schema types will be enclosed in a [caseless namespace `enum`](https://www.swiftbysundell.com/articles/powerful-ways-to-use-swift-enums/#namespaces-and-non-initializable-types). - -When creating a single target application, this option allows you to include Apollo iOS's generated module directly in your application target. - -> **Note:** When using this module type, you are responsible for ensuring the generated files are linked to your application target. - - - -```json title="CLI Configuration JSON" -"output": { - "schemaTypes": { - "moduleType": { - "embeddedInTarget": { - "name": "MyApplicationTarget", - "accessModifier": "internal" - } - }, - "path": "./generated/schema/" - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput( - path: "./generated/schema/", - moduleType: .embeddedInTarget(name: "MyApplicationTarget", accessModifier: .internal) - ) - ... - ) -) -``` - - - -#### Swift package manager - -**[`ModuleType.swiftPackageManager`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum/swiftpackagemanager)** - -This option automates the creation of an SPM package for your schema types. This generates a `Package.swift` file that is suitable for linking the generated schema types files to your project using Swift Package Manager. - -The schema types will be contained in a stand-alone module with the [`schemaNamespace`](#schema-namespace) provided. Other targets in your application that contain generated operation models must have a dependency on this target. - -For multi-module projects using Swift Package Manager, this is the recommended configuration option. - -> **Including schema types in your own `Package.swift` file:** -> -> This option generates an SPM package with its own `Package.swift` file. This is ideal if you want to share your schema module across multiple projects or using Xcode's Package Dependency GUI. -> -> If you would like to include your schema module as a target in your own `Package.swift` file, you can define a target with the name and path of the generated files in your `Package.swift` file. - - - -```json title="CLI Configuration JSON" -"output": { - "schemaTypes": { - "moduleType": { - "swiftPackageManager": {} - }, - "path": "./generated/schema/" - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput( - path: "./generated/schema/", - moduleType: .swiftPackageManager - ) - ... - ) -) -``` - - - -#### Other schema module types - -**[`ModuleType.other`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum/other)** - -This value should be used when you would like to define a schema module using another package management system (such as CocoaPods), or you want more control over the generated package than what [`ModuleType.swiftPackageManager`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum/swiftpackagemanager) allows, or manually creating your own targets or modules in another way. - -`ModuleType.other` indicates to the Code Generation Engine that your schema types will be contained in their own target, rather than embedded in your application target. This affects the `import` statements in your generated operation definition files. - -Using this option, you are required to create a target, or module, for your schema module using your preferred package manager. - -> **Note:** You must specify the name of the target, or module, you created in the [`schemaNamespace`](#schema-namespace) property of your configuration. This will be used for `import` statements as well as to fully qualify the referenced types in generated operation files. - - - -```json title="CLI Configuration JSON" -"output": { - "schemaTypes": { - "moduleType": { - "other": {} - }, - "path": "./generated/schema/" - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput( - path: "./generated/schema/", - moduleType: .other - ) - ... - ) -) -``` - - - -### Operations - -Operation files are generated from all the GraphQL operation definitions matched by your configuration's [`operationSearchPaths`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/fileinput/operationsearchpaths). Each operation (query, mutation, or subscription) and fragment definition will be created in a separate file. - -> To learn more about GraphQL operations, check out [Defining operations](../fetching/fetching-data#defining-operations) - -The `output.operations` property value determines the location of the generated operation files: - -| Value | Description | -| ----- | ----------- | -| [`inSchemaModule`](#operations-in-the-schema-module) | Operation models will be included in the schema types module. | -| [`relative(subpath:accessModifier:)`](#relative-operations-output) | Operation models will be output relative to their defining `.graphql` files. | -| [`absolute(path:accessModifier:)`](#absolute-operations-output) | All operation object files will be located in the specified path. | - -#### Operations in the schema module - -**[`OperationsFileOutput.inSchemaModule`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/operationsfileoutput/inschemamodule)** - -This option includes the generated operation models in the same module as your schema types. - -This means the output location or your operation models is determined by the [`output.schemaTypes.path`](#schema-types) option. When using this option the directory of your schema module will include a `Schema` folder for your schema types, as well as folders for your [operations](./../fetching/fetching-data#defining-operations), [fragments](./../fetching/fragments), and [local cache mutations](./../caching/cache-transactions#defining-local-cache-mutations). - -> When using this option, generated operation models are expected to be included in the same target as the schema types. Therefore they will not include `import` statements to import the schema module. - -#### Relative operations output - -**[`OperationsFileOutput.relative(subpath: String?, accessModifier: AccessModifier)`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/operationsfileoutput/relative(subpath:accessModifier:))** - -This option outputs your generated operation models relative to their GraphQL definition (`.graphql` files). - -Using relative operation outputs, you have complete control over where your operation definitions are generated. It is common practice to co-locate your operation and fragment models with the parts of your project that will use them. - -An optional `subpath` parameter can be provided to generate operation models in a subfolder that will be created within the directory of their defining GraphQL definition file. If no `subpath` is specified then all operation files will be generated alongside thier GraphQL definition files. Use the `accessModifier` property to control the visibility of the generated code. - -> #### **Operation Models in a multi-module project:** -> -> If your project constists of multiple modules you can use relative operation output, to generate operation models into directories that are part of different modules in your project. In order to generate relative operation models for a multi-module project, all of your operation models should be generated at the same time. This means the Code Generation Engine should be run in a context that has access to the source files of all of your modules. -> -> After generating your operation models ensure that: -> -> - All modules containing generated operation models are linked to the target containing your schema types. -> - All fragments referenced by your operation models are either: -> - Included in the same target as the referencing operation; or -> - Included in the schema module directly -> -> *In the future, we plan to allow you to include fragments in other modules and share them between multiple modules in your project.* - -#### Absolute operations output - -**[`OperationsFileOutput.absolute(path: String, accessModifier: AccessModifier)`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/operationsfileoutput/absolute(path:accessModifier:))** - -This option outputs all of your generated operation models in a single directory. - -Specify the directory for your operation models using the `path` parameter. This is resolved as a relative path from the directory containing your `apollo-codegen-config.json` file when using the CLI. Use the `accessModifier` property to control the visibility of the generated code. - -### Test mocks - -**[`output.testMocks: TestMockFileOutput`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/testmockfileoutput)** - -Test mock objects can be created for your operation models, to configure whether test mocks are generated and how they are added to your project, use this option. - -> To learn more about using test mocks to mock your operation models, see the [Test mocks documentation](./../testing/test-mocks). - -The `output.testMocks` option can be configured with the following values: - -| Value | Description | -| ----- | ----------- | -| [`none`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/testmockfileoutput/none) | Test mocks will not be generated. | -| [`swiftPackage(targetName:)`](#test-mocks-in-a-swift-package) | Test mock files will be generated and included in a target defined in an SPM package. | -| [`absolute(path:accessModifier:)`](#absolute-test-mocks-output) | Test mock files will be generated at the specified path. | - -#### Test mocks in a Swift Package - -**[`TestMockFileOutput.swiftPackage(targetName: String?)`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/testmockfileoutput/swiftpackage(targetname:))** - -This option generates test mock files and defines a target in the schema modules generated `Package.swift` file that is suitable for linking the test mock files to your test target using Swift Package Manager. - -The name of the test mock target can be specified with the `targetName` parameter. If no `targetName` is provided, the target name defaults to `"${schemaNamespace}TestMocks"`. - -> **Note:** Using this option requires your [`output.schemaTypes.moduleType`](#module-type) to be [`.swiftPackageManager`](#swift-package-manager). If this option is provided without the `.swiftPackageManager` module type, code generation will fail. - -#### Absolute test mocks output - -**[`TestMockFileOutput.absolute(path: String, accessModifier: AccessModifier)`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/testmockfileoutput/absolute(path:accessModifier:))** - -This option outputs all of your generated test mocks in a single directory. - -Specify the directory for your test mocks using the `path` parameter. This is resolved as a relative path from the directory containing your `apollo-codegen-config.json` file when using the CLI. Use the `accessModifier` property to control the visibility of the generated code. - -> **Note:** When using this option, you are responsible for ensuring the generated test mocks are linked to your test target. -> -> Test mocks generated this way may also be manually embedded in a test utility module that is imported by your test target. - -## Output options - -The code generation engine supports a number of configuration options to change the behaviour of the generator and tailor the generated Swift code to your specific needs. - -The top-level properties are: - -| Property Name | Description | -| ------------- | ----------- | -| [`additionalInflectionRules`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/additionalinflectionrules) | Any non-default rules for pluralization or singularization of type names. | -| [`deprecatedEnumCases`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/deprecatedenumcases) | Annotate generated Swift enums with the Swift `@available` attribute for GraphQL enum cases annotated with the built-in [`@deprecated` directive](https://spec.graphql.org/draft/#sec--deprecated). | -| [`schemaDocumentation`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/schemadocumentation) | Include or exclude [schema documentation](https://spec.graphql.org/draft/#sec-Descriptions) in the generated files. | -| [`selectionSetInitializers`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/selectionsetinitializers) | Generate initializers for your generated selection set models. | -| [`operationDocumentFormat`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/operationdocumentformat) | How to generate the operation documents for your generated operations. This can be used to generate operation identifiers for use with a server that supports [Persisted Queries or Automatic Persisted Queries](./../fetching/persisted-queries) | -| [`cocoapodsCompatibleImportStatements`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/cocoapodscompatibleimportstatements) | Generate import statements that are compatible with including `Apollo` via Cocoapods. | -| [`warningsOnDeprecatedUsage`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/warningsondeprecatedusage) | Annotate generated Swift code with the Swift `@available` attribute and `@deprecated` argument for parts of the GraphQL schema annotated with the built-in [`@deprecated` directive](https://spec.graphql.org/draft/#sec--deprecated). | -| [`conversionStrategies`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/conversionstrategies) | Rules for how to convert the names of values from the schema in generated code. | -| [`pruneGeneratedFiles`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/prunegeneratedfiles) | Whether unused generated files will be automatically deleted. | -| [`markOperationDefinitionsAsFinal`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/markOperationDefinitionsAsFinal) | Whether generated GraphQL operation and local cache mutation class types will be marked as `final`. | - - - -```json title="CLI Configuration JSON" -"options": { - "additionalInflectionRules": [{ - "pluralization": { - "replacementRegex": "animals", - "singularRegex": "animal" - } - }], - "deprecatedEnumCases": "include", - "schemaDocumentation": "include", - "selectionSetInitializers" : { - "operations": false, - "namedFragments": false, - "localCacheMutations" : true, - "definitionsNamed": [ - "MyOperation", - "MyFragment" - ] - }, - "operationDocumentFormat" : ["definition", "operationId"], - "cocoapodsCompatibleImportStatements": false, - "warningsOnDeprecatedUsage": "include", - "conversionStrategies": { - "enumCases": "camelCase", - "fieldAccessors": "default" - }, - "pruneGeneratedFiles": true, - "markOperationDefinitionsAsFinal": true -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - options: ApolloCodegenConfiguration.OutputOptions( - additionalInflectionRules: [ - .pluralization( - singularRegex: "animal", - replacementRegex: "animals" - ) - ], - deprecatedEnumCases: .include, - schemaDocumentation: .include, - selectionSetInitializers: [ - .localCacheMutations, - .operation(named: "MyOperation"), - .fragment(named: "MyFragment) - ], - operationDocumentFormat: [.document, .operationId], - cocoapodsCompatibleImportStatements: false, - warningsOnDeprecatedUsage: .include, - conversionStrategies: ApolloCodegenConfiguration.ConversionStrategies( - enumCases: .camelCase, - fieldAccessors: .default - ), - pruneGeneratedFiles: true, - markOperationDefinitionsAsFinal: true - ) -) -``` - - - -## Experimental features - -The code generation engine supports some behaviors where the affect on the generated code is considered experimental. An example of this is a specification of the GraphQL schema that is not yet formalized and undergoing change as the proposal advances. - -> Note: These features could change at any time and are not guaranteed to always be available. - -The current supported experimental features are: - -| Value | escription | -| ----- | ----------- | -| [`clientControlledNullability`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/experimentalfeatures-swift.struct/clientcontrollednullability) | If enabled, codegen will understand and parse Client Controlled Nullability. Read the [RFC](https://github.com/graphql/graphql-spec/issues/867) for more detail. | -| [`legacySafelistingCompatibleOperations`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/experimentalfeatures-swift.struct/legacysafelistingcompatibleoperations) | If enabled, the generated operations will be transformed using a method that attempts to maintain compatibility with the legacy behavior from [`apollo-tooling`](https://github.dev/apollographql/apollo-tooling) for registering persisted operation to a safelist.

*Note: Safelisting queries is a deprecated feature of Apollo Server that has reduced support for legacy use cases. This option may not work as intended in all situations.* | - - - -```json title="CLI Configuration JSON" -"experimentalFeatures": { - "clientControlledNullability": false, - "legacySafelistingCompatibleOperations": false -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - experimentalFeatures: ApolloCodegenConfiguration.ExperimentalFeatures( - clientControlledNullability: false, - legacySafelistingCompatibleOperations: false - ) -) -``` - - - -## Schema download configuration - -An optional step in the code generation process is to fetch a GraphQL schema from a remote server. This step ensures that you always have an up-to-date schema on which to base your operations and it eliminates the need to manually download the schema outside of the automated process. - -The properties to configure the schema download are: - -| Property Name | Description | -| ------------- | ----------- | -| [`downloadMethod`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.property) | How to download the schema. | -| [`downloadTimeout`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadtimeout) | The maximum time (in seconds) to wait before indicating that the download timed out. | -| [`headers`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/headers) | Any additional headers to include when retrieving your schema. This is useful when the schema download requires authentication. | -| [`outputPath`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/outputpath) | The local path where the downloaded schema should be written to. | - -### Download method - -There are two supported sources for fetching a GraphQL schema: - -#### 1. Apollo server registry - -The Apollo schema registry serves as a central hub for managing your graph. - -The properties you will need to configure are: - -| Property Name | Description | -| ------------- | ----------- | -| [`apiKey`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/apolloregistrysettings/apikey) | API key to use when retrieving your schema from the Apollo Registry. | -| [`graphID`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/apolloregistrysettings/graphid) | Identifier of the graph to fetch. Can be found in Apollo Studio. | -| [`variant`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/apolloregistrysettings/variant) | Variant of the graph in the registry. | - - - -```json title="CLI Configuration JSON" -"schemaDownload": { - "downloadMethod": { - "apolloRegistry": { - "_0": { - "graphID": "your-graphid", - "apiKey": "your-api-key", - "variant": "current" - } - } - }, - "downloadTimeout": 60, - "headers": { - "Accept-Encoding" : "gzip", - "Authorization" : "Bearer " - }, - "outputPath": "./graphql/" -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - schemaDownload: ApolloSchemaDownloadConfiguration( - using: .apolloRegistry(.init( - apiKey: "your-api-key", - graphID: "your-graphid", - variant: "current")), - timeout: 60.0, - headers: [ - .init(key: "Accept-Encoding", value: "gzip"), - .init(key: "Authorization", value: "Bearer ") - ], - outputPath: "./graphql/") -) -``` - - - -#### 2. [GraphQL introspection](https://spec.graphql.org/draft/#sec-Introspection) - -A GraphQL service supports introspection over its schema. - -> **Note:** Many production servers disable introspection for security reasons. If your introspection query is failing check that it is not disabled. - -The properties you will need to configure are: - -| Property Name | Description | -| ------------- | ----------- | -| [`endpointURL`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/introspection(endpointurl:httpmethod:outputformat:includedeprecatedinputvalues:)) | URL of the GraphQL introspection service. | -| [`httpMethod`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/httpmethod) | HTTP request method. | -| [`outputFormat`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/outputformat) | Output format for the downloaded schema. | -| [`includeDeprecatedInputValues`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration/downloadmethod-swift.enum/introspection(endpointurl:httpmethod:outputformat:includedeprecatedinputvalues:)) | Specify whether input values annotated with the built-in `@deprecated` directive should be included in the fetched schema. | - - - -```json title="CLI Configuration JSON" -"schemaDownload": { - "downloadMethod": { - "introspection": { - "endpointURL": "https://server.com", - "httpMethod": { - "POST": {} - }, - "includeDeprecatedInputValues": false, - "outputFormat": "SDL" - } - }, - "downloadTimeout": 60, - "headers": [], - "outputPath": "./graphql/" -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - schemaDownload: ApolloSchemaDownloadConfiguration( - using: .introspection( - endpointURL: URL(string: "https://server.com")!), - timeout: 60.0, - headers: [], - outputPath: "./graphql/") -) -``` - - - -For more details, see the section on [downloading a schema](./downloading-schema). - -## Operation Manifest Configuration - -Optional settings used to configure generation of the operation identifier manifest for use with [Persisted Queries](./../fetching/persisted-queries). - -| Property Name | Description | -| ------------- | ----------- | -| `path` | Local path where the generated operation manifest file should be written. | -| [`version`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/operationmanifestfileoutput/version) | The version format to use when generating the operation manifest. | -| [`generateManifestOnCodeGeneration`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/operationmanifestconfiguration/generateManifestOnCodeGeneration) | Whether or not the operation manifest should be generated every time code generation is run. Defaults to false. | - - - -```json title="CLI Configuration JSON" -"operationManifest" : { - "generateManifestOnCodeGeneration" : false, - "path" : "/operation/identifiers/path", - "version" : "persistedQueries" -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - operationManifest: .init( - path: "./manifest/operationManifest.json", - version: .persistedQueries, - generateManifestOnCodeGeneration: false - ) -) -``` - - - -## Full Codegen Configuration Example - -Below is an example that illustrates an `apollo-codegen-config.json` where every available option is configured in some way to show its usage and formatting: - -```json title="apollo-codegen-config.json" -{ - "schemaNamespace" : "MySchema", - "schemaDownload": { - "downloadMethod": { - "introspection": { - "endpointURL": "https://server.com", - "httpMethod": { - "POST": {} - }, - "includeDeprecatedInputValues": false, - "outputFormat": "SDL" - } - }, - "downloadTimeout": 60, - "headers": [], - "outputPath": "./graphql/" - }, - "experimentalFeatures" : { - "clientControlledNullability" : true, - "legacySafelistingCompatibleOperations" : true - }, - "operationManifest" : { - "generateManifestOnCodeGeneration" : false, - "path" : "/operation/identifiers/path", - "version" : "persistedQueries" - }, - "input" : { - "operationSearchPaths" : [ - "/search/path/**/*.graphql" - ], - "schemaSearchPaths" : [ - "/path/to/schema.graphqls" - ] - }, - "output" : { - "operations" : { - "absolute" : { - "accessModifier" : "internal", - "path" : "/absolute/path" - } - }, - "schemaTypes" : { - "moduleType" : { - "embeddedInTarget" : { - "accessModifier" : "public", - "name" : "SomeTarget" - } - }, - "path" : "/output/path" - }, - "testMocks" : { - "swiftPackage" : { - "targetName" : "SchemaTestMocks" - } - } - }, - "options" : { - "additionalInflectionRules" : [ - { - "pluralization" : { - "replacementRegex" : "animals", - "singularRegex" : "animal" - } - } - ], - "cocoapodsCompatibleImportStatements" : true, - "conversionStrategies" : { - "enumCases" : "none", - "fieldAccessors" : "camelCase" - }, - "deprecatedEnumCases" : "exclude", - "operationDocumentFormat" : [ - "definition" - ], - "pruneGeneratedFiles" : false, - "schemaDocumentation" : "exclude", - "selectionSetInitializers" : { - "localCacheMutations" : true - }, - "warningsOnDeprecatedUsage" : "exclude" - } -} -``` \ No newline at end of file diff --git a/docs/source/code-generation/downloading-schema.mdx b/docs/source/code-generation/downloading-schema.mdx deleted file mode 100644 index f6834ca22d..0000000000 --- a/docs/source/code-generation/downloading-schema.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Downloading a schema ---- - -Apollo iOS requires a GraphQL schema file as input to its code generation process. You can provide your schema either in JSON format (most commonly the result of an introspection query) or in GraphQL SDL (Schema Definition Language). - -> Conventionally, JSON files have the `.json` extension and SDL files use the `.graphqls` extension. - -There are a few ways to download a GraphQL schema: - -### 1. Apollo Studio - -Apollo Studio is a cloud platform that helps you build, validate, and secure your organization's graph. - -In the SDL view of the Schema tab of Apollo Studio there is a drop-down menu where you can download the linked schema in SDL or JSON format. - -Below is a screenshot showing the [StarWars GraphQL API](https://studio.apollographql.com/public/star-wars-swapi/home?variant=current) in an Apollo Studio [public example](https://studio.apollographql.com/public/star-wars-swapi/schema/sdl?variant=current). On the right-hand side you can see the drop-down allowing downloads of both formats. - -Where to download a schema from Apollo Studio - -Please see the [documentation](https://www.apollographql.com/docs/studio/) for further details on how to use Apollo Studio. - -### 2. Codegen CLI - -The Codegen CLI provides a convenient command-line tool for fetching a GraphQL schema and writing it to a file. - -> See the documentation on the [`fetch-schema`](./codegen-cli#fetch-schema) command for details on how to use it. - -The codegen CLI also supports fetching a GraphQL schema as an initial step in the code generation process. This automates fetching the schema and ensures you are always using the most up-to-date schema. - -> See the documentation on the [`generate`](./codegen-cli#generate) command for details on how to use it. - -The Apollo schema registry and GraphQL introspection are both supported as methods for downloading. - -#### Apollo schema registry - -The Apollo schema registry serves as a central hub for managing your graph. At its core, the schema registry is a version control system for schemas. It stores a schema's change history, tracking the types and fields that were added, modified, and removed. In order to fetch a schema from the schema registry using the codegen CLI you will need credentials detailed in [Schema download configuration](./codegen-configuration#1-apollo-server-registry). - -#### GraphQL introspection - -GraphQL introspection enables you to query a GraphQL server for information about the underlying schema. This includes data like types, fields, queries, mutations, and even the field-level descriptions. - -> See the GraphQL spec for full details on the [introspection](https://spec.graphql.org/draft/#sec-Introspection) feature. - -> **Note:** Many production servers disable introspection for security reasons. If your introspection query is failing check that it is not disabled. diff --git a/docs/source/code-generation/introduction.mdx b/docs/source/code-generation/introduction.mdx deleted file mode 100644 index 133b219c1d..0000000000 --- a/docs/source/code-generation/introduction.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Code generation ---- - -Apollo iOS generates operation objects for your GraphQL operations, providing a type-safe way to construct operations and provide values for input variables in your Swift code. - -Each generated operation contains a set of robust, strongly-typed models for its response. These generated models help you access your GraphQL response data in a type-safe and flexible format. You don't need to deal with parsing JSON responses or passing around dictionaries of values that require manual casting. You also don't need to write model types yourself, because models are generated from the GraphQL operations you define. - -Because generated response models are operation-specific, they include properties _only_ for the GraphQL fields included in their corresponding operation. This means you can rely on the Swift type checker to flag data access errors at compile time. - -> Check out our step-by-step tutorial on how to [get started with Apollo iOS code generation](./../tutorial/codegen-getting-started). - -## GraphQL source files - -To generate models, Apollo iOS requires two input sources: - -1. **A GraphQL schema** - -The **GraphQL schema** is a list of all of the types that are available and the fields you can query on those types. The schema can be thought of as a contract of what it's _possible_ to ask for. - -A schema is provided by every GraphQL server. You can generally get your schema from your server via an introspection query or from [Apollo Studio](https://www.apollographql.com/docs/studio/). - -> Apollo iOS provides tools to help you obtain your GraphQL schema. See [Downloading a schema](./downloading-schema/) for more details. - -2. **A set of GraphQL operations and fragments** - -A **GraphQL operation** defines an interaction with your schema. A GraphQL operation can be a query, a mutation, or a subscription. All operations define a set of fields from the types in your schema to fetch data for. The operation definition determines what the response your GraphQL server provides will include. - -Your operation input sources can also include files that define [GraphQL fragments](./../fetching/fragments). These fragments can be referenced by your operation definitions. - -In order for Apollo to generate useful models, **you must define at least one operation**. This tells us what data you would like to fetch. - -> For more information on GraphQL operation definitions see [Defining operations](../fetching/fetching-data#defining-operations). - -All of the GraphQL operation files that you specify as input sources will be merged into a single GraphQL document. Fragments defined in one file are available across all operation input sources. _This means operation and fragment names must be unique across all input sources._ - -Apollo iOS combines the type information from your schema with your operation definitions to generate models. The schema provides the information needed to generate type-safe models, and your operations define the shape and structure of the generated models. - -The Apollo iOS Code Generation Engine parses your schema and operations and ensures that your operations are valid to be performed against the schema provided. It generates models that include all of the necessary information to create type-safe operations, send those operations as network requests, and parse the response data onto the type-safe response models. - -There are many choices to be made about the shape of the generated models and how they are packaged to be used in your project. You specify this through a [code generation configuration](./codegen-configuration). - -The most basic way to think about these is with the following equation: - -**Schema + Operations + Configuration = Code** - -If you don't have any operations, our code generator won't know what information you want to fetch, so it can't generate the code to send a request or parse a result. If you don't provide a schema, our code generator won't know if your operations are valid or what types any of the fields you want to fetch will return, so it can't generate type-safe models. If you don't provide a configuration our code generator can only make general assumptions about the generated code which may not be the best choice for your needs. If you have all three, the appropriate checks can be made and type-safe code can be generated, in a precise way for your project. - -## Running code generation - -The Apollo code generation engine can be run using one of two methods: - -### [The Codegen CLI](./codegen-cli) - -**This is the recommended method for most use cases.** - -The [Codegen CLI](./codegen-cli) is the simplest way to get started with Apollo iOS. The correct version of the CLI is automatically bundled with our SPM and Cocoapod packages, so you never have to worry about installation or updates. - -### [Swift Scripting](./run-codegen-in-swift-code) - -For advanced use cases, you can include our code generation engine within your own Swift project. - -> To learn more about running code generation from Swift code, check out [Running codegen in Swift code](./run-codegen-in-swift-code). diff --git a/docs/source/code-generation/run-codegen-in-swift-code.mdx b/docs/source/code-generation/run-codegen-in-swift-code.mdx deleted file mode 100644 index 115788180c..0000000000 --- a/docs/source/code-generation/run-codegen-in-swift-code.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Running code generation in Swift code ---- - -For most use cases, the Apollo iOS [Codegen CLI](./codegen-cli) is the recommended method for generating code and downloading your schema. The CLI uses the `ApolloCodegenLib` to execute these operation. - -To enable advanced use, the `ApolloCodegenLib` can be included as a dependency of your own Swift projects. This enables you to use Swift scripting to perform operations that cannot be done with the CLI. Calling into the `ApolloCodegenLib` directly allows you to integrate Apollo into your development process however you would like. - -## Installing `ApolloCodegenLib` - -The `ApolloCodegenLib` is included as a product in the Apollo iOS SPM Package. - -> At this time, `ApolloCodegenLib` only supports `macOS`. You cannot run code generation scripts on other platforms. - -To use it within your own Swift project, just include it as a dependency. - -```swift title="Package.swift" -.target( - name: "MyApp", - dependencies: [ - .product(name: "ApolloCodegenLib", package: "apollo-ios"), - ] -) -``` - -> **Important:** Because code generation is tied to its usage in the Apollo iOS SDK, you make sure you are using the `ApolloCodegenLib` from the same version of the package as the application that uses your generated code. - -## Usage - -Once you've installed the `ApolloCodegenLib` dependency in your project, you can use it to: - -- [Installing `ApolloCodegenLib`](#installing-apollocodegenlib) -- [Usage](#usage) - - [Running code generation](#running-code-generation) - - [Downloading a schema](#downloading-a-schema) - -### Running code generation - -To configure and run code generation using `ApolloCodegenLib`, create an [`ApolloCodegenConfiguration`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration), then pass it to `ApolloCodegen.build(with configuration:withRootURL:itemsToGenerate:)` function. - -By default, the Code Generation Engine will resolve all file paths in your `ApolloCodegenConfiguration` relative to the current working directory. The `rootURL` parameter can be used to provide a local file path URL of the root of the project that you want to run code generation on. This will resolve file paths in your configuration relative to the provided `rootURL`. The [`itemsToGenerate`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegen/itemsToGenerate) parameter allows you to customize what items will be generated. If you don't provide options this will default to `[.code]` which will just generate code files in the same way code generation worked prior to this option set being added in version 1.4.0. - -```swift -import ApolloCodegenLib - -let configuration = ApolloCodegenConfiguration( - schemaNamespace: "MyGraphAPI", - input: ApolloCodegenConfiguration.FileInput( - schemaSearchPaths: ["**/*.graphqls"], - operationSearchPaths: ["**/*.graphql"] - ), - output: ApolloCodegenConfiguration.FileOutput( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput( - path: "./generated/schema/", - moduleType: .swiftPackageManager - ), - operations: .inSchemaModule, - testMocks: .none - ), - options: ApolloCodegenConfiguration.OutputOptions( - additionalInflectionRules: [ - .pluralization( - singularRegex: "animal", - replacementRegex: "animals" - ) - ], - queryStringLiteralFormat: .multiline, - deprecatedEnumCases: .include, - schemaDocumentation: .include, - apqs: .disabled, - cocoapodsCompatibleImportStatements: false, - warningsOnDeprecatedUsage: .include, - conversionStrategies: ApolloCodegenConfiguration.ConversionStrategies( - enumCases: .camelCase - ), - pruneGeneratedFiles: true - ) -) - -try! ApolloCodegen.build(with: configuration) -``` - -> For more information on the configuring code generation, see the [configuration documentation](./codegen-configuration). - -### Downloading a schema - -If you would like to download a GraphQL schema from you own Swift project, use the [`ApolloSchemaDownloader`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloader). - -The schema downloader can be configured with an [`ApolloSchemaDownloadConfiguration`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apolloschemadownloadconfiguration). - -```swift -import ApolloCodegenLib - -let configuration = ApolloSchemaDownloadConfiguration( - using: .introspection(endpointURL: endpoint, outputFormat: .SDL), - outputPath: outputURL.path -) - -try! ApolloSchemaDownloader.fetch(configuration: configuration) -``` - -> For more information on schema fetching, see [Downloading a schema](./downloading-schema). diff --git a/docs/source/config.json b/docs/source/config.json deleted file mode 100644 index 94118a4739..0000000000 --- a/docs/source/config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "title": "Client (iOS)", - "version": "v1", - "algoliaFilters": [ - "docset:apollo-ios" - ], - "sidebar": { - "Introduction": "/", - "Get Started": "/get-started", - "Project Configuration": "/project-configuration", - "Migration Guides": [ - { - "v1.0": "/migrations/1.0", - "v1.2": "/migrations/1.2", - "v1.3": "/migrations/1.3" - }, - true - ], - "Tutorial": [ - { - "Code Generation": "/tutorial/codegen-getting-started", - "Build a project with Apollo": [ - { - "Introduction": "/tutorial/tutorial-introduction", - "1. Configure your project": "/tutorial/tutorial-configure-project", - "2. Add the GraphQL schema": "/tutorial/tutorial-add-graphql-schema", - "3. Write your first query": "/tutorial/tutorial-write-your-first-query", - "4. Running code generation": "/tutorial/tutorial-running-code-generation", - "5. Execute your first query": "/tutorial/tutorial-execute-first-query", - "6. Connect your queries to your UI": "/tutorial/tutorial-connect-queries-to-ui", - "7. Add more info to the list": "/tutorial/tutorial-add-more-info-to-list", - "8. Paginate results": "/tutorial/tutorial-paginate-results", - "9. Complete the details view": "/tutorial/tutorial-complete-details-view", - "10. Write your first mutation": "/tutorial/tutorial-first-mutation", - "11. Authenticate your operations": "/tutorial/tutorial-authenticate-operations", - "12. Define additional mutations": "/tutorial/tutorial-define-additional-mutations", - "13. Write your first subscription": "/tutorial/tutorial-subscriptions" - }, - true - ] - }, - true - ], - "API Reference": [ - { - "Overview": "https://www.apollographql.com/docs/ios/docc/documentation/index", - "Apollo Client": "https://www.apollographql.com/docs/ios/docc/documentation/Apollo", - "ApolloAPI": "https://www.apollographql.com/docs/ios/docc/documentation/ApolloAPI", - "ApolloWebSocket": "https://www.apollographql.com/docs/ios/docc/documentation/ApolloWebSocket", - "ApolloSQLite": "https://www.apollographql.com/docs/ios/docc/documentation/ApolloSQLite", - "ApolloCodegenLib": "https://www.apollographql.com/docs/ios/docc/documentation/ApolloCodegenLib" - }, - true - ], - "Code Generation": [ - { - "Introduction": "/code-generation/introduction", - "The Codegen CLI": "/code-generation/codegen-cli", - "Configuration": "/code-generation/codegen-configuration", - "Downloading a Schema": "/code-generation/downloading-schema", - "Running Code Generation in Swift Code": "/code-generation/run-codegen-in-swift-code" - }, - true - ], - "Fetching": [ - { - "Fetching Data": "/fetching/fetching-data", - "Operations": [ - { - "Queries": "/fetching/queries", - "Mutations": "/fetching/mutations", - "Subscriptions": "/fetching/subscriptions", - "Fragments": "/fetching/fragments" - }, - true - ], - "Operation Arguments": "/fetching/operation-arguments", - "Error Handling": "/fetching/error-handling", - "Type Conditions": "/fetching/type-conditions", - "Custom Scalars": "/custom-scalars", - "Persisted Queries": "/fetching/persisted-queries" - }, - true - ], - "Caching": [ - { - "Introduction": "/caching/introduction", - "Setup": "/caching/cache-setup", - "Direct Cache Access": "/caching/cache-transactions", - "Custom Cache Keys": "/caching/cache-key-resolution" - }, - true - ], - "Networking": [ - { - "Creating a Client": "/networking/client-creation", - "Advanced Network Configuration": "/networking/request-pipeline" - }, - true - ], - "Development & Testing": [ - { - "Test Mocks": "/testing/test-mocks" - }, - true - ], - "Troubleshooting": [ - { - "Code Generation": "/troubleshooting/codegen-troubleshooting" - }, - true - ] - } -} diff --git a/docs/source/custom-scalars.mdx b/docs/source/custom-scalars.mdx deleted file mode 100644 index b4e1ae8b36..0000000000 --- a/docs/source/custom-scalars.mdx +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: Custom Scalars ---- - -In addition to its [built-in scalar types](https://graphql.org/learn/schema/#scalar-types) (`Int`, `String`, etc.), GraphQL supports defining [custom scalars](/apollo-server/schema/custom-scalars/). For example, your schema might provide a custom scalar for `Date`, `UUID`, or `GeoLocation`. - -Custom Scalars are initially defined as part of a schema. To interact with a schema using custom scalars, your client must define a Swift type to use for each custom scalar. - -Apollo iOS automatically defines Swift types for all of the [built-in scalar types](https://graphql.org/learn/schema/#scalar-types): - -| GraphQL Type | Swift Type | -| -------------|------------| -| `Int` | `Int` | -| `Float` | `Double` | -| `Boolean` | `Bool` | -| `String` | `String` | -| `ID` | `String` | - -By default, each custom scalar is treated as a Swift `String`, but you can customize the type of all of your custom scalars with Apollo iOS! - -## Generating custom scalar types - -If any part of your GraphQL application references a custom scalar defined by the schema, a file for it will be generated in your generated schema output. This file can be used to define the Swift type for the custom scalar. - -For example, in a schema that defines a custom scalar: - -```graphql title="MySchema.graphqls" - scalar UUID -``` - -Apollo iOS generates a `UUID` custom scalar type in your generated schema output. This generated file defines `UUID` as a `String` by default. - -```swift title="MySchema/CustomScalars/UUID.swift" -public extension MySchema { - typealias UUID = String -} -``` - -The `MySchema.UUID` type will be referenced in any other generated objects that reference the `UUID` scalar. - -Because custom scalar files are only generated once, they can then be edited, and your changes will never be overwritten by subsequent code generation execution. - -You can edit this file to define a different type for the `UUID` scalar type. - -> **Note:** Custom scalars may be referenced by fields on GraphQL types, values for input parameters, or on input objects. Because custom scalars are only generated when they are referenced by your operations, they may be added to your project during any future execution of code generation, not just on the initial execution. - -## Defining a custom scalar type - -You can define the type for a custom scalar by creating a new type, or by pointing the typealias to another existing type. - -The type for your custom scalar must conform to the [`CustomScalarType`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/customscalartype) protocol. This requires you to implement the JSON serialization functionality for your custom scalar type. - ---- - -To implement the [`CustomScalarType`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/customscalartype) protocol: - -#### 1. Implement the `_jsonValue` property. - -This converts the scalar value into a `JSONValue` that can be serialized into a JSON dictionary. The value of the `_jsonValue` property will be stored in the cache as the JSON value for the custom scalar. - -Usually, this should be identical to the value received from the network response to represent the custom scalar. - -#### 2. Implement the `init(_jsonValue:)` initializer. - -This initializer is used to construct the custom scalar value from a `JSONValue`. When constructing the scalar from a network response, the value of the `_jsonValue` parameter will be the value from the network response. When constructing the scalar from a cached value, this will be the value provided in the `_jsonValue` property. - -If the value provided is unrecognized, you should throw an error from this function. Apollo iOS provides [`JSONDecodingError`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/jsondecodingerror) in the `ApolloAPI` library, but you may throw any custom error you wish. - -#### 3. Implement the `Hashable` and `Equatable` protocols if needed. - -If your custom scalar type does not already conform to `Hashable` and `Equatable`, you will need to implement `hash(into:)` and the `==` operator to conform to each of these protocols respectively. - -### Example: `UUID` - -For example, you could point the `typealias` for `UUID` to the `Foundation.UUID` type: - -```swift title="MySchema/CustomScalars/UUID.swift" -import Foundation - -public extension MySchema { - typealias UUID = Foundation.UUID -} - -extension Foundation.UUID: CustomScalarType { - public init (_jsonValue value: JSONValue) throws { - guard let uuidString = value as? String, - let uuid = UUID(uuidString: uuidString) else { - throw JSONDecodingError.couldNotConvert(value: value, to: Foundation.UUID.self) - } - - self = uuid - } - - public var _jsonValue: JSONValue { - uuidString - } -} -``` - -### Example: `GeoPoint` - -Alternatively, you could create your own custom scalar type. In this case, replace the `typealias` with the new type. - -For example, a custom scalar `GeoPoint` that has a JSON representation of `"100.0,10.0"` could be implemented like this: - -```swift title="MySchema/CustomScalars/GeoPoint.swift" -import Foundation - -extension MySchema { - public struct GeoPoint: CustomScalarType, Hashable { - let x: Float - let y: Float - - public init (_jsonValue value: JSONValue) throws { - let coordinates = try (value as? String)? - .components(separatedBy: ",") - .map { try Float(_jsonValue: $0) } - - guard let coordinates, coordinates.count == 2 else { - throw JSONDecodingError.couldNotConvert(value: value, to: GeoPoint.self) - } - - self.x = coordinates[0] - self.y = coordinates[1] - } - - public var _jsonValue: JSONValue { - "\(String(format: "%.1f", x)),\(String(format: "%.1f", y))" - } - } -} -``` - -The `GeoPoint` struct conforms to both `CustomScalarType` and `Hashable`. You must explicitly declare the conformance to `Hashable`, which inherits `Equatable` conformance. Because Swift can synthesize the `Hashable` and `Equatable` conformancs here, you do not need to implement them. - -The `init(_jsonValue:)` initializer casts the `JSONValue` as a `String` and separates it into two coordinates. It converts those coordinates using `Float(_jsonValue:)` which is provided by Apollo. Each of the [built-in scalar types](https://graphql.org/learn/schema/#scalar-types) has JSON serialization support that you can use within your custom scalar implementations. - -To ensure consistency of the serialized JSON, the `_jsonValue` function ensures that the coordinates are formatted with a single decimal point using `String(format:,_:)`. - -## JSON and other custom scalars with multiple return types - -Some custom scalars are set up to potentially return multiple types at runtime. This is not ideal since you lose type safety, but if you're using an API you don't have control over, there's often not a great alternative to this. - -When this happens, because you don't know the type that's coming in, you can't set up a single `typealias` for that scalar. Instead, you need to define some other way of instantiating your custom scalar object. - -This happens most often with JSON, which can return either an array or a dictionary. Here's an example of how you can use an enum to allow dynamic-but-limited types to parse (with `CustomJSON` as a placeholder type name`): - -```swift title="MySchema/CustomScalars/CustomJSON.swift" -extension MySchema { - public enum CustomJSON: CustomScalarType, Hashable { - case dictionary([String: AnyHashable]) - case array([AnyHashable]) - - public init(_jsonValue value: JSONValue) throws { - if let dict = value as? [String: AnyHashable] { - self = .dictionary(dict) - } else if let array = value as? [AnyHashable] { - self = .array(array) - } else { - throw JSONDecodingError.couldNotConvert(value: value, to: CustomJSON.self) - } - } - - public var _jsonValue: JSONValue { - switch self { - case let .dictionary(json as AnyHashable), - let .array(json as AnyHashable): - return json - } - } - - public static func == (lhs: CustomJSON, rhs: CustomJSON) -> Bool { - lhs._jsonValue == rhs._jsonValue - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(_jsonValue) - } - } -} -``` diff --git a/docs/source/enums.mdx b/docs/source/enums.mdx deleted file mode 100644 index c52298a6fe..0000000000 --- a/docs/source/enums.mdx +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Enums ---- - -# UNDER CONSTRUCTION \ No newline at end of file diff --git a/docs/source/fetching/error-handling.mdx b/docs/source/fetching/error-handling.mdx deleted file mode 100644 index f56064e057..0000000000 --- a/docs/source/fetching/error-handling.mdx +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: Error Handling ---- - -Whenever you execute a GraphQL operation with two high-level types of errors can occur: - -- **Network errors**: a GraphQL response wasn't received because an error occurred while communicating with your GraphQL server. This might be an SSL error, a socket error because your app is offline, or a 500 or any other HTTP error. When a network error occurs, no data is returned. -- **GraphQL errors**: a GraphQL response is received, and it contains a non-empty [`errors`](https://spec.graphql.org/draft/#sec-Errors) field. This means the server wasn't able to completely process the query. The response might include partial data if the server was able to process some of the query. - -## Network errors - -The result of executing an operation is a Swift [`Result`](https://developer.apple.com/documentation/swift/result). A network error results in a `.failure(Error)` result for the operation. - -You can handle network errors by using a `do/catch` block and calling `try result.get()` or by switching on the `result`. - - - -```swift -apollo.fetch(query: HeroNameQuery()) { result in - do { - let data = try result.get().data - ... - - } catch { - // Network error - print(error) - } -} -``` - -```swift -apollo.fetch(query: HeroNameQuery()) { result in - switch result { - case .success(let response): - ... - - case .failure(let error): - // Network error - print(error) - } -} -``` - - - -### Causes - -Possible causes of a network error include (but are not limited to): - -* The app is offline or doesn't have access to the network. -* A DNS error occurred, making it impossible to look up the host. -* An SSL error occurred (e.g., the server certificate isn't trusted). -* The connection was closed. -* The server responded with a non-successful HTTP code. -* The server didn't respond with valid JSON. -* The response JSON doesn't satisfy the schema and cannot be parsed. -* A request was specified as `.returnCacheDataDontFetch` but the data wasn't cached. - -Examine the exception for more detailed information about the actual error. - -## GraphQL errors - -Because a response with GraphQL errors might still contain data, a `.failure` result is not returned. Instead, they return a `.success` result containing a [`GraphQLResult`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/graphqlresult) whose `errors` field contains the errors that occurred. - -For example, the following query uses an invalid `id` to look up a `Person`: - -```graphql -query FilmAndPersonQuery { - film(id: "ZmlsbXM6M") { - title - } - person(id: "badId") { - name - } -} -``` - -The server will send the following response: - -```json -{ - "data": { - "film": { - "title": "A New Hope" - }, - "person": null - }, - "errors": [ - { - "message": "No entry in local cache for https://swapi.dev/api/people/m�H/", - "locations": [ - { - "line": 35, - "column": 3 - } - ], - "path": [ - "person" - ] - } - ] -} -``` - -Note that while there are errors, the query successfully returned the title of the film: `A New Hope`. In general, any error while executing an operation [bubbles up](https://spec.graphql.org/draft/#sec-Errors) to the next nullable field. In this case `data?.person` is `nil`. In the worst case, `GraphQLResult.data` may be `nil` if everything else is non-nullable. - -Apollo iOS gives you access to both the `data` and the `errors` in the [`GraphQLResult`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/graphqlresult) class: - -```swift -apollo.fetch(query: HeroNameQuery()) { result in - switch result { - case .success(let response): - if let errors = response.errors { - // GraphQL errors - } - - let film = response.data?.film // Exists - let person = response.data?.person // nil - - case .failure(let error): - // Network error - print(error) - } -} -``` - -GraphQL errors are returned as type-safe [`GraphQLError`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/graphqlerror) values. These values are parsed from the response as described in the section on [response format errors in the GraphQL specification](https://spec.graphql.org/October2021/#sec-Errors). diff --git a/docs/source/fetching/fetching-data.mdx b/docs/source/fetching/fetching-data.mdx deleted file mode 100644 index 74364a4eda..0000000000 --- a/docs/source/fetching/fetching-data.mdx +++ /dev/null @@ -1,204 +0,0 @@ ---- -title: Fetching Data ---- - -Fetching data in a predictable, type-safe way is one of the core features of Apollo iOS. In this guide, you'll learn how to execute an operation against a GraphQL endpoint and use the result in your application. - -## Prerequisites -This page assumes some familiarity with building GraphQL operations. For a refresher, we recommend [reading this guide](http://graphql.org/learn/queries/) and practicing [running operations in Apollo Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fswapi-graphql.netlify.app%2F.netlify%2Ffunctions%2Findex&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAOIIoBiAlgDZwDORwAOkkUQIY03V2Mtt2RAGa0GTVkKEoqKGgklCAvopVIlIADQgAbhzxUOAI3n0MIEEqA&_gl=1*1e24cus*_ga*MTk0Mjk2MDI3Mi4xNjU3NTYxOTc1*_ga_0BGG5V2W2K*MTY2NDIzNTkzMy41NS4xLjE2NjQyMzcwMDguMC4wLjA.). - -Because Apollo iOS uses standard GraphQL syntax, any operation you can run in Sandbox can also be put into the `.graphql` files in your project. - -> *Exception: Apollo iOS does requires every query to have a name (even though this isn't required by the GraphQL spec)* - -This page also assumes that you've already set up Apollo iOS for your application. For help with setup, see the [getting started guide](./../get-started). - -## Defining operations - -In Apollo iOS, each operation you execute is represented as an instance of a generated class that implements the [`GraphQLOperation`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/graphqloperation) protocol. Constructor arguments can be used to define operation variables if needed. You can then pass an operation object to an `ApolloClient` to send the operation to the server, execute it, and receive strongly typed results. - -GraphQL operations can be [queries](./queries), [mutations](./mutations), or [subscriptions](./subscriptions). For more information on using each of these operation types, see their individual usages guides. - -To generate these classes, we first need to define the GraphQL operations we want to execute. - -> For more information about how Apollo iOS generates your operation classes, see [Code Generation](./../code-generation/introduction). - -Let's say we define a GraphQL query named `HeroName`: - -```graphql -query HeroName { - hero { - id - name - } -} -``` - -Apollo iOS will generate a `HeroNameQuery` class that you can construct and pass to `ApolloClient.fetch(query:)`: - -```swift -apollo.fetch(query: HeroNameQuery()) { result in - guard let data = try? result.get().data else { return } - print(data.hero.name) // Luke Skywalker -} -``` - -To learn about defining operations that take arguments, see [Operation Arguments](./operation-arguments). - -## Generated operation models - -An operation's results are returned as a hierarchy of immutable structs that match the structure of the operations's fields. These structs only include fields that are included in the operation (other schema fields are omitted). - -In other words, Apollo iOS generates result types based on the operations you write, not based on the schema you query against. - -For example, given the following schema: - -```graphql -type Query { - hero: Character! -} - -interface Character { - id: String! - name: String! - friends: [Character!] - appearsIn: [Episode]! - } - - type Human implements Character { - id: String! - name: String! - friends: [Character] - appearsIn: [Episode]! - height(unit: LengthUnit = METER): Float - } - - type Droid implements Character { - id: String! - name: String! - friends: [Character] - appearsIn: [Episode]! - primaryFunction: String -} -``` - -And the following query: - -```graphql -query HeroAndFriendsNames { - hero { - id - name - friends { - id - name - } - } -} -``` - -Apollo iOS generates a type-safe model that looks something like this (details are omitted to focus on the class structure): - -```swift -class HeroAndFriendsNamesQuery: GraphQLQuery { - struct Data: SelectionSet { - let hero: Hero - - struct Hero: SelectionSet { - let id: String - let name: String - let friends: [Friend]? - - struct Friend: SelectionSet { - let id: String - let name: String - } - } - } -} -``` - -Because the `HeroAndFriendsNames` query doesn't fetch `appearsIn`, this property is not part of the returned result type and cannot be accessed here. Similarly, `id` is only accessible in `Friend`, not in `Hero`. - -Because GraphQL supports nullability, you have compile-time type safety. If the request is successful, all queried data (and only this data) will be accessible. There is no need to handle null fields in UI code. - -> For more information on how to fetch type-safe data, learn about [type conditions](./type-conditions#accessing-conditional-response-data). - -## Operation result handling - -The result of executing an operation is a Swift [`Result`](https://developer.apple.com/documentation/swift/result) whose `.success` case contains a [`GraphQLResult`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/graphqlresult) where `Data` is the generated root `Data` struct of the operation that was executed. - -You can call `try result.get().data` to obtain the `Data` object from the result. If you would like to handle error's or inspect the result's metadata, you can `switch` on the result like this: - -```swift -apollo.fetch(query: HeroNameQuery()) { result in - switch result { - case .success(let graphQLResult): - if let name = graphQLResult.data?.hero?.name { - print(name) // Luke Skywalker - } else if let errors = graphQLResult.errors { - // GraphQL errors - print(errors) - } - case .failure(let error): - // Network or response format errors - print(error) - } -} -``` -> **Note:** An operation can be successful, but the `GraphQLResult` may still include `GraphQLErrors`. See [Error Handling](./fetching/../error-handling) for more information. - -## Handling operation results in the background - -By default, Apollo will deliver operation results **on the main thread**, which is probably what you want if you're using them to update the UI. - -If you want your result handler to be called on a background queue, the `fetch(query:)`, `perform(mutation:)` and `subscribe(subscription:)` functions take an optional `queue:` parameter. - -```swift -apollo.fetch( - query: HeroNameQuery(), - queue: DispatchQueue.global(qos: .background), -) { result in - ... // Will be called on a background queue -} -``` - -## Fetching locally cached data - -Apollo iOS uses a [normalized cache](./../caching/introduction#what-is-a-normalized-cache) to store your GraphQL response data locally. This allows you to retrieve operation data that has been previously fetched without waiting for an additional network request. You can configure how your fetch requests interact with the cache using cache policies. - -### Cache policies - -`ApolloClient`'s `fetch(query:)` method takes an optional `cachePolicy` that allows you to specify when results should be fetched from the server, and when data should be loaded from the local cache. - -By default, each request uses the `.returnCacheDataElseFetch` cache policy, which means data will be loaded from the cache when available, and fetched from the server otherwise. - -The cache polices which you can specify are: - -- **`.fetchIgnoringCacheData`** - - Always fetch from the server, but still store results to the cache. -- **`.fetchIgnoringCacheCompletely`** -- Always fetch from the server, and do not store results from the cache. - - If you're not using the cache at all, this method is preferred to `fetchIgnoringCacheData` for performance reasons. -- **`.returnCacheDataAndFetch`** - - Return data from the cache if its available; *then* perform a fetch to see if there are any updates; store results in the cache. - - This is useful if you are [watching queries](./queries#watching-queries), since those will be updated when the call to the server returns. -- **`.returnCacheDataDontFetch`** - - Return data from the cache; never fetch from the server. - - This policy will return an error if cached data is not available. -- **`.returnCacheDataElseFetch`** - *(Default Value)* - - Return data from the cache if its available; if cache data is missing or incomplete, fetch data from the server and store results in the cache. - - This is the most common use case, and is the most performant method if your data is not expected to change. - - If you do not need to check for updates to data once it's been fetched, you should usually use this cache policy. - -> If you're interested in returning cached data after a failed fetch, the current recommended approach is to use an `additionalErrorInterceptor` on your interceptor chain to examine if the error is one it makes sense to show old data for rather than something that needs to be passed on to the user, and then retrying with a `.returnCacheDataDontFetch` retry policy. An example of this setup can be found in the [Cache-dependent interceptor tests](https://github.com/apollographql/apollo-ios/blob/main/Tests/ApolloTests/Cache/CacheDependentInterceptorTests.swift). - -For more information on how result data is stored in the cache data or how to configure the normalized cache, see the [Caching documentation](./../caching/introduction). - -## Using `GET` instead of `POST` for queries - -By default, Apollo constructs queries and sends them to your graphql endpoint using `POST` with the JSON generated. - -If you want Apollo to use `GET` instead, pass `true` to the optional `useGETForQueries` parameter when setting up your `RequestChainNetworkTransport`. This will set up all queries conforming to `GraphQLQuery` sent through the HTTP transport to use `GET`. - ->**NOTE:** This is a toggle which affects all queries sent through that client, so if you need to have certain queries go as `POST` and certain ones go as `GET`, you will likely have to swap out the `RequestChainNetworkTransport`. diff --git a/docs/source/fetching/fragments.mdx b/docs/source/fetching/fragments.mdx deleted file mode 100644 index 9909ca3141..0000000000 --- a/docs/source/fetching/fragments.mdx +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: Fragments ---- - -The GraphQL spec defines two types of [fragments](http://graphql.org/learn/queries/#fragments): -- [Named fragments](#named-fragments), which enable you to reuse a set of fields across multiple operations or selection sets. -- [Inline fragments](#inline-fragments), which can group fields and apply type conditions or directives but are *not* reusable. - -Both named and inline fragments can be used as [type conditions](./type-conditions), which enables you to access fields of [polymorphic types](https://www.apollographql.com/docs/apollo-server/schema/unions-interfaces/). - -> Read the [guide on type conditions](./type-conditions) to learn more. - -## Named fragments - -A named fragment is defined in a `.graphql` file, just like an operation definition. A named fragment always has a name and a "parent type", that is, the type in the schema that it can be applied to. This fragment can be included in a selection set in an operation definition. - -Apollo iOS generates separate result types for named fragments, which means they are a great way of keeping UI components or utility functions independent of specific queries. - - - -```graphql title="HeroDetailsFragment.graphql" -fragment HeroDetails on Character { - name - appearsIn -} -``` - -```graphql title="HeroAndFriendsQuery.graphql" -query HeroAndFriends { - hero { - name - ...HeroDetails - friends { - ...HeroDetails - } - } -} -``` - - - -Apollo iOS generates a type-safe model for the `HeroDetails` fragment that looks something like this (details are omitted to focus on the class structure): - -```swift title="HeroDetails.graphql.swift" -struct HeroDetails: MySchema.SelectionSet, Fragment { - let name: String - let appearsIn: [Episode] -} -``` - -The result data models generated for the `HeroAndFriendsQuery` will include the fields from the `HeroDetails` fragment and are able to be converted into the `HeroDetails` fragment model. - -```swift title="HeroAndFriendsQuery.graphql.swift" -class HeroAndFriendsQuery: GraphQLQuery { - struct Data: SelectionSet { - let hero: Hero - - struct Hero: SelectionSet { - let name: String - let friends: [Friend] - let appearsIn: [Episode] - - // Fragment Conversion Declaration - var fragments: Fragments - struct Fragments { - var heroDetails: HeroDetails { ... } - } - - struct Friend: SelectionSet { - let name: String - let appearsIn: [Episode] - - // Fragment Conversion Declaration - var fragments: Fragments - struct Fragments { - var heroDetails: HeroDetails { ... } - } - } - } - } -} -``` - -### Fragment conversion - -A result model that includes a fragment in it's definition will contain a `Fragments` struct that facilitates fragment conversion. - -Both the `Hero` and the `Friend` models from the `HeroAndFriendsQuery` above have a `Fragments` struct and can be converted to the `HeroDetails` fragment. - -```swift -let hero: HeroDetails = data.hero.fragments.heroDetails -let friends: [HeroDetails] = data.hero.friends.map { $0.fragments.heroDetails } -``` - -### Fragment reuse - -Fragment conversion allows you to reuse fragments as common models across different operations or multiple objects within the same operation. - -One common pattern is to define a fragment for a child view, and include the fragment in a query defined at a parent level. This way, the child view can easily be reused and only depends on the specific data it needs. - -The `HeroDetails` fragment above is used for both the `Hero` and `Friend` models from the `HeroAndFriendsQuery`, but a hero can be displayed alongside their friends in your application by showing a list of views that each are configured with a `HeroDetails` fragment model. - -```swift title="HeroDetailsView.swift" -struct HeroDetailsListView: View { - let data: HeroAndFriendsQuery.Data - - var body: some View { - VStack { - HeroDetailsView(hero: data.hero.fragments.heroDetails) - for friend in data.hero.friends { - HeroDetailsView(hero: friend.fragments.heroDetails) - } - } - } -} - -struct HeroDetailsView: View { - let hero: HeroDetails - - var body: some View { - HStack { - Text(hero.name) - Text(hero.appearsIn.description) - } - } -} -``` - -You can add additional data to the `HeroDetails` fragment and display that data in the `HeroDetailsView` without affecting the parent view at all. Additionally, the `HeroDetailsView` can be used with other GraphQL operations that include the `HeroDetails` fragment. - -## Inline fragments - -An [inline fragment](http://graphql.org/learn/queries/#inline-fragments) is a fragment that has no name. It is declared "inline" within another definition and cannot be reused. Inline fragments can be included in an operation definition, a named fragment definition, or nested inside another inline fragment. They are typically used to conditionally include fields in an operation using a [type conditions](./type-conditions) or the `@skip`/`@include` directives. - -Apollo iOS does not generate individual models for inline fragments, instead they affect the generated models for the operations or fragments containing them. - -You can use inline fragments with type conditions to query for type-specific fields: - -```graphql -query HeroAndFriends($episode: Episode) { - hero(episode: $episode) { - name - ... on Droid { - primaryFunction - } - } -} -``` - -And results from inline fragments with type conditions will be made available through specially generated `as` properties: - -```swift -let name: String = data.hero.name -let primaryFunction: String = data.hero.asDroid?.primaryFunction -``` - -> For more information about how to use inline fragments as type conditions, see the [type conditions documentation](./type-conditions). diff --git a/docs/source/fetching/mutations.md b/docs/source/fetching/mutations.md deleted file mode 100644 index 634a9416b0..0000000000 --- a/docs/source/fetching/mutations.md +++ /dev/null @@ -1,186 +0,0 @@ ---- -title: Mutations ---- - -In addition to fetching data using queries, Apollo iOS also handles GraphQL mutations. Mutations are identical to queries in syntax, the only difference being that you use the keyword `mutation` instead of `query` to indicate that the root fields on this query are going to be performing writes to the backend. - -For more information on GraphQL mutations, we recommend [reading this guide](https://graphql.org/learn/queries/#mutations). - -GraphQL mutations represent two things in one operation: - -1. The mutation field name with arguments, which represents the actual operation to be done on the server. -2. The fields you want back from the result of the mutation to update the client. - -All business logic involved in mutating data is handled by the server. The client has no direct knowledge of how data will be mutated. Just like any other field, each mutation in a schema returns a type. If that type is an object type, you may query fields on that type, which can be used to fetch the new state of the mutated object. - -In this example, we define a mutation called `UpvotePost`, which performs the schema's `upvotePost(postId:)` mutation. - -```graphql -mutation UpvotePost($postId: Int!) { - upvotePost(postId: $postId) { - id - votes - } -} -``` - -The server implements the `upvotePost(postId:)` mutation to add an upvote to the post with the given `postId` and return that post. The above mutation selects the `id` and `votes` fields on the returned `Post` object. - -The result might be: - -``` -{ - "data": { - "upvotePost": { - "id": "123", - "votes": 5 - } - } -} -``` - -## Performing mutations - -Similar to queries, mutations are represented by instances of generated classes, conforming to the `GraphQLMutation` protocol. Operation arguments are generated used to define mutation variables. For more information on passing arguments to a mutation see ["Operation arguments"](./operation-arguments) - -You pass a mutation object to `ApolloClient.perform(mutation:)` to send the mutation to the server, execute it, and receive typed results. - -```swift -apollo.perform(mutation: UpvotePostMutation(postId: postId)) { result in - guard let data = try? result.get().data else { return } - print(data.upvotePost?.votes) -} -``` - -## Using fragments in mutation results - -In many cases, you'll want to use mutation results to update your UI. Fragments can be a great way of sharing result handling between queries and mutations: - -```graphql -mutation UpvotePost($postId: Int!) { - upvotePost(postId: $postId) { - ...PostDetails - } -} -``` - -```swift -client.perform(mutation: UpvotePostMutation(postId: postId)) { result in - guard let data = try? result.get().data else { return } - self.configure(with: data.upvotePost?.fragments.postDetails) -} -``` - -## Passing input objects - -The GraphQL type system includes [input objects](http://graphql.org/learn/schema/#input-types) as a way to pass complex values to fields. Input objects are often defined as mutation variables, because they give you a compact way to pass in objects to be created: - -```graphql -mutation CreateReviewForEpisode($episode: Episode!, $review: ReviewInput!) { - createReview(episode: $episode, review: $review) { - stars - commentary - } -} -``` - -```swift -let review = ReviewInput(stars: 5, commentary: "This is a great movie!") -apollo.perform(mutation: CreateReviewForEpisodeMutation(episode: .jedi, review: review)) -``` - -## Designing mutation results - -When people talk about GraphQL, they often focus on the data fetching side of things, because that's where GraphQL brings the most value. Mutations can be pretty nice if done well, but the principles of designing good mutations, and especially good mutation result types, are not yet well-understood in the open source community. So when you are working with mutations it might often feel like you need to make a lot of application-specific decisions. - -In GraphQL, mutations can return any type, and that type can be queried just like a regular GraphQL query. So the question is - what type should a particular mutation return? - -In most cases, the data available from a mutation result should be the server developer's best guess of the data a client would need to understand what happened on the server. For example, a mutation that creates a new comment on a blog post might return the comment itself. A mutation that reorders an array might need to return the whole array. - -## Uploading files - -### An Important Caveat About File Uploads -Apollo recommends only using GraphQL file uploading for proof-of-concept applications. While there is a spec we presently support for making `multipart-form` requests with GraphQL, we've found that, in practice, it's much simpler to use more purpose-built tools for file upload. - -Apollo recommends using more traditional methods to upload your files, such as REST `multipart-form` uploads or SDK's that support file uploads, such as AmazonS3. [This article covers how to do that with Typescript](https://www.apollographql.com/blog/graphql-file-uploads-with-react-hooks-typescript-amazon-s3-tutorial-ef39d21066a2), but the general theory for iOS works basically the same: - -- Upload data **not** using GraphQL, getting back either an identifier or URL for the uploaded data. -- Send that received identifier or URL to your graph using GraphQL. - -If you'd still prefer to upload directly with Apollo, continue reading. - -### Uploading Directly With Apollo - -The iOS SDK supports the [GraphQL Multipart Request Specification](https://github.com/jaydenseric/graphql-multipart-request-spec#multipart-form-field-structure) for uploading files. - -At the moment, we only support uploads for a single operation, not for batch operations. You can upload multiple files for a single operation if your server supports it, though. - -To upload a file, you will need: - -- A `NetworkTransport` which also supports the `UploadingNetworkTransport` protocol on your `ApolloClient` instance. If you're using `RequestChainNetworkTransport` (which is set up by default), this protocol is already supported. -- The correct `MIME` type for the data you're uploading. The default value is `application/octet-stream`. -- Either the data or the file URL of the data you want to upload. -- A mutation which takes an `Upload` as a parameter. Note that this must be supported by your server. - -Here is an example of a GraphQL query for a mutation that accepts a single upload, and then returns the `id` for that upload: - -```graphql -mutation UploadFile($file:Upload!) { - singleUpload(file:$file) { - id - } -} -``` - -If you wanted to use this to upload a file called `a.txt`, it would look something like this: - -```swift -// Create the file to upload -guard let fileURL = Bundle.main.url(forResource: "a", withExtension: "txt"), - let file = GraphQLFile( - fieldName: "file", // Must be the name of the field the file is being uploaded to - originalName: "a.txt", - mimeType: "text/plain", // <-defaults to "application/octet-stream" - fileURL: fileURL -) else { - // Either the file URL couldn't be created or the file couldn't be created. - return -} - -// Actually upload the file -client.upload( - operation: UploadFileMutation(file: "a"), // <-- `Upload` is a custom scalar that's a `String` under the hood. - files: [file] -) { result in - switch result { - case .success(let graphQLResult): - print("ID: \(graphQLResult.data?.singleUpload.id)") - case .failure(let error): - print("error: \(error)") - } -} -``` - -A few other notes: - -- Due to some limitations around the spec, whatever the file is being added for should be at the root of your GraphQL query. So if you have something like: - - ```graphql - mutation AvatarUpload($userID: GraphQLID!, $file: Upload!) { - id - } - ``` - - it will work, but if you have some kind of object encompassing both of those fields like this: - - ```graphql - # Assumes AvatarObject(userID: GraphQLID, file: Upload) exists - mutation AvatarUpload($avatarObject: AvatarObject!) { - id - } - ``` - - it will not. Generally you should be able to deconstruct upload objects to allow you to send the appropriate fields. - -- If you are uploading an array of files, you need to use the same field name for each file. These will be updated at send time. -- If you are uploading an array of files, the array of `String`s passed into the query must be the same number as the array of files. diff --git a/docs/source/fetching/operation-arguments.mdx b/docs/source/fetching/operation-arguments.mdx deleted file mode 100644 index 254c1eefcc..0000000000 --- a/docs/source/fetching/operation-arguments.mdx +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: Operation Arguments ---- - -GraphQL operations can define arguments as part of their definitions, the values of these arguments can be passed to field arguments or directive arguments (eg. `@skip` and `@include`). - -Apollo iOS generates type-safe initializers for your operation that accept your operation's arguments. These arguments can be [built-in scalar types](https://graphql.org/learn/schema/#scalar-types), [custom scalars](./../custom-scalars), [enums](./../enums), or [input objects](./../input-objects) defined in your schema. - -Let's say we define a GraphQL query named `HeroName` with an `episode` argument which is a custom `Episode` enum defined in our schema: - -```graphql title="HeroNameQuery.graphql" -query HeroName($episode: Episode!) { - hero(episode: $episode) { - name - } -} -``` - -Apollo iOS will generate a `HeroNameQuery` class with variables: - -```swift title="HeroNameQuery.graphql.swift" -class HeroNameQuery: GraphQLQuery { - ... - - var episode: Episode - - init(episode: Episode) { - self.episode = episode - } -} -``` -Your `HeroNameQuery` will have a property for the `episode` variable, which will be passed to any field or directive arguments that use the `$episode` variable in the operation definition. - -This query object can be initialized and passed to `ApolloClient.fetch(query:)`: - -```swift -apollo.fetch(query: HeroNameQuery(episode: .empire)) { result in - guard let data = try? result.get().data else { return } - print(data.hero.name) // Luke Skywalker -} -``` - -## Working with nullable arguments - -When defining an operation argument with a nullable value, Apollo iOS will wrap the generated argument's type in a generic [`GraphQLNullable`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/graphqlnullable) wrapper enum. - -According to [the GraphQL spec](http://spec.graphql.org/October2021/#sec-Null-Value), explicitly providing a `null` value for an input value to a field argument is semantically different from not providing a value at all (`nil`). This enum allows you to distinguish your input values between `null` and `nil`. - -If the `HeroName` query is defined with a nullable `episode` argument, the generated `HeroNameQuery` will have an `episode` field with the type `GraphQLNullable`: - - -```swift title="HeroNameQuery.graphql.swift" -class HeroNameQuery: GraphQLQuery { - ... - - var episode: GraphQLNullable - - init(episode: GraphQLNullable) { - self.episode = episode - } -} -``` - -The `HeroNameQuery` can be initialized with a `GraphQLNullable` value: - - - -```swift title="Null value" -.init(episode: .null) -``` - -```swift title="No value" -.init(episode: .none) -``` - -```swift title=".some case" -.init(episode: .some(.empire)) -``` - - - -Or with an optional value using the [nil coalescing operator](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/__(_:_:)) to provide a fallback. - -```swift title=".some case" -let optionalEpisode: Episode? - -.init(episode: optionalEpisode ?? .none) -``` -For more usage information see the [`GraphQLNullable` documentation](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/graphqlnullable). - -## Default values - -When defining your operation's arguments, you may provide default values for the arguments. These default arguments will be included in your generated operation's initializer: - - - -```graphql title="HeroNameQuery.graphql" -query HeroName( - $episode: Episode! = .EMPIRE -) { - hero(episode: $episode) { - name - } -} -``` - -```swift title="HeroNameQuery.graphql.swift" -class HeroNameQuery: GraphQLQuery { - ... - - var episode: Episode - - init(episode: Episode = .empire) { - self.episode = episode - } -} -``` - - - -> **Note:** This only applies for operation arguments defined by the client. -> -> Default values for fields on [Input Objects](./../input-objects) are defined by the schema, and not generated. \ No newline at end of file diff --git a/docs/source/fetching/persisted-queries.mdx b/docs/source/fetching/persisted-queries.mdx deleted file mode 100644 index 358340e711..0000000000 --- a/docs/source/fetching/persisted-queries.mdx +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: Persisted Queries -description: Secure your graph while minimizing request latency ---- - - - -## Differences between persisted queries and APQ - - - -## Implementation steps - -Both persisted queries and APQs require you to configure code generation and how your client makes requests. If you intend to use persisted queries for safelisting, you also need to generate an operations manifest. - -We recommend you follow this order while implementing: - -| Implementation Step | Required for PQs? | Required for APQs? | -| -----| ------------------ | ----------------- | -| 1. Configure generated operation models| ✅ | ✅ | -| 2. Generate the operation manifest |✅ | -- | -| 3. Publish the operation manifest |✅ | -- | -| 4. Enable persisted queries on the client when it makes requests | ✅ | ✅ | - -The rest of this article details these steps. - -Persisted queries also require you to create and link a PQL, and to configure your router to receive persisted query requests. This document only describes the steps that need to be taken by the client to create a manifest of the client's operations and send persisted query requests. For more information on the other configuration aspects of persisted queries, see the [GraphOS persisted queries documentation](/graphos/operations/persisted-queries). - -### 0. Requirements - -You can use APQ with the following versions of Apollo iOS, Apollo Server, and Apollo Router: -- Apollo iOS (v1.0.0+) -- [Apollo Server](/apollo-server/) (v1.0.0+) -- [Apollo Router](/router) (v0.1.0+) - -> **Note:** You can use _either_ Apollo Server _or_ Apollo Router for APQs. They don't need to be used together. - -Persisted queries is currently in [preview](/resources/product-launch-stages#preview) and has the following requirements: -- Apollo iOS (v1.4.0+) -- [Apollo Router](/router) (v1.25.0+) -- [GraphOS Enterprise plan](/graphos/enterprise/) - -### 1. Configure generated operation models - -Both persisted queries and APQs require your code generation to include operation IDs. You can configure this in your code generation configuration's [`options`](output-options). -Specifically, set the `operationDocumentFormat` array to `definition`, `operationId`, or both `definition` and `operationId`. -- To use APQs, you must include both the `definition` and `operationId`. -- For persisted queries, you only need the `operationId`. - -```json title="apollo-codegen-config.json" -"options": { - "operationDocumentFormat" : [ - "definition", - "operationId" - ] -} -``` - -### 2. Generate operation manifest - -> This step is only required for implementing safelisting with persisted queries. It is _not_ required for APQs. - -An operation manifest acts as a safelist of trusted operations the [Apollo Router](/router/) can check incoming requests against. You can generate operation manifests by adding the [`operationManifest`](./../code-generation/codegen-configuration#operation-manifest-configuration) option to your `ApolloCodegenConfiguration` JSON file like so: - -```json title="apollo-codegen-config.json" -"operationManifest" : { - "generateManifestOnCodeGeneration" : false, - "path" : "/operation/identifiers/path", - "version" : "persistedQueries" -} -``` - -Once these options are configured you can run the [`generate-operation-manifest`](./../code-generation/codegen-cli#generate-operation-manifest) in order to generate your operation manifest. If you have the `generateManifestOnCodeGeneration` flag set to `true` your operation manifest will also generate everytime you run the [`generate`](./../code-generation/codegen-cli#generate) command. - -The resulting operation manifest for `persistedQueries` looks like this: - -```json title="operationIdentifiers.json" -{ - "format": "apollo-persisted-query-manifest", - "version": 1, - "operations": [ - { - "id": "e0321f6b438bb42c022f633d38c19549dea9a2d55c908f64c5c6cb8403442fef", - "body": "query GetItem { thing { __typename } }", - "name": "GetItem", - "type": "query" - } - ] -} -``` - -To automatically update the manifest for each new app release, you can include the [`generate`](./../code-generation/codegen-cli#generate) or [`generate-operation-manifest`](./../code-generation/codegen-cli#generate-operation-manifest) command in your CI/CD pipeline. - -### 3. Publish operation manifest - -> This step is only required for implementing safelisting with persisted queries. It is _not_ required for APQs. - - - -### 4. Enable persisted queries on `ApolloClient` - -Once you've configured your code generation to include operation IDs, you can update your client to query by operation ID rather than the full operation string. This configuration is the same whether you're using APQ or persisted queries: - -- Initialize a custom `NetworkTransport` using `RequestChainNetworkTransport` with `autoPersistQueries` parameter set to `true` and an `interceptorProvider` that includes the `AutomaticPersistedQueryInterceptor` (such as `DefaultInterceptorProvider`). -- Initialize your `ApolloClient` with the custom `NetworkTransport` that supports persisted queries. - -```swift -let store = ApolloStore(cache: InMemoryNormalizedCache()) -let interceptorProvider = DefaultInterceptorProvider(store: store) -let networkTransport = RequestChainNetworkTransport( - interceptorProvider: interceptorProvider, - endpointURL: URL(string: "http://localhost:4000/graphql")!, - autoPersistQueries: true -) - -let client = ApolloClient(networkTransport: networkTransport, store: store) -``` - -For more information on configuring your `ApolloClient`, `NetworkTransport`, `InterceptorProvider`, and the request chain, see the [request pipeline](./../networking/request-pipeline) documentation. - -#### Sending APQ retries as `GET` requests - -> **Note:** Apollo iOS only retries failed ID-based operations for APQs, not persisted queries. - -By default, the Apollo clients sends operation retries as `POST` requests. In some cases, you may prefer or need to retry an operation using a `GET` request: for example, you may make requests to a CDN that has better performance with `GET`s. - -To use `GET` for APQ retry requests, set the `useGETForPersistedQueryRetry` on your `RequestChainNetworkTransport` to `true`. - -In most cases, keeping the default option (`false`) suffices. \ No newline at end of file diff --git a/docs/source/fetching/queries.mdx b/docs/source/fetching/queries.mdx deleted file mode 100644 index 0e3dd61d9d..0000000000 --- a/docs/source/fetching/queries.mdx +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Queries ---- - -Queries are the most commonly used GraphQL operations. A query is used to fetch data from a GraphQL server. Apollo iOS allows you to fetch a query operation from a server using a type-safe, generated query model. In Apollo iOS, queries can also be watched for local changes to their data, allowing you to react to changes. - -For more information about GraphQL queries, we recommend [reading this guide](http://graphql.org/learn/queries/). - -## Fetching queries - -After defining and generating a query model, as outlined in ["Defining operations"](./fetching-data#defining-operations), you can fetch your query using `ApolloClient.fetch(query:)`. - -For more information on fetching GraphQL operations see ["Fetching Data"](./fetching-data). - -## Watching queries - -Queries can also be watched with `ApolloClient.watch(query:)`. Watching a query is very similar to fetching a query. The main difference is that you don't just receive an initial result, but your result handler will be invoked whenever relevant data in the cache changes: - -```swift -let watcher = apollo.watch(query: HeroNameQuery()) { result in - guard let data = try? result.get().data else { return } - print(data.hero?.name) // Luke Skywalker -} -``` - -If any of the data for the query changes in the local cache, the result handler will be invoked again. - -When you call `ApolloClient.watch(query:)` a [`GraphQLQueryWatcher`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/graphqlquerywatcher) is returned. Changes to the query's data will be watched until `cancel()` is called on the watcher. - -> **NOTE:** Remember to call `cancel()` on a watcher when its parent object is deallocated, or you will get a memory leak! diff --git a/docs/source/fetching/subscriptions.mdx b/docs/source/fetching/subscriptions.mdx deleted file mode 100644 index 07ffe1a4c4..0000000000 --- a/docs/source/fetching/subscriptions.mdx +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: Subscriptions ---- - -Subscriptions are long-lived GraphQL read operations that can update their response over time, enabling clients to receive new data as it becomes available. - -Apollo iOS supports subscriptions over the following protocols: - -- [WebSocket](#websocket), including multiple [subprotocols](#websocket-subprotocols) -- [HTTP](#http), using [chunked multipart responses](https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md) (version 1.1.0 and later) - -**You must use whichever protocol is supported by your GraphQL endpoint.** - -## Enabling support - -To support GraphQL subscriptions, you need to initialize your `ApolloClient` instance with a [`NetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/networktransport) that supports subscriptions. See below for applicable classes for each subscription protocol. - -### WebSocket - -To use Apollo iOS with WebSocket-based subscriptions, you need to install the optional `ApolloWebSocket` library. This library includes two classes that conform to the [`NetworkTransport` protocol](../docc/documentation/apollo/networktransport): - -- **[`WebSocketTransport`](../docc/documentation/apollowebsocket/websockettransport)** sends _all_ operations (including queries and mutations) over WebSocket. -- **[`SplitNetworkTransport`](../docc/documentation/apollowebsocket/splitnetworktransport)** maintains a [`WebSocketTransport`](../docc/documentation/apollowebsocket/websockettransport) instance, _along with_ an [`UploadingNetworkTransport`](../docc/documentation/apollo/uploadingnetworktransport) instance (usually [`RequestChainNetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/requestchainnetworktransport)). This provides a single network transport that uses HTTP for queries and mutations and WebSocket for subscriptions. - -`SplitNetworkTransport` is recommended for most use cases, because it enables you to retain a single `NetworkTransport` setup that avoids issues caused by using multiple client objects. - -Here's an example of setting up an `ApolloClient` that uses a `SplitNetworkTransport` to support all operation types: - - - -```swift -/// A common store to use for `httpTransport` and `webSocketTransport`. -let store = ApolloStore() - -/// A web socket transport to use for subscriptions -let webSocketTransport: WebSocketTransport = { - let url = URL(string: "ws://localhost:8080/websocket")! - let webSocketClient = WebSocket(url: url, protocol: .graphql_transport_ws) - return WebSocketTransport(websocket: webSocketClient) -}() - -/// An HTTP transport to use for queries and mutations -let httpTransport: RequestChainNetworkTransport = { - let url = URL(string: "http://localhost:8080/graphql")! - return RequestChainNetworkTransport(interceptorProvider: DefaultInterceptorProvider(store: store), endpointURL: url) -}() - -/// A split network transport to allow the use of both of the above -/// transports through a single `NetworkTransport` instance. -let splitNetworkTransport = SplitNetworkTransport( - uploadingNetworkTransport: httpTransport, - webSocketNetworkTransport: webSocketTransport -) - -/// Create a client using the `SplitNetworkTransport`. -let client = ApolloClient(networkTransport: splitNetworkTransport, store: store) -``` - - - -#### WebSocket subprotocols - -Apollo iOS supports the following WebSocket subprotocols for subscriptions: - -- [`graphql-ws`](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md), which is implemented in the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) and [AWS AppSync](https://docs.aws.amazon.com/appsync/latest/devguide/real-time-websocket-client.html#handshake-details-to-establish-the-websocket-connection) libraries. (⚠️ This protocol is not actively maintained!) -- [`graphql-transport-ws`](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md), which is implemented in the [graphql-ws](https://github.com/enisdenjo/graphql-ws) library. - -> **Note:** These protocols are **not** cross-compatible. You need to use whichever protocol is supported by your GraphQL endpoint. All `WebSocket` initializers enable you to specify which protocol to use (expand the code block above for an example). - -#### Providing authorization tokens - -In a standard HTTP operation, if authentication is necessary an `Authorization` header is often sent with requests. However, with WebSocket, this can't be sent with every payload because a persistent connection is required. - -For WebSocket, the `connectingPayload` provides the parameters you would typically specify in your request headers. - -Note that this must be set **when the `WebSocketTransport` is created**. If you need to update the `connectingPayload`, you need to recreate the client using a new `webSocketTransport`. - -```swift -let webSocketTransport: WebSocketTransport = { - let url = URL(string: "ws://localhost:8080/websocket")! - let webSocketClient = WebSocket(url: url, protocol: .graphql_transport_ws) - let authPayload = ["authToken": myAuthToken] - return WebSocketTransport(websocket: webSocketClient, connectingPayload: authPayload) -}() -``` - -### HTTP - -The default `NetworkTransport` for Apollo iOS is the [`RequestChainNetworkTransport`](../docc/documentation/apollo/requestchainnetworktransport). In Apollo iOS `1.1.0` and later, this transport supports subscriptions over HTTP, with no additional configuration required. - -> See the instructions for [creating a client](../networking/client-creation). - -## Generating and executing - -Apollo iOS supports subscriptions via [code generation](../code-generation/introduction/). Similar to queries, subscriptions are represented by instances of generated classes, conforming to the `GraphQLSubscription` protocol. - -```graphql title="ReviewAddedSubscription.graphql" -subscription ReviewAdded { - reviewAdded { - id - stars - } -} -``` - -After you generate these classes, you can execute subscriptions using `ApolloClient.subscribe(subscription:)` with a [subscription-supporting `NetworkTransport`](#enabling-support). If you do, your client continues to receive updated data until the subscription is [canceled](#canceling-a-subscription). - -```swift -let subscription = client.subscribe(subscription: ReviewAddedSubscription()) { result in - guard let data = try? result.get().data else { return } - print(data.reviews.map { $0.stars }) -} -``` - -> **Note:** GraphQL subscriptions are distinct from [watching queries](./queries#watching-queries). A query watcher is only updated when new data is written to the local cache (usually by another network operation). A GraphQL subscription is a long-lived request that might receive updated data from the server continually. - -## Canceling a subscription - -It's important to cancel a subscription connection whenever you're done with it. As long as a subscription is active, it maintains a connection to the server, and its `resultHandler` completion block is retained. This can create memory leaks and reduce your application's performance. - -When you call `ApolloClient.subscribe(subscription:)` an opaque `Cancellable` is returned. You can cancel the subscription by calling `cancel()` on the returned `Cancellable`. This terminates the connection to the server and releases the `resultHandler` completion block. - -**A subscription's cancellation object does not cancel itself when it's deallocated!** Make sure to `cancel()` it yourself. A `class` can ensure any subscriptions it manages are canceled when it's released by using its deinitializer: - -```swift -class ReviewViewController { - - let client: ApolloClient! - private var subscription: Cancellable? - - func subscribeToReviews() { - // Keep a reference to the subscription's cancellation object. - self.subscription = client.subscribe(subscription: ReviewAddedSubscription()) { [weak self] result in - // Handle each update from the subscription. - } - } - - deinit { - // Make sure the subscription is cancelled, if it exists, when this object is deallocated. - self.subscription?.cancel() - } -} -``` diff --git a/docs/source/fetching/type-conditions.mdx b/docs/source/fetching/type-conditions.mdx deleted file mode 100644 index 549a449af4..0000000000 --- a/docs/source/fetching/type-conditions.mdx +++ /dev/null @@ -1,176 +0,0 @@ ---- -title: Type Conditions ---- - -The GraphQL type system includes interfaces and unions as abstract types that object types can conform to. A field in a GraphQL schema with an abstract return type may return any concrete `type` that can be converted to the abstract type. - -Consider the following schema: - -```graphql title="StarWarsSchema.graphql" -type Query { - hero: Character! -} - -interface Character { - name: String! -} - -type Human implements Character { - name: String! -} - -type Droid implements Character { - name: String! - primaryFunction: String! -} -``` - -Since both the `Human` and `Droid` types implement the `Character` interface, they can both be converted into the abstract type `Character`. That means the result of a field of the `Character` type (ie. `hero`), the can be either a `Human` or a `Droid`. When we query the `hero` field, the server doesn't return a response object of the `Character` type, it returns either a concrete type that implements the `Character` interface. In this case, that is either a `Human` or a `Droid`. - -## Type conversion - -In order to know if the type of an object in a response can be converted to another type, we have to know the concrete type of the object. We can request that the server provides us the concrete type of the object by fetching the [`__typename` metadata field](https://spec.graphql.org/draft/#sec-Type-Name-Introspection). - -Apollo iOS automatically augments your queries to add the `__typename` field to every object in your operations. This is primarily to support conditional type conversion, but it means a `__typename` property is always defined and can be used to differentiate between object types manually if needed. - -An object can be converted to an another type based on the following rules, where the "target type" is the type that we are attempting to convert *to*: -- If the target type is a concrete **object type**: - - If the object's type is exactly the target type. -- If the target type is an **interface**: - - If the object's type implements the target interface type. -- If the target type is a **union**: - - If the target union type's set of possible types includes the object's type. - -## Querying with type conditions - -Whenever we want to query type-specific fields on an object with an abstract type, we have to use a type condition. - -In this example, we want to query the `primaryFunction` on the `hero` field, but we can only query the `primaryFunction` field if the returned `hero` is a `Droid` type. The following query definition is invalid and does not compile: - -```graphql title="HeroAsDroidQuery.graphql" -query HeroAsDroid { - hero { - name - primaryFunction # Field "primaryFunction" does not exist on type "Character" - } -} -``` - -We can query the `primaryFunction` field using a fragment on the `Droid` type. This can be either a [named fragment](./fragments#named-fragments) or an [inline fragment](./fragments#inline-fragments). - - - -```graphql title="Inline Fragment" -query HeroAsDroid { - hero { - name - ... on Droid { - primaryFunction - } - } -} -``` - -```graphql title="Named Fragment" -query HeroAsDroid { - hero { - name - ...DroidDetails - } -} - -fragment DroidDetails on Droid { - name - primaryFunction -} -``` - - - -## Accessing conditional response data - -Using a fragment on another type creates a type condition in the generated model objects. - -In order to access the `primaryFunction` on the `Hero` model, we need to know if the hero is a droid. Apollo iOS will generate a `Hero` model with an optional `asDroid` property: - -```swift title="HeroAsDroidQuery.graphql.swift" -class HeroAsDroidQuery: GraphQLQuery { - struct Data: SelectionSet { - let hero: Hero - - struct Hero: SelectionSet { - let name: String - var asDroid: AsDroid? { ... } - - // Type Condition Declaration - struct AsDroid: InlineFragment { - let name: String - let primaryFunction: String - } - } - } -} -``` - -The `hero.asDroid` property is optional, and will only return a value if the type of the hero object in the response data is a droid. We can now conditionally convert the `Hero` to an `AsDroid` model and access the `primaryFunction` property. - -```swift -let primaryFunction: String? = hero.asDroid?.primaryFunction -``` - -### Converting to a conditional named fragment - -If the type condition is created by a named fragment, the `asDroid` object can also be used to perform [fragment conversion](./fragments#fragment-conversion). - -Here we declare the type condition with a fragment named `DroidDetails`: - - - -```graphql title="Query & Fragment Definitions" -query HeroAsDroid { - hero { - name - ...DroidDetails - } -} - -fragment DroidDetails on Droid { - name - primaryFunction -} -``` - -```swift title="Generated Model" -class HeroAsDroidQuery: GraphQLQuery { - struct Data: SelectionSet { - let hero: Hero - - struct Hero: SelectionSet { - let name: String - - var asDroid: AsDroid? { ... } - - // Type Condition Declaration - struct AsDroid: InlineFragment { - let name: String - let primaryFunction: String - - // Fragment Conversion Declaration - var fragments: Fragments - struct Fragments { - var droidDetails: DroidDetails { ... } - } - } - } - } -} -``` - - - -In order to convert the `Hero` into a `DroidDetails` fragment, we need to know if the hero is a droid. With a named fragment, Apollo iOS generates a `Hero.AsDroid` model that includes a conversion to `DroidDetails`. We can now convert to an optional `DroidDetails` fragment. - -```swift -let droidDetails: DroidDetails? = hero.asDroid?.fragments.droidDetails -``` -> Learn more about how to use named fragments to generate better models in our [*Fragments* documentation](./fragments). \ No newline at end of file diff --git a/docs/source/get-started.mdx b/docs/source/get-started.mdx deleted file mode 100644 index 2613af50ec..0000000000 --- a/docs/source/get-started.mdx +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: Getting Started with Apollo iOS -sidebar_title: Get Started ---- - -import SPMXcodeInstallationPanel from "../shared/spm-xcode-installation-panel.mdx" -import SPMPackageInstallationPanel from "../shared/spm-package-installation-panel.mdx" -import PodsInstallationPanel from "../shared/pods-installation-panel.mdx" -import SetupCodegen from "../shared/setup-codegen/combined.mdx" - -Follow the steps below to add Apollo iOS to your app: - -## 1. Install the Apollo frameworks - -You can add Apollo iOS into your project using Swift Package Manager or CocoaPods. - -
- - - - - - - - -## 2. Add a schema file to your target directory - -For Apollo iOS to generate models for your GraphQL operations, you need a local copy of your GraphQL server's schema. - -> See [Downloading a schema](./code-generation/downloading-schema) for more details. - -## 3. Create `.graphql` files for your GraphQL operations - -Apollo iOS generates code from the GraphQL queries and mutations defined in your target's files. To use Apollo iOS, you'll need to define at least one operation GraphQL operation. - -GraphQL operation and fragment definitions traditionally have the file extension `.graphql`. The generated models will have the file extension `.graphql.swift`. - -> See [Defining operations](./fetching/fetching-data#defining-operations) for more details. - -## 4. Setup and run code generation - -Apollo iOS code generation uses your `.graphql` files to generate API code that helps you execute GraphQL operations and parse and cache operation responses. - -Whenever you make changes to your GraphQL operation definitions, you'll need to run the code generation engine to re-generate your GraphQL models. - -The easiest way to do this is with the Codegen CLI provided with Apollo iOS. - -> For more advanced usage and configuration (including use with modularized projects), see [Code Generation](./code-generation/introduction). -> -> To use Apollo's code generation and schema downloader from within any Swift script or library, check out [Running code generation in Swift code](./code-generation/run-codegen-in-swift-code). - - - -## 5. Create an `ApolloClient` - -Before you can execute GraphQL operations in your app, you need to initialize an `ApolloClient` instance. - -```swift -import Foundation -import Apollo - -let apolloClient = ApolloClient(url: URL(string: "http://localhost:4000/graphql")!) -``` - -> See [Creating a client](./networking/client-creation) for more details. - -## 6. Fetch a query - -`ApolloClient` can fetch your generated operation definitions, and return the response as a type-safe generated data model. - -For example, if you define a query called `HeroName`: - -```graphql -query HeroName { - hero { - name - } -} -``` - -Apollo iOS will generate a `HeroNameQuery` class that you can construct and pass to `ApolloClient.fetch(query:)`: - -```swift -apolloClient.fetch(query: HeroNameQuery()) { result in - guard let data = try? result.get().data else { return } - print(data.hero.name) // Luke Skywalker -} -``` - -> See [Fetching data](./fetching/fetching-data) for more details. diff --git a/docs/source/index.mdx b/docs/source/index.mdx deleted file mode 100644 index 08dc30c022..0000000000 --- a/docs/source/index.mdx +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Introduction to Apollo iOS -description: A strongly typed, Swift-first GraphQL client ---- - -**Apollo iOS** is an [open-source](https://github.com/apollographql/apollo-ios) GraphQL client for native client applications, written in Swift. - -Apollo iOS executes queries and mutations using a GraphQL server and returns results as pre-generated and operation-specific Swift types. This means that Apollo iOS takes care of forming spec-compliant GraphQL requests, parsing JSON responses, and manually validating and type-casting response data for you! - -Apollo iOS also includes caching mechanisms specifically for GraphQL data, enabling you to execute GraphQL queries against your locally cached data directly. - -
- - Installation - -
- -## Key features - -Apollo iOS has three key features: - -- [Code generation](#code-generation) -- A [normalized cache](#the-normalized-cache) -- The [networking and GraphQL execution layer](#networking-and-graphql-execution) - -Used together, these features dramatically improve the process of requesting, consuming, and persisting GraphQL data. - -### Code generation - -Apollo iOS generates _objects_ based on the GraphQL operations you define, providing a type-safe way to use operations in your code. - -Each generated operation object contains a set of robust, strongly-typed models for that operation's response. These models enable you to access your GraphQL response data in a type-safe and flexible way. - -Because generated response models are operation-specific, they _only_ include properties for the GraphQL fields within that operation. This means you can rely on the Swift type checker to flag data access errors at compile time. - -Apollo iOS also generates models for your GraphQL _fragments_. Using fragment models alongside your operation-specific models enables you to share common models across multiple GraphQL operations. - -Apollo iOS additionally generates models for your schema's input, enum, and custom scalar types, all of which help improve your code's type-safety. - -### The normalized cache - -Apollo iOS's normalized cache is designed specifically for GraphQL. It normalizes operation results to build a client-side cache of your data, updating with every operation you execute. - -Apollo iOS's cache de-duplicates GraphQL responses, merging data from separate GraphQL operations into normalized objects. This enables your cache to stay up-to-date with your backend with as few operations as possible. - -The normalization of objects across operations means that your cache acts as a source of truth for your graph, enabling your application to react to changes in real-time. - -To learn more about the normalization process, see our blog post [Demystifying Cache Normalization](https://www.apollographql.com/blog/apollo-client/caching/demystifying-cache-normalization). - -### Networking and GraphQL execution - -Apollo iOS provides a networking API that helps you execute GraphQL operations against any spec-compliant GraphQL server. The GraphQL execution pipeline automatically caches your response data in the normalized cache and returns the response data using your generated, type-safe operation models. - -Apollo iOS handles all the heavy lifting of networking with GraphQL, including: - -- Constructing spec-compliant GraphQL network requests -- Checking for existing data in the normalized cache -- Executing network transport -- Parsing and validating GraphQL network responses -- Exposing GraphQL errors as type-safe Swift errors -- Writing response data to the normalized cache -- Mapping response data onto type-safe, generated operation models - -## Related libraries - -[Apollo Kotlin](/kotlin/) is a GraphQL client for native Android apps written in Java and Kotlin, and it also supports the Kotlin Multi-Platform integration. - -Apollo Client's integration for [React](/react) also works with [React Native](https://facebook.github.io/react-native/) on both iOS and Android. - -
- - Get Started! - -
diff --git a/docs/source/input-objects.mdx b/docs/source/input-objects.mdx deleted file mode 100644 index 7b1ec9d17f..0000000000 --- a/docs/source/input-objects.mdx +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Input Objects ---- - -# UNDER CONSTRUCTION \ No newline at end of file diff --git a/docs/source/logo/favicon.png b/docs/source/logo/favicon.png deleted file mode 100644 index 74b56fa621..0000000000 Binary files a/docs/source/logo/favicon.png and /dev/null differ diff --git a/docs/source/logo/icon-apollo-white-200x200.png b/docs/source/logo/icon-apollo-white-200x200.png deleted file mode 100644 index a1b4b5703c..0000000000 Binary files a/docs/source/logo/icon-apollo-white-200x200.png and /dev/null differ diff --git a/docs/source/logo/logo-apollo-space-left.svg b/docs/source/logo/logo-apollo-space-left.svg deleted file mode 100644 index bd0ad9f93c..0000000000 --- a/docs/source/logo/logo-apollo-space-left.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/source/logo/logo-apollo-space.svg b/docs/source/logo/logo-apollo-space.svg deleted file mode 100644 index a168fc113a..0000000000 --- a/docs/source/logo/logo-apollo-space.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/source/logo/logo-apollo-subbrands-developers-space.svg b/docs/source/logo/logo-apollo-subbrands-developers-space.svg deleted file mode 100644 index b1bbe7f0f2..0000000000 --- a/docs/source/logo/logo-apollo-subbrands-developers-space.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/docs/source/migrations/1.0.mdx b/docs/source/migrations/1.0.mdx deleted file mode 100644 index bbf5fe50d6..0000000000 --- a/docs/source/migrations/1.0.mdx +++ /dev/null @@ -1,470 +0,0 @@ ---- -title: Apollo iOS 1.0 migration guide -description: From 0.x to 1.0 ---- - -import SetupCodegen from "../../shared/setup-codegen/combined.mdx" -import SeparateLocalCacheMutationsNote from "../../shared/separate-local-cache-mutation-note.mdx" - -Apollo iOS 1.0 provides a stable API that uses modern Swift language conventions and features. - -Among other improvements, Apollo iOS 1.0 features new: - -- Code generation tooling written in pure Swift code. -- Generated models that improve readability and functionality while reducing generated code size. -- Support for using generated models in multi-module projects. -- Type-safe APIs for cache key resolution. - -This article describes the significant changes for this major version of Apollo iOS and a walk-through of migrating an existing project from Apollo iOS 0.x to 1.0. - -> **Steps to migrate to Apollo iOS 1.0:** -> 1. Begin by reading about the [key changes](#key-changes). -> 2. Next, follow our [step-by-step instructions](#step-by-step-instructions) to upgrade your existing app. -> 3. Finally, see [breaking changes](#breaking-changes) to resolve any remaining build errors. - -## Key changes - -### Generated schema module - -The 0.x version of Apollo iOS generates models for your GraphQL operation definitions _and_ the input objects and enums referenced in your schema. - -Apollo iOS 1.0 expands on this, generating an _entire module_ that contains models and metadata for your GraphQL schema and its type definitions. - -In addition to your input objects and enum types, this module contains: -- Types for the objects, interfaces, and unions in your schema. -- Editable definitions for your custom scalars. -- An editable `SchemaConfiguration.swift` file. -- Metadata for the Apollo GraphQL executor. - -Schema types are contained in their own namespace to prevent naming conflicts. You can generate this namespace as a stand-alone module, imported by your project, or as a caseless namespace enum that you can embed in your application target. - -### Multi-module support - -Apollo iOS 1.0 can support complex applications composed of multiple modules _or_ monolithic application targets. - -The [generated schema module](#generated-schema-module) supports multi-module projects by containing all of a schema's shared types and metadata. This enables you to move generated operation models anywhere within your project structure (as long as they are linked to the schema module). - -Apollo iOS's code generation engine provides flexible configuration options that make code generation work seamlessly for any project structure. - -## Step-by-step instructions - -> **Before migrating to Apollo iOS 1.0, you should consider your project structure and decide how you want to include your generated schema module and operation models.** -> -> To learn about how you can best integrate Apollo iOS to suit your project's needs, see our [Project configuration documentation](../project-configuration). - -To migrate to Apollo iOS 1.0, you'll do the following: -1. [Update your Apollo iOS dependency](#1-update-to-apollo-ios-10) -2. [Setup code generation](#2-set-up-code-generation) -3. [Replace the code generation build phase](#3-replace-the-code-generation-build-phase) -4. [Refactor your code to use new APIs](#4-refactor-your-code) - -Much of this migration process involves the new code generation mechanism. - -As you go through this process, we'll explain how to remove deprecated pieces of the legacy 0.x version along the way. Each of the following steps also includes explanations for any breaking API changes. - -### Step 1: Upgrade to Apollo iOS 1.0 - -Begin by updating your Apollo iOS dependency to the latest version. You can include Apollo iOS as a package using Swift Package Manager (SPM) or Cocoapods. - -To receive bug fixes and new features, we recommend including `1.0` up to the next major release. - -> To see the modules provided by the Apollo iOS SDK (and determine which modules you need), see [SDK components](../project-configuration#apollo-ios-sdk-components). - - - -```swift title="Package.swift" -.package( - url: "https://github.com/apollographql/apollo-ios.git", - .upToNextMajor(from: "1.0.0") -), -``` - -```ruby title="Podfile" -pod 'Apollo' ~> '1.0' -``` - - - -> **Note:** You can build Apollo iOS 1.0 as a dynamic `.xcframework` or a static library. You can also build and include Apollo iOS 1.0 as a pre-compiled binary with a build tool such as Carthage or Buck (though we don't currently document how to do this). - -### Step 2: Set up code generation - -Apollo iOS 1.0 includes a new code generation engine, written in pure Swift code, replacing the legacy `apollo-tooling` library. To use 1.0, you must install the new code generation engine and remove the old one. - -We recommend running the new code generation engine using the Apollo Codegen CLI. You can also run code generation in a Swift script for more advanced usage. - -#### Codegen CLI setup - -For CLI setup instructions, select the method you are using to include `Apollo`. - - - -#### Swift scripts setup - -If you are [running code generation via a Swift script](./../code-generation/run-codegen-in-swift-code), update your script to use the version of `ApolloCodgenLib` that matches your `Apollo` version. - -Then, update the `ApolloCodegenConfiguration` in your script with the new configuration values. For a list of configuration options, see [Codegen configuration](./../code-generation/codegen-configuration). - -### Step 3: Replace the code generation build phase - -> We no longer recommend running Apollo's code generation as an Xcode build phase. - -Your generated files change whenever you modify your `.graphql` operation definitions (which happens infrequently). Running code generation on every build increases build times and slows development. - -Instead, we recommend running code generation **manually (using the CLI)** whenever you modify your `.graphql` files. - -If you want to continue running code generation on each build, you can update your build script to run the CLI `generate` command. - -### Step 4: Refactor your code - -While designing Apollo iOS 1.0, we tried to limit the number of code changes required to migrate from legacy versions. - -Below are explanations for each [breaking change](#breaking-changes) that Apollo iOS 1.0 brings and tips on addressing those changes during your migration. - -## Breaking changes - -### Custom scalars - -In the 0.x version of Apollo iOS, your schema's custom scalars are exposed as a `String` type field by default. If you used the `--passthroughCustomScalars` option, your generated models included the name of the custom scalar. You were responsible for defining the types passed through to your custom scalars. - -In Apollo iOS 1.0, operation models use custom scalar definitions, and by default, Apollo iOS generates `typealias` definitions for all referenced custom scalars. These definitions are within your schema module. The default implementation of all custom scalars is a `typealias` to `String`. - -> Custom scalar files are generated once. This means you can edit them, and subsequent code generation executions won't overwrite your changes. - -To migrate a custom scalar type to Apollo iOS 1.0, do the following: -- Include the type in your schema module. -- Ensure the type conforms to the [`CustomScalarType`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/customscalartype) protocol. -- Point the `typealias` definition to the new type. - - Or, if the type has the exact name of your custom scalar, remove the `typealias` definition. - -> For more details on defining custom scalars, see [Custom Scalars](../custom-scalars). - -#### Example - -We define a `scalar Coordinate`, which we reference in our GraphQL operations. Apollo iOS generates the `Coordinate` custom scalar: - -```swift title="MySchema/CustomScalars/UUID.swift" -public extension MySchema { - typealias Coordinate = String -} -``` - -A custom scalar with the name `Coordinate` could replace the `typealias`, like so: - -```swift title="MySchema/CustomScalars/UUID.swift" -public extension MySchema { - struct Coordinate: CustomScalarType { - let x: Int - let y: Int - - public init (_jsonValue value: JSONValue) throws { - guard let value = value as? String, - let coordinates = value.components(separatedBy: ",").compactMap({ Int($0) }), - coordinates.count == 2 else { - throw JSONDecodingError.couldNotConvert(value: value, to: Coordinate.self) - } - - self.x = coordinates[0] - self.y = coordinates[1] - } - - public var _jsonValue: JSONValue { - "\(x),\(y)" - } - } -} -``` - -### Cache key configuration - -In the 0.x version of Apollo iOS, you could configure the computation of cache keys for the normalized cache by providing a `cacheKeyForObject` block to `ApolloClient`. - -In Apollo iOS 1.0, we replace this with a type-safe API in the `SchemaConfiguration.swift` file, which Apollo iOS generates alongside the generated schema types. - -To migrate your cache key configuration code, refactor your `cacheKeyForObject` implementation into the `SchemaConfiguration.swift` file's [`cacheKeyInfo(for type:object:)`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/schemaconfiguration/cachekeyinfo(for:object:)) function. This function needs to return a `CacheKeyInfo` struct (instead of a cache key `String`). - -In 0.x, we recommended that you prefix your cache keys with the `__typename` of the object to prevent key conflicts. - -Apollo iOS 1.0 does this automatically. If you want to group cache keys for objects of different types (e.g., by a common interface type), you can set the `uniqueKeyGroup` property of the `CacheKeyInfo` you return. - -> For more details on the new cache key configuration APIs, see [Custom cache keys](./../caching/cache-key-resolution). - -#### Example - -Given a `cacheKeyForObject` block: - -```swift -client.cacheKeyForObject = { - guard let typename = $0["__typename"] as? String, - let id = $0["id"] as? String else { - return nil - } - - return "\(typename):\(id)" -} -``` - -You can migrate this to the new [`cacheKeyInfo(for type:object:)`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/schemaconfiguration/cachekeyinfo(for:object:)) function like so: - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - guard let id = object["id"] as? String else { - return nil - } - - return CacheKeyInfo(id: id) - } -} -``` - -Or you can use the [JSON value convenience initializer](./../caching/cache-key-resolution#json-value-convenience-initializer), like so: - -```swift title="SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - return try? CacheKeyInfo(jsonValue: object["id"]) - } -} -``` - -### Local Cache Mutations - -In the 0.x version of Apollo iOS, you could directly change data in the local cache using any of your generated operation or fragment models. - -The APIs for direct cache access have mostly stayed the same but generated model objects are now **immutable by default**. You can still _read_ cache data directly using your generated models, but to mutate cache data, you now need to define separate [local cache mutation](./../caching/cache-transactions#defining-local-cache-mutations) operations or fragments. - -You can define a local cache mutation model by applying the `@apollo_client_ios_localCacheMutation` directive to any GraphQL operation or fragment definition. - -> For a detailed explanation of the new local cache mutation APIs, see [Direct cache access](./../caching/cache-transactions). - - - -#### Example - -Given an operation and write transaction from Apollo iOS 0.x versions: - - - -```graphql -query UserDetails { - loggedInUser { - id - name - posts { - id - body - } - } -} -``` - -```swift -store.withinReadWriteTransaction({ transaction in - let cacheMutation = UserDetailsQuery() - - let newPost = UserDetailsQuery.Data.LoggedInUser.Post(id: "789, body: "This is a new post!") - - try transaction.update(cacheMutation) { (data: inout UserDetailsQuery.Data) in - data.loggedInUser.posts.append(newPost) - } -}) -``` - - -In Apollo iOS 1.0, you can rewrite this using a new `LocalCacheMutation`: - - - -```graphql -query AddUserPostLocalCacheMutation @apollo_client_ios_localCacheMutation { - loggedInUser { - posts { - id - body - } - } -} -``` - -```swift -store.withinReadWriteTransaction({ transaction in - let cacheMutation = AddUserPostLocalCacheMutation() - - let newPost = AddUserPostLocalCacheMutation.Data.LoggedInUser.Post(data: DataDict( - ["__typename": "Post", "id": "789", "body": "This is a new post!"], - variables: nil - )) - - try transaction.update(cacheMutation) { (data: inout AddUserPostLocalCacheMutation.Data) in - data.loggedInUser.posts.append(newPost) - } -}) -``` - - - -### Nullable Input Values - -According to [the GraphQL spec](http://spec.graphql.org/October2021/#sec-Null-Value), explicitly providing `null` as the value for an input field is semantically different from not providing a value (`nil`). - -To distinguish between `null` and `nil`, the 0.x version of Apollo iOS generated optional input values as double optional value types (`??`, or `Optional>`). This was confusing for many users and didn't clearly express the intention of the API. - -In Apollo iOS 1.0, we replaced the double optional values with a new [`GraphQLNullable`](https://www.apollographql.com/docs/ios/docc/documentation/apolloapi/graphqlnullable) wrapper enum type. - -This new type requires you to indicate your input fields' value or nullability behavior _explicitly_. This applies to nullable input arguments on your operation definitions and nullable properties on input objects. - -While this API is slightly more verbose, it provides clarity and reduced bugs caused by unexpected behavior. - -> For more examples and best practices using `GraphQLNullable`, see [Working with nullable arguments](./../fetching/operation-arguments#working-with-nullable-arguments). - -#### Example - -If we are passing a value to a nullable input parameter, we'll need to wrap that value in a `GraphQLNullable`: - - - -```swift title="Apollo iOS 0.x" -MyQuery(input: "Value") -``` - -```swift title="Apollo iOS 1.0" -MyQuery(input: .some("Value")) -``` - - - -To provide a `null` or `nil` value, use `.null` or `.none`, respectively. - - - -```swift title="Apollo iOS 0.x" -/// A `nil` double optional value translates to omission of the value. -MyQuery(input: nil) - -/// An optional containing a `nil` value translates to an `null` value. -MyQuery(input: .some(nil)) -``` - -```swift title="Apollo iOS 1.0" -/// A `GraphQLNullable.none` value translates to omission of the value. -MyQuery(input: .none) - -/// A `GraphQLNullable.null` value translates to an `null` value. -MyQuery(input: .null) -``` - - - -When passing an optional value to a nullable input value, you need to provide a fallback value if your value is `nil`: - - - -```swift title="Apollo iOS 0.x" -var optionalInput: String? = nil - -MyQuery(input: optionalInput) -``` - -```swift title="Apollo iOS 1.0" -var optionalInput: String? = nil - -MyQuery(input: optionalInput ?? .null) -``` - - - -### Mocking operation models for testing - -In the 0.x version of Apollo iOS, you could create mocks of your generated operation models by using each model's generated initializers or by initializing them directly with JSON data. Both methods were error-prone, cumbersome, and fragile. - -Apollo iOS 1.0 provides a new way to generate test mocks based on your schema types. Begin by adding [`output.testMocks`](./../code-generation/codegen-configuration#test-mocks) to your code generation configuration, then link your generated test mocks to your unit test target. - -Instead of creating a model using a type's generated initializer, you create a test mock of the schema type for the underlying object. Using the test mock, you can set values for relevant fields and initialize your operation model. - -Apollo iOS 1.0's new test mocks are more comprehensible and type-safe. They also remove the need for generated initializers for different model types. - -Note, you can continue initializing your operation models with JSON data, but the initializer has changed slightly. For more information, [See JSON initializer](#test-mocks-from-json-data). - -> For more details, see [Test Mocks](./../testing/test-mocks). - -#### Examples - -Given a `Hero` interface type that can be either a `Human` or `Droid` type, and the following operation definition: - -```graphql -query HeroDetails { - hero { - id - ... on Human { - name - } - ... on Droid { - modelNumber - } - } -} -``` - -The 0.x version of Apollo iOS generates initializers for each type on the `HeroDetails.Data.Hero` model: - -```swift -struct Hero { - static func makeHuman(id: String, name: String) { - // ... - } - - static func makeDroid(id: String, modelNumber: String) { - // ... - } -} -``` - -These initializers are not generated in Apollo iOS 1.0. Instead, you can initialize either a `Mock`, or a `Mock`: - -```swift -let mockHuman = Mock() -mockHuman.id = "10" -mockHuman.name = "Han Solo" - -let mockDroid = Mock() -mockDroid.id = "12" -mockDroid.modelNumber = "R2-D2" -``` - -Then, create mocks of the `HeroDetails.Data.Hero` model using your test mocks: - -```swift -let humanHero = HeroDetails.Data.Hero(from: mockHuman) -let droidHero = HeroDetails.Data.Hero(from: mockDroid) -``` - -##### Test mocks from JSON Data - -If you want to continue initializing your models using JSON data directly, you can update your initializers to create your model using the `init(data: DataDict)` initializer. You must also ensure that your JSON data is a `[String: AnyHashable]` dictionary. - - - -```swift title="0.x" -let json: [String: Any] = [ - "__typename: "Human", - // ... -] - -let hero = HeroDetails.Data.Hero( - unsafeResultMap: json -) -``` - -```swift title="1.0" -let json: [String: AnyHashable] = [ - "__typename: "Human", - // ... -] - -let hero = HeroDetails.Data.Hero( - data: DataDict(json) -) -``` - - diff --git a/docs/source/migrations/1.2.mdx b/docs/source/migrations/1.2.mdx deleted file mode 100644 index 582c311aeb..0000000000 --- a/docs/source/migrations/1.2.mdx +++ /dev/null @@ -1,246 +0,0 @@ ---- -title: Apollo iOS 1.2 migration guide -description: From 1.0 - 1.1 to 1.2 ---- - -This guide describes the process of migrating your code from version 1.0 or 1.1 to version 1.2 of Apollo iOS. - -Though 1.2 is a minor version bump, a critical problem was addressed in this version that requires a small breaking change during the upgrade. While we strive to make the upgrade path for minor versions seamless, this issue could not be reasonably resolved without requiring this migration. - -## Cache Key Configuration API - -The API for [configuring custom cache keys](../caching/cache-key-resolution) has had a minor change in this version. The signature of the `cacheKeyInfo(for:object:)` function, defined in your generated `SchemaConfiguration.swift` file, has been modified. - -In previous versions, the `object` parameter was of the type `JSONObject`, which is a `typealias` for the type `Dictionary`. In 1.2, the `object` parameter is of a newly defined type `ObjectData`. - -In order to preserve your implementation, the `SchemaConfiguration.swift` file is generated only the first time code generation is run. This means that when upgrading to Apollo iOS 1.2, you will need to modify the function signature of the `cacheKeyInfo(for:object:)` function. - -*For new projects, the function will be properly generated on the first code generation run.* - -### Reasoning - -Because cache key resolution is performed both on raw JSON (from a network response) and `SelectionSet` model data (when writing to the cache directly), the underlying `object` data will have different formats. This inconsistency caused bugs that were difficult to track down for some users. The ``ObjectData`` wrapper `struct` is used to normalize this data to a consistent format in the context of the `cacheKeyInfo(for:object:)` function. - -### Migration Steps - -For most users, the change will be as simple as changing the function signature from: - -```swift title="v1.0 SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - /// ... - } -} -``` - -to - -```swift title="v1.2 SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - /// ... - } -} -``` - -For most basic use cases, which only use the `object`'s `subscript` to access its values, this will suffice. However, the `ObjectData` struct does not provide the same API as a `Dictionary` and has some semantic differences that you may need to address. **We recommend running sufficient tests to ensure your cache key resolution function still returns the expected values.** - -If your cache key resolution function does not compile or resolve cache keys correctly with the new function signature, please continue reading for more information. - -### Changes to underlying value types - -The `ObjectData` struct allows you to access the values of the provided `object` in a way that ensure consistency of the value types. If your implementation of the `cacheKeyInfo(for:object:)` function casts values to specific expected types, you may need to modify your code to ensure that casting is done properly. The values you should expect to be returned for the keys in an `ObjectData` struct are as follows: - -- Scalar types - - The raw scalar value (`String, Int, Float, Double` or `Bool`) -- Custom scalar types - - The custom scalar will be deserialized into the raw value returned from the type's `jsonValue` property. - - See [Custom Scalars](../custom-scalars) for more information -- Object types - - For other GraphQL objects nested inside of the passed `object`, another `ObjectData` struct will be returned. - - In previous versions, the return value was another `JSONObject` (ie. `Dictionary`). -- List types - - For a list field, the returned value is the newly defined `ListData` struct. - - `ListData` functions the same as `ObjectData`, wrapping an array of elements instead of a dictionary. - -### `ObjectData` API limitations - -The `ObjectData` struct exposes a notably limited API. It only allows subscript access to the key value pairs of its underlying data. Generally, this API should suffice for accessing the values needed to resolve cache keys. If your `cacheKeyInfo(for:object:)` function is using any other functionality of `Dictionary`, you will need to refactor your code. - -In order to limit the complexity required by cache key resolution mechanisms, additions to the `ObjectData` API are being made only as needed based on feedback from our users. **If your `cacheKeyInfo(for:object:)` function requires other functionality to be exposed on `ObjectData`, please [submit a Feature Request](https://github.com/apollographql/apollo-ios/issues/new?template=feature_request.yaml).** - -### Example - -Let's consider an example `cacheKeyInfo(for:object:)` function from the previous version which needs to have some modifications made while migrating to version 1.2 - -```swift title="v1.0 SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: JSONObject) -> CacheKeyInfo? { - switch type { - case Objects.User: - let userInfo = object[info] as? [String: AnyHashable] - let emailList = userInfo["emailAddresses"] as? [String] - return try? CacheKeyInfo(jsonValue: emailList[0]) - - case Objects.Post: - let timestampCustomScalar = object["timestamp"] as? TimeStamp - let timestampRawValue = object["timestamp"] as? String - let timestampString = (timestampCustomScalar?.jsonValue as? String) - ?? timestampRawValue - return try? CacheKeyInfo(jsonValue: timestampString) - - case Objects.Product: - return try? CacheKeyInfo(id: object["UPC"]) - - default: - return nil - } - } -} -``` - -To migrate this function to 1.2, we need to make a few changes. - -1. The `object` parameter must be changed to the type `ObjectData` -2. The value for the `User` object's `info` field should be cast to `ObjectData` instead of `[String: AnyHashable]` -3. The `User` object's `info.emailAddresses` should expect a `ListData` type instead of `[String]`. -4. Previously, the value for the `Post` object's `timestamp` custom scalar may have been the `TimeStamp` custom scalar or its raw `jsonValue` type, depending on the source of the data. Now we should always expect the deserialized `jsonValue` – in this case, a `String`. -5. The `Product` object's `UPC` field has always been a scalar `String` value. There is no change needed here. - -```swift title="v1.2 SchemaConfiguration.swift" -public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration { - static func cacheKeyInfo(for type: Object, object: ObjectData) -> CacheKeyInfo? { - switch type { - case Objects.User: - let userInfo = object["info"] as? ObjectData - let emailList = userInfo["emailAddresses"] as? ListData - return try? CacheKeyInfo(jsonValue: emailList[0] as? String) - - case Objects.Post: - let timestamp = object["timestamp"] as? String - return try? CacheKeyInfo(jsonValue: timestamp) - - case Objects.Product: - return try? CacheKeyInfo(jsonValue: object["UPC"]) - - default: - return nil - } - } -} -``` - -The `ObjectData` and `ListData` subscript accessors can also be chained together. This means the `User` object's cache key resolution could be implemented more simply as: - -```swift -case Objects.User: - return try? CacheKeyInfo( - jsonValue: object["info"]?["emailAddresses"]?[0] - ) -``` -## Swift Access Modifiers - -`1.2.0` introduces new codegen configuration parameters that allow you to specify the access control of the generated Swift types. When using a module type of [`embeddedInTarget`](../code-generation/codegen-configuration#module-type) or operation output types of [`relative` or `absolute`](../code-generation/codegen-configuration#operations) you can choose to have the generated Swift types be accessible with `public` or `internal` access. - -**You do not need to add these options to your codegen configuration but the default used when the option is not specified is different from previous Apollo iOS versions.** - -Before `1.2.0` all Swift types were generated with `public` access, the default for the new configuration option is `internal`. - -This means that where you might have been using publicly available Swift types before you might now have compiler errors where those types are no longer accessible. To resolve this you will need to add the configuration option to your codegen configuration specifying the `public` access modifier. - -**You may need to make manual changes to the schema configuration and custom scalar files because these files are not regenerated if they already exist. The alternative to manually updating them is to remove those files, run code generation, and then re-add any custom logic you may have had in the pre-existing custom scalar files.** - -### Example - -#### Module type - - - -```json title="CLI Configuration JSON" -"output": { - "schemaTypes": { - "moduleType": { - "embeddedInTarget": { - "name": "MyApplicationTarget", - "accessModifier": "public" - } - }, - "path": "./generated/schema/" - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - schemaTypes: ApolloCodegenConfiguration.SchemaTypesFileOutput( - path: "./generated/schema/", - moduleType: .embeddedInTarget(name: "MyApplicationTarget", accessModifier: .public) - ) - ... - ) -) -``` - - - -#### Operations - `relative` - - - -```json title="CLI Configuration JSON" -"output": { - "operations" : { - "relative" : { - "subpath": "Generated", - "accessModifier": "public" - } - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - operations: .relative( - subpath: "generated", - accessModifier: .public - ) - ... - ) -) -``` - - - -#### Operations - `absolute` - - - -```json title="CLI Configuration JSON" -"output": { - "operations" : { - "absolute" : { - "path": "Generated", - "accessModifier": "public" - } - } -} -``` - -```swift title="Swift Codegen Setup" -let configuration = ApolloCodegenConfiguration( - // Other properties not shown - output: ApolloCodegenConfiguration.FileOutput( - operations: .absolute( - path: "generated", - accessModifier: .public - ) - ... - ) -) -``` - - diff --git a/docs/source/migrations/1.3.mdx b/docs/source/migrations/1.3.mdx deleted file mode 100644 index bbbd5050f9..0000000000 --- a/docs/source/migrations/1.3.mdx +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: Apollo iOS 1.3 migration guide -description: From 1.2 to 1.3 ---- - -This guide describes the process of migrating your code from version 1.2 to version 1.3 of Apollo iOS. Please follow the relevant migration guides if you're on a version other than 1.2. - -Though 1.3 is a minor version bump, a few critical bugs were fixed in this version that require some breaking changes during the upgrade. While we strive to make the upgrade path for minor versions seamless, these issues could not be reasonably resolved without requiring this migration. - -## Request Chain Interceptors - -The `ApolloInterceptor` protocol implemented by request chain interceptors has had a minor change in this version. Any custom interceptors you use are now required to be able to identify themselves through a new property. - -The `RequestChain` protocol has also had a minor change in this version. The `proceedAsync(request:response:completion:)` function has been deprecated and replaced with a function named identically except for the inclusion of the interceptor so that it can be identified. This removes the need for the request chain to maintain index positioning of the list of interceptors. - -### Migration Steps - -In order for your custom interceptors to conform to the protocol change you can simply add the following line to your interceptor. -```swift title="Interceptor identification" -public var id: String = UUID().uuidString -``` - -Wherever your custom interceptors call back to the request chain you should replace the call to `proceedAsync(request:response:completion:)` with a call to the new function. -```swift title="Resolve deprecation warning" -chain.proceedAsync( - request: request, - response: response, - interceptor: self, - completion: completion -) -``` -## Reserved Keyword Type Name Suffxing - -When using certain keywords as the name of a GraphQL type the generated code would fail to compile, as a result we decided to enforce the same reserved keyword list already being used for a Selection Set to the following other GraphQL types: - -- Custom Scalar -- Enum -- Fragment -- Input Object -- Interface -- Object -- Union - -Names for these types will be checked (case insensitive) against the following reserved list: - -- ``Any`` -- ``DataDict`` -- ``DocumentType`` -- ``Fragments`` -- ``FragmentContainer`` -- ``ParentType`` -- ``Protocol`` -- ``Schema`` -- ``Selection`` -- ``Self`` -- ``String`` -- ``Bool`` -- ``Int`` -- ``Float`` -- ``Double`` -- ``ID`` -- ``Type`` -- ``Error`` -- ``_`` - -If a reserved keyword is found it will have its type name suffixed based on the type it represents, take the following Enum example: - -```graphql title="Enum Example" -enum Type { - valueOne - valueTwo -} -``` - -This would result in a generated Swift enum that looks like this: - -```swift title="Generated Enum" -enum Type_Enum: String, EnumType -``` - -Not all of the reserved keywords listed cause a compilation error, however we felt it best to apply suffixing to all of them. This could result in some minor breaking changes to your generated code if you are currently using any of the listed reserved keywords and will require you to update their usage to the new suffixed name. \ No newline at end of file diff --git a/docs/source/networking/client-creation.mdx b/docs/source/networking/client-creation.mdx deleted file mode 100644 index 75748a0cbd..0000000000 --- a/docs/source/networking/client-creation.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: Creating a client ---- - -Before you can execute GraphQL operations in your app, you need to initialize an [`ApolloClient`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apolloclient) instance. - -## Basic client creation - -For a basic client with a default configuration, you can initialize [`ApolloClient`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apolloclient) just by providing the `URL` to your GraphQL server. - -```swift -let client = ApolloClient(url: URL(string: "http://localhost:4000/graphql")!) -``` - -The default client configuration uses: -- An [`InMemoryNormalizedCache`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/inmemorynormalizedcache) for [caching response data in-memory](./../caching/cache-setup#inmemorynormalizedcache). -- A [`RequestChainNetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/requestchainnetworktransport) configured to communicate with a spec-compliant GraphQL server over HTTP. -- A [`DefaultInterceptorProvider`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/defaultinterceptorprovider) that supports: - - Reading/writing response data to the normalized cache. - - Sending network requests using `URLSession`. - - Parsing GraphQL response data in JSON format - - [Automatic Persisted Queries](./../fetching/apqs). - -> For more information on the in-memory normalized cache, see its documentation in [Cache Setup](./../caching/cache-setup#inmemorynormalizedcache). -> -> To learn more about the request chain or interceptor providers, check out our [Advanced networking configuration documentation](./request-pipeline). - -## Custom client creation - -If you need to customize your networking client configuration use the designated initializer. - -[`ApolloClient`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apolloclient) is initialized with a `NetworkTransport` object and an `ApolloStore`. - -```swift -public init( - networkTransport: NetworkTransport, - store: ApolloStore -) -``` - -### Network Transport - -Apollo iOS provides the following classes that conform to the [`NetworkTransport` protocol](https://www.apollographql.com/docs/ios/docc/documentation/apollo/networktransport): - -| Class | Description | -|-------|-------------| -| [`RequestChainNetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/requestchainnetworktransport) | Passes a request through a chain of interceptors that can interact with the request both before and after it's transmitted. Uses standard HTTP requests to communicate with the server. | -| [`WebSocketTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollowebsocket/websockettransport) | Transmits _all_ GraphQL operations via WebSocket. Requires the `ApolloWebSocket` library. | -| [`SplitNetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollowebsocket/splitnetworktransport) | Transmits subscription operations via WebSocket and other operations via HTTP. Requires the `ApolloWebSocket` library. | - -> * For more information on `RequestChainNetworkTransport`, learn about [Advanced networking configuration](./request-pipeline). -> -> * For more information on `WebSocketTransport` and `SplitNetworkTransport`, see [Enabling subscription support](./../fetching/subscriptions#enabling-graphql-subscription-support). - -### Apollo Store - -The `ApolloStore` is the cache used for GraphQL response data. The default cache stores response data in-memory. This data is not persisted between application runs. - -To persist cache data on-disk or configure the cache further, you can provide a custom `ApolloStore`. - -> Learn more about customizing your cache with our [Caching documentation](./../caching/introduction). \ No newline at end of file diff --git a/docs/source/networking/request-pipeline.mdx b/docs/source/networking/request-pipeline.mdx deleted file mode 100644 index c0fb85ca6c..0000000000 --- a/docs/source/networking/request-pipeline.mdx +++ /dev/null @@ -1,547 +0,0 @@ ---- -title: Advanced networking configuration -description: Customizing the Apollo iOS Request Chain ---- - -In Apollo iOS, the [`ApolloClient`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apolloclient) uses a [`NetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/networktransport) object to fetch GraphQL queries from a remote GraphQL server. - -The default `NetworkTransport` is the [`RequestChainNetworkTransport`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/requestchainnetworktransport). Appropriately, this network transport uses a structure called a **request chain** to process each operation in individual steps. - -> To learn about configuring your client to support sending subscription operations over a web socket, see [Enabling subscription support](./../fetching/subscriptions#enabling-graphql-subscription-support). - -## Request chains - -A **request chain** defines a sequence of **interceptors** that handle the lifecycle of a particular GraphQL operation's execution. One interceptor might add custom HTTP headers to a request, while the next might be responsible for actually _sending_ the request to a GraphQL server over HTTP. A third interceptor might then write the operation's result to the Apollo iOS cache. - -When an operation is executed, an object called an **`InterceptorProvider`** generates a `RequestChain` for the operation. Then, `kickoff` is called on the request chain, which runs the first interceptor in the chain: - -```mermaid -flowchart TB - operation(Client executes
operation) - operation --> chain(InterceptorProvider
creates request chain) - link1(First
interceptor) - link2(Second
interceptor) - complete(Chain complete) - result(Return Result) - error(Handle Error) - chain--"kickoff called"-->link1 - link1--proceedAsync called-->link2 - link2 --> complete - complete--No result available-->error - complete--Result available-->result - class error secondary; - class result tertiary; -``` - -An interceptor can perform arbitrary, asynchronous logic on any thread. When an interceptor finishes running, it calls `proceedAsync` on its `RequestChain`, which advances to the next interceptor. - -By default when the last interceptor in the chain finishes, if a parsed operation result is available, that result is returned to the operation's original caller. Otherwise, error-handling logic is called. - -**Each request has its own short-lived `RequestChain`.** This means that the sequence of interceptors can differ for each operation. - -## Interceptor providers - -To generate a [request chain](#request-chains) for each GraphQL operation, Apollo iOS passes operations to an object called an **interceptor provider**. This object conforms to the [`InterceptorProvider` protocol](https://www.apollographql.com/docs/ios/docc/documentation/apollo/interceptorprovider). - -### Default provider - -`DefaultInterceptorProvider` is a default implementation of an interceptor provider. This default interceptor provider supports: - - Reading/writing response data to the normalized cache. - - Sending network requests using `URLSession`. - - Parsing GraphQL response data in JSON format - - [Automatic Persisted Queries](./../fetching/apqs). - -The `DefaultInterceptorProvider` is initialized with a `URLSessionClient` and an `ApolloStore` to pass into the interceptors it creates. By configuring these two objects the `DefaultInterceptorProvider` can support most common use cases. - -> If you need to customize your request pipeline further, you can create a [custom interceptor provider](#custom-interceptor-providers). - -#### Default interceptors - -The `DefaultInterceptorProvider` creates a request chain with the following interceptors for _every_ operation. - - - -```mermaid -flowchart TB - max(MaxRetryInterceptor) --> cacheRead(CacheReadInterceptor) - cacheRead --> network(NetworkFetchInterceptor) - network --> response(ResponseCodeInterceptor) - response --> multipart(MultipartResponseParsingInterceptor) - multipart --> json(JSONResponseParsingInterceptor) - json --> apq(AutomaticPersistedQueryInterceptor) - apq --> cacheWrite(CacheWriteInterceptor) -``` - - - -> These built-in interceptors are described [below](#built-in-interceptors). - -### Custom interceptor providers - -> [See an example interceptor provider.](#example-interceptor-provider) - -If your use case requires it, you can create a custom struct or class that conforms to the [`InterceptorProvider` protocol](https://www.apollographql.com/docs/ios/docc/documentation/apollo/interceptorprovider). - -If you define a custom `InterceptorProvider`, it should almost always create a `RequestChain` that uses a similar structure to the [default](#default-interceptors), but that includes additions or modifications as needed for particular operations. - -> **Tip:** If you only need to add interceptors to the beginning or end of the default request chain, you can _subclass_ `DefaultInterceptorProvider` instead of creating a new class from scratch. - -When creating request chains in your custom interceptor provider, note the following: - -* Interceptors are designed to be **short-lived**. Your interceptor provider should provide a completely new set of interceptors for each request to avoid having multiple calls use the same interceptor instance simultaneously. -* Holding references to individual interceptors (outside of test verification) is generally not recommended. Instead, you can create an interceptor that holds onto a longer-lived object, and the provider can pass this object into each new set of interceptors. This way, each interceptor is disposable, but you don't have to recreate the underlying object that does heavier work. - -If you do create your own `InterceptorProvider`, you can use any of the built-in interceptors that are included in Apollo iOS: - -### Built-in interceptors - -Apollo iOS provides a collection of built-in interceptors you can create in a [custom interceptor provider](#custom-interceptor-providers). You can also create a custom interceptor by defining a class that conforms to the [`ApolloInterceptor` protocol](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apollointerceptor). - -> [See examples of custom interceptors](#example-interceptors) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
- -**Pre-network** -
- -##### [`MaxRetryInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/maxretryinterceptor) - - - -Enforces a maximum number of retries for a GraphQL operation that initially fails (default three retries). -
- -##### [`CacheReadInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/cachereadinterceptor) - - - -Reads data from the Apollo iOS cache _before_ an operation is executed on the server, according to that operation's `cachePolicy`. - -If cached data is found that fully resolves the operation, that data is returned. The request chain then continues or terminates according to the operation's `cachePolicy`. -
- -**Network** -
- -##### [`NetworkFetchInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/networkfetchinterceptor) - - - -Takes a [`URLSessionClient`](#the-urlsessionclient-class) and uses it to send the prepared `HTTPRequest` (or subclass thereof) to the GraphQL server. - -If you're sending operations over the network, your `RequestChain` requires this interceptor (or a custom interceptor that handles network communication). - -
- -**Post-network** -
- -##### [`ResponseCodeInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/responsecodeinterceptor) - - - -For unsuccessfully executed operations, checks the response code of the GraphQL server's HTTP response and passes it to the `RequestChain`'s `handleErrorAsync` callback. - -Note that most errors at the GraphQL level are returned with a `200` status code and information in the `errors` array (per the [GraphQL spec](https://spec.graphql.org/draft/#sec-Response-Format)). This interceptor helps with server-level errors (such as `500`s) and errors that are returned by middleware. - -For more information, see [this article on error handling in GraphQL](https://medium.com/@sachee/200-ok-error-handling-in-graphql-7ec869aec9bc). - -
- -##### [`AutomaticPersistedQueryInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/automaticpersistedqueryinterceptor) - - - -Checks a GraphQL server's response _after_ execution to see whether the provided APQ hash for the operation was successfully found by the server. If it _wasn't_, the interceptor restarts the chain and the operation is retried with the full query string. - -
- -##### [`MultipartResponseParsingInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/multipartresponseparsinginterceptor) - - - -Parses a multipart response using the Incremental Delivery over HTTP spec, and passes it on to the next interceptor. - -It is important that the next interceptor must be the JSONResponseParsingInterceptor in order to have the individual messages parsed into a `GraphQLResult`. - -
- -##### [`JSONResponseParsingInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/jsonresponseparsinginterceptor) - - - -Parses a GraphQL server's JSON response into a `GraphQLResult` object and attaches it to the `HTTPResponse`. - -
- -##### [`CacheWriteInterceptor`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/cachewriteinterceptor) - - - -Writes response data to the Apollo iOS cache _after_ an operation is executed on the server, according to that operation's `cachePolicy`. - -
- -#### The `additionalErrorInterceptor` - -An `InterceptorProvider` can optionally provide an `additionalErrorInterceptor` that's called before an error is returned to the caller. This is mostly useful for logging and tracing errors. This interceptor must conform to the [`ApolloErrorInterceptor` protocol](https://www.apollographql.com/docs/ios/docc/documentation/apollo/apolloerrorinterceptor). - -The `additionalErrorInterceptor` is _not_ part of the request chain. Instead, any other interceptor can invoke this interceptor by calling `chain.handleErrorAsync`. - -> **Note:** For _expected_ errors with a clear resolution (such as renewing an expired authentication token), you should define an interceptor _within_ your request chain that can resolve the issue and retry the operation. - -## Interceptor flow - -Most interceptors execute their logic and then call `chain.proceedAsync` to proceed to the next interceptor in the request chain. However, interceptors can call other methods to override this default flow. - -### Retrying an operation - -Any interceptor can call `chain.retry` to immediately restart the current request chain from the beginning. This can be helpful if the interceptor needed to refresh an access token or modify other configuration for the operation to succeed. - -> **Important:** Do not call `retry` in an unbounded way. If your server is returning `500`s or if the user has no internet connection, repeatedly retrying can create an infinite loop of requests (especially if you aren't using the `MaxRetryInterceptor` to limit the number of retries). -> -> Unbounded retries will drain your user's battery and might also run up their data usage. Make sure to only `retry` when there's something your code can do about the original failure! - -### Returning a value - -An interceptor can directly return a value to the operation's original caller, instead of waiting for the request chain to complete. To do so, the interceptor can call `chain.returnValueAsync`. - -**This does not prevent the rest of the request chain from executing.** An interceptor can still call `chain.proceedAsync` as usual after calling `chain.returnValueAsync`. - -You can even call `chain.returnValueAsync` multiple times within a request chain! This is helpful when initially returning a _locally cached_ value before returning a value returned by the GraphQL server. - -### Returning an error - -If an interceptor encounters an error, it can return the details of that error by calling `chain.handleErrorAsync`. - -**This does not prevent the rest of the request chain from executing.** An interceptor can still call `chain.proceedAsync` as usual after calling `chain.handleErrorAsync`. However, if the encountered error will cause the operation to fail, you can skip calling `chain.proceedAsync` to end the request chain. - -## Examples - -The following example snippets demonstrate how to use an advanced request pipeline with custom interceptors. This code assumes you have the following _hypothetical_ classes in your own code (these classes are _not_ part of Apollo iOS): - -- **`UserManager`:** Checks whether the active user is logged in, performs associated checks on errors and responses to see if they need to renew their token, and performs that renewal when necessary. -- **`Logger`:** Handles printing logs based on their level. Supports `.debug`, `.error`, and `.always` log levels. - -### Example interceptors - -#### `UserManagementInterceptor` - -This example interceptor checks whether the active user is logged in. If so, it asynchronously renews that user's access token if it's expired. Finally, it adds the access token to an `Authorization` header before proceeding to the next interceptor in the request chain. - -```swift -import Foundation -import Apollo - -class UserManagementInterceptor: ApolloInterceptor { - enum UserError: Error { - case noUserLoggedIn - } - - public var id: String = UUID().uuidString - - /// Helper function to add the token then move on to the next step - private func addTokenAndProceed( - _ token: Token, - to request: HTTPRequest, - chain: RequestChain, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) { - request.addHeader(name: "Authorization", value: "Bearer \(token.value)") - chain.proceedAsync( - request: request, - response: response, - interceptor: self, - completion: completion - ) - } - - func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) { - guard let token = UserManager.shared.token else { - // In this instance, no user is logged in, so we want to call - // the error handler, then return to prevent further work - chain.handleErrorAsync( - UserError.noUserLoggedIn, - request: request, - response: response, - completion: completion - ) - return - } - - // If we've gotten here, there is a token! - if token.isExpired { - // Call an async method to renew the token - UserManager.shared.renewToken { [weak self] tokenRenewResult in - guard let self = self else { - return - } - - switch tokenRenewResult { - case .failure(let error): - // Pass the token renewal error up the chain, and do - // not proceed further. Note that you could also wrap this in a - // `UserError` if you want. - chain.handleErrorAsync( - error, - request: request, - response: response, - completion: completion - ) - - case .success(let token): - // Renewing worked! Add the token and move on - self.addTokenAndProceed( - token, - to: request, - chain: chain, - response: response, - completion: completion - ) - } - } - } else { - // We don't need to wait for renewal, add token and move on - self.addTokenAndProceed( - token, - to: request, - chain: chain, - response: response, - completion: completion - ) - } - } -} -``` - -#### `RequestLoggingInterceptor` - -This example interceptor logs the outgoing request using the hypothetical `Logger` class, then proceeds to the next interceptor in the request chain: - -```swift -import Foundation -import Apollo - -class RequestLoggingInterceptor: ApolloInterceptor { - - public var id: String = UUID().uuidString - - func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) { - Logger.log(.debug, "Outgoing request: \(request)") - chain.proceedAsync( - request: request, - response: response, - interceptor: self, - completion: completion - ) - } -} -``` - -#### `‌ResponseLoggingInterceptor` - -This example interceptor uses the hypothetical `Logger` class to log the request's response if it exists, then proceeds to the next interceptor in the request chain. - -This is an example of an interceptor that can both proceed _and_ throw an error. We don't necessarily want to stop processing if this interceptor was added in wrong place, but we _do_ want to know about that error. - -```swift -import Foundation -import Apollo - -class ResponseLoggingInterceptor: ApolloInterceptor { - - enum ResponseLoggingError: Error { - case notYetReceived - } - - public var id: String = UUID().uuidString - - func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) { - defer { - // Even if we can't log, we still want to keep going. - chain.proceedAsync( - request: request, - response: response, - interceptor: self, - completion: completion - ) - } - - guard let receivedResponse = response else { - chain.handleErrorAsync( - ResponseLoggingError.notYetReceived, - request: request, - response: response, - completion: completion - ) - return - } - - Logger.log(.debug, "HTTP Response: \(receivedResponse.httpResponse)") - - if let stringData = String(bytes: receivedResponse.rawData, encoding: .utf8) { - Logger.log(.debug, "Data: \(stringData)") - } else { - Logger.log(.error, "Could not convert data to string!") - } - } -} -``` - -### Example interceptor provider - -This `InterceptorProvider` creates request chains using all of the [default interceptors](#default-interceptors) in their usual order, with all of the [example interceptors](#example-interceptors) defined above added at the appropriate points in the request pipeline: - -```swift -import Foundation -import Apollo - -struct NetworkInterceptorProvider: InterceptorProvider { - - // These properties will remain the same throughout the life of the `InterceptorProvider`, even though they - // will be handed to different interceptors. - private let store: ApolloStore - private let client: URLSessionClient - - init(store: ApolloStore, client: URLSessionClient) { - self.store = store - self.client = client - } - - func interceptors(for operation: Operation) -> [ApolloInterceptor] { - return [ - MaxRetryInterceptor(), - CacheReadInterceptor(store: self.store), - UserManagementInterceptor(), - RequestLoggingInterceptor(), - NetworkFetchInterceptor(client: self.client), - ResponseLoggingInterceptor(), - ResponseCodeInterceptor(), - JSONResponseParsingInterceptor(), - AutomaticPersistedQueryInterceptor(), - CacheWriteInterceptor(store: self.store) - ] - } -} -``` - -### Example `ApolloClient` setup - -Here's what it looks like to setup an `ApolloClient` with our example `NetworkInterceptorProvider`. - -```swift -import Foundation -import Apollo - -let client: ApolloClient = { - // The cache is necessary to set up the store, which we're going - // to hand to the provider - let cache = InMemoryNormalizedCache() - let store = ApolloStore(cache: cache) - - let client = URLSessionClient() - let provider = NetworkInterceptorProvider(store: store, client: client) - let url = URL(string: "https://apollo-fullstack-tutorial.herokuapp.com/graphql")! - - let requestChainTransport = RequestChainNetworkTransport( - interceptorProvider: provider, - endpointURL: url - ) - - // Remember to give the store you already created to the client so it - // doesn't create one on its own - return ApolloClient(networkTransport: requestChainTransport, store: store) -}() -``` - -> An example of setting up a client that can handle WebSocket and subscriptions is included in the [subscriptions documentation](./../fetching/subscriptions#creating-an-apolloclient-with-subscription-support). - -## The `URLSessionClient` class - -Because `URLSession` only supports use in the background using the delegate-based API, Apollo iOS provides a [`URLSessionClient`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/urlsessionclient) class that helps manage the `URLSessionDelegate`. - -> Note that because setting up a delegate is only possible in the initializer for `URLSession`, you can only pass `URLSessionClient`'s initializer a `URLSessionConfiguration`, **not** an existing `URLSession`. - -By default, instances of `URLSessionClient` use `URLSessionConfiguration.default` to set up their session, and instances of `DefaultInterceptorProvider` use the default initializer for `URLSessionClient`. - -The `URLSessionClient` class and most of its methods are `open`, so you can subclass it if you need to override any of the delegate methods for the `URLSession` delegates we're using, or if you need to handle additional delegate scenarios. diff --git a/docs/source/project-configuration.mdx b/docs/source/project-configuration.mdx deleted file mode 100644 index 0bcd7b8eec..0000000000 --- a/docs/source/project-configuration.mdx +++ /dev/null @@ -1,311 +0,0 @@ ---- -title: Project configuration -description: Structuring a GraphQL application with the Apollo iOS SDK ---- - -Apollo iOS 1.0 can support complex applications composed of multiple modules _and_ monolithic application targets. - -The code generation engine and modularized structure of the Apollo iOS SDK provide flexible configuration options, enabling you to structure your project as you like. - -This article covers the _models_ generated by Apollo iOS, the _modules_ that compose the Apollo iOS SDK, and how to structure these components in your project. - -## Generated models - -Apollo iOS generates the following groups of files for you: - -* **[Operation models](#operation-models):** Models for the queries, mutations, subscriptions, and fragments defined in your GraphQL files. -* **[Schema types](#schema-types):** Your GraphQL schema's shared types and metadata (e.g., objects, enums, input objects). -* **[Test mocks](#test-mocks):** Test mock objects for your schema types, which you can use to create operation models in your tests. - -#### Operation models - -Apollo iOS generates _operation models_ from the files where you define your GraphQL operations (i.e., queries, mutations, subscriptions, and fragments). - -Operation models are classes that represent your GraphQL operations, which you can then use to make GraphQL requests (via `ApolloClient`). - -Each operation model includes a set of type-safe response model objects, representing that operation's result. When `ApolloClient` successfully executes a GraphQL request, it returns an instance of the corresponding response model for the executed operation. - -> To learn more about GraphQL operations, check out [Defining operations](./fetching/fetching-data#defining-operations). - -#### Schema types - -GraphQL schemas use a type system to define the shape of your available data. GraphQL operations (and your generated operation models) depend on a schema to know how to shape their operations to access a server's data. - -Apollo iOS generates a collection of types that provide the properties and metadata about each type in your GraphQL schema (i.e., objects, interfaces, unions, enums, input objects, etc.). Your generated [operation models](#operation-models) reference these shared schema types to provide type information without duplicating code. - -#### Test mocks - -Apollo iOS enables you to generate test mock objects that you can use in your test targets. These mocks enable you to create operation models for your tests. - -For more details, see [Test Mocks](./testing/test-mocks). - -## Structuring your project - -When including Apollo iOS in a new project, deciding _how_ to structure your project is an essential first step. A large part of this step is determining where your generated GraphQL models fit. - -You can include your GraphQL models in your main application target, spread them across many modules, or expose them as an independent module that multiple applications can use. Depending on the needs and constraints of your project, you'll configure the code generation engine and link to the Apollo iOS libraries differently. - -Below, we cover the three primary decisions you'll need to make about your project structure. - -### Single target vs multi-module - -> ** 1. Does your project consist of a single application target or multiple modules?** - -Depending on the size and complexity of your project, it might be built as a single monolithic application target _or_ be composed of multiple modules. - -For a **monolithic** application, you can link your application target to the `Apollo` library. You can also optionally link to [`ApolloSQLite`](#apollosqlite) and/or [`ApolloWebSocket`](#apollowebsocket) to enable their functionality. - -> For more information about the libraries that make up the Apollo iOS SDK, see the [Apollo iOS SDK](#apollo-ios-sdk-components). - -To include the Apollo iOS SDK in a project with **multiple modules**: - -1. Link `Apollo` to the modules configuring or using the networking and caching APIs. - - Optionally, link `ApolloSQLite` and/or `ApolloWebSocket` to the module that sets up your `ApolloClient` to enable them. -2. Link `ApolloAPI` to the modules that only include generated models. - -Additionally, you can optionally link `ApolloTestSupport` to your unit test target to create mocks of your generated models. - -> ⚠️ **Do not link [`ApolloCodegenLib`](#apollocodegenlib) to your application targets.** -> -> `ApolloCodegenLib` only supports macOS, and you should only link it to development tools that want to use the Apollo code generation engine. - -### Schema types module - -> ** 2. How do you want to include your generated schema types?** - -You can include generated schema types in your project by embedding them directly in your application target or as a separate module. You can configure this using the [`output.schemaTypes`](./code-generation/codegen-configuration#schema-types) property in your codegen configuration. - -When setting up codegen for the first time, you'll need to specify a location path for the generated module and the [`moduleType`](./code-generation/codegen-configuration#module-type). The `moduleType` property configures how the code generation engine links generated schema types in your project. - -For most projects, we recommend creating a separate schema module. This enables you to share your generated models across modules as your project grows. For simple single-target applications, you can embed your schema types directly in your target. - -#### Creating a schema module - -You can link a schema module to every module that includes or consumes your generated operation models. - -The code generation engine can automate the creation of schema modules for the Swift Package Manager. The code generation engine is also flexible enough to support manual configuration for projects that require customized dependencies. - -Use the [`.swiftPackageManager`](./code-generation/codegen-configuration#swift-package-manager) or [`.other`](./code-generation/codegen-configuration#other-schema-module-types) options to generate a schema types module. - -> Most dependency managers (e.g., SPM and Cocoapods) can automatically include your generated files in the module's directory. This means that when generated files are added or removed from the generated module, they are linked to your project automatically. - -#### Embedded in your application - -You can also include schema types directly in a target that you created. - -To do this, use [`ModuleType.embeddedInTarget(name: String)`](./code-generation/codegen-configuration#embedded-in-target) as the value of the [`output.schemaTypes.moduleType`](./code-generation/codegen-configuration#module-type) property. The generated schema types are scoped within a caseless enum used as a namespace to prevent conflicts with types you may already have defined in your target. - -If you require more control over your schema types you can use the [`ModuleType.other`](./code-generation/codegen-configuration#other) value. This gives you full control over the module and your choice of dependency manager. - -> These options makes you responsible for **manually** adding generated files to your chosen target or module. When the code generation engine creates or removes files, you'll need to manually add or remove them from the project navigator. - -### Operation model generation - -> ** 3. Where should your generated operation models live?** - -Finally, choose how you want to use operation models in your project. You can configure this using the [`output.operations`](./code-generation/codegen-configuration#operations) property in your codegen configuration. - -The only requirements are that your operation models have access to your schema types and the `ApolloAPI` target to compile successfully. - -Generally, you'll decide between two options: [confined models](#confined-models) or [shared models](#shared-models). - -#### Confined models - -If you want to organize your generated models by specific feature areas or modules, use the [`OperationsFileOutput.relative(subpath: String?)`](./code-generation/codegen-configuration#relative-operations-output) value for the [`output.operations`](./code-generation/codegen-configuration#operations) property. The code generation engine now generates your operation models relative to the `.graphql` files that define them. - -This option gives you the most flexibility and control over your operation models. You can generate them anywhere in your project structure by organizing your `.graphql` operation definitions. - -With relative paths, you can: -- Co-locate models alongside the feature code using them -- Include models in different modules across your project -- Organize models based on feature area -- Or use any other structure your project needs - -> When including your operation models in a multi-module project, ensure that any modules that include your operation models link to **both** your [schema types module](#schema-types-module) and the [`ApolloAPI` library](#apolloapi). - -#### Shared models - -You can also share your generated operation models across modules in your project. You can do this by including them within the shared schema types module or by manually including them in another shared module. - -##### Bundling within a shared schema type module - -For most small projects, including your operation models within the shared schema type module is the most straightforward way to share them. With this structure, your operation models are in a sub-folder of the schema types module directory. - -You can do this using the [`.inSchemaModule`](./code-generation/codegen-configuration#operations-in-the-schema-module) option for the [`output.operations`](./code-generation/codegen-configuration#operations) property: - - _If you have a schema module_, the codegen engine includes your operations in that module, which you can then import into your project's other modules. - - _If you are embedding your schema in another target_, the codegen engine includes your operations in the generated schema namespace in your application target. - -##### Absolute path - -You can also generate your operation models into a single directory using the [`.absolute(path:)`](./code-generation/codegen-configuration#absolute-operations-output) option. Then, you can manually include this directory in your project however you see fit. - -If you choose to generate the operation models to an absolute path, you are responsible for linking the generated files to the rest of your project. You must ensure that any targets included by your operation models link to both your schema types module and the `ApolloAPI` library. - -### Supporting other configurations - -Above, we've shared the most common examples of modular architecture, but there are many alternative configurations we haven't covered. - -Apollo iOS has different options to support flexible configurations of your schema types and operation models. We recommend familiarizing yourself with Apollo iOS's [codegen configuration](./code-generation/codegen-configuration) to find a combination that best suits your project needs. - -## Apollo iOS SDK components - -> **For Cocoapods users:** -> -> Cocoapods combines subspecs into a single target. This means that: -> - The [`ApolloAPI`](#apolloapi) is merged into the [`Apollo`](#apollo) target. -> - If you use the [`ApolloSQLite`](#apollosqlite) and [`ApolloWebSocket`](#apollowebsocket) subspecs, they are also merged into the `Apollo` target. - -Libraries that compose the Apollo iOS package: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DescriptionUsage
- -#### `Apollo` - -
- -The core Apollo client library. - -Includes the networking and caching APIs, including `ApolloClient` and `ApolloStore`. - - - -Any targets that need to access these core components directly should be linked against `Apollo`. - -
- -#### `ApolloAPI` - -
- -Includes the common components that generated models use for your project. - - - -Any targets that include your generated models should be linked to `ApolloAPI`. - -The `Apollo` library has a dependency on this target, so any target that links to `Apollo` doesn't need to link to `ApolloAPI` directly. - -Because generated models export the `ApolloAPI` library's interface, targets that consume generated models but don't _contain_ them don't need to link to `ApolloAPI` directly. - -
- -#### `ApolloSQLite` - -
- -Provides a `NormalizedCache` implementation backed by a `SQLite` database. - - - -Use this library if you'd like to persist cache data across application lifecycles. This library only needs to be linked to your targets that configure the `SQLiteNormalizedCache` and pass it to the `ApolloStore`. - -For more information on setting up a persistent SQLite cache, see[`SQLiteNormalizedCache`](./caching/cache-setup#sqlitenormalizedcache). - -
- -#### `ApolloWebSocket` - -
- -Provides a web socket transport implementation that supports `GraphQLSubscription` operations. - - - -If your project uses GraphQL subscriptions, you **must** include this library. This library only needs to be linked to your targets that configure the `WebSocketTransport` and pass it to the `ApolloClient`. - -For more information, see [Enabling GraphQL subscription support](./fetching/subscriptions#enabling-graphql-subscription-support). - -
- -#### `ApolloTestSupport` - -
- -Includes the APIs for creating test mocks for your generated models - - - -Link this library to *unit test targets* that need to create mocks of generated models. - -
- -#### `ApolloCodegenLib` - -
- -Includes the code generation engine for generating GraphQL models. - -For most projects, **we strongly recommend using the Codegen CLI** instead of using `ApolloCodegenLib` directly. - - - -Use this library if you want to run the code generation engine from your own Swift executable targets. - -Link this library to development tools that want to use the Apollo code generation engine. This library only supports macOS. - -**`ApolloCodegenLib` shouldn't be linked to your application targets.** - -
diff --git a/docs/source/screenshot/apollo-xcode-plugin.png b/docs/source/screenshot/apollo-xcode-plugin.png deleted file mode 100644 index 8443af04b1..0000000000 Binary files a/docs/source/screenshot/apollo-xcode-plugin.png and /dev/null differ diff --git a/docs/source/screenshot/spm_packages_add_package.png b/docs/source/screenshot/spm_packages_add_package.png deleted file mode 100644 index 2ef90687d7..0000000000 Binary files a/docs/source/screenshot/spm_packages_add_package.png and /dev/null differ diff --git a/docs/source/screenshot/spm_packages_dialog.png b/docs/source/screenshot/spm_packages_dialog.png deleted file mode 100644 index ded7f1aa56..0000000000 Binary files a/docs/source/screenshot/spm_packages_dialog.png and /dev/null differ diff --git a/docs/source/screenshot/spm_select_package.png b/docs/source/screenshot/spm_select_package.png deleted file mode 100644 index 0a5fdfb3fb..0000000000 Binary files a/docs/source/screenshot/spm_select_package.png and /dev/null differ diff --git a/docs/source/screenshot/studio-starwarsapi-download.png b/docs/source/screenshot/studio-starwarsapi-download.png deleted file mode 100644 index 661028ef51..0000000000 Binary files a/docs/source/screenshot/studio-starwarsapi-download.png and /dev/null differ diff --git a/docs/source/testing/test-mocks.mdx b/docs/source/testing/test-mocks.mdx deleted file mode 100644 index 8a24fbfd97..0000000000 --- a/docs/source/testing/test-mocks.mdx +++ /dev/null @@ -1,184 +0,0 @@ ---- -title: Test mocks ---- - -When unit testing code that uses your generated operation models, you will often want to create response models with mock data. Apollo iOS provides generated test mocks that facilitate this. - -## Purpose - -Generated test mocks provide a type-safe way to mock your response models. Rather than dealing with cumbersome and error prone JSON data, test mocks make mocking safer,more concise, and reusable. They are mutable, offer code completion in Xcode, and update with new fields automatically as your schema and operations change. - -### Mocking GraphQL responses with JSON - -Because the generated response models are backed by a JSON dictionary, initializing them with mock data without generated test mocks is verbose and error-prone. You need to create stringly-typed JSON dictionaries that are structured exactly like the expected network response to ensure the your models parse properly. - -```swift -let data: [String: AnyHashable] = [ - "data": [ - "__typename": "Query", - "hero": [ - "__typename": "Human", - "id": "123", - "name": "Obi-wan Kenobi", - "friends": [ - [ - "__typename": "Human", - "id": "456", - "name": "Padme Amidala" - ], - [ - "__typename": "Droid", - "id": "789", - "name": "C-3PO" - ] - ] - ] - ] -] - -let model = HeroAndFriendsQuery.Data(data: DataDict(data)) - -XCTAssertEqual(model.hero.friends[1].name, "C-3PO") -``` - -Constructing and maintaining these JSON dictionaries in your tests is cumbersome and time consuming. - -### Mocking GraphQL responses with generated test mocks - -Generated test mocks provide a type-safe way to build mocks of your response models, without using stringly-typed JSON. - -```swift -let mock = Mock( - hero: Mock( - id: "123", - name: "Obi-wan Kenobi", - friends: [ - Mock( - id: "456", - name: "Padme Amidala" - ), - Mock( - id: "780", - name: "C-3PO" - ) - ] - ) -) - -let model = HeroAndFriendsQuery.Data.from(mock) - -XCTAssertEqual(model.hero.friends[1].name, "C-3PO") -``` - -## Setting up test mocks - -To generate test mocks along side your schema types and operation models, configure your code generation configuration to include them as described in [code generation configuration - Test mocks](./../code-generation/codegen-configuration#test-mocks). - -Once you've generated test mocks and linked them to your unit test target, you will need to import `ApolloTestSupport` in your unit tests to start using them. - -```swift -import MyTestMocksTarget -import ApolloTestSupport -import XCTest - -class HeroAndFriendsQueryFetchingTests: XCTestCase { - ... -} -``` - -## Usage - -Fields in a GraphQL operation can be of abstract types (`interface` or `union`). This means we don't always know what type of object a field in a response model will be. When using [type conditions](./../fetching/type-conditions) in our operations, the possible values for a response object can be very different depending on what object type is returned for the field. Because of this, generating intializers for our operation response models directly would require tens or hundreds of different generated initializers for every response object. - -Instead, Apollo iOS generates `MockObject` types based on your schema object types. You create a mock of a concrete object type from your schema as, and set fields on it. Then you can use this mock object to initialize any response model. This allows you to build mock data for objects and use them with multiple tests and response models. - -### Creating test mocks - -You can create a mock of any object type by initializing the generic `Mock` class and specifying a `MockObject` type. - -Because test mocks require you to use a concrete object type, the `__typename` field automatically included whenever the object is used in a response model. - -```swift -let grevious = Mock() - -print(grevious.__typename) // "Droid" -``` - -### Setting properties on test mocks - -Each `MockObject` has generated properties for each field that could be fetched on that object type across all the operations in your project. If a field on your GraphQL schema is never fetched by your application, it won't be generated on your test mock objects. - -When using your test mocks in a unit test, you may only be concerned about a subset of the required fields on the response object. Test mocks don't require you to initialize values for any fields you are not using in your tests. - -You can initialize them with no data, and then set only the fields relevant for your test. Apollo iOS also generates convenience initializers for each concrete object type. - - - -```swift -let grevious = Mock() -grevious.name = "General Grevious" -grevious.numberOfArms = 4 - -let dooku = Mock() -dooku.name = "Count Dooku" - -grevious.friends = [dooku] -``` - -```swift -let grevious = Mock( - name: "General Grevious", - numberOfArms: 4, - friends: [ - Mock(name: "Count Dooku") - ] -) -``` - - - -### Creating response models from test mocks - -Once you've initialized your mock objects, you can construct any of your generated response models with them. You do not need to create mocks for an entire operation's response model, just the objects your are using in your tests. You can also convert your mocks into your generated [fragment models](../fetching/fragments#fragment-reuse). - -All generated response models conform to the `SelectionSet` protocol. To create a model with a test mock, call `from(_ mock:)` on the model's type. - -```swift -let mockLuke = Mock(name: "Luke Skywalker") -let heroQueryModel = HeroAndFriendsQuery.Data.Hero.from(mockLuke) - -let mockLeia = Mock(name: "Leia Organa") -let heroDetailsFragmentModel = HeroDetails.from(mockLeia) -``` - -You can then use the created response models in your unit tests. - -> **Note:** Make sure to set all of the properties on your mocks that are going to be accessed during your test's execution. If your program accesses a required property on a response model and it's test mock does not contain that field, your tests will crash! - -### Reusing test mocks - -The same test mock can be used to create multiple different response models. - -```swift -let mock = Mock(name: "Luke Skywalker") - -let hero = HeroAndFriendsQuery.Data.Hero.from(mock) -let heroDetails = HeroDetailsFragment.from(mock) -let mutationResponseModel = HeroDetailsMutation.Data.Hero(mock) -``` - -While `Mock` a `class`, your generated response models are `structs` with value semantics. This means that when you create a response model, it creates it's own copy of the test mock's data. If you mutate the test mock's data after creating a response model, that model's data will be unaffected. - -```swift -let mock = Mock(name: "Luke Skywalker") - -let hero = HeroAndFriendsQuery.Data.Hero.from(mock) -print(hero.name) // "Luke Skywalker" - -mock.name = "Leia Organa" -let heroDetails = HeroDetailsFragment.from(mock) -print(heroDetails.name) // "Leia Organa" - -/// The `hero` has not had it's data mutated. -print(hero.name) // "Luke Skywalker" -``` diff --git a/docs/source/troubleshooting/codegen-troubleshooting.mdx b/docs/source/troubleshooting/codegen-troubleshooting.mdx deleted file mode 100644 index 0ad4c801c0..0000000000 --- a/docs/source/troubleshooting/codegen-troubleshooting.mdx +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: Code Generation Troubleshooting -sidebar_title: Code Generation ---- - -# Errors - -## TypeNameConflict - -Example error output: - -```text title="TypeNameConflict error output" -TypeNameConflict - Field 'values' conflicts with field 'value' in operation/fragment `ConflictingQuery`. Recommend using a field alias for one of these fields to resolve this conflict. -``` - -If you receive this error, you have an Operation or Fragment that is resulting in multiple types of the same name due to how singularization/pluralization works in code generation. Take the following schema and query defintion for example: - -```graphql title="Example Schema" -type Query { - user: User -} - -type User { - containers: [Container] -} - -type Container { - value: Value - values: [Value] -} - -type Value { - propertyA: String! - propertyB: String! - propertyC: String! - propertyD: String! -} -``` - -```graphql title="ConflictingQuery" -query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - - values { - propertyA - propertyC - } - } - } -} -``` - -If you run code generation with these you will get the `TypeNameConflict` error because the generated code for your query would contain code that looks like this: - -TypeNameConflict example code output - -As the error says, the recommended way to solve this is to use a field alias, so updating the query to be this: - -```graphql title="ConflictingQuery" -query ConflictingQuery { - user { - containers { - value { - propertyA - propertyB - propertyC - propertyD - } - - valueAlias: values { - propertyA - propertyC - } - } - } -} -``` - -If you run the code generation with the update query you will no longer see the error and the resulting code will look like this: - -TypeNameConflict alias example code output \ No newline at end of file diff --git a/docs/source/troubleshooting/images/type_name_conflict_alias_output.png b/docs/source/troubleshooting/images/type_name_conflict_alias_output.png deleted file mode 100644 index 371e3b1704..0000000000 Binary files a/docs/source/troubleshooting/images/type_name_conflict_alias_output.png and /dev/null differ diff --git a/docs/source/troubleshooting/images/type_name_conflict_example_output.png b/docs/source/troubleshooting/images/type_name_conflict_example_output.png deleted file mode 100644 index f4d9adb8a5..0000000000 Binary files a/docs/source/troubleshooting/images/type_name_conflict_example_output.png and /dev/null differ diff --git a/docs/source/tutorial/codegen-getting-started.mdx b/docs/source/tutorial/codegen-getting-started.mdx deleted file mode 100644 index 0d46a1f4a1..0000000000 --- a/docs/source/tutorial/codegen-getting-started.mdx +++ /dev/null @@ -1,278 +0,0 @@ ---- -title: Get started with Apollo iOS codegen ---- - -This short tutorial guides you through the basic concepts of generating Swift code with Apollo iOS. We'll introduce you the core capabilities of code generation, and walk through the process of generating Swift code using a GraphQL schema and GraphQL operations. - -> For more in-depth details, see [Code generation](../code-generation/introduction). - -## Step 1: Project Setup - -Start by creating a new directory, and navigating into it: - -```shell -mkdir ios-code-gen-example -cd ios-code-gen-example -``` - -## Step 2: Download a GraphQL schema - -We'll use the [StarWars GraphQL API](https://studio.apollographql.com/public/star-wars-swapi/home?variant=current) for this example. You can check this schema out using [Apollo Studio](https://studio.apollographql.com/public/star-wars-swapi/schema/sdl?variant=current). - -Where to download a schema from Apollo Studio - -On the right-hand side in Apollo Studio find the drop-down to download the schema, shown in the above screenshot. Apollo Studio supports both `JSON` or `Raw` formats. For this tutorial select `Raw` which downloads the GraphQL schema in the Schema Definition Language (SDL) format. - -Clicking `Raw` will download a file named `star-wars-swapi@current.graphql`. - -## Step 3: Move the downloaded schema into your project - -Download or move the already downloaded `star-wars-swapi@current.graphql` file into the directory you created in [Step 1](#step-1-setup). - -Rename the file extension from `.graphql` to `.graphqls`. Note the `s` on the end signifying a GraphQL schema file. - -## Step 4: Create a GraphQL operation - -You'll also need to create a GraphQL operation file because the code generation engine requires both a schema and at least one operation to generate code. - -We'll be using the [allFilms Query operation](https://studio.apollographql.com/public/star-wars-swapi/explorer?variant=current) as an example. Clicking this link will open Explorer in Apollo Studio where you can select the fields you would like to be fetched. Alternatively, the query text below already has fields selected. - -Copy the query text and create a new file named `AllFilmsQuery.graphql` in the directory you created in [Step 1](#step-1-setup). Paste this query into the new file. - -```graphql -query Query { - allFilms { - films { - title - director - releaseDate - speciesConnection { - species { - name - classification - homeworld { - name - } - } - } - } - } -} -``` - -## Step 5: Download the CLI - -Browse to the list of [Apollo iOS releases](https://github.com/apollographql/apollo-ios/releases) in GitHub and find the latest release. In the Assets list for each release will be a pre-built CLI binary called `apollo-ios-cli.tar.gz` - -Download and unzip this file then move the `apollo-ios-cli` binary file into the directory you created in [Step 1](#step-1-setup). - -> For more information on the different ways to install the CLI, see the [codegen CLI](../code-generation/codegen-cli#installation) documentation. - -## Step 6: Create a codegen configuration - -Run the following command: - -```bash -./apollo-ios-cli init --schema-namespace StarWarsAPI --module-type swiftPackageManager -``` - -The CLI will create a configuration file named `apollo-codegen-configuration.json`, pre-filled with default values. The file should look similar to this: - -```json -{ - "schemaNamespace": "StarWarsAPI", - "input": { - "operationSearchPaths": ["**/*.graphql"], - "schemaSearchPaths": ["**/*.graphqls"] - }, - "output": { - "testMocks": { - "none": {} - }, - "schemaTypes": { - "path": "./StarWarsAPI", - "moduleType": { - "swiftPackageManager": {} - } - }, - "operations": { - "inSchemaModule": {} - } - } -} -``` - -### Step 7: Generate code - -Now you are ready to generate some code! Run the following command: - -```bash -./apollo-ios-cli generate -``` - -You should see a new file created at `StarWarsAPI/Sources/Operations/Queries/Query.graphql.swift`, that looks similar to this: - - - -```swift - -// @generated -// This file was automatically generated and should not be edited. - -@_exported import ApolloAPI -import StarWarsAPI - -public class Query: GraphQLQuery { - public static let operationName: String = "Query" - public static let document: DocumentType = .notPersisted( - definition: .init( - """ - query Query { - allFilms { - __typename - films { - __typename - title - director - releaseDate - speciesConnection { - __typename - species { - __typename - name - classification - homeworld { - __typename - name - } - } - } - } - } - } - """ - )) - - public init() {} - - public struct Data: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(data: DataDict) { __data = data } - - public static var __parentType: ParentType { StarWarsAPI.Objects.Root } - public static var __selections: [Selection] { [ - .field("allFilms", AllFilms?.self), - ] } - - public var allFilms: AllFilms? { __data["allFilms"] } - - /// AllFilms - /// - /// Parent Type: `FilmsConnection` - public struct AllFilms: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(data: DataDict) { __data = data } - - public static var __parentType: ParentType { StarWarsAPI.Objects.FilmsConnection } - public static var __selections: [Selection] { [ - .field("films", [Film?]?.self), - ] } - - /// A list of all of the objects returned in the connection. This is a convenience - /// field provided for quickly exploring the API; rather than querying for - /// "{ edges { node } }" when no edge data is needed, this field can be be used - /// instead. Note that when clients like Relay need to fetch the "cursor" field on - /// the edge to enable efficient pagination, this shortcut cannot be used, and the - /// full "{ edges { node } }" version should be used instead. - public var films: [Film?]? { __data["films"] } - - /// AllFilms.Film - /// - /// Parent Type: `Film` - public struct Film: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(data: DataDict) { __data = data } - - public static var __parentType: ParentType { StarWarsAPI.Objects.Film } - public static var __selections: [Selection] { [ - .field("title", String?.self), - .field("director", String?.self), - .field("releaseDate", String?.self), - .field("speciesConnection", SpeciesConnection?.self), - ] } - - /// The title of this film. - public var title: String? { __data["title"] } - /// The name of the director of this film. - public var director: String? { __data["director"] } - /// The ISO 8601 date format of film release at original creator country. - public var releaseDate: String? { __data["releaseDate"] } - public var speciesConnection: SpeciesConnection? { __data["speciesConnection"] } - - /// AllFilms.Film.SpeciesConnection - /// - /// Parent Type: `FilmSpeciesConnection` - public struct SpeciesConnection: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(data: DataDict) { __data = data } - - public static var __parentType: ParentType { StarWarsAPI.Objects.FilmSpeciesConnection } - public static var __selections: [Selection] { [ - .field("species", [Specy?]?.self), - ] } - - /// A list of all of the objects returned in the connection. This is a convenience - /// field provided for quickly exploring the API; rather than querying for - /// "{ edges { node } }" when no edge data is needed, this field can be be used - /// instead. Note that when clients like Relay need to fetch the "cursor" field on - /// the edge to enable efficient pagination, this shortcut cannot be used, and the - /// full "{ edges { node } }" version should be used instead. - public var species: [Specy?]? { __data["species"] } - - /// AllFilms.Film.SpeciesConnection.Specy - /// - /// Parent Type: `Species` - public struct Specy: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(data: DataDict) { __data = data } - - public static var __parentType: ParentType { StarWarsAPI.Objects.Species } - public static var __selections: [Selection] { [ - .field("name", String?.self), - .field("classification", String?.self), - .field("homeworld", Homeworld?.self), - ] } - - /// The name of this species. - public var name: String? { __data["name"] } - /// The classification of this species, such as "mammal" or "reptile". - public var classification: String? { __data["classification"] } - /// A planet that this species originates from. - public var homeworld: Homeworld? { __data["homeworld"] } - - /// AllFilms.Film.SpeciesConnection.Specy.Homeworld - /// - /// Parent Type: `Planet` - public struct Homeworld: StarWarsAPI.SelectionSet { - public let __data: DataDict - public init(data: DataDict) { __data = data } - - public static var __parentType: ParentType { StarWarsAPI.Objects.Planet } - public static var __selections: [Selection] { [ - .field("name", String?.self), - ] } - - /// The name of this planet. - public var name: String? { __data["name"] } - } - } - } - } - } - } -} -``` - - - -And that's it! You can also review all the additional generated files to get a deeper understanding of how code generation works using the Apollo iOS client. diff --git a/docs/source/tutorial/images/add_info_to_list.png b/docs/source/tutorial/images/add_info_to_list.png deleted file mode 100644 index d6e0901612..0000000000 Binary files a/docs/source/tutorial/images/add_info_to_list.png and /dev/null differ diff --git a/docs/source/tutorial/images/add_local_package.png b/docs/source/tutorial/images/add_local_package.png deleted file mode 100644 index d6d8e2da52..0000000000 Binary files a/docs/source/tutorial/images/add_local_package.png and /dev/null differ diff --git a/docs/source/tutorial/images/add_local_package_browser.png b/docs/source/tutorial/images/add_local_package_browser.png deleted file mode 100644 index fb4ebc0c80..0000000000 Binary files a/docs/source/tutorial/images/add_local_package_browser.png and /dev/null differ diff --git a/docs/source/tutorial/images/add_new_query_file.png b/docs/source/tutorial/images/add_new_query_file.png deleted file mode 100644 index 8af676a662..0000000000 Binary files a/docs/source/tutorial/images/add_new_query_file.png and /dev/null differ diff --git a/docs/source/tutorial/images/add_package_dialog.png b/docs/source/tutorial/images/add_package_dialog.png deleted file mode 100644 index 0fec382afb..0000000000 Binary files a/docs/source/tutorial/images/add_package_dialog.png and /dev/null differ diff --git a/docs/source/tutorial/images/completed_id_query.png b/docs/source/tutorial/images/completed_id_query.png deleted file mode 100644 index 259a466709..0000000000 Binary files a/docs/source/tutorial/images/completed_id_query.png and /dev/null differ diff --git a/docs/source/tutorial/images/connect_query_to_launch_list.png b/docs/source/tutorial/images/connect_query_to_launch_list.png deleted file mode 100644 index 2de847d896..0000000000 Binary files a/docs/source/tutorial/images/connect_query_to_launch_list.png and /dev/null differ diff --git a/docs/source/tutorial/images/detail_view_complete.png b/docs/source/tutorial/images/detail_view_complete.png deleted file mode 100644 index 3e9646b3c6..0000000000 Binary files a/docs/source/tutorial/images/detail_view_complete.png and /dev/null differ diff --git a/docs/source/tutorial/images/dont_add_query_file_to_target.png b/docs/source/tutorial/images/dont_add_query_file_to_target.png deleted file mode 100644 index a97a4339fc..0000000000 Binary files a/docs/source/tutorial/images/dont_add_query_file_to_target.png and /dev/null differ diff --git a/docs/source/tutorial/images/empty_file_template.png b/docs/source/tutorial/images/empty_file_template.png deleted file mode 100644 index dbc1621dec..0000000000 Binary files a/docs/source/tutorial/images/empty_file_template.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_add_auth_header.png b/docs/source/tutorial/images/explorer_add_auth_header.png deleted file mode 100644 index b1a2cefbfe..0000000000 Binary files a/docs/source/tutorial/images/explorer_add_auth_header.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_add_launches_query.png b/docs/source/tutorial/images/explorer_add_launches_query.png deleted file mode 100644 index 52ae2d5ab4..0000000000 Binary files a/docs/source/tutorial/images/explorer_add_launches_query.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_added_empty_tab.png b/docs/source/tutorial/images/explorer_added_empty_tab.png deleted file mode 100644 index a543eb3611..0000000000 Binary files a/docs/source/tutorial/images/explorer_added_empty_tab.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_added_login_mutation.png b/docs/source/tutorial/images/explorer_added_login_mutation.png deleted file mode 100644 index cb09b360a5..0000000000 Binary files a/docs/source/tutorial/images/explorer_added_login_mutation.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_authentication_header.png b/docs/source/tutorial/images/explorer_authentication_header.png deleted file mode 100644 index 0d44cb1f5f..0000000000 Binary files a/docs/source/tutorial/images/explorer_authentication_header.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_autocomplete.png b/docs/source/tutorial/images/explorer_autocomplete.png deleted file mode 100644 index 8b3f90af56..0000000000 Binary files a/docs/source/tutorial/images/explorer_autocomplete.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_book_trips_starter.png b/docs/source/tutorial/images/explorer_book_trips_starter.png deleted file mode 100644 index 34b995bf17..0000000000 Binary files a/docs/source/tutorial/images/explorer_book_trips_starter.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_book_with_trip_id_singular.png b/docs/source/tutorial/images/explorer_book_with_trip_id_singular.png deleted file mode 100644 index ceb33f9969..0000000000 Binary files a/docs/source/tutorial/images/explorer_book_with_trip_id_singular.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_book_with_trip_ids.png b/docs/source/tutorial/images/explorer_book_with_trip_ids.png deleted file mode 100644 index e28ab4aeeb..0000000000 Binary files a/docs/source/tutorial/images/explorer_book_with_trip_ids.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_cancel_trip_mutation.png b/docs/source/tutorial/images/explorer_cancel_trip_mutation.png deleted file mode 100644 index 6c9bd80cb1..0000000000 Binary files a/docs/source/tutorial/images/explorer_cancel_trip_mutation.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_check_cursor.png b/docs/source/tutorial/images/explorer_check_cursor.png deleted file mode 100644 index 0db0c03f0f..0000000000 Binary files a/docs/source/tutorial/images/explorer_check_cursor.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_cursor.png b/docs/source/tutorial/images/explorer_cursor.png deleted file mode 100644 index 7c6f2abb10..0000000000 Binary files a/docs/source/tutorial/images/explorer_cursor.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_details_renamed.png b/docs/source/tutorial/images/explorer_details_renamed.png deleted file mode 100644 index 2cee405dd0..0000000000 Binary files a/docs/source/tutorial/images/explorer_details_renamed.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_initial_added_query.png b/docs/source/tutorial/images/explorer_initial_added_query.png deleted file mode 100644 index 5f5e574e72..0000000000 Binary files a/docs/source/tutorial/images/explorer_initial_added_query.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_launch_detail_result.png b/docs/source/tutorial/images/explorer_launch_detail_result.png deleted file mode 100644 index 8f3ed84dd3..0000000000 Binary files a/docs/source/tutorial/images/explorer_launch_detail_result.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_launch_list_initial_response.png b/docs/source/tutorial/images/explorer_launch_list_initial_response.png deleted file mode 100644 index d0ea9adefa..0000000000 Binary files a/docs/source/tutorial/images/explorer_launch_list_initial_response.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_launch_list_rename.png b/docs/source/tutorial/images/explorer_launch_list_rename.png deleted file mode 100644 index 5d0a602e09..0000000000 Binary files a/docs/source/tutorial/images/explorer_launch_list_rename.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_launch_query_start.png b/docs/source/tutorial/images/explorer_launch_query_start.png deleted file mode 100644 index 1e30702c0e..0000000000 Binary files a/docs/source/tutorial/images/explorer_launch_query_start.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_launches_drill_in.png b/docs/source/tutorial/images/explorer_launches_drill_in.png deleted file mode 100644 index d07ea24ab3..0000000000 Binary files a/docs/source/tutorial/images/explorer_launches_drill_in.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_login_email_added.png b/docs/source/tutorial/images/explorer_login_email_added.png deleted file mode 100644 index dd23eefab0..0000000000 Binary files a/docs/source/tutorial/images/explorer_login_email_added.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_meatball_copy.png b/docs/source/tutorial/images/explorer_meatball_copy.png deleted file mode 100644 index 2aea9dc790..0000000000 Binary files a/docs/source/tutorial/images/explorer_meatball_copy.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_new_tab.png b/docs/source/tutorial/images/explorer_new_tab.png deleted file mode 100644 index 531fe29668..0000000000 Binary files a/docs/source/tutorial/images/explorer_new_tab.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_query_list.png b/docs/source/tutorial/images/explorer_query_list.png deleted file mode 100644 index ea68d9e93a..0000000000 Binary files a/docs/source/tutorial/images/explorer_query_list.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_rocket_back.png b/docs/source/tutorial/images/explorer_rocket_back.png deleted file mode 100644 index 6a95fd0da5..0000000000 Binary files a/docs/source/tutorial/images/explorer_rocket_back.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_rocket_drill_in.png b/docs/source/tutorial/images/explorer_rocket_drill_in.png deleted file mode 100644 index 9c7134d1b8..0000000000 Binary files a/docs/source/tutorial/images/explorer_rocket_drill_in.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_sandbox_open.png b/docs/source/tutorial/images/explorer_sandbox_open.png deleted file mode 100644 index fc9bdff6fd..0000000000 Binary files a/docs/source/tutorial/images/explorer_sandbox_open.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_submit_operation.png b/docs/source/tutorial/images/explorer_submit_operation.png deleted file mode 100644 index ab724262fb..0000000000 Binary files a/docs/source/tutorial/images/explorer_submit_operation.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_subscription_success.png b/docs/source/tutorial/images/explorer_subscription_success.png deleted file mode 100644 index 977afd795d..0000000000 Binary files a/docs/source/tutorial/images/explorer_subscription_success.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_subscriptions_listening.png b/docs/source/tutorial/images/explorer_subscriptions_listening.png deleted file mode 100644 index 0290c15f70..0000000000 Binary files a/docs/source/tutorial/images/explorer_subscriptions_listening.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_trip_cancelled.png b/docs/source/tutorial/images/explorer_trip_cancelled.png deleted file mode 100644 index e245d44287..0000000000 Binary files a/docs/source/tutorial/images/explorer_trip_cancelled.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_tripsbooked_initial.png b/docs/source/tutorial/images/explorer_tripsbooked_initial.png deleted file mode 100644 index 1a96d57f41..0000000000 Binary files a/docs/source/tutorial/images/explorer_tripsbooked_initial.png and /dev/null differ diff --git a/docs/source/tutorial/images/explorer_tripsbooked_renamed.png b/docs/source/tutorial/images/explorer_tripsbooked_renamed.png deleted file mode 100644 index 0cb482cee0..0000000000 Binary files a/docs/source/tutorial/images/explorer_tripsbooked_renamed.png and /dev/null differ diff --git a/docs/source/tutorial/images/generated_swift_package_folder.png b/docs/source/tutorial/images/generated_swift_package_folder.png deleted file mode 100644 index 4c52689766..0000000000 Binary files a/docs/source/tutorial/images/generated_swift_package_folder.png and /dev/null differ diff --git a/docs/source/tutorial/images/installed_dependencies.png b/docs/source/tutorial/images/installed_dependencies.png deleted file mode 100644 index 9585ce591a..0000000000 Binary files a/docs/source/tutorial/images/installed_dependencies.png and /dev/null differ diff --git a/docs/source/tutorial/images/launches_detail.png b/docs/source/tutorial/images/launches_detail.png deleted file mode 100644 index 8da6a63d98..0000000000 Binary files a/docs/source/tutorial/images/launches_detail.png and /dev/null differ diff --git a/docs/source/tutorial/images/link_binary_with_libraries.png b/docs/source/tutorial/images/link_binary_with_libraries.png deleted file mode 100644 index bc29e357d2..0000000000 Binary files a/docs/source/tutorial/images/link_binary_with_libraries.png and /dev/null differ diff --git a/docs/source/tutorial/images/link_binary_with_libraries_dialog.png b/docs/source/tutorial/images/link_binary_with_libraries_dialog.png deleted file mode 100644 index c6bb3453cf..0000000000 Binary files a/docs/source/tutorial/images/link_binary_with_libraries_dialog.png and /dev/null differ diff --git a/docs/source/tutorial/images/login_mutation_email.png b/docs/source/tutorial/images/login_mutation_email.png deleted file mode 100644 index 39824c41d1..0000000000 Binary files a/docs/source/tutorial/images/login_mutation_email.png and /dev/null differ diff --git a/docs/source/tutorial/images/login_mutation_null.png b/docs/source/tutorial/images/login_mutation_null.png deleted file mode 100644 index 62949d6d35..0000000000 Binary files a/docs/source/tutorial/images/login_mutation_null.png and /dev/null differ diff --git a/docs/source/tutorial/images/next_minor.png b/docs/source/tutorial/images/next_minor.png deleted file mode 100644 index b861a3ea60..0000000000 Binary files a/docs/source/tutorial/images/next_minor.png and /dev/null differ diff --git a/docs/source/tutorial/images/open_in_explorer_launches.png b/docs/source/tutorial/images/open_in_explorer_launches.png deleted file mode 100644 index cedbafd1d8..0000000000 Binary files a/docs/source/tutorial/images/open_in_explorer_launches.png and /dev/null differ diff --git a/docs/source/tutorial/images/package_in_project_hierarchy.png b/docs/source/tutorial/images/package_in_project_hierarchy.png deleted file mode 100644 index 8873543c48..0000000000 Binary files a/docs/source/tutorial/images/package_in_project_hierarchy.png and /dev/null differ diff --git a/docs/source/tutorial/images/query_console_log_sample.png b/docs/source/tutorial/images/query_console_log_sample.png deleted file mode 100644 index c5092d8f7b..0000000000 Binary files a/docs/source/tutorial/images/query_console_log_sample.png and /dev/null differ diff --git a/docs/source/tutorial/images/sandbox_green_dot.png b/docs/source/tutorial/images/sandbox_green_dot.png deleted file mode 100644 index 21db0c26a4..0000000000 Binary files a/docs/source/tutorial/images/sandbox_green_dot.png and /dev/null differ diff --git a/docs/source/tutorial/images/sandbox_landing.png b/docs/source/tutorial/images/sandbox_landing.png deleted file mode 100644 index 3fccf6e94a..0000000000 Binary files a/docs/source/tutorial/images/sandbox_landing.png and /dev/null differ diff --git a/docs/source/tutorial/images/sandbox_patch_size_docs.png b/docs/source/tutorial/images/sandbox_patch_size_docs.png deleted file mode 100644 index 06c34dd5fe..0000000000 Binary files a/docs/source/tutorial/images/sandbox_patch_size_docs.png and /dev/null differ diff --git a/docs/source/tutorial/images/sandbox_schema_book_trips.png b/docs/source/tutorial/images/sandbox_schema_book_trips.png deleted file mode 100644 index 1f0f16a02a..0000000000 Binary files a/docs/source/tutorial/images/sandbox_schema_book_trips.png and /dev/null differ diff --git a/docs/source/tutorial/images/sandbox_schema_mutations.png b/docs/source/tutorial/images/sandbox_schema_mutations.png deleted file mode 100644 index c43a0be03e..0000000000 Binary files a/docs/source/tutorial/images/sandbox_schema_mutations.png and /dev/null differ diff --git a/docs/source/tutorial/images/sandbox_schema_reference.png b/docs/source/tutorial/images/sandbox_schema_reference.png deleted file mode 100644 index 714cad3aec..0000000000 Binary files a/docs/source/tutorial/images/sandbox_schema_reference.png and /dev/null differ diff --git a/docs/source/tutorial/images/schema_icon.png b/docs/source/tutorial/images/schema_icon.png deleted file mode 100644 index a4697e535c..0000000000 Binary files a/docs/source/tutorial/images/schema_icon.png and /dev/null differ diff --git a/docs/source/tutorial/images/schema_login_definition.png b/docs/source/tutorial/images/schema_login_definition.png deleted file mode 100644 index 742777ffb6..0000000000 Binary files a/docs/source/tutorial/images/schema_login_definition.png and /dev/null differ diff --git a/docs/source/tutorial/images/schema_tripsBooked_definition.png b/docs/source/tutorial/images/schema_tripsBooked_definition.png deleted file mode 100644 index 6383070c53..0000000000 Binary files a/docs/source/tutorial/images/schema_tripsBooked_definition.png and /dev/null differ diff --git a/docs/source/tutorial/images/select_libs.png b/docs/source/tutorial/images/select_libs.png deleted file mode 100644 index f5da07a96c..0000000000 Binary files a/docs/source/tutorial/images/select_libs.png and /dev/null differ diff --git a/docs/source/tutorial/images/simulator_subscription_notification_view.png b/docs/source/tutorial/images/simulator_subscription_notification_view.png deleted file mode 100644 index ac12784bb5..0000000000 Binary files a/docs/source/tutorial/images/simulator_subscription_notification_view.png and /dev/null differ diff --git a/docs/source/tutorial/images/starting_app_state_simulator.png b/docs/source/tutorial/images/starting_app_state_simulator.png deleted file mode 100644 index 41b5cbf48f..0000000000 Binary files a/docs/source/tutorial/images/starting_app_state_simulator.png and /dev/null differ diff --git a/docs/source/tutorial/images/starting_project_structure.png b/docs/source/tutorial/images/starting_project_structure.png deleted file mode 100644 index a596dd0ab6..0000000000 Binary files a/docs/source/tutorial/images/starting_project_structure.png and /dev/null differ diff --git a/docs/source/tutorial/images/tap_to_load_more.png b/docs/source/tutorial/images/tap_to_load_more.png deleted file mode 100644 index 7e135e4616..0000000000 Binary files a/docs/source/tutorial/images/tap_to_load_more.png and /dev/null differ diff --git a/docs/source/tutorial/images/tap_to_load_more_results.png b/docs/source/tutorial/images/tap_to_load_more_results.png deleted file mode 100644 index beead27d8b..0000000000 Binary files a/docs/source/tutorial/images/tap_to_load_more_results.png and /dev/null differ diff --git a/docs/source/tutorial/tutorial-add-graphql-schema.mdx b/docs/source/tutorial/tutorial-add-graphql-schema.mdx deleted file mode 100644 index ba5a1e4d6e..0000000000 --- a/docs/source/tutorial/tutorial-add-graphql-schema.mdx +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "2. Add the GraphQL Schema" ---- - -import SPMXcodeInstallCLI from "../../shared/cli-install/spm-xcode.mdx" - -This tutorial uses a modified version of the GraphQL server you build as part of [the Apollo full-stack tutorial](https://www.apollographql.com/docs/tutorial/introduction/). You can visit [that server's Apollo Studio Sandbox Explorer](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com%2Fgraphql) to explore its schema without needing to be logged in: - -The Sandbox query explorer - -You'll know that this Sandbox instance is pointed at our server because its URL, `https://apollo-fullstack-tutorial.herokuapp.com`, is in the box at the top left of the page. If Sandbox is properly connected, you'll see a green dot: - -A closeup of the URL box with a dot indicating it's connected - -The schema defines which GraphQL operations your server can execute. At the top left, click the schema icon to get an overview of your schema: - -The schema icon to click - -In the **Reference** tab, you can now see a list of all of the things available to you as a consumer of this API, along with available fields on all objects: - -Apollo sandbox showing the schema reference - -## Setup Codegen CLI - - - -> **Note:** Xcode 14.3 has a bug where the `Install CLI` plugin command does not show up in the menu when right-clicking on your project which is being tracked [here](https://github.com/apollographql/apollo-ios/issues/2919). If you experience this issue an alternative is to use another version of Xcode, or follow the instructions to get a pre-built binary of the CLI on the [Codegen CLI](https://www.apollographql.com/docs/ios/code-generation/codegen-cli#installation) page. - -## Create your Codegen Configuration - -Next we need to setup our [codegen configuration](https://www.apollographql.com/docs/ios/code-generation/codegen-configuration) file. To do this run the following command in Terminal from project directory: - -```bash -./apollo-ios-cli init --schema-namespace RocketReserverAPI --module-type swiftPackageManager -``` - -This generates a basic `apollo-codegen-config.json` file for our project. - -## Download your server's schema - -Next we need to download the schema for our project to use. To do so, first we need to update our `apollo-codegen-config.json` to include a [`schemeDownloadConfiguration`](https://www.apollographql.com/docs/ios/code-generation/codegen-configuration#schema-download-configuration). Add the following JSON to the end of the config file after the `output` object: - -```json -"schemaDownloadConfiguration": { - "downloadMethod": { - "introspection": { - "endpointURL": "https://apollo-fullstack-tutorial.herokuapp.com/graphql", - "httpMethod": { - "POST": {} - }, - "includeDeprecatedInputValues": false, - "outputFormat": "SDL" - } - }, - "downloadTimeout": 60, - "headers": [], - "outputPath": "./graphql/schema.graphqls" -} -``` - -> For more information about downloading schemas, see the [Downloading a Schema](https://www.apollographql.com/docs/ios/code-generation/downloading-schema) documentation. - -Now that we have updated our config, we can download the schema by running the following command in Terminal: - -```bash -./apollo-ios-cli fetch-schema -``` - -After running this command you should see a `graphql` folder in your project directory containing a `schema.graphqls` file. - -In the next step you will [write your first query.](tutorial-write-your-first-query) \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-add-more-info-to-list.mdx b/docs/source/tutorial/tutorial-add-more-info-to-list.mdx deleted file mode 100644 index 8b8833c164..0000000000 --- a/docs/source/tutorial/tutorial-add-more-info-to-list.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: "7. Add more info to the list" ---- - -Go back to `LaunchList.graphql`. Your query is already fetching most of the information you want to display, but it would be nice to display both the name of the mission and an image of the patch. - -Looking at the schema in Sandbox Explorer, you can see that `Launch` has a property of `mission`, which allows you to get details of the mission. A mission has both a `name` and a `missionPatch` property, and the `missionPatch` can optionally take a parameter about what size something needs to be. - -Because loading a list view with large images can impact performance, ask for the name and a `SMALL` mission patch. Update your query to look like the following: - -```graphql title="LaunchList.graphql" -query LaunchList { - launches { - hasMore - cursor - launches { - id - site - mission { - name - missionPatch(size: SMALL) - } - } - } -} -``` - -When you re-run code generation if you look in `LaunchListQuery.graphql.swift`, you'll see a new nested type, `Mission`, with the two properties you requested. - -Any GraphQL field can take arguments like `missionPatch` above, and arguments can be of scalar or complex types. In this case, `SMALL` is an enum in the GraphQL schema. It can take a finite list of values. If you look at the Schema section in Sandbox, you can see a list of the enums. You can then click in to see that `PatchSize` can only take two values: `SMALL` and `LARGE` - -The patch size enum in Sandbox's Schema tab - -## Connect the data to the UI - -Go to `LaunchRow.swift` and add the following import to the top of the file: - -```swift title="LaunchRow.swift" -import RocketReserverAPI -import SDWebImageSwiftUI // highlight-line -import SwiftUI -``` - -Next replace the existing `placeholderImg` reference with the following code: - -```swift title="LaunchRow.swift" -if let missionPatch = launch.mission?.missionPatch { - WebImage(url: URL(string: missionPatch)) - .resizable() - .placeholder(placeholderImg) - .indicator(.activity) - .scaledToFit() - .frame(width: 50, height: 50) -} else { - placeholderImg - .resizable() - .scaledToFit() - .frame(width: 50, height: 50) -} -``` - -Finally let's update the text label for the mission name: - -```swift title="LaunchRow.swift" -VStack(alignment: .leading) { - Text(launch.mission?.name ?? "Mission Name") // highlight-line - Text(launch.site ?? "Launch Site") - .font(.system(size: 14)) -} -``` - -## Test your query - -Build and run the application, and you will see all the information for current launches. - -Add info to List - -If you scroll down, you'll see the list includes only about 20 launches. This is because the list of launches is **paginated**, and you've only fetched the first page. - -Next, you will [use a cursor-based loading system to load the entire list of launches](tutorial-paginate-results). \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-authenticate-operations.mdx b/docs/source/tutorial/tutorial-authenticate-operations.mdx deleted file mode 100644 index fc8e38ee06..0000000000 --- a/docs/source/tutorial/tutorial-authenticate-operations.mdx +++ /dev/null @@ -1,115 +0,0 @@ ---- -title: "11. Authenticate your operations" ---- - -In this section you will learn how to add your login authorization token to your operations. - -## Create the `AuthorizationInterceptor` - -Before you can book a trip, you need to be able to pass your authentication token along to the example server. To do that, let's dig a little deeper into how iOS's `ApolloClient` works. - -The `ApolloClient` uses something called a `NetworkTransport` under the hood. By default, the client creates a `RequestChainNetworkTransport` instance to handle talking over HTTP to your server. - -A `RequestChain` runs your request through an array of `ApolloInterceptor` objects which can mutate the request and/or check the cache before it hits the network, and then do additional work after a response is received from the network. - -The `RequestChainNetworkTransport` uses an object that conforms to the `InterceptorProvider` protocol in order to create that array of interceptors for each operation it executes. There are a couple of providers that are set up by default, which return a fairly standard array of interceptors. - -The nice thing is that you can also add your own interceptors to the chain anywhere you need to perform custom actions. In this case, you want to have an interceptor that will add your token. - -First, create the new interceptor. Go to **File > New > File...** and create a new **Swift File**. Name it **AuthorizationInterceptor.swift**, and make sure it's added to the **RocketReserver** target. Open that file, and add the following code: - -```swift title="AuthorizationInterceptor.swift" -import Foundation -import Apollo -import ApolloAPI - -class AuthorizationInterceptor: ApolloInterceptor { - - func interceptAsync( - chain: RequestChain, - request: HTTPRequest, - response: HTTPResponse?, - completion: @escaping (Result, Error>) -> Void - ) where Operation : GraphQLOperation { - // TODO - } - -} -``` - -Next, import `KeychainSwift` at the top of the file so you can access the key you stored in the keychain in the last step of the tutorial: - -```swift title="AuthorizationInterceptor.swift" -import KeychainSwift -``` - -Then, replace the `TODO` within the `interceptAsync` method with code to get the token from the keychain, and add it to your headers if it exists: - -```swift title="AuthorizationInterceptor.swift" -let keychain = KeychainSwift() -if let token = keychain.get(LoginView.loginKeychainKey) { - request.addHeader(name: "Authorization", value: token) -} - -chain.proceedAsync(request: request, - response: response, - completion: completion) -``` - -An array of `ApolloInterceptor`s which are handed off to each request to perform in order is set up by an object conforming to the `InterceptorProvider` protocol. There's a `DefaultInterceptorProvider` which has an array with most of the Interceptors you'd want to use. - -You can also make your own object conforming to `InterceptorProvider` - or, in this case, since the interceptor only needs to be added to the beginning of the list to run before all the other interceptors, you can subclass the existing `DefaultInterceptorProvider`. - -Go to **File > New > File...** and create a new **Swift File**. Name it **NetworkInterceptorProvider.swift**, and make sure it's added to the **RocketReserver** target. Add code which inserts your `AuthorizationInterceptor` before the other interceptors provided by the `DefaultInterceptorProvider`: - -```swift title="NetworkInterceptorProvider.swift" -import Foundation -import Apollo -import ApolloAPI - -class NetworkInterceptorProvider: DefaultInterceptorProvider { - - override func interceptors(for operation: Operation) -> [ApolloInterceptor] where Operation : GraphQLOperation { - var interceptors = super.interceptors(for: operation) - interceptors.insert(AuthorizationInterceptor(), at: 0) - return interceptors - } - -} -``` - -> Another way to do this would be to copy and paste the list interceptors provided by the `DefaultInterceptorProvider` (which are all public), and then place your interceptors in the points in the array where you want them. However, since in this case we can run this interceptor first, it's simpler to subclass. - -## Use the interceptor - -Next, go back to your `Network` class. Replace the `ApolloClient` with an updated `lazy var` which creates the `RequestChainNetworkTransport` manually, using your custom interceptor provider: - -```swift title="Network.swift" -class Network { - - static let shared = Network() - - private(set) lazy var apollo: ApolloClient = { - let client = URLSessionClient() - let cache = InMemoryNormalizedCache() - let store = ApolloStore(cache: cache) - let provider = NetworkInterceptorProvider(client: client, store: store) - let url = URL(string: "https://apollo-fullstack-tutorial.herokuapp.com/graphql")! - let transport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: url) - - return ApolloClient(networkTransport: transport, store: store) - }() - -} -``` - -Now, go back to **AuthorizationInterceptor.swift**. -Click on the line numbers to add a breakpoint at the line where you're instantiating the `Keychain`: - -```swift title="AuthorizationInterceptor.swift" -let keychain = KeychainSwift() -``` - -Build and run the application. Whenever a network request goes out, that breakpoint should now get hit. If you're logged in, your token will be sent to the server whenever you make a request! - -Now that your operations are being authenticated, it's time to [define additional mutations](tutorial-define-additional-mutations) to be able to book and cancel trips. \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-complete-details-view.mdx b/docs/source/tutorial/tutorial-complete-details-view.mdx deleted file mode 100644 index 4e7171cbd1..0000000000 --- a/docs/source/tutorial/tutorial-complete-details-view.mdx +++ /dev/null @@ -1,274 +0,0 @@ ---- -title: "9. Complete the details view" ---- - -In this section, you'll write a second GraphQL query that requests details about a single launch and uses that data in a `DetailView` - -To get more information to show on the detail page, you have a couple of options: - -- You could request all the details you want to display for every single launch in the `LaunchList` query, and then pass that retrieved object on to the `DetailViewController`. -- You could provide the identifier of an individual launch to a _different_ query to request all the details you want to display. - -The first option *can* seem easier if there isn't a substantial difference in size between what you're requesting for the list versus the detail page. - -However, remember that one of the advantages of GraphQL is that you can query for _exactly_ the data you need to display on a page. If you're not going to be displaying additional information, you can save bandwidth, execution time, and battery life by not asking for data until you need it. - -This is especially true when you have a *much* larger query for your detail view than for your list view. Passing the identifier and then fetching based on that is considered a best practice. Even though the amount of data in this case doesn't differ greatly, you'll build out a query to help fetch details based on the ID so you'll know how to do it in the future. - -# Create the details query - -Create a new empty file and name it `LaunchDetails.graphql`. In this file, you'll add the details you want to display in the detail view. First, you'll want to go back to [your Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com%2Fgraphql) and make sure that your query works! - -In the Explorer tab, start by clicking the "New Tab" button in the middle operations section: - -the new tab button - -A new tab will be added with nothing in it: - -The UI after adding a new tab - -In the left-hand column, click the word "Query" under "Documentation" to be brought to a list of possible queries: - -The list of possible queries - -Select the `launch` query by clicking the button next to it. Sandbox Explorer will automatically set up the query for you to use: - -What the launch query will look like immediately after adding it - -First, change the name of the operation from "Query" to "LaunchDetails" - that will then reflect in the tab name and make it easier to tell which query you're working with: - -The renamed query - -Let's go through what's been added here: - -- Again, we've added an operation, but this time it's got a parameter coming into it. This was added automatically by Sandbox Explorer because there is not a default value provided for the non-null `launchId` argument. -- The parameter is prefixed with a `$` for its name, and the type is indicated immediately after. Note that the `ID` type here has an exclamation point, meaning it can't be null. -- Within that operation, we make a call to the `launch` query. The `id` is the argument the query is expecting, and the `$launchId` is the name of the parameter we just passed in the line above. -- Again, there's blank space for you to add the fields you want to get details for on the returned object, which in this case is a `Launch`. -- Finally, at the bottom, the "Variables" section of the Operations panel has been expanded, and a dictionary has been added with a key of `"launchId"`. At runtime, this will be used to fill in the blank of the `$launchId` parameter. - - -> Note: GraphQL's assumptions about nullability are different from Swift's. In Swift, if you don't annotate a property's type with either a question mark or an exclamation point, that property is non-nullable. -> -> In GraphQL, if you don't annotate a field's type with an exclamation point, that field is considered *nullable*. This is because GraphQL fields are **nullable by default**. -> -> Keep this difference in mind when you switch between editing Swift and GraphQL files. - -Now in the Sandbox Explorer, start by using the checkboxes or typing to add the properties you're already requesting in the `LaunchList` query. One difference: Use `LARGE` for the mission patch size since the patch will be displayed in a much larger `ImageView`: - -```graphql title="(Sandbox Explorer)" -query LaunchDetails($id:ID!) { - launch(id: $id) { - id - site - mission { - name - missionPatch(size:LARGE) - } - } -} -``` - -Next, look in the left sidebar to see what other fields are available. Selecting `rocket` will add a set of brackets to request details about the rocket, and drill you into the `rocket` property, showing you the available fields on the `Rocket` type: - -The available properties for Rocket - -Click the buttons to check off `name` and `type`. Next, go back to `Launch` by clicking the back button next to the `Rocket` type in the left sidebar: - -The back button - -Finally, check off the `isBooked` property on the `Launch`. Your final query should look like this: - -```graphql title="(Sandbox Explorer)" -query LaunchDetails($launchId: ID!) { - launch(id: $launchId) { - id - site - mission { - name - missionPatch(size: LARGE) - } - rocket { - name - type - } - isBooked - } -} -``` - -At the bottom of the Operations section, update the Variables section to pass in an ID for a launch. In this case, it needs to be a string that contains a number: - -```json title="(Sandbox Explorer)" -{ "id": "25" } -``` - -This tells Sandbox Explorer to fill in the value of the `$launchId` variable with the value `"25"` when it runs the query. Press the big play button, and you should get some results back for the launch with ID 25: - -Detail request returning JSON - -Now that you've confirmed it worked, copy the query (either by selecting all the text or using the "Copy Operation" option from the meatball menu as before) and paste it into your `LaunchDetails.graphql` file. Run the code generation from Terminal to generate the code for the new query. - -## Execute the query - -Now let's add the code to run this query to retrieve our data. - -Go to `DetailViewModel.swift` and add this `import` - -```swift title="DetailViewModel.swift" -import RocketReserverAPI -``` - -Next let's update the `init()` method and add some variables to hold our Launch data: - -```swift title="DetailViewModel.swift" -let launchID: RocketReserverAPI.ID // highlight-line - -@Published var launch: LaunchDetailsQuery.Data.Launch?// highlight-line -@Published var isShowingLogin = false -@Published var appAlert: AppAlert? - -init(launchID: RocketReserverAPI.ID) {// highlight-line - self.launchID = launchID// highlight-line -} -``` - -Next we need to run the query, so replace the `TODO` in the `loadLaunchDetails` method with this code: - -```swift title="DetailViewModel.swift" -func loadLaunchDetails() { - guard launchID != launch?.id else { - return - } - - Network.shared.apollo.fetch(query: LaunchDetailsQuery(launchId: launchID)) { [weak self] result in - guard let self = self else { - return - } - - switch result { - case .success(let graphQLResult): - if let launch = graphQLResult.data?.launch { - self.launch = launch - } - - if let errors = graphQLResult.errors { - self.appAlert = .errors(errors: errors) - } - case .failure(let error): - self.appAlert = .errors(errors: [error]) - } - } -} -``` - -Now that we have our query executing we need to update the UI code to use the new data. - -## Update UI code - -To start, go to `DetailView.swift` and add the following `import` statements: - -```swift title="DetailView.swift" -import RocketReserverAPI -import SDWebImageSwiftUI -``` - -Next, we need to update the `init()` method to initialize the `DetailViewModel` with a `launchID`: - -```swift title="DetailView.swift" -init(launchID: RocketReserverAPI.ID) { - _viewModel = StateObject(wrappedValue: DetailViewModel(launchID: launchID)) -} -``` - -Almost done! Let's update the `body` View variable to use the launch data from `DetailViewModel` and call the `loadLaunchDetails` method: - -```swift title="DetailView.swift" -var body: some View { - VStack { - if let launch = viewModel.launch { // highlight-line - HStack(spacing: 10) { - if let missionPatch = launch.mission?.missionPatch { // highlight-line - WebImage(url: URL(string: missionPatch)) // highlight-line - .resizable() // highlight-line - .placeholder(placeholderImg) // highlight-line - .indicator(.activity) // highlight-line - .scaledToFit() // highlight-line - .frame(width: 165, height: 165) // highlight-line - } else { // highlight-line - placeholderImg - .resizable() - .scaledToFit() - .frame(width: 165, height: 165) - } // highlight-line - - VStack(alignment: .leading, spacing: 4) { - if let missionName = launch.mission?.name { // highlight-line - Text(missionName) - .font(.system(size: 24, weight: .bold)) - } - - if let rocketName = launch.rocket?.name { // highlight-line - Text("🚀 \(rocketName)") - .font(.system(size: 18)) - } - - if let launchSite = launch.site { // highlight-line - Text(launchSite) - .font(.system(size: 14)) - } - } - - Spacer() - } - - if launch.isBooked { // highlight-line - cancelTripButton() - } else { - bookTripButton() - } - } - Spacer() - } - .padding(10) - .navigationTitle(viewModel.launch?.mission?.name ?? "") // highlight-line - .navigationBarTitleDisplayMode(.inline) - .task { - viewModel.loadLaunchDetails() // highlight-line - } - .sheet(isPresented: $viewModel.isShowingLogin) { - LoginView(isPresented: $viewModel.isShowingLogin) - } - .appAlert($viewModel.appAlert) -} -``` - -Also, you'll need to update the preview code in `DetailView` to this: - -```swift title="DetailView.swift" -struct DetailView_Previews: PreviewProvider { - static var previews: some View { - DetailView(launchID: "110") // highlight-line - } -} -``` - -Now we just need to connect the `DetailView` to our `LaunchListView`. So let's go to `LaunchListView.swift` and update our `List` to the following: - -```swift title="LaunchListView.swift" -ForEach(0.. - -You may have noticed that the detail view includes a `Book Now!` button, but there's no way to book a seat yet. To fix that, let's [learn how to make changes to objects in your graph with mutations, including authentication](tutorial-first-mutation). diff --git a/docs/source/tutorial/tutorial-configure-project.mdx b/docs/source/tutorial/tutorial-configure-project.mdx deleted file mode 100644 index 4806d59054..0000000000 --- a/docs/source/tutorial/tutorial-configure-project.mdx +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: "1. Configure your project" ---- - -In this step, you'll get the starter project and add the Apollo iOS SDK to a new project. - -## Clone the starter project - -```text -git clone https://github.com/apollographql/iOSTutorial.git -``` - -The starter project is located in the `starter` folder. - -> **Note:** At any time, if you want to view a completed version of the project, open the project in the `final` folder. - -## Open the 'starter' project in Xcode - -Open the `RocketReserver.xcodeproj` located in the `starter` folder: - -Folder structure for opening project - -When the project opens, Swift Package Manager (SPM) will resolve some dependencies that you'll be using later in the project that are already set up: - -* [KeychainSwift](https://github.com/evgenyneu/keychain-swift) -* [SDWebImage](https://github.com/SDWebImage/SDWebImage) -* [SDWebImageSwiftUI](https://github.com/SDWebImage/SDWebImageSwiftUI) - -If you build and run the project you should see a list with placeholder data: - -Starting app state - -Next let's add Apollo as a dependency. - -## Add the Apollo iOS SDK to your project - -1. Go to **File > Add Packages...**. The Add Package dialog appears, by default with Apple packages. In the upper right hand corner, paste `https://github.com/apollographql/apollo-ios` into the search bar: - -The Xcode add package dialog, arrow pointing at search bar - -2. Xcode will then show you the `apollo-ios` package and allow you to select a version in the right hand panel. Select **Up to Next Minor** from the Version dropdown (At the time of writing, the current minor version is 1.2.x, note that minor breaking changes _can_ occur between minor releases): - -Select next minor in dropdown - -3. Click **Add Package**. Once SPM is done checking out the package, a list of framework targets included in the library appears. For this tutorial, select the main **Apollo** target and the **ApolloWebSocket** target: - -Select the first and last targets - -_Note: Do **not** select the `Apollo-Dynamic` target, this is only for use for projects linking to our library dynamically. Most projects, including this one, will not need to do this._ - -4. Click **Add Package**. SPM fetches your dependencies. When it completes, you can see them in the project navigator: - -Screenshot of installed dependencies - -> **Note:** Because SPM has not yet implemented [Target-Based Dependency Resolution](https://github.com/apple/swift-evolution/blob/master/proposals/0226-package-manager-target-based-dep-resolution.md), you'll see the `SQLite` dependency even though you didn't select `ApolloSQLite`, the target which depends on it. - -Your project should now be ready to use the Apollo iOS SDK. Next, you will [add the GraphQL schema to the project.](tutorial-add-graphql-schema) diff --git a/docs/source/tutorial/tutorial-connect-queries-to-ui.mdx b/docs/source/tutorial/tutorial-connect-queries-to-ui.mdx deleted file mode 100644 index f7a17a6d23..0000000000 --- a/docs/source/tutorial/tutorial-connect-queries-to-ui.mdx +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "6. Connect your queries to your UI" ---- - -In this chapter you are going to display a list of Launches in a [List](https://developer.apple.com/documentation/swiftui/list). - -## Configure LaunchListViewModel - -In `LaunchListViewModel` add a new variable to hold the launches returned by the query: - -```swift title="LaunchListViewModel.swift" -@Published var launches = [LaunchListQuery.Data.Launches.Launch]() // highlight-line -@Published var appAlert: AppAlert? -@Published var notificationMessage: String? -``` - -Next, replace the `TODO` in the `loadMoreLaunches()` method with the code to run the `LaunchListQuery`: - -```swift title="LaunchListViewModel.swift" -Network.shared.apollo.fetch(query: LaunchListQuery()) { [weak self] result in - guard let self = self else { - return - } - - switch result { - case .success(let graphQLResult): - if let launchConnection = graphQLResult.data?.launches { - self.launches.append(contentsOf: launchConnection.launches.compactMap({ $0 })) - } - - if let errors = graphQLResult.errors { - self.appAlert = .errors(errors: errors) - } - case .failure(let error): - self.appAlert = .errors(errors: [error]) - } -} -``` - -`GraphQLResult` has both a `data` property and an `errors` property. This is because GraphQL allows partial data to be returned if it's non-null. - -In the example we're working with now, we could theoretically obtain a list of launches, and then an error stating that a launch with a particular ID could not be retrieved. - -This is why when you get a `GraphQLResult`, you generally want to check both the `data` property (to display any results you got from the server) _and_ the `errors` property (to try to handle any errors you received from the server). - -As you can see in the code, the sample project has already provided an easy way to display error alerts by simply assigning the desired value to the `appAlert` property. - -## Use Launches in the UI - -First let's update our `LaunchRow` view to be able to display the data for a specific `Launch`. At the top of the file add `import RocketReserverAPI` and then add the following variable: - -```swift title="LaunchRow.swift" -let launch: LaunchListQuery.Data.Launches.Launch // highlight-line -private let placeholderImg = Image("placeholder") -``` - -Then let's update one of our [Text](https://developer.apple.com/documentation/swiftui/text) views to show the launch site: - -```swift title="LaunchRow.swift" -VStack(alignment: .leading) { - Text("Mission Name") - Text(launch.site ?? "Launch Site") // highlight-line - .font(.system(size: 14)) -} -``` - -Now that our `LaunchRow` is updated, let's move over to `LaunchListView` and start displaying our Launches in the list. - -Update the `ForEach` loop to loop through every launch item from our `viewModel` and create a `LaunchRow` for it: - -```swift title="LaunchListView.swift" -ForEach(0.. - -Next, you'll [add more info](tutorial-add-more-info-to-list) to the list to make it look nicer! \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-define-additional-mutations.mdx b/docs/source/tutorial/tutorial-define-additional-mutations.mdx deleted file mode 100644 index f989f5b059..0000000000 --- a/docs/source/tutorial/tutorial-define-additional-mutations.mdx +++ /dev/null @@ -1,267 +0,0 @@ ---- -title: "12. Define additional mutations" ---- - -In this section you will implement additional mutations for booking and cancelling trips. - -## Add the `BookTrip` mutation - -In [Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com), open the Schema tab by clicking its icon, select the `Mutations`, and take a look at the `bookTrips` mutation: - -The docs for book trips - -Click the play button to the right to open this mutation in Explorer. Click the plus button to add the `bookTrips` mutation: - -The book trips operation immediately after adding it - -You can see in the left sidebar that this takes an argument of an array of IDs (which was added as `$bookTripsLaunchIds`), and the object returned from the operation has three properties: - -* A `success` boolean indicating whether the booking succeeded -* A `message` string to display to the user -* A list of `launches` the current user has booked - -Click the plus signs next to `success` and `message` to add those to your operation. - -In the "Variables" section of Sandbox Explorer, add an array of identifiers. In this case, we'll use a single identifier to book one trip: - -```json title="(Sandbox Explorer)" -{"bookTripsLaunchIds": ["25"]} -``` - -Next, directly next to the word "Variables", you'll see the word "Headers". Click that to bring up the headers section. Click the "New Header" button, and add "Authorization" in the header key text box and paste the token you got back in the last section for the value: - -The headers section - -Now, click the Submit Operation button to run your authorized query. You'll get back information regarding the trips (or in this case, trip) you've just booked. - -> Note: If you receive an error that says "Cannot read property 'id' of null", that means your user was not found based on the token you passed through. Make sure your authorization header is properly formatted and that you're actually logged in! - -Explorer showing the result of booking a trip with an array of IDs - -With a mutation written like this, you can book any number of trips you want at the same time. However, the booking mechanism in our application will only let you book one trip at a time. - -Luckily, there's an easy way to update the mutation so it's required to only take a single object. First, update the name of your operation in Explorer to the singular `BookTrip`. Next, update the mutation to take a single `$id`, then pass an array containing that `$id` to the `bookTrips` mutation: - -```graphql title="(Sandbox Explorer)" -mutation BookTrip($id:ID!) { - bookTrips(launchIds:[$id]) { - success - message - } -} -``` - -This is helpful because the Swift code generation will now generate a method that only accepts a single `ID` instead of an array, but you'll still be calling the same mutation under the hood, without the backend needing to change anything. - -In the Variables section of Sandbox Explorer, update the JSON dictionary to use `id` as the key, and remove the array brackets from around the identifier: - -```json title="(Sandbox Explorer)" -{"id": "25"} -``` - -Click the Submit Operation button to run your updated query. The response you get back should be identical to the one you got earlier: - -The result of booking a trip with a single identifier - -Now that you've fleshed out your operation, it's time to put it into the app. Go to **File > New > File... > Empty**, name this file `BookTrip.graphql` and add it next to your other GraphQL files. Paste in the final query from the Sandbox Explorer. - -```graphql title="BookTrip.graphql" -mutation BookTrip($id: ID!) { - bookTrips(launchIds: [$id]) { - success - message - } -} -``` - -Now run code generation in Terminal to generate the new mutation code. - -## Implement the `bookTrip` logic - -Now that you have the `BookTrip` mutation, it's time to implement the logic to book a trip in the app. Start by going to `DetailViewModel.swift` and finding the `bookTrip()` method. - -Replacing the existing function with this code: - -```swift title="DetailViewModel.swift" -private func bookTrip(with id: RocketReserverAPI.ID) { - Network.shared.apollo.perform(mutation: BookTripMutation(id: id)) { [weak self] result in - guard let self = self else { - return - } - - switch result { - case .success(let graphQLResult): - if let bookingResult = graphQLResult.data?.bookTrips { - if bookingResult.success { - self.appAlert = .basic(title: "Success!", - message: bookingResult.message ?? "Trip booked successfully") - self.loadLaunchDetails() - } else { - self.appAlert = .basic(title: "Could not book trip", - message: bookingResult.message ?? "Unknown failure") - } - } - - if let errors = graphQLResult.errors { - self.appAlert = .errors(errors: errors) - } - case .failure(let error): - self.appAlert = .errors(errors: [error]) - } - } -} -``` - -You've now got the code to book a trip. Before you run it, let's add the code to cancel a trip as well. - -## Add the `CancelTrip` mutation - -The process for the `CancelTrip` mutation is similar to the one for `BookTrip`. Go back to the Sandbox's Schema tab, select Mutations, and look at the `cancelTrip` mutation's documentation: - -Documentation for the cancel trip mutation - -Click the play button to the right to open this operation in Explorer, add a new tab to Explorer for this new operation, then click the plus button to create your operation. - -Check off `success` and `message` again to add those properties to the list of ones you want to get back with your cancellation information. - -Again, Explorer's gotten a little verbose here, so update your operation's name and variables to be a little shorter: - -```graphql title="(Sandbox Explorer)" -mutation CancelTrip($id: ID!) { - cancelTrip(launchId: $id) { - success - message - } -} -``` - -One key difference from `bookTrips` is that you're only allowed to cancel one trip at a time because only one `ID!` is accepted as a parameter. - -In the Variables section of Sandbox Explorer, you can use the exact same JSON that you used for `BookTrip` (because it also used a single identifier called "id"): - -```json title="(GraphiQL)" -{"id": "25"} -``` - -Make sure that in the Headers section, you add your authorization token again (the token added to the tab with `BookTrip` won't carry over to this new tab): - -The headers section - -Click the Submit Operation button to cancel the trip, and you should see a successful request: - -Successful cancel trip request - -Once again, go back to Xcode and create a new empty file, name it `CancelTrip.graphql`, and add it next to your other GraphQL files. Then, paste in the final query from Sandbox Explorer: - -```graphql title="CancelTrip.graphql" -mutation CancelTrip($launchId: ID!) { - cancelTrip(launchId: $launchId) { - success - message - } -} -``` - -Now run code generation in Terminal to generate the new mutation code. - -## Implement the `cancelTrip` logic - -Now let's implement the logic to cancel a trip in the app, go back to `DetailViewModel.swift`, find the `cancelTrip()` method and replace it with the following code: - -```swift title="DetailViewModel.swift" -private func cancelTrip(with id: RocketReserverAPI.ID) { - Network.shared.apollo.perform(mutation: CancelTripMutation(launchId: id)) { [weak self] result in - guard let self = self else { - return - } - - switch result { - case .success(let graphQLResult): - if let cancelResult = graphQLResult.data?.cancelTrip { - if cancelResult.success { - self.appAlert = .basic(title: "Trip cancelled", - message: cancelResult.message ?? "Your trip has been officially cancelled") - self.loadLaunchDetails() - } else { - self.appAlert = .basic(title: "Could not cancel trip", - message: cancelResult.message ?? "Unknown failure.") - } - } - - if let errors = graphQLResult.errors { - self.appAlert = .errors(errors: errors) - } - case .failure(let error): - self.appAlert = .errors(errors: [error]) - } - } -} -``` - -One more thing we need to do is update the `bookOrCancel()` method to actually call our `bookTrip(...)` and `cancelTrip(...)` methods, replace the `TODO` in `bookOrCancel()` with the following code: - -```swift title="DetailViewModel.swift" -guard let launch = launch else { - return -} - -launch.isBooked ? cancelTrip(with: launch.id) : bookTrip(with: launch.id) -``` - -Now build and run the application, if you go to the detail view for any launch and click "Book trip" you should get a message that the trip was successfully booked, but you'll notice that the UI doesn't update, even if you go out of the detail view and back into it again. - -Why is that? Because the trip you've got stored locally in your cache still has the old value for `isBooked`. - -There are a number of ways to change this, but for now we'll focus on the one that requires the fewest changes to your code: re-fetching the booking info from the network. - -## Force a fetch from the network - -The `fetch` method of `ApolloClient` provides defaults for most of its parameters, so if you're using the default configuration, the only value you need to provide yourself is the `Query`. - -However, an important parameter to be aware of is the `cachePolicy`. By default, this has the value of `returnCacheDataElseFetch`, which does essentially what it says on the label: it looks in the current cache (by default an in-memory cache) for data, and fetches it from the network if it's not present. - -If the data *is* present, the default behavior is to return the local copy to prevent an unnecessary network fetch. However, this is sometimes not the desired behavior (especially after executing a mutation). - -There are [several different cache policies available to you](../caching/#specifying-a-cache-policy), but the easiest way to absolutely force a refresh from the network that still updates the cache is to use `fetchIgnoringCacheData`. This policy bypasses the cache when going to the network, but it also stores the results of the fetch in the cache for future use. - -First, we need to add the following `import` to `DetailViewModel`: - -```swift title="DetailViewModel.swift" -import Apollo -``` - -Update the `loadLaunchDetails` method to take a parameter to determine if it should force reload. If it should force reload, update the cache policy from the default `.returnCacheDataElseFetch`, which will return data from the cache if it exists, to `.fetchIgnoringCacheData`: - -```swift title="DetailViewModel.swift" -func loadLaunchDetails(forceReload: Bool = false) { // highlight-line - guard forceReload || launchID != launch?.id else { // highlight-line - return - } - - let cachePolicy: CachePolicy = forceReload ? .fetchIgnoringCacheData : .returnCacheDataElseFetch // highlight-line - - Network.shared.apollo.fetch(query: LaunchDetailsQuery(launchId: launchID), cachePolicy: cachePolicy) { [weak self] result in // highlight-line - // Network handling remains the same - } -} -``` - -Next, update both the `bookTrip(...)` and `cancelTrip(...)` methods to use the updated `loadLaunchDetails(...)` call: - -```swift title="DetailViewModel.swift" -// bookTrip() -self.appAlert = .basic(title: "Success!", - message: bookingResult.message ?? "Trip booked successfully") -self.loadLaunchDetails(forceReload: true) // highlight-line - -// cancelTrip() -self.appAlert = .basic(title: "Trip cancelled", - message: cancelResult.message ?? "Your trip has been officially cancelled") -self.loadLaunchDetails(forceReload: true) // highlight-line -``` - -## Test the mutations - -Run the application. When you book or cancel a trip, the application will fetch the updated state and update the UI with the correct state. When you go out and back in, the cache will be updated with the most recent state, and the most recent state will display. - -In the next section, you'll learn how to use [subscriptions](tutorial-subscriptions) with the Apollo client. \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-execute-first-query.mdx b/docs/source/tutorial/tutorial-execute-first-query.mdx deleted file mode 100644 index c19e119abf..0000000000 --- a/docs/source/tutorial/tutorial-execute-first-query.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "5. Execute your first query" ---- - -To use the generated operations in `RocketReserverAPI`, you first create an instance of `ApolloClient`. This instance takes your generated code and uses it to make network calls to your server. It's recommended that this instance is a singleton or static instance that's accessible from anywhere in your codebase. - -## Create an ApolloClient - -1. Create a new Swift file within `RocketReserver` called `Network.swift`. Set the target to `RocketReserver` and add `import Apollo` to the top of the file. - -2. Now add the following code into the file: - -```swift title="Network.swift" -class Network { - static let shared = Network() - - private(set) lazy var apollo = ApolloClient(url: URL(string: "https://apollo-fullstack-tutorial.herokuapp.com/graphql")!) -} -``` - -## Implement the query - -To make sure your `ApolloClient` instance is communicating correctly with the server, go to `LaunchListViewModel`, add these imports, then add the following code to the `init()` method just below the TODO: - -```swift title="LaunchListViewModel.swift" -import Apollo -import RocketReserverAPI - -... - -init() { - // TODO (Section 13 - https://www.apollographql.com/docs/ios/tutorial/tutorial-subscriptions#use-your-subscription) - Network.shared.apollo.fetch(query: LaunchListQuery()) { result in - switch result { - case .success(let graphQLResult): - print("Success! Result: \(graphQLResult)") - case .failure(let error): - print("Failure! Error: \(error)") - } - } -} -``` - -## Test your query - -Build and run your application. The web host might take a few seconds to spin up your GraphQL server if nobody's been using it recently, but once it's up, you should see a response that resembles the following: - -Query console log output, beginning with 'Success! Result: GraphQLResult...' - -This means the request was correctly executed and you now have a list of launch sites 🚀🚀🚀. - -Go ahead and remove the code added to the `init()` method so there is just the TODO for later: - - -```swift title="LaunchListViewModel.swift" -init() { - // TODO (Section 13 - https://www.apollographql.com/docs/ios/tutorial/tutorial-subscriptions#use-your-subscription) -} -``` - -Next, let's [connect this data to your UI](tutorial-connect-queries-to-ui) diff --git a/docs/source/tutorial/tutorial-first-mutation.mdx b/docs/source/tutorial/tutorial-first-mutation.mdx deleted file mode 100644 index d90c972c0f..0000000000 --- a/docs/source/tutorial/tutorial-first-mutation.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: "10. Write your first mutation" ---- - -In this section, you will write your first mutation to log in to the backend. - -A mutation is used to change data on your server. Here the login mutation will create a session based on your email address. - -> **Note**: The way you log in to this particular server might differ from the way you log in with your own server. Login is often handled by _middleware_, or a layer totally separate from GraphQL, like [OAuth](https://en.wikipedia.org/wiki/OAuth). -> Also note that a typical authentication flow should require a password but for this tutorial, anyone is allowed to book flights with a valid email address! - -## Prototype your mutation in Sandbox Explorer - -Open [your Sandbox Explorer](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com%2Fgraphql) and click on the plus symbol to add a new tab. Next, click on the Schema icon to get back to looking at your schema, and select "Mutation" to look at your list of mutations: - -The list of available mutations - -Scroll down to take a look at the `login` mutation: - -The definition of login in the schema - -Click the play button to the right to open that mutation in the Explorer tab. When it opens, click the plus sign next to `login` to add the operation: - -The login mutation after initially being added - -Notice the red error indication - this is because the type returned by the mutation is `User`, which is not a **leaf** type: you need to choose which of the user's fields the mutation will return. For our purposes, we only need the `token` field, so add it by clicking the plus sign next to it. - -You'll also notice that `email` wasn't automatically added as an argument even though it doesn't seem to have a default value: that's because `email` is of type `String` - which remember, in GraphQL, means that it's **not** required (although obviously you won't get too far without it). - -Click the plus sign next to the `email` argument to have that argument added: - -The operation with the email argument - -You'll also notice that Sandbox Explorer has added a variable to your "Variables" section to match the login email. - -Click the Submit Operation button your mutation. You'll see that since you sent `null` for the email address, you get back `null` for the login: - -Results of passing a null email - -Now, replace `null` in the Query Variables section with an actual email address: - -```json title="(Sandbox Explorer)" -{ "email": "me@example.com" } -``` - -Press the Submit Operation button, and this time you'll get an actual response: - -Results of passing an actual email - -Next, copy the operation, either manually or using the three-dot menu's "Copy operation" option. - -## Add the mutation to the project - -Now that your mutation is working, add it to your project. Create a file named `Login.graphql` next to your other GraphQL files and past the contents of the mutation: - -```graphql title="Login.graphql" -mutation Login($email: String!) { - login(email: $email) { - token - } -} -``` -Note: we've also marked the `email` variable as non-nullable by adding `!` to the end of the type, since we always want to pass a value for it. - -Run code generation in Terminal to generate the code for the mutation. - -## Implement the login logic - -To start, go to `LoginViewModel.swift` and add the following `import`: - -```swift title="LoginViewModel.swift" -import Apollo -import RocketReserverAPI -``` - -Next, replace the `TODO` in the `login(with email: String?)` method with the following code: - -```swift title="LoginViewModel.swift" -Network.shared.apollo.perform(mutation: LoginMutation(email: email)) { [weak self] result in - defer { - self?.isSubmitEnabled = true - } - - switch result { - case .success(let graphQLResult): - if let token = graphQLResult.data?.login?.token { - // TODO - store token securely - self?.isPresented = false - } - - if let errors = graphQLResult.errors { - self?.appAlert = .errors(errors: errors) - } - case .failure(let error): - self?.appAlert = .errors(errors: [error]) - } -} -``` - -Next, you need to store the login credential that's returned by the server. Login credentials should always be stored in the Keychain, but interacting with it directly is challenging, so you'll be using the `KeychainSwift` library which has already been added as a Swift Package to this project. - -At the top of `LoginViewModel.swift` add the following `import`: - -```swift title="LoginViewModel.swift" -import KeychainSwift -``` - -Now replace the `TODO - store token securely` after unwrapping the token with the following: - -```swift title="LoginViewModel.swift" -let keychain = KeychainSwift() -keychain.set(token, forKey: LoginView.loginKeychainKey) -``` - -## Display the login view - -Next we need to check if the user is logged in when booking/cancelling a trip to see if we should display the `LoginView`. - -To do this go to the `DetailViewModel.swift`, you will notice the `bookOrCancel()` method already has some code in it to call the `isLoggedIn()` method, and if that returns false to set the flag to show the login view. - -```swift title="DetailViewModel.swift" -func bookOrCancel() { - guard self.isLoggedIn() else { - isShowingLogin = true - return - } - - // TODO -} -``` - -Currently the `isLoggedIn()` method is always returning false, so let's update that now, first add the following `import` to `DetailViewModel.swift`: - -```swift title="DetailViewModel.swift" -import KeychainSwift -``` - -Next, replace the contents of the `isLoggedIn()` method with the following: - -```swift title="DetailViewModel.swift" -private func isLoggedIn() -> Bool { - let keychain = KeychainSwift() // highlight-line - return keychain.get(LoginView.loginKeychainKey) != nil // highlight-line -} -``` - -## Test the login mutation - -Build and run the application, select a launch from the list to get to the `DetailView`. You should see that clicking the "Book now!" button shows the login view and if you login with this email: `me@example.com`, subsequent presses of "Book now!" no longer show the login view. - -In the next section, you will add you will learn how to [authenicate your operations](tutorial-authenticate-operations) with your login token. \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-introduction.mdx b/docs/source/tutorial/tutorial-introduction.mdx deleted file mode 100644 index 9650d4f978..0000000000 --- a/docs/source/tutorial/tutorial-introduction.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "Introduction" ---- - -Welcome! This tutorial demonstrates adding the Apollo iOS SDK to an app to communicate with a GraphQL server. In this tutorial you will learn how to: - -* Download a schema -* Run code generation -* Write queries and mutations -* Handle errors -* Handle Pagination -* Authenticate with a backend server -* Use subscriptions to receive real-time updates - -The tutorial uses an instance of [Apollo Server](https://www.apollographql.com/docs/apollo-server/) hosted on Heroku, and [Apollo Studio Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com%2Fgraphql&_gl=1*d2b33m*_ga*MzQ1Mzc2MDg1LjE2ODE3NjA2ODc.*_ga_0BGG5V2W2K*MTY4Mjk2MjIwMi4yNS4xLjE2ODI5NjIyMzIuMC4wLjA.) which connects to that server. If you're curious about how to build your own server, see the [Apollo full-stack tutorial](https://www.apollographql.com/docs/tutorial/introduction/). - -> If you encounter any issues during the tutorial, feel free to ask questions by either [opening an issue on the tutorial GitHub repo](https://github.com/apollographql/iOSTutorial) or [stopping by our community forums for help](https://community.apollographql.com). - -## What are you building? - -This tutorial takes you through building an app to "book a seat" on any of the rockets that have been sent into space by [SpaceX](https://www.spacex.com/). - -The tutorial is confirmed to work with the following tools: - -- Xcode 14.3 -- Swift 5.8 -- Apollo iOS SDK 1.2.0 - -The tutorial assumes that you're using a Mac with Xcode and assumes some prior experience with iOS development. The tutorial is built using SwiftUI, however it is not intended to teach SwiftUI but rather to illustrate how to use the Apollo iOS SDK. - -Before you start, you should either check out or download the contents of the iOS tutorial repository at [https://github.com/apollographql/iOSTutorial](https://github.com/apollographql/iOSTutorial). There's a "starter" folder where you'll begin and a "final" folder that shows what the app will wind up looking like when it's complete. - -## Ready to start? - -[🚀 Let's go! 🚀](./tutorial-configure-project) diff --git a/docs/source/tutorial/tutorial-paginate-results.mdx b/docs/source/tutorial/tutorial-paginate-results.mdx deleted file mode 100644 index 1aec95ef5f..0000000000 --- a/docs/source/tutorial/tutorial-paginate-results.mdx +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: "8. Paginate results" ---- - -As you might have noticed, the object returned from the `LaunchListQuery` is a `LaunchConnection`. This object has a list of launches, a pagination cursor, and a boolean to indicate whether more launches exist. - -When using a cursor-based pagination system, it's important to remember that the cursor gives you a place where you can get all results after a certain spot, regardless of whether more items have been added in the interim. - -In the previous section, you hardcoded the `SMALL` size argument directly in the GraphQL query, but you can also define arguments programmatically using variables. You will use them here to implement pagination. - -## Add a `cursor` variable - -In `LaunchList.graphql`, add a `cursor` variable. In GraphQL, variables are prefixed with the dollar sign. - -```graphql title="LaunchList.graphql" -query LaunchList($cursor: String) { # highlight-line - launches(after: $cursor) { # highlight-line - hasMore - cursor - launches { - id - site - mission { - name - missionPatch(size: SMALL) - } - } - } -} -``` - -Now re-run code generation to update the GraphQL code. - -You can experiment with GraphQL variables in Sandbox Explorer by using the pane under the main body of the operation named **Variables**. If you omit the `$cursor` variable, the server returns data starting from the beginning: - -Explorer variables - -## Update `LaunchListViewModel` to use `cursor` - -First, you need to hang on to the most recently received `LaunchConnection` object. - -Add a variable to hold on to this object, as well as a variable for the most recent request, at the top of the `LaunchListViewModel.swift` file near your `launches` variable: - -```swift title="LaunchListViewModel.swift" -@Published var launches = [LaunchListQuery.Data.Launches.Launch]() -@Published var lastConnection: LaunchListQuery.Data.Launches? // highlight-line -@Published var activeRequest: Cancellable? // highlight-line -@Published var appAlert: AppAlert? -@Published var notificationMessage: String? -``` - -Next, let's update our `loadMoreLaunches()` method to use the `cursor` property as well as manage the `lastConnection` and `activeRequest` properties: - -```swift title="LaunchListViewModel.swift" -private func loadMoreLaunches(from cursor: String?) { // highlight-line - self.activeRequest = Network.shared.apollo.fetch(query: LaunchListQuery(cursor: cursor ?? .null)) { [weak self] result in // highlight-line - guard let self = self else { - return - } - - self.activeRequest = nil // highlight-line - - switch result { - case .success(let graphQLResult): - if let launchConnection = graphQLResult.data?.launches { - self.lastConnection = launchConnection// highlight-line - self.launches.append(contentsOf: launchConnection.launches.compactMap({ $0 })) - } - - if let errors = graphQLResult.errors { - self.appAlert = .errors(errors: errors) - } - case .failure(let error): - self.appAlert = .errors(errors: [error]) - } - } -} -``` - -Now implement the `loadMoreLaunchesIfTheyExist()` method to check if there are any launches to load before attempting to load them. Replace the `TODO` with the following code: - -```swift title="LaunchListViewModel.swift" -func loadMoreLaunchesIfTheyExist() { - guard let connection = self.lastConnection else { - self.loadMoreLaunches(from: nil) - return - } - - guard connection.hasMore else { - return - } - - self.loadMoreLaunches(from: connection.cursor) -} -``` - -## Update UI Code - -Next, go to `LaunchListView` and update our task to call the newly implemented `loadMoreLaunchesIfTheyExist()` method: - -```swift title="LaunchListView.swift" -.task { - viewModel.loadMoreLaunchesIfTheyExist() // highlight-line -} -``` - -Now update the `List` to optionally add a button to load more launches at the end of the list: - -```swift title="LaunchListView.swift" -List { - ForEach(0.. - -When you tap that row, the next set of launches will be fetched and loaded into the list. If you continue this process eventually the `Tap to load more` button will no longer be displayed because all launches have been loaded. - -Tap to load more - -Next, you'll [complete the details view](tutorial-complete-details-view) that will allow you to book a seat on a launch. diff --git a/docs/source/tutorial/tutorial-running-code-generation.mdx b/docs/source/tutorial/tutorial-running-code-generation.mdx deleted file mode 100644 index f8a024e0f0..0000000000 --- a/docs/source/tutorial/tutorial-running-code-generation.mdx +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: "4. Running code generation" ---- - -Now that we have both a schema and a query file, it's time to run code generation. To run code generation run the following command in Terminal from your project directory: - -```bash -./apollo-ios-cli generate -``` - -You should now see a new `RocketReserverAPI` folder in your project directory which contains the Swift package containing your generated source code. - -Generated swift package folder - -## Add the generated SPM package to your project - -With the code generated, next we need to add the generated SPM package to the project. - -> The default configuration for code generation creates a new Swift package for the schema module and operations. For more information on code generation such as different [module types](https://www.apollographql.com/docs/ios/code-generation/codegen-configuration#module-type) you can generate or [different ways to run code generation](https://www.apollographql.com/docs/ios/code-generation/run-codegen-in-swift-code) see the documentation. - -1. In Xcode go to **File > Add Packages...**, in the Add Package dialog select **Add Local...** - -Add local package - -2. Select the `RocketReserverAPI` folder in the file dialog, then click **Add Package** - -Add local package browser - -3. You should now see the `RocketReserverAPI` package included in your project - -Package in project hierarchy - -4. Next, in Xcode select the project, then the `RocketReserver` target, and go to **Build Phases**. Under the **Link Binary With Libraries** section click the **+** sign - -Link binary with libraries - -5. In the dialog that pops up, select the `RocketReserverAPI` library and click **Add** - -Link binary with libraries dialog - -## Examine the generated code - -In the Xcode project hierarchy, navigate to `RocketReserver/Packages/RocketReseverAPI/Sources/Operations/Queries/LaunchListQuery.graphql.swift`. It defines a root class, `LaunchListQuery`, with many nested structs below it. If you compare the structs to the JSON data returned in Sandbox Explorer, you see that the structure matches. These structs include properties only for the fields that your query requests. - -Try commenting out the `id` property in `LaunchList.graphql` using a `#`, saving, then running code generation again. When the code generation completes, the innermost `Launch` now only includes the built-in `__typename` and the requested `site` property. - -Uncomment `id` in `LaunchList.graphql` and re-run code generation to restore the property. - -Now that you've generated code and had a chance to see what's in there, it's time to get everything working end to end! Next, you will [Execute your first query.](tutorial-execute-first-query) \ No newline at end of file diff --git a/docs/source/tutorial/tutorial-subscriptions.mdx b/docs/source/tutorial/tutorial-subscriptions.mdx deleted file mode 100644 index ca882a940d..0000000000 --- a/docs/source/tutorial/tutorial-subscriptions.mdx +++ /dev/null @@ -1,175 +0,0 @@ ---- -title: "13. Write your first subscription" ---- - -In this section, you will use subscriptions to get notified whenever someone books a flight 🚀! [Subscriptions](https://graphql.org/blog/subscriptions-in-graphql-and-relay/) allow you to be notified in real time whenever an event happens on your server. The [fullstack backend](https://apollo-fullstack-tutorial.herokuapp.com/graphql) supports subscriptions based on [WebSockets](https://en.wikipedia.org/wiki/WebSocket). - -## Write your subscription - -Open your [Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com/graphql) back up, click on the Schema tab at the far left. In addition to `queries` and `mutations`, you will see a third type of operations, `subscriptions`. Click on subscriptions to see the `tripsBooked` subscription: - -The definition of tripsBooked in the schema - -This subscription doesn't take any arguments and returns a single scalar named `tripsBooked`. Since you can book multiple trips at once, `tripsBooked` is an `Int`. It will contain the number of trips booked at once or -1 if a trip has been cancelled. - -Click the play button to the far right of `tripsBooked` to open the subscription in Explorer. Open a new tab, then check the `tripsBooked` button to have the subscription added: - -The initial definition of the TripsBooked subscription - -Again, rename your subscription so it's easier to find: - -The subscription after rename - -Click the Submit Operation button, and your subscription will start listening to events. You can tell it's up and running because a panel will pop up at the lower right where subscription data will come in: - -The UI showing that it's listening for subscription updates - -## Test your subscription - -Open a new tab in Explorer. In this new tab, add code to book a trip like on [step 8](tutorial-mutations), but with a hard-coded ID: - -```graphql -mutation BookTrip { - bookTrips(launchIds: ["93"]){ - message - } -} -``` - -Do not forget to include the authentication header. At the bottom of the Sandbox Explorer pane where you add operations, there's a `Headers` section: - -Adding a login token to explorer - -Click the Submit Operation button. If everything went well, you just booked a trip! At the top of the right panel, you'll see the success JSON for your your `BookTrip` mutation, and below it, updated JSON for the `TripsBooked` subscription: - -Subscription success in Explorer - -Continue booking and/or canceling trips, you will see events coming in the subscription panel in real time. After some time, the server might close the connection and you'll have to restart your subscription to keep receiving events. - -## Add the subscription to your project - -Now that your subscription is working, add it to your project. Create an empty file named `TripsBooked.graphql` next to your other GraphQL files and paste the contents of the subscription. The process is similar to what you've already done for queries and mutations: - -```graphql title="TripsBooked.graphql" -subscription TripsBooked { - tripsBooked -} -``` - -Now run code generation in Terminal to generate the code for your subscription. - -## Configure your ApolloClient to use subscription - -In `Network.swift`, you'll need to set up a transport which supports subscriptions in addition to general network usage. In practice, this means adding a `WebSocketTransport` which will allow real-time communication with your server. - -First, at the top of the file, add an import for the **ApolloWebSocket** framework to get access to the classes you'll need: - -```swift title="Network.swift" -import ApolloWebSocket -``` - -Next, in the lazy declaration of the `apollo` variable, immediately after `transport` is declared, set up what you need to add subscription support to your client: - -```swift title="Network.swift" -private(set) lazy var apollo: ApolloClient = { - let client = URLSessionClient() - let cache = InMemoryNormalizedCache() - let store = ApolloStore(cache: cache) - let provider = NetworkInterceptorProvider(client: client, store: store) - let url = URL(string: "https://apollo-fullstack-tutorial.herokuapp.com/graphql")! - let transport = RequestChainNetworkTransport(interceptorProvider: provider, endpointURL: url) - - let webSocket = WebSocket( // highlight-line - url: URL(string: "wss://apollo-fullstack-tutorial.herokuapp.com/graphql")!, // highlight-line - protocol: .graphql_ws // highlight-line - ) // highlight-line - - let webSocketTransport = WebSocketTransport(websocket: webSocket) // highlight-line - - let splitTransport = SplitNetworkTransport( // highlight-line - uploadingNetworkTransport: transport, // highlight-line - webSocketNetworkTransport: webSocketTransport // highlight-line - ) // highlight-line - - return ApolloClient(networkTransport: splitTransport, store: store) // highlight-line -}() -``` - -What's happening here? - -1. You've created a web socket with the server's web socket URL - `wss://` is the protocol for a secure web socket. -2. You've created a `WebSocketTransport`, which allows the Apollo SDK to communicate with the web socket. -3. You've created a `SplitNetworkTransport`, which can decide whether to use a web socket or not automatically, with both the `RequestChainNetworkTransport` you had previously set up, and the `WebSocketTransport` you just set up. -4. You're now passing the `splitTransport` into the `ApolloClient`, so that it's the main transport being used in your `ApolloClient`. - -Now, you're ready to actually use your subscription! - -## Use your subscription - -To use the subscription you created, go to `LaunchListViewModel.swift` and start by adding a new variable to hold the subscription: - -```swift title="LaunchListViewModel.swift" -@Published var launches = [LaunchListQuery.Data.Launches.Launch]() -@Published var lastConnection: LaunchListQuery.Data.Launches? -@Published var activeRequest: Cancellable? -var activeSubscription: Cancellable? // highlight-line -@Published var appAlert: AppAlert? -@Published var notificationMessage: String? -``` - -Now, replace the `TODO` in the `startSubscription()` method with the following code: - -```swift title="LaunchListViewModel.swift" -func startSubscription() { - activeSubscription = Network.shared.apollo.subscribe(subscription: TripsBookedSubscription()) { [weak self] result in - guard let self = self else { - return - } - - switch result { - case .success(let graphQLResult): - if let tripsBooked = graphQLResult.data?.tripsBooked { - self.handleTripsBooked(value: tripsBooked) - } - - if let errors = graphQLResult.errors { - self.appAlert = .errors(errors: errors) - } - case .failure(let error): - self.appAlert = .errors(errors: [error]) - } - } -} -``` - -Next, update the TODO in the `init()` method to the following: - -```swift title="LaunchListViewModel.swift" -init() { - startSubscription()//highlight-line -} -``` - -Notice in `LaunchListView.swift` there is already a line to handle displaying a view from the subscription: - -```swift title="LaunchListView.swift" -.notificationView(message: $viewModel.notificationMessage) -``` - -## Test your subscription - -Build and run the application, now whenever a trip is booked or cancelled (from either in the app detail view or from the Sandbox Explorer) you should see a small notification pop up at the bottom of the screen: - -Subscription notification view - -Congratulations, you've completed the tutorial! - -## More resources - -There are way more things you can do with the Apollo iOS SDK, and the rest of this documentation includes info on more advanced topics like: - -- Using [fragments](../fragments/) -- Working with [custom scalars](../fetching-queries/#notes-on-working-with-custom-scalars) -- [Caching](../caching/) - -Feel free to ask questions by either [joining our Discord server](https://discord.gg/GraphOS) or [joining the Apollo GraphQL Forum](http://community.apollographql.com/new-topic?category=Help&tags=mobile,client). diff --git a/docs/source/tutorial/tutorial-write-your-first-query.mdx b/docs/source/tutorial/tutorial-write-your-first-query.mdx deleted file mode 100644 index 243642881c..0000000000 --- a/docs/source/tutorial/tutorial-write-your-first-query.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: "3. Write your first query" ---- - -The most common GraphQL operation is the **query**, which requests data from your graph in a structure that conforms to your server's schema. If you return to [the Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com/graphql) for your server, you can see available queries in the Schema Reference tab you opened earlier. - -Scroll down to the `launches` field to get details about it: - -Detail about launches field - -Here, you see both the query term itself, the return type, and information about parameters that can be passed to the query. You can use this information to write a query you'll eventually add to your app. - -To start working with this query in the Sandbox Explorer, select the "play" button to the right side of the information: - -Open in Explorer - -This brings you back into Sandbox's Explorer tab with the sidebar on the left showing documentation for the query you've selected: - -Docs open in the left sidebar - -Notice the small button next to the `launches` icon. Click this button to add the query to the middle "operations" panel: - -Click the button to add this query - -When the query is added, it will look like this: - -The query once it's been added to the Operations section - -Let's break down what you're seeing here: - -- The type of the operation, `query`, followed by the name of the operation, currently `Query` (we'll make that more specific in a second), is the outermost set of brackets. -- The next set of brackets contains the query's `selection set`. In GraphQL, the term `selection set` is the list of fields you want to fetch. Since the `arguments` for this query both have default values, they are not automatically added to the query for you. -- An error in the empty space between the brackets, which is where you'll put the list of information you want back from each launch. - -The Apollo iOS SDK requires every query to have a name (even though this isn't required by the GraphQL spec). Since you're going to be creating more than one query, it's also a good idea to give this operation a specific name other than `Query`. Change the name of the operation to `LaunchList`: - -Renaming the query - -Next, on the left hand side, you can select what fields you want back in the returned object. Start by clicking the button next to the `cursor` field. It will mark that field as selected, then insert it into your operations: - -After adding the cursor field. - -This is probably the easiest way to add fields to your object, since it knows how everything is spelled and what type everything is. - -However, you can also use auto-complete to help you with this. Add a newline below `cursor` in the Operations panel and start typing `ha`. An autocomplete box pops up and shows you options based on what's in the schema: - -Example of autocomplete - -The Sandbox Explorer is a great tool for building and verifying queries so you don't have to repeatedly rebuild your project in Xcode to try out changes. - -As the schema indicates, the `launches` query returns a `LaunchConnection` object. This object includes a list of launches, along with fields related to pagination (`cursor` and `hasMore`). The query you've written so far indicates exactly which fields of this `LaunchConnection` object you want to be returned. - -Run this query by pressing the "Submit Operation" button, which should now have the name of your query, `LaunchList`: - -Submit the operation - -You'll quickly see the query returns results as a JSON object on the right-hand side of the page: - -Query JSON in Sandbox Explorer - -This query executes successfully, but it doesn't include any information about the `launches`! That's because we didn't include the necessary field in the query. - -Click the button next to the `launches` field at the bottom of the left column. It will add a set of braces for `launches` to the operations section, and then move the documentation to show information for the `Launch` type: - -Status after adding launches field - -The fields you add in this set of brackets will be fetched for every launch in the list. Click the buttons next to `id` and `site` properties to add those two fields. When you're done, your operation should look like this: - -```graphql title="(Sandbox Explorer)" -query LaunchList { - launches { - cursor - hasMore - launches { - id - site - } - } -} -``` - -Run the operation again, and you'll now see that in addition to the information you got back before, you're also getting a list of launches with their ID and site information: - -Updated query JSON in Sandbox Explorer - -## Add the query to Xcode - -Now that your query is fetching the right data, it's time to add the query to Xcode. - -1. Right-click on the `graphql` folder in the project hierarchy and select **New File...** - -Updated query JSON in Sandbox Explorer - -2. Select the **Empty** file template, and click **Next** - -Empty file template - -3. Name the file `LaunchList.graphql`, ensure the file is being added to the `graphql` folder where your `schema.graphqls` file is. Finally, make sure the file is **not** being added to the app target, then click **Create** - -Don't add file to target - -4. Copy your final operation from Sandbox Explorer by selecting the three dot (aka "meatball") menu to the right of your operation name and selecting "Copy Operation": - -Copy operation from Explorer Sandbox - -5. Paste the copied operation into the `LaunchList.graphql` file. Your query file should now look like this: - -```graphql title="/graphql/LaunchList.graphql" -query LaunchList { - launches { - cursor - hasMore - launches { - id - site - } - } -} -``` - -You now have a query ready to use, in the next step you will be generating the graphql code by [Running code generation.](tutorial-running-code-generation) diff --git a/makefile b/makefile index c92e78d483..e5ff361020 100644 --- a/makefile +++ b/makefile @@ -1,31 +1,5 @@ -.PHONY: clean wipe build build-for-cocoapods test +default: unpack-cli -default: clean build - -clean: - swift package clean - -wipe: - rm -rf .build - -build: - swift build -c release - -build-cli: - swift build --product apollo-ios-cli -c release; \ - cp -f .build/release/apollo-ios-cli apollo-ios-cli - -build-cli-universal: - swift build --product apollo-ios-cli -c release --arch arm64 --arch x86_64; \ - cp -f .build/apple/Products/Release/apollo-ios-cli apollo-ios-cli - -build-cli-for-cocoapods: - swift build --product apollo-ios-cli -c release -Xswiftc -DCOCOAPODS - -archive-cli-for-release: - make build-cli-universal; \ - tar -czf apollo-ios-cli.tar.gz apollo-ios-cli; \ - echo "Attach apollo-ios-cli.tar.gz to the GitHub release" - -test: - swift test +unpack-cli: + (cd CLI && tar -xvf apollo-ios-cli.tar.gz -C ../) + chmod +x apollo-ios-cli diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index 93c1071b76..0000000000 --- a/netlify.toml +++ /dev/null @@ -1,19 +0,0 @@ -[build] - ignore = "exit 0" - -[build.environment] - NODE_VERSION = "16" - -[context.deploy-preview.build] - base = "docs" - ignore = "git diff --quiet HEAD^ HEAD ." - command = """\ - cd ../ - rm -rf monodocs - git clone https://github.com/apollographql/docs --branch main --single-branch monodocs - cd monodocs - npm i - cp -r ../docs local - DOCS_LOCAL=true npm run build \ - """ - publish = "../monodocs/public" diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 8ddf24ba19..0000000000 --- a/renovate.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "packageFiles": ["docs/package.json"], - "extends": [ - "apollo-docs" - ], - "labels": ["dependency-management"] -} diff --git a/screenshots/xcode-code-completion.png b/screenshots/xcode-code-completion.png deleted file mode 100644 index 5da9ea7e25..0000000000 Binary files a/screenshots/xcode-code-completion.png and /dev/null differ diff --git a/screenshots/xcode-data-access-error.png b/screenshots/xcode-data-access-error.png deleted file mode 100644 index b64ab2d265..0000000000 Binary files a/screenshots/xcode-data-access-error.png and /dev/null differ diff --git a/screenshots/xcode-query-validation.png b/screenshots/xcode-query-validation.png deleted file mode 100644 index 6056317c80..0000000000 Binary files a/screenshots/xcode-query-validation.png and /dev/null differ diff --git a/scripts/ensure-no-build-settings-in-pbxproj.sh b/scripts/ensure-no-build-settings-in-pbxproj.sh deleted file mode 100755 index eb21028de0..0000000000 --- a/scripts/ensure-no-build-settings-in-pbxproj.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -PROJECT_PATH=${1} -if [ -z "${PROJECT_PATH}" ]; then - echo "Project path not specified." - exit 1 -fi - -PROJECT_FILE_PATH="${PROJECT_PATH}/project.pbxproj" -NUMBER_OF_BUILD_SETTINGS=`grep "buildSettings" "$PROJECT_FILE_PATH" | wc -l` -NUMBER_OF_EMPTY_BUILD_SETTINGS=`grep -B 0 -A 1 "buildSettings" "$PROJECT_FILE_PATH" | grep "};" | wc -l` - -if [ $NUMBER_OF_BUILD_SETTINGS != $NUMBER_OF_EMPTY_BUILD_SETTINGS ]; then - NUMBER_WITH_SETTINGS=`expr $NUMBER_OF_BUILD_SETTINGS - $NUMBER_OF_EMPTY_BUILD_SETTINGS` - - echo "${PROJECT_PATH}: error: Found ${NUMBER_WITH_SETTINGS} build settings in Xcode project file. Build settings should only be defined in .xcconfig files." - exit 1 -fi diff --git a/scripts/get-version.sh b/scripts/get-version.sh index 7bead58d8e..a135fa8982 100755 --- a/scripts/get-version.sh +++ b/scripts/get-version.sh @@ -1,7 +1,8 @@ #!/bin/bash -source "$(dirname "$0")/version-constants.sh" +directory=$(dirname "$0") +source "$directory/version-constants.sh" -prefix="$VERSION_CONFIG_VAR = " -version_config=$(cat $VERSION_CONFIG_FILE) -echo "${version_config:${#prefix}}" +constantsFile=$(cat $directory/../$APOLLO_CONSTANTS_FILE) +currentVersion=$(echo $constantsFile | sed 's/^.*ApolloVersion: String = "\([^"]*\).*/\1/') +echo $currentVersion diff --git a/scripts/install-apollo-server-docs-example-server.sh b/scripts/install-apollo-server-docs-example-server.sh deleted file mode 100755 index db81cfc94c..0000000000 --- a/scripts/install-apollo-server-docs-example-server.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -cd $(dirname "$0")/../.. - -git clone https://github.com/apollographql/docs-examples.git - -cd docs-examples/apollo-server/v3/subscriptions-graphql-ws - -npm install diff --git a/scripts/install-node-v12.sh b/scripts/install-node-v12.sh deleted file mode 100755 index 013e8cf14c..0000000000 --- a/scripts/install-node-v12.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -touch $BASH_ENV -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash -echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV -echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV -echo nvm install v12.22.10 >> $BASH_ENV -echo nvm use v18.16.0 >> $BASH_ENV diff --git a/scripts/install-or-update-starwars-server.sh b/scripts/install-or-update-starwars-server.sh deleted file mode 100755 index 8e1678134a..0000000000 --- a/scripts/install-or-update-starwars-server.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -cd $(dirname "$0")/../.. - -git -C starwars-server pull || git clone https://github.com/apollographql/starwars-server - -cd starwars-server - -npm install -npm prune diff --git a/scripts/run-codegen.sh b/scripts/run-codegen.sh deleted file mode 100755 index 9e8e192e2d..0000000000 --- a/scripts/run-codegen.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cd $(dirname "$0")/../SwiftScripts - -swift run Codegen --package-type SPM diff --git a/scripts/run-test-codegen-configurations.sh b/scripts/run-test-codegen-configurations.sh deleted file mode 100755 index 27fa60a0f9..0000000000 --- a/scripts/run-test-codegen-configurations.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -test_projects=false - -while getopts 't' OPTION; do - case "$OPTION" in - t) - echo "[-t] used - each configuration will be tested" - echo - test_projects=true - ;; - ?) - echo "script usage: $(basename $0) [-t]" >&2 - exit 1 - ;; - esac -done -shift "$(($OPTIND -1))" - -cd $(dirname "$0")/../ -CodeGenConfigsDirectory="./Tests/TestCodeGenConfigurations" - -for dir in `ls $CodeGenConfigsDirectory`; -do - echo "-- Generating code for project: $dir --" - if swift run apollo-ios-cli generate -p $CodeGenConfigsDirectory/$dir/apollo-codegen-config.json; then - if [ "$test_projects" = true ]; then - echo -e "-- Testing project: $dir --" - cd $CodeGenConfigsDirectory/$dir - - if /bin/bash ./test-project.sh; then - echo -e "\n" - cd - > /dev/null - else - exit 1 - fi - fi - else - exit 1 - fi - - -done diff --git a/scripts/set-version.sh b/scripts/set-version.sh deleted file mode 100755 index 18e01719ac..0000000000 --- a/scripts/set-version.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -CURRENT_VERSION=$($(dirname "$0")/get-version.sh) - -# Set configuration file version constant - -source "$(dirname "$0")/version-constants.sh" - -NEW_VERSION="$1" - - if [[ ! $NEW_VERSION =~ ^[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2} ]]; then - echo "You must specify a version in the format x.x.x" - exit 1 - fi - -echo "$VERSION_CONFIG_VAR = $NEW_VERSION" > $VERSION_CONFIG_FILE - -# Set CLI version constant - -MATCH_TEXT='CLIVersion: String = "' -SEARCH_TEXT="$MATCH_TEXT$CURRENT_VERSION" -REPLACE_TEXT="$MATCH_TEXT$NEW_VERSION" -sed -i '' -e "s/$SEARCH_TEXT/$REPLACE_TEXT/" $CLI_CONSTANTS_FILE - -# Feedback -echo "Committing change from version $CURRENT_VERSION to $NEW_VERSION" -git add -A && git commit -m "Updated version numbers" diff --git a/scripts/version-constants.sh b/scripts/version-constants.sh index 19b69e8036..eaedbb262e 100644 --- a/scripts/version-constants.sh +++ b/scripts/version-constants.sh @@ -1,3 +1 @@ -VERSION_CONFIG_VAR="CURRENT_PROJECT_VERSION" -VERSION_CONFIG_FILE="Configuration/Shared/Project-Version.xcconfig" -CLI_CONSTANTS_FILE="Sources/CodegenCLI/Constants.swift" +APOLLO_CONSTANTS_FILE="Sources/Apollo/Constants.swift"